13 #include <geos/util/TopologyException.h>
15 #include "IException.h"
16 #include "LimitPolygonSeeder.h"
17 #include "PolygonTools.h"
50 std::vector<geos::geom::Point *> points;
53 const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal();
68 if(fabs(polyBoundBox->getMaxX() - polyBoundBox->getMinX()) > fabs((polyBoundBox->getMaxY() - polyBoundBox->getMinY()))) {
77 double xSpacing = (polyBoundBox->getMaxX() - polyBoundBox->getMinX()) / (xSteps);
78 double ySpacing = (polyBoundBox->getMaxY() - polyBoundBox->getMinY()) / (ySteps);
80 double realMinX = polyBoundBox->getMinX() + xSpacing / 2;
81 double realMinY = polyBoundBox->getMinY() + ySpacing / 2;
82 double maxY = polyBoundBox->getMaxY();
83 double maxX = polyBoundBox->getMaxX();
85 for(
double y = realMinY; y < maxY; y += ySpacing) {
86 for(
double x = realMinX; x < maxX; x += xSpacing) {
87 geos::geom::Geometry *gridSquarePolygon =
GetMultiPolygon(x - xSpacing / 2.0, y - ySpacing / 2,
88 x + xSpacing / 2.0, y + ySpacing / 2, *multiPoly);
90 geos::geom::Point *centroid = gridSquarePolygon->getCentroid();
92 delete gridSquarePolygon;
93 if(centroid == NULL)
continue;
95 double gridCenterX = centroid->getX();
96 double gridCenterY = centroid->getY();
99 geos::geom::Coordinate c(gridCenterX, gridCenterY);
100 points.push_back(Isis::globalFactory->createPoint(c));
122 double dMaxX,
double dMaxY,
123 const geos::geom::MultiPolygon &orig) {
124 geos::geom::CoordinateSequence *points =
new geos::geom::CoordinateArraySequence();
126 points->add(geos::geom::Coordinate(dMinX, dMinY));
127 points->add(geos::geom::Coordinate(dMaxX, dMinY));
128 points->add(geos::geom::Coordinate(dMaxX, dMaxY));
129 points->add(geos::geom::Coordinate(dMinX, dMaxY));
130 points->add(geos::geom::Coordinate(dMinX, dMinY));
132 geos::geom::Polygon *poly = Isis::globalFactory->createPolygon(Isis::globalFactory->createLinearRing(points), NULL);
133 geos::geom::Geometry *overlap = poly->intersection(&orig);
164 QString msg =
"PVL for LimitPolygonSeeder must contain [MajorAxisPoints] in [";
177 QString msg =
"PVL for LimitPolygonSeeder must contain [MinorAxisPoints] in [";
183 QString msg =
"Improper format for PolygonSeeder PVL [" + pvl.
fileName() +
"]";