27 #include "../common/STLUtils.h"
28 #include "../geometry.h"
35 unsigned int& firstTile,
unsigned int& lastTile)
const
51 tileIndex = int( (y - m_referencePolygon.getMBR()->getLowerLeftY() ) / m_dy );
60 : m_referencePolygon(pol)
70 unsigned int total_tiles_number = 1 +
73 for(
unsigned int i = 0; i < total_tiles_number; i++)
96 assert(ri < m_referencePolygon.getNumRings());
98 unsigned int num_points = m_referencePolygon[ri]->getNPoints();
102 unsigned int numSegments = num_points - 1;
104 for(
unsigned int j = 0; j < numSegments; j++)
107 std::pair<unsigned int, unsigned int> segPointer(ri, j);
110 unsigned int firstTileIndex = 0;
111 unsigned int lastTileIndex = 0;
115 getTileIndex(*cj, *cjp1, firstTileIndex, lastTileIndex);
117 assert(firstTileIndex < m_tileIndex.size());
118 assert(lastTileIndex < m_tileIndex.size());
121 for(
unsigned int k = firstTileIndex; k <= lastTileIndex; k++)
122 m_tileIndex[k]->push_back(segPointer);
130 getTileIndex(y, tidx);
132 if (tidx < m_tileIndex.size())
133 (*index) = m_tileIndex[tidx];
140 return m_referencePolygon;
std::size_t getNumRings() const
It returns the number of rings in this CurvePolygon.
~TileIndexer()
Destructor.
const te::gm::Polygon & m_referencePolygon
Reference polygon.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
void 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.
A LinearRing is a LineString that is both closed and simple.
const double & getY() const
It returns the Point y-coordinate value.
A point with x and y coordinate values.
Polygon tile indexing class for optmized geometrical relational tests.
double m_dy
Tile resolution along "y" axis.
void getTile(const double &y, TileSegIndex **index) const
Gets tile index.
void addRing(const unsigned int &ri)
Update the tile index with the information of the supplied ring.
void clear()
Clear all internal resources.
TileIndexer(const TileIndexer &)
Constructor.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
std::vector< TileSegIndex * > m_tileIndex
Each tile segments index vector.
std::vector< std::pair< unsigned int, unsigned int > > TileSegIndex
const te::gm::Polygon & getPolygon() const
Returns the polygon.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
double getHeight() const
It returns the envelope height.
const Envelope * getMBR() const
It returns the minimum bounding rectangle for the geometry in an internal representation.
void init()
Init internal variables.