ITransform2D Interface

Provides access to methods for transforming geometries using either specific parameters or arbitrary transformation objects (affine transformations, geographic transformations, etc.).

When To Use

ITransform2D is a generic interface implemented by most elements and geometries (i.e., CircleElement, FrameElement, Point, Line, Polygon, etc.). Use this interface when you want to update the position of the element or geometry through some type of Euclidan 2D transformation opertion (move, rotate, scale, or transform).

Members

Name Description
Method Move Moves dx units horizontally and dy units vertically.
Method MoveVector Moves a direction and distance v. v can be in a different spatial reference than the geometry being moved.
Method Rotate Rotates about the specified origin point. The angle is in radians. The origin can be in a different spatial reference than the geometry being rotated.
Method Scale Scales about the specified origin using seperate horizonal and vertical scales. The origin point can be in a different spatial reference than the geometry being scaled.
Method Transform Applies an arbitrary transformation. In particular, the transformation parameter can be either an affine transformation or a geographic transformation (datum shift).

ITransform2D.Move Method

Moves dx units horizontally and dy units vertically.

Public Sub Move ( _
    ByVal dx As Double, _
    ByVal dy As Double _
)
public void Move (
    double dx,
    double dy
);

Description

Moves the Geometry dX units along the X-Axis and dY units along the Y-Axis. Only changes the position of the Geometry without altering any of the other characteristics. Move is a spatial offset.

Remarks

Transform2D Move Example

ITransform2D.MoveVector Method

Moves a direction and distance v. v can be in a different spatial reference than the geometry being moved.

Public Sub MoveVector ( _
    ByVal v As ILine _
)
public void MoveVector (
    ILine v
);

Description

Moves the Geometry dX units along the X-Axis and dY units along the Y-Axis, where dX and dY are calculated from the input vector Line. Only the Length and Angle of the vector affect the transformation. The location of the vector does not change the transformation. Only changes the position of the Geometry without altering any of the other characteristics. Move is a spatial offset.

Remarks

Transform2D MoveVector Example

ITransform2D.Rotate Method

Rotates about the specified origin point. The angle is in radians. The origin can be in a different spatial reference than the geometry being rotated.

Public Sub Rotate ( _
    ByVal Origin As IPoint, _
    ByVal rotationAngle As Double _
)
public void Rotate (
    IPoint Origin,
    double rotationAngle
);

Description

Rotate performs an angular transform (rotation) on the Geometry. The Origin is the only point in the transformation guaranteed to remain in the same location after the transformation is performed. Regardless of the Origin, the transformed Geometry is the same, except for a positional offset. The RotationAngle is measured in radians.

Remarks

An Envelope cannot be Rotated.

Transform2D Rotate Example

ITransform2D.Scale Method

Scales about the specified origin using seperate horizonal and vertical scales. The origin point can be in a different spatial reference than the geometry being scaled.

Public Sub Scale ( _
    ByVal Origin As IPoint, _
    ByVal sx As Double, _
    ByVal sy As Double _
)
public void Scale (
    IPoint Origin,
    double sx,
    double sy
);

Description

Stretches the Geometry a factor of sX along the X-Axis and a factor of sY along the Y-Axis (where sX is the ratio of Old Width to New Width, and sY is the ratio of Old Height to New Height). The Origin point is the reference Point from which the transformation is performed (Regardless of the location of the Origin point, the Geometry resulting from the transformation is the same, except for a positional offset). The Origin is the only point in the transformation guaranted to remain in the same location after the transformation is complete.

Remarks

Note: Caution must be taken when scaling a CircularArc or a geometry containing CircularArc segments. Unless Abs(ScaleX) = Abs(ScaleY), the resulting CircularArcs will not retain the characteristics of the original geometry (since they remain CircularArcs).

Scale Example

//Create Point you wish to scale 

            IPoint startingPoint = new PointClass() as IPoint;

            startingPoint.PutCoords(10, 10);

            //Create a point to act as origin

            IPoint origin = new PointClass() as IPoint;

            origin.PutCoords(15, 15);

            //Cast the startingPoint into the correct Interface

            ITransform2D transformScalePoint = startingPoint as ITransform2D;

            //Perform Scale 

            transformScalePoint.Scale(origin, .5, .5);

            double x;

            double y;

            startingPoint.QueryCoords(out x, out y);

            Debug.Print(x.ToString());

            Debug.Print(y.ToString());

ITransform2D.Transform Method

Applies an arbitrary transformation. In particular, the transformation parameter can be either an affine transformation or a geographic transformation (datum shift).

Public Sub Transform ( _
    ByVal Direction As esriTransformDirection, _
    ByVal Transformation As ITransformation _
)
public void Transform (
    esriTransformDirection Direction,
    ITransformation Transformation
);

Classes that implement ITransform2D

Classes Description
BezierCurve A cubic Bezier curve defined between two points; optionally has measure, height and ID attributes at each endpoint.
CircularArc A portion of a circle that connects two points optionally has measure, height and ID attributes at each endpoint.
EllipticArc A portion of the boundary of a 2D ellipse that connects two points; optionally has measure, height and ID attributes at each endpoint.
Envelope A rectangle with sides parallel to a coordinate system defining the extent of another geometry; optionally has min and max measure, height and ID attributes.
GeometryBag An ordered collection of objects that support the IGeometry interface.
Line A 2D straight line between a pair of 2D endpoints; can optionally have height, measure and ID attributes at each endpoint.
MultiPatch A collection of surface patches.
Multipoint An ordered collection of points; optionally has measure, height and ID attributes.
Path A sequence of connected segments.
Point A two dimensional point, optionally with measure, height, and ID attributes.
Polygon A collection of rings ordered by their containment relationship; optionally has measure, height and ID attributes.
Polyline An ordered collection of paths; optionally has measure, height and ID attributes.
Ring An area bounded by one, closed sequence of connected segments; optionally has measure, height and ID attributes at each vertex.
TriangleFan A continuous 3D fan of triangles, where each triangle after the first shares an edge with the preceding triangle, and all triangles share a common pivot point.
Triangles A collection of 3D triangles, where each consecutive triplet of vertices defines a new triangle
TriangleStrip A continuous 3D strip of triangles, where each triangle after the first shares an edge with the preceding triangle.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.