Skip to content

Commit b019ba2

Browse files
committed
Fixes apps that fail when passing a GeoTiff with ISIS metadata
1 parent 822ab2c commit b019ba2

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ namespace Isis {
3333
// images. This is a modified insertion sort.
3434
for (int image = 0; image < images.size(); image++) {
3535
unsigned int insertPos = 0;
36-
QString sn = SerialNumber::Compose(images[image].toString());
36+
Cube cube(images[image].toString());
37+
QString sn = SerialNumber::Compose(*(cube.label()));
3738
for (insertPos = 0; insertPos < sortedList.size(); insertPos++) {
3839
if (sn.compare(sortedList[insertPos].first) < 0) break;
3940
}

isis/src/base/objs/SerialNumberList/SerialNumberList.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ find files of those names at the top level of this repository. **/
88

99
#include <QString>
1010

11+
#include "Cube.h"
1112
#include "IException.h"
1213
#include "FileList.h"
1314
#include "FileName.h"
@@ -119,7 +120,14 @@ namespace Isis {
119120
* does not exist.
120121
*/
121122
void SerialNumberList::add(const QString &filename, bool def2filename) {
122-
Pvl p(Isis::FileName(filename).expanded());
123+
Pvl p;
124+
try {
125+
p = Pvl(Isis::FileName(filename).expanded());
126+
}
127+
catch (...) {
128+
Cube cube(Isis::FileName(filename).expanded());
129+
p = *(cube.label());
130+
}
123131
PvlObject cubeObj = p.findObject("IsisCube");
124132

125133
try {
@@ -249,7 +257,14 @@ namespace Isis {
249257
*
250258
*/
251259
void SerialNumberList::add(const QString &serialNumber, const QString &filename) {
252-
Pvl p(Isis::FileName(filename).expanded());
260+
Pvl p;
261+
try {
262+
p = Pvl(Isis::FileName(filename).expanded());
263+
}
264+
catch (...) {
265+
Cube cube(Isis::FileName(filename).expanded());
266+
p = *(cube.label());
267+
}
253268
PvlObject cubeObj = p.findObject("IsisCube");
254269

255270
try {

isis/src/control/apps/autoseed/autoseed.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,14 @@ namespace Isis {
153153

154154
// Grab the labels from the first filename in the SerialNumberList to get
155155
// some info
156-
Pvl cubeLab(serialNumbers.fileName(0));
156+
Pvl cubeLab;
157+
try {
158+
cubeLab = Pvl(serialNumbers.fileName(0));
159+
}
160+
catch (...) {
161+
Cube cube(serialNumbers.fileName(0));
162+
cubeLab = *(cube.label());
163+
}
157164

158165
// Construct a Projection for converting between Lon/Lat and X/Y
159166
// This is used inside the seeding algorithms.

0 commit comments

Comments
 (0)