BeginUpdate;
BeginUpdate();
The BeginUpdate method stops legend rendering.
The rendering can be resumed by calling the IMapTerritoryInfo.EndUpdate method.
To execute the example the repository must contain a regular report with the REPORT identifier. The map containing only map factor must be added to the regular report.
Add links to the Map, Metabase Report,Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Sheet: IPrxSheet;
Table: IPrxTable;
Objects: ITabObjects;
Map: IMap;
Layer: IMapLayer;
Legend: IMapLegend;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get regular report
Report := MB.ItemById("REPORT").Edit As IPrxReport;
// Get map from regular report
Sheet := Report.Activesheet;
Table := Sheet As IPrxTable;
Objects := Table.TabSheet.Objects;
Map := Objects.Item(0).Extension As IMap;
// Add map legend
Legend := New DxMapLegend.Create As IMapLegend;
Map.View.Legend := Legend;
Legend.Visible := True;
// Stop map rendering
Legend.BeginUpdate;
// Display the No Data element in the first place in legend
Layer := Map.Layers.FindByName("Regions");
Legend.Visual := Layer.Visuals.Item(0);
Legend.NoDataElementFirst := True;
Legend.NoDataElementVisible := True;
// Continue map rendering
Legend.EndUpdate;
//Save changes
(Report As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Report: IPrxReport;
Sheet: IPrxSheet;
Table: IPrxTable;
Objects: ITabObjects;
Map: IMap;
Layer: IMapLayer;
Legend: DxMapLegend = New DxMapLegendClass();
Begin
// Get repository
MB := Params.Metabase;
// Get regular report
Report := MB.ItemById["REPORT"].Edit() As IPrxReport;
// Get map from regular report
Sheet := Report.Activesheet;
Table := Sheet As IPrxTable;
Objects := Table.TabSheet.Objects;
Map := Objects.Item[0].Extension As IMap;
// Add map legend
Map.View.Legend := Legend As DxMapLegend;
Legend.Visible := True;
// Stop map rendering
Legend.BeginUpdate();
// Display the No Data element in the first place in legend
Layer := Map.Layers.FindByName["Regions"];
Legend.Visual := Layer.Visuals.Item[0];
Legend.NoDataElementFirst := True;
Legend.NoDataElementVisible := True;
// Continue map rendering
Legend.EndUpdate();
//Save changes
(Report As IMetabaseObject).Save();
End Sub;
After executing the example the legend containing the No Data element on the first position is displayed for the map factor:
The legend drawing is stopped for the parameters update period.
See also: