#include <CoordinateConverter.h>
Public Member Functions | |
CoordinateConverter () | |
BoundingBox2 | GetBoundingBox () const |
const Vector2d & | GetOffset () 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_int32s > | m_Size |
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.
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.
BoundingBox2 karto::CoordinateConverter::GetBoundingBox | ( | ) | const [inline] |
const Vector2d& karto::CoordinateConverter::GetOffset | ( | ) | const [inline] |
kt_double karto::CoordinateConverter::GetResolution | ( | ) | const [inline] |
kt_double karto::CoordinateConverter::GetScale | ( | ) | const [inline] |
const Size2<kt_int32s>& karto::CoordinateConverter::GetSize | ( | ) | const [inline] |
Vector2d karto::CoordinateConverter::GridToWorld | ( | const Vector2i & | rGrid, |
kt_bool | flipY = false |
||
) | const [inline] |
Converts the given grid coordinate to world coordinates
rGrid | grid coordinate |
flipY | whether to flip the y-coordinate (useful for drawing applications with inverted y-coordinates) |
Definition at line 91 of file CoordinateConverter.h.
void karto::CoordinateConverter::SetOffset | ( | const Vector2d & | rOffset | ) | [inline] |
void karto::CoordinateConverter::SetResolution | ( | kt_double | resolution | ) | [inline] |
Sets the resolution
resolution | new resolution |
Definition at line 175 of file CoordinateConverter.h.
void karto::CoordinateConverter::SetScale | ( | kt_double | scale | ) | [inline] |
void karto::CoordinateConverter::SetSize | ( | const Size2< kt_int32s > & | rSize | ) | [inline] |
KARTO_DEPRECATED kt_double karto::CoordinateConverter::Transform | ( | kt_double | value | ) | [inline] |
Scales the given value
value | value to scale |
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
rWorld | world coordinate |
flipY | whether to flip the y-coordinate (useful for drawing applications with inverted y-coordinates) |
Definition at line 68 of file CoordinateConverter.h.
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.