CreateRangeMapDataAdapter(AdapterType: PrxMapAdapter; Sheet: IPrxSheet): IPrxMapDataAdapter;
CreateRangeMapDataAdapter(AdapterType: Prognoz.Platform.Interop.Report.PrxMapAdapter; Sheet: Prognoz.Platform.Interop.Report.IPrxSheet) : Prognoz.Platform.Interop.Report.IPrxMapDataAdapter;
AdapterType. Adapter type for displaying source data on the map.
Sheet. A page containing data ranges, which should be displayed on the map.
The CreateRangeMapDataAdapter method creates a data adapter for a map allowing to display data from the specified data range.
Identifiers of regions and values for them must be specified in separate ranges.
Executing the example requires a regular report with the REGULAR_REPORT identifier, the first report sheet contains a map with the Regions layer, the second report sheet contains a table with data for some regions. Add links to the Metabase, Report, Tab, Map system assemblies in the unit.
Sub UserProc;
Var
Mb: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Tab: ITabSheet;
Map: IMap;
BarVisual: IMapBarVisual;
PrxDA: IPrxMapDataAdapter;
Range: IPrxRange;
DataAdapterM: IPrxDataAdapterManager;
Begin
Mb := MetabaseClass.Active;
MObj := Mb.ItemById("REGULAR_REPORT").Edit;
Report := MObj As IPrxReport;
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
// Add a bar indicator to map
Map := Tab.Objects.Item(0).Extension As IMap;
BarVisual := Map.Layers.FindByName("Regions").Visuals.AddBarVisual;
// Create a data adapter for map
DataAdapterM := New PrxDataAdapterManager.Create;
PrxDA := DataAdapterM.CreateRangeMapDataAdapter(PrxMapAdapter.Static, Report.ActiveSheet);
// Determine sheet with data
PrxDa.Sheet := Report.Sheets.Item(1);
// Set cell range containing region identifiers
PrxDA.IdRange := Tab.ParseRange("B35:B37");
// Set cell range with displayed data on map
PrxDa.DataRange := Tab.ParseRange("C35:C37");
BarVisual.DataAdapter := PrxDA As IMapDataAdapter;
MObj.Save;
End Sub UserProc;
After executing the example a new bar indicator displaying data on specified regions is created for a map.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Map;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Tab: ITabSheet;
Map: IMap;
BarVisual: IMapBarVisual;
PrxDA: IPrxMapDataAdapter;
Range: IPrxRange;
DataAdapterM: PrxDataAdapterManager = New PrxDataAdapterManagerClass();
Begin
Mb := Params.Metabase;
MObj := Mb.ItemById["REGULAR_REPORT"].Edit();
Report := MObj As IPrxReport;
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
// Add a bar indicator to map
Map := Tab.Objects.Item[0].Extension As IMap;
BarVisual := Map.Layers.FindByName["Regions"].Visuals.AddBarVisual();
// Create a data adapter for map
PrxDA := DataAdapterM.CreateRangeMapDataAdapter(PrxMapAdapter.pmaStatic, Report.ActiveSheet);
// Determine sheet with data
PrxDa.Sheet := Report.Sheets.Item[1];
// Set cell range containing region identifiers
PrxDA.IdRange := Tab.ParseRange("B35:B37");
// Set cell range with displayed data on map
PrxDa.DataRange := Tab.ParseRange("C35:C37");
BarVisual.DataAdapter := PrxDA As IMapDataAdapter;
MObj.Save();
End Sub;
See also: