![]() |
Isis 3 Programmer Reference
|
Distance measurement, usually in meters. More...
#include <Distance.h>

Public Types | |
| enum | Units { Meters, Kilometers, Pixels, SolarRadii } |
| This is a list of available units to access and store Distances in. More... | |
Public Member Functions | |
| Distance () | |
| This initializes the distance to an invalid state. More... | |
| Distance (double distance, Units distanceUnit) | |
| This is the general purpose constructor for Distance. More... | |
| Distance (double distanceInPixels, double pixelsPerMeter) | |
| This is a constructor for Distance given pixels with a conversion ratio. More... | |
| Distance (const Distance &distanceToCopy) | |
| This is the copy constructor for Distance. More... | |
| virtual | ~Distance () |
| This will free the memory allocated by this instance of the Distance class. More... | |
| double | meters () const |
| Get the distance in meters. More... | |
| void | setMeters (double distanceInMeters) |
| Set the distance in meters. More... | |
| double | kilometers () const |
| Get the distance in kilometers. More... | |
| void | setKilometers (double distanceInKilometers) |
| Set the distance in kilometers. More... | |
| double | pixels (double pixelsPerMeter=1.0) const |
| Get the distance in pixels using the given conversion ratio. More... | |
| void | setPixels (double distanceInPixels, double pixelsPerMeter=1.0) |
| Set the distance in pixels. More... | |
| double | solarRadii () const |
| Get the distance in solar radii (a unit of ~696,265km). More... | |
| void | setSolarRadii (double distanceInSolarRadii) |
| Set the distance in solar radii. More... | |
| QString | toString () const |
| Get a textual representation of this distance. More... | |
| bool | isValid () const |
| Test if this distance has been initialized or not. More... | |
| bool | operator> (const Distance &otherDistance) const |
| Compare two distances with the greater than operator. More... | |
| bool | operator< (const Distance &otherDistance) const |
| Compare two distances with the less than operator. More... | |
| bool | operator>= (const Distance &otherDistance) const |
| Compare two distances with the greater than or equal to operator. More... | |
| bool | operator<= (const Distance &otherDistance) const |
| Compare two distances with the less than or equal to operator. More... | |
| bool | operator== (const Distance &otherDistance) const |
| Compare two distances with the == operator. More... | |
| bool | operator!= (const Distance &otherDistance) const |
| Compare two distances with the != operator. More... | |
| Distance & | operator= (const Distance &distanceToCopy) |
| Assign this distance to the value of another distance. More... | |
| Distance | operator+ (const Distance &distanceToAdd) const |
| Add another distance to this distance (1km + 1m = 1005m) More... | |
| Displacement | operator- (const Distance &distanceToSub) const |
| Subtract another distance from this distance (1km - 1m = 995m). More... | |
| double | operator/ (const Distance &distanceToDiv) const |
| Divide another distance into this distance (5m / 1m = 5). More... | |
| Distance | operator/ (const double &valueToDiv) const |
| Divide a value from this distance (5m / 2 = 2.5m). More... | |
| Distance | operator* (const double &valueToMult) const |
| Multiply this distance by a value (5m * 2 = 10m). More... | |
| void | operator+= (const Distance &distanceToAdd) |
| Add and assign the given distance to ourselves. More... | |
| void | operator-= (const Distance &distanceToSub) |
| Subtract and assign the given distance from ourself. More... | |
| void | operator/= (const double &valueToDiv) |
| Divide this distance by a value and assign the result to ourself. More... | |
| void | operator*= (const double &valueToMult) |
| Multiply this distance by a value and assign the result to ourself. More... | |
Protected Member Functions | |
| virtual double | distance (Units distanceUnit) const |
| This is a helper method to access distances in a universal manner with uniform error checking. More... | |
| virtual void | setDistance (const double &distance, Units distanceUnit) |
| This is a helper method to set distances in a universal manner with uniform error checking. More... | |
Private Attributes | |
| double | m_distanceInMeters |
| This is the distance value that this class is encapsulating, always stored in meters. More... | |
Friends | |
| Distance | operator* (double mult, Distance dist) |
| Multiply this distance by a value (5m * 2 = 10m). More... | |
Distance measurement, usually in meters.
This class is designed to encapsulate the concept of a distance. This is typically used for Radius and XYZ values but is also available as a general purpose class. This class does not accept negative values.
2011-04-18 Steven Lambright Improved special pixel math handling
2012-02-16 Steven Lambright - Brought up to method and member naming standards.
2012-03-22 Steven Lambright - Added toString().
2012-03-22 Steven Lambright - Added solarRadii(), setSolarRadii(), and the unit SolarRadii. References #1232.
Definition at line 47 of file Distance.h.
This is a list of available units to access and store Distances in.
These values can be passed to the constructor to specify which unit the double you are passing in is in.
| Enumerator | |
|---|---|
| Meters | The distance is being specified in meters. |
| Kilometers | The distance is being specified in kilometers. |
| Pixels | The distance is being specified in pixels. |
| SolarRadii | "Solar radius is a unit of distance used to express the size of stars in astronomy equal to the current radius of the Sun. " We're using 6.9599*10^8 meters, because that's the actual unit value, even though the radius has been more accurately calculated to 6.96342*10^8 m. http://en.wikipedia.org/wiki/Solar_radius http://www.astro.wisc.edu/~dolan/constants.html https://www.cfa.harvard.edu/~dfabricant/huchra/ay145/constants.html |
Definition at line 54 of file Distance.h.
| Isis::Distance::Distance | ( | ) |
This initializes the distance to an invalid state.
You must set the distance later on with operator= or one of the Set methods.
Definition at line 33 of file Distance.cpp.
References Meters, Isis::Null, and setDistance().
Referenced by operator*(), operator+(), and operator/().
| Isis::Distance::Distance | ( | double | distance, |
| Units | distanceUnit | ||
| ) |
This is the general purpose constructor for Distance.
This will initialize with the given distance. If Pixels are supplied as the units, then a default pixels/meter = 1.0 will be used.
| distance | The distance to initialize with, must be in units of distanceUnit and not be negative |
| distanceUnit | The unit distance is in, can be any value in Distance::Units |
Definition at line 48 of file Distance.cpp.
References distance(), Meters, Pixels, and setDistance().
| Isis::Distance::Distance | ( | double | distanceInPixels, |
| double | pixelsPerMeter | ||
| ) |
This is a constructor for Distance given pixels with a conversion ratio.
This will initialize with the pixels converted to meters.
| distanceInPixels | The distance to initialize with, must be in units of pixels and should not be negative |
| pixelsPerMeter | The pixels/meter conversion factor |
Definition at line 64 of file Distance.cpp.
References Meters, and setDistance().
| Isis::Distance::Distance | ( | const Distance & | distanceToCopy | ) |
This is the copy constructor for Distance.
The distance passed in will be exactly duplicated.
| distanceToCopy | This is the distance we are making an exact duplicate of |
Definition at line 76 of file Distance.cpp.
References Meters, meters(), and setDistance().
|
virtual |
This will free the memory allocated by this instance of the Distance class.
Definition at line 85 of file Distance.cpp.
References m_distanceInMeters, and Isis::Null.
|
protectedvirtual |
This is a helper method to access distances in a universal manner with uniform error checking.
| distanceUnit | Unit of the return value. If this is invalid, an exception will be thrown. |
Definition at line 417 of file Distance.cpp.
References _FILEINFO_, Kilometers, m_distanceInMeters, Meters, Isis::Null, Pixels, Isis::IException::Programmer, and SolarRadii.
Referenced by Distance(), isValid(), kilometers(), meters(), pixels(), setDistance(), and solarRadii().
| bool Isis::Distance::isValid | ( | ) | const |
Test if this distance has been initialized or not.
Definition at line 204 of file Distance.cpp.
References distance(), Meters, and Isis::Null.
Referenced by Isis::StereoTool::calculateElevation(), Isis::FindTool::centerLinkedViewports(), Isis::Camera::ComputeAzimuth(), Isis::FeatureNomenclature::featureDiameterGreaterThan(), Isis::Camera::GroundRangeResolution(), operator*(), operator*=(), operator+(), operator+=(), operator-(), Isis::Displacement::operator-=(), operator-=(), operator/(), operator/=(), operator<(), operator>(), Isis::SurfacePoint::ResetLocalRadius(), Isis::Shape::save(), Isis::Image::save(), Isis::ControlPoint::SetAprioriSurfacePoint(), Isis::Camera::SetGround(), Isis::SurfacePoint::SetRectangular(), Isis::SurfacePoint::SetRectangularSigmas(), Isis::SurfacePoint::SetSpherical(), Isis::SurfacePoint::SetSphericalPoint(), Isis::SurfacePoint::SetSphericalSigmas(), toString(), Isis::SunShadowTool::updateRow(), and Isis::SunShadowTool::updateShadowHeightEdit().
| double Isis::Distance::kilometers | ( | ) | const |
Get the distance in kilometers.
Definition at line 118 of file Distance.cpp.
References distance(), and Kilometers.
Referenced by Isis::BundleTargetBody::applyParameterCorrections(), Isis::Camera::ComputeAzimuth(), Isis::SurfacePoint::DistanceToDouble(), Isis::BundleControlPoint::formatBundleLatitudinalOutputDetailString(), Isis::BundleTargetBody::formatBundleOutputString(), Isis::SpacecraftPosition::getDistanceLightTime(), Isis::Camera::GetLocalNormal(), Isis::SpacecraftPosition::getRadiusLightTime(), Isis::SpatialPlotTool::getSpatialStatistics(), Isis::TriangularPlate::hasPoint(), Isis::VimsGroundMap::Init(), Isis::EquatorialCylindricalShape::intersectSurface(), Isis::DemShape::intersectSurface(), Isis::CameraGroundMap::MeanRadiusPartial(), Isis::TriangularPlate::point(), Isis::CameraGroundMap::PointPartial(), Isis::EmbreeShapeModel::pointToRay(), Isis::SurfacePoint::ResetLocalRadius(), Isis::RadarGroundMap::SetFocalPlane(), Isis::VimsGroundMap::SetGround(), Isis::BundleTargetBody::setSolveSettings(), Isis::SurfacePoint::SetSphericalPoint(), Isis::Sensor::SpacecraftAltitude(), Isis::TargetInfoWidget::TargetInfoWidget(), Isis::SunShadowTool::updateRow(), and Isis::SunShadowTool::updateShadowHeightEdit().
| double Isis::Distance::meters | ( | ) | const |
Get the distance in meters.
Definition at line 97 of file Distance.cpp.
References distance(), and Meters.
Referenced by Isis::CameraStatistics::addStats(), Isis::StereoTool::calculateElevation(), Isis::Camera::ComputeAzimuth(), Isis::BundleAdjust::computeBundleStatistics(), Isis::ControlNetFilter::CubeDistanceFilter(), Isis::Displacement::Displacement(), Distance(), Isis::FindTool::distancePerPixel(), Isis::SurfacePoint::DistanceToDouble(), Isis::QnetSetAprioriDialog::fillAverageAprioriLineEdits(), Isis::QnetSetAprioriDialog::fillCurrentAprioriLineEdits(), Isis::QnetSetAprioriDialog::fillReferenceAprioriLineEdits(), Isis::QnetSetAprioriDialog::fillSigmaLineEdits(), Isis::QnetCubeDistanceFilter::filter(), Isis::BundleControlPoint::formatAdjustedSigmaString(), Isis::SpatialPlotTool::getSpatialStatistics(), Isis::GroundGrid::GroundGrid(), Isis::StereoTool::measureSaved(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), Isis::Displacement::operator-=(), operator-=(), operator/(), operator/=(), operator<(), operator=(), operator==(), operator>(), Isis::BundleSolutionInfo::outputText(), Isis::ControlNetFilter::PointLatLonFilter(), Isis::SunShadowTool::recalculateShadowHeight(), Isis::Camera::ringRangeResolution(), Isis::ProjectionFactory::RingsCreateForCube(), Isis::Shape::save(), Isis::Image::save(), Isis::SurfacePoint::SetRectangularSigmas(), Isis::SurfacePoint::SetSphericalSigmas(), Isis::SurfacePoint::SetSphericalSigmasDistance(), Isis::BundleControlPoint::setWeights(), Isis::ControlNetVersioner::toPvl(), toString(), Isis::BundleControlPoint::updateAdjustedSurfacePointLatitudinally(), Isis::MeasureTool::updateDist(), Isis::TrackTool::updateLabels(), Isis::SunShadowTool::updateRow(), Isis::AdvancedTrackTool::updateRow(), Isis::SunShadowTool::updateShadowHeightEdit(), Isis::ControlPointEditWidget::updateSurfacePointInfo(), Isis::QnetTool::updateSurfacePointInfo(), and Isis::ControlNetVersioner::writeFirstPoint().
|
inline |
Compare two distances with the != operator.
Two uninitialized distances are equal to each other.
| otherDistance | This is the distance we're comparing to, i.e. on the right hand side of the operator when used |
Definition at line 146 of file Distance.h.
References meters().
| Distance Isis::Distance::operator* | ( | const double & | valueToMult | ) | const |
Multiply this distance by a value (5m * 2 = 10m).
| valueToMult | This is the value to multiply by |
Definition at line 325 of file Distance.cpp.
References Distance(), Isis::IsSpecial(), isValid(), Meters, and meters().
| void Isis::Distance::operator*= | ( | const double & | valueToMult | ) |
Multiply this distance by a value and assign the result to ourself.
| valueToMult | This is the value we are going to multiply by |
Definition at line 399 of file Distance.cpp.
References Isis::IsSpecial(), isValid(), Meters, meters(), Isis::Null, and setDistance().
Add another distance to this distance (1km + 1m = 1005m)
| distanceToAdd | This is the distance we are adding to ourselves |
Definition at line 266 of file Distance.cpp.
References Distance(), isValid(), Meters, and meters().
| void Isis::Distance::operator+= | ( | const Distance & | distanceToAdd | ) |
Add and assign the given distance to ourselves.
| distanceToAdd | This is the distance we are to duplicate exactly |
Definition at line 352 of file Distance.cpp.
References isValid(), Meters, meters(), Isis::Null, and setDistance().
| Displacement Isis::Distance::operator- | ( | const Distance & | distanceToSub | ) | const |
Subtract another distance from this distance (1km - 1m = 995m).
This could throw an exception if the result is negative.
| distanceToSub | This is the distance we are subtracting from ourself |
Definition at line 280 of file Distance.cpp.
References isValid(), Isis::Displacement::Meters, and meters().
| void Isis::Distance::operator-= | ( | const Distance & | distanceToSub | ) |
Subtract and assign the given distance from ourself.
This could throw an exception if the result is negative, in which case the new value is never applied.
| distanceToSub | This is the distance we are to subtract |
Definition at line 369 of file Distance.cpp.
References isValid(), Meters, meters(), Isis::Null, and setDistance().
| double Isis::Distance::operator/ | ( | const Distance & | distanceToDiv | ) | const |
Divide another distance into this distance (5m / 1m = 5).
| distanceToDiv | This is the divisor displacement (denominator) |
Definition at line 296 of file Distance.cpp.
References isValid(), meters(), and Isis::Null.
| Distance Isis::Distance::operator/ | ( | const double & | valueToDiv | ) | const |
Divide a value from this distance (5m / 2 = 2.5m).
| valueToDiv | This is the divisor displacement (denominator) |
Definition at line 310 of file Distance.cpp.
References Distance(), Isis::IsSpecial(), isValid(), Meters, and meters().
| void Isis::Distance::operator/= | ( | const double & | valueToDiv | ) |
Divide this distance by a value and assign the result to ourself.
| valueToDiv | This is the displacement we are to divide by |
Definition at line 384 of file Distance.cpp.
References Isis::IsSpecial(), isValid(), Meters, meters(), Isis::Null, and setDistance().
| bool Isis::Distance::operator< | ( | const Distance & | otherDistance | ) | const |
Compare two distances with the less than operator.
| otherDistance | This is the distance we're comparing to, i.e. on the right hand side of the operator when used |
Definition at line 234 of file Distance.cpp.
References _FILEINFO_, isValid(), meters(), and Isis::IException::Programmer.
|
inline |
Compare two distances with the less than or equal to operator.
| otherDistance | This is the distance we're comparing to, i.e. on the right hand side of the operator when used |
Definition at line 120 of file Distance.h.
Assign this distance to the value of another distance.
| distanceToCopy | This is the distance we are to duplicate exactly |
Definition at line 251 of file Distance.cpp.
References Meters, meters(), and setDistance().
|
inline |
Compare two distances with the == operator.
Two uninitialized distances are equal to each other.
| otherDistance | This is the distance we're comparing to, i.e. on the right hand side of the operator when used |
Definition at line 133 of file Distance.h.
References meters().
| bool Isis::Distance::operator> | ( | const Distance & | otherDistance | ) | const |
Compare two distances with the greater than operator.
| otherDistance | This is the distance we're comparing to, i.e. on the right hand side of the operator when used |
Definition at line 216 of file Distance.cpp.
References _FILEINFO_, isValid(), meters(), and Isis::IException::Programmer.
|
inline |
Compare two distances with the greater than or equal to operator.
| otherDistance | This is the distance we're comparing to, i.e. on the right hand side of the operator when used |
Definition at line 107 of file Distance.h.
| double Isis::Distance::pixels | ( | double | pixelsPerMeter = 1.0 | ) | const |
Get the distance in pixels using the given conversion ratio.
| pixelsPerMeter | Pixels/Meters conversion ratio to use, stored data is always in meters |
Definition at line 143 of file Distance.cpp.
References distance(), and Meters.
Referenced by Isis::RawCubeChunk::RawCubeChunk().
|
protectedvirtual |
This is a helper method to set distances in a universal manner with uniform error checking.
| distance | The distance, in units of distanceUnit, to set this class to. If this is negative an exception will be thrown and the state unmodified. |
| distanceUnit | Unit of distance. If this is invalid, an exception will be thrown and the state left unmodified. |
Definition at line 464 of file Distance.cpp.
References _FILEINFO_, distance(), Isis::IsSpecial(), Kilometers, m_distanceInMeters, Meters, Isis::Null, Pixels, Isis::IException::Programmer, and SolarRadii.
Referenced by Distance(), operator*=(), operator+=(), operator-=(), operator/=(), operator=(), setKilometers(), setMeters(), setPixels(), and setSolarRadii().
| void Isis::Distance::setKilometers | ( | double | distanceInKilometers | ) |
Set the distance in kilometers.
| distanceInKilometers | This is the value to set this distance to, given in kilometers. This will throw an exception if the value is negative. |
Definition at line 130 of file Distance.cpp.
References Kilometers, and setDistance().
Referenced by Isis::SurfacePoint::ResetLocalRadius().
| void Isis::Distance::setMeters | ( | double | distanceInMeters | ) |
Set the distance in meters.
| distanceInMeters | This is the value to set this distance to, given in meters. This will throw an exception if the value is negative. |
Definition at line 108 of file Distance.cpp.
References Meters, and setDistance().
Referenced by Isis::BundleResults::initialize().
| void Isis::Distance::setPixels | ( | double | distanceInPixels, |
| double | pixelsPerMeter = 1.0 |
||
| ) |
Set the distance in pixels.
| distanceInPixels | This is the value to set this distance to, given in pixels. This will throw an exception if the distance is negative after the conversion to meters. |
| pixelsPerMeter | Pixels/Meters conversion ratio to use, stored data is always in meters |
Definition at line 157 of file Distance.cpp.
References Meters, and setDistance().
| void Isis::Distance::setSolarRadii | ( | double | distanceInSolarRadii | ) |
Set the distance in solar radii.
| distanceInSolarRadii | This is the value to set this distance to, given in solar radii. This will throw an exception if the value is negative. |
Definition at line 179 of file Distance.cpp.
References setDistance(), and SolarRadii.
| double Isis::Distance::solarRadii | ( | ) | const |
Get the distance in solar radii (a unit of ~696,265km).
Definition at line 167 of file Distance.cpp.
References distance(), and SolarRadii.
| QString Isis::Distance::toString | ( | ) | const |
Get a textual representation of this distance.
Definition at line 189 of file Distance.cpp.
References isValid(), meters(), and Isis::toString().
Multiply this distance by a value (5m * 2 = 10m).
| mult | This is the value to multiply by |
| dist | This is the distance to multiply into |
Definition at line 341 of file Distance.cpp.
|
private |
This is the distance value that this class is encapsulating, always stored in meters.
Definition at line 172 of file Distance.h.
Referenced by distance(), setDistance(), and ~Distance().