libosmscout 0.1
Loading...
Searching...
No Matches
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

bool BoundingBoxToPixel (const GeoBox &boundingBox, ScreenBox &screenBox) const
 Converts a valid GeoBox to its on screen pixel coordinates.
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.
double ConvertWidthToPixel (double width) const
 Convert a width in mm into the equivalent pixel size based on the given DPI.
virtual bool GeoToPixel (const GeoCoord &coord, Vertex2D &pixel) const =0
 Converts a geo coordinate to a pixel coordinate.
double GetAngle () const
 Returns the angle in radians ([0..2*PI[) of the display in relation to the north.
GeoCoord GetCenter () const
GeoBox GetDimensions () const
double GetDPI () const
 Return the DPI as part of the projection.
size_t GetHeight () const
 Returns the height of the screen.
Magnification GetMagnification () const
 Return the magnification as part of the projection.
double GetMeterInMM () const
 Returns the number of on screen millimeters for one meter on the ground.
double GetMeterInPixel () const
 Returns the number of on screen pixel for one meter on the ground.
double GetPixelSize () const
 Returns the size of a pixel in meter.
ScreenBox GetScreenBox () const
 Return a ScreenBox instance for the screen.
size_t GetWidth () const
 Returns the width of the screen.
virtual bool IsValid () const =0
virtual bool IsValidFor (const GeoCoord &coord) const =0
 Return true if given coordinate is valid for this projection.
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.
 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.
GeoBox boundingBox
 Bounding box of the current projection on the ground.
GeoCoord center
 Coordinate of the center of the displayed area.
double dpi =0.0
 Screen DPI.
size_t height =0
 Height of image.
Magnification magnification
 Current magnification.
double meterInMM =0.0
 Number of on screen millimeters for one meter on the ground.
double meterInPixel =0.0
 Number of on screen pixel for one meter on the ground.
double pixelSize =0.0
 Size of a pixel in meter.
size_t width =0
 Width of image.

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

References Projection().

◆ Projection() [3/3]

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

References Projection().

◆ ~Projection()

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

Member Function Documentation

◆ BoundingBoxToPixel()

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::Vertex2D::GetX(), and osmscout::Vertex2D::GetY().

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

◆ CanBatch()

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

◆ ConvertPixelToWidth()

double osmscout::Projection::ConvertPixelToWidth ( double pixel) const
inlinenodiscard

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

Parameters
widthWidth in screen pixel
Returns
Width in mm

References dpi.

◆ 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.

References boundingBox, and BoundingBoxToPixel().

Referenced by BoundingBoxToPixel(), and osmscout::MapPainter::DrawHillShading().

◆ GetAngle()

double osmscout::Projection::GetAngle ( ) const
inlinenodiscard

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).

References angle.

Referenced by osmscout::MapWidget::paint(), and osmscout::PlaneMapRenderer::RenderMap().

◆ GetCenter()

GeoCoord osmscout::Projection::GetCenter ( ) const
inlinenodiscard

References center.

Referenced by osmscout::MoveHandler::moveNow().

◆ GetDimensions()

◆ GetDPI()

◆ GetHeight()

◆ GetMagnification()

◆ GetMeterInMM()

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

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

References meterInMM.

Referenced by osmscout::GetFeatureStyle().

◆ GetMeterInPixel()

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

◆ GetPixelSize()

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

◆ GetScreenBox()

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

Return a ScreenBox instance for the screen.

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

Returns
ScreenBox instance

References GetHeight(), and GetWidth().

Referenced by osmscout::IsAreaRingVisible(), 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::MercatorProjection, and osmscout::TileProjection.

◆ operator=() [1/2]

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

References Projection().

◆ operator=() [2/2]

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

References Projection().

◆ 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.

◆ BatchTransformer

friend class BatchTransformer
friend

Member Data Documentation

◆ angle

◆ 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 GetMeterInMM(), 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 GetMeterInPixel(), 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: