User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_shape.create_void

Table of Contents

TGIS_Shape.Create constructor

DK11 for Delphi | GisLayerVector.TGIS_Shape.Create | Overloads | Constructors | Fields | Methods | Properties

Create a shape instance.

Available also on: .NET | Java | Python.

Syntax

// Delphi
public
  constructor Create; overload; virtual;
// C++ Builder
Create (void);

Remarks

For usage TGIS_LayerVector.CreateShape method is recommended instead.

Use this method to create a shape. Internally it calls Recreate method.

Example

This is a simple procedure showing how to add a shape to the layer.

Delphi

// some declarations
const
  WKTText='POLYGON((15 15,25 15,25 25,15 25,15 15),(10 10,10 20,20 20,20 10,10 10))';
var
  layerObj : TGIS_LayerVector ;
 
procedure MyClass.AddShape();
var
  shp, shp2 : TGIS_Shape;
begin
  // set the original layer form
  layerObj.RevertAll;
 
  // let's create new shapes
  shp:= TGIS_Shape.Create(nil,nil,false,-1,layerObj);
  shp2:=TGIS_Shape.Create(nil,nil,false,-1,layerObj);
  try
    // make a duplicate
    shp2.Recreate(shp,nil,false,-1,layerObj);
    // and try build it from WKT string on the layer
    layerObj.AddShape( shp.CreateFromWKT(WKTText) );
  finally
    shp.Free;
    shp2.Free;
  end;
 
  // let's see the results
  GIS.FullExtent;
end;
2022/11/16 01:22

Page Tools