USGS

Isis 3.0 Developer's Reference (API)

Home

Displacement.h
Go to the documentation of this file.
1 #ifndef Displacement_h
2 #define Displacement_h
3 
23 namespace Isis {
24  class Distance;
25 
43  class Displacement {
44  public:
50  enum Units {
57  };
58 
59  Displacement();
60  Displacement(double displacement, Units distanceUnit);
61  Displacement(double displacementInPixels, double pixelsPerMeter);
62  Displacement(const Distance &distanceToCopy);
63 
68 
69  double meters() const;
70  void setMeters(double displacementInMeters);
71 
72  double kilometers() const;
73  void setKilometers(double displacementInKilometers);
74 
75  double pixels(double pixelsPerMeter = 1.0) const;
76  void setPixels(double distanceInPixels, double pixelsPerMeter = 1.0);
77 
78  bool isValid() const;
79 
89  bool operator >(const Displacement &otherDisplacement) const;
90  bool operator <(const Displacement &otherDisplacement) const;
91 
92 
101  bool operator >=(const Displacement &otherDisplacement) const {
102  return *this > otherDisplacement || *this == otherDisplacement;
103  }
104 
105 
114  bool operator <=(const Displacement &otherDisplacement) const {
115  return *this < otherDisplacement || *this == otherDisplacement;
116  }
117 
128  bool operator !=(const Displacement &otherDisplacement) const {
129  return !(*this == otherDisplacement);
130  }
131 
142  bool operator ==(const Displacement &otherDisplacement) const {
143  return m_displacementInMeters ==
144  otherDisplacement.m_displacementInMeters;
145  }
146 
147  Displacement operator +(const Displacement &displacementToAdd) const;
148  Displacement operator -(const Displacement &displacementToSub) const;
149  Displacement operator -(const Distance &distanceToSub) const;
150  double operator /(const Displacement &displacementToDiv) const;
151  Displacement operator /(const double &valueToDiv) const;
152  Displacement operator *(const double &valueToMult) const;
153  friend Displacement operator *(double mult, Displacement displacement);
154  void operator +=(const Displacement &displacementToAdd);
155  void operator -=(const Displacement &displacementToSub);
156  void operator -=(const Distance &distanceToSub);
157  void operator /=(const double &valueToDiv);
158  void operator *=(const double &valueToMult);
159 
160  protected:
161  double displacement(Units displacementUnit) const;
162  void setDisplacement(const double &displacement, Units displacementUnit);
163 
164  private:
169  double m_displacementInMeters;
170  };
171 }
172 
173 #endif