Public Member Functions | Private Attributes | List of all members
karto::CoordinateConverter Class Reference

#include <CoordinateConverter.h>

Public Member Functions

 CoordinateConverter ()
 
BoundingBox2 GetBoundingBox () const
 
const Vector2dGetOffset () const
 
kt_double GetResolution () const
 
kt_double GetScale () const
 
const Size2< kt_int32s > & GetSize () const
 
Vector2d GridToWorld (const Vector2i &rGrid, kt_bool flipY=false) const
 
void SetOffset (const Vector2d &rOffset)
 
void SetResolution (kt_double resolution)
 
void SetScale (kt_double scale)
 
void SetSize (const Size2< kt_int32s > &rSize)
 
KARTO_DEPRECATED kt_double Transform (kt_double value)
 
Vector2i WorldToGrid (const Vector2d &rWorld, kt_bool flipY=false) const
 

Private Attributes

Vector2d m_Offset
 
kt_double m_Scale
 
Size2< kt_int32sm_Size
 

Detailed Description

Convert coordinates between world and grid coordinates. In world coordinates, 1.0 = 1 meter, whereas in grid coordinates, 1 = 1 pixel! The conversion from pixels to meters is 1.0 meter = 1 pixel / scale.

Definition at line 40 of file CoordinateConverter.h.

Constructor & Destructor Documentation

karto::CoordinateConverter::CoordinateConverter ( )
inline

Constructs a converter with a scale of 20.0 (conversion: 1 pixel = 0.05 meters)

Definition at line 46 of file CoordinateConverter.h.

Member Function Documentation

BoundingBox2 karto::CoordinateConverter::GetBoundingBox ( ) const
inline

Gets the bounding box

Returns
bounding box

Definition at line 184 of file CoordinateConverter.h.

const Vector2d& karto::CoordinateConverter::GetOffset ( ) const
inline

Gets the offset

Returns
offset

Definition at line 130 of file CoordinateConverter.h.

kt_double karto::CoordinateConverter::GetResolution ( ) const
inline

Gets the resolution

Returns
resolution

Definition at line 166 of file CoordinateConverter.h.

kt_double karto::CoordinateConverter::GetScale ( ) const
inline

Gets the scale

Returns
scale

Definition at line 112 of file CoordinateConverter.h.

const Size2<kt_int32s>& karto::CoordinateConverter::GetSize ( ) const
inline

Gets the size

Returns
size

Definition at line 157 of file CoordinateConverter.h.

Vector2d karto::CoordinateConverter::GridToWorld ( const Vector2i rGrid,
kt_bool  flipY = false 
) const
inline

Converts the given grid coordinate to world coordinates

Parameters
rGridgrid coordinate
flipYwhether to flip the y-coordinate (useful for drawing applications with inverted y-coordinates)
Returns
equivalent world coordinate of given grid coordinate

Definition at line 91 of file CoordinateConverter.h.

void karto::CoordinateConverter::SetOffset ( const Vector2d rOffset)
inline

Sets the offset

Parameters
rOffsetnew offset

Definition at line 139 of file CoordinateConverter.h.

void karto::CoordinateConverter::SetResolution ( kt_double  resolution)
inline

Sets the resolution

Parameters
resolutionnew resolution

Definition at line 175 of file CoordinateConverter.h.

void karto::CoordinateConverter::SetScale ( kt_double  scale)
inline

Sets the scale

Parameters
scale

Definition at line 121 of file CoordinateConverter.h.

void karto::CoordinateConverter::SetSize ( const Size2< kt_int32s > &  rSize)
inline

Sets the size

Parameters
rSizenew size

Definition at line 148 of file CoordinateConverter.h.

KARTO_DEPRECATED kt_double karto::CoordinateConverter::Transform ( kt_double  value)
inline

Scales the given value

Parameters
valuevalue to scale
Returns
scaled value

Definition at line 57 of file CoordinateConverter.h.

Vector2i karto::CoordinateConverter::WorldToGrid ( const Vector2d rWorld,
kt_bool  flipY = false 
) const
inline

Converts the given world coordinate to grid coordinates

Parameters
rWorldworld coordinate
flipYwhether to flip the y-coordinate (useful for drawing applications with inverted y-coordinates)
Returns
equivalent grid coordinate of given world coordinate

Definition at line 68 of file CoordinateConverter.h.

Member Data Documentation

Vector2d karto::CoordinateConverter::m_Offset
private

Definition at line 202 of file CoordinateConverter.h.

kt_double karto::CoordinateConverter::m_Scale
private

Definition at line 200 of file CoordinateConverter.h.

Size2<kt_int32s> karto::CoordinateConverter::m_Size
private

Definition at line 199 of file CoordinateConverter.h.


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


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Tue Nov 7 2017 06:02:36