58 ShapeModelFactory::ShapeModelFactory() {
63 ShapeModelFactory::~ShapeModelFactory() {
86 if ( Preference::Preferences().hasGroup(
"ShapeModel") ) {
87 parameters.
merge(
PvlFlatMap(Preference::Preferences().findGroup(
"ShapeModel")));
91 bool skyTarget = target->
isSky();
98 QString shapeModelFilenames =
"";
107 else if (kernelsPvlGroup.
hasKeyword(
"ElevationModel") &&
108 !kernelsPvlGroup[
"ElevationModel"].isNull()) {
109 shapeModelFilenames = (QString) kernelsPvlGroup[
"ElevationModel"];
111 else if (kernelsPvlGroup.
hasKeyword(
"ShapeModel") &&
112 !kernelsPvlGroup[
"ShapeModel"].isNull()) {
113 shapeModelFilenames = (QString) kernelsPvlGroup[
"ShapeModel"];
125 "Unable to create a shape model from given target and pvl.",
128 if (shapeModelFilenames ==
"") {
131 QString msg =
"Unable to construct an Ellipsoid shape model.";
145 else if (shapeModelFilenames ==
"RingPlane") {
148 QString msg =
"Unable to construct a RingPlane shape model.";
163 QString preferred = parameters.
get(
"RayTraceEngine",
"None").toLower();
164 QString onerror = parameters.
get(
"OnError",
"Continue").toLower();
168 QString fileErrorMsg =
"Invalid shape model file [" 169 + shapeModelFilenames +
"] in Kernels group.";
173 if (
"bullet" == preferred ) {
175 FileName v_shapefile(shapeModelFilenames);
176 QString ext = v_shapefile.
extension().toLower();
186 QString mess =
"Bullet could not initialize ISIS Cube DEM";
191 QString b_msg =
"Bullet could not initialize DEM!";
204 PvlContainer::Replace);
210 QString mess =
"Unable to create preferred BulletShapeModel";
212 if (
"fail" == onerror)
throw fileError;
219 if (
"embree" == preferred ) {
222 FileName v_shapefile(shapeModelFilenames);
223 QString ext = v_shapefile.
extension().toLower();
238 PvlContainer::Replace);
240 return ( embreeModel );
244 QString mess =
"Unable to create preferred EmbreeShapeModel";
246 if (
"fail" == onerror)
throw fileError;
254 QString msg =
"The given shape model file is not a valid NAIF DSK file. " 255 "Unable to construct a NAIF DSK shape model.";
268 if (shapeModel == NULL) {
271 fileError.
append(dskError);
278 shapeModelCube->
open(
FileName(shapeModelFilenames).expanded(),
"r" );
282 QString msg =
"The given shape model file is not a valid ISIS DEM. " 283 "Unable to open as an ISIS cube.";
285 finalError.
append(fileError);
296 QString msg =
"The given shape model file is not a valid ISIS DEM cube. " 297 "It is not map-projected.";
299 finalError.
append(fileError);
306 QString msg =
"Unable to construct a DEM shape model from the given " 307 "EquatorialCylindrical projected ISIS cube.";
315 finalError.
append(fileError);
324 QString msg =
"Unable to construct a DEM shape model " 325 "from the given projected ISIS cube file.";
328 shapeModel =
new DemShape(target, pvl);
333 finalError.
append(fileError);
340 delete shapeModelCube;
345 finalError.
append(fileError);
350 if (shapeModel == NULL) {
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Define plane shape model.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
File name manipulation and expansion.
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
Namespace for the standard library.
void setTolerance(const double &tolerance)
Set the tolerance used when checking if the stored surface point is visible.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Projection * projection()
double toDouble(const QString &string)
Global function to convert from a string to a double.
Define shapes and provide utilities for Isis3 targets.
Class for managing the construction and destruction of EmbreeTargetShapes.
bool isSky() const
Return if our target is the sky.
Define shapes and provide utilities for shapes stored as Isis3 EquatorialCylindrical map...
Base class for Map Projections.
QString get(const QString &key, const int &index=0) const
Gets the value of a keyword in the PvlFlatMap.
Provides a flat map of PvlKeywords.
Define shapes and provide utilities for targets stored as Isis3 maps.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
Provides support for NAIF's Digital Shape Kernel (DSK)
A single keyword-value pair.
void open(const QString &cfile, QString access="r")
This method will open an isis cube for reading or reading/writing.
Shape model that uses the Bullet library to perform ray tracing.
Container for cube-like labels.
This class is used to create and store valid Isis3 targets.
int merge(const PvlFlatMap &other)
Adds the keywords from another PvlFlatMap.
Define shapes and provide utilities for Isis3 targets.
Namespace for ISIS/Bullet specific routines.
QString extension() const
Returns the last extension of the file name.
virtual bool IsEquatorialCylindrical()
This method returns true if the projection is equatorial cylindrical.
void setTolerance(const double &tolerance)
Sets the occlusion tolerance.
Bullet Target Shape for planetary bodies.
General purpose Embree ray tracing model.
IO Handler for Isis Cubes.