It implements the vectorizer, based on TerraLib 4 algorithm. More...
#include <Vectorizer.h>
Public Member Functions | |
void | clear () |
Clear all internally allocated resources. More... | |
bool | detectEdge (long i, long j, te::gm::LineString &line) |
Detects an edge of a cell in Raster. More... | |
Vectorizer & | operator= (const Vectorizer &rhs) |
Assignment operator. More... | |
bool | run (std::vector< te::gm::Geometry * > &polygons) |
Returns true if current algorithm implementation runs ok, false otherwise. More... | |
bool | startingEdgeTest (const int &x, const int &y) |
Tests if the current point is a edge start. More... | |
Vectorizer (Raster *r, std::size_t b, unsigned int mp=0) | |
Constructor. More... | |
Vectorizer (const Vectorizer &rhs) | |
Copy constructor. More... | |
~Vectorizer () | |
Destructor. More... | |
Protected Attributes | |
std::vector < VectorizerPolygonStructure > | m_containerPolygons |
Vector of all polygons. More... | |
te::gm::Coord2D | m_directions [8] |
Directions vector. More... | |
unsigned int | m_maxPolygons |
The maximum allowed number of polygons to be created. More... | |
unsigned long | m_nColumns |
The number of columns. More... | |
unsigned long | m_nLines |
The number of lines. More... | |
double | m_noDataValue |
The used dummy value. More... | |
Raster * | m_raster |
The input image. More... | |
unsigned int | m_rasterBand |
The raster band to be used. More... | |
double | m_resX |
Resolution X. More... | |
double | m_resY |
Resolution Y. More... | |
te::sam::rtree::Index < unsigned int, 8, 4 > * | m_rTreePolygons |
A RTree instance pointer to optimize the searching of points inside already created polygons. More... | |
bool | m_useNoData |
Flag indication for dummy value use (rotulated image). More... | |
It implements the vectorizer, based on TerraLib 4 algorithm.
This algorithm implements a vectorizer, which is an algorithm to convert an image with pixel-labels into a set of polygons. All connected pixels in the image with the same label will define an individual polygon. This algorithm is based on the implementation of the previous version of this library, the TerraLib 4.
Definition at line 72 of file Vectorizer.h.
te::rst::Vectorizer::Vectorizer | ( | Raster * | r, |
std::size_t | b, | ||
unsigned int | mp = 0 |
||
) |
Constructor.
r | The input raster. |
b | The selected band of the raster to be vectorized. |
mp | The maximum allowed number of polygons to be created (default = 0, unlimited). |
Definition at line 46 of file Vectorizer.cpp.
References EAST, te::rst::Raster::getBand(), te::rst::Raster::getGrid(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rst::Band::getProperty(), te::rst::Grid::getResolutionX(), te::rst::Grid::getResolutionY(), m_containerPolygons, m_directions, m_nColumns, m_nLines, te::rst::BandProperty::m_noDataValue, m_noDataValue, m_raster, m_rasterBand, m_resX, m_resY, m_rTreePolygons, m_useNoData, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, and WEST.
te::rst::Vectorizer::Vectorizer | ( | const Vectorizer & | rhs | ) |
Copy constructor.
rhs | The right-hand-side copy that would be used to copy from. |
Definition at line 78 of file Vectorizer.cpp.
te::rst::Vectorizer::~Vectorizer | ( | ) |
Destructor.
Definition at line 82 of file Vectorizer.cpp.
void te::rst::Vectorizer::clear | ( | ) |
Clear all internally allocated resources.
Definition at line 945 of file Vectorizer.cpp.
bool te::rst::Vectorizer::detectEdge | ( | long | i, |
long | j, | ||
te::gm::LineString & | line | ||
) |
Detects an edge of a cell in Raster.
i | abscissa (column) of the upper-left point of the shape |
j | ordinate (line) of the upper-left point of the shape |
line | 2D Line. |
Definition at line 412 of file Vectorizer.cpp.
References te::gm::LineString::computeMBR(), EAST, te::gm::LineString::getEndPoint(), te::gm::LineString::getNPoints(), te::gm::LineString::getStartPoint(), te::gm::LineString::getX(), te::gm::LineString::getY(), te::gm::LineString::makeEmpty(), NORTH, NORTHEAST, NORTHWEST, te::gm::LineString::setNumCoordinates(), te::gm::LineString::setPoint(), te::gm::LineString::setX(), te::gm::LineString::setY(), SOUTH, SOUTHEAST, SOUTHWEST, WEST, te::gm::Coord2D::x, and te::gm::Coord2D::y.
te::rst::Vectorizer & te::rst::Vectorizer::operator= | ( | const Vectorizer & | rhs | ) |
Assignment operator.
rhs | The right-hand-side copy that would be used to copy from. |
Definition at line 87 of file Vectorizer.cpp.
bool te::rst::Vectorizer::run | ( | std::vector< te::gm::Geometry * > & | polygons | ) |
Returns true if current algorithm implementation runs ok, false otherwise.
polygons | The vector of polygons (will be cleared) to get the result of the vectorization. |
Definition at line 158 of file Vectorizer.cpp.
References te::gm::CurvePolygon::add(), te::rst::TileIndexer::addRing(), te::rst::TileIndexer::clear(), te::gm::Geometry::contains(), te::gm::GetGeomFromEnvelope(), te::gm::Envelope::getHeight(), te::gm::Envelope::getLowerLeftX(), te::gm::Envelope::getLowerLeftY(), te::gm::Geometry::getMBR(), te::gm::CurvePolygon::getNPoints(), te::gm::CurvePolygon::getNumRings(), te::rst::TileIndexer::getPolygon(), te::gm::CurvePolygon::getRingN(), te::gm::Envelope::getWidth(), te::gm::Geometry::intersects(), te::gm::LineStringType, te::rst::VectorizerPolygonStructure::m_indexer, te::rst::VectorizerPolygonStructure::m_polygon, te::gm::PolygonType, te::common::TaskProgress::pulse(), te::rst::VectorizerPolygonStructure::reset(), TE_TR, te::gm::Geometry::toString(), te::common::TaskProgress::UNDEFINED, te::gm::Coord2D::x, and te::gm::Coord2D::y.
Referenced by te::rst::Raster::vectorize().
bool te::rst::Vectorizer::startingEdgeTest | ( | const int & | x, |
const int & | y | ||
) |
Tests if the current point is a edge start.
x | X coord. |
y | Y coord. |
Definition at line 920 of file Vectorizer.cpp.
|
protected |
|
protected |
|
protected |
The maximum allowed number of polygons to be created.
Definition at line 146 of file Vectorizer.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
The raster band to be used.
Definition at line 145 of file Vectorizer.h.
Referenced by Vectorizer().
|
protected |
|
protected |
|
protected |
A RTree instance pointer to optimize the searching of points inside already created polygons.
Definition at line 147 of file Vectorizer.h.
Referenced by Vectorizer().
|
protected |
Flag indication for dummy value use (rotulated image).
Definition at line 137 of file Vectorizer.h.
Referenced by Vectorizer().