13#include "IException.h"
14#include "PolygonTools.h"
16#include "StripPolygonSeeder.h"
54 std::vector<geos::geom::Point *> points;
57 const geos::geom::Envelope *polyBoundBox = multiPoly->getEnvelopeInternal();
70 geos::geom::Point *centroid = multiPoly->getCentroid().release();
71 double centerX = centroid->getX();
72 double centerY = centroid->getY();
75 int xStepsToCentroid = (int)((centerX - polyBoundBox->getMinX()) /
p_Xspacing + 0.5);
76 int yStepsToCentroid = (int)((centerY - polyBoundBox->getMinY()) /
p_Yspacing + 0.5);
77 double dRealMinX = centerX - (xStepsToCentroid *
p_Xspacing);
78 double dRealMinY = centerY - (yStepsToCentroid *
p_Yspacing);
82 for(
double y = dRealMinY; y <= polyBoundBox->getMaxY(); y +=
p_Yspacing) {
84 for(
double x = dRealMinX; x <= polyBoundBox->getMaxX(); x +=
p_Xspacing) {
85 geos::geom::Coordinate c(x + dDeltaXToReal, y + dDeltaYToReal);
86 geos::geom::Point *p = Isis::globalFactory->createPoint(c).release();
87 if(p->within(multiPoly)) {
88 points.push_back(Isis::globalFactory->createPoint(c).release());
91 geos::geom::Coordinate c2(x - dDeltaXToReal, y - dDeltaYToReal);
92 p = Isis::globalFactory->createPoint(c2).release();
93 if(p->within(multiPoly)) {
94 points.push_back(Isis::globalFactory->createPoint(c2).release());
121 if(algo.hasKeyword(
"XSpacing")) {
123 if(invalgo.hasKeyword(
"XSpacing")) {
124 invalgo.deleteKeyword(
"XSpacing");
128 QString msg =
"PVL for StripSeeder must contain [XSpacing] in [";
129 msg += pvl.fileName() +
"]";
134 if(algo.hasKeyword(
"YSpacing")) {
136 if(invalgo.hasKeyword(
"YSpacing")) {
137 invalgo.deleteKeyword(
"YSpacing");
141 QString msg =
"PVL for StripSeeder must contain [YSpacing] in [";
142 msg += pvl.fileName() +
"]";
147 QString msg =
"Improper format for PolygonSeeder PVL [" + pvl.fileName() +
"]";
170 pluginInfo.addKeyword(name);
171 pluginInfo.addKeyword(minThickness);
172 pluginInfo.addKeyword(minArea);
173 pluginInfo.addKeyword(xSpac);
174 pluginInfo.addKeyword(ySpac);
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Adds specific functionality to C++ strings.
This class is used as the base class for all PolygonSeeder objects.
virtual void Parse(Pvl &pvl)
Initialize parameters in the PolygonSeeder class using a PVL specification.
Pvl * invalidInput
The Pvl passed in by the constructor minus what was used.
QString StandardTests(const geos::geom::MultiPolygon *multiPoly, const geos::geom::Envelope *polyBoundBox)
Check the polygon to see if it meets standard criteria.
double MinimumArea()
Return the minimum allowed area of the polygon.
double MinimumThickness()
Return the minimum allowed thickness of the polygon.
QString Algorithm() const
The name of the algorithm, read from the Name Keyword in the PolygonSeeder Pvl passed into the constr...
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
@ Traverse
Search child objects.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Seed points using a grid with a staggered pattern.
double p_Xspacing
The spacing in the x direction between points.
std::vector< geos::geom::Point * > Seed(const geos::geom::MultiPolygon *mp)
Seed a polygon with points.
StripPolygonSeeder(Pvl &pvl)
Construct a StripPolygonSeeder algorithm.
double p_Yspacing
The spacing in the y direction between points.
virtual void Parse(Pvl &pvl)
Parse the StripSeeder spicific parameters from the PVL.
virtual PvlGroup PluginParameters(QString grpName)
Plugin parameters.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.