Isis 3 Programmer Reference
Isis::NaifDskPlateModel Class Reference

Implementation interface API for NAIF's DSK plate model. More...

#include <NaifDskPlateModel.h>

Collaboration diagram for Isis::NaifDskPlateModel:
Collaboration graph

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...
 
SurfacePointpoint (const Latitude &lat, const Longitude &lon) const
 Get surface intersection for a lat/lon grid point. More...
 
Interceptintercept (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...
 
NaifDskPlateModelclone () const
 

Private Types

enum  ErrAction { Throw, NoThrow }
 Enumeration to indicate whether to throw an exception if an error occurs. More...
 
typedef QSharedPointer< NaifDskDescriptorSharedNaifDskDescriptor
 

Private Member Functions

NaifDskDescriptoropenDSK (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...
 
SurfacePointmakePoint (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...
 

Detailed Description

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.

Author
2013-12-05 Kris Becker
History:

2013-12-05 Kris Becker Original Version

2015-03-08 Jeannie Backer - Added documentation and test. Added class to ISIS trunk. References #2035

2017-05-19 Christopher Combs - Modified unitTest.cpp: added ReportError method to truncate paths before data directory. Allows test to pass when not using the default data area. Fixes #4738.

2017-06-28 Kris Becker - Updated DSK includes for NAIF N0066 release that now includes the DSK formally. The includes are now all in SpiceUsr.h. Removed SPICE includes from the cpp file as well. Fixes #4947.

Definition at line 65 of file NaifDskPlateModel.h.

Member Enumeration Documentation

◆ ErrAction

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 97 of file NaifDskPlateModel.h.

Constructor & Destructor Documentation

◆ NaifDskPlateModel() [1/2]

Isis::NaifDskPlateModel::NaifDskPlateModel ( )

Default empty constructor.

Definition at line 61 of file NaifDskPlateModel.cpp.

◆ NaifDskPlateModel() [2/2]

Isis::NaifDskPlateModel::NaifDskPlateModel ( const QString &  dskfile)

Construct given a file name - the only way to create with a DSK file.

Definition at line 66 of file NaifDskPlateModel.cpp.

References _FILEINFO_, isValid(), m_dsk, openDSK(), and Isis::IException::User.

Member Function Documentation

◆ filename()

QString Isis::NaifDskPlateModel::filename ( ) const

Returns the nane of the NAIF DSK file.

Definition at line 88 of file NaifDskPlateModel.cpp.

References isValid(), and m_dsk.

◆ intercept()

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.

History:
2013-12-05 Kris Becker Original Version
Parameters
vertexBody fixed X/Y/Z coordinate of the observer
raydirVector that specifies a look direction
Returns
Intercept* Pointer to a valid intercept point. If no intercept is found, a null pointer is returned.

Definition at line 196 of file NaifDskPlateModel.cpp.

References isPlateIdValid(), makePoint(), plate(), and plateIdOfIntercept().

Referenced by Isis::NaifDskShape::intersectSurface().

◆ isPlateIdValid()

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.

History:
2013-12-05 Kris Becker Original Version
Parameters
plateidPlate ID to check for validity
Returns
bool Returns true if a valid plate ID is provided, otherwise false is returned

Definition at line 230 of file NaifDskPlateModel.cpp.

References isValid().

Referenced by intercept(), plate(), and point().

◆ isValid()

bool Isis::NaifDskPlateModel::isValid ( ) const

Checks validity of the object.

Definition at line 81 of file NaifDskPlateModel.cpp.

References m_dsk.

Referenced by filename(), isPlateIdValid(), NaifDskPlateModel(), numberPlates(), numberVertices(), plate(), plateIdOfIntercept(), and point().

◆ makePoint()

SurfacePoint * Isis::NaifDskPlateModel::makePoint ( const NaifVertex v) const
private

Construct and return a SurfacePoint pointer.

Definition at line 416 of file NaifDskPlateModel.cpp.

References Isis::Displacement::Kilometers, Isis::validate(), and verify().

Referenced by intercept(), and point().

◆ numberPlates()

int Isis::NaifDskPlateModel::numberPlates ( ) const

Returns the number of plates in the model.

Definition at line 103 of file NaifDskPlateModel.cpp.

References isValid(), and m_dsk.

Referenced by size().

◆ numberVertices()

int Isis::NaifDskPlateModel::numberVertices ( ) const

Returns the number of vertices in the plate model.

Definition at line 111 of file NaifDskPlateModel.cpp.

References isValid(), and m_dsk.

◆ openDSK()

NaifDskPlateModel::NaifDskDescriptor * Isis::NaifDskPlateModel::openDSK ( const QString &  dskfile)
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.

History:
2013-12-05 Kris Becker Original Version
Parameters
dskfileName of NAIF DSK file to open. These files typically end in a ".bds" extension
Returns
NaifDskPlateModel::NaifDskDescriptor* Returns a pointer to a NAIF DSK file descriptor if operations successful. An exception is thrown if an error should occur.

Definition at line 362 of file NaifDskPlateModel.cpp.

References _FILEINFO_, Isis::NaifStatus::CheckErrors(), Isis::FileName::expanded(), Isis::FileName::fileExists(), and Isis::IException::User.

Referenced by NaifDskPlateModel().

◆ plate()

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.

Author
2014-02-05 Kris Becker Original Version
Parameters
plateidValid id of the plate to retrieve
Returns
NaifTriangle Triahgle associated with the plate id

Definition at line 307 of file NaifDskPlateModel.cpp.

References _FILEINFO_, Isis::NaifStatus::CheckErrors(), isPlateIdValid(), isValid(), m_dsk, Isis::IException::Programmer, and verify().

Referenced by intercept().

◆ plateIdOfIntercept()

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.

History:
2013-12-05 Kris Becker Original Version
Parameters
vertexPosition in body fixed coordinates of observer
raydirLook direction vector to use as intercept ray
xpointOutput of point of intercept in body fixed coordinates if an intercept point is found
Returns
SpiceInt Returns the plate ID of the intercept point

Definition at line 253 of file NaifDskPlateModel.cpp.

References _FILEINFO_, Isis::NaifStatus::CheckErrors(), isValid(), m_dsk, Isis::IException::Programmer, Isis::validate(), and verify().

Referenced by intercept().

◆ point()

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.

History:
2013-12-05 Kris Becker Original Version
Parameters
latLatitide of the grid coordinate point
lonLongitude of the grid coordinate point
Returns
SurfacePoint* Returns a pointer to a valid intercept point

Definition at line 138 of file NaifDskPlateModel.cpp.

References _FILEINFO_, Isis::NaifStatus::CheckErrors(), isPlateIdValid(), isValid(), Isis::Angle::isValid(), m_dsk, makePoint(), Isis::Latitude::planetocentric(), Isis::Longitude::positiveEast(), Isis::IException::Programmer, Isis::Angle::Radians, and verify().

Referenced by Isis::NaifDskShape::localRadius().

◆ size()

int Isis::NaifDskPlateModel::size ( ) const

Returns the number of plates in the DSK file - mostly for conformity.

Definition at line 96 of file NaifDskPlateModel.cpp.

References numberPlates().

◆ verify()

bool Isis::NaifDskPlateModel::verify ( const bool &  test,
const QString &  errmsg,
const ErrAction action = Throw 
) const
private

Convenience method for generalized error reporting.

Definition at line 402 of file NaifDskPlateModel.cpp.

References _FILEINFO_, Isis::IException::Programmer, and Throw.

Referenced by makePoint(), plate(), plateIdOfIntercept(), and point().

Member Data Documentation

◆ m_dsk

SharedNaifDskDescriptor Isis::NaifDskPlateModel::m_dsk
private

Shared pointer to the NaifDskDescriptor for this plate.

Definition at line 129 of file NaifDskPlateModel.h.

Referenced by filename(), isValid(), NaifDskPlateModel(), numberPlates(), numberVertices(), plate(), plateIdOfIntercept(), and point().


The documentation for this class was generated from the following files: