Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
Shape.cpp
1#include "Shape.h"
2
3#include <QBuffer>
4#include <QDataStream>
5#include <QDebug>
6#include <QDir>
7#include <QFileInfo>
8#include <QMessageBox>
9#include <QMutexLocker>
10#include <QRegularExpression>
11#include <QScopedPointer>
12#include <QString>
13#include <QUuid>
14#include <QXmlStreamWriter>
15
16#include <geos/geom/MultiPolygon.h>
17#include <geos/io/WKTReader.h>
18#include <geos/io/WKTWriter.h>
19
20#include "Angle.h"
21#include "CameraFactory.h"
22#include "ControlPoint.h"
23#include "Cube.h"
24#include "CubeAttribute.h"
25#include "DisplayProperties.h"
26#include "Distance.h"
27#include "FileName.h"
28#include "IException.h"
29#include "ImagePolygon.h"
30#include "IString.h"
31#include "PolygonTools.h"
32#include "Project.h"
33#include "ProjectionFactory.h"
34#include "SerialNumber.h"
35#include "ShapeDisplayProperties.h"
36#include "Target.h"
37
38namespace Isis {
45 Shape::Shape(QString imageFileName, QObject *parent) : QObject(parent) {
46
47 m_fileName = imageFileName;
48
49 initMemberData();
50 cube();
51 initShape();
52 }
53
54
61 Shape::Shape(Cube *shapeCube, QObject *parent) : QObject(parent) {
62
63 m_fileName = shapeCube->fileName();
64
65 initMemberData();
66 m_cube = shapeCube;
67 initShape();
68 }
69
70
75 delete m_bodyCode;
76 m_bodyCode = NULL;
77
78 delete m_cube;
79 m_cube = NULL;
80
81 delete m_footprint;
82 m_footprint = NULL;
83
84 delete m_id;
85 m_id = NULL;
86
87 // Shape is a "Qt" parent of display properties, so the Shape QObject
88 // destructor will take care of deleting the display props. See call to
89 // DisplayProperties' constructor.
91 }
92
93
94 void Shape::initMemberData() {
95
96 m_bodyCode = NULL;
97 m_cube = NULL;
99 m_footprint = NULL;
100 m_id = NULL;
101
102 m_aspectRatio = Null;
103 m_resolution = Null;
104 m_lineResolution = Null;
105 m_sampleResolution = Null;
106
107 m_targetName = "";
108 m_projectionName = "";
109 m_pixelResolution = Null;
110 m_scale = Null;
111 }
112
113
114 void Shape::initShape() {
115
116 m_displayProperties = new ShapeDisplayProperties(FileName(m_fileName).name(), this);
117 m_id = new QUuid(QUuid::createUuid());
119
120 m_radiusSource = ControlPoint::RadiusSource::None;
121
122 if (cube()->hasTable("ShapeModelStatistics")) {
123 m_surfacePointSource = ControlPoint::SurfacePointSource::Basemap;
124 m_radiusSource = ControlPoint::RadiusSource::DEM;
125 m_shapeType = Dem;
126 }
127 // Is this a level 1 or level 2?
128 else {
129 try {
131 m_surfacePointSource = ControlPoint::SurfacePointSource::Basemap;
132 m_radiusSource = ControlPoint::RadiusSource::Ellipsoid;
133 m_shapeType = Basemap;
134 }
135 catch (IException &) {
136 // TODO Determine if unprojected shape has been bundle adjusted. Otherwise, ??
137 try {
139 m_surfacePointSource = ControlPoint::SurfacePointSource::Reference;
140
141 PvlGroup kernels = cube()->group("Kernels");
142 if (kernels.hasKeyword("ShapeModel")) {
143 QString shapeFile = kernels["ShapeModel"];
144 if (shapeFile.contains("dem")) {
145 m_radiusSource = ControlPoint::RadiusSource::DEM;
146 }
147 else {
148 m_radiusSource = ControlPoint::RadiusSource::Ellipsoid;
149 }
150 }
151 m_shapeType = Unprojected;
152 }
153 catch (IException &e) {
154 m_surfacePointSource = ControlPoint::SurfacePointSource::None;
155 m_radiusSource = ControlPoint::RadiusSource::None;
156 m_shapeType = Unknown;
157 QString message = "Cannot create either Camera or Projections "
158 "for the ground source file [" + displayProperties()->displayName() + "]. "
159 "Check the validity of the cube labels. The cube must either be projected or "
160 " run through spiceinit.";
161 throw IException(e, IException::Io, message, _FILEINFO_);
162 }
163 }
164 }
165
166 try {
167 if (m_shapeType == Unprojected) {
168 initCamStats();
169 }
170 else if (m_shapeType == Basemap || m_shapeType == Dem) {
171 initMapStats();
172 if (m_shapeType == Dem) {
173 initDemStats();
174 }
175 }
176 }
177 catch (IException &e) {
178 QString message = "Cannot initialize the camera, map or dem statistics for this shape file [" +
179 displayProperties()->displayName() + "]. Check the validity of the cube labels. The "
180 "cube must either be projected or run through spiceinit. \n";
181 message += e.toString();
182 QMessageBox::warning((QWidget *) parent(), "Warning", message);
183 }
184
185 try {
186 initQuickFootprint();
187 }
188 catch (IException &e) {
189
190 }
191 }
192
193
194 ControlPoint::SurfacePointSource::Source Shape::surfacePointSource() {
195 return m_surfacePointSource;
196 }
197
198
199 ControlPoint::RadiusSource::Source Shape::radiusSource() {
200 return m_radiusSource;
201 }
202
203
204 Shape::ShapeType Shape::shapeType() {
205 return m_shapeType;
206 }
207
208
221 void Shape::fromPvl(const PvlObject &pvl) {
222 QString pvlFileName = ((IString)pvl["FileName"][0]).ToQt();
223 if (m_fileName != pvlFileName) {
224 throw IException(IException::Unknown,
225 tr("Tried to load Shape [%1] with properties/information from [%2].")
226 .arg(m_fileName).arg(pvlFileName),
227 _FILEINFO_);
228 }
229
230 displayProperties()->fromPvl(pvl.findObject("DisplayProperties"));
231
232 if (pvl.hasKeyword("ID")) {
233 QByteArray hexValues(pvl["ID"][0].toLatin1());
234 QDataStream valuesStream(QByteArray::fromHex(hexValues));
235 valuesStream >> *m_id;
236 }
237 }
238
239
253 PvlObject Shape::toPvl() const {
254 PvlObject output("Shape");
255
256 output += PvlKeyword("FileName", m_fileName);
257
258 // Do m_id
259 QBuffer dataBuffer;
260 dataBuffer.open(QIODevice::ReadWrite);
261
262 QDataStream idStream(&dataBuffer);
263 idStream << *m_id;
264
265 dataBuffer.seek(0);
266
267 output += PvlKeyword("ID", QString(dataBuffer.data().toHex()));
268
269 output += displayProperties()->toPvl();
270
271 return output;
272 }
273
274
280 bool result = false;
281
282 if (m_footprint)
283 result = true;
284
285 if (!result && m_cube) {
286 Blob example = ImagePolygon().toBlob();
287
288 QString blobType = example.Type();
289 QString blobName = example.Name();
290
291 Pvl &labels = *m_cube->label();
292
293 for (int i = 0; i < labels.objects(); i++) {
294 PvlObject &obj = labels.object(i);
295
296 if (obj.isNamed(blobType) && obj.hasKeyword("Name") && obj["Name"][0] == blobName)
297 result = true;
298 }
299 }
300
301 return result;
302 }
303
304
310 if (!m_cube) {
311 try {
312 m_cube = new Cube(m_fileName);
313 }
314 catch (IException &e) {
315 throw IException(e, IException::Programmer, "Cube cannot be created", _FILEINFO_);
316 }
317 }
318
319 return m_cube;
320 }
321
322
328 if (m_cube) {
329 delete m_cube;
330 m_cube = NULL;
331 }
332 }
333
334
343
344
354
355
361 QString Shape::fileName() const {
362 return m_fileName;
363 }
364
365
371 return m_serialNumber;
372 }
373
379 geos::geom::MultiPolygon *Shape::footprint() {
380 return m_footprint;
381 }
382
383
387 void Shape::setId(QString id) {
388 *m_id = QUuid(QString("{%1}").arg(id));
389 }
390
391
397 const geos::geom::MultiPolygon *Shape::footprint() const {
398 return m_footprint;
399 }
400
401
406 bool Shape::initFootprint(QMutex *cameraMutex) {
407 if (!m_footprint) {
408 try {
409 initQuickFootprint();
410 }
411 catch (IException &e) {
412 try {
413 m_footprint = createFootprint(cameraMutex);
414 }
415 catch(IException &e) {
416 IString msg = "Could not read the footprint from cube [" +
417 displayProperties()->displayName() + "]. Please make "
418 "sure footprintinit has been run";
419 throw IException(e, IException::Io, msg, _FILEINFO_);
420 }
421 }
422 }
423
424 // I'm not sure how this could ever be NULL. -SL
425 return (m_footprint != NULL);
426 }
427
428
434 double Shape::aspectRatio() const {
435 return m_aspectRatio;
436 }
437
438
444 QString Shape::id() const {
445 return m_id->toString().remove(QRegularExpression("[{}]"));
446 }
447
448
455 double Shape::resolution() const {
456 return m_resolution;
457 }
458
459
467 return m_emissionAngle;
468 }
469
470
478 return m_incidenceAngle;
479 }
480
481
488 double Shape::lineResolution() const {
489 return m_lineResolution;
490 }
491
492
500 return m_localRadius;
501 }
502
503
511 return m_northAzimuth;
512 }
513
514
522 return m_phaseAngle;
523 }
524
525
532 double Shape::sampleResolution() const {
533 return m_sampleResolution;
534 }
535
536
540 void Shape::copyToNewProjectRoot(const Project *project, FileName newProjectRoot) {
541 if (FileName(newProjectRoot) != FileName(project->projectRoot())) {
542 Cube origShape(m_fileName);
543
544 FileName newExternalLabelFileName(Project::shapeDataRoot(newProjectRoot.toString()) + "/" +
545 FileName(m_fileName).dir().dirName() + "/" + FileName(m_fileName).name());
546
547 QScopedPointer<Cube> newExternalLabel(
548 origShape.copy(newExternalLabelFileName, CubeAttributeOutput("+External")));
549
550 // If this is an ecub (it should be) and is pointing to a relative file name,
551 // then we want to copy the DN cube also.
552 if ( origShape.labelsAttached() == Cube::ExternalLabel ) {
553 if (origShape.externalCubeFileName().path() == ".") {
554 Cube dnFile(
555 FileName(m_fileName).path() + "/" + origShape.externalCubeFileName().name());
556
557 FileName newDnFileName = newExternalLabelFileName.setExtension("cub");
558
559 QScopedPointer<Cube> newDnFile(dnFile.copy(newDnFileName, CubeAttributeOutput()));
560 newDnFile->close();
561
562 newExternalLabel->relocateDnData(newDnFileName.name());
563 }
564 else {
565 newExternalLabel->relocateDnData(origShape.externalCubeFileName());
566 }
567 }
568 }
569 }
570
571
577 bool deleteCubAlso = (cube()->externalCubeFileName().path() == ".");
578 closeCube();
579
580 if (!QFile::remove(m_fileName)) {
581 throw IException(IException::Io,
582 tr("Could not remove file [%1]").arg(m_fileName),
583 _FILEINFO_);
584 }
585
586 if (deleteCubAlso) {
587 FileName cubFile = FileName(m_fileName).setExtension("cub");
588 if (!QFile::remove(cubFile.expanded())) {
589 throw IException(IException::Io,
590 tr("Could not remove file [%1]").arg(m_fileName),
591 _FILEINFO_);
592 }
593 }
594
595 // If we're the last thing in the folder, remove the folder too.
596 QDir dir;
597 dir.rmdir(FileName(m_fileName).path());
598 }
599
600
608 closeCube();
609
610 FileName original(m_fileName);
611 FileName newName(project->shapeDataRoot() + "/" +
612 original.dir().dirName() + "/" + original.name());
613 m_fileName = newName.expanded();
614 }
615
616
623 geos::geom::MultiPolygon *Shape::createFootprint(QMutex *cameraMutex) {
624 QMutexLocker lock(cameraMutex);
625
626 // We need to walk the shape to create the polygon...
627 ImagePolygon imgPoly;
628
629 int sampleStepSize = cube()->sampleCount() / 10;
630 if (sampleStepSize <= 0) sampleStepSize = 1;
631
632 int lineStepSize = cube()->lineCount() / 10;
633 if (lineStepSize <= 0) lineStepSize = 1;
634
635 imgPoly.Create(*cube(), sampleStepSize, lineStepSize);
636
637 IException e = IException(IException::User,
638 tr("Warning: Polygon re-calculated for [%1] which can be very slow")
639 .arg(displayProperties()->displayName()),
640 _FILEINFO_);
641 e.print();
642
643 return PolygonTools::MakeMultiPolygon(imgPoly.Polys()->clone().release());
644 }
645
646
651 bool hasCamStats = false;
652
653 Pvl &label = *cube()->label();
654 for (int i = 0; !hasCamStats && i < label.objects(); i++) {
655 PvlObject &obj = label.object(i);
656
657 try {
658 if (obj.name() == "Table") {
659 if (obj["Name"][0] == "CameraStatistics") {
660 hasCamStats = true;
661 }
662 }
663 }
664 catch (IException &e) {
665 e.print();
666 }
667 }
668
669 if (hasCamStats) {
670 Table camStatsTable("CameraStatistics", m_fileName, label);
671
672 int numRecords = camStatsTable.Records();
673 for (int recordIndex = 0; recordIndex < numRecords; recordIndex++) {
674 TableRecord &record = camStatsTable[recordIndex];
675
676 // The TableField class gives us a std::string with NULL (\0) characters... be careful not
677 // to keep them when going to QString.
678 QString recordName((QString)record["Name"]);
679 double avgValue = (double)record["Average"];
680
681 if (recordName == "AspectRatio") {
682 m_aspectRatio = avgValue;
683 }
684 else if (recordName == "Resolution") {
685 m_resolution = avgValue;
686 }
687 else if (recordName == "EmissionAngle") {
688 m_emissionAngle = Angle(avgValue, Angle::Degrees);
689 }
690 else if (recordName == "IncidenceAngle") {
691 m_incidenceAngle = Angle(avgValue, Angle::Degrees);
692 }
693 else if (recordName == "LineResolution") {
694 m_lineResolution = avgValue;
695 }
696 else if (recordName == "LocalRadius") {
697 m_localRadius = Distance(avgValue, Distance::Meters);
698 }
699 else if (recordName == "NorthAzimuth") {
700 m_northAzimuth = Angle(avgValue, Angle::Degrees);
701 }
702 else if (recordName == "PhaseAngle") {
703 m_phaseAngle = Angle(avgValue, Angle::Degrees);
704 }
705 else if (recordName == "SampleResolution") {
706 m_sampleResolution = avgValue;
707 }
708 }
709 }
710
711 for (int i = 0; i < label.objects(); i++) {
712 PvlObject &obj = label.object(i);
713 try {
714 if (obj.hasGroup("Instrument")) {
715 PvlGroup instGroup = obj.findGroup("Instrument");
716
717 if (instGroup.hasKeyword("SpacecraftName"))
718 m_spacecraftName = obj.findGroup("Instrument")["SpacecraftName"][0];
719
720 if (instGroup.hasKeyword("InstrumentId"))
721 m_instrumentId = obj.findGroup("Instrument")["InstrumentId"][0];
722 }
723 }
724 catch (IException &e) {
725 e.print();
726 }
727 }
728 }
729
730
731 void Shape::initMapStats() {
732
733 Pvl &label = *cube()->label();
734 for (int i = 0; i < label.objects(); i++) {
735 PvlObject &obj = label.object(i);
736 try {
737 if (obj.hasGroup("Instrument")) {
738 PvlGroup instGroup = obj.findGroup("Instrument");
739
740 if (instGroup.hasKeyword("SpacecraftName"))
741 m_spacecraftName = obj.findGroup("Instrument")["SpacecraftName"][0];
742
743 if (instGroup.hasKeyword("InstrumentId"))
744 m_instrumentId = obj.findGroup("Instrument")["InstrumentId"][0];
745 }
746
747 if (obj.hasGroup("Mapping")) {
748 PvlGroup mapGroup = obj.findGroup("Mapping");
749
750 if (mapGroup.hasKeyword("TargetName"))
751 m_targetName = obj.findGroup("Mapping")["TargetName"][0];
752
753 if (mapGroup.hasKeyword("ProjectionName"))
754 m_projectionName = obj.findGroup("Mapping")["ProjectionName"][0];
755
756 if (mapGroup.hasKeyword("CenterLongitude"))
757 m_centerLongitude = Longitude(toDouble(obj.findGroup("Mapping")["CenterLongitude"][0]),
758 mapGroup, Angle::Degrees);
759
760 if (mapGroup.hasKeyword("CenterLatitude"))
761 m_centerLatitude = Latitude(toDouble(obj.findGroup("Mapping")["CenterLatitude"][0]),
762 mapGroup, Angle::Degrees);
763
764 if (mapGroup.hasKeyword("MinimumLatitude"))
765 m_minimumLatitude = Latitude(toDouble(obj.findGroup("Mapping")["MinimumLatitude"][0]),
766 mapGroup, Angle::Degrees);
767
768 if (mapGroup.hasKeyword("MaximumLatitude"))
769 m_maximumLatitude = Latitude(toDouble(obj.findGroup("Mapping")["MaximumLatitude"][0]),
770 mapGroup, Angle::Degrees);
771
772 if (mapGroup.hasKeyword("MinimumLongitude"))
773 m_minimumLongitude = Longitude(toDouble(obj.findGroup("Mapping")["MinimumLongitude"][0]),
774 mapGroup, Angle::Degrees);
775
776 if (mapGroup.hasKeyword("MaximumLongitude"))
777 m_maximumLongitude = Longitude(toDouble(obj.findGroup("Mapping")["MaximumLongitude"][0]),
778 mapGroup, Angle::Degrees);
779
780 if (mapGroup.hasKeyword("PixelResolution"))
781 m_pixelResolution = obj.findGroup("Mapping")["PixelResolution"];
782
783 if (mapGroup.hasKeyword("Scale"))
784 m_scale = obj.findGroup("Mapping")["Scale"];
785 }
786 }
787 catch (IException &e) {
788 e.print();
789 }
790 }
791 }
792
793
794 void Shape::initDemStats() {
795
796
797 }
798
799
800 void Shape::initQuickFootprint() {
801 ImagePolygon poly = cube()->readFootprint();
802 m_footprint = PolygonTools::MakeMultiPolygon(poly.Polys()->clone().release());
803 }
804
805
816 void Shape::save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot)
817 const {
818
819 stream.writeStartElement("shape");
820
821 stream.writeAttribute("id", m_id->toString());
822 stream.writeAttribute("fileName", FileName(m_fileName).name());
823 stream.writeAttribute("serialNumber", m_serialNumber);
824
825 QString type;
826 if (m_shapeType == Unprojected) {
827 type = "Unprojected";
828 }
829 else if (m_shapeType == Basemap) {
830 type = "Basemap";
831 }
832 else {
833 type = "Dem";
834 }
835 stream.writeAttribute("shapeType", type);
836 stream.writeAttribute("surfacePointSource",
837 ControlPoint::SurfacePointSourceToString(m_surfacePointSource));
838 stream.writeAttribute("radiusSource",
839 ControlPoint::RadiusSourceToString(m_radiusSource));
840
841 if (m_shapeType == Unprojected) {
842 stream.writeAttribute("instrumentId", m_instrumentId);
843 stream.writeAttribute("spacecraftName", m_spacecraftName);
844
845 if (!IsSpecial(m_aspectRatio)) {
846 stream.writeAttribute("aspectRatio", IString(m_aspectRatio).ToQt());
847 }
848
849 if (!IsSpecial(m_resolution)) {
850 stream.writeAttribute("resolution", IString(m_resolution).ToQt());
851 }
852
853 if (m_emissionAngle.isValid()) {
854 stream.writeAttribute("emissionAngle", IString(m_emissionAngle.radians()).ToQt());
855 }
856
857 if (m_incidenceAngle.isValid()) {
858 stream.writeAttribute("incidenceAngle", IString(m_incidenceAngle.radians()).ToQt());
859 }
860
861 if (!IsSpecial(m_lineResolution)) {
862 stream.writeAttribute("lineResolution", IString(m_lineResolution).ToQt());
863 }
864
865 if (m_localRadius.isValid()) {
866 stream.writeAttribute("localRadius", IString(m_localRadius.meters()).ToQt());
867 }
868
869 if (m_northAzimuth.isValid()) {
870 stream.writeAttribute("northAzimuth", IString(m_northAzimuth.radians()).ToQt());
871 }
872
873 if (m_phaseAngle.isValid()) {
874 stream.writeAttribute("phaseAngle", IString(m_phaseAngle.radians()).ToQt());
875 }
876
877 if (!IsSpecial(m_sampleResolution)) {
878 stream.writeAttribute("sampleResolution", IString(m_sampleResolution).ToQt());
879 }
880 }
881 else if (m_shapeType == Basemap) {
882
883 }
884 else if (m_shapeType == Dem) {
885
886 }
887
888 if (m_footprint) {
889 stream.writeStartElement("footprint");
890
891 geos::io::WKTWriter wktWriter;
892 stream.writeCharacters(QString::fromStdString(wktWriter.write(m_footprint)));
893
894 stream.writeEndElement();
895 }
896
897 m_displayProperties->save(stream, project, newProjectRoot);
898
899 stream.writeEndElement();
900 }
901}
Defines an angle and provides unit conversions.
Definition Angle.h:45
@ Degrees
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition Angle.h:56
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
static QString RadiusSourceToString(RadiusSource::Source source)
Obtain a string representation of a given RadiusSource.
static QString SurfacePointSourceToString(SurfacePointSource::Source source)
Obtain a string representation of a given SurfacePointSource.
Manipulate and parse attributes of output cube filenames.
IO Handler for Isis Cubes.
Definition Cube.h:168
ImagePolygon readFootprint() const
Read the footprint polygon for the Cube.
Definition Cube.cpp:1114
int lineCount() const
Definition Cube.cpp:2008
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:1810
@ ExternalLabel
The label is pointing to an external DN file - the label is also external to the data.
Definition Cube.h:254
PvlGroup & group(const QString &group) const
Read a group from the cube into a Label.
Definition Cube.cpp:2277
int sampleCount() const
Definition Cube.cpp:2081
Cube * copy(FileName newFile, const CubeAttributeOutput &newFileAttributes)
Copies the cube to the new fileName.
Definition Cube.cpp:288
LabelAttachment labelsAttached() const
Test if labels are attached.
Definition Cube.cpp:260
virtual QString fileName() const
Returns the opened cube's filename.
Definition Cube.cpp:1837
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition Cube.cpp:1975
QString displayName() const
Returns the display name.
PvlObject toPvl() const
Convert to Pvl for project files.
Distance measurement, usually in meters.
Definition Distance.h:34
@ Meters
The distance is being specified in meters.
Definition Distance.h:43
Create cube polygons, read/write polygons to blobs.
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.
geos::geom::MultiPolygon * Polys()
Return a geos Multipolygon.
Blob toBlob() const
Serialize the ImagePolygon to a Blob.
static geos::geom::MultiPolygon * MakeMultiPolygon(const geos::geom::Geometry *geom)
Make a geos::geom::MultiPolygon out of the components of the argument.
The main project for ipce.
Definition Project.h:287
static QString shapeDataRoot(QString projectRoot)
Appends the root directory name 'shapes' to the project .
Definition Project.cpp:2149
QString projectRoot() const
Get the top-level folder of the project.
Definition Project.cpp:1728
static Isis::Projection * CreateFromCube(Isis::Cube &cube)
This method is a helper method.
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
This is the GUI communication mechanism for shape objects.
void initCamStats()
TODO.
Definition Shape.cpp:650
~Shape()
Clean up this shape.
Definition Shape.cpp:74
geos::geom::MultiPolygon * createFootprint(QMutex *cameraMutex)
Calculate a footprint for an Shape using the camera or projection information.
Definition Shape.cpp:623
Shape(QString shapeFileName, QObject *parent=0)
Create an Shape from a cube file on disk.
Definition Shape.cpp:45
void closeCube()
Cleans up the Cube *.
Definition Shape.cpp:327
PvlObject toPvl() const
Convert this Shape to PVL.
Definition Shape.cpp:253
bool isFootprintable() const
Test to see if it's possible to create a footprint from this shape.
Definition Shape.cpp:279
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
Definition Shape.h:130
Distance localRadius() const
Get the local radius of this shape, as calculated and attached by camstats.
Definition Shape.cpp:499
Angle phaseAngle() const
Get the phase angle of this shape, as calculated and attached by camstats.
Definition Shape.cpp:521
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:607
double resolution() const
Get the resolution of this shape, as calculated and attached by camstats.
Definition Shape.cpp:455
QString serialNumber()
Get the serial number.
Definition Shape.cpp:370
QString m_spacecraftName
Spacecraft name associated with this Shape.
Definition Shape.h:165
double sampleResolution() const
Get the sample resolution of this shape, as calculated and attached by camstats.
Definition Shape.cpp:532
ShapeDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this shape.
Definition Shape.cpp:340
double lineResolution() const
Get the line resolution of this shape, as calculated and attached by camstats.
Definition Shape.cpp:488
void deleteFromDisk()
Delete the shape data from disk.
Definition Shape.cpp:576
Angle emissionAngle() const
Get the emission angle of this shape, as calculated and attached by camstats.
Definition Shape.cpp:466
QString id() const
Get a unique, identifying string associated with this shape.
Definition Shape.cpp:444
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
Definition Shape.cpp:816
double aspectRatio() const
Get the aspect ratio of this shape, as calculated and attached by camstats.
Definition Shape.cpp:434
QString fileName() const
Get the file name of the cube that this shape represents.
Definition Shape.cpp:361
Cube * m_cube
The cube associated with this Shape.
Definition Shape.h:141
geos::geom::MultiPolygon * m_footprint
A 0-360 ocentric lon,lat degrees footprint of this Shape.
Definition Shape.h:169
Cube * cube()
Get the Cube * associated with this display property.
Definition Shape.cpp:309
Angle incidenceAngle() const
Get the incidence angle of this shape, as calculated and attached by camstats.
Definition Shape.cpp:477
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copy the cub/ecub files associated with this shape into the new project.
Definition Shape.cpp:540
QUuid * m_id
A unique ID for this Shape (useful for others to reference this Shape when saving to disk).
Definition Shape.h:173
QString m_serialNumber
This will always be simply the filename and is created on construction.
Definition Shape.h:157
QString m_instrumentId
Instrument id associated with this Shape.
Definition Shape.h:161
bool initFootprint(QMutex *cameraMutex)
Calculate a footprint for this shape.
Definition Shape.cpp:406
void fromPvl(const PvlObject &pvl)
Read the shape settings from a Pvl.
Definition Shape.cpp:221
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition Shape.cpp:387
Angle northAzimuth() const
Get the north azimuth of this shape, as calculated and attached by camstats.
Definition Shape.cpp:510
geos::geom::MultiPolygon * footprint()
Get the footprint of this shape (if available).
Definition Shape.cpp:379
QString m_fileName
The on-disk file name of the cube associated with this Shape.
Definition Shape.h:153
ShapeDisplayProperties * m_displayProperties
The GUI information for how this Shape ought to be displayed.
Definition Shape.h:149
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16