The CustomTileProvider sample demonstrates how to create a custom tile provider using IMapTileProvider and IMapTile interface and configure it in a Map Control which is placed on a report. This sample makes use of two projects - CustomTileProviders and TileProviderEndUserDesigner in a single Visual Studio solution. The CustomTileProviders project contains the tile server configurations for the tile providers, whereas the TileProviderEndUserDesigner project references the created CustomTileProviders project assemblies.
Sample Location
Visual Basic.NET
<User Folder>\ComponentOne Samples\ActiveReports 8\Page Reports\CPL\API\VB.NET\CustomTileProvider
C#
<User Folder>\ComponentOne Samples\ActiveReports 8\Page Reports\CPL\API\C#\CustomTileProvider
Runtime Features
When you run this sample, the ActiveReports End User Designer appears with an overlaying
Help-Creating a Custom Tile Provider dialog. This dialog gives you step-by-step instructions to create a new tile provider for a Map control with custom settings.
The End User Designer displays a report containing a Map control with MapQuest set as the default tile provider. To change the existing tile provider, double-click on the Map control to display the existing tile layer and right click to select
Edit. In the
Map Tile Properties - General dialog that appears, click the
Provider drop-down to select the tile provider you want to apply to the Map control. Go to the to view the data in the selected tile provider. You can choose from the following tile provider options:
- Google-Sample
- Cloud-Made Sample
- MapQuest-Sample
- OpenStreetMap-Sample
|
Note: The Microsoft Bing Map server offers static map images. This requires an Application key for authentication. The default key provided by ActiveReports is for demo purpose and can not be used by 3rd party applications. In order to obtain a Bing Map Key, see HowTo - Create a Bing Map Account and HowTo - Generate a Bing Map Key. |
Project Details
CustomTileProviders folder
This folder contain files that are used in the CustomTileProvider project.
CloudMadeTileProvider.cs
GoogleMapsTileProvider.cs
MapQuestTileProvider.cs
MapTile.cs
This class represents a single map tile, implementing the IMapTile interface. For more information on ImapTile interface, see
Add a Custom Tile Provider.
OpenStreetMapTileProvider.cs
WebRequestHelper.cs
This class picks the raw data from the tile providers and loads them into the System.IO.MemoryStream class.
TileProviderEndUserDesigner folder
This folder contain files that are used in the TileProviderEndUserDesigner project.
CustomTileProvider.rdlx
This report contains the Map control that visualizes the oil production in different parts of the world on a virtual earth background. The map control uses the color rule set on a polygon layer to differentiate parts of world as per their oil production capacity. These colors are defined using a color rule which is described in the legend at runtime. The report gets the data from Factbook.rdsx shared data source.
DesignerForm.cs
This is the main form that gets displayed when you run the sample. This form uses multiple controls like the ToolStripPanel, ToolStripContainerPanel, SplitContainer, Designer, Toolbox, ReportExplorer and PropertyGrid controls to create a customized End User Designer. It also contains code to load CustomTileProvider.rdlx report into the Designer.
GrapeCity.ActiveReports.config
This configuration file contains the settings for the various tile providers, and is located in the same folder as the EndUserDesigner.exe file for the tile provider settings to work.
HelperForm.cs
This form uses the HelperForm class to display a screen containing step-by-step instructions for the user to create a custom tile provider.