DK for Delphi | GisLayerVector.TGIS_Shape.Transform | Overloads | Constructors | Fields | Methods | Properties
Transforms shape geometry using a 3x3 matrix and translation vector, either in place or as a new shape.
// Delphi public function Transform( const _origin : TGIS_Point3D; const _m11 : Double; const _m12 : Double; const _m13 : Double; const _m21 : Double; const _m22 : Double; const _m23 : Double; const _m31 : Double; const _m32 : Double; const _m33 : Double; const _dx : Double; const _dy : Double; const _dz : Double; const _returnnewobj : Boolean ) : TGIS_Shape; overload;
// C++ Builder public: TGIS_Shape* Transform( TGIS_Point3D* const _origin, const double _m11, const double _m12, const double _m13, const double _m21, const double _m22, const double _m23, const double _m31, const double _m32, const double _m33, const double _dx, const double _dy, const double _dz, const bool _returnnewobj ) /* overload */;
| Name | Type | Description |
|---|---|---|
| _origin | TGIS_Point3D | Origin point used as the transformation pivot. |
| _m11 | Double | Matrix element [1,1]. |
| _m12 | Double | Matrix element [1,2]. |
| _m13 | Double | Matrix element [1,3]. |
| _m21 | Double | Matrix element [2,1]. |
| _m22 | Double | Matrix element [2,2]. |
| _m23 | Double | Matrix element [2,3]. |
| _m31 | Double | Matrix element [3,1]. |
| _m32 | Double | Matrix element [3,2]. |
| _m33 | Double | Matrix element [3,3]. |
| _dx | Double | Translation offset applied in the X direction. |
| _dy | Double | Translation offset applied in the Y direction. |
| _dz | Double | Translation offset applied in the Z direction. |
| _returnnewobj | Boolean | If True, returns a new transformed shape; if False, modifies the current shape and returns it. |
| Type | Description |
|---|---|
| TGIS_Shape | The transformed shape instance according to _returnnewobj. |
PURPOSE: Applies affine or general linear transformation to shape geometry with control over whether the operation creates a new object or updates the existing shape.
BEHAVIOR: Transforms coordinates relative to _origin using the supplied matrix and translation values. When _returnnewobj is True, the original shape is unchanged; otherwise the current shape is modified in place.
CONSTRAINTS: Callers must account for object ownership when _returnnewobj is True. In-place transformation permanently changes the current geometry.
Rotate shape by 30 degrees
procedure TfrmMain.rotateShape( const _shp : TGIS_Shape ) ; var angle : Double ; center : TGIS_Point3D ; begin angle := -DegToRad( 30 ) ; center.X := shp.Extent.XMin + ( shp.Extent.XMax - shp.Extent.XMin ) / 2 ; center.Y := shp.Extent.YMin + ( shp.Extent.YMax - shp.Extent.YMin ) / 2 ; center.Z := 0 ; _shp.Transform( center, Cos( angle ), Sin( angle ), 0, -Sin( angle ), Cos( angle ), 0, 0 , 0 , 1, // 3D 0 , 0 , 0 // shift ) ; _shp.Invalidate ;