40 #if defined(MAKE_THREAD_SAFE) 41 #include <QMutexLocker> 43 #include <QScopedPointer> 61 NaifDskPlateModel::NaifDskPlateModel() : m_dsk(0) { }
69 QString mess =
"Could not open DSK file " + dskfile;
76 NaifDskPlateModel::~NaifDskPlateModel() { }
82 return ( !
m_dsk.isNull() );
105 return (
m_dsk->m_plates );
113 return (
m_dsk->m_vertices );
142 verify ( lat.
isValid(),
"Latitude parameter invalid in NaifDskPlateMode::point()" );
143 verify ( lon.
isValid(),
"Longitude parameter invalid in NaifDskPlateMode::point()" );
149 SpiceDouble lonlat[2];
154 SpiceInt plateId(-1);
156 #if defined(MAKE_THREAD_SAFE) 157 QMutexLocker lock(&
m_dsk->m_mutex);
160 llgrid_pl02(
m_dsk->m_handle, &
m_dsk->m_dladsc, npoints,
161 (ConstSpiceDouble (*)[2]) lonlat,
162 (SpiceDouble (*)[3]) &spoint[0], &plateId);
167 QString mess =
"Plateid = " + QString::number(plateId) +
" is invalid";
231 if ( !
isValid() )
return (
false);
232 return ( (plateid >= 1) && (plateid <= m_dsk->m_plates) );
259 verify(
validate(vertex),
"Invalid/bad dimensions on intercept source point");
260 verify(
validate(raydir),
"Invalid/bad dimensions on ray direction vector");
264 "Invalid point source data to determine intercept",
276 #if defined(MAKE_THREAD_SAFE) 277 QMutexLocker lock(&
m_dsk->m_mutex);
281 dskx02_c(
m_dsk->m_handle, &
m_dsk->m_dladsc, &vertex[0], &raydir[0],
282 &plateid, &xpt[0], &found);
285 if ( !found )
return (0);
314 QString mess =
"Plateid = " + QString::number(plateid) +
" is invalid";
322 #if defined(MAKE_THREAD_SAFE) 323 QMutexLocker lock(&
m_dsk->m_mutex);
327 dskp02_c(
m_dsk->m_handle, &
m_dsk->m_dladsc, plateid, 1, &nplates,
328 ( SpiceInt(*)[3] )(iplate));
334 for (
int i = 0 ; i < 3 ; i++) {
335 dskv02_c(
m_dsk->m_handle, &
m_dsk->m_dladsc, iplate[i], 1, &n,
336 ( SpiceDouble(*)[3] )(
plate[i]));
367 QString mess =
"NAIF DSK file [" + dskfile +
"] does not exist.";
373 dsk->m_dskfile = dskfile;
375 dasopr_c( dskFile.
expanded().toLatin1().data(), &dsk->m_handle );
380 dlabfs_c( dsk->m_handle, &dsk->m_dladsc, &found );
383 QString mess =
"No segments found in DSK file " + dskfile ;
388 dskgd_c( dsk->m_handle, &dsk->m_dladsc, &dsk->m_dskdsc );
391 dskz02_c( dsk->m_handle, &dsk->m_dladsc, &dsk->m_vertices,
396 return ( dsk.take() );
405 if ( (
Throw == action ) && ( !test ) ) {
425 NaifDskPlateModel::NaifDskDescriptor::NaifDskDescriptor() : m_dskfile(), m_handle(-1),
426 m_dladsc(), m_dskdsc(), m_plates(0),
427 m_vertices(0), m_mutex() {
431 NaifDskPlateModel::NaifDskDescriptor::~NaifDskDescriptor() {
This class defines a body-fixed surface point.
SpiceInt numberPlates() const
Returns the number of plates in the model.
The distance is being specified in kilometers.
File name manipulation and expansion.
NaifDskDescriptor * openDSK(const QString &dskfile)
Opens a valid NAIF DSK plate model file.
Throw an exception if an error occurs.
SurfacePoint * makePoint(const NaifVertex &v) const
Construct and return a SurfacePoint pointer.
double planetocentric(Angle::Units units=Angle::Radians) const
Get the latitude in the planetocentric (universal) coordinate system.
Namespace for the standard library.
This class is designed to encapsulate the concept of a Latitude.
NAIF DSK file descriptor.
This error is for when a programmer made an API call that was illegal.
SpiceInt m_handle
The DAS file handle of the DSK file.
TNT::Array1D< SpiceDouble > NaifVector
Namespace to contain type definitions of NAIF DSK fundamentals.
Intercept * intercept(const NaifVertex &vertex, const NaifVector &raydir) const
Determine a target body intercept point from an observer and look direction.
This class is designed to encapsulate the concept of a Longitude.
TNT::Array1D< SpiceDouble > NaifVertex
1-D Buffer[3]
SpiceInt numberVertices() const
Returns the number of vertices in the plate model.
SurfacePoint * point(const Latitude &lat, const Longitude &lon) const
Get surface intersection for a lat/lon grid point.
NaifTriangle plate(SpiceInt plateid) const
Retrieve the triangular plate identified by its ID.
bool isValid() const
Checks validity of the object.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
Container for a intercept condition.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
double positiveEast(Angle::Units units=Angle::Radians) const
Get the longitude in the PositiveEast coordinate system.
bool validate(const NaifVertex &v)
Verifies that the given NaifVector or NaifVertex is 3 dimensional.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
SharedNaifDskDescriptor m_dsk
Shared pointer to the NaifDskDescriptor for this plate.
ErrAction
Enumeration to indicate whether to throw an exception if an error occurs.
NaifDskPlateModel()
Default empty constructor.
int size() const
Returns the number of plates in the DSK file - mostly for conformity.
Displacement is a signed length, usually in meters.
Specification for an abstract triangular plate.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Namespace for ISIS/Bullet specific routines.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
QString filename() const
Returns the nane of the NAIF DSK file.
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
bool verify(const bool &test, const QString &errmsg, const ErrAction &action=Throw) const
Convenience method for generalized error reporting.
bool isPlateIdValid(const SpiceInt plateid) const
Determines if the plate ID is valid.
bool fileExists() const
Returns true if the file exists; false otherwise.
TNT::Array2D< SpiceDouble > NaifTriangle
3-D triangle[3][3]
SpiceInt plateIdOfIntercept(const NaifVertex &vertex, const NaifVector &raydir, NaifVertex &xpoint) const
Primary API to determine ray intercept from observer/look direction.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.