Rogue Wave Views
Maps Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions
IlvMapAdapter Class Reference

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...
 
IlvMapAdaptercopy () 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
 
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 IlvMapAdapterLoad (IlvInputFile &file)
 Loads an adapter from an input file. More...
 

Detailed Description

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.

See also
IlvMapInfo.

Constructor & Destructor Documentation

§ IlvMapAdapter() [1/4]

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.

Parameters
projectionThe projection.
extensionThe extension.

§ IlvMapAdapter() [2/4]

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
precisionThe precision of the adapter.
centerThe center of the extension.
invertYSpecifies the orientation of Y axis.

§ IlvMapAdapter() [3/4]

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.

Note
The 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.
Parameters
ulUpper left corner of the area to be mapped.
lrLower right corner of the area to be mapped.
precisionThe precision.

§ IlvMapAdapter() [4/4]

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:

  • 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.
Note
The 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.
Parameters
ulUpper left corner of the area to be mapped.
lrLower right corner of the area to be mapped.
destinationThe rectangle to map to.

Member Function Documentation

§ copy()

IlvMapAdapter* IlvMapAdapter::copy ( ) const

Returns a copy of the adapter.

Returns
The copy of the object.

§ ensureVisible() [1/2]

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
viewThe view to be translated.
pointThe point which becomes visible.

§ ensureVisible() [2/2]

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.

Warning
This method works only if view has been added to an IlvManager or to one of its subclasses.
Parameters
viewThe view to be translated.
ulThe upper left corner of the rectangle which
  • will become visible.
lrThe lower right corner of the rectangle which will become visible.

§ fitTransformerToRect()

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.

Warning
This method works only if view has been added to an IlvManager or one of its subclasses.
Parameters
viewThe view.
ulThe upper left corner of the rectangle to fit in.
lrThe lower right corner of the rectangle to fit in.
redrawSpecifies if the view is to be redrawn.
keepAspectRatioSpecifies if the transformation should keep the aspect ratio.

§ fromViews() [1/4]

void IlvMapAdapter::fromViews ( const IlvPoint p,
IlvCoordinate c 
) const

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

Parameters
pThe point to be converted.
cThe converted point.

§ fromViews() [2/4]

IlvCoordinate IlvMapAdapter::fromViews ( const IlvPoint point) const

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

Parameters
pointThe point to be converted.
Returns
The converted point.

§ fromViews() [3/4]

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
distanceThe distance to be converted.
Returns
The converted distance.

§ fromViews() [4/4]

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.

Parameters
srcThe IlvRect to be converted.
ulThe upper left corner of the converted rectangle.
lrThe lower right corner of the converted rectangle.

§ getCenter()

IlvCoordinate IlvMapAdapter::getCenter ( ) const

Returns the center of the maximal extension of the adapter.

Returns
The center of the maximal extension of the adapter.

§ getMaxExtension()

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.

Parameters
ulThe upper left corner of the extension.
lrThe lower left corner of the extension.

§ getPrecision()

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.

§ isBad()

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.

§ isInRange()

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
pointThe point to be checked.
Returns
IlTrue if the point can be displayed, IlFalse otherwise.

§ isInvertingY()

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.

§ Load()

static IlvMapAdapter* IlvMapAdapter::Load ( IlvInputFile file)
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.

Note
The usual way to attach an adapter to an IlvManager and to save it with the manager is to use an IlvMapInfo.
Parameters
fileThe file to read from.
Returns
The read IlvMapAdapter.

§ save()

void IlvMapAdapter::save ( IlvOutputFile file) const

Writes the adapter into file.

Parameters
fileThe file to write to.

§ toViews() [1/4]

void IlvMapAdapter::toViews ( const IlvCoordinate c,
IlvPoint p 
) const

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

Parameters
cThe coordinate to be converted.
pThe converted point.

§ toViews() [2/4]

IlvPoint IlvMapAdapter::toViews ( const IlvCoordinate coord) const

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

Parameters
coordThe coordinate to be converted.
Returns
The converted IlvPoint.

§ toViews() [3/4]

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
distanceThe distance to be converted.
Returns
The converted distance.

§ toViews() [4/4]

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.

Parameters
ulThe upper left corner of the rectangle to be converted.
lrThe lower right corner of the rectangle to be converted.
Returns
The converted IlvRect .

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