ArcGIS Explorer Component Help |
GeometryOperations..::.Scale Method (Geometry, Double, Double) |
GeometryOperations Class Example See Also |
Returns a new Geometry which is a copy of the input Geometry scaled by the specified factors along the x and y axis,
around the center of the geometry.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static Geometry Scale( Geometry inputGeometry, double scaleX, double scaleY ) |
Visual Basic (Declaration) |
---|
Public Shared Function Scale ( _ inputGeometry As Geometry, _ scaleX As Double, _ scaleY As Double _ ) As Geometry |
Parameters
- inputGeometry
- Type: ESRI.ArcGISExplorer.Geometry..::.Geometry
The Geometry to copy and scale.
- scaleX
- Type: System..::.Double
The factor by which to scale the geometry along the x-axis.
- scaleY
- Type: System..::.Double
The factor by which to scale the geometry along the y-axis.
Return Value
A new Geometry of the same type as the inputGeometry, scaled by the specified factors.Remarks
The point of origin used for the operation is the center of the extent of the geometry; both the minimum and maximum X and Y coordinates of the geometry will change equally.
You can use this overload of the Scale method to resize a geometry and change the aspect ratio; the geometry is stretched by different factors along both the x and y axis. You can use the Scale(Geometry, Double) overloads to scale a geometry around its center point and maintain the aspect ratio.
Examples
The code below gets the Note currently selected, and uses the GeometryOperations class to
scale the Geometry of the Graphic of the Note along the x-axis by a factor of 2, keeping the
y-axis length the same, producing a stretched geometry.
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; // Specify a scale with two factors to change the aspect ratio of the geometry. Geometry stretched = GeometryOperations.Scale(selected.Graphic.Geometry, 2, 1); // Update the geometry of the graphic. selected.Graphic.Geometry = stretched; }
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) ' Specify a scale with two factors to change the aspect ratio of the geometry. Dim stretched As Geometry = GeometryOperations.Scale(selected.Graphic.Geometry, 2, 1) ' Update the geometry of the graphic. selected.Graphic.Geometry = stretched End If