PointValue Class Reference

#include <point.h>

Inheritance diagram for PointValue:

Value List of all members.

Public Member Functions

virtual QString toString ()
 PointValue ()
 PointValue (Token data)
 PointValue (double a, double b)
virtual Data getSaveDescription (QString)
PointValue operator * (const PointValue &other) const
PointValueoperator/= (const PointValue &other)
PointValueoperator *= (const PointValue &other)

Public Attributes

double x
double y

Protected Member Functions

virtual bool equals_same_type (Value *other)

Detailed Description

Points as they are used within the spreadsheet. All points assume an orthonormal axis. So the distance can be calculated in a normal way. It also means that the coordinates are independent of the underlying resolution of the image.

Definition at line 11 of file point.h.


Constructor & Destructor Documentation

PointValue::PointValue  )  [inline]
 

Standard constructor; initalizes x and y to 0

Definition at line 21 of file point.h.

References x, and y.

00022      {
00023        x = 0;
00024        y = 0;
00025      };

PointValue::PointValue Token  data  )  [inline]
 

initializes data from the x and y fields in the token.

Definition at line 31 of file point.h.

References x, and y.

00032      {
00033        x = (Float8)data["x"];
00034        y = (Float8)data["y"];
00035      }

PointValue::PointValue double  a,
double  b
[inline]
 

Standard constructor

Definition at line 40 of file point.h.

References x, and y.

00041      {
00042        x = a;
00043        y = b;
00044      }


Member Function Documentation

bool PointValue::equals_same_type Value other  )  [protected, virtual]
 

Implements Value.

Definition at line 21 of file point.cpp.

References x, and y.

00022 {
00023   PointValue * o = (PointValue*)other;
00024   return x==o->x && y==o->y;
00025 }

virtual Data PointValue::getSaveDescription QString   )  [inline, virtual]
 

returns a token containing the type as 'point' and the x and y fields as Float8.

Implements Value.

Definition at line 50 of file point.h.

References x, and y.

Referenced by LineValue::getSaveDescription(), ImageValue::getSaveDescription(), and BoxValue::getSaveDescription().

00051      {
00052        Token r;
00053        r["type"]=Symbol("point");
00054        r["x"]=Float8(x);
00055        r["y"]=Float8(y);
00056        return r;
00057      };

PointValue PointValue::operator * const PointValue other  )  const
 

Multiplies the x and y coordinates of both points and returns the new point. Useful for scaling and zooming functions.

Definition at line 44 of file point.cpp.

References x, and y.

00045 {
00046   PointValue result;
00047   result.x = x*other.x;
00048   result.y = y*other.y;
00049   return result;
00050 }

PointValue& PointValue::operator *= const PointValue other  )  [inline]
 

Definition at line 73 of file point.h.

References x, and y.

00074      {
00075        x*=other.x;
00076        y*=other.y;
00077        return *this;
00078      }

PointValue& PointValue::operator/= const PointValue other  )  [inline]
 

Definition at line 66 of file point.h.

References x, and y.

00067      {
00068        x/=other.x;
00069        y/=other.y;
00070        return *this;
00071      }

QString PointValue::toString  )  [virtual]
 

Implements Value.

Definition at line 14 of file point.cpp.

References x, and y.

Referenced by LineValue::toString(), and BoxValue::toString().

00015 {
00016   return QString("(")+QString::number(x)+
00017     QString(", ")+QString::number(y)+
00018     QString(")");
00019 }


Member Data Documentation

double PointValue::x
 

Definition at line 14 of file point.h.

Referenced by Runtime::add(), DirectPoint::copyFrom(), Runtime::div(), LineValue::dx(), equals_same_type(), getSaveDescription(), ImageValue::horiz(), ImageValue::ImageValue(), ImageValue::left(), ImageValue::loadImage(), max(), min(), Runtime::mul(), Runtime::neg(), BoxPicker::nextPoint(), operator *(), operator *=(), DirectPoint::operator PointValue(), operator/=(), PointValue(), ImageValue::right(), toString(), and Runtime::zoomy().

double PointValue::y
 

Definition at line 15 of file point.h.

Referenced by Runtime::add(), ImageValue::bottom(), DirectPoint::copyFrom(), Runtime::div(), LineValue::dy(), equals_same_type(), getSaveDescription(), ImageValue::ImageValue(), ImageValue::loadImage(), max(), min(), Runtime::mul(), Runtime::neg(), BoxPicker::nextPoint(), operator *(), operator *=(), DirectPoint::operator PointValue(), operator/=(), PointValue(), ImageValue::top(), toString(), ImageValue::vertic(), and Runtime::zoomx().


The documentation for this class was generated from the following files:
Generated on Mon Jun 5 22:08:43 2006 for iis by  doxygen 1.4.6