Plugin Introduction:
This sample is used to export map to an .emf, .eps, .gif, .jpg, or .png format picture.
Control/Object/Interface:
Control/Object/Interface |
Properties |
Methods |
Plugin |
|
Initialize(), ExitInstance() |
CtrlAction |
FormClass |
Run() |
IFormMap |
MapControl |
|
MapControl |
Map |
|
Map |
|
OutputMapToEMF(), OutputMapToEPS(), OutputMapToGIF(), OutputMapToJPG(), OutputMapToPNG() |
Application |
ActiveApplication, Output |
|
Basic Steps:
- Open MapExport.sln in the SuperMap iDesktop 8C\SampleCode\MapExport with Microsoft Visual Studio 2008 and compile it.
- When succeeded, you can find two files generated: SuperMap.Desktop.MapExport.dll located in the SuperMap iDesktop 8C\Bin\Plugins\MapExport folder and SuperMap.Desktop.MapExport.config located in the SuperMap iDesktop 8C\WorkEnvironment\Default folder.
- Copy the SampleIcons folder from the SuperMap iDesktop 8C\SampleCode folder to SuperMap iDesktop 8C\SampleCode\Resources.
- Start SuperMap iDesktop 8C.
- Open World.smwu provided in the SuperMap iDesktop 8C\SampleData\World folder. When you open the WorldMap_Day map, you will see the Map Export tab on the Ribbon.
- On the Map window, you need to specify the extent of the map that you want to export into images. For example:
- On the Map Export tab, in the Export group, click the Export Map drop-down arrow to select the format in which you want to export the map.
- In the Save As dialog box that appears, specify the where you want to place the picutre and the name of the picutre, then click Save.
- When you see "Succeeded to export map!" in the Output Window, open the picture to view the result.
Data:
SuperMap iDesktop 8C\SampleData\World\World.smwu.
Note:
When you successfully compile MapExport.sln, SuperMap.Desktop.MapExport.dll and SuperMap.Desktop.MapExport.config will be generated and copied to SuperMap iDesktop 8C\Bin\Plugins\MapExport and SuperMap iDesktop 8C\WorkEnvironment\Default respectively. Each time you start SuperMap iDesktop 8C, the Map Export plugin will be loaded.
If you want to remove the Map Export plugin from SuperMap iDesktop 8C, you only need to delete SuperMap.Desktop.MapExport.config in the SuperMap iDesktop 8C\WorkEnvironment\Default folder.