te::rst::TileIndexer Class Reference

Polygon tile indexing class for optmized geometrical relational tests. More...

#include <TileIndexer.h>

Public Types

typedef std::vector< std::pair< unsigned int, unsigned int > > TileSegIndex
 

Public Member Functions

bool addRing (const unsigned int &ri)
 Update the tile index with the information of the supplied ring. More...
 
void clear ()
 Clear all internal resources. More...
 
TileIndexerclone () const
 Returns a clone of this instance (the caller of this method must thake the ownership of the returned pointer). More...
 
const te::gm::PolygongetPolygon () const
 Returns the polygon. More...
 
bool getTile (const double &y, TileSegIndex **index) const
 Gets tile index. More...
 
 TileIndexer (const TileIndexer &)
 Constructor. More...
 
 TileIndexer (const te::gm::Polygon &pol, const double &dy)
 Alternative Constructor. More...
 
bool within (const te::gm::Point &geometry) const
 It returns true if the given geometry is within the indexed reference polygon. More...
 
bool withinOrTouches (const te::gm::Point &geometry) const
 It returns true if the given geometry is within or touches the indexed reference polygon. More...
 
 ~TileIndexer ()
 Destructor. More...
 

Protected Member Functions

bool getTileIndex (const te::gm::Point &p1, const te::gm::Point &p2, unsigned int &firstTile, unsigned int &lastTile) const
 Gets tile index intervals in y direction for a given segment. More...
 
bool getTileIndex (const double &y, unsigned int &tileIndex) const
 Gets tile index for y coordinate value. More...
 
void init ()
 Init internal variables. More...
 
const TileIndexeroperator= (const TileIndexer &)
 Copy overload. More...
 

Protected Attributes

double m_dy
 Tile resolution along "y" axis. More...
 
const te::gm::Polygonm_referencePolygon
 Reference polygon. More...
 
std::vector< TileSegIndex * > m_tileIndex
 Each tile segments index vector. More...
 
bool m_withinIsInside
 
te::gm::LinearRing const * m_withinRingPtr
 
TileSegIndexm_withinTileIndexPtr
 
double m_withinTileX
 
double m_withinTileY
 
te::gm::Coord2D m_withinVtx0
 
te::gm::Coord2D m_withinVtx1
 
int m_withinYEquals
 
int m_withinYFlag0
 
int m_withinYFlag1
 

Detailed Description

Polygon tile indexing class for optmized geometrical relational tests.

Note
The related polygon instance must always be valid (only the polygon reference is stored internally).

Definition at line 54 of file TileIndexer.h.

Member Typedef Documentation

typedef std::vector<std::pair<unsigned int, unsigned int> > te::rst::TileIndexer::TileSegIndex

Definition at line 58 of file TileIndexer.h.

Constructor & Destructor Documentation

te::rst::TileIndexer::TileIndexer ( const TileIndexer rhs)

Constructor.

Definition at line 85 of file TileIndexer.cpp.

References m_tileIndex.

Referenced by clone().

te::rst::TileIndexer::TileIndexer ( const te::gm::Polygon pol,
const double &  dy 
)

Alternative Constructor.

Parameters
polThe polygon to index.
dyTile size along "y" axis.

Definition at line 97 of file TileIndexer.cpp.

References addRing(), te::gm::Envelope::getHeight(), te::gm::Geometry::getMBR(), te::gm::CurvePolygon::getNumRings(), init(), m_dy, m_referencePolygon, m_tileIndex, and TE_TR.

te::rst::TileIndexer::~TileIndexer ( )

Destructor.

Definition at line 132 of file TileIndexer.cpp.

References clear().

Member Function Documentation

bool te::rst::TileIndexer::addRing ( const unsigned int ri)

Update the tile index with the information of the supplied ring.

Parameters
riThe ring index.
Returns
true, if ok, false on errors.

Definition at line 137 of file TileIndexer.cpp.

References te::gm::CurvePolygon::getNPoints(), te::gm::CurvePolygon::getNumRings(), getTileIndex(), m_referencePolygon, and m_tileIndex.

Referenced by TileIndexer().

void te::rst::TileIndexer::clear ( )

Clear all internal resources.

Definition at line 125 of file TileIndexer.cpp.

References te::common::FreeContents(), init(), and m_tileIndex.

Referenced by ~TileIndexer().

te::rst::TileIndexer * te::rst::TileIndexer::clone ( ) const

Returns a clone of this instance (the caller of this method must thake the ownership of the returned pointer).

Returns
Returns a clone of this instance (the caller of this method must thake the ownership of the returned pointer).

Definition at line 80 of file TileIndexer.cpp.

References TileIndexer().

const te::gm::Polygon& te::rst::TileIndexer::getPolygon ( ) const
inline

Returns the polygon.

Definition at line 128 of file TileIndexer.h.

bool te::rst::TileIndexer::getTile ( const double &  y,
TileSegIndex **  index 
) const

Gets tile index.

Parameters
yThe Y value.
indexOutput tile pointer.
Returns
true if ok, false on errors.

Definition at line 181 of file TileIndexer.cpp.

References getTileIndex(), and m_tileIndex.

Referenced by within(), and withinOrTouches().

bool te::rst::TileIndexer::getTileIndex ( const te::gm::Point p1,
const te::gm::Point p2,
unsigned int firstTile,
unsigned int lastTile 
) const
protected

Gets tile index intervals in y direction for a given segment.

Parameters
p1First segment coordinate.
p2Second segment coordinate.
firstTileThe first tile index that this segment intersects.
lastTileThe last tile index that this segment intersects.
Returns
true if ok, false on errors.
Note
The segment does NOT need to be oriented.

Definition at line 37 of file TileIndexer.cpp.

References te::gm::Envelope::getLowerLeftY(), te::gm::Geometry::getMBR(), te::gm::Envelope::getUpperRightY(), te::gm::Point::getY(), m_dy, and m_referencePolygon.

Referenced by addRing(), and getTile().

bool te::rst::TileIndexer::getTileIndex ( const double &  y,
unsigned int tileIndex 
) const
protected

Gets tile index for y coordinate value.

Parameters
yValue of "y" coordinate.
tileIndexIndex of corresponding tile.
Returns
true if ok, false on errors.

Definition at line 59 of file TileIndexer.cpp.

References te::gm::Envelope::getLowerLeftY(), te::gm::Geometry::getMBR(), te::gm::Envelope::getUpperRightY(), m_dy, and m_referencePolygon.

void te::rst::TileIndexer::init ( )
protected

Init internal variables.

Definition at line 75 of file TileIndexer.cpp.

References m_dy.

Referenced by clear(), and TileIndexer().

const TileIndexer& te::rst::TileIndexer::operator= ( const TileIndexer )
protected

Copy overload.

bool te::rst::TileIndexer::within ( const te::gm::Point geometry) const

It returns true if the given geometry is within the indexed reference polygon.

Parameters
rhsThe other geometry to be compared.
Returns
true if the given geometry is within the indexed reference polygon.

Definition at line 197 of file TileIndexer.cpp.

References te::gm::CurvePolygon::getNumRings(), getTile(), te::gm::Point::getX(), te::gm::LineString::getX(), te::gm::Point::getY(), te::gm::LineString::getY(), m_referencePolygon, m_withinIsInside, m_withinRingPtr, m_withinTileIndexPtr, m_withinTileX, m_withinTileY, m_withinVtx0, m_withinVtx1, m_withinYFlag0, m_withinYFlag1, te::gm::Coord2D::x, and te::gm::Coord2D::y.

bool te::rst::TileIndexer::withinOrTouches ( const te::gm::Point geometry) const

It returns true if the given geometry is within or touches the indexed reference polygon.

Parameters
rhsThe other geometry to be compared.
Returns
true if the given geometry is within the indexed reference polygon.

Definition at line 245 of file TileIndexer.cpp.

References te::gm::CurvePolygon::getNumRings(), getTile(), te::gm::Point::getX(), te::gm::LineString::getX(), te::gm::Point::getY(), te::gm::LineString::getY(), m_referencePolygon, m_withinIsInside, m_withinRingPtr, m_withinTileIndexPtr, m_withinTileX, m_withinTileY, m_withinVtx0, m_withinVtx1, m_withinYEquals, m_withinYFlag0, m_withinYFlag1, te::gm::Coord2D::x, and te::gm::Coord2D::y.

Member Data Documentation

double te::rst::TileIndexer::m_dy
protected

Tile resolution along "y" axis.

Definition at line 158 of file TileIndexer.h.

Referenced by getTileIndex(), init(), and TileIndexer().

const te::gm::Polygon& te::rst::TileIndexer::m_referencePolygon
protected

Reference polygon.

Definition at line 159 of file TileIndexer.h.

Referenced by addRing(), getTileIndex(), TileIndexer(), within(), and withinOrTouches().

std::vector<TileSegIndex*> te::rst::TileIndexer::m_tileIndex
protected

Each tile segments index vector.

Definition at line 160 of file TileIndexer.h.

Referenced by addRing(), clear(), getTile(), and TileIndexer().

bool te::rst::TileIndexer::m_withinIsInside
mutableprotected

Definition at line 167 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

te::gm::LinearRing const* te::rst::TileIndexer::m_withinRingPtr
mutableprotected

Definition at line 171 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

TileSegIndex* te::rst::TileIndexer::m_withinTileIndexPtr
mutableprotected

Definition at line 164 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

double te::rst::TileIndexer::m_withinTileX
mutableprotected

Definition at line 166 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

double te::rst::TileIndexer::m_withinTileY
mutableprotected

Definition at line 165 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

te::gm::Coord2D te::rst::TileIndexer::m_withinVtx0
mutableprotected

Definition at line 172 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

te::gm::Coord2D te::rst::TileIndexer::m_withinVtx1
mutableprotected

Definition at line 173 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

int te::rst::TileIndexer::m_withinYEquals
mutableprotected

Definition at line 170 of file TileIndexer.h.

Referenced by withinOrTouches().

int te::rst::TileIndexer::m_withinYFlag0
mutableprotected

Definition at line 168 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().

int te::rst::TileIndexer::m_withinYFlag1
mutableprotected

Definition at line 169 of file TileIndexer.h.

Referenced by within(), and withinOrTouches().


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