libosmscout
0.1
|
Mercator projection as used by the OpenStreetMap tile rendering code. More...
#include <TileProjection.h>
Public Member Functions | |
bool | CanBatch () const override |
bool | GeoToPixel (const GeoCoord &coord, Vertex2D &pixel) const override |
Converts a geo coordinate to a pixel coordinate. More... | |
bool | IsLinearInterpolationEnabled () const |
bool | IsValid () const override |
bool | IsValidFor (const GeoCoord &coord) const override |
Return true if given coordinate is valid for this projection. More... | |
TileProjection & | operator= (const TileProjection &)=default |
TileProjection & | operator= (TileProjection &&)=default |
bool | PixelToGeo (double x, double y, GeoCoord &coord) const override |
Converts a pixel coordinate to a geo coordinate. More... | |
bool | Set (const OSMTileId &tile, const Magnification &magnification, double dpi, size_t width, size_t height) |
bool | Set (const OSMTileId &tile, const Magnification &magnification, size_t width, size_t height) |
bool | Set (const OSMTileIdBox &tileBox, const Magnification &magnification, double dpi, size_t width, size_t height) |
void | SetLinearInterpolationUsage (bool b) |
Switch to enable/disable linear interpolation of latitude to pixel computation. More... | |
TileProjection ()=default | |
TileProjection (const TileProjection &)=default | |
TileProjection (TileProjection &&)=default | |
~TileProjection () override=default | |
![]() | |
bool | BoundingBoxToPixel (const GeoBox &boundingBox, ScreenBox &screenBox) const |
Converts a valid GeoBox to its on screen pixel coordinates. More... | |
double | ConvertPixelToWidth (double pixel) const |
Convert a width in pixel into the equivalent mm size based on the given DPI. More... | |
double | ConvertWidthToPixel (double width) const |
Convert a width in mm into the equivalent pixel size based on the given DPI. More... | |
double | GetAngle () const |
Returns the angle in radians ([0..2*PI[) of the display in relation to the north. More... | |
GeoCoord | GetCenter () const |
GeoBox | GetDimensions () const |
double | GetDPI () const |
Return the DPI as part of the projection. More... | |
size_t | GetHeight () const |
Returns the height of the screen. More... | |
Magnification | GetMagnification () const |
Return the magnification as part of the projection. More... | |
double | GetMeterInMM () const |
Returns the number of on screen millimeters for one meter on the ground. More... | |
double | GetMeterInPixel () const |
Returns the number of on screen pixel for one meter on the ground. More... | |
double | GetPixelSize () const |
Returns the size of a pixel in meter. More... | |
ScreenBox | GetScreenBox () const |
Return a ScreenBox instance for the screen. More... | |
size_t | GetWidth () const |
Returns the width of the screen. More... | |
Projection & | operator= (const Projection &)=default |
Projection & | operator= (Projection &&)=default |
Projection ()=default | |
Projection (const Projection &)=default | |
Projection (Projection &&)=default | |
virtual | ~Projection ()=default |
Protected Member Functions | |
void | GeoToPixel (const BatchTransformer &transformData) const override |
virtual bool | SetInternal (const GeoBox &boundingBox, const Magnification &magnification, double dpi, size_t width, size_t height) |
Additional Inherited Members | |
![]() | |
double | angle =0.0 |
Display rotation angle in radians, canvas clockwise. More... | |
GeoBox | boundingBox |
Bounding box of the current projection on the ground. More... | |
GeoCoord | center |
Coordinate of the center of the displayed area. More... | |
double | dpi =0.0 |
Screen DPI. More... | |
size_t | height =0 |
Height of image. More... | |
Magnification | magnification |
Current magnification. More... | |
double | meterInMM =0.0 |
Number of on screen millimeters for one meter on the ground. More... | |
double | meterInPixel =0.0 |
Number of on screen pixel for one meter on the ground. More... | |
double | pixelSize =0.0 |
Size of a pixel in meter. More... | |
size_t | width =0 |
Width of image. More... | |
Mercator projection as used by the OpenStreetMap tile rendering code.
The TileProjection simplifies the general Mercator projection code to make sure that there are no effects based on rounding errors or similar.
|
default |
|
default |
|
default |
|
overridedefault |
|
inlineoverridevirtual |
Implements osmscout::Projection.
|
overrideprotectedvirtual |
Implements osmscout::Projection.
|
overridevirtual |
Converts a geo coordinate to a pixel coordinate.
Return true on success, false if given coordinate is not valid for this projection.
Implements osmscout::Projection.
References osmscout::Projection::center, osmscout::GeoCoord::GetLat(), osmscout::GeoCoord::GetLon(), osmscout::gradtorad, osmscout::Projection::height, and IsValidFor().
|
inline |
|
inlineoverridevirtual |
Implements osmscout::Projection.
|
inlineoverridevirtual |
Return true if given coordinate is valid for this projection.
Implements osmscout::Projection.
References osmscout::GeoCoord::GetLat(), and osmscout::GeoCoord::GetLon().
Referenced by GeoToPixel(), and PixelToGeo().
|
default |
|
default |
|
overridevirtual |
Converts a pixel coordinate to a geo coordinate.
Return true on success, false if returned coordinate is not valid for this projection.
Implements osmscout::Projection.
References osmscout::gradtorad, osmscout::Projection::height, IsValidFor(), and osmscout::GeoCoord::Set().
bool osmscout::TileProjection::Set | ( | const OSMTileId & | tile, |
const Magnification & | magnification, | ||
double | dpi, | ||
size_t | width, | ||
size_t | height | ||
) |
|
inline |
bool osmscout::TileProjection::Set | ( | const OSMTileIdBox & | tileBox, |
const Magnification & | magnification, | ||
double | dpi, | ||
size_t | width, | ||
size_t | height | ||
) |
|
protectedvirtual |
References osmscout::Projection::boundingBox, osmscout::Projection::center, osmscout::Projection::dpi, osmscout::Earth::extentMeter, osmscout::GeoBox::GetCenter(), osmscout::GeoCoord::GetLat(), osmscout::Magnification::GetMagnification(), osmscout::GeoBox::GetMaxLon(), osmscout::GeoBox::GetMinLat(), osmscout::GeoBox::GetMinLon(), osmscout::gradtorad, osmscout::Projection::height, osmscout::Projection::magnification, osmscout::Projection::meterInMM, osmscout::Projection::meterInPixel, osmscout::Projection::pixelSize, and osmscout::Projection::width.
Referenced by Set().
|
inline |
Switch to enable/disable linear interpolation of latitude to pixel computation.
It speedup GeoToPixel calculation with fractional error on small render area.