User Tools

Site Tools


api:dk11:delphi:gislayerpixel.tgis_layerpixel.loop_double_tgis_shape_boolean

TGIS_LayerPixel.Loop(Double; TGIS_Shape; Boolean) method

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

Prepares enumerator to iterate the layer through the linear shape. Lines are interpreted as-line-flow for terrain profile like analysis. Pixels are treated as points.

Available also on: .NET | Java | ActiveX.

Syntax

// Delphi
public
  function Loop(
    const _pixelsize : Double;
    const _shape : TGIS_Shape;
    const _writable : Boolean
  ) : TGIS_LayerPixelEnumeratorFactory; overload; virtual;
// C++ Builder
public:
  virtual TGIS_LayerPixelEnumeratorFactory* Loop(
    const double _pixelsize,
    TGIS_Shape* const _shape,
    const bool _writable
  ) /* overload */;

Parameters

Name Type Description
_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 within the shape will be found
_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 with the except:<list type=“bullet”><item>if _shape is liner then pixel are returned as-line-flow order.</item><item>if _shape is point or multi-point then pixels are returned in a point-by-point order</item></list>

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

_shape

If provided _shape is polygonal then a standard test will be performed and only pixels within polygon will be returned row by row, column by column. But if provided shape is a line or point or multi-point then pixels will be for a touch relationship with shape. Furthermore for line points will be returned as line flow, and TGIS_PixelItem.Distance will be filled accordingly which allow analyses like a terrain profile across line.

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

2020/05/07 01:08