Isis 3 Programmer Reference
ImageOverlapSet.h
1#ifndef ImageOverlapSet_h
2#define ImageOverlapSet_h
8/* SPDX-License-Identifier: CC0-1.0 */
9
10#include <vector>
11#include <string>
12
13#include <QList>
14#include <QThread>
15#include <QMutex>
16
17#include "geos/geom/MultiPolygon.h"
18#include "geos/geom/LinearRing.h"
19#include "geos/util/GEOSException.h"
20
21#include "ImageOverlap.h"
22#include "IException.h"
23#include "PvlGroup.h"
24
25namespace Isis {
26
27 // Forward declarations
28 class SerialNumberList;
29
86 class ImageOverlapSet : private QThread {
87 public:
88 ImageOverlapSet(bool continueOnError = false, bool useThread = true);
89 virtual ~ImageOverlapSet();
90
91 void FindImageOverlaps(SerialNumberList &boundaries);
92 void FindImageOverlaps(std::vector<QString> sns,
93 std::vector<geos::geom::MultiPolygon *> polygons);
94 void FindImageOverlaps(SerialNumberList &boundaries, QString outputFile);
95 void ReadImageOverlaps(const QString &filename);
96 void WriteImageOverlaps(const QString &filename);
97
103 int Size() {
104 return p_lonLatOverlaps.size();
105 }
106
115 const ImageOverlap *operator[](int index) {
116 return p_lonLatOverlaps[index];
117 };
118
119 std::vector<ImageOverlap *> operator[](QString serialNumber);
120
122 const std::vector<PvlGroup> &Errors() {
123 return p_errorLog;
124 }
125 protected:
126 void FindAllOverlaps(SerialNumberList *snlist = NULL);
128
130 std::vector<PvlGroup> p_errorLog;
131
132 private:
134 void run() {
136 }
137
139
140 QList<ImageOverlap *> p_lonLatOverlaps;
141
142 ImageOverlap *CreateNewOverlap(QString serialNumber,
143 geos::geom::MultiPolygon *lonLatPolygon);
144
145 bool SetPolygon(geos::geom::Geometry *poly, int position, ImageOverlap *sncopy = NULL, bool insert = false);
146 void HandleError(IException &e, SerialNumberList *snlist, QString msg = "", int overlap1 = -1, int overlap2 = -1);
147 void HandleError(geos::util::GEOSException *exc, SerialNumberList *snlist, QString msg = "", int overlap1 = -1, int overlap2 = -1);
148 void HandleError(SerialNumberList *snlist, QString msg, int overlap1 = -1, int overlap2 = -1);
149
154
157
166 QMutex p_lonLatOverlapsMutex;
167 };
168};
169
170#endif
Isis exception class.
Definition IException.h:91
Individual overlap container.
This class is used to find the overlaps between all the images in a list of serial numbers.
void ReadImageOverlaps(const QString &filename)
Create polygons of overlap from the file specified.
QList< ImageOverlap * > p_lonLatOverlaps
The list of lat/lon overlaps.
void FindAllOverlaps(SerialNumberList *snlist=NULL)
Find the overlaps between all the existing ImageOverlap Objects.
std::vector< PvlGroup > p_errorLog
This is a list of detailed* errors including all known information.
int p_calculatedSoFar
The index of the last overlap that is done calculating (number calculated-1)
ImageOverlap * CreateNewOverlap(QString serialNumber, geos::geom::MultiPolygon *lonLatPolygon)
Create an overlap item to hold the overlap poly and its SN.
virtual ~ImageOverlapSet()
Delete this object.
void run()
Find overlaps is all the threaded calculate does.
const std::vector< PvlGroup > & Errors()
Return the a list of errors encountered.
void HandleError(IException &e, SerialNumberList *snlist, QString msg="", int overlap1=-1, int overlap2=-1)
If a problem occurred when searching for image overlaps, this method will handle it.
void AddSerialNumbers(ImageOverlap *to, ImageOverlap *from)
Add the serial numbers from the second overlap to the first.
int p_writtenSoFar
The index of the last overlap that is done writing (number written-1)
bool SetPolygon(geos::geom::Geometry *poly, int position, ImageOverlap *sncopy=NULL, bool insert=false)
This method inserts or overwrites a polygon in the overlap list based on parameters.
ImageOverlapSet(bool continueOnError=false, bool useThread=true)
Create FindImageOverlaps object.
SerialNumberList * p_snlist
This is used for multi-threaded calls to FindAllOverlaps only; this class never gets ownership of thi...
void DespikeLonLatOverlaps()
Despikes all of the overlaps in p_lonLatOverlaps.
QMutex p_calculatePolygonMutex
This mutex will be used to have blocking on the write method when multi-threading (instead of busy wa...
void FindImageOverlaps(SerialNumberList &boundaries)
Create polygons of overlap from the images specified in the serial number list.
int Size()
Returns the total number of latitude and longitude overlaps.
bool p_threadedCalculate
True if we want to do calculations in a threaded way.
bool p_continueAfterError
If false iExceptions will be thrown from FindImageOverlaps(...)
void WriteImageOverlaps(const QString &filename)
Write polygons of overlap to the file specified.
const ImageOverlap * operator[](int index)
Returns the images which overlap at a given loverlap.
Serial Number list generator.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16