rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvMapAdapter Class Reference

Defines the Coordinate Adapter class. More...

#include <ilviews/maps/adapter.h>

List of all members.

Public Member Functions

 IlvMapAdapter (const IlvCoordinate &upperLeftCorner, const IlvCoordinate &lowerRightCorner, const IlvRect &destination)
 Initializes an adapter by specifying the area to be mapped.
 IlvMapAdapter (const IlvCoordinate &upperLeftCorner, const IlvCoordinate &lowerRightCorner, IlDouble precision=0)
 Initializes an adapter by specifying the area that will be mapped.
 IlvMapAdapter (IlDouble precision, IlvCoordinate *center=0, IlBoolean invertY=IlTrue)
 Initializes an adapter by specifying its precision.
 IlvMapAdapter (const IlvProjection *projection, IlDouble extension=1.)
 Initializes an adapter that can be used with the Cartesian coordinate system of projection.
IlvMapAdaptercopy () const
 Returns a copy of the adapter.
void ensureVisible (IlvView *view, const IlvCoordinate &upperLeftCorner, const IlvCoordinate &lowerRightCorner) const
 Ensures that a rectangular part of a view becomes visible.
void ensureVisible (IlvView *view, const IlvCoordinate &point) const
 Ensures that a point of a view becomes visible.
void fitTransformerToRect (IlvView *view, const IlvCoordinate &upperLeftCorner, const IlvCoordinate &lowerRightCorner, IlBoolean redraw=IlTrue, IlBoolean keepAspectRatio=IlTrue) const
 Ensures that a rectangular part of a view fits in a view.
void fromViews (const IlvRect &src, IlvCoordinate &upperLeftCorner, IlvCoordinate &lowerRightCorner) const
 Converts a rectangle expressed in the Views coordinate system into a rectangle expressed in the geographic coordinate system.
IlDouble fromViews (IlDouble distance) const
 Converts a distance expressed in the Rogue Wave Views coordinate system into a distance expressed in the geographic coordinate system.
IlvCoordinate fromViews (const IlvPoint &point) const
 Converts a point from the manager coordinate system to the geographic coordinate system.
void fromViews (const IlvPoint &point, IlvCoordinate &coord) const
 Converts a point from the manager coordinate system to the geographic coordinate system.
IlvCoordinate getCenter () const
 Returns the center of the maximal extension of the adapter.
void getMaxExtension (IlvCoordinate &upperLeftCorner, IlvCoordinate &lowerRightCorner) const
 Returns the maximal extension of the adapter.
IlDouble getPrecision () const
 Returns the precision of the adapter.
IlBoolean isBad () const
 Checks the status of the adapter.
IlBoolean isInRange (const IlvCoordinate &point) const
IlBoolean isInvertingY () const
 Checks the direction of the Y axis.
void save (IlvOutputFile &file) const
 Writes the adapter into file.
IlvRect toViews (const IlvCoordinate &upperLeftCorner, const IlvCoordinate &lowerRightCorner) const
 Converts a rectangle expressed in the geographic coordinate system into a rectangle expressed in the manager coordinate system.
IlDouble toViews (IlDouble distance) const
 Converts a distance expressed in the geographic coordinate system into a distance expressed in the Rogue Wave Views coordinate system.
IlvPoint toViews (const IlvCoordinate &coord) const
 Converts a point from the geographic coordinate system to the manager coordinate system.
void toViews (const IlvCoordinate &coord, IlvPoint &point) const
 Converts a point from the geographic coordinate system to the manager coordinate system.

Static Public Member Functions

static IlvMapAdapterLoad (IlvInputFile &file)
 Loads an adapter from the IlvInputFile file.

Detailed Description

Defines the Coordinate Adapter class.

The IlvMapAdapter class is a converter that provides facilities to convert geographic coordinates (that are generally expressed with floating point values in a coordinate system where the vertical axis is oriented upwards) into the points used by an IlvManager which are expressed with integer values in a coordinate system where the vertical axis is oriented downwards.
An adapter is characterized by its precision and its maximal extension. The precision is the distance expressed in the geographic coordinate system between two consecutive points of a manager. The maximal extension is the largest rectangle, expressed in the geographic coordinate system, that can be safely drawn into a manager. This rectangle is not necessarily centered on (0, 0).
With Rogue Wave Views you can, for example, define adapters that let you map the entire Earth's surface into a manager with a precision of three meters.

See also:
IlvMapInfo Library: ilvmaps

Constructor & Destructor Documentation

IlvMapAdapter::IlvMapAdapter ( const IlvProjection projection,
IlDouble  extension = 1. 
)

Initializes an adapter that can be used with the Cartesian coordinate system of projection.

