Isis 3 Programmer Reference
|
Implementation interface API for NAIF's DSK plate model. More...
#include <NaifDskPlateModel.h>
Classes | |
class | NaifDskDescriptor |
NAIF DSK file descriptor. More... | |
Public Member Functions | |
NaifDskPlateModel () | |
Default empty constructor. More... | |
NaifDskPlateModel (const QString &dskfile) | |
Construct given a file name - the only way to create with a DSK file. More... | |
bool | isValid () const |
Checks validity of the object. More... | |
QString | filename () const |
Returns the nane of the NAIF DSK file. More... | |
int | size () const |
Returns the number of plates in the DSK file - mostly for conformity. More... | |
SpiceInt | numberPlates () const |
Returns the number of plates in the model. More... | |
SpiceInt | numberVertices () const |
Returns the number of vertices in the plate model. More... | |
SurfacePoint * | point (const Latitude &lat, const Longitude &lon) const |
Get surface intersection for a lat/lon grid point. More... | |
Intercept * | intercept (const NaifVertex &vertex, const NaifVector &raydir) const |
Determine a target body intercept point from an observer and look direction. More... | |
bool | isPlateIdValid (const SpiceInt plateid) const |
Determines if the plate ID is valid. More... | |
SpiceInt | plateIdOfIntercept (const NaifVertex &vertex, const NaifVector &raydir, NaifVertex &xpoint) const |
Primary API to determine ray intercept from observer/look direction. More... | |
NaifTriangle | plate (SpiceInt plateid) const |
Retrieve the triangular plate identified by its ID. More... | |
NaifDskPlateModel * | clone () const |
Private Types | |
enum | ErrAction { Throw, NoThrow } |
Enumeration to indicate whether to throw an exception if an error occurs. More... | |
typedef QSharedPointer< NaifDskDescriptor > | SharedNaifDskDescriptor |
Private Member Functions | |
NaifDskDescriptor * | openDSK (const QString &dskfile) |
Opens a valid NAIF DSK plate model file. More... | |
bool | verify (const bool &test, const QString &errmsg, const ErrAction &action=Throw) const |
Convenience method for generalized error reporting. More... | |
SurfacePoint * | makePoint (const NaifVertex &v) const |
Construct and return a SurfacePoint pointer More... | |
Private Attributes | |
SharedNaifDskDescriptor | m_dsk |
Shared pointer to the NaifDskDescriptor for this plate. More... | |
Implementation interface API for NAIF's DSK plate model.
This class implements a thread safe version of the NAIF DSK plate model API. This version is coded using the "alpha" version of the DSK library toolkit as release in 2010.
Part of the design of this implementation is the abilty to efficiently clone the object so that it is suitable for use in a threaded environment. Note that files is only closed when the last reference is released.
It is recommended that a shared or scoped pointer that provides the necessary elements for efficient safe thread computing.
Definition at line 49 of file NaifDskPlateModel.h.
|
private |
Enumeration to indicate whether to throw an exception if an error occurs.
Enumerator | |
---|---|
Throw | Throw an exception if an error occurs. |
NoThrow | Do not throw an exception if an error occurs. |
Definition at line 81 of file NaifDskPlateModel.h.
Isis::NaifDskPlateModel::NaifDskPlateModel | ( | ) |
Default empty constructor.
Definition at line 44 of file NaifDskPlateModel.cpp.
Isis::NaifDskPlateModel::NaifDskPlateModel | ( | const QString & | dskfile | ) |
Construct given a file name - the only way to create with a DSK file.
Definition at line 49 of file NaifDskPlateModel.cpp.
References isValid(), m_dsk, openDSK(), and Isis::IException::User.
QString Isis::NaifDskPlateModel::filename | ( | ) | const |
Returns the nane of the NAIF DSK file.
Definition at line 71 of file NaifDskPlateModel.cpp.
Intercept * Isis::NaifDskPlateModel::intercept | ( | const NaifVertex & | vertex, |
const NaifVector & | raydir | ||
) | const |
Determine a target body intercept point from an observer and look direction.
This method will compute an intercept point on the target body given a body fixed vertex of an observer and a look direction. This implements a true ray intersection algortihm.
If an intercept point cannot be found a null pointer is returned.
vertex | Body fixed X/Y/Z coordinate of the observer |
raydir | Vector that specifies a look direction |
Definition at line 179 of file NaifDskPlateModel.cpp.
References isPlateIdValid(), makePoint(), plate(), and plateIdOfIntercept().
Referenced by Isis::NaifDskShape::intersectSurface().
bool Isis::NaifDskPlateModel::isPlateIdValid | ( | const SpiceInt | plateid | ) | const |
Determines if the plate ID is valid.
A valid plateId is between the values of 1 and the number of plates in the model.
This method is useful for checking for errors when determining the plate of intersection. Valid intersections are initially return by the NAID DSK API as identifying the plate ID where the intersection occurs. A DSK routine then retreives the triangle plate (TIN) by this ID number.
plateid | Plate ID to check for validity |
Definition at line 213 of file NaifDskPlateModel.cpp.
References isValid().
Referenced by intercept(), plate(), and point().
bool Isis::NaifDskPlateModel::isValid | ( | ) | const |
Checks validity of the object.
Definition at line 64 of file NaifDskPlateModel.cpp.
References m_dsk.
Referenced by filename(), isPlateIdValid(), NaifDskPlateModel(), numberPlates(), numberVertices(), plate(), plateIdOfIntercept(), and point().
|
private |
Construct and return a SurfacePoint pointer
Definition at line 399 of file NaifDskPlateModel.cpp.
References Isis::Displacement::Kilometers, Isis::validate(), and verify().
Referenced by intercept(), and point().
int Isis::NaifDskPlateModel::numberPlates | ( | ) | const |
Returns the number of plates in the model.
Definition at line 86 of file NaifDskPlateModel.cpp.
References isValid(), and m_dsk.
Referenced by size().
int Isis::NaifDskPlateModel::numberVertices | ( | ) | const |
Returns the number of vertices in the plate model.
Definition at line 94 of file NaifDskPlateModel.cpp.
|
private |
Opens a valid NAIF DSK plate model file.
This method opens a NAIF DSK plate model file and initializes internal components for TIN processing.
If the file is valid a pointer to a NAIF DSK descriptor is returned for use.
dskfile | Name of NAIF DSK file to open. These files typically end in a ".bds" extension |
Definition at line 345 of file NaifDskPlateModel.cpp.
References Isis::NaifStatus::CheckErrors(), Isis::FileName::expanded(), Isis::FileName::fileExists(), and Isis::IException::User.
Referenced by NaifDskPlateModel().
NaifTriangle Isis::NaifDskPlateModel::plate | ( | SpiceInt | plateid | ) | const |
Retrieve the triangular plate identified by its ID.
This method can be used to retrieve a particular plate specified by its ID. This is useful for general retrieval and can be used to easily read all plates in a DSK file.
plateid | Valid id of the plate to retrieve |
Definition at line 290 of file NaifDskPlateModel.cpp.
References Isis::NaifStatus::CheckErrors(), isPlateIdValid(), isValid(), m_dsk, Isis::IException::Programmer, and verify().
Referenced by intercept().
SpiceInt Isis::NaifDskPlateModel::plateIdOfIntercept | ( | const NaifVertex & | vertex, |
const NaifVector & | raydir, | ||
NaifVertex & | xpoint | ||
) | const |
Primary API to determine ray intercept from observer/look direction.
This method determines an intercept point given an observer position and a look direction vector. It uses the NAIF DSK API to determine the ray intercept point given the position and look direction from the observer.
vertex | Position in body fixed coordinates of observer |
raydir | Look direction vector to use as intercept ray |
xpoint | Output of point of intercept in body fixed coordinates if an intercept point is found |
Definition at line 236 of file NaifDskPlateModel.cpp.
References Isis::NaifStatus::CheckErrors(), isValid(), m_dsk, Isis::IException::Programmer, Isis::validate(), and verify().
Referenced by intercept().
SurfacePoint * Isis::NaifDskPlateModel::point | ( | const Latitude & | lat, |
const Longitude & | lon | ||
) | const |
Get surface intersection for a lat/lon grid point.
This method will return a surface point intercept given a lat/lon coordinate. Primary use of this method is to determine radius values at the grid point.
Essentially a fixed body ray is created from the lat/lon location that extends beyond the highest radius of the body as defined by the plate model. The endpoint of this ray serves as the observer position. A look direction vector is created from the observer point by reversing the direction of the vector from the center of the body to the observer point. Theoretically, this routine should not fail based upon this technique.
lat | Latitide of the grid coordinate point |
lon | Longitude of the grid coordinate point |
Definition at line 121 of file NaifDskPlateModel.cpp.
References Isis::NaifStatus::CheckErrors(), isPlateIdValid(), Isis::Angle::isValid(), isValid(), m_dsk, makePoint(), Isis::Latitude::planetocentric(), Isis::Longitude::positiveEast(), Isis::IException::Programmer, Isis::Angle::Radians, and verify().
Referenced by Isis::NaifDskShape::localRadius().
int Isis::NaifDskPlateModel::size | ( | ) | const |
Returns the number of plates in the DSK file - mostly for conformity.
Definition at line 79 of file NaifDskPlateModel.cpp.
References numberPlates().
|
private |
Convenience method for generalized error reporting.
Definition at line 385 of file NaifDskPlateModel.cpp.
References Isis::IException::Programmer, and Throw.
Referenced by makePoint(), plate(), plateIdOfIntercept(), and point().
|
private |
Shared pointer to the NaifDskDescriptor for this plate.
Definition at line 113 of file NaifDskPlateModel.h.
Referenced by filename(), isValid(), NaifDskPlateModel(), numberPlates(), numberVertices(), plate(), plateIdOfIntercept(), and point().