|
CartoType API
|
#include <cartotype_projection.h>
Public Member Functions | |
| CT_IMPORT | TCoordinateTransform (const TCoordinateTransformParam &aParam) |
| CT_IMPORT void | Set (const TCoordinateTransformParam &aParam) |
| virtual TResult | Project (const TPoint &aInput, TPoint &aOutput) const =0 |
| virtual TResult | Inverse (const TPoint &aInput, TPoint &aOutput) const =0 |
| virtual TResult | ProjectTo64ths (const TPoint &aInput, TPoint &aOutput) const =0 |
| virtual CT_IMPORT void | Sync () |
| virtual CT_IMPORT const TTransformFP * | FullTransformTo64ths () const |
| virtual TCoordinateTransform * | Copy (TResult &aError) const =0 |
| virtual CT_IMPORT TResult | ProjectContour (MWritableContour &aContour) const |
| virtual CT_IMPORT TResult | ProjectContourTo64ths (MWritableContour &aContour) const |
| CT_IMPORT TResult | PixelsToMeters (int32 &aDistance) const |
| CT_IMPORT TResult | MetersToPixels (int32 &aDistance) const |
| virtual CT_IMPORT TResult | PixelRectToInputRect (const TRect &aPixelRect, TRect &aInputRect) const |
| virtual CT_IMPORT TResult | InputRectToPixelRect (const TRect &aInputRect, TRect &aPixelRect) const |
| CT_IMPORT TResult | MultiplyScale (const TFixed &aFactor) |
| CT_IMPORT TResult | MultiplyScale (double aFactor) |
| CT_IMPORT void | Translate (double aDeltaX, double aDeltaY) |
| CT_IMPORT void | Translate (TFixed aDeltaX, TFixed aDeltaY) |
| CT_IMPORT void | Rotate (TFixed aAngle, const TPoint &aCenter) |
| CT_IMPORT void | Rotate (double aAngle, const TPoint &aCenter) |
| CT_IMPORT void | SetRotation (TFixed aAngle, const TPoint &aCenter) |
| CT_IMPORT void | SetRotation (double aAngle, const TPoint &aCenter) |
| virtual CT_IMPORT TResult | Read (TDataInputStream &aInput) |
| virtual CT_IMPORT TResult | Write (TDataOutputStream &aOutput) const |
| bool | InputIn64ths () const |
| TFixedSmall | PixelsPerMeter () const |
Protected Attributes | |
| TTransformFP | iTransform |
| TTransformFP | iInverseTransform |
| int32 | iScale |
| double | iScaleFloat |
| bool | iProjectFromMeters |
| bool | iInputIn64ths |
| TFixedSmall | iPixelsPerMeter |
| TResult | iErrorStatus |
The abstract base class for coordinate transformation classes. A coordinate transform can convert between any two representations of positions as two-dimensional integer points. Its commonest uses are (i) to convert between latitude and longitude (represented as 65536ths of a degree) and projected map metres, when creating a map database (in the tool generate_map_data_type1); and (ii) to convert between projected map metres and display pixels, when drawing the map.
| virtual TCoordinateTransform* CartoType::TCoordinateTransform::Copy | ( | TResult & | aError | ) | const [pure virtual] |
Create an exact copy of this object.
Implemented in CartoType::TSimpleCoordinateTransform, CartoType::TNullProjection, CartoType::TOrdnanceSurveyProjection, CartoType::TMillerCylindrical, CartoType::TMercator, CartoType::TUtmEllipsoidal, CartoType::TTransverseMercator, and CartoType::TCylindricalEquidistant.
| CT_EXPORT const TTransformFP * TCoordinateTransform::FullTransformTo64ths | ( | ) | const [virtual] |
Return the full transformation to 64ths of units if possible; that is, if this object can be represented as an affine transform. If not, return null.
Reimplemented in CartoType::TSimpleCoordinateTransform.
| CT_EXPORT TResult TCoordinateTransform::InputRectToPixelRect | ( | const TRect & | aInputRect, |
| TRect & | aPixelRect | ||
| ) | const [virtual] |
Convert a rectangle in projection input units to the smallest bounding box in pixels. This is done by projecting all four corners of the input rectangle and determining the minimum and maximum x and y values for the resulting rectangle. The base class implementation is correct if the projection functions are monotonic. If not a derived implementation must take into account extrema of the projection functions.
Reimplemented in CartoType::TTransverseMercator.
| virtual TResult CartoType::TCoordinateTransform::Inverse | ( | const TPoint & | aInput, |
| TPoint & | aOutput | ||
| ) | const [pure virtual] |
Project a point using the inverse transformation.
Implemented in CartoType::TSimpleCoordinateTransform, CartoType::TOrdnanceSurveyProjection, CartoType::TMillerCylindrical, CartoType::TMercator, CartoType::TProjection, and CartoType::TUtmEllipsoidal.
| CT_EXPORT TResult TCoordinateTransform::MetersToPixels | ( | int32 & | aDistance | ) | const |
Convert a distance in meters to pixels.
Multiply the scale by the given factor. Check if overflow results.
| CT_EXPORT TResult TCoordinateTransform::MultiplyScale | ( | double | aFactor | ) |
Multiply the scale by the given factor, using a floating-point scale argument to allow very large or small factors. Check if overflow results.
| CT_EXPORT TResult TCoordinateTransform::PixelRectToInputRect | ( | const TRect & | aPixelRect, |
| TRect & | aInputRect | ||
| ) | const [virtual] |
Convert a rectangle in pixels to the smallest bounding box in projection input units. This is done by projecting all four corners of the pixel rectangle and determining the minimum and maximum x and y values for the resulting rectangle. The base class implementation is correct if the inverse projection functions are monotonic. If not a derived implementation must take into account extrema of the inverse projection functions.
Reimplemented in CartoType::TTransverseMercator.
| CT_EXPORT TResult TCoordinateTransform::PixelsToMeters | ( | int32 & | aDistance | ) | const |
Convert a distance in pixels to meters.
| virtual TResult CartoType::TCoordinateTransform::Project | ( | const TPoint & | aInput, |
| TPoint & | aOutput | ||
| ) | const [pure virtual] |
Project a point using the transformation.
Implemented in CartoType::TProjectionUsingFloatingPoint, and CartoType::TProjection.
| CT_EXPORT TResult TCoordinateTransform::ProjectContour | ( | MWritableContour & | aContour | ) | const [virtual] |
Project all the points in a contour to pixels. This base version calls Project on all the points and removes duplicates. Derived classes may save time by using faster methods if possible.
| CT_EXPORT TResult TCoordinateTransform::ProjectContourTo64ths | ( | MWritableContour & | aContour | ) | const [virtual] |
Project all the points in a contour to 64ths of pixels. This base version calls Project on all the points and removes duplicates. Derived classes may save time by using faster methods if possible.
Reimplemented in CartoType::TSimpleCoordinateTransform.
| virtual TResult CartoType::TCoordinateTransform::ProjectTo64ths | ( | const TPoint & | aInput, |
| TPoint & | aOutput | ||
| ) | const [pure virtual] |
Convert a point to 64ths of units using the transformation. This function gives the same results as Project, but with both the x and y coordinate multiplied by 64. It is a convenience function used when projecting to 64ths of pixels, which are the internal units used for rendering shapes.
Implemented in CartoType::TProjectionUsingFloatingPoint, and CartoType::TProjection.
| CT_EXPORT TResult TCoordinateTransform::Read | ( | TDataInputStream & | aInput | ) | [virtual] |
A virtual function to read a projection object from serialized data. Derived classes call this base function then read any data of their own.
Reimplemented in CartoType::TOrdnanceSurveyProjection, CartoType::TMercator, CartoType::TUtmEllipsoidal, CartoType::TTransverseMercator, and CartoType::TCylindricalEquidistant.
Rotate the transform around a point in pixels by an angle given in radians.
| CT_EXPORT void TCoordinateTransform::Rotate | ( | double | aAngle, |
| const TPoint & | aCenter | ||
| ) |
Rotate the transform around a point in pixels by an angle given in radians.
Set the transform to a rotation round a point in pixels by an angle given in radians.
| CT_EXPORT void TCoordinateTransform::SetRotation | ( | double | aAngle, |
| const TPoint & | aCenter | ||
| ) |
Set the transform to a rotation round a point in pixels by an angle given in radians.
| CT_EXPORT void TCoordinateTransform::Sync | ( | ) | [virtual] |
Update any internal parameters after a change to a coordinate transform.
Reimplemented in CartoType::TProjectionUsingFloatingPoint, and CartoType::TProjection.
| CT_EXPORT void TCoordinateTransform::Translate | ( | double | aDeltaX, |
| double | aDeltaY | ||
| ) |
Apply a translation to the transform.
Apply a translation to the transform.
| CT_EXPORT TResult TCoordinateTransform::Write | ( | TDataOutputStream & | aOutput | ) | const [virtual] |
A virtual function to write a projection object as serialized data. Derived classes call this base function then write any data of their own. What is written is not the constructed object but the parameter block needed to create it; in this case TCoordinateTransformParam.
Reimplemented in CartoType::TMercator, CartoType::TProjection, CartoType::TUtmEllipsoidal, and CartoType::TTransverseMercator.
TResult CartoType::TCoordinateTransform::iErrorStatus [protected] |
Error status of this coordinate transformation.
bool CartoType::TCoordinateTransform::iInputIn64ths [protected] |
True if the input is in 64ths, not whole units.
The inverse of iTransform.
Ratio between pixels and meters.
bool CartoType::TCoordinateTransform::iProjectFromMeters [protected] |
True if projecting from meters, not degrees. When projecting from meters we use a notional degree size of 65536 meters, which is about 1/1.6966... of the real value. Therefore the scale has to be adjusted.
int32 CartoType::TCoordinateTransform::iScale [protected] |
The ratio between input units and output units, stored as 256 times the value supplied in TCoordinateTransformParam.
double CartoType::TCoordinateTransform::iScaleFloat [protected] |
Scale expressed as a float.
The transform applied to the output after the projection is applied; offsets are in pixels.
1.7.5.1