libosmscout  1.1.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osmscout::TileProjection Class Reference

#include <libosmscout/include/osmscout/util/Projection.h>

Inheritance diagram for osmscout::TileProjection:
Inheritance graph
[legend]
Collaboration diagram for osmscout::TileProjection:
Collaboration graph
[legend]

Public Member Functions

 TileProjection ()
 
bool CanBatch () const override
 
bool IsValid () const override
 
bool IsValidFor (const GeoCoord &coord) const override
 
bool Set (const OSMTileId &tile, const Magnification &magnification, size_t width, size_t height)
 
bool Set (const OSMTileId &tile, const Magnification &magnification, double dpi, size_t width, size_t height)
 
bool Set (const OSMTileIdBox &tileBox, const Magnification &magnification, double dpi, size_t width, size_t height)
 
bool PixelToGeo (double x, double y, double &lon, double &lat) const override
 
bool GeoToPixel (const GeoCoord &coord, double &x, double &y) const override
 
bool IsLinearInterpolationEnabled () const
 
void SetLinearInterpolationUsage (bool b)
 
- Public Member Functions inherited from osmscout::Projection
 Projection ()
 
virtual ~Projection ()=default
 
GeoCoord GetCenter () const
 
double GetLon () const
 
double GetLat () const
 
double GetAngle () const
 
size_t GetWidth () const
 
size_t GetHeight () const
 
Magnification GetMagnification () const
 
double GetDPI () const
 
bool GeoIsIn (double lon, double lat) const
 
bool GeoIsIn (double lonMin, double latMin, double lonMax, double latMax) const
 
GeoBox GetDimensions () const
 
void GetDimensions (GeoBox &boundingBox) const
 
double GetPixelSize () const
 
double GetMeterInPixel () const
 
double GetMeterInMM () const
 
double ConvertWidthToPixel (double width) const
 
double ConvertPixelToWidth (double pixel) const
 

Protected Member Functions

virtual bool SetInternal (double lonMin, double latMin, double lonMax, double latMax, const Magnification &magnification, double dpi, size_t width, size_t height)
 
void GeoToPixel (const BatchTransformer &transformData) const override
 

Protected Attributes

bool valid
 projection is valid More...
 
double lonOffset
 
double latOffset
 
double scale
 
double scaleGradtorad
 Precalculated scale*Gradtorad. More...
 
double scaledLatDeriv
 precalculated derivation of "latToYPixel" function in projection center scaled by gradtorad * scale More...
 
bool useLinearInterpolation
 switch to enable linear interpolation of latitude to pixel computation More...
 
- Protected Attributes inherited from osmscout::Projection
double lon
 Longitude coordinate of the center of the image. More...
 
double lat
 Latitude coordinate of the center of the image. More...
 
double angle
 Display rotation angle in radians, canvas clockwise. More...
 
Magnification magnification
 Current magnification. More...
 
double dpi
 Screen DPI. More...
 
size_t width
 Width of image. More...
 
size_t height
 Height of image. More...
 
double lonMin
 Longitude of the upper left corner of the image. More...
 
double latMin
 Latitude of the upper left corner of the image. More...
 
double lonMax
 Longitude of the lower right corner of the image. More...
 
double latMax
 Latitude of the lower right corner of the image. More...
 
double pixelSize
 Size of a pixel in meter. More...
 
double meterInPixel
 Number of on screen pixel for one meter on the ground. More...
 
double meterInMM
 Number of on screen millimeters for one meter on the ground. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TileProjection()

osmscout::TileProjection::TileProjection ( )

Member Function Documentation

◆ CanBatch()

bool osmscout::TileProjection::CanBatch ( ) const
inlineoverridevirtual

Implements osmscout::Projection.

◆ GeoToPixel() [1/2]

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

◆ GeoToPixel() [2/2]

void osmscout::TileProjection::GeoToPixel ( const BatchTransformer transformData) const
overrideprotectedvirtual

Implements osmscout::Projection.

◆ IsLinearInterpolationEnabled()

bool osmscout::TileProjection::IsLinearInterpolationEnabled ( ) const
inline

◆ IsValid()

bool osmscout::TileProjection::IsValid ( ) const
inlineoverridevirtual

Implements osmscout::Projection.

◆ IsValidFor()

bool osmscout::TileProjection::IsValidFor ( const GeoCoord &  coord) const
inlineoverridevirtual

Return true if given coordinate is valid for this projection

Implements osmscout::Projection.

◆ PixelToGeo()

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

◆ Set() [1/3]

bool osmscout::TileProjection::Set ( const OSMTileId &  tile,
const Magnification &  magnification,
size_t  width,
size_t  height 
)
inline

◆ Set() [2/3]

bool osmscout::TileProjection::Set ( const OSMTileId &  tile,
const Magnification &  magnification,
double  dpi,
size_t  width,
size_t  height 
)

◆ Set() [3/3]

bool osmscout::TileProjection::Set ( const OSMTileIdBox &  tileBox,
const Magnification &  magnification,
double  dpi,
size_t  width,
size_t  height 
)

◆ SetInternal()

virtual bool osmscout::TileProjection::SetInternal ( double  lonMin,
double  latMin,
double  lonMax,
double  latMax,
const Magnification &  magnification,
double  dpi,
size_t  width,
size_t  height 
)
protectedvirtual

◆ SetLinearInterpolationUsage()

void osmscout::TileProjection::SetLinearInterpolationUsage ( bool  b)
inline

Switch to enable/disable linear interpolation of latitude to pixel computation. It speedup GeoToPixel calculation with fractional error on small render area.

Member Data Documentation

◆ latOffset

double osmscout::TileProjection::latOffset
protected

◆ lonOffset

double osmscout::TileProjection::lonOffset
protected

◆ scale

double osmscout::TileProjection::scale
protected

◆ scaledLatDeriv

double osmscout::TileProjection::scaledLatDeriv
protected

precalculated derivation of "latToYPixel" function in projection center scaled by gradtorad * scale

◆ scaleGradtorad

double osmscout::TileProjection::scaleGradtorad
protected

Precalculated scale*Gradtorad.

◆ useLinearInterpolation

bool osmscout::TileProjection::useLinearInterpolation
protected

switch to enable linear interpolation of latitude to pixel computation

◆ valid

bool osmscout::TileProjection::valid
protected

projection is valid


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