IPrxMapLegend.Map

Syntax

Map: IPrxMap;

Description

The Map property determines a regular report map, for which a legend is created.

Fore Example

Executing the example requires a regular report, which sheet contains a map with the Regions layer and the Map indicator. The form should contain: a button named Button1, the UiReport non-visual component named UiReport1, the ReportBox component named ReportBox1. In the properties of the UiReport component select the regular report as an object, set the Active property to True. Select the UiReport1 data source for the ReportBox component. Add links to the Drawing, Forms, Map, Report, Tab, Forms.Net (for Fore.NET example) system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Obj: ITabObject;
    Map: IPrxMap;
    Sheet: IPrxSheet;
    Info: IMapTerritoryInfo;
    Legend: IMapLegend;
    RectFL, RectFT: IGxRectF;
    LayerL, LayerT: IMapLayer;
    Visual: IMapVisual;
Begin
    
//Determine regular report sheet, which contains a map with the PrxMap1 identifier
    Sheet := UiReport1.Report.Sheets.Item(0);
    Map := Sheet.Table.Objects.Object(
"PrxMap1").Extension As IPrxMap;
    
// Create rectangles and set their parameters
    RectFL := New GxRectF.Create(005050);
    RectFT := 
New GxRectF.Create(06050110);
    
// Add a legend by identifier as an object
    Obj := Sheet.Table.Objects.Add("PrxMapLegend", RectFL);
    
// Determine a regular report map, for which a legend is created
    (Obj.Extension As IPrxMapLegend).Map := Map;
    
// Set an indicator for the legend and display it in the specified rectangle
    LayerL := (Map As IMap).Layers.Item(0);
    Visual := LayerL.Visuals.Item(
0);
    (Obj.Extension 
As IMapLegend).Visual := Visual;
    
// Add info by territories as an object
    Obj := Sheet.Table.Objects.Add("PrxMapTerritoryInfo", RectFT);
    
// Determine a regular report map, for which info is created
    (Obj.Extension As IPrxMapTerritoryInfo).Map := Map;
    
// Determine a map layer for info and display it in the specified rectangle
    LayerT := (Map As IMap).Layers.Item(0);
    (Obj.Extension 
As IMapTerritoryInfo).Layer := LayerT;
End Sub Button1OnClick;

After executing the example and clicking the button in the ReportBox component, the regular report map is displayed with the legend and the territory info in the specified rectangles.

Fore.NET Example

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

Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Forms;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    Obj: ITabObject;
    Map: PrxMap;
    Sheet: IPrxSheet;
    Info: IMapTerritoryInfo;
    Legend: IMapLegend;
    RectFL, RectFT: GxRectF = New GxRectFClass();
    LayerL, LayerT: IMapLayer;
    Visual: IMapVisual;
Begin
    //Determine a regular report sheet, which contains a map with the PrxMap1 identifier
    Sheet := uiReportNet1.ReportUi.Report.Sheets.Item[0];
    Map := Sheet.Table.Objects.Object["PrxMap1"].Extension As PrxMap;
    // Create rectangles and set their parameters
    RectFL.Create(005050);
    RectFT.Create(06050110);
    // Add a legend by identifier as an object
    Obj := Sheet.Table.Objects.Add("PrxMapLegend", RectFL);
    // Determine a regular report map, for which a legend is created
    (Obj.Extension As PrxMapLegend).Map := Map;
    // Set an identifier for legend and display it in the specified rectangle
    LayerL := (Map As IMap).Layers.Item[0];
    Visual := LayerL.Visuals.Item[0];
    (Obj.Extension As IMapLegend).Visual := Visual;
    // Add info by territories as an object
    Obj := Sheet.Table.Objects.Add("PrxMapTerritoryInfo", RectFT);
    // Determine a regular report map, for which info is created
    (Obj.Extension As IPrxMapTerritoryInfo).Map := Map;
    // Determine map layer for info and display it in the specified rectangle
    LayerT := (Map As IMap).Layers.Item[0];
    (Obj.Extension As IMapTerritoryInfo).Layer := LayerT;
End Sub;

See also:

IPrxMapLegend