Isis 3 Programmer Reference
Shape.h
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,
73  Basemap,
74  Unprojected,
75  Unknown };
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();
88  ControlPoint::SurfacePointSource::Source surfacePointSource();
89  ControlPoint::RadiusSource::Source radiusSource();
91  ShapeType shapeType();
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 
169  ControlPoint::SurfacePointSource::Source m_surfacePointSource;
170  ControlPoint::RadiusSource::Source m_radiusSource;
171  ShapeType m_shapeType;
172 
180  QString m_fileName;
184  QString m_serialNumber;
188  QString m_instrumentId;
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::Shape::m_spacecraftName
QString m_spacecraftName
Spacecraft name associated with this Shape.
Definition: Shape.h:192
Isis::Shape::setId
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition: Shape.cpp:402
Isis::Shape::displayProperties
ShapeDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this shape.
Definition: Shape.cpp:355
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::Shape::deleteFromDisk
void deleteFromDisk()
Delete the shape data from disk.
Definition: Shape.cpp:591
Isis::Latitude
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:51
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::Shape::closeCube
void closeCube()
Cleans up the Cube *.
Definition: Shape.cpp:342
Isis::Shape::createFootprint
geos::geom::MultiPolygon * createFootprint(QMutex *cameraMutex)
Calculate a footprint for an Shape using the camera or projection information.
Definition: Shape.cpp:638
Isis::Shape::m_displayProperties
ShapeDisplayProperties * m_displayProperties
The GUI information for how this Shape ought to be displayed.
Definition: Shape.h:176
Isis::Shape::footprint
geos::geom::MultiPolygon * footprint()
Get the footprint of this shape (if available).
Definition: Shape.cpp:394
Isis::Shape::incidenceAngle
Angle incidenceAngle() const
Get the incidence angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:492
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::initCamStats
void initCamStats()
TODO.
Definition: Shape.cpp:665
Isis::Shape::cube
Cube * cube()
Get the Cube * associated with this display property.
Definition: Shape.cpp:324
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::Shape::toPvl
PvlObject toPvl() const
Convert this Shape to PVL.
Definition: Shape.cpp:268
Isis::Shape::m_serialNumber
QString m_serialNumber
This will always be simply the filename and is created on construction.
Definition: Shape.h:184
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::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
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::Shape::m_fileName
QString m_fileName
The on-disk file name of the cube associated with this Shape.
Definition: Shape.h:180
Isis::Shape::fromPvl
void fromPvl(const PvlObject &pvl)
Read the shape settings from a Pvl.
Definition: Shape.cpp:236
Isis::Shape::m_footprint
geos::geom::MultiPolygon * m_footprint
A 0-360 ocentric lon,lat degrees footprint of this Shape.
Definition: Shape.h:196
Isis::Shape::id
QString id() const
Get a unique, identifying string associated with this shape.
Definition: Shape.cpp:459
Isis::Shape::aspectRatio
double aspectRatio() const
Get the aspect ratio of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:449
Isis::Shape::phaseAngle
Angle phaseAngle() const
Get the phase angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:536
Isis::Shape::m_instrumentId
QString m_instrumentId
Instrument id associated with this Shape.
Definition: Shape.h:188
Isis::Shape::resolution
double resolution() const
Get the resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:470
Isis::Shape
This represents a shape in a project-based GUI interface.
Definition: Shape.h:68
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
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::Shape::m_cube
Cube * m_cube
The cube associated with this Shape.
Definition: Shape.h:168
Isis::Shape::XmlHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
Definition: Shape.cpp:936
Isis::Shape::Shape
Shape(QString shapeFileName, QObject *parent=0)
Create an Shape from a cube file on disk.
Definition: Shape.cpp:45
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::Shape::serialNumber
QString serialNumber()
Get the serial number.
Definition: Shape.cpp:385
Isis::Shape::XmlHandler
Definition: Shape.h:138
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::Shape::m_bodyCode
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
Definition: Shape.h:157
Isis::Shape::m_id
QUuid * m_id
A unique ID for this Shape (useful for others to reference this Shape when saving to disk).
Definition: Shape.h:200
QObject
Isis::Shape::XmlHandler::XmlHandler
XmlHandler(Shape *shape, FileName shapeFolder)
Create an XML Handler (reader) that can populate the Shape class data.
Definition: Shape.cpp:828
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
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::PlotWindow *)
We have plot windows as QVariant data types, so here it's enabled.