Back to Devexpress

TdxCustomMapItemLayer.AddItem(TdxMapItemClass) Method

vcl-dxcustommapitemlayer-dot-tdxcustommapitemlayer-dot-additem-x28-dxmapitem-dot-tdxmapitemclass-x29.md

latest1.6 KB
Original Source

TdxCustomMapItemLayer.AddItem(TdxMapItemClass) Method

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

Declaration

delphi
function AddItem(AMapItemClass: TdxMapItemClass): TdxMapItem;

Parameters

NameType
AMapItemClassTdxMapItemClass

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.

delphi
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

TdxMapItems.Add

TdxCustomMapItemLayer Class

TdxCustomMapItemLayer Members

dxCustomMapItemLayer Unit