ArcGIS Explorer Component Help |
GeometryOperations..::.Scale Method (Geometry, Double, Double, Point) |
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,
using the specified Point of origin..
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, Point origin ) |
Visual Basic (Declaration) |
---|
Public Shared Function Scale ( _ inputGeometry As Geometry, _ scaleX As Double, _ scaleY As Double, _ origin As Point _ ) 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.
- origin
- Type: ESRI.ArcGISExplorer.Geometry..::.Point
A Point to use as the origin of the scale operation.
Return Value
A new Geometry of the same type as the inputGeometry, scaled by the specified factors.Remarks
You can use this overload of the Scale method to resize a geometry around a specified point of origin, and also 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, Point) overloads to scale a geometry around a specified 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 by a factor of 2 using the bottom-left corner of the
geometry's extent as the origin of the operation; this means the minimum X and Y coordinates of the
geometry remain the same and the maximum X and Y coordinates change.
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; // Get the bottom-left corner of the geometry. Geometry geom = selected.Graphic.Geometry; Envelope env = geom.GetEnvelope(); ESRI.ArcGISExplorer.Geometry.Point bottomLeft = new ESRI.ArcGISExplorer.Geometry.Point(env.XMin, env.YMin); // Scale the geometry maintaining the aspect ratio, and using the bottom-left point as the origin Geometry scaled = GeometryOperations.Scale(geom, 2, bottomLeft); // Alternatively, scale with different x and y factors to change the aspect ratio. // Geometry scaled = GeometryOperations.Scale(geom, 2, 1, bottomLeft); // Update the geometry of the graphic. selected.Graphic.Geometry = scaled; }
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) ' Get the bottom-left corner of the geometry. Dim geom As Geometry = selected.Graphic.Geometry Dim env As Envelope = geom.GetEnvelope() Dim bottomLeft As ESRI.ArcGISExplorer.Geometry.Point = New ESRI.ArcGISExplorer.Geometry.Point(env.XMin, env.YMin) ' Scale the geometry maintaining the aspect ratio, and using the bottom-left point as the origin Dim scaled As Geometry = GeometryOperations.Scale(geom, 2, bottomLeft) ' Alternatively, scale with different x and y factors to change the aspect ratio. ' Dim scaled As Geometry = GeometryOperations.Scale(geom, 2, 1, bottomLeft) ' Update the geometry of the graphic. selected.Graphic.Geometry = scaled End If