Isis 3 Programmer Reference
Shape.h
1 
2 #ifndef Shape_H
3 #define Shape_H
4 
22 #include <QObject>
23 
24 #include <QString>
25 
26 #include "Angle.h"
27 #include "ControlPoint.h"
28 #include "Distance.h"
29 #include "FileName.h"
30 #include "Latitude.h"
31 #include "Longitude.h"
32 #include "XmlStackedHandler.h"
33 
34 #include <SpiceUsr.h>
35 #include <SpiceZfc.h>
36 #include <SpiceZmc.h>
37 
38 class QUuid;
39 class QMutex;
40 class QXmlStreamWriter;
41 
42 namespace geos {
43  namespace geom {
44  class MultiPolygon;
45  }
46 }
47 
48 namespace Isis {
49  class Cube;
50  class FileName;
51  class Image;
52  class Project;
53  class PvlObject;
54  class ShapeDisplayProperties;
55  class XmlStackedHandlerReader;
56 
78  class Shape : public QObject {
79  Q_OBJECT
80  public:
81  enum ShapeType {
82  Dem,
83  Basemap,
84  Unprojected,
85  Unknown };
86 
87  explicit Shape(QString shapeFileName, QObject *parent = 0);
88  explicit Shape(Cube *shapeCube, QObject *parent = 0);
89  Shape(FileName shapeFolder, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
90  ~Shape();
91 
92  void fromPvl(const PvlObject &pvl);
93  PvlObject toPvl() const;
94 
95  bool isFootprintable() const;
96  Cube *cube();
97  void closeCube();
98  ControlPoint::SurfacePointSource::Source surfacePointSource();
99  ControlPoint::RadiusSource::Source radiusSource();
101  ShapeType shapeType();
103  QString fileName() const;
104  QString serialNumber();
105  geos::geom::MultiPolygon *footprint();
106  const geos::geom::MultiPolygon *footprint() const;
107  void setId(QString id);
108 
109  bool initFootprint(QMutex *cameraMutex);
110 
111  double aspectRatio() const;
112  QString id() const;
113  double resolution() const;
114  Angle emissionAngle() const;
115  Angle incidenceAngle() const;
116  double lineResolution() const;
117  Distance localRadius() const;
118  Angle northAzimuth() const;
119  Angle phaseAngle() const;
120  double sampleResolution() const;
121 
122  void copyToNewProjectRoot(const Project *project, FileName newProjectRoot);
123  void deleteFromDisk();
124  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
125 
126  public slots:
127  void updateFileName(Project *);
128 
129  private:
130  Shape(const Shape &other);
131  Shape &operator=(const Shape &rhs);
132 
133  void initMemberData();
134  void initShape();
135  void initCamStats();
136  void initMapStats();
137  void initDemStats();
138 
139  geos::geom::MultiPolygon *createFootprint(QMutex *cameraMutex);
140  void initQuickFootprint();
141 
148  class XmlHandler : public XmlStackedHandler {
149  public:
150  XmlHandler(Shape *shape, FileName shapeFolder);
151 
152  virtual bool startElement(const QString &namespaceURI, const QString &localName,
153  const QString &qName, const QXmlAttributes &atts);
154  virtual bool characters(const QString &ch);
155  virtual bool endElement(const QString &namespaceURI, const QString &localName,
156  const QString &qName);
157 
158  private:
159  Q_DISABLE_COPY(XmlHandler);
160 
161  Shape *m_shape;
162  FileName m_shapeFolder;
163  QString m_characters;
164  };
165 
166  private:
167  SpiceInt *m_bodyCode;
171 // QString *m_name; //!< Name of the target
172 
173 
179  ControlPoint::SurfacePointSource::Source m_surfacePointSource;
180  ControlPoint::RadiusSource::Source m_radiusSource;
181  ShapeType m_shapeType;
182 
190  QString m_fileName;
194  QString m_serialNumber;
198  QString m_instrumentId;
206  geos::geom::MultiPolygon *m_footprint;
210  QUuid *m_id;
211 
212  // Level 1 labels
213  double m_aspectRatio;
214  double m_resolution;
215  Angle m_emissionAngle;
216  Angle m_incidenceAngle;
217  double m_lineResolution;
218  Distance m_localRadius;
219  Angle m_northAzimuth;
220  Angle m_phaseAngle;
221  double m_sampleResolution;
222 
223  // Mapping labels
224  QString m_targetName;
225  QString m_projectionName;
226  Longitude m_centerLongitude;
227  Latitude m_centerLatitude;
228  Latitude m_minimumLatitude;
229  Latitude m_maximumLatitude;
230  Longitude m_minimumLongitude;
231  Longitude m_maximumLongitude;
232  double m_pixelResolution;
233  double m_scale;
234 
235  // Dem Labels
236  Distance m_minimumRadius;
237  Distance m_maximumRadius;
238  };
239 
240 }
241 
243 
244 #endif
PvlObject toPvl() const
Convert this Shape to PVL.
Definition: Shape.cpp:268
double resolution() const
Get the resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:471
The main project for ipce.
Definition: Project.h:289
void closeCube()
Cleans up the Cube *.
Definition: Shape.cpp:343
File name manipulation and expansion.
Definition: FileName.h:116
Angle incidenceAngle() const
Get the incidence angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:493
QString m_spacecraftName
Spacecraft name associated with this Shape.
Definition: Shape.h:202
Angle northAzimuth() const
Get the north azimuth of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:526
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copy the cub/ecub files associated with this shape into the new project.
Definition: Shape.cpp:556
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:63
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
Distance localRadius() const
Get the local radius of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:515
ShapeDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this shape.
Definition: Shape.cpp:356
geos::geom::MultiPolygon * createFootprint(QMutex *cameraMutex)
Calculate a footprint for an Shape using the camera or projection information.
Definition: Shape.cpp:639
This is the GUI communication mechanism for shape objects.
~Shape()
Clean up this shape.
Definition: Shape.cpp:89
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double sampleResolution() const
Get the sample resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:548
Distance measurement, usually in meters.
Definition: Distance.h:47
XmlHandler(Shape *shape, FileName shapeFolder)
Create an XML Handler (reader) that can populate the Shape class data.
Definition: Shape.cpp:830
QString m_instrumentId
Instrument id associated with this Shape.
Definition: Shape.h:198
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
bool initFootprint(QMutex *cameraMutex)
Calculate a footprint for this shape.
Definition: Shape.cpp:422
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
Definition: Shape.cpp:938
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
Definition: Shape.cpp:846
QUuid * m_id
A unique ID for this Shape (useful for others to reference this Shape when saving to disk)...
Definition: Shape.h:210
Cube * cube()
Get the Cube * associated with this display property.
Definition: Shape.cpp:325
Angle emissionAngle() const
Get the emission angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:482
double lineResolution() const
Get the line resolution of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:504
QString serialNumber()
Get the serial number.
Definition: Shape.cpp:386
QString m_serialNumber
This will always be simply the filename and is created on construction.
Definition: Shape.h:194
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:623
XML Handler that parses XMLs in a stack-oriented way.
Shape(QString shapeFileName, QObject *parent=0)
Create an Shape from a cube file on disk.
Definition: Shape.cpp:45
ShapeDisplayProperties * m_displayProperties
The GUI information for how this Shape ought to be displayed.
Definition: Shape.h:186
Definition: Image.h:43
Cube * m_cube
The cube associated with this Shape.
Definition: Shape.h:178
geos::geom::MultiPolygon * footprint()
Get the footprint of this shape (if available).
Definition: Shape.cpp:395
QString id() const
Get a unique, identifying string associated with this shape.
Definition: Shape.cpp:460
QString fileName() const
Get the file name of the cube that this shape represents.
Definition: Shape.cpp:377
void fromPvl(const PvlObject &pvl)
Read the shape settings from a Pvl.
Definition: Shape.cpp:236
void initCamStats()
TODO.
Definition: Shape.cpp:666
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition: Shape.cpp:403
Defines an angle and provides unit conversions.
Definition: Angle.h:62
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void deleteFromDisk()
Delete the shape data from disk.
Definition: Shape.cpp:592
This represents a shape in a project-based GUI interface.
Definition: Shape.h:78
QString m_fileName
The on-disk file name of the cube associated with this Shape.
Definition: Shape.h:190
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
geos::geom::MultiPolygon * m_footprint
A 0-360 ocentric lon,lat degrees footprint of this Shape.
Definition: Shape.h:206
double aspectRatio() const
Get the aspect ratio of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:450
Angle phaseAngle() const
Get the phase angle of this shape, as calculated and attached by camstats.
Definition: Shape.cpp:537
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
Manage a stack of content handlers for reading XML files.
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
Definition: Shape.h:167
bool isFootprintable() const
Test to see if it&#39;s possible to create a footprint from this shape.
Definition: Shape.cpp:294
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
IO Handler for Isis Cubes.
Definition: Cube.h:170