User Tools

Site Tools


api:dk11:delphi:gislayerpixel.tgis_layerpixel.loop_tgis_extent_double_tgis_shape_string_integer_boolean

TGIS_LayerPixel.Loop(TGIS_Extent; Double; TGIS_Shape; String; Integer; Boolean) method

DK11 for Delphi | GisLayerPixel.TGIS_LayerPixel.Loop | Overloads | Constructors | Fields | Methods | Properties | Events

Prepares enumerator to iterate the layer (pixels are treated as points).

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

Syntax

// Delphi
public
  function Loop(
    const _extent : TGIS_Extent;
    const _pixelsize : Double;
    const _shape : TGIS_Shape;
    const _de9im : String;
    const _band : Integer;
    const _writable : Boolean
  ) : TGIS_LayerPixelEnumeratorFactory; overload; virtual;
// C++ Builder
public:
  virtual TGIS_LayerPixelEnumeratorFactory* Loop(
    TGIS_Extent* const _extent,
    const double _pixelsize,
    TGIS_Shape* const _shape,
    const UnicodeString _de9im,
    const int _band,
    const bool _writable
  ) /* overload */;

Parameters

Name Type Description
_extent TGIS_Extent extent of items to be found; expected _extent units are in a Layer coordinate space
_pixelsize Double minimum requested size of image pixel; by providing 0 a maximum possible resolution will be used, which is also a fastest method if a layer is full in-memory because in such situation a pointer to existing memory will be used
_shape TGIS_Shape if not nil, then only pixels matching _de9im matrix with be found;
_de9im String DE-9IM matrix of comparison
_band Integer band specification
  1. 0 - if default Loop must be used; in such bands are interpreted as image or grid depends or layer; Color or Value are filled accordingly
  2. number of specific band; in such situation only Bands property is filled
  3. -1 - all bands are retrieved; only Bands property is filled
_writable Boolean if true than layer will post back any changes in locked area; if write is not possible then TGIS_PixelItem.Writable will be set accordingly

Result

Type Description
TGIS_LayerPixelEnumeratorFactory Pixel item returned row by row, column by column.

Remarks

_pixelsize

By providing _pixelsize=0, a native layer resolution is requested. This is also the fastest method if a layer is fully in-memory because, in such situation, a pointer to existing memory is used

Example

General way to query for terrain profile:

foreach (TatukGIS.NDK.TGIS_PixelItem px in lp.Loop(0, line, false))
{
  Memo.AppendText(
    String.Format("Distance: {0}, Height:{1}\r\n", px.Distance, px.Value)
  );
}

General way to query for pixels within polygon and modifying value:

foreach (TGIS_PixelItem px in lp.Loop(polygon.Extent, 0, polygon, "T", true))
{
  px.Color = TGIS_Color.Red;
}

References

2022/11/16 01:19

Page Tools