Rogue Wave Views Maps Package API Reference Guide |
Rogue Wave Views Documentation Home |
Defines the Coordinate Adapter class. More...
#include <ilviews/maps/adapter.h>
Public Member Functions | |
IlvMapAdapter (const IlvProjection *projection, IlDouble extension=1.) | |
Initializes an adapter that can be used with the Cartesian coordinate system of a projection. More... | |
IlvMapAdapter (IlDouble precision, IlvCoordinate *center=0, IlBoolean invertY=IlTrue) | |
Initializes an adapter by specifying its precision. More... | |
IlvMapAdapter (const IlvCoordinate &ul, const IlvCoordinate &lr, IlDouble precision=0) | |
Initializes an adapter by specifying the area that will be mapped. More... | |
IlvMapAdapter (const IlvCoordinate &ul, const IlvCoordinate &lr, const IlvRect &destination) | |
Initializes an adapter by specifying the area to be mapped. More... | |
IlvMapAdapter * | copy () const |
Returns a copy of the adapter. More... | |
void | ensureVisible (IlvView *view, const IlvCoordinate &point) const |
Ensures that a point of a view becomes visible. More... | |
void | ensureVisible (IlvView *view, const IlvCoordinate &ul, const IlvCoordinate &lr) const |
Ensures that a rectangular part of a view becomes visible. More... | |
void | fitTransformerToRect (IlvView *view, const IlvCoordinate &ul, const IlvCoordinate &lr, IlBoolean redraw=IlTrue, IlBoolean keepAspectRatio=IlTrue) const |
Ensures that a rectangular part of a view fits in a view. More... | |
void | fromViews (const IlvPoint &p, IlvCoordinate &c) const |
Converts a point from the manager coordinate system to the geographic coordinate system. More... | |
IlvCoordinate | fromViews (const IlvPoint &point) const |
Converts a point from the manager coordinate system to the geographic coordinate system. More... | |
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. More... | |
void | fromViews (const IlvRect &src, IlvCoordinate &ul, IlvCoordinate &lr) const |
Converts a rectangle expressed in the Views coordinate system into a rectangle expressed in the geographic coordinate system. More... | |
IlvCoordinate | getCenter () const |
Returns the center of the maximal extension of the adapter. More... | |
void | getMaxExtension (IlvCoordinate &ul, IlvCoordinate &lr) const |
Returns the maximal extension of the adapter. More... | |
IlDouble | getPrecision () const |
Returns the precision of the adapter. More... | |
IlBoolean | isBad () const |
Checks the status of the adapter. More... | |
IlBoolean | isInRange (const IlvCoordinate &point) const |
Checks if a point can be displayed. More... | |
IlBoolean | isInvertingY () const |
Checks the direction of the Y axis. More... | |
void | save (IlvOutputFile &file) const |
Writes the adapter into file. More... | |
void | toViews (const IlvCoordinate &c, IlvPoint &p) const |
Converts a point from the geographic coordinate system to the manager coordinate system. More... | |
IlvPoint | toViews (const IlvCoordinate &coord) const |
Converts a point from the geographic coordinate system to the manager coordinate system. More... | |
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. More... | |
IlvRect | toViews (const IlvCoordinate &ul, const IlvCoordinate &lr) const |
Converts a rectangle expressed in the geographic coordinate system into a rectangle expressed in the manager coordinate system. More... | |
Static Public Member Functions | |
static IlvMapAdapter * | Load (IlvInputFile &file) |
Loads an adapter from an input file. More... | |
Defines the Coordinate Adapter class.
Library: ilvmaps
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.
IlvMapInfo
. IlvMapAdapter::IlvMapAdapter | ( | const IlvProjection * | projection, |
IlDouble | extension = 1. |
||
) |
Initializes an adapter that can be used with the Cartesian coordinate system of a 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.
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.
precision | The precision of the adapter. |
center | The center of the extension. |
invertY | Specifies the orientation of Y axis. |
IlvMapAdapter::IlvMapAdapter | ( | const IlvCoordinate & | ul, |
const IlvCoordinate & | lr, | ||
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.
x
value of lr must be larger than the x
value of ul. Concerning the vertical axis, if ul.y() > lr.y(), the adapter assumes that the vertical axis of the geographic coordinate system is oriented upwards. ul | Upper left corner of the area to be mapped. |
lr | Lower right corner of the area to be mapped. |
precision | The precision. |
IlvMapAdapter::IlvMapAdapter | ( | const IlvCoordinate & | ul, |
const IlvCoordinate & | lr, | ||
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 ul and lr 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:
x
value of lr must be larger than the x
value of ul. Concerning the vertical axis, if ul.y() is greater than lr.y(), the adapter assumes that the vertical axis of the geographic coordinate system is oriented upwards. ul | Upper left corner of the area to be mapped. |
lr | Lower right corner of the area to be mapped. |
destination | The rectangle to map to. |
IlvMapAdapter* IlvMapAdapter::copy | ( | ) | const |
Returns a copy of the adapter.
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.
IlvManager
or to one of its subclasses. view | The view to be translated. |
point | The point which becomes visible. |
void IlvMapAdapter::ensureVisible | ( | IlvView * | view, |
const IlvCoordinate & | ul, | ||
const IlvCoordinate & | lr | ||
) | 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.
IlvManager
or to one of its subclasses. view | The view to be translated. |
ul | The upper left corner of the rectangle which
|
lr | The lower right corner of the rectangle which will become visible. |
void IlvMapAdapter::fitTransformerToRect | ( | IlvView * | view, |
const IlvCoordinate & | ul, | ||
const IlvCoordinate & | lr, | ||
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.
IlvManager
or one of its subclasses. view | The view. |
ul | The upper left corner of the rectangle to fit in. |
lr | 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 IlvPoint & | p, |
IlvCoordinate & | c | ||
) | const |
Converts a point from the manager coordinate system to the geographic coordinate system.
p | The point to be converted. |
c | The converted point. |
IlvCoordinate IlvMapAdapter::fromViews | ( | const IlvPoint & | point | ) | const |
Converts a point from the manager coordinate system to the geographic coordinate system.
point | The point to be converted. |
Converts a distance expressed in the Rogue Wave Views coordinate system into a distance expressed in the geographic coordinate system.
distance | The distance to be converted. |
void IlvMapAdapter::fromViews | ( | const IlvRect & | src, |
IlvCoordinate & | ul, | ||
IlvCoordinate & | lr | ||
) | const |
Converts a rectangle expressed in the Views coordinate system into a rectangle expressed in the geographic coordinate system.
src | The IlvRect to be converted. |
ul | The upper left corner of the converted rectangle. |
lr | The lower right corner of the converted rectangle. |
IlvCoordinate IlvMapAdapter::getCenter | ( | ) | const |
Returns the center of the maximal extension of the adapter.
void IlvMapAdapter::getMaxExtension | ( | IlvCoordinate & | ul, |
IlvCoordinate & | lr | ||
) | const |
Returns the maximal extension of the adapter.
This method sets ul to the upper left corner of the maximal extension and sets lr to the lower right corner of the maximal extension.
ul | The upper left corner of the extension. |
lr | 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.
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.
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.
point | The point to be checked. |
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.
IlTrue
if Y
axis is oriented upwards, IlFalse
otherwise.
|
static |
Loads an adapter from an input 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.
IlvManager
and to save it with the manager is to use an IlvMapInfo
. file | The file to read from. |
IlvMapAdapter
. void IlvMapAdapter::save | ( | IlvOutputFile & | file | ) | const |
Writes the adapter into file.
file | The file to write to. |
void IlvMapAdapter::toViews | ( | const IlvCoordinate & | c, |
IlvPoint & | p | ||
) | const |
Converts a point from the geographic coordinate system to the manager coordinate system.
c | The coordinate to be converted. |
p | The converted point. |
IlvPoint IlvMapAdapter::toViews | ( | const IlvCoordinate & | coord | ) | const |
Converts a point from the geographic coordinate system to the manager coordinate system.
coord | The coordinate to be converted. |
IlvPoint
. Converts a distance expressed in the geographic coordinate system into a distance expressed in the Rogue Wave Views coordinate system.
distance | The distance to be converted. |
IlvRect IlvMapAdapter::toViews | ( | const IlvCoordinate & | ul, |
const IlvCoordinate & | lr | ||
) | const |
Converts a rectangle expressed in the geographic coordinate system into a rectangle expressed in the manager coordinate system.
ul | The upper left corner of the rectangle to be converted. |
lr | The lower right corner of the rectangle to be converted. |
IlvRect
. © Copyright 2018, 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.