vcl-dxmapcontrolinformationprovider-9fba55eb.md
A collection of auxiliary map information providers.
TdxMapControlInformationProviders = class(
TcxComponentCollection
)
Auxiliary map information providers complement a tile data provider and allow you to display additional map-related information, such as routes and addresses.
The list below outlines key members of the TdxMapControlInformationProviders class. These members allow you to access and manage individual auxiliary map information providers.
AddCreates a new information provider of the required type and adds the provider to the collection.ClearClears the information provider collection.CountReturns the number of information providers in the collection.ItemsProvides indexed access to information providers in the collection.RemoveRemoves an individual information provider from the collection.
AssignCopies information providers between collections.BeginUpdate | EndUpdateAllow you to avoid excessive redraw operations and server queries during batch collection changes.
The following code example implements a procedure that accepts an Azure Maps account key, and creates and configures all Azure Maps information provider components:
uses
dxAzureMapInformationProviders; // Declares all Azure Maps information provider classes
// ...
procedure TMyForm.CreateAzureMapsInformationProviders(const AAzureKey: string);
var
AProviders: TdxMapControlInformationProviders;
AProvider: TdxMapControlAzureMapInformationProvider;
I: Integer;
begin
AProviders := dxMapControl1.InformationProviders;
AProviders.BeginUpdate; // Initiates the following batch change
try
// Create all Azure Maps information providers
AProviders.Add(TdxMapControlAzureMapGeocodeProvider);
AProviders.Add(TdxMapControlAzureMapGeolocationProvider);
AProviders.Add(TdxMapControlAzureMapReverseGeocodeProvider);
AProviders.Add(TdxMapControlAzureMapRouteProvider);
for I := 0 to AProviders.Count - 1 do // Iterates through all created information providers
begin
AProvider := AProviders.Items[I] as TdxMapControlAzureMapInformationProvider;
AProvider.AzureKey := AAzureKey; // Assigns the same Azure Maps account key to all providers
end;
finally
AProviders.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
#include "dxAzureMapInformationProviders.hpp" // Declares all Azure Maps information provider classes
// ...
void __fastcall TMyForm::CreateAzureMapsInformationProviders(const UnicodeString &AAzureKey)
{
TdxMapControlInformationProviders *AProviders;
TdxMapControlAzureMapInformationProvider *AProvider;
AProviders = dxMapControl1->InformationProviders;
AProviders->BeginUpdate(); // Initiates the following batch change
try
{
// Create all Azure Maps information providers
AProviders->Add(__classid(TdxMapControlAzureMapGeocodeProvider));
AProviders->Add(__classid(TdxMapControlAzureMapGeolocationProvider));
AProviders->Add(__classid(TdxMapControlAzureMapReverseGeocodeProvider));
AProviders->Add(__classid(TdxMapControlAzureMapRouteProvider));
for(int i = 0; i < AProviders->Count; i++) // Iterates through all created information providers
{
AProvider = dynamic_cast<TdxMapControlAzureMapInformationProvider*>(AProviders->Items[i]);
AProvider->AzureKey = AAzureKey; // Assigns the same Azure Maps account key to all providers
}
}
__finally
{
AProviders->EndUpdate(); // Calls EndUpdate regardless of the batch operation's success
}
}
The TdxCustomMapControl.InformationProviders property references a TdxMapControlInformationProviders object.
TObject TPersistent TcxComponentCollection TdxMapControlInformationProviders
See Also