TdxMapLayers.Add(TdxMapLayerClass) Method
Creates a map layer of the required type and adds the layer to the collection.
Declaration
function Add(AItemClass: TdxMapLayerClass): TdxMapLayer;
Parameters
Name | Type | Description |
---|---|---|
AItemClass | TdxMapLayerClass | The reference to the required map layer class. |
Returns
Type | Description |
---|---|
TdxMapLayer | The created map layer. To access all public API members of the created map layer, cast the returned object to the corresponding terminal TdxMapLayer class descendant ( |
Remarks
Call the Add
function to create any supported map layer and add it to the collection.
Code Example: Add a Tile Map Layer and Load Azure Maps Data
The following code example implements a procedure that accepts an Azure Maps account key, creates and configures a map tile layer, and loads data:
uses
dxAzureMapImageryDataProvider; // This unit declares TdxMapControlAzureMapImageryDataProvider
// ...
procedure TMyForm.AddAzureMapLayer(const AAzureKey: string);
var
ATileLayer: TdxMapImageTileLayer;
AProvider: TdxMapControlAzureMapImageryDataProvider;
begin
ATileLayer := dxMapControl1.Layers.Add(TdxMapImageTileLayer) as TdxMapImageTileLayer;
ATileLayer.ProviderClass := TdxMapControlAzureMapImageryDataProvider;
AProvider := ATileLayer.Provider as TdxMapControlAzureMapImageryDataProvider;
AProvider.BeginUpdate; // Initiates the following batch change
try
AProvider.AzureKey := AAzureKey; // Assigns the Azure account key
AProvider.Tileset := TdxAzureMapTileset.Satellite; // Changes the default tileset
AProvider.MaxParallelConnectionCount := 8; // Explicitly defines the number of parallel connections
finally
AProvider.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
Type-Specific Map Layer Creation Methods
Alternatively, you can call the following functions of the Map Control to create corresponding map layers:
- TdxCustomMapControl.AddImageTileLayer
- Creates a new image tile layer and adds it to the map layer collection.
- TdxCustomMapControl.AddItemFileLayer
- Creates a new item file layer and adds it to the map layer collection.
- TdxCustomMapControl.AddItemLayer
- Creates a new item layer.
See Also