218 IString msg =
"Distance has not been initialized, you must initialize "
219 "it first before comparing with another distance using [>]";
236 IString msg =
"Distance has not been initialized, you must initialize "
237 "it first before comparing with another distance using [<]";
252 if(
this == &distanceToCopy)
return *
this;
419 double resultingDistance =
Null;
423 switch(distanceUnit) {
425 resultingDistance = distanceInMeters;
429 resultingDistance = distanceInMeters / 1000.0;
433 IString msg =
"Cannot call distance() with pixels, ask for another "
440 resultingDistance = distanceInMeters / 6.9599e8;
444 if(resultingDistance ==
Null) {
445 IString msg =
"Distance does not understand the enumerated value [" +
446 IString(distanceUnit) +
"] as a unit";
450 return resultingDistance;
465 double distanceInMeters =
Null;
472 switch(distanceUnit) {
478 distanceInMeters = distance * 1000.0;
482 IString msg =
"Cannot setDistance with pixels, must convert to another "
489 distanceInMeters = distance * 6.9599e8;
493 if(distanceInMeters ==
Null) {
494 IString msg =
"Distance does not understand the enumerated value [" +
495 IString(distanceUnit) +
"] as a unit";
499 if (distanceInMeters < 0.0) {
500 IString msg =
"Negative distances are not supported, the value [" +
501 IString(distanceInMeters) +
" meters] cannot be stored in the Distance "
double operator/(const Distance &distanceToDiv) const
Divide another distance into this distance (5m / 1m = 5).
void operator/=(const double &valueToDiv)
Divide this distance by a value and assign the result to ourself.
const double Null
Value for an Isis Null pixel.
virtual double distance(Units distanceUnit) const
This is a helper method to access distances in a universal manner with uniform error checking...
Units
This is a list of available units to access and store Distances in.
void operator+=(const Distance &distanceToAdd)
Add and assign the given distance to ourselves.
void operator*=(const double &valueToMult)
Multiply this distance by a value and assign the result to ourself.
"Solar radius is a unit of distance used to express the size of stars in astronomy equal to the curre...
QString toString() const
Get a textual representation of this distance.
double m_distanceInMeters
This is the distance value that this class is encapsulating, always stored in meters.
The distance is being specified in kilometers.
bool operator<(const Distance &otherDistance) const
Compare two distances with the less than operator.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Angle operator*(double mult, Angle angle)
Multiply this angle by a double and return the resulting angle.
Distance()
This initializes the distance to an invalid state.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
This error is for when a programmer made an API call that was illegal.
The distance is being specified in meters.
Distance measurement, usually in meters.
void setMeters(double distanceInMeters)
Set the distance in meters.
void setPixels(double distanceInPixels, double pixelsPerMeter=1.0)
Set the distance in pixels.
double meters() const
Get the distance in meters.
virtual ~Distance()
This will free the memory allocated by this instance of the Distance class.
#define _FILEINFO_
Macro for the filename and line number.
bool isValid() const
Test if this distance has been initialized or not.
void setKilometers(double distanceInKilometers)
Set the distance in kilometers.
bool IsSpecial(const double d)
Returns if the input pixel is special.
void operator-=(const Distance &distanceToSub)
Subtract and assign the given distance from ourself.
Distance operator*(const double &valueToMult) const
Multiply this distance by a value (5m * 2 = 10m).
double solarRadii() const
Get the distance in solar radii (a unit of ~696,265km).
Displacement is a signed length, usually in meters.
bool operator>(const Distance &otherDistance) const
Compare two distances with the greater than operator.
Adds specific functionality to C++ strings.
void setSolarRadii(double distanceInSolarRadii)
Set the distance in solar radii.
The distance is being specified in meters.
double kilometers() const
Get the distance in kilometers.
Distance operator+(const Distance &distanceToAdd) const
Add another distance to this distance (1km + 1m = 1005m)
virtual void setDistance(const double &distance, Units distanceUnit)
This is a helper method to set distances in a universal manner with uniform error checking...
The distance is being specified in pixels.
Displacement operator-(const Distance &distanceToSub) const
Subtract another distance from this distance (1km - 1m = 995m).
Distance & operator=(const Distance &distanceToCopy)
Assign this distance to the value of another distance.
double pixels(double pixelsPerMeter=1.0) const
Get the distance in pixels using the given conversion ratio.