29 #include "geos/util/TopologyException.h"
66 std::vector<geos::geom::Point *> points;
69 const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal();
84 if(fabs(polyBoundBox->getMaxX() - polyBoundBox->getMinX()) > fabs((polyBoundBox->getMaxY() - polyBoundBox->getMinY()))) {
93 double xSpacing = (polyBoundBox->getMaxX() - polyBoundBox->getMinX()) / (xSteps);
94 double ySpacing = (polyBoundBox->getMaxY() - polyBoundBox->getMinY()) / (ySteps);
96 double realMinX = polyBoundBox->getMinX() + xSpacing / 2;
97 double realMinY = polyBoundBox->getMinY() + ySpacing / 2;
98 double maxY = polyBoundBox->getMaxY();
99 double maxX = polyBoundBox->getMaxX();
101 for(
double y = realMinY; y < maxY; y += ySpacing) {
102 for(
double x = realMinX; x < maxX; x += xSpacing) {
103 geos::geom::Geometry *gridSquarePolygon =
GetMultiPolygon(x - xSpacing / 2.0, y - ySpacing / 2,
104 x + xSpacing / 2.0, y + ySpacing / 2, *multiPoly);
106 geos::geom::Point *centroid = gridSquarePolygon->getCentroid();
108 delete gridSquarePolygon;
109 if(centroid == NULL)
continue;
111 double gridCenterX = centroid->getX();
112 double gridCenterY = centroid->getY();
115 geos::geom::Coordinate c(gridCenterX, gridCenterY);
116 points.push_back(Isis::globalFactory.createPoint(c));
138 double dMaxX,
double dMaxY,
139 const geos::geom::MultiPolygon &orig) {
140 geos::geom::CoordinateSequence *points =
new geos::geom::CoordinateArraySequence();
142 points->add(geos::geom::Coordinate(dMinX, dMinY));
143 points->add(geos::geom::Coordinate(dMaxX, dMinY));
144 points->add(geos::geom::Coordinate(dMaxX, dMaxY));
145 points->add(geos::geom::Coordinate(dMinX, dMaxY));
146 points->add(geos::geom::Coordinate(dMinX, dMinY));
148 geos::geom::Polygon *poly = Isis::globalFactory.createPolygon(Isis::globalFactory.createLinearRing(points), NULL);
149 geos::geom::Geometry *overlap = poly->intersection(&orig);
180 QString msg =
"PVL for LimitPolygonSeeder must contain [MajorAxisPoints] in [";
193 QString msg =
"PVL for LimitPolygonSeeder must contain [MinorAxisPoints] in [";
199 QString msg =
"Improper format for PolygonSeeder PVL [" + pvl.
fileName() +
"]";