rwlogo

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
List of all members | Public Member Functions | Static Public Member Functions
IlvMapInfo Class Reference

The IlvMapInfo class is used to attach map information to an IlvManager. More...

#include <ilviews/maps/mapinfo.h>

Public Member Functions

 IlvMapInfo (const IlvProjection *projection, const IlvMapAdapter *adapter=0, IlBoolean copy=IlTrue)
 Initializes a new instance of IlvMapInfo. More...
 
IlvMapInfoattach (IlvManager *manager)
 Attaches the map information to manager. The map information will be automatically saved with the manager.
This method returns the instance of IlvMapInfo that was previously attached to the manager or 0 if none. It also notifies the listeners that have been attached to the manager by the AddMapInfoListener() static method.
More...
 
void detach ()
 Detaches map information from its manager and notifies the listeners of the manager.
 
IlvMapsError forward (const IlvCoordinate &coord, IlvPoint &point) const
 Converts a latitude and a longitude into graphic coordinates. More...
 
const IlvMapAdaptergetAdapter () const
 Returns the adapter of the map information. More...
 
IlvManagergetManager () const
 Returns the manager that this map info is attached to. More...
 
const IlvProjectiongetProjection () const
 Returns the projection of the map information. More...
 
IlDouble getScale (IlvView *view) const
 Returns the cartographic scale of the view. More...
 
const IlvUnitConvertergetUnitConverter () const
 Returns the unit converter of the map information. More...
 
IlvMapsError inverse (const IlvPoint &point, IlvCoordinate &coord) const
 Converts graphic coordinates into geographic coordinates. More...
 
IlvMapsError inverse (const IlvEvent &event, const IlvView *view, IlvCoordinate &coord) const
 Computes the longitude and latitude of the mouse event event that occurred in view. The result is stored in coord.
More...
 
void setScale (IlvView *view, IlDouble scale, IlBoolean redraw=IlTrue) const
 Sets the scale of view to scale. In the following example scale is set to 1/50,000th.
More...
 
IlvMapsError toViews (const IlvCoordinate &data, const IlvProjection *sourceProjection, IlvPoint &result) const
 Converts a coordinate expressed in a source projection into the manager coordinate system, after having applied the projection of the map info. More...
 

Static Public Member Functions

static void AddMapInfoListener (IlvManager *manager, IlvMapInfoListener *listener)
 Registers listener so that it can be notified about map information changes occurring to manager. More...
 
static IlvMapInfoGet (IlvManager *manager)
 Returns the map information that is attached to the specified manager. More...
 
static void RemoveMapInfoListener (IlvManager *manager, IlvMapInfoListener *listener)
 Removes specified listener to the notification list of the specified manager. More...
 
static void SetScreenSize (IlvDisplay *display, IlUInt heightmm, IlUInt widthmm)
 Specifies the height and the width of the display screen for a more accurate scale management. More...
 

Detailed Description

The IlvMapInfo class is used to attach map information to an IlvManager.

This class is used to attach map information to an IlvManager.
This information is persistent and is automatically saved when the manager is saved.
When an IlvMapInfo is attached to an IlvManager, the manager becomes georeferenced. The points of the manager can be interpreted in terms of distances. Heterogeneous map data can be potentially loaded into the manager because the Cartesian coordinate system of the manager (specified by a projection) is known.
In addition to enabling applications to save georeferencing information, the IlvMapInfo class provides additional services, such as directly converting latitude and longitude into points expressed in the manager coordinate system, converting mouse events into latitude and longitude, or setting the scale of a view.
Library: ilvmaps

See Also
IlvMapAdapter, IlvProjection, IlvUnitConverter, IlvMapInfoListener.

Constructor & Destructor Documentation

IlvMapInfo::IlvMapInfo ( const IlvProjection projection,
const IlvMapAdapter adapter = 0,
IlBoolean  copy = IlTrue 
)

Initializes a new instance of IlvMapInfo.

Initializes an IlvMapInfo with projection and adapter.

Parameters
projectionThe projection to be attached.
adapterThe adapter for this projection. If this parameter is not specified, a new IlvMapAdapter optimized for the projection is used.
copyIf IlTrue, the arguments projection and adapter are copied. If not specified, defaults to IlTrue.

Member Function Documentation

static void IlvMapInfo::AddMapInfoListener ( IlvManager manager,
IlvMapInfoListener listener 
)
static

Registers listener so that it can be notified about map information changes occurring to manager.

Parameters
managerThe manager to listen to.
listenerThe listener to register.
IlvMapInfo* IlvMapInfo::attach ( IlvManager manager)

Attaches the map information to manager. The map information will be automatically saved with the manager.
This method returns the instance of IlvMapInfo that was previously attached to the manager or 0 if none. It also notifies the listeners that have been attached to the manager by the AddMapInfoListener() static method.

Warning
When map information is attached to a manager, the manager becomes the owner of the map information, and will delete it in its destructor.
Parameters
managerThe manager this map info is attached to.
Returns
The previously attached map info, if any.
IlvMapsError IlvMapInfo::forward ( const IlvCoordinate coord,
IlvPoint point 
) const

Converts a latitude and a longitude into graphic coordinates.

This member function is a convenience function that first calls the forward() function of the projection of the map information, and then the toViews() function of the adapter.

Parameters
coordThe geographic coordinates to be converted.
pointStores the graphic coordinates of the point.
Returns
The error code returned by IlvProjection::forward().
static IlvMapInfo* IlvMapInfo::Get ( IlvManager manager)
static

Returns the map information that is attached to the specified manager.

This static function is a convenience function that returns the instance of IlvMapInfo that is attached to manager, or a null pointer if no map information is attached to it.

Parameters
managerThe manager which map information is to be returned.
Returns
The attached IlvMapInfo.
const IlvMapAdapter* IlvMapInfo::getAdapter ( ) const

Returns the adapter of the map information.

The adapter is used to convert coordinates expressed in the geographic Cartesian coordinate system (that is, projected latitude and longitude) into points in a manager coordinate system.

Returns
The adapter of the map information.
IlvManager* IlvMapInfo::getManager ( ) const

Returns the manager that this map info is attached to.

Returns
The manager to which the map information is attached or a null pointer if the map is not attached to any manager.
const IlvProjection* IlvMapInfo::getProjection ( ) const

Returns the projection of the map information.

The projection is used to convert latitude and longitude into a Cartesian coordinate system.

Returns
The projection of the map information.
IlDouble IlvMapInfo::getScale ( IlvView view) const

Returns the cartographic scale of the view.

The scale is the ratio between the size of the objects drawn in view and the size of these objects in the geographic Cartesian coordinate system, which could be called the real size of these objects.

Note
The computation of the scale depends on the size of the screen where view is displayed. The getScale()() method tries to determine this size, but the platform API to get this size often returns inaccurate results. For a more precise scale management, you can specify the size of the screen using the SetScreenSize() static function.
Parameters
viewThe view for which the scale is to be computed.
Returns
The scale of the view.
const IlvUnitConverter* IlvMapInfo::getUnitConverter ( ) const

Returns the unit converter of the map information.

The unit converter is used to convert distances in the geographic Cartesian coordinate system into meters.

Returns
The unit converter of the map information.
IlvMapsError IlvMapInfo::inverse ( const IlvPoint point,
IlvCoordinate coord 
) const

Converts graphic coordinates into geographic coordinates.

This member function is a convenience function that calls first the fromViews() function of the adapter of the map information, and then the inverse() function of the projection.

Parameters
pointThe graphic coordinates to be converted.
coordStores the geographic coordinates of the point.
Returns
The error code returned by IlvProjection::inverse().
IlvMapsError IlvMapInfo::inverse ( const IlvEvent event,
const IlvView view,
IlvCoordinate coord 
) const

Computes the longitude and latitude of the mouse event event that occurred in view. The result is stored in coord.

Warning
This function should not be called if the instance of IlvMapInfo is not attached to the manager of the view.
Parameters
eventThe mouse event.
viewThe view in which the event occurred.
coordStores the result of the computation.
Returns
The error code returned by IlvProjection::inverse().
static void IlvMapInfo::RemoveMapInfoListener ( IlvManager manager,
IlvMapInfoListener listener 
)
static

Removes specified listener to the notification list of the specified manager.

Removes listener from the list of listeners that will be notified about the map information changes that occur to manager.

Parameters
managerThe target manager.
listenerThe listener to be removed.
void IlvMapInfo::setScale ( IlvView view,
IlDouble  scale,
IlBoolean  redraw = IlTrue 
) const

Sets the scale of view to scale. In the following example scale is set to 1/50,000th.

mapInfo->setScale(view,
1. / 50000.,
IlTrue);
Parameters
viewThe view which scale is to be set.
scaleThe scale to be set.
redrawIf IlTrue, an immediate refresh of the view is performed. If IlFalse, this method only affects the transformer of the view. If not specified, this defaults to IlTrue.
static void IlvMapInfo::SetScreenSize ( IlvDisplay display,
IlUInt  heightmm,
IlUInt  widthmm 
)
static

Specifies the height and the width of the display screen for a more accurate scale management.

Parameters
displayThe display.
heightmmThe height of the screen, in millimeters.
widthmmThe width of the screen, in millimeters.
IlvMapsError IlvMapInfo::toViews ( const IlvCoordinate data,
const IlvProjection sourceProjection,
IlvPoint result 
) const

Converts a coordinate expressed in a source projection into the manager coordinate system, after having applied the projection of the map info.

Parameters
dataThe coordinate to be translated, expressed in the source projection.
sourceProjectionThe projection of data. If this parameter is set to 0, the function assumes that data is expressed in the mapinfo projection.
resultStores the result of the translation.
Returns
The error code returned by projection conversion functions.

© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.