libosmscout
0.1
|
#include <Projection.h>
Classes | |
class | BatchTransformer |
This class is used to hide internal complexity concerned with batching GeoToPixel calls. More... | |
Public Member Functions | |
bool | BoundingBoxToPixel (const GeoBox &boundingBox, ScreenBox &screenBox) const |
Converts a valid GeoBox to its on screen pixel coordinates. More... | |
virtual bool | CanBatch () const =0 |
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... | |
virtual bool | GeoToPixel (const GeoCoord &coord, Vertex2D &pixel) const =0 |
Converts a geo coordinate to a pixel coordinate. 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... | |
virtual bool | IsValid () const =0 |
virtual bool | IsValidFor (const GeoCoord &coord) const =0 |
Return true if given coordinate is valid for this projection. More... | |
Projection & | operator= (const Projection &)=default |
Projection & | operator= (Projection &&)=default |
virtual bool | PixelToGeo (double x, double y, GeoCoord &coord) const =0 |
Converts a pixel coordinate to a geo coordinate. More... | |
Projection ()=default | |
Projection (const Projection &)=default | |
Projection (Projection &&)=default | |
virtual | ~Projection ()=default |
Protected Member Functions | |
virtual void | GeoToPixel (const BatchTransformer &transformData) const =0 |
Protected Attributes | |
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... | |
Friends | |
class | BatchTransformer |
The Projection class is an abstract base class for multiple projection implementations.
The Projection class allows transformation of geo coordinates to screen/image coordinates and screen/image coordinates back to geo coordinates.
|
default |
|
default |
|
default |
|
virtualdefault |
bool osmscout::Projection::BoundingBoxToPixel | ( | const GeoBox & | boundingBox, |
ScreenBox & | screenBox | ||
) | const |
Converts a valid GeoBox to its on screen pixel coordinates.
Return true on success, false if given coordinate is not valid for this projection.
References boundingBox, GeoToPixel(), osmscout::GeoBox::GetMaxCoord(), osmscout::GeoBox::GetMaxLat(), osmscout::GeoBox::GetMaxLon(), osmscout::GeoBox::GetMinCoord(), osmscout::GeoBox::GetMinLat(), osmscout::GeoBox::GetMinLon(), osmscout::Vertex2D::GetX(), osmscout::Vertex2D::GetY(), and osmscout::GeoBox::IsValid().
Referenced by osmscout::MapPainter::IsVisibleArea(), and osmscout::MapPainter::IsVisibleWay().
|
pure virtual |
Implemented in osmscout::TileProjection, and osmscout::MercatorProjection.
Referenced by osmscout::Projection::BatchTransformer::GeoToPixel().
|
inline |
Convert a width in pixel into the equivalent mm size based on the given DPI.
width | Width in screen pixel |
|
inline |
Convert a width in mm into the equivalent pixel size based on the given DPI.
width | Width in mm |
Referenced by osmscout::MapPainterSVG::AfterPreprocessing(), osmscout::MapPainterSVG::BeforeDrawing(), osmscout::MapPainterCairo::BeforeDrawing(), osmscout::MapPainterQt::BeforeDrawing(), osmscout::MapPainterAgg::BeforeDrawing(), osmscout::MapPainter::DrawContourLines(), osmscout::MapPainterAgg::DrawSymbol(), osmscout::MapPainterSVG::DrawSymbol(), osmscout::Symbol::GetBoundingBox(), osmscout::MapPainterSVG::GetFontHeight(), osmscout::Symbol::GetHeight(), osmscout::Symbol::GetMaxBorderWidth(), osmscout::Symbol::GetWidth(), osmscout::MapPainterCairo::HasIcon(), osmscout::MapPainterQt::HasIcon(), osmscout::MapPainterSVG::HasIcon(), osmscout::MapPainterQt::HasPattern(), osmscout::MapWidget::paint(), and osmscout::SymbolRenderer::Render().
|
protectedpure virtual |
Implemented in osmscout::MercatorProjection, and osmscout::TileProjection.
|
pure virtual |
Converts a geo coordinate to a pixel coordinate.
Return true on success, false if given coordinate is not valid for this projection.
Implemented in osmscout::MercatorProjection, and osmscout::TileProjection.
Referenced by BoundingBoxToPixel(), osmscout::MapPainter::DrawHillShading(), osmscout::Projection::BatchTransformer::Flush(), and osmscout::Projection::BatchTransformer::GeoToPixel().
|
inline |
Returns the angle in radians ([0..2*PI[) of the display in relation to the north.
A degree of 0 means north is to the top, a degree of PI, renders with the south to the top of the display).
Referenced by osmscout::PlaneMapRenderer::DrawMap(), osmscout::MapWidget::paint(), osmscout::PlaneMapRenderer::RenderMap(), osmscout::MapPainterOpenGL::SetCenter(), and osmscout::MapPainterOpenGL::SetMagnification().
|
inline |
|
inline |
Referenced by osmscout::MapPainter::DrawContourLines(), osmscout::MapPainter::DrawHillShading(), osmscout::PlaneMapRenderer::DrawMap(), osmscout::MapService::GetGroundTiles(), osmscout::MapService::GetSRTMData(), osmscout::MapService::LookupTiles(), osmscout::TiledMapRenderer::onLoadJobFinished(), osmscout::TiledRenderingHelper::RenderTiles(), and osmscout::DBLoadJob::Run().
|
inline |
Return the DPI as part of the projection.
Referenced by osmscout::PlaneMapRenderer::DrawMap(), osmscout::MapPainterCairo::DrawMap(), osmscout::MapPainterOpenGL::SetCenter(), and osmscout::MapPainterOpenGL::SetMagnification().
|
inline |
Returns the height of the screen.
Referenced by osmscout::MapPainterSVG::BeforeDrawing(), osmscout::MapPainterAgg::BeforeDrawing(), osmscout::LockHandler::currentPosition(), osmscout::MapPainterCairo::DrawGround(), osmscout::MapPainterAgg::DrawGround(), osmscout::MapPainterQt::DrawGround(), osmscout::MapPainterSVG::DrawGround(), osmscout::PlaneMapRenderer::DrawMap(), osmscout::MapPainterOpenGL::DrawMap(), osmscout::MapPainterSVG::DrawMap(), osmscout::PlaneMapRenderer::RenderMap(), osmscout::TiledRenderingHelper::RenderTiles(), osmscout::DBRenderJob::Run(), osmscout::MapPainterOpenGL::SetCenter(), and osmscout::MapPainterOpenGL::SetMagnification().
|
inline |
Return the magnification as part of the projection.
Referenced by osmscout::PlaneMapRenderer::DrawMap(), osmscout::GetFeatureStyle(), osmscout::MapService::GetGroundTiles(), osmscout::MapPainterOpenGL::GetMagnification(), osmscout::StyleConfig::HasWayPathShieldStyle(), osmscout::StyleConfig::HasWayPathTextStyle(), osmscout::MapService::LookupTiles(), osmscout::TiledRenderingHelper::RenderTiles(), and osmscout::MapPainterOpenGL::SetCenter().
|
inline |
Returns the number of on screen millimeters for one meter on the ground.
Referenced by osmscout::GetFeatureStyle().
|
inline |
Returns the number of on screen pixel for one meter on the ground.
Referenced by osmscout::Symbol::GetBoundingBox(), osmscout::GetFeatureStyle(), osmscout::Symbol::GetHeight(), osmscout::Symbol::GetWidth(), osmscout::MapWidget::paint(), and osmscout::SymbolRenderer::Render().
|
inline |
Returns the size of a pixel in meter.
Referenced by osmscout::MapPainter::GetProjectedWidth().
|
inline |
Return a ScreenBox instance for the screen.
The ScreenBox has the value [(0.0,0.0)(width,height)]
Referenced by osmscout::MapPainter::IsVisibleArea(), and osmscout::MapPainter::IsVisibleWay().
|
inline |
Returns the width of the screen.
Referenced by osmscout::MapPainterSVG::BeforeDrawing(), osmscout::MapPainterAgg::BeforeDrawing(), osmscout::LockHandler::currentPosition(), osmscout::MapPainterCairo::DrawGround(), osmscout::MapPainterAgg::DrawGround(), osmscout::MapPainterQt::DrawGround(), osmscout::MapPainterSVG::DrawGround(), osmscout::PlaneMapRenderer::DrawMap(), osmscout::MapPainterOpenGL::DrawMap(), osmscout::MapPainterSVG::DrawMap(), osmscout::PlaneMapRenderer::RenderMap(), osmscout::TiledRenderingHelper::RenderTiles(), osmscout::DBRenderJob::Run(), osmscout::MapPainterOpenGL::SetCenter(), and osmscout::MapPainterOpenGL::SetMagnification().
|
pure virtual |
Implemented in osmscout::TileProjection, and osmscout::MercatorProjection.
|
pure virtual |
Return true if given coordinate is valid for this projection.
Implemented in osmscout::TileProjection, and osmscout::MercatorProjection.
|
default |
|
default |
|
pure virtual |
Converts a pixel coordinate to a geo coordinate.
Return true on success, false if returned coordinate is not valid for this projection.
Implemented in osmscout::MercatorProjection, and osmscout::TileProjection.
|
friend |
|
protected |
Display rotation angle in radians, canvas clockwise.
Referenced by osmscout::MercatorProjection::GeoToPixel(), osmscout::MercatorProjection::Move(), osmscout::MercatorProjection::PixelToGeo(), and osmscout::MercatorProjection::Set().
|
protected |
Bounding box of the current projection on the ground.
Referenced by BoundingBoxToPixel(), osmscout::TileProjection::Set(), osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Coordinate of the center of the displayed area.
Referenced by osmscout::TileProjection::GeoToPixel(), osmscout::MercatorProjection::GeoToPixel(), osmscout::MercatorProjection::Move(), osmscout::MercatorProjection::PixelToGeo(), osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Screen DPI.
Referenced by osmscout::MercatorProjection::Move(), osmscout::TileProjection::Set(), osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Height of image.
Referenced by osmscout::TileProjection::GeoToPixel(), osmscout::MercatorProjection::GeoToPixel(), osmscout::MercatorProjection::Move(), osmscout::TileProjection::PixelToGeo(), osmscout::MercatorProjection::PixelToGeo(), osmscout::TileProjection::Set(), osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Current magnification.
Referenced by osmscout::MercatorProjection::Move(), osmscout::TileProjection::Set(), osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Number of on screen millimeters for one meter on the ground.
Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Number of on screen pixel for one meter on the ground.
Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Size of a pixel in meter.
Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().
|
protected |
Width of image.
Referenced by osmscout::MercatorProjection::GeoToPixel(), osmscout::MercatorProjection::Move(), osmscout::MercatorProjection::PixelToGeo(), osmscout::TiledRenderingHelper::RenderTiles(), osmscout::TileProjection::Set(), osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().