Back to Devexpress

TdxMapImageTileLayer Class

vcl-dxmapimagetilelayer.md

latest8.5 KB
Original Source

TdxMapImageTileLayer Class

A map tile layer.

Declaration

delphi
TdxMapImageTileLayer = class(
    TdxMapLayer
)

Remarks

A map tile layer loads data from a supported map provider server.

Available Map Tile Providers

You can assign references to the following classes of the ProviderClass property to select the corresponding tile provider:

TdxMapControlAzureMapImageryDataProviderLoads map tiles from Azure Maps servers.TdxMapControlOpenStreetMapImageryDataProviderLoads map tiles from the OpenStreetMap service.

Tile Provider Selection at Design Time

You can use the Object Inspector to select any available tile data provider at design time. Select an image tile layer, click the Provider node’s drop-down button, and select the required data provider in the menu.

Main API Members

The list below outlines key members of the TdxMapImageTileLayer class. These members allow you to configure map tile provider settings and core map layer functionality.

Tile Data Provider-Related API Members

IsReadyAllows you to identify if the latest data request is completed.ProviderProvides access to tile data provider settings.ProviderClass | ProviderClassNameAllow you to switch between supported tile data providers.

Coordinate Conversion Methods

GeoPointToMapUnit | GeoPointToScreenPointConvert geographical coordinates into map and screen coordinates.MapUnitToScreenPointConverts a point position in map measurement units into screen (pixel) coordinates.ScreenPointToGeoPoint | ScreenPointToMapUnitConvert screen (pixel) coordinates into geographical and map point coordinates.

General-Purpose API Members

AlphaBlendValueAllows you to adjust tile layer opacity.CollectionProvides access to the parent map layer collection.Index

Specifies the map layer’s index in the parent collection.

Tip

The Index property value also determines the map layer’s Z-order (draw order). A map layer with the highest index is displayed on top of all other layers.

We recommend that you display the most transparent layers on top (map item layers with markers, for example).

IsActuallyVisibleIdentifies if the parent Map Control displays the map layer.VisibleSpecifies if the map layer is visible.

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:

delphi
uses
  dxAzureMapImageryDataProvider; // 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;
cpp
#include "dxAzureMapImageryDataProvider.hpp" // Declares TdxMapControlAzureMapImageryDataProvider
// ...

void __fastcall TMyForm::AddAzureMapLayer(const UnicodeString &AAzureKey)
{
  TdxMapLayer *ALayer;
  TdxMapImageTileLayer *ATileLayer;
  TdxMapControlAzureMapImageryDataProvider *AProvider;

  ALayer = dxMapControl1->Layers->Add(__classid(TdxMapImageTileLayer));
  ATileLayer = dynamic_cast<TdxMapImageTileLayer*>(ALayer);
  ATileLayer->ProviderClass = __classid(TdxMapControlAzureMapImageryDataProvider);
  AProvider = dynamic_cast<TdxMapControlAzureMapImageryDataProvider*>(ATileLayer->Provider);
  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
  }
}

Direct TdxMapImageTileLayer Class References

The following public API members reference a TdxMapImageTileLayer object:

TdxCustomMapControl.AddImageTileLayerCreates a new image tile layer and adds it to the map layer collection.TdxMapLayers.ItemsProvides indexed access to stored map layers.

To see map tile layers with all supported information providers in action, run the Mapping demo in the VCL Demo Center installed with compiled DevExpress demos. Click the Data Providers item in the side bar to the left and switch between available data providers in the Ribbon UI.

Download: Compiled VCL Demos

Tip

Compiled DevExpress demos ship with source code installed in the Public Documents folder (%Public%) for all users ( default ). You can find all project and source code files for the Map Control demo in the following folder:

%Public%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressMapControl

Inheritance

TObject TPersistent TComponent TcxCustomComponent TcxComponentCollectionItem TdxMapLayer TdxMapImageTileLayer

See Also

TdxMapItemFileLayer Class

TdxMapItemFileLayer Class

TdxMapImageTileLayer Members

dxMapImageTileLayer Unit