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

#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

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...
 
Projectionoperator= (const Projection &)=default
 
Projectionoperator= (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
 

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

◆ Projection() [1/3]

osmscout::Projection::Projection ( )
default

◆ Projection() [2/3]

osmscout::Projection::Projection ( const Projection )
default

◆ Projection() [3/3]

osmscout::Projection::Projection ( Projection &&  )
default

◆ ~Projection()

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

Member Function Documentation

◆ BoundingBoxToPixel()

bool osmscout::Projection::BoundingBoxToPixel ( const GeoBox boundingBox,
ScreenBox screenBox 
) const

◆ CanBatch()

virtual bool osmscout::Projection::CanBatch ( ) const
pure virtual

◆ ConvertPixelToWidth()

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

◆ ConvertWidthToPixel()

◆ GeoToPixel() [1/2]

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

◆ GeoToPixel() [2/2]

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

Referenced by BoundingBoxToPixel(), osmscout::MapPainter::DrawHillShading(), osmscout::Projection::BatchTransformer::Flush(), and osmscout::Projection::BatchTransformer::GeoToPixel().

◆ GetAngle()

double osmscout::Projection::GetAngle ( ) const
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().

◆ GetCenter()

◆ GetDimensions()

◆ GetDPI()

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

◆ GetHeight()

◆ GetMagnification()

◆ GetMeterInMM()

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

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

Referenced by osmscout::GetFeatureStyle().

◆ GetMeterInPixel()

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

◆ GetPixelSize()

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

Returns the size of a pixel in meter.

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

◆ GetScreenBox()

ScreenBox osmscout::Projection::GetScreenBox ( ) const
inline

Return a ScreenBox instance for the screen.

The ScreenBox has the value [(0.0,0.0)(width,height)]

Returns
ScreenBox instance

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

◆ GetWidth()

◆ IsValid()

virtual bool osmscout::Projection::IsValid ( ) const
pure virtual

◆ IsValidFor()

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.

◆ operator=() [1/2]

Projection& osmscout::Projection::operator= ( const Projection )
default

◆ operator=() [2/2]

Projection& osmscout::Projection::operator= ( Projection &&  )
default

◆ PixelToGeo()

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

Friends And Related Function Documentation

◆ BatchTransformer

friend class BatchTransformer
friend

Member Data Documentation

◆ angle

double osmscout::Projection::angle =0.0
protected

◆ boundingBox

GeoBox osmscout::Projection::boundingBox
protected

◆ center

◆ dpi

◆ height

◆ magnification

◆ meterInMM

double osmscout::Projection::meterInMM =0.0
protected

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

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

◆ meterInPixel

double osmscout::Projection::meterInPixel =0.0
protected

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

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

◆ pixelSize

double osmscout::Projection::pixelSize =0.0
protected

◆ width


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