USGS

Isis 3.0 Object Programmers' Reference

Home

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.
 NaifDskPlateModel (const QString &dskfile)
 Construct given a file name - the only way to create with a DSK file.
bool isValid () const
 Checks validity of the object.
QString filename () const
 Returns the nane of the NAIF DSK file.
int size () const
 Returns the number of plates in the DSK file - mostly for conformity.
SpiceInt numberPlates () const
 Returns the number of plates in the model.
SpiceInt numberVertices () const
 Returns the number of vertices in the plate model.
SurfacePointpoint (const Latitude &lat, const Longitude &lon) const
 Get surface intersection for a lat/lon grid point.
Interceptintercept (const NaifVertex &vertex, const NaifVector &raydir) const
 Determine a target body intercept point from an observer and look direction.
bool isPlateIdValid (const SpiceInt plateid) const
 Determines if the plate ID is valid.
SpiceInt plateIdOfIntercept (const NaifVertex &vertex, const NaifVector &raydir, NaifVertex &xpoint) const
 Primary API to determine ray intercept from observer/look direction.
NaifTriangle plate (SpiceInt plateid) const
 Retrieve the triangular plate identified by its ID.
NaifDskPlateModelclone () 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

NaifDskDescriptoropenDSK (const QString &dskfile)
 Opens a valid NAIF DSK plate model file.
bool verify (const bool &test, const QString &errmsg, const ErrAction &action=Throw) const
 Convenience method for generalized error reporting.
SurfacePointmakePoint (const NaifVertex &v) const
 Construct and return a SurfacePoint pointer.

Private Attributes

SharedNaifDskDescriptor m_dsk
 Shared pointer to the NaifDskDescriptor for this plate.

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
History:
2015-03-08 Jeannie Backer - Added documentation and test. Added class to ISIS trunk. References #2035

Definition at line 59 of file NaifDskPlateModel.h.

Member Enumeration Documentation

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

Constructor & Destructor Documentation

Isis::NaifDskPlateModel::NaifDskPlateModel ( )

Default empty constructor.

Definition at line 68 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 73 of file NaifDskPlateModel.cpp.

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

Member Function Documentation

QString Isis::NaifDskPlateModel::filename ( ) const

Returns the nane of the NAIF DSK file.

Definition at line 95 of file NaifDskPlateModel.cpp.

References isValid(), and m_dsk.

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 203 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.

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 237 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 88 of file NaifDskPlateModel.cpp.

References m_dsk.

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

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

Construct and return a SurfacePoint pointer.

Definition at line 423 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 110 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 118 of file NaifDskPlateModel.cpp.

References isValid(), and m_dsk.

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 369 of file NaifDskPlateModel.cpp.

References _FILEINFO_, Isis::NaifStatus::CheckErrors(), 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.

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 314 of file NaifDskPlateModel.cpp.

References _FILEINFO_, 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.

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 260 of file NaifDskPlateModel.cpp.

References _FILEINFO_, 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.

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 145 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().

int Isis::NaifDskPlateModel::size ( ) const

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

Definition at line 103 of file NaifDskPlateModel.cpp.

References numberPlates().

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 409 of file NaifDskPlateModel.cpp.

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

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

Member Data Documentation

SharedNaifDskDescriptor Isis::NaifDskPlateModel::m_dsk
private

Shared pointer to the NaifDskDescriptor for this plate.

Definition at line 123 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: