40 #if defined(MAKE_THREAD_SAFE)
41 #include <QMutexLocker>
43 #include <QScopedPointer>
45 #include <dsk_proto.h>
68 NaifDskPlateModel::NaifDskPlateModel() : m_dsk(0) { }
76 QString mess =
"Could not open DSK file " + dskfile;
83 NaifDskPlateModel::~NaifDskPlateModel() { }
89 return ( !
m_dsk.isNull() );
112 return (
m_dsk->m_plates );
120 return (
m_dsk->m_vertices );
149 verify ( lat.
isValid(),
"Latitude parameter invalid in NaifDskPlateMode::point()" );
150 verify ( lon.
isValid(),
"Longitude parameter invalid in NaifDskPlateMode::point()" );
156 SpiceDouble lonlat[2];
161 SpiceInt plateId(-1);
163 #if defined(MAKE_THREAD_SAFE)
164 QMutexLocker lock(&
m_dsk->m_mutex);
167 llgrid_pl02(
m_dsk->m_handle, &
m_dsk->m_dladsc, npoints,
168 (ConstSpiceDouble (*)[2]) lonlat,
169 (SpiceDouble (*)[3]) &spoint[0], &plateId);
174 QString mess =
"Plateid = " + QString::number(plateId) +
" is invalid";
238 if ( !
isValid() )
return (
false);
239 return ( (plateid >= 1) && (plateid <= m_dsk->m_plates) );
266 verify(
validate(vertex),
"Invalid/bad dimensions on intercept source point");
267 verify(
validate(raydir),
"Invalid/bad dimensions on ray direction vector");
271 "Invalid point source data to determine intercept",
283 #if defined(MAKE_THREAD_SAFE)
284 QMutexLocker lock(&
m_dsk->m_mutex);
288 dskx02_c(
m_dsk->m_handle, &
m_dsk->m_dladsc, &vertex[0], &raydir[0],
289 &plateid, &xpt[0], &found);
292 if ( !found )
return (0);
321 QString mess =
"Plateid = " + QString::number(plateid) +
" is invalid";
329 #if defined(MAKE_THREAD_SAFE)
330 QMutexLocker lock(&
m_dsk->m_mutex);
334 dskp02_c(
m_dsk->m_handle, &
m_dsk->m_dladsc, plateid, 1, &nplates,
335 ( SpiceInt(*)[3] )(iplate));
341 for (
int i = 0 ; i < 3 ; i++) {
342 dskv02_c(
m_dsk->m_handle, &
m_dsk->m_dladsc, iplate[i], 1, &n,
343 ( SpiceDouble(*)[3] )(plate[i]));
373 if ( !dskFile.fileExists() ) {
374 QString mess =
"NAIF DSK file [" + dskfile +
"] does not exist.";
380 dsk->m_dskfile = dskfile;
382 dasopr_c( dskFile.expanded().toLatin1().data(), &dsk->m_handle );
387 dlabfs_c( dsk->m_handle, &dsk->m_dladsc, &found );
390 QString mess =
"No segments found in DSK file " + dskfile ;
395 dskgd_c( dsk->m_handle, &dsk->m_dladsc, &dsk->m_dskdsc );
398 dskz02_c( dsk->m_handle, &dsk->m_dladsc, &dsk->m_vertices,
403 return ( dsk.take() );
412 if ( (
Throw == action ) && ( !test ) ) {
432 NaifDskPlateModel::NaifDskDescriptor::NaifDskDescriptor() : m_dskfile(), m_handle(-1),
433 m_dladsc(), m_dskdsc(), m_plates(0),
434 m_vertices(0), m_mutex() {
438 NaifDskPlateModel::NaifDskDescriptor::~NaifDskDescriptor() {
This class defines a body-fixed surface point.
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.
int size() const
Returns the number of plates in the DSK file - mostly for conformity.
NaifTriangle plate(SpiceInt plateid) const
Retrieve the triangular plate identified by its ID.
QString filename() const
Returns the nane of the NAIF DSK file.
This class is designed to encapsulate the concept of a Latitude.
NAIF DSK file descriptor.
SurfacePoint * point(const Latitude &lat, const Longitude &lon) const
Get surface intersection for a lat/lon grid point.
SurfacePoint * makePoint(const NaifVertex &v) const
Construct and return a SurfacePoint pointer.
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.
SpiceInt plateIdOfIntercept(const NaifVertex &vertex, const NaifVector &raydir, NaifVertex &xpoint) const
Primary API to determine ray intercept from observer/look direction.
This class is designed to encapsulate the concept of a Longitude.
TNT::Array1D< SpiceDouble > NaifVertex
1-D Buffer[3]
SpiceInt numberPlates() const
Returns the number of plates in the model.
bool verify(const bool &test, const QString &errmsg, const ErrAction &action=Throw) const
Convenience method for generalized error reporting.
#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.
double positiveEast(Angle::Units units=Angle::Radians) const
Get the longitude in the PositiveEast coordinate system.
double planetocentric(Angle::Units units=Angle::Radians) const
Get the latitude in the planetocentric (universal) coordinate system.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
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.
bool isValid() const
Checks validity of the object.
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.
bool isPlateIdValid(const SpiceInt plateid) const
Determines if the plate ID is valid.
Intercept * intercept(const NaifVertex &vertex, const NaifVector &raydir) const
Determine a target body intercept point from an observer and look direction.
SpiceInt numberVertices() const
Returns the number of vertices in the plate model.
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
TNT::Array2D< SpiceDouble > NaifTriangle
3-D triangle[3][3]
Unless noted otherwise, the portions of Isis written by the USGS are public domain.