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