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);
88 p_serialNumbers.clear();
101 if(p_polygon != NULL) {
118 if(p_polygon != NULL) {
127 void ImageOverlap::Write(std::ostream &outputStream) {
129 geos::io::WKBWriter geosWriter;
133 for(
unsigned int sn = 0; sn < p_serialNumbers.size(); sn++) {
138 serialNums += p_serialNumbers[sn];
143 outputStream << serialNums;
145 geosWriter.writeHEX(*p_polygon, outputStream);
157 for(
unsigned int s = 0; s < p_serialNumbers.size(); ++s) {
158 if(sn == p_serialNumbers[s]) {
159 QString msg =
"Duplicate SN added to [" +
160 QString::fromStdString(p_polygon->toString()) +
"]";
165 p_serialNumbers.push_back(sn);
177 return p_polygon->getArea();
186 for(
int thisSn = 0; thisSn < this->Size(); ++thisSn) {
187 for(
int otherSn = 0; otherSn < other.Size(); ++otherSn) {
188 if(p_serialNumbers[thisSn] == other.p_serialNumbers[otherSn]) {
207 for(
int thisSn = 0; thisSn < Size(); ++thisSn) {
208 if(p_serialNumbers[thisSn] == sn) {
@ Programmer
This error is for when a programmer made an API call that was illegal.
Individual overlap container.
virtual void SetPolygon(const geos::geom::MultiPolygon &polygon)
This method will replace the existing polygon that defines the overlap with a new one.
virtual double Area()
This method will return the area of the polygon.
void Init()
Initialize this object to a known state.
void Add(QString &sn)
This method will add a new serial number to the list of serial numbers alread associated with the ove...
ImageOverlap()
Construct an empty ImageOverlap object.
bool HasAnySameSerialNumber(ImageOverlap &other) const
This method will return true if any serial number from this ImageOverlap is also in the other ImageOv...
bool HasSerialNumber(QString &sn) const
This method will return true if input serial number exists in the ImageOverlap.
virtual ~ImageOverlap()
Destroy this ImageOverlap object.
This is free and unencumbered software released into the public domain.