User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_shape.lock_tgis_lock



TGIS_Shape.Lock method

DK for Delphi | GisLayerVector.TGIS_Shape.Lock | Constructors | Fields | Methods | Properties

Locks the shape for batch geometry updates to defer expensive recalculations.

Available also on: .NET | Java | ActiveX | Python.

Syntax

// Delphi
public
  procedure Lock(
    const _lock : TGIS_Lock
  ); virtual;
// C++ Builder
public:
  virtual void Lock(
    TGIS_Lock* const _lock
  );

Parameters

Name Type Description
_lock TGIS_Lock lock mode controlling which cached geometry state is deferred

Remarks

PURPOSE: Improves performance during bulk editing by postponing extent and related geometry updates until unlocking.

BEHAVIOR: Prevents immediate recalculation of selected cached values while points or parts are being modified. The exact deferred state depends on the _lock mode.

CONSTRAINTS: Must be paired with a later Unlock call to restore normal update behavior.

Example

Delphi

procedure MyForm.FormCreate();
var
  shp : TGIS_Shape;
  lk : TGIS_LayerVector;
begin
  // let's create a new layer
  lk:=TGIS_LayerVector.Create;
  GIS.Add(lk);
 
  // let's create a new shape on our layer
  shp := lk.CreateShape( TGIS_ShapeType.Point ) ;
 
  // if successfully, let's lock, edit and unlock our shape
  if assigned( shp ) then begin
    shp.Lock( TGIS_Lock.Extent ) ;
    shp.AddPart ;
    shp.AddPoint( GisPoint( 3,3 ) ) ;
    shp.Params.Area.Color:=clBlack;
    shp.Unlock ;
  end;

References

2026/07/11 00:38

Page Tools