The maximal extension of the adapter is a rectangle centered on projection. Its width and length are equal to extension multiplied by the circumference of the ellipsoid of the projection. When used to map the Earth, with the default extension value of 1, this constructor initializes an adapter with a precision of about three meters.

Parameters:
projection The projection.
extension The extension.
IlvMapAdapter::IlvMapAdapter ( IlDouble  precision,
IlvCoordinate center = 0,
IlBoolean  invertY = IlTrue 
)

Initializes an adapter by specifying its precision.

If center is specified, the maximal extension of the adapter will be centered at center. Otherwise, it is centered at (0, 0). If invertY is set to IlTrue, the geographic coordinate system is assumed to have the vertical axis oriented upwards.

Parameters:
precision The precision of the adapter.
center The center of the extension.
invertY Specifies the orientation of Y axis.
IlvMapAdapter::IlvMapAdapter ( const IlvCoordinate upperLeftCorner,
const IlvCoordinate lowerRightCorner,
IlDouble  precision = 0 
)

Initializes an adapter by specifying the area that will be mapped.

The area is a rectangle specified by its upper left corner and its lower right corner.
By default, the adapter defines the best precision available for the area to be mapped, but it is possible to specify it.

Warning:
[note] The x value of lowerRightCorner must be larger than the x value of upperLeftCorner. Concerning the vertical axis, if upperLeftCorner.y() > lowerRightCorner.y(), the adapter assumes that the vertical axis of the geographic coordinate system is oriented upwards.
Parameters:
upperLeftCorner Upper left corner of the area to be mapped.
lowerRightCorner Lower right corner of the area to be mapped.
precision The precision.
IlvMapAdapter::IlvMapAdapter ( const IlvCoordinate upperLeftCorner,
const IlvCoordinate lowerRightCorner,
const IlvRect destination 
)

Initializes an adapter by specifying the area to be mapped.

Initializes an adapter by specifying the area to be mapped with the parameters upperLeftCorner and lowerRightCorner and its image with the destination parameter expressed in the manager coordinate system. If the area to be mapped does not have the same ratio between length and width as the destination area, the adapter will adjust its parameters as follows:

  • The image of the area to be mapped has the same center as destination.
  • The image of the area to be mapped is contained by destination and is tangent to destination. It also keeps its original ratio between width and height.
Warning:
[note] The x value of lowerRightCorner must be larger than the x value of upperLeftCorner. Concerning the vertical axis, if upperLeftCorner.y() is greater than lowerRightCorner.y(), the adapter assumes that the vertical axis of the geographic coordinate system is oriented upwards.
Parameters:
upperLeftCorner Upper left corner of the area to be mapped.
lowerRightCorner Lower right corner of the area to be mapped.
dest The IlvRect to map to.

Member Function Documentation

IlvMapAdapter* IlvMapAdapter::copy (  )  const

Returns a copy of the adapter.

Returns:
The copy of the object.
void IlvMapAdapter::ensureVisible ( IlvView view,
const IlvCoordinate upperLeftCorner,
const IlvCoordinate lowerRightCorner 
) const

Ensures that a rectangular part of a view becomes visible.

Translates the transformer of view so that the rectangle defined by its upper left and lower right corners in the geographic coordinate system becomes visible.

Warning:
This method works only if view has been added to an IlvManager or to one of its subclasses.
Parameters:
view The view to be translated.
upperLeftCorner The upper left corner of the rectangle which will become visible.
lowerRightCorner The lower right corner of the rectangle which will become visible.
void IlvMapAdapter::ensureVisible ( IlvView view,
const IlvCoordinate point 
) const

Ensures that a point of a view becomes visible.

Translates the transformer of view so that point, expressed in the geographic coordinate system, becomes visible.

Warning:
This method works only if view has been added to an IlvManager or to one of its subclasses.
Parameters:
view The view to be translated.
point The point which becomes visible.
void IlvMapAdapter::fitTransformerToRect ( IlvView view,
const IlvCoordinate upperLeftCorner,
const IlvCoordinate lowerRightCorner,
IlBoolean  redraw = IlTrue,
IlBoolean  keepAspectRatio = IlTrue 
) const

Ensures that a rectangular part of a view fits in a view.

Changes the transformer of view so that the rectangle defined in the geographic coordinate system by its upper left and lower right corners fits the visible area of view. The resulting transformer is the combination of a zoom and a translation.

Warning:
This method works only if view has been added to an IlvManager or one of its subclasses.
Parameters:
view The view.
upperLeftCorner The upper left corner of the rectangle to fit in.
lowerRightCorner The lower right corner of the rectangle to fit in.
redraw Specifies if the view is to be redrawn.
keepAspectRatio Specifies if the transformation should keep the aspect ratio.
void IlvMapAdapter::fromViews ( const IlvRect src,
IlvCoordinate upperLeftCorner,
IlvCoordinate lowerRightCorner 
) const

