IEaxMapChart.Action

Fore Syntax

Action: String;

Fore.NET Syntax

Action: string;

Description

The Action property determines a macro to process map events.

Comments

Depending on the file where the macro is implemented the path to the macro in this property is specified in the different ways:

In the units and forms of the repository user macros are to be implemented in the global scope of names (Global Scope).

In .NET units and .NET forms of the repository the user macros are to be implemented within a class. Macro is to be a  static procedure or function.

NOTE. Development environment object, where macro implementation is, must be connected to regular report.

Fore Example

To execute the example, repository must have:

It is required that in the example there is the Action macro which will be used as event handler.

Add links to the Drawing, Express, Metabase, Report, Tab, Topobase, Visualizators system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Report: IPrxReport;
    Module: IMetabaseObjectDescriptor;
    ActiveSheet: IPrxSheet;
    Assemb: IPrxAssemblies;
    i: Integer;
    Table: IPrxTable;
    Objects: ITabObjects;
    AddObj: ITabObject;
    Obj: IPrxVisualizer;
    DA: IEaxDAtaArea;
    Slice: IEaxDataAreaSlice;
    SlObj: IEaxObject;
    MapChart: IEaxMapChart;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get regular report
    Report := MB.ItemById("REG_REPORT_ACTION").Edit As IPrxReport;
    // Connect unit with macro to regular report
    Module := MB.ItemById("IEAXMAPCHART_ACTION");
    Assemb := Report.Assemblies;
    i := Assemb.Add(Module);
    // Create new object  - visualizer
    ActiveSheet := Report.ActiveSheet;
    Table := ActiveSheet As IPrxTable;
    Objects := Table.TabSheet.Objects;
    AddObj := Objects.Add("PrxVisualizer"New GxRectF.Create(00100100));
    Obj := AddObj.Extension As IPrxVisualizer;
    // Get analytical data area
    DA := Report.DataArea;
    // Get data slice
    Slice := DA.Slices.Item(0);
    // Add map as visualizer
    SlObj := Slice.Views.AddByType(EaxObjectType.MapChart) As IEaxVisualizer;
    Obj.EaxVisualizer := SlObj As IEaxVisualizer;
    MapChart := Obj.EaxVisualizer As IEaxMapChart;
    MapChart.Enabled := True;
    MapChart.Visible := True;
    MapChart.Topobase := MB.ItemById("MAP").Edit As ITopobase;
    // Determine macro to process events
    MapChart.Action := "REG_REPORT_ACTION.Action";
    MapChart.DoAction("RF");
    // Refresh map
    MapChart.Refresh;
    // Save changes
    (Report As IMetabaseObject).Save;
End Sub UserProc;

// Event handler
Public Sub Action(n: Variant);
Var
    Table: IPrxTable;
    Objects: ITabObjects;
    Object: IPrxVisualizer;
    MapChart: IEaxMapChart;
    Map: IVZMapChart;
    i: Integer;
    RootLayer: IVZMapChartLayer;
    Shapes: IVZMapChartShapes;
Begin
    If n.IsNull Or n.IsEmpty Then
        Return;
    End If;
    // Get map as visualizer
    Table := PrxReport.ActiveReport.ActiveSheet As IPrxTable;
    Objects := Table.TabSheet.Objects;
    Object := Objects.Item(0).Extension As IPrxVisualizer;
    MapChart := Object.EaxVisualizer As IEaxMapChart;
    Map := MapChart.MapChart;
    // Get map layer
    RootLayer := Map.RootLayer.LayerById("Regions");
    // Get map territories
    Shapes := RootLayer.Shapes;
    // In the G8 cell will be displayed territory identifier
    If n.VarType = ForeVariantType.String Then
        For i := 0 To Shapes.Count - 1 Do
        If Shapes.Item(i).Name = (n As String) Then
            Table.TabSheet.Cell(77).Value := Shapes.Item(i).Name;
        End If;
        End For;
    End If;
End Sub Action;

After executing the example, visualizer basing on the map will be created in regular report. Map will use event handler which implements the main mouse button clicking on the territory with the RF identifier. As a result, the G8 cell displays territory name.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Topobase;
Imports Prognoz.Platform.Interop.Visualizators;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Report: IPrxReport;
    Module: IMetabaseObjectDescriptor;
    ActiveSheet: IPrxSheet;
    Assemb: IPrxAssemblies;
    i: Integer;
    Table: IPrxTable;
    Objects: ITabObjects;
    AddObj: ITabObject;
    Rect: GxRectF = New GxRectFClass();
    Obj: IPrxVisualizer;
    DA: IEaxDAtaArea;
    Slice: IEaxDataAreaSlice;
    SlObj: IEaxObject;
    MapChart: IEaxMapChart;
Begin
    // Get repository
    MB := Params.Metabase;
    // Get regular report
    Report := MB.ItemById["REG_REPORT_ACTION"].Edit() As IPrxReport;
    // Connect unit with macro to regular report
    Module := MB.ItemById["IEAXMAPCHART_ACTION"];
    Assemb := Report.Assemblies;
    i := Assemb.Add(Module);
    // Create new object  - visualizer
    ActiveSheet := Report.ActiveSheet;
    Table := ActiveSheet As IPrxTable;
    Objects := Table.TabSheet.Objects;
    Rect.Create(00100100);
    AddObj := Objects.Add("PrxVisualizer", Rect);
    Obj := AddObj.Extension As IPrxVisualizer;
    // Get analytical data area
    DA := Report.DataArea;
    // Get data slice
    Slice := DA.Slices.Item[0];
    // Add map as visualizer
    SlObj := Slice.Views.AddByType(EaxObjectType.eotMapChart) As IEaxVisualizer;
    Obj.EaxVisualizer := SlObj As IEaxVisualizer;
    MapChart := Obj.EaxVisualizer As IEaxMapChart;
    MapChart.Enabled := True;
    MapChart.Visible := True;
    MapChart.Topobase := MB.ItemById["MAP"].Edit() As Topobase;
    // Determine macro to process events
    MapChart.Action := "REG_REPORT_ACTION.Action";
    MapChart.DoAction("RF");
    // Refresh map
    MapChart.Refresh();
    // Save changes
    (Report As IMetabaseObject).Save();
End Sub;

// Event handler
Public Sub Action(n: Object);
Var
    Report: IPrxReport;
    PrxReport: PrxReportClass = New PrxReportClass();
    Table: IPrxTable;
    Objects: ITabObjects;
    Object: IPrxVisualizer;
    MapChart: IEaxMapChart;
    Map: IVZMapChart;
    i: Integer;
    RootLayer: IVZMapChartLayer;
    Shapes: IVZMapChartShapes;
Begin
    If n = Null Then
        Return;
    End If;
    // Get map as visualizer
    Report := PrxReport.ActiveReport[Null];
    Table := Report.ActiveSheet As IPrxTable;
    Objects := Table.TabSheet.Objects;
    Object := Objects.Item[0].Extension As IPrxVisualizer;
    MapChart := Object.EaxVisualizer As IEaxMapChart;
    Map := MapChart.MapChart;
    // Get map layer
    RootLayer := Map.RootLayer.LayerById("Regions");
    // Get map territories
    Shapes := RootLayer.Shapes;
    // In the G8 cell will be displayed territory identifier
    If n Is String Then
        For i := 0 To Shapes.Count - 1 Do
        If Shapes.Item[i].Name = (n As String) Then
            Table.TabSheet.Cell[77].Value := Shapes.Item[i].Name;
        End If;
        End For;
    End If;
End Sub Action;

See also:

IEaxMapChart