Skip to main content

TdxCustomMapItemLayer.AddItem(TdxMapItemClass) Method

Creates a map item of a specified type and appends it to the layer’s MapItems collection.

Declaration

function AddItem(AMapItemClass: TdxMapItemClass): TdxMapItem;

Parameters

Name Type
AMapItemClass TdxMapItemClass

Returns

Type
TdxMapItem

Remarks

AMapItemClass specifies the class of map item to be created. Pass any of the built-in map item classes listed in the TdxMapItem class description or a custom one (a TdxMapItem descendant) as this parameter. The created map item is returned as the function’s result.

The following code example shows how to create an item layer, add a pushpin to it using the AddItem method, and specify the pushpin’s label text.

uses
   ..., dxMapItemLayer, dxMapItem;
var
  AMapItemLayer: TdxMapItemLayer;
  APushpin: TdxMapPushpin;
begin
  AMapItemLayer := <dxMapControl>.AddItemLayer();
  APushpin := TdxMapPushpin(AMapItemLayer.AddItem(TdxMapPushpin));
  APushpin.Text := 'You are here';
end;
See Also