TdxMapLayers.Add(TdxMapLayerClass) Method
Creates a map layer of a specified type and appends it to the collection.
Declaration
function Add(AItemClass: TdxMapLayerClass): TdxMapLayer;
Parameters
Name | Type |
---|---|
AItemClass | TdxMapLayerClass |
Returns
Type |
---|
TdxMapLayer |
Remarks
AItemClass specifies the class of map layer to be created. Pass a built-in map layer class (TdxMapImageTileLayer, TdxMapItemFileLayer, or TdxMapItemLayer) or a custom one (a TdxMapLayer descendant) as this parameter. The created map layer is returned as the function’s result.
The following code example shows how to add an item file layer to a map control using the Add method and load data from an Esri shapefile to this layer.
uses
..., dxMapItemFileLayer;
var
AMapItemFileLayer: TdxMapItemFileLayer;
begin
AMapItemFileLayer := TdxMapItemFileLayer(<dxMapControl>.Layers.Add(TdxMapItemFileLayer));
AMapItemFileLayer.FileType := miftShape;
AMapItemFileLayer.LoadFromFile('Countries.shp');
end;
In addition to the Add method, you can create specific built-in map layers using a map control’s AddImageTileLayer, AddItemFileLayer, and AddItemLayer functions.
See Also