IMapScale.AutoCalculate

Syntax

AutoCalculate(Layer: IMapLayer; DataAdapter: Object; AttributeName: String);

Parameters

Layer. Map layer.

DataAdapter. Cube value that corresponds to the territory with the specified attribute.

AttributeName. Map attribute.

Description

The AutoCalculate method automatically calculates report scale values.

Example

Executing the example requires that the repository contains a regular report with the REPORT identifier. A color scale needs to be created for the regular report, the report sheet must contain the map, for which the map indicator is created.

Add links to the Map, Metabase, Report, Tab system assemblies.

Sub UserProc;
Var
    MB: IMetabase;  
    Report: IPrxReport;
    PrxTable: IPrxTable;
    TabObj: ITabObjects;
    Map: IMap;
    Layer: IMapLayer;
    Visual: IMapAreaVisual;
    MapScale: IMapColorScale;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get regular report
    Report := MB.ItemById("REPORT").Edit As IPrxReport;
    PrxTable := Report.ActiveSheet As IPrxTable;
    TabObj := PrxTable.TabSheet.Objects;
    // Get map
    Map := TabObj.Item(0).Extension As IMap;
    // Find layer by name
    Layer := Map.Layers.FindByName("Regions");
    // Determine indicator from the collection
    Visual := Layer.Visuals.Item(0As IMapAreaVisual;
    // Determine map scale
    MapScale := Report.Scales.Item(0).MapScale As IMapColorScale;
    // Set whether scale values are automatically calculated
    MapScale.AutoCalculable := True;
    // Set type of automatic scale calculation
    MapScale.AutoScaleMode := MapAutoScaleMode.Uniform;
    // Start automatic calculation of scale values
    MapScale.AutoCalculate(Layer, Visual.DataAdapter, Visual.AttributeName);
End Sub UserProc;

After executing the example the report scale values are calculated.

See also:

IMapScale