User Tools

Site Tools


api:dk11:delphi:gistopology.tgis_topology.splitbyarc_tgis_shape_tgis_shapearc_boolean

TGIS_Topology.SplitByArc(TGIS_Shape; TGIS_ShapeArc; Boolean) method

DK11 for Delphi | GisTopology.TGIS_Topology.SplitByArc | Overloads | Constructors | Methods | Properties | Events

Divide an input shape (polygon, arc or multipoint) into a row of shapes along a given line, otherwise return a copy of the shape when the line doesn't divide it.

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

Syntax

// Delphi
public
  function SplitByArc(
    const _shape : TGIS_Shape;
    const _arc : TGIS_ShapeArc;
    const _fixshape : Boolean
  ) : TGIS_ObjectList; overload;
// C++ Builder
public:
  TGIS_ObjectList* SplitByArc(
    TGIS_Shape* const _shape,
    TGIS_ShapeArc* const _arc,
    const bool _fixshape
  ) /* overload */;

Parameters

Name Type Description
_shape TGIS_Shape a shape to divide
_arc TGIS_ShapeArc dividing line
_fixshape Boolean if True, then checks and eventually fixes the input shape for common topological problems, like self-crossings, overlapped parts etc.

Result

Type Description
TGIS_ObjectList returns list of shapes divided by arc

Example

Delphi

var
  layerObj : TGIS_LayerVector ;    //layer for new shapes
 
procedure MyClass.SplitByArc (Sender: TObject);
var
  n            : Integer;
  shape_list   : TList;
  topology_obj : TGIS_Topology ;
begin
  layerObj.RevertAll ;
  topology_obj := TGIS_Topology.Create ;
  try
    shape_list := topology_obj.SplitByArc (shpPolygon, shpArc, True);
    if assigned( shape_list ) then begin
      Randomize ;
      for n := 0 to shape_list.Count - 1 do begin
        TGIS_Shape( shape_list.Items[ n ] ).Params.Area.Color := Random( 255 ) * 256 * 256 +
                                                                 Random( 255 ) * 256 + Random( 256 ) ;
        layerObj.AddShape( shape_list.Items[ n ] ) ;
      end;
      shape_list.Free;
    end;
  finally
    topology_obj.Free ;
  end ;
  GIS.Update ;
end;

References

2023/03/24 01:21

Page Tools