Converts a rectangle expressed in the Views coordinate system into a rectangle expressed in the geographic coordinate system.

Parameters:
src The IlvRect to be converted.
upperLeftCorner The upper left corner of the converted rectangle.
lowerRightCorner The lower right corner of the converted rectangle.
IlDouble IlvMapAdapter::fromViews ( IlDouble  distance  )  const

Converts a distance expressed in the Rogue Wave Views coordinate system into a distance expressed in the geographic coordinate system.

Parameters:
distance The distance to be converted.
Returns:
The converted distance.
IlvCoordinate IlvMapAdapter::fromViews ( const IlvPoint point  )  const

Converts a point from the manager coordinate system to the geographic coordinate system.

Parameters:
point The point to be converted.
Returns:
The converted point.
void IlvMapAdapter::fromViews ( const IlvPoint point,
IlvCoordinate coord 
) const

Converts a point from the manager coordinate system to the geographic coordinate system.

Parameters:
point The point to be converted.
coord The converted point.
IlvCoordinate IlvMapAdapter::getCenter (  )  const

Returns the center of the maximal extension of the adapter.

Returns:
The center of the maximal extension of the adapter.
void IlvMapAdapter::getMaxExtension ( IlvCoordinate upperLeftCorner,
IlvCoordinate lowerRightCorner 
) const

Returns the maximal extension of the adapter.

This method sets upperLeftCorner to the upper left corner of the maximal extension and sets lowerRightCorner to the lower right corner of the maximal extension.

Parameters:
upperLeftCorner The upper left corner of the extension.
lowerRightCorner The lower left corner of the extension.
IlDouble IlvMapAdapter::getPrecision (  )  const

Returns the precision of the adapter.

The precision is defined as the distance, in the geographic coordinate system unit, between two consecutive points in the manager.

Returns:
The precision of the adapter.
IlBoolean IlvMapAdapter::isBad (  )  const

Checks the status of the adapter.

Returns IlTrue if the adapter has been initialized with wrong parameters, for example, if the rectangle to be mapped has a null area. In this case, the adapter should not be used.

Returns:
IlTrue if the adapter is in an inconsistent state, IlFalse otherwise.
IlBoolean IlvMapAdapter::isInRange ( const IlvCoordinate point  )  const

Checks if a point can be displayed.

Returns IlTrue if point can be displayed into an IlvManager. The function actually tests whether point is inside the maximal extension of the adapter.

Parameters:
point The point to be checked.
Returns:
IlTrue if the point can be displayed, IlFalse otherwise.
IlBoolean IlvMapAdapter::isInvertingY (  )  const

Checks the direction of the Y axis.

Returns IlTrue if the adapter assumes that the vertical axis of the geographic coordinate system is oriented upwards.

Returns:
IlTrue if Y axis is oriented upwards, IlFalse otherwise.
static IlvMapAdapter* IlvMapAdapter::Load ( IlvInputFile file  )  [static]

Loads an adapter from the IlvInputFile file.

It can be used, for example, within the read method of a subclass of IlvNamedProperty.
The returned object must be deleted by the user.

Warning:
[note] The usual way to attach an adapter to an IlvManager and to save it with the manager is to use an IlvMapInfo.
Parameters:
file The file to read from.
Returns:
The read IlvMapAdapter.
void IlvMapAdapter::save ( IlvOutputFile file  )  const

Writes the adapter into file.

Parameters:
file The file to write to.
IlvRect IlvMapAdapter::toViews ( const IlvCoordinate upperLeftCorner,
const IlvCoordinate lowerRightCorner 
) const

Converts a rectangle expressed in the geographic coordinate system into a rectangle expressed in the manager coordinate system.

Parameters:
upperLeftCorner The upper left corner of the rectangle to be converted.
lowerRightCorner The lower right corner of the rectangle to be converted.
Returns:
The converted IlvRect .
IlDouble IlvMapAdapter::toViews ( IlDouble  distance  )  const

Converts a distance expressed in the geographic coordinate system into a distance expressed in the Rogue Wave Views coordinate system.

Parameters:
distance The distance to be converted.
Returns:
The converted distance.
IlvPoint IlvMapAdapter::toViews ( const IlvCoordinate coord  )  const

Converts a point from the geographic coordinate system to the manager coordinate system.

Parameters:
coord The coordinate to be converted.
Returns:
The converted IlvPoint.
void IlvMapAdapter::toViews ( const IlvCoordinate coord,
IlvPoint point 
) const

Converts a point from the geographic coordinate system to the manager coordinate system.

Parameters:
coord The coordinate to be converted.
point The converted point.

© Copyright 2012, 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.