IMapIconScale.AutoSetup

Syntax

AutoSetup(

Layer: IMapLayer;

DataAdapter: Object;

Image: IGxImage;

ColCount: Integer;

RowCount: Integer;

Count: Integer);

Parameters

Layer - layer containing the indicator.

DataAdapter - data source that determines the icon.

Image - image with icons for the scale values.

ColCount - number of columns in the image with icons.

RowCount - number of rows in the image with icons.

Count - number of scale tick marks.

Description

The AutoSetup method executes the scale autoset.

Example

Executing the example requires a form, a button named Button1 on the form, the UiMap component named UiMap1 that is a data source for the MapBox component. The map must be connected to the UiMap1 component. The VisualDataAdapter class, that creates a dynamic data source, must also be implemented. The class example is contained in the IMapVisual.DataAdapter property description. The "C:\Icons.gif" file, that contains icons for the scale, must be present in the file system.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Map: IMap;

Layer: IMapLayer;

ImageVisual: IMapImageVisual;

ImageProp: IMapVisualIconProperty;

Scale: IMapIconScale;

Begin

Map := UiMap1.Map;

Layer := Map.Layers.FindByName("Regions");

ImageVisual := Layer.Visuals.AddImageVisual;

ImageVisual.DataAdapter := New VisualDataAdapter.Create As IMapDynamicDataAdapter;

ImageProp := ImageVisual.Image;

ImageProp.DataAdapter := ImageVisual.DataAdapter;

ImageVisual.Height.Value := 2;

ImageVisual.Width.Value := 2;

ImageProp.Dependent := True;

Scale := ImageProp.Scale;

Scale.AutoSetup(Layer, ImageVisual.DataAdapter, GxImage.FromFile("C:\Icons.gif"), 2, 1, 2);

End Sub Button1OnClick;

After executing the example the icon indicator is added to the Regions layer. The indicator scale is set automatically:

The icons are obtained from the "C:\Icons.gif" file: .

See also:

IMapIconScale