Map: IPrxMap;
The Map property determines a regular report map, for which a legend is created.
Executing the example requires that the repository contain a regular report, which sheet contains a map with the Regions layer and a map indicator.
Place on the form the Buttoncomponent named Button1, the UiReport component named UiReport1, and the ReportBox component named ReportBox1. For the UiReport component select a regular report in the Object property and set the Active property to True. For the ReportBox component select the UiReport1 component in the Report property.
Add links to the Drawing, Forms, Map, Report, and Tab system assemblies.
The example is a handler of the OnClick event for the Button component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Obj: ITabObject;
Map: IPrxMap;
Sheet: IPrxSheet;
RectFL, RectFT: IGxRectF;
LayerL, LayerT: IMapLayer;
Visual: IMapVisual;
SheetTab: IPrxTable;
Objects: ITabObjects;
Table: ITabSheet;
Begin
//Determine a regular report sheet, which contains a map with the PrxMap1 identifier
Sheet := UiReport1.Report.Sheets.Item(0);
SheetTab := Sheet As IPrxTable;
Table := SheetTab.TabSheet;
Objects := Table.Objects;
Map := 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 := Objects.Add("PrxMapLegend", RectFL);
// Determine a regular report map, for which a legend is built
(Obj.Extension As IPrxMapLegend).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 := Objects.Add("PrxMapTerritoryInfo", RectFT);
// Determine a regular report map, for which territory info is built
(Obj.Extension As IPrxMapTerritoryInfo).Map := Map;
// Set map layer for territory 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 the ReportBox component displays the regular report map with a legend and a territory info in the specified rectangles.
See also: