User Tools

Site Tools


api:dk11:delphi:gislayervector.tgis_layervector.loop_tgis_extent_string

TGIS_LayerVector.Loop(TGIS_Extent; String) method

DK11 for Delphi | GisLayerVector.TGIS_LayerVector.Loop | Overloads | Constructors | Fields | Methods | Properties | Events

Prepare enumerator (also known as iterator or cursor) to iterate layer.

Available also on: .NET | Java | ActiveX.

Syntax

// Delphi
public
  function Loop(
    const _extent : TGIS_Extent;
    const _query : String
  ) : TGIS_LayerVectorEnumeratorFactory; overload; virtual;
// C++ Builder
public:
  virtual TGIS_LayerVectorEnumeratorFactory* Loop(
    TGIS_Extent* const _extent,
    const UnicodeString _query
  ) /* overload */;

Parameters

Name Type Description
_extent TGIS_Extent extent of items to be found; expected _extent units are in a Layer coordinate space
_query String query which must be matched by item; closely mimics SQL WHERE clause; for examples you can use 'AGE >= 18'; empty (default) means that no items will match.

Result

Type Description
TGIS_LayerVectorEnumeratorFactory Shape itself or nil.

Example

Delphi

// Indirect use
var
  shp : TGIS_Shape ;
begin
  // automated enumerators
  for shp in layer.Loop( some_extent,
                         'POPULATION>100000 AND AREA>50333'
                       ) do
  begin
    dosomething();
  end ;
end ;
 
// Direct enumerator use
var
  shp : TGIS_Shape ;
  en  : TGIS_LayerVectorEnumerator ;
begin
  en := layer.Loop( some_extent,
                    'POPULATION>100000 AND AREA>50333'
                  ).GetEnumerator ;
  while en.MoveNext do begin
    shp := en.GetCurrent ;
    dosomething();
  end ;
  en.Free ;
end ;

C++ Builder

// Indirect use
// Indirect use is not possible due to C++ limitation
 
// Direct enumerator use
TGIS_LayerVectorEnumerator *en;
 
en = layer->Loop(some_extent,"POPULATION>100000 AND AREA>50333")->GetEnumerator() ;
while (en->MoveNext()) 
{
  shp = en->Current;
  dosomething();
}
delete en;

References

2019/08/13 10:50