ArcGIS Explorer Component Help |
GeometryOperations..::.Rotate Method (Geometry, Point, Double, Unit) |
GeometryOperations Class Example See Also |
Returns a new Geometry which is a copy of the input Geometry rotated by the specified angle in the specified angular units,
using the specified Point as the origin of rotation.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static Geometry Rotate( Geometry inputGeometry, Point origin, double rotateAngle, Unit unit ) |
Visual Basic (Declaration) |
---|
Public Shared Function Rotate ( _ inputGeometry As Geometry, _ origin As Point, _ rotateAngle As Double, _ unit As Unit _ ) As Geometry |
Parameters
- inputGeometry
- Type: ESRI.ArcGISExplorer.Geometry..::.Geometry
The Geometry to copy and rotate.
- origin
- Type: ESRI.ArcGISExplorer.Geometry..::.Point
A Point to use as the origin of rotation.
- rotateAngle
- Type: System..::.Double
The angle by which to rotate the geometry, in unit units.
- unit
- Type: ESRI.ArcGISExplorer.Geometry..::.Unit
The units of the rotateAngle. Must be an Angular unit.
Return Value
A new Geometry of the same type as the inputGeometry, rotated by the specified angle.Remarks
This overload of the Rotate method allows you to rotate a geometry around a point of origin other than the center of the Geometry; using this overload may result in the geometry changing location if the origin is far from the center point of the geometry.
The unit parameter allows you to specify rotation in an angular unit other than radians, for example you can rotate a geometry by 90 degrees.
Examples
The code below gets the Note currently selected, and uses the GeometryOperations class to
rotate the Geometry of the Graphic of the Note.
The code assumes you have using statements for the Application, Geometry and Mapping namespaces.
CopyC#
SelectedItemsCollection selItems = ESRI.ArcGISExplorer.Application.Application.SelectedItems; if ((selItems.Count == 1) && (selItems[0] is Note)) { Note selected = selItems[0] as Note; // Rotate the geometry Geometry rotated = GeometryOperations.Rotate(selected.Graphic.Geometry, 90, Unit.Angular.Degrees); // Alternatively, specify rotation in radians, e.g. // Geometry rotated = GeometryOperations.Rotate(selected.Graphic.Geometry, 1.570796); // Update the geometry of the graphic. selected.Graphic.Geometry = rotated; }
CopyVB.NET
Dim selItems As SelectedItemsCollection = ESRI.ArcGISExplorer.Application.Application.SelectedItems If selItems.Count = 1 AndAlso TypeOf selItems(0) Is Note Then Dim selected As Note = selItems(0) Dim rotated As Geometry = GeometryOperations.Rotate(selected.Graphic.Geometry, 90, Unit.Angular.Degrees) ' Alternatively, specify rotation in radians, e.g. ' Dim rotated As Geometry = GeometryOperations.Rotate(selected.Graphic.Geometry, 1.570796) selected.Graphic.Geometry = rotated End If