Map: IPrxMap;
The Map property determines a regular report map, for which a legend is created.
Executing the example requires a regular report, which sheet contains a map with the Regions slice and the Map indicator. The form should contain a button with the Button1 name, the UiReport non-visual component named UiReport1, the ReportBox component named ReportBox1. Select regular report as an object in the UiReport component properties, 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(0, 0, 50, 50);
RectFT := New GxRectF.Create(0, 60, 50, 110);
// 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, on clicking the button, the ReportBox component displays regular report map with legend and info by territories in the specified rectangles.
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(0, 0, 50, 50);
RectFT.Create(0, 60, 50, 110);
// 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: