IMapLayerVisuals.AddBarVisual

Syntax

AddBarVisual: IMapBarVisual;

Description

The AddBarVisual method adds a bar indicator to the collection.

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.

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

Var

Map: IMap;

Layer: IMapLayer;

BarVisual: IMapBarVisual;

Fill: IMapVisualFillProperty;

Color: IMapVisualColorProperty;

Collection: IMapColorCollection;

Begin

Map := UiMap1.Map;

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

BarVisual := Layer.Visuals.AddBarVisual;

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

Fill := BarVisual.Fill;

Fill.Dependent := False;

Fill.Value := GxHatchStyle.DarkUpwardDiagonal;

Color := BarVisual.FillColor;

Collection := Color.Values;

Collection.Item(0) := GxColor.FromName("Red");

BarVisual.Width.Value := 1;

End Sub Button1OnClick;

After executing the example the map indicator, which is hatched in red, is added to the Regions layer:

See also:

IMapLayerVisuals