Isis Developer Reference
Shape.h
Go to the documentation of this file.
1 #ifndef Shape_H
2 #define Shape_H
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QObject>
13 
14 #include <QString>
15 
16 #include "Angle.h"
17 #include "ControlPoint.h"
18 #include "Distance.h"
19 #include "FileName.h"
20 #include "Latitude.h"
21 #include "Longitude.h"
22 #include "XmlStackedHandler.h"
23 
24 #include <SpiceUsr.h>
25 #include <SpiceZfc.h>
26 #include <SpiceZmc.h>
27 
28 class QUuid;
29 class QMutex;
30 class QXmlStreamWriter;
31 
32 namespace geos {
33  namespace geom {
34  class MultiPolygon;
35  }
36 }
37 
38 namespace Isis {
39  class Cube;
40  class FileName;
41  class Image;
42  class Project;
43  class PvlObject;
44  class ShapeDisplayProperties;
45  class XmlStackedHandlerReader;
46 
68  class Shape : public QObject {
69  Q_OBJECT
70  public:
71  enum ShapeType {
72  Dem,
76 
77  explicit Shape(QString shapeFileName, QObject *parent = 0);
78  explicit Shape(Cube *shapeCube, QObject *parent = 0);
79  Shape(FileName shapeFolder, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
80  ~Shape();
81 
82  void fromPvl(const PvlObject &pvl);
83  PvlObject toPvl() const;
84 
85  bool isFootprintable() const;
86  Cube *cube();
87  void closeCube();
93  QString fileName() const;
94  QString serialNumber();
95  geos::geom::MultiPolygon *footprint();
96  const geos::geom::MultiPolygon *footprint() const;
97  void setId(QString id);
98 
99  bool initFootprint(QMutex *cameraMutex);
100 
101  double aspectRatio() const;
102  QString id() const;
103  double resolution() const;
104  Angle emissionAngle() const;
105  Angle incidenceAngle() const;
106  double lineResolution() const;
107  Distance localRadius() const;
108  Angle northAzimuth() const;
109  Angle phaseAngle() const;
110  double sampleResolution() const;
111 
112  void copyToNewProjectRoot(const Project *project, FileName newProjectRoot);
113  void deleteFromDisk();
114  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
115 
116  public slots:
117  void updateFileName(Project *);
118 
119  private:
120  Shape(const Shape &other);
121  Shape &operator=(const Shape &rhs);
122 
123  void initMemberData();
124  void initShape();
125  void initCamStats();
126  void initMapStats();
127  void initDemStats();
128 
129  geos::geom::MultiPolygon *createFootprint(QMutex *cameraMutex);
130  void initQuickFootprint();
131 
138  class XmlHandler : public XmlStackedHandler {
139  public:
140  XmlHandler(Shape *shape, FileName shapeFolder);
141 
142  virtual bool startElement(const QString &namespaceURI, const QString &localName,
143  const QString &qName, const QXmlAttributes &atts);
144  virtual bool characters(const QString &ch);
145  virtual bool endElement(const QString &namespaceURI, const QString &localName,
146  const QString &qName);
147 
148  private:
149  Q_DISABLE_COPY(XmlHandler);
150 
151  Shape *m_shape;
152  FileName m_shapeFolder;
153  QString m_characters;
154  };
155 
156  private:
157  SpiceInt *m_bodyCode;
161 // QString *m_name; //!< Name of the target
162 
163 
168  Cube *m_cube;
169  ControlPoint::SurfacePointSource::Source m_surfacePointSource;
170  ControlPoint::RadiusSource::Source m_radiusSource;
171  ShapeType m_shapeType;
172 
176  ShapeDisplayProperties *m_displayProperties;
180  QString m_fileName;
184  QString m_serialNumber;
188  QString m_instrumentId;
192  QString m_spacecraftName;
196  geos::geom::MultiPolygon *m_footprint;
200  QUuid *m_id;
201 
202  // Level 1 labels
203  double m_aspectRatio;
204  double m_resolution;
205  Angle m_emissionAngle;
206  Angle m_incidenceAngle;
207  double m_lineResolution;
208  Distance m_localRadius;
209  Angle m_northAzimuth;
210  Angle m_phaseAngle;
211  double m_sampleResolution;
212 
213  // Mapping labels
214  QString m_targetName;
215  QString m_projectionName;
216  Longitude m_centerLongitude;
217  Latitude m_centerLatitude;
218  Latitude m_minimumLatitude;
219  Latitude m_maximumLatitude;
220  Longitude m_minimumLongitude;
221  Longitude m_maximumLongitude;
222  double m_pixelResolution;
223  double m_scale;
224 
225  // Dem Labels
226  Distance m_minimumRadius;
227  Distance m_maximumRadius;
228  };
229 
230 }
231 
233 
234 #endif
Isis::Angle::Degrees
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:56
FileName.h
Isis::CameraFactory::Create
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
Definition: CameraFactory.cpp:45
ProjectionFactory.h
QWidget
Isis::Shape::setId
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition: Shape.cpp:402
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::Cube::fileName
virtual QString fileName() const
Returns the opened cube's filename.
Definition: Cube.cpp:1563
Cube.h
Isis::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::Shape::displayProperties
ShapeDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this shape.
Definition: Shape.cpp:355
CameraFactory.h
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::IException::print
void print() const
Prints a string representation of this exception to stderr.
Definition: IException.cpp:445
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::Shape *)
Isis::ControlPoint::SurfacePointSource::Basemap
@ Basemap
Definition: ControlPoint.h:445
Isis::DisplayProperties::fromPvl
void fromPvl(const PvlObject &pvl)
Definition: DisplayProperties.cpp:54
Isis::Shape::surfacePointSource
ControlPoint::SurfacePointSource::Source surfacePointSource()
Definition: Shape.cpp:209
Isis::Shape::deleteFromDisk
void deleteFromDisk()
Delete the shape data from disk.
Definition: Shape.cpp:591
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Cube::group
PvlGroup & group(const QString &group) const
Read a group from the cube into a Label.
Definition: Cube.cpp:1991
Project.h
Isis::Shape::Unprojected
@ Unprojected
Definition: Shape.h:74
Isis::Blob::Type
QString Type() const
Accessor method that returns a string containing the Blob type.
Definition: Blob.cpp:124
Isis::FileName::name
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:162
Isis::ControlPoint::SurfacePointSource::Reference
@ Reference
Definition: ControlPoint.h:444
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
geos
Definition: Image.h:43
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::Cube::readFootprint
ImagePolygon readFootprint() const
Read the footprint polygon for the Cube.
Definition: Cube.cpp:866
Isis::XmlStackedHandlerReader::pushContentHandler
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
Definition: XmlStackedHandlerReader.cpp:55
Isis::ImagePolygon::toBlob
Blob toBlob() const
Serialize the ImagePolygon to a Blob.
Definition: ImagePolygon.cpp:1347
Target.h
Isis::Shape::closeCube
void closeCube()
Cleans up the Cube *.
Definition: Shape.cpp:342
Isis::Shape::radiusSource
ControlPoint::RadiusSource::Source radiusSource()
Definition: Shape.cpp:214
Isis::ControlPoint::RadiusSource::Source
Source
Definition: ControlPoint.h:451
Isis::SerialNumber::Compose
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
Definition: SerialNumber.cpp:38
Isis::Cube::copy
Cube * copy(FileName newFile, const CubeAttributeOutput &newFileAttributes)
Copies the cube to the new fileName.
Definition: Cube.cpp:276
Longitude.h
Isis::Project::shapeDataRoot
static QString shapeDataRoot(QString projectRoot)
Appends the root directory name 'shapes' to the project .
Definition: Project.cpp:2087
Isis::Shape::footprint
geos::geom::MultiPolygon * footprint()
Get the footprint of this shape (if available).
Definition: Shape.cpp:394
Isis::XmlStackedHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Definition: XmlStackedHandler.cpp:44
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::ImagePolygon::Create
void Create(Cube &cube, int sinc=1, int linc=1, int ss=1, int sl=1, int ns=0, int nl=0, int band=1, bool increasePrecision=false)
Create a Polygon from given cube.
Definition: ImagePolygon.cpp:217
Isis::PvlObject::objects
int objects() const
Returns the number of objects.
Definition: PvlObject.h:219
Isis::CubeAttributeOutput
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:473
Isis::globalFactory
static geos::geom::GeometryFactory::Ptr globalFactory
Definition: PolygonTools.h:51
Isis::ShapeDisplayProperties::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Saves this object to an XML file.
Definition: ShapeDisplayProperties.cpp:124
Isis::Shape::incidenceAngle
Angle incidenceAngle() const
Get the incidence angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:492
ShapeDisplayProperties.h
Isis::ImagePolygon
Create cube polygons, read/write polygons to blobs.
Definition: ImagePolygon.h:153
Isis::Shape::isFootprintable
bool isFootprintable() const
Test to see if it's possible to create a footprint from this shape.
Definition: Shape.cpp:294
Isis::Shape::cube
Cube * cube()
Get the Cube * associated with this display property.
Definition: Shape.cpp:324
Isis::PvlObject::object
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:489
Isis::Shape::northAzimuth
Angle northAzimuth() const
Get the north azimuth of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:525
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::Shape::copyToNewProjectRoot
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copy the cub/ecub files associated with this shape into the new project.
Definition: Shape.cpp:555
Isis::IsSpecial
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
Isis::Blob::Name
QString Name() const
Accessor method that returns a string containing the Blob name.
Definition: Blob.cpp:133
Isis::Shape::toPvl
PvlObject toPvl() const
Convert this Shape to PVL.
Definition: Shape.cpp:268
IString.h
Shape.h
Isis::Shape::Basemap
@ Basemap
Definition: Shape.h:73
Isis::Shape::shapeType
ShapeType shapeType()
Definition: Shape.cpp:219
Isis::ShapeDisplayProperties
This is the GUI communication mechanism for shape objects.
Definition: ShapeDisplayProperties.h:60
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::Shape::fileName
QString fileName() const
Get the file name of the cube that this shape represents.
Definition: Shape.cpp:376
Isis::Shape::emissionAngle
Angle emissionAngle() const
Get the emission angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:481
Isis::Cube::externalCubeFileName
FileName externalCubeFileName() const
If this is an external cube label file, this will give you the cube dn file that this label reference...
Definition: Cube.cpp:1535
Isis::ControlPoint::RadiusSource::Ellipsoid
@ Ellipsoid
Definition: ControlPoint.h:455
Isis::ControlPoint::RadiusSourceToString
static QString RadiusSourceToString(RadiusSource::Source source)
Obtain a string representation of a given RadiusSource.
Definition: ControlPoint.cpp:1413
Isis::Shape::fromPvl
void fromPvl(const PvlObject &pvl)
Read the shape settings from a Pvl.
Definition: Shape.cpp:236
Isis::Shape::id
QString id() const
Get a unique, identifying string associated with this shape.
Definition: Shape.cpp:459
Isis::ReadWrite
const int ReadWrite
Definition: Process.h:24
Isis::Distance::Meters
@ Meters
The distance is being specified in meters.
Definition: Distance.h:43
Isis::Shape::aspectRatio
double aspectRatio() const
Get the aspect ratio of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:449
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Latitude.h
Isis::Shape::phaseAngle
Angle phaseAngle() const
Get the phase angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:536
Isis::Cube::lineCount
int lineCount() const
Definition: Cube.cpp:1734
Isis::Shape::Dem
@ Dem
Definition: Shape.h:72
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::FileName::dir
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
Definition: FileName.cpp:465
Isis::ControlPoint::RadiusSource::DEM
@ DEM
Definition: ControlPoint.h:456
Isis::ControlPoint::RadiusSource::None
@ None
Definition: ControlPoint.h:452
Isis::PvlContainer::isNamed
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
Definition: PvlContainer.h:72
Isis::Project::shapeDataRoot
QString shapeDataRoot() const
Accessor for the root directory of the shape model data.
Definition: Project.cpp:2097
Isis::ControlPoint::SurfacePointSourceToString
static QString SurfacePointSourceToString(SurfacePointSource::Source source)
Obtain a string representation of a given SurfacePointSource.
Definition: ControlPoint.cpp:1492
Isis::ControlPoint::StringToSurfacePointSource
static SurfacePointSource::Source StringToSurfacePointSource(QString str)
Obtain a SurfacePoint::Source from a string.
Definition: ControlPoint.cpp:1530
Isis::ControlPoint::StringToRadiusSource
static RadiusSource::Source StringToRadiusSource(QString str)
Obtain a RadiusSource::Source from a string.
Definition: ControlPoint.cpp:1448
Isis::ControlPoint::SurfacePointSource::None
@ None
Definition: ControlPoint.h:441
Isis::PvlObject::hasKeyword
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
Definition: PvlObject.cpp:236
DisplayProperties.h
Isis::Shape::resolution
double resolution() const
Get the resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:470
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::Distance::isValid
bool isValid() const
Test if this distance has been initialized or not.
Definition: Distance.cpp:192
Isis::Shape
This represents a shape in a project-based GUI interface.
Definition: Shape.h:68
Isis::Cube::sampleCount
int sampleCount() const
Definition: Cube.cpp:1807
Isis::DisplayProperties::displayName
QString displayName() const
Returns the display name.
Definition: DisplayProperties.cpp:88
ControlPoint.h
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::XmlStackedHandler::endElement
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Definition: XmlStackedHandler.cpp:55
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Shape::localRadius
Distance localRadius() const
Get the local radius of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:514
Isis::Angle
Defines an angle and provides unit conversions.
Definition: Angle.h:45
Isis::FileName::toString
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Definition: FileName.cpp:515
Isis::ControlPoint::SurfacePointSource::Source
Source
Definition: ControlPoint.h:440
Isis::Project::projectRoot
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1666
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::ProjectionFactory::CreateFromCube
static Isis::Projection * CreateFromCube(Isis::Cube &cube)
This method is a helper method.
Definition: ProjectionFactory.cpp:1069
Isis::Shape::Shape
Shape(QString shapeFileName, QObject *parent=0)
Create an Shape from a cube file on disk.
Definition: Shape.cpp:45
Isis::Shape::Unknown
@ Unknown
Definition: Shape.h:75
Isis::Shape::ShapeType
ShapeType
Definition: Shape.h:71
IException.h
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::Shape::updateFileName
void updateFileName(Project *)
Change the on-disk file name for this cube to be where the shape ought to be in the given project.
Definition: Shape.cpp:622
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::PolygonTools::MakeMultiPolygon
static geos::geom::MultiPolygon * MakeMultiPolygon(const geos::geom::Geometry *geom)
Make a geos::geom::MultiPolygon out of the components of the argument.
Definition: PolygonTools.cpp:1369
Isis::Angle::isValid
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid,...
Definition: Angle.cpp:95
Isis::Shape::serialNumber
QString serialNumber()
Get the serial number.
Definition: Shape.cpp:385
Isis::Cube::storesDnData
bool storesDnData() const
This method returns a boolean value.
Definition: Cube.cpp:1904
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::DisplayProperties::toPvl
PvlObject toPvl() const
Convert to Pvl for project files.
Definition: DisplayProperties.cpp:68
Angle.h
Isis::Distance::meters
double meters() const
Get the distance in meters.
Definition: Distance.cpp:85
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
Isis::Shape::initFootprint
bool initFootprint(QMutex *cameraMutex)
Calculate a footprint for this shape.
Definition: Shape.cpp:421
Isis::Shape::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
Definition: Shape.cpp:844
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
PolygonTools.h
QObject
Distance.h
Isis::FileName::setExtension
FileName setExtension(const QString &extension) const
Sets all current file extensions to a new extension in the file name.
Definition: FileName.cpp:265
Isis::Blob
Definition: Blob.h:51
SerialNumber.h
XmlStackedHandlerReader.h
XmlStackedHandler.h
Isis::Shape::lineResolution
double lineResolution() const
Get the line resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:503
Isis::Shape::sampleResolution
double sampleResolution() const
Get the sample resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:547
Isis::Shape::~Shape
~Shape()
Clean up this shape.
Definition: Shape.cpp:89
Isis::ImagePolygon::Polys
geos::geom::MultiPolygon * Polys()
Return a geos Multipolygon.
Definition: ImagePolygon.h:210
CubeAttribute.h
Isis::FileName::path
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:103
Isis::Angle::Radians
@ Radians
Radians are generally used in mathematical equations, 0-2*PI is one circle, however these are more di...
Definition: Angle.h:63
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IString::ToQt
QString ToQt() const
Retuns the object string as a QString.
Definition: IString.cpp:869
ImagePolygon.h
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::Angle::radians
double radians() const
Convert an angle to a double.
Definition: Angle.h:226