DataAdapter: Object;
The DataAdapter property determines a data source that determines the parameter construction.
Executing the example requires a form with the following components: the Button component named Button1, the MapBox component named MapBox1, and the UiMap component named UiMap1. UiMap1 is a data source for MapBox1. A map should be connected to the UiMap1 component. The VisualDataAdapter class that creates a dynamic data source should also be implemented. The class example is contained in description of the IMapVisual.DataAdapter property. The file system should contain the C:\blue.gif file with image.
The example is a handler of the OnClick event for the Button1 component.
Add links to the Drawing, ExtCtrls, Forms, and Map system assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Map: IMap;
Layer: IMapLayer;
ImageVisual: IMapImageVisual;
Image: IGxImage;
ImageProp: IMapVisualIconProperty;
Begin
Map := UiMap1.Map;
Layer := Map.Layers.FindByName("Regions");
ImageVisual := Layer.Visuals.AddImageVisual;
ImageVisual.DataAdapter := New VisualDataAdapter.Create As IMapDynamicDataAdapter;
ImageProp := ImageVisual.Image;
ImageProp.Dependent := False;
Image := GxImage.FromFile("C:\blue.gif");
ImageProp.Value := Image;
ImageProp.DataAdapter := ImageVisual.DataAdapter;
ImageVisual.Height.Value := 4;
ImageVisual.Width.Value := 4;
End Sub Button1OnClick;
After executing the example the icon indicator, that is 4 pixels long and wide, is added to the Regions layer. The indicator icon is loaded from the C:\blue.gif file. The data source, that determines the construction, matches with the indicator data source.
See also: