Isis 3 Programmer Reference
Isis::GridPolygonSeeder Class Reference

Seed points using a grid. More...

#include <GridPolygonSeeder.h>

Inheritance diagram for Isis::GridPolygonSeeder:
Inheritance graph
Collaboration diagram for Isis::GridPolygonSeeder:
Collaboration graph

Public Member Functions

 GridPolygonSeeder (Pvl &pvl)
 Construct a GridPolygonSeeder algorithm.
 
virtual ~GridPolygonSeeder ()
 Destructor.
 
std::vector< geos::geom::Point * > Seed (const geos::geom::MultiPolygon *mp)
 Seed a polygon with points.
 
bool SubGrid ()
 
virtual PvlGroup PluginParameters (QString grpName)
 Plugin parameters.
 
double MinimumThickness ()
 Return the minimum allowed thickness of the polygon.
 
double MinimumArea ()
 Return the minimum allowed area of the polygon.
 
QString Algorithm () const
 The name of the algorithm, read from the Name Keyword in the PolygonSeeder Pvl passed into the constructor.
 
Pvl InvalidInput ()
 This method returns a copy of the Pvl passed in by the constructor (from a def file probably) minus what was used.
 

Protected Member Functions

virtual void Parse (Pvl &pvl)
 Parse the GridPolygonSeeder spicific parameters from the PVL.
 
QString StandardTests (const geos::geom::MultiPolygon *multiPoly, const geos::geom::Envelope *polyBoundBox)
 Check the polygon to see if it meets standard criteria.
 

Protected Attributes

PvlinvalidInput
 The Pvl passed in by the constructor minus what was used.
 

Private Member Functions

std::vector< geos::geom::Point * > SeedGrid (const geos::geom::MultiPolygon *mp)
 
std::vector< geos::geom::Point * > SeedSubGrid (const geos::geom::MultiPolygon *mp)
 This method works a lot like SeedGrid, except around the edges of known polygons.
 
geos::geom::Point * CheckSubGrid (const geos::geom::MultiPolygon &, const double &, const double &, const int &)
 This method is used to search for a valid point, on the polygon, within the square whose center is defined by the centerX, centerY arguments and size is given by p_Xspacing and p_Yspacing.
 

Private Attributes

double p_Xspacing
 
double p_Yspacing
 
bool p_subGrid
 
QString p_algorithmName
 The value for the 'Name' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.
 
double p_minimumThickness
 The value for the 'MinimumThickness' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.
 
double p_minimumArea
 The value for the 'MinimumArea' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.
 

Detailed Description

Seed points using a grid.

This class is used to construct a grid of points inside a polygon.

Author
2006-01-20 Stuart Sides
History

2007-05-09 Tracie Sucharski, Changed a single spacing value to a separate value for x and y.

2008-02-29 Steven Lambright - Created SubGrid capabilities, cleaned up Seed methods

2008-06-18 Christopher Austin - Fixed documentation errors

2008-08-18 Christopher Austin - Upgraded to geos3.0.0

2008-11-25 Steven Lambright - Added error checking

2008-12-05 Christopher Austin - capped the subgrid to 127x127 to prevent segfaults on too high a precision

2000-01-30 Steven Lambright - Fixed an issue with not seeding entire polygons when a large portion of the polygon was on the right side of the envelope.

2009-08-05 Travis Addair - Encapsulated group creation for seed definition group

2010-04-15 Eric Hyer - Now updates parent's invalidInput variable

  • included SubGrid for what PluginParameters returns

2010-04-20 Christopher Austin - adapted for generic/unitless seeding

Definition at line 48 of file GridPolygonSeeder.h.

Constructor & Destructor Documentation

◆ GridPolygonSeeder()

Isis::GridPolygonSeeder::GridPolygonSeeder ( Pvl & pvl)

Construct a GridPolygonSeeder algorithm.

Parameters
pvlA Pvl object that contains a valid polygon point seeding definition

Definition at line 29 of file GridPolygonSeeder.cpp.

References Parse().

◆ ~GridPolygonSeeder()

virtual Isis::GridPolygonSeeder::~GridPolygonSeeder ( )
inlinevirtual

Destructor.

Definition at line 53 of file GridPolygonSeeder.h.

Member Function Documentation

◆ Algorithm()

QString Isis::PolygonSeeder::Algorithm ( ) const
inherited

The name of the algorithm, read from the Name Keyword in the PolygonSeeder Pvl passed into the constructor.

Returns
QString The value of the Name Keyword in the Pvl.

Definition at line 172 of file PolygonSeeder.cpp.

References Isis::PolygonSeeder::p_algorithmName.

Referenced by PluginParameters(), Isis::LimitPolygonSeeder::PluginParameters(), and Isis::StripPolygonSeeder::PluginParameters().

◆ CheckSubGrid()

geos::geom::Point * Isis::GridPolygonSeeder::CheckSubGrid ( const geos::geom::MultiPolygon & xymp,
const double & centerX,
const double & centerY,
const int & precision )
private

This method is used to search for a valid point, on the polygon, within the square whose center is defined by the centerX, centerY arguments and size is given by p_Xspacing and p_Yspacing.

The precision parameter determines how many points are checked. If precision is zero, then only the center is checked. In other cases, the pattern looks like this: 0: ___________________________ | 2 1 2 | | 2 2 2 | | 2 1 2 0 2 1 2 | | 2 2 2 | | 2 1 2 | |___________________________| Where the numbers represent the precision at which the point will be found.

Parameters
xympThe multipolygon we're testing for points
centerXThe X position of the center of the polygon
centerYThe Y position of the center of the polygon
precisionSee description
Returns
geos::Point* Found point, NULL if nothing found

Definition at line 292 of file GridPolygonSeeder.cpp.

Referenced by SeedSubGrid().

◆ InvalidInput()

Pvl Isis::PolygonSeeder::InvalidInput ( )
inherited

This method returns a copy of the Pvl passed in by the constructor (from a def file probably) minus what was used.

Returns
Pvl A copy of this pvl minus what was used.

Definition at line 231 of file PolygonSeeder.cpp.

References Isis::PolygonSeeder::invalidInput.

◆ MinimumArea()

double Isis::PolygonSeeder::MinimumArea ( )
inherited

Return the minimum allowed area of the polygon.

This value is set from the "MinimumArea" keyword in the PVL. The seeding algorithm will not seed polygons that have an area less than this.

Returns
double The value for the minimum area allowed.

Definition at line 195 of file PolygonSeeder.cpp.

References Isis::PolygonSeeder::p_minimumArea.

Referenced by PluginParameters(), Isis::LimitPolygonSeeder::PluginParameters(), Isis::StripPolygonSeeder::PluginParameters(), and Isis::PolygonSeeder::StandardTests().

◆ MinimumThickness()

double Isis::PolygonSeeder::MinimumThickness ( )
inherited

Return the minimum allowed thickness of the polygon.

This value is set from the "MinimumThickness" keyword in the PVL. The seeding algorithm will not seed polygons that have a thickness ratio less than this

Returns
double The value for the minimum thickness allowed.

Definition at line 183 of file PolygonSeeder.cpp.

References Isis::PolygonSeeder::p_minimumThickness.

Referenced by PluginParameters(), Isis::LimitPolygonSeeder::PluginParameters(), Isis::StripPolygonSeeder::PluginParameters(), SeedSubGrid(), and Isis::PolygonSeeder::StandardTests().

◆ Parse()

void Isis::GridPolygonSeeder::Parse ( Pvl & pvl)
protectedvirtual

Parse the GridPolygonSeeder spicific parameters from the PVL.

Parameters
pvlThe PVL object containing the control parameters for this polygon seeder.

Reimplemented from Isis::PolygonSeeder.

Definition at line 381 of file GridPolygonSeeder.cpp.

References Isis::PvlObject::findGroup(), Isis::PolygonSeeder::invalidInput, Isis::PolygonSeeder::Parse(), Isis::PvlObject::Traverse, Isis::IString::UpCase(), and Isis::IException::User.

Referenced by GridPolygonSeeder().

◆ PluginParameters()

PvlGroup Isis::GridPolygonSeeder::PluginParameters ( QString grpName)
virtual

Plugin parameters.

This method will add the PvlKeyword values for algorithm name, minimum thickness, and minimum area of this object to a PvlGroup with the name that is passed in.

Parameters
grpNameA string containing the PvlGroup name.
Returns
PvlGroup The PvlGroup with the appropriate parameters added.

Reimplemented from Isis::PolygonSeeder.

Definition at line 442 of file GridPolygonSeeder.cpp.

References Isis::PolygonSeeder::Algorithm(), Isis::PolygonSeeder::MinimumArea(), Isis::PolygonSeeder::MinimumThickness(), and Isis::toString().

◆ Seed()

std::vector< geos::geom::Point * > Isis::GridPolygonSeeder::Seed ( const geos::geom::MultiPolygon * lonLatPoly)
virtual

Seed a polygon with points.

Seed the supplied polygon with points in a grid pattern. The spacing is determined by the PVL group "PolygonSeederAlgorithm"

Parameters
lonLatPolygeos::MultiPolygon The polygon to be seeded with points.
projThe Projection to seed the polygon into
Returns
std::vector<geos::Point*> A vector of points which have been seeded into the polygon. The caller assumes responsibility for deleteing these.
History
2007-05-09 Tracie Sucharski, Changed a single spacing value to a separate value for x and y.

Implements Isis::PolygonSeeder.

Definition at line 52 of file GridPolygonSeeder.cpp.

References SeedSubGrid().

◆ SeedGrid()

std::vector< geos::geom::Point * > Isis::GridPolygonSeeder::SeedGrid ( const geos::geom::MultiPolygon * mp)
private

Definition at line 68 of file GridPolygonSeeder.cpp.

◆ SeedSubGrid()

std::vector< geos::geom::Point * > Isis::GridPolygonSeeder::SeedSubGrid ( const geos::geom::MultiPolygon * multiPoly)
private

This method works a lot like SeedGrid, except around the edges of known polygons.

This method varies in that every grid square around the edge of a found polygon will be searched in more depth than all other grid squares.

Parameters
lonLatPoly
proj
Returns
std::vector<geos::Point*> List of found points inside the polygon

Every square in the grid needs to be monitored, we'll need to know if: (a) center needs checked - pointShouldCheck (b) entire square needs checked using precision, next to found pt - pointShouldSubGridCheck (c) A point was found in the square - pointFound (d) The center of the square is not found, but the square hasnt been checked in depth - pointNotFound (e) The square has been checked in depth and no valid points found - pointCantFind

This is a pretty good equation for how much precision is to be used in the in-depth checks around the edges of polygons.

Thickness * Depth^2 <= 0.5 (0.5 is a constant, the larger the more precision to be used) Depth^2 <= 0.5/Thickness Depth <= (0.5/Thickness)^0.5

Definition at line 124 of file GridPolygonSeeder.cpp.

References CheckSubGrid(), Isis::PolygonSeeder::MinimumThickness(), and Isis::PolygonSeeder::StandardTests().

Referenced by Seed().

◆ StandardTests()

QString Isis::PolygonSeeder::StandardTests ( const geos::geom::MultiPolygon * xymp,
const geos::geom::Envelope * xyBoundBox )
protectedinherited

Check the polygon to see if it meets standard criteria.

Parameters
xympThe multipoly containing the coordinates in x/y units instead of lon/lat
xyBoundBoxThe bounding box of the multipoly
Returns
QString A string with an appropriate message to throw if a test was unsuccessful or an empty string if all tests passed.

Definition at line 146 of file PolygonSeeder.cpp.

References Isis::PolygonSeeder::MinimumArea(), Isis::PolygonSeeder::MinimumThickness(), and Isis::toString().

Referenced by Isis::LimitPolygonSeeder::Seed(), Isis::StripPolygonSeeder::Seed(), and SeedSubGrid().

◆ SubGrid()

bool Isis::GridPolygonSeeder::SubGrid ( )
inline

Definition at line 57 of file GridPolygonSeeder.h.

Member Data Documentation

◆ invalidInput

Pvl* Isis::PolygonSeeder::invalidInput
protectedinherited

◆ p_algorithmName

QString Isis::PolygonSeeder::p_algorithmName
privateinherited

The value for the 'Name' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.

Definition at line 82 of file PolygonSeeder.h.

Referenced by Isis::PolygonSeeder::Algorithm(), Isis::PolygonSeeder::operator=(), Isis::PolygonSeeder::Parse(), Isis::PolygonSeeder::PluginParameters(), Isis::PolygonSeeder::PolygonSeeder(), and Isis::PolygonSeeder::PolygonSeeder().

◆ p_minimumArea

double Isis::PolygonSeeder::p_minimumArea
privateinherited

The value for the 'MinimumArea' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.

Definition at line 89 of file PolygonSeeder.h.

Referenced by Isis::PolygonSeeder::MinimumArea(), Isis::PolygonSeeder::operator=(), Isis::PolygonSeeder::Parse(), Isis::PolygonSeeder::PluginParameters(), and Isis::PolygonSeeder::PolygonSeeder().

◆ p_minimumThickness

double Isis::PolygonSeeder::p_minimumThickness
privateinherited

The value for the 'MinimumThickness' Keyword in the PolygonSeederAlgorithm group of the Pvl that is passed into the constructor.

Definition at line 85 of file PolygonSeeder.h.

Referenced by Isis::PolygonSeeder::MinimumThickness(), Isis::PolygonSeeder::operator=(), Isis::PolygonSeeder::Parse(), Isis::PolygonSeeder::PluginParameters(), and Isis::PolygonSeeder::PolygonSeeder().

◆ p_subGrid

bool Isis::GridPolygonSeeder::p_subGrid
private

Definition at line 76 of file GridPolygonSeeder.h.

◆ p_Xspacing

double Isis::GridPolygonSeeder::p_Xspacing
private

Definition at line 74 of file GridPolygonSeeder.h.

◆ p_Yspacing

double Isis::GridPolygonSeeder::p_Yspacing
private

Definition at line 75 of file GridPolygonSeeder.h.


The documentation for this class was generated from the following files: