AvailableFormats: Integer;
AvailableFormats: Integer;
The AvailableFormats property returns the combination of format values, to which the map is converted.
The property value determines, to which formats the map is converted and in which formats the map can be used.
Values of formats are described in the TopobaseFormat enumeration.
Executing the example requires a map with the MAP1 identifier and the Regions layer. Create a form, add two buttons named Button1 and Button2 to it, two MapBox components named MapBox1 and MapBox2, two UiMap components named UiMap1 and UiMap2, select the UiMap1 and UiMap2 as the source of the MapBox1 and MapBox2 components respectively, add two IntegerEdit component named IntegerEdit1 and IntegerEdit2 on it, the Memo component named Memo1, select the Tbs - 1, Svg - 2, Google - 4, Triangulate - 8, Vml - 16 values of the Text property of the Memo1 component, and add links to the MathFin, Drawing, Metabase, ForeSystem and Topobase system assemblies in the module assembly inspector.
Var Count: Integer;
int: integer;
Class VisualDataAdapter: Object, IMapTimeDynamicDataAdapter
Function Get_PartCount(Attribute: Variant; TimePoint: Integer): Integer;
Begin
Return Count;
End Function Get_PartCount;
Function Get_TimePointName(TimePoint: Integer): String;
Begin
Return "TimePoint " + TimePoint.ToString;
End Function Get_TimePointName;
Function Get_TimePointsCount: Integer;
Begin
Return 4;
End Function Get_TimePointsCount;
Function Get_Data(Attribute: Variant; PartvIndex: Integer; TimePoint: Integer): Variant;
Var t: Integer;
i: Integer;
Begin
t := 1;
For i := 0 To TimePoint Do
t := t + 10;
End For;
Return Math.Rand * 10 * t;
End Function Get_Data;
Function Get_CustomFormat: String;
Begin
Return "#0,000";
End Function Get_CustomFormat;
End Class VisualDataAdapter;
Class OBJ6879Form: Form
MapBox1: MapBox;
UiMap1: UiMap;
Button1: Button;
Button2: Button;
UiMap2: UiMap;
MapBox2: MapBox;
IntegerEdit1: IntegerEdit;
IntegerEdit2: IntegerEdit;
Memo1: Memo;
mb: IMetabase;
Map: IMap;
Top: IMapTopobase;
Itop: ITopobase;
Sub CreateLayer(m: IMap);
Var StartC, EndC: IGxColor;
Color: IMapVisualColorProperty;
Scale: IMapColorScale;
AreaVisual: IMapAreaVisual;
Layer: IMapLayer;
Begin
Layer := M.Layers.FindByName("Regions");
M.Color := New GxColor.CreateARGB(100, 100, 100, 100);
M.Refresh;
AreaVisual := Layer.Visuals.AddAreaVisual;
AreaVisual.DataAdapter := New VisualDataAdapter.Create;
Count := 5;
Color := AreaVisual.Color;
Color.DataAdapter := AreaVisual.DataAdapter;
Scale := New DxMapColorScale.Create;
StartC := GxColor.FromName("Red");
EndC := GxColor.FromName("Blue");
Scale.AutoSetup(Layer, AreaVisual.DataAdapter, StartC, EndC);
Color.Scale := Scale;
M.Refresh;
End Sub CreateLayer;
Sub OBJ6879FormOnCreate(Sender: Object; Args: IEventArgs);
Begin
mb := MetabaseClass.Active;
Map := UiMap1.Map;
Top := mb.FetchItemById("MAP1").Edit As IMapTopobase;
Map.Topobase := Top;
itop := Top As ITopobase;
CreateLayer(Map);
End Sub OBJ6879FormOnCreate;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
Itop.Convert((IntegerEdit1.Value) As TopobaseFormat, (IntegerEdit2.Value) As TopobaseFormat);
UiMap2.Map.Topobase := Itop As IMapTopobase;
CreateLayer(UiMap1.Map);
CreateLayer(UiMap2.Map);
End Sub Button1OnClick;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Topo: ITopobase;
Begin
Topo := itop;
If (Topo.AvailableFormats And TopobaseFormat.Tbs) <> 0 Then
Debug.WriteLine("Tbs");
End If;
If (Topo.AvailableFormats And TopobaseFormat.Svg) <> 0 Then
Debug.WriteLine("Svg");
End If;
If (Topo.AvailableFormats And TopobaseFormat.Google) <> 0 Then
Debug.WriteLine("Google");
End If;
If (Topo.AvailableFormats And TopobaseFormat.Triangulate) <> 0 Then
Debug.WriteLine("Triangulate");
End If;
If (Topo.AvailableFormats And TopobaseFormat.Vml) <> 0 Then
Debug.WriteLine("Vml");
End If;
End Sub Button2OnClick;
End Class OBJ6879Form;
In the IntegerEdit1 component set the value of the source format and the output format value in the IntegerEdit2 component. On clicking the Button1 button the topobase is converted from the format, which value is specified in the IntegerEdit1 component, and in the format, which value is specified in IntegerEdit2. On clicking the Button2 button the list of formats, to which the map is converted, is shown in the console window.
Executing the example requires a map with the MAP1 identifier and the Regions layer. Create a form, add two buttons named Button1 and Button2 to the form, two mapBoxNet components named mapBoxNet1 and mapBoxNet2, two uiMapNet components named uiMapNet1 and uiMapNet2, select the uiMapNet1 and uiMapNet2 as the source of the mapBoxNet1 and mapBoxNet2 components respectively, add two numericUpDown components named numericUpDown1 and numericUpDown2, add links to the Chart, MathFin, Drawing, Metabase, ForeSystem and Topobase system assemblies.
Imports System;
Imports System.Collections.Generic;
Imports System.ComponentModel;
Imports System.Data;
Imports System.Drawing;
Imports System.Text;
Imports System.Windows.Forms;
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.MathFin;
Imports Prognoz.Platform.Interop.Topobase;
Imports Prognoz.Platform.Interop.ForeSystem;
Class VisualDataAdapter: IMapTimeDynamicDataAdapter
Public Property PartCount[Attribute: Object; TimePoint: Integer]: Integer
Get
Begin
Return Count;
End Get
End Property;
Public Property Data[Attribute: Object; PartvIndex: Integer; TimePoint: Integer]: Object
Get
Var Math: MathClass = New MathClass();
t: Integer;
i: Integer;
Begin
t := 1;
For i := 0 To TimePoint Do
t := t + 10;
End For;
Return Math.Rand() * 10 * t;
End Get
End Property;
Public Property TimePointsCount: Integer
Get
Begin
Return 4;
End Get
End Property;
Public Property TimePointName[TimePoint: Integer]: String
Get
Begin
Return "TimePoint " + TimePoint.ToString();
End Get
End Property;
Public Property CustomFormat: String
Get
Begin
Return "#0,000";
End Get
End Property;
End Class;
Var Count: Integer;
Sub CreateLayer(m: IMap);
Var StartC, EndC: GxColor;
Color: IMapVisualColorProperty;
Scale: DxMapColorScale;
AreaVisual: IMapAreaVisual;
Layer: IMapLayer;
GxColorCls: GxColorClass_2 = New GxColorClass_2();
GxColorCls1: GxColorClassClass = New GxColorClassClass();
Begin
Layer := M.Layers.FindByName["Regions"];
GxColorCls.CreateARGB(100, 100, 100, 100);
M.Color := GxColorCls;
M.Refresh();
AreaVisual := Layer.Visuals.AddAreaVisual();
AreaVisual.DataAdapter := New VisualDataAdapter();
Count := 5;
Color := AreaVisual.Color;
Color.DataAdapter := AreaVisual.DataAdapter;
M.Refresh();
End Sub CreateLayer;
Public Partial Class OBJ918Form: Prognoz.Platform.Forms.Net.ForeNetForm
Public Constructor OBJ918Form();
Begin
InitializeComponent();
End Constructor;
mb: IMetabase;
Map: IMap;
Top: IMapTopobase;
Itop: ITopobase;
Private Sub OBJ918Form_Load(sender: System.Object; e: System.EventArgs);
Begin
mb := Self.Metabase;
Map := UiMapNet1.Map;
Top := mb.ItemById["MAP1"].Edit() As IMapTopobase;
Itop := Top As ITopobase;
Map.Topobase := Itop As DxMapTopobase;
CreateLayer(Map);
End Sub;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Begin
Itop.Convert(Convert.ToInt32(numericUpDown1.Value) As TopobaseFormat, (Convert.ToInt32(numericUpDown2.Value)) As TopobaseFormat);
UiMapNet2.Map.Topobase := Itop As DxMapTopobase;
CreateLayer(UiMapNet1.Map);
CreateLayer(UiMapNet2.Map);
End Sub;
Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
Var
Topo: ITopobase;
Begin
Topo := itop;
If (Topo.AvailableFormats And (TopobaseFormat.ttTbs As Integer)) <> 0 Then
System.Diagnostics.Debug.WriteLine("Tbs");
End If;
If (Topo.AvailableFormats And (TopobaseFormat.ttSvg As Integer)) <> 0 Then
System.Diagnostics.Debug.WriteLine("Svg");
End If;
If (Topo.AvailableFormats And (TopobaseFormat.ttGoogle As Integer)) <> 0 Then
System.Diagnostics.Debug.WriteLine("Google");
End If;
If (Topo.AvailableFormats And (TopobaseFormat.ttTriangulate As Integer)) <> 0 Then
System.Diagnostics.Debug.WriteLine("Triangulate");
End If;
If (Topo.AvailableFormats And (TopobaseFormat.ttVml As Integer)) <> 0 Then
System.Diagnostics.Debug.WriteLine("Vml");
End If;
End Sub;
End Class;
In the numericUpDown1 component set the value of the source format and the output format value in the numericUpDown2 component. After executing the example the topobase is converted from the format, which value is specified in the numericUpDown1 component, and the format, which value is specified in the numericUpDown2 by clicking the Button1 button. On clicking the Button2 button the list of formats, to which the map is converted is shows in the console window.
See also: