IMapTimeDynamicDataAdapter.Data

Syntax

Data(Attribute: Variant; PartIndex: Integer; TimePointIndex: Integer): Variant;

Parameters

Attribute. Parameter that determines, which data must be returned by a time adapter.

PartIndex. Parameter that determines composite part of the indicator.

TimePointIndex. Parameter that determines a time point.

Description

The Data property returns value of the specified composite part of the indicator to the specified time point.

Comments

The composite part of the indicator is specified by the PartIndex parameter, the time point is specified by the TimePointIndex parameter.

Example

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 TESTForm: 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;
        Map := UiMap1.Map;
        Layer := Map.Layers.FindByName("Regions");
        Map.Color := New GxColor.CreateARGB(100100100100);
        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(570, i) As String);
            Debug.WriteLine("Part Count " + DA.PartCount(57, i).ToString);
        End For;
        
    End Sub Button2OnClick;

End Class TESTForm;

Specify the number of composite parts in the IntegerEdit1 component. After executing the example on clicking Button1 indicators 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 indicator composite parts specified in IntegerEdit1.

See also:

IMapTimeDynamicDataAdapter