SceneCoordinate Class Reference

Scene coordinate. More...

#include <scenecoordinate.h>

List of all members.

Public Member Functions

 SceneCoordinate ()
 Constructs a null coordinate.
 SceneCoordinate (double x, double y)
 Constructs a coordinate with given x and y.
 SceneCoordinate (const GeoCoordinate &coordinate)
 Constructs a coordinate with values converted from the given GeoCoordinate.
qreal azimuthTo (const SceneCoordinate &to) const
 Returns the azimuth from this coordinate to other coordinate.
bool isNull () const
 Check if coordinate is (0.0, 0.0).
void setX (double x)
 Sets the latitude.
void setY (double y)
 Sets the longitude.
QPointF toPointF () const
 Convert to QPointF.
double x () const
 Returns the x value.
double y () const
 Returns the y value.
 operator QVariant () const
 Operator for creating QVariant.
SceneCoordinateoperator*= (double factor)
 Multiplies this coordinate's values by the given factor, and returns a reference to this coordinate.
SceneCoordinateoperator+= (const SceneCoordinate &coordinate)
 Adds the given coordinate to this coordinate and returns a reference to this coordinate.
SceneCoordinateoperator-= (const SceneCoordinate &coordinate)
 Subtracts the given coordinate from this coordinate and returns a reference to this coordinate.
const SceneCoordinate operator+ (const SceneCoordinate &other) const
 Returns a SceneCoordinate object that is the sum of the coordinates.
const SceneCoordinate operator- (const SceneCoordinate &other) const
 Returns a SceneCoordinate object that is formed by subtracting the coordinates.

Private Member Functions

void convertFrom (const GeoCoordinate &coordinate)
 Convert values from GeoCoordinate.
void normalize (double &value, int min, int max)
 Translate integer part of the given value between min and max.

Private Attributes

double m_x
 X value.
double m_y
 Y value.

Detailed Description

Scene coordinate.

Author:
Sami Rämö - sami.ramo@ixonos.com

Constructor & Destructor Documentation

SceneCoordinate::SceneCoordinate ( double  x,
double  y 
)

Constructs a coordinate with given x and y.

Parameters:
x X value
y Y value
SceneCoordinate::SceneCoordinate ( const GeoCoordinate coordinate  ) 

Constructs a coordinate with values converted from the given GeoCoordinate.

Uses convertFrom() method.

Parameters:
coordinate Geological coordinate

Member Function Documentation

qreal SceneCoordinate::azimuthTo ( const SceneCoordinate to  )  const

Returns the azimuth from this coordinate to other coordinate.

Zero is pointing to north. Returned value is from 0 to 360.

Parameters:
to Target coordinate
Returns:
Azimuth in degrees
void SceneCoordinate::convertFrom ( const GeoCoordinate coordinate  )  [private]

Convert values from GeoCoordinate.

Does run normalize() for the x value after the conversion to make sure that the result is inside the allowed map pixel values.

In horizontal direction: -180º equals scene pixel 0 (first scene pixel) +180º equals -180º

scene has 2^18 * 256 - 1 = 67108864 pixels per side one pixel width is 360º / 67108864 = 0.00000536441802978516º so the last scene pixel is 180º - 0.00000536441802978516º = 179.99999463558197021484º

Parameters:
coordinate Geological coordinate
bool SceneCoordinate::isNull (  )  const

Check if coordinate is (0.0, 0.0).

Returns:
True if both X and Y are 0.0, otherwise false
void SceneCoordinate::normalize ( double &  value,
int  min,
int  max 
) [private]

Translate integer part of the given value between min and max.

If given value is not inside the given range (min <= value <= max), then the allowed range is adder or subtracted until the value does fit in the range. Only integer part is compared.

Parameters:
value Value to be normalized
min Minimum allowed value
max Maximum allowed value
void SceneCoordinate::setX ( double  x  ) 

Sets the latitude.

Parameters:
x X value
void SceneCoordinate::setY ( double  y  ) 

Sets the longitude.

Parameters:
y Y value
QPointF SceneCoordinate::toPointF (  )  const

Convert to QPointF.

Returns:
a QPointF object
double SceneCoordinate::x (  )  const

Returns the x value.

Returns:
x
double SceneCoordinate::y (  )  const

Returns the y value.

Returns:
y

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

Generated on Fri Sep 3 12:05:42 2010 for Situare client for Maemo by  doxygen 1.6.1