libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::Projection Class Referenceabstract

The Projection class is an abstract base class for multiple projection implementations. More...

#include <Projection.h>

+ Inheritance diagram for osmscout::Projection:

Classes

class  BatchTransformer
 This class is used to hide internal complexity concerned with batching GeoToPixel calls. More...
 

Public Member Functions

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...
 
bool GeoIsIn (double lon, double lat) const
 Returns true, if the given geo coordinate is in the bounding box. More...
 
bool GeoIsIn (double lonMin, double latMin, double lonMax, double latMax) const
 Returns true, if the given bounding box is completely within the projection bounding box. More...
 
virtual bool GeoToPixel (const GeoCoord &coord, double &x, double &y) const =0
 Converts a geo coordinate to a pixel coordinate. More...
 
double GetAngle () const
 Returns the angle ([0..2*PI[) of the display in relation to the north. More...
 
GeoCoord GetCenter () const
 
void GetDimensions (GeoBox &boundingBox) const
 Returns the bounding box of the area covered. More...
 
double GetDPI () const
 Return the DPI as part of the projection. More...
 
size_t GetHeight () const
 Returns the height of the screen. More...
 
double GetLat () const
 Returns latitude coordinate of the region center. More...
 
double GetLon () const
 Returns longitude coordinate of the region center. 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...
 
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...
 
virtual bool PixelToGeo (double x, double y, double &lon, double &lat) const =0
 Converts a pixel coordinate to a geo coordinate. More...
 
 Projection ()
 
virtual ~Projection ()=default
 

Protected Member Functions

virtual void GeoToPixel (const BatchTransformer &transformData) const =0
 

Protected Attributes

double angle
 Display rotation angle. More...
 
double dpi
 Screen DPI. More...
 
size_t height
 Height of image. More...
 
double lat
 Latitude coordinate of the center of the image. More...
 
double latMax
 Latitude of the lower right corner of the image. More...
 
double latMin
 Latitude of the upper left corner of the image. More...
 
double lon
 Longitude coordinate of the center of the image. More...
 
double lonMax
 Longitude of the lower right corner of the image. More...
 
double lonMin
 Longitude of the upper left corner of the image. More...
 
Magnification magnification
 Current magnification. More...
 
double meterInMM
 Number of on screen millimeters for one meter on the ground. More...
 
double meterInPixel
 Number of on screen pixel for one meter on the ground. More...
 
double pixelSize
 Size of a pixel in meter. More...
 
size_t width
 Width of image. More...
 

Friends

class BatchTransformer
 

Detailed Description

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.

Constructor & Destructor Documentation

osmscout::Projection::Projection ( )
virtual osmscout::Projection::~Projection ( )
virtualdefault

Member Function Documentation

virtual bool osmscout::Projection::CanBatch ( ) const
pure virtual
double osmscout::Projection::ConvertPixelToWidth ( double  pixel) const
inline

Convert a width in pixel into the equivalent mm size based on the given DPI.

Parameters
widthWidth in screen pixel
Returns
Width in mm
bool osmscout::Projection::GeoIsIn ( double  lon,
double  lat 
) const
inline

Returns true, if the given geo coordinate is in the bounding box.

bool osmscout::Projection::GeoIsIn ( double  lonMin,
double  latMin,
double  lonMax,
double  latMax 
) const
inline

Returns true, if the given bounding box is completely within the projection bounding box.

virtual bool osmscout::Projection::GeoToPixel ( const GeoCoord &  coord,
double &  x,
double &  y 
) const
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::TileProjection, and osmscout::MercatorProjection.

Referenced by osmscout::MapPainterQt::DrawGroundTiles(), osmscout::MapPainter::IsVisibleArea(), osmscout::MapPainter::IsVisibleWay(), and osmscout::MapPainter::Transform().

virtual void osmscout::Projection::GeoToPixel ( const BatchTransformer transformData) const
protectedpure virtual
double osmscout::Projection::GetAngle ( ) const
inline

Returns the angle ([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 PlaneMapRenderer::DrawMap(), and PlaneMapRenderer::RenderMap().

GeoCoord osmscout::Projection::GetCenter ( ) const
inline
double osmscout::Projection::GetDPI ( ) const
inline

Return the DPI as part of the projection.

Referenced by osmscout::MapPainter::Draw(), PlaneMapRenderer::DrawMap(), and osmscout::MapPainterCairo::DrawMap().

double osmscout::Projection::GetLat ( ) const
inline

Returns latitude coordinate of the region center.

double osmscout::Projection::GetLon ( ) const
inline

Returns longitude coordinate of the region center.

double osmscout::Projection::GetMeterInMM ( ) const
inline

Returns the number of on screen millimeters for one meter on the ground.

Referenced by osmscout::GetFeatureStyle().

double osmscout::Projection::GetMeterInPixel ( ) const
inline

Returns the number of on screen pixel for one meter on the ground.

Referenced by osmscout::MapPainterQt::DrawSymbol(), osmscout::GetFeatureStyle(), and MapWidget::paint().

double osmscout::Projection::GetPixelSize ( ) const
inline

Returns the size of a pixel in meter.

Referenced by osmscout::MapPainter::GetProjectedWidth().

virtual bool osmscout::Projection::IsValid ( ) const
pure virtual
virtual bool osmscout::Projection::IsValidFor ( const GeoCoord &  coord) const
pure virtual

Return true if given coordinate is valid for this projection.

Implemented in osmscout::TileProjection, and osmscout::MercatorProjection.

virtual bool osmscout::Projection::PixelToGeo ( double  x,
double  y,
double &  lon,
double &  lat 
) const
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::TileProjection, and osmscout::MercatorProjection.

Friends And Related Function Documentation

friend class BatchTransformer
friend

Member Data Documentation

double osmscout::Projection::latMax
protected

Latitude of the lower right corner of the image.

Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().

double osmscout::Projection::latMin
protected

Latitude of the upper left corner of the image.

Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().

double osmscout::Projection::lon
protected
double osmscout::Projection::lonMax
protected

Longitude of the lower right corner of the image.

Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().

double osmscout::Projection::lonMin
protected

Longitude of the upper left corner of the image.

Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().

double osmscout::Projection::meterInMM
protected

Number of on screen millimeters for one meter on the ground.

Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().

double osmscout::Projection::meterInPixel
protected

Number of on screen pixel for one meter on the ground.

Referenced by osmscout::MercatorProjection::Set(), and osmscout::TileProjection::SetInternal().

double osmscout::Projection::pixelSize
protected

The documentation for this class was generated from the following files: