FormatSaveToFile(SourceFormat: TopobaseFormat; FileName: String);
FormatSaveToFile(SourceFormat: Prognoz.Platform.Interop.Topobase.TopobaseFormat; FileName: System.String);
SourceFormat .Topobase format.
FileName.The path and the file name.
The FormatSaveToFile method saves the topobase to the file.
Executing the example requires a map with the OBJ6878 identifier and the Regions layer. Create a form, add the Button1 button to the form, the mapBox component named mapBox1, the uiMap component named uiMap1, select the uiMap1 as a source for the mapBox1 component, add the IntegerEdit component named IntegerEdit1, the EditBox component named EditBox1, 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, add links to the MathFin, Drawing, Metabase and Topobase system assemblies in the module assembly inspector.
Var Count: 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;
Memo1: Memo;
IntegerEdit1: IntegerEdit;
EditBox1: EditBox;
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 As IMapDynamicDataAdapter;
Count := 5;
Color := AreaVisual.Color;
Color.DataAdapter := AreaVisual.DataAdapter;
Scale := New DxMapColorScale.Create As IMapColorScale;
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("OBJ6878").Edit As IMapTopobase;
Itop := Top As ITopobase;
Map.Topobase := Itop As IMapTopobase;
CreateLayer(Map);
End Sub OBJ6879FormOnCreate;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
Itop.FormatSaveToFile((IntegerEdit1.Value) As TopobaseFormat, "C:\Topobase." + EditBox1.Text);
End Sub Button1OnClick;
End Class OBJ6879Form;
Set the value of one of the topobase formats in the IntegerEdit1 component and enter the name of the defined format in the text box of the EditBox1 component. After executing the example the topobase is saved to the file on the C disc with the Topobase name and defined extension on clicking the Button1 button.
Executing the example requires a map with the OBJ6878 identifier and the Regions layer. Create a form, add the Button1 button to the form, the mapBoxNet component named mapBoxNet1, the uiMapNet component named uiMapNet1, select the uiMapNet1 as a source for the mapBoxNet1 component, add the numericUpDown component named numericUpDown1, the textBox component named textBox1, add links to the MathFin, Drawing, Metabase 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;
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;
Scale := New DxMapColorScaleClass();
StartC := GxColorCls1.FromName("Red");
EndC := GxColorCls1.FromName("Blue");
Scale.AutoSetup(Layer, AreaVisual.DataAdapter, StartC, EndC);
Color.Scale := Scale;
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["OBJ6878"].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.FormatSaveToFile(((NumericUpDown1.Value As integer) As TopobaseFormat), "C:\Topobase." + textbox1.Text);
End Sub;
End Class;
Set the value of one of the topobase formats in the NumericUpDown1 component and enter the name of the defined format in the text box of the textbox1 component. After executing the example the topobase is saved to the file on the C disc with the Topobase name and defined extension on clicking the Button1 button.
See also: