Selecting a Target Projection
Maps are always represented within a specific projection system. If you want to merge data coming from different sources into the same manager, you should be able to reproject it so that its respective positions on the target map reflect its exact positions in the source projection. Also if you include Rogue Wave® Views Maps graphical user interface component, such as the scale, the compass, or the coordinate viewer in your application, these components need to know the reference projection to operate correctly. The Rogue Wave Views components designed for cartography can be found in the GUI package.
Associating a projection with an
IlvManager is done using a
IlvMapInfo class. This class holds an
IlvProjection and an
IlvMapAdapter, and thus define the projection and the mapping between the geographic coordinates and the manager coordinates.
The following example associates a Mercator projection with the manager:
IlvMercatorProjection* proj = new IlvMercatorProjection(); IlvMapInfo* mapInfo = new IlvMapInfo(proj, 0, IlvFalse); mapInfo->attach(_manager); |
The map info is automatically saved when the manager is saved to an
.ilv file (via a call to the
IlvManager::save method). When reading a map from an
.ilv file, you can retrieve the projection contained in the manager to find out what kind of projection was used to create the map. For example:
IlvManager* manager = new IlvManager(display); manager->read(fileName); IlvMapInfo* mapInfo = IlvMapInfo::Get(manager); if(!mapInfo) { IlvPrint("No IlvMapInfo was saved in this file"); } else { const IlvProjection* projection = mapInfo->getProjection(); if(!projection) IlvPrint("No projection was saved in this file"); else IlvPrint("The %s projection was saved in this file", projection->getClassInfo()->getProjectionName()); } |
The package
projection provides a number of predefined projections which all inherit from the
IlvProjection base class. These projections are described in
Map Projections. See also the section
Loading Nongeoreferenced Files.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.