IMapDynamicDataAdapter.PartCount

Syntax

PartCount(Attribute: Variant): Integer;

Parameters

Attribute - parameter that determines the data, for which the number of areas should be returned.

Description

The PartCount property returns the number of separate data areas. Each data area corresponds to a single region of the map.

Example

Executing the example requires a form with a button named Button1, the UiMap component named UiMap1 and the MapBox component. The map must be connected to the UiMap1 component.

Var Count: 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
    Button1: Button;
    UiMap1: UiMap;
    MapBox1: MapBox;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Da: TerritoryInfoAdapter;
        MapDa: IMapDynamicDataAdapter;
        M: IMap;
        mLayer: IMapLayer;
        mShapes: IMapTopobaseShapes;
        mShape: IMapTopobaseShape;
        i: integer;
        pc: Integer;
    Begin
        Da := New TerritoryInfoAdapter.Create;
        MapDa := da As IMapDynamicDataAdapter;
        M := UiMap1.Map;
        mLayer := M.View.TerritoryInfo.Layer;
        mShapes := mLayer.Shapes;
        For i := 0 To mShapes.Count - 1 Do
            mShape := mShapes.Item(i);
            pc := MapDa.PartCount(mShape) - 1;
            Debug.WriteLine(MapDa.Data(mShape, pc));
        End For;
        mLayer.TerritoryInfoAdapter := MapDa;
    End Sub Button1OnClick;

End Class TestForm;

After executing the example the data source for the territory info is determined. The elements of the last data area in the data adapter are displayed in the console window.

See also:

IMapDynamicDataAdapter