47 std::size_t lastPos =
m_coords.size();
53 for(std::size_t i = lastPos; i <
m_coords.size(); ++i)
76 return "Implements vertex search snap.";
88 std::vector<std::size_t> report;
94 std::size_t snappedPos = report[0];
100 double minDistance = std::numeric_limits<double>::max();
101 for(std::size_t i = 1; i < report.size(); ++i)
105 if(distance < minDistance)
107 minDistance = distance;
108 snappedPos = report[i];
113 assert(snappedPos <
m_coords.size());
119 result.
x = snapped.x;
120 result.
y = snapped.y;
This class implements geometry snap concept.
Utility functions for TerraLib Edit module.
SnapVertex(const std::string &source, int srid=TE_UNKNOWN_SRS)
te::sam::rtree::Index< std::size_t, 8 > m_rtree
Internal index used to retrieve geometries spatially.
This class implements a vertex search snap.
An utility struct for representing 2D coordinates.
TEEDITEXPORT void GetCoordinates(te::gm::Geometry *geom, std::vector< te::gm::Coord2D > &coords)
void add(te::gm::Geometry *geom)
std::string getName() const
Coord2D getCenter() const
It returns the rectangle's center coordinate.
std::size_t m_nGeometries
The current number of geometries added to the snap.
An Envelope defines a 2D rectangular region.
bool search(const te::gm::Envelope &e, te::gm::Coord2D &result)
TEEDITEXPORT double GetDistance(const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
std::string getDescription() const
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
static Snap * Builder(const std::string &source, int srid)
bool isValid() const
It tells if the rectangle is valid or not.
std::vector< te::gm::Coord2D > m_coords
The snap coordinates.
std::size_t m_maxGeometries
The maximum number of geometries that can be added to the snap. If 0, there will be not limit...