10 #include "geos/io/WKBReader.h"
11 #include "geos/io/WKBWriter.h"
13 #include "PolygonTools.h"
14 #include "IException.h"
16 #include "ImageOverlap.h"
39 geos::geom::MultiPolygon &polygon) {
53 geos::io::WKBReader geosReader;
56 getline(inputStream, fileData);
58 QString serialNums = fileData.c_str();
59 foreach (QString serialNum, serialNums.split(
",")) {
64 getline(inputStream, fileData);
66 std::stringstream multiPolygon;
67 multiPolygon << fileData;
68 multiPolygon.seekg(0, std::ios::beg);
71 geosReader.readHEX(multiPolygon));
89 p_serialNumbers.clear();
102 if(p_polygon != NULL) {
119 if(p_polygon != NULL) {
128 void ImageOverlap::Write(std::ostream &outputStream) {
130 geos::io::WKBWriter geosWriter;
134 for(
unsigned int sn = 0; sn < p_serialNumbers.size(); sn++) {
139 serialNums += p_serialNumbers[sn];
144 outputStream << serialNums;
146 geosWriter.writeHEX(*p_polygon, outputStream);
158 for(
unsigned int s = 0; s < p_serialNumbers.size(); ++s) {
159 if(sn == p_serialNumbers[s]) {
160 QString msg =
"Duplicate SN added to [" +
161 QString::fromStdString(p_polygon->toString()) +
"]";
166 p_serialNumbers.push_back(sn);
178 return p_polygon->getArea();
187 for(
int thisSn = 0; thisSn < this->Size(); ++thisSn) {
188 for(
int otherSn = 0; otherSn < other.Size(); ++otherSn) {
189 if(p_serialNumbers[thisSn] == other.p_serialNumbers[otherSn]) {
208 for(
int thisSn = 0; thisSn < Size(); ++thisSn) {
209 if(p_serialNumbers[thisSn] == sn) {