Data(Attribute: Variant; PartIndex: Integer; TimePointIndex: Integer): Variant;
Data[Attribute: System.Object; PartIndex: System.Int32; TimePointIndex: System.Int32]: System.Object;
Attribute. Parameter that determines, which data must be returned by a time adapter.
PartIndex. Parameter that determines composite part of the factor.
TimePointIndex. Parameter that determines a time point.
The Data property returns value of the specified composite part of the factor to the specified time point.
The composite part of the factor is specified by the PartIndex parameter, the time point is specified by the TimePointIndex parameter.
Executing the example requires a map with the OBJ2908 identifier and the Regions layer. Create a form, add two buttons with the Button1 and Button2 names, the MapBox component with the MapBox1 name, the UiMap component with the UiMap1 name, specify the UiMap1 as a source for the MapBox1 component, add the IntegerEdit component with the IntegerEdit1 name, add references to the Drawing, Map, MathFin and Metabase system assemblies in the assembly inspector.
Var Count: Integer;
int: integer;
Class TerritoryInfoAdapter: Object, IMapDynamicDataAdapter
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 TerritoryInfoAdapter;
Class OBJ7171Form: Form
MapBox1: MapBox;
UiMap1: UiMap;
Button1: Button;
Button2: Button;
IntegerEdit1: IntegerEdit;
Map: IMap;
Layer: IMapLayer;
BarVisual: IMapBarVisual;
Sub OBJ4006FormOnCreate(Sender: Object; Args: IEventArgs);
Var mb: IMetabase;
qwe: IMapTimeDynamicDataAdapter;
Begin
mb := MetabaseClass.Active;
UiMap1.Map.Topobase := MetabaseClass.Active.ItemById("OBJ2908").Bind As IMapTopobase; // OBJ2910
Map := UiMap1.Map;
Layer := Map.Layers.FindByName("Regions");
Map.Color := New GxColor.CreateARGB(100, 100, 100, 100);
Map.Refresh;
End Sub OBJ4006FormOnCreate;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var Fill: IMapVisualFillProperty;
Color: IMapVisualColorProperty;
Collection: IMapColorCollection;
ns: IMapNumericScale;
vals: array Of double;
i: Integer;
Scale: IMapColorScale;
StartC, EndC: IGxColor;
Begin
BarVisual := New DxMapBarVisual.Create;
BarVisual := Layer.Visuals.AddBarVisual;
BarVisual.DataAdapter := New TimeDynamicDataAdapter.Create;
Color := BarVisual.Color;
Color.DataAdapter := BarVisual.DataAdapter;
Color.Dependent := True;
Scale := New DxMapColorScale.Create As IMapColorScale;
StartC := GxColor.FromName("Red");
EndC := GxColor.FromName("Blue");
Scale.AutoSetup(Layer, BarVisual.DataAdapter, StartC, EndC);
Color.Scale := Scale;
BarVisual.Height.Dependent := True;
ns := BarVisual.Height.Scale;
ns.AutoCalculable := True;
ns.Count := 3;
vals := New Double[ns.Count];
For i := 0 To vals.Length - 1 Do
vals[i] := i * 20;
End For;
ns.AutoSetup(Layer, BarVisual.DataAdapter, vals, ns.Count, True);
End Sub Button1OnClick;
Sub IntegerEdit1OnChange(Sender: Object; Args: IEventArgs);
Begin
Count := IntegerEdit1.Value;
End Sub IntegerEdit1OnChange;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Var i: Integer;
Visuals: IMapLayerVisuals;
DA: IMapTimeDynamicDataAdapter;
Begin
Visuals := Map.Layers.FindByName("Regions").Visuals;
DA := Visuals.Item(0).DataAdapter As IMapTimeDynamicDataAdapter;
For i := 0 To DA.TimePointsCount - 1 Do
Debug.WriteLine("Name " + DA.TimePointName(i));
Debug.WriteLine("Value " + DA.Data(57, 0, i) As String);
Debug.WriteLine("Part Count " + DA.PartCount(57, i).ToString);
End For;
End Sub Button2OnClick;
End Class OBJ7171Form;
Specify the number of composite parts in the IntegerEdit1 component. After executing the example on clicking Button1 factors are added to the map. On clicking the Button2 button for each of the time points the output shows its name, value, and the number of factor composite parts specified in IntegerEdit1.
Executing the example requires a map with the OBJ133 identifier and the Regions layer. Create a form, add two buttons with the Button1 and Button2 names, the MapBoxNet component with the mapBoxNet1 name, the UiMapNet component with the UiMapNet1 name, specify the UiMapNet1 as a source of the MapBoxNet1 component, add the numericUpDown component with the numericUpDown1 name, add references to the Drawing, Map, MathFin and Metabase 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.Drawing;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.MathFin;
Class TerritoryInfoAdapter: 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;
Public Partial Class OBJ947Form: Prognoz.Platform.Forms.NET.ForeNetForm
Public Constructor OBJ947Form();
Begin
InitializeComponent();
End Constructor;
Map: IMap;
GxColorCls: GxColorClass_2 = New GxColorClass_2();
Layer: IMapLayer;
BarVisual: IMapBarVisual;
Private Sub OBJ947Form_Load(sender: System.Object; e: System.EventArgs);
Var mb: IMetabase;
Begin
mb := self.Metabase;
uimapnet1.Map.Topobase := mb.ItemById["OBJ133"].Bind() As DxMapTopobase;
Map := UiMapnet1.Map;
Layer := Map.Layers.FindByName["Regions"];
GxColorCls.CreateARGB(100, 100, 100, 100);
Map.Color := GxColorCls;
Map.Refresh();
End Sub;
Private Sub numericUpDown1_ValueChanged(sender: System.Object; e: System.EventArgs);
Begin
Count := Convert.ToInt32(numericUpDown1.Value);
End Sub;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Fill: IMapVisualFillProperty;
Color: IMapVisualColorProperty;
Collection: IMapColorCollection;
ns: IMapNumericScale;
vals: array Of double;
i: Integer;
Scale: DxMapColorScale;
StartC, EndC: GxColor;
GxColorCls: GxColorClassClass = New GxColorClassClass();
Begin
BarVisual := New DxMapBarVisual();
BarVisual := Layer.Visuals.AddBarVisual();
BarVisual.DataAdapter := New VisualDataAdapter();
Color := BarVisual.Color;
Color.DataAdapter := BarVisual.DataAdapter;
Color.Dependent := True;
Scale := New DxMapColorScale();
StartC := GxColorCls.FromName("Red");
EndC := GxColorCls.FromName("Blue");
Scale.AutoSetup(Layer, BarVisual.DataAdapter, StartC, EndC);
Color.Scale := Scale;
BarVisual.Height.Dependent := True;
ns := BarVisual.Height.Scale;
ns.AutoCalculable := True;
ns.Count := 3;
vals := New Double[ns.Count];
For i := 0 To vals.Length - 1 Do
vals[i] := i * 20;
End For;
ns.AutoSetup(Layer, BarVisual.DataAdapter, vals, ns.Count, True);
End Sub;
Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
Var i: Integer;
Visuals: IMapLayerVisuals;
DA: IMapTimeDynamicDataAdapter;
Begin
Visuals := Map.Layers.FindByName["Regions"].Visuals;
DA := Visuals.Item[0].DataAdapter As IMapTimeDynamicDataAdapter;
For i := 0 To DA.TimePointsCount - 1 Do
System.Diagnostics.Debug.WriteLine("Name " + DA.TimePointName[i]);
System.Diagnostics.Debug.WriteLine("Value " + (DA.Data[57, 0, i]).ToString());
System.Diagnostics.Debug.WriteLine("Part Count " + DA.PartCount[57, i].ToString());
End For;
End Sub;
End Class;
Determine the number of composite parts in the numericUpDown1 component. After executing the example on clicking the Button1 button factors are added to the map. On clicking the Button2 button for each of the time points the output shows its name, value, and the number of factor composite parts specified in numericUpDown1.
See also: