27 #include "../dataaccess/dataset/DataSet.h" 
   28 #include "../dataaccess/dataset/ObjectId.h" 
   29 #include "../dataaccess/utils/Utils.h" 
   30 #include "../datatype/SimpleData.h" 
   31 #include "../geometry/Coord2D.h" 
   32 #include "../geometry/Envelope.h" 
   33 #include "../geometry/GeometryCollection.h" 
   34 #include "../geometry/GeometryProperty.h" 
   35 #include "../geometry/LineString.h" 
   36 #include "../geometry/MultiPoint.h" 
   37 #include "../geometry/Point.h" 
   38 #include "../geometry/Polygon.h" 
   39 #include "../geometry/Utils.h" 
   40 #include "../srs/Config.h" 
   47 #include <boost/uuid/random_generator.hpp> 
   48 #include <boost/uuid/uuid_io.hpp> 
   63     reprojectedEnvelope.
transform(srid, layer->getSRID());
 
   66   Feature* f = RepositoryManager::getInstance().getFeature(layer->getId(), env, srid);
 
   72   if(!reprojectedEnvelope.
intersects(layer->getExtent()))
 
   75   std::auto_ptr<const te::map::LayerSchema> schema(layer->getSchema());
 
   77   if(!schema->hasGeom())
 
   80   std::vector<std::string> oidPropertyNames;
 
   86   std::auto_ptr<te::da::DataSet> dataset = layer->getData(gp->getName(), &reprojectedEnvelope, 
te::gm::INTERSECTS);
 
   88   if(dataset.get() == 0)
 
   98   while(dataset->moveNext())
 
  100     std::auto_ptr<te::gm::Geometry> g(dataset->getGeometry(gp->getName()));
 
  102     if(g->contains(&point) || g->crosses(geometryFromEnvelope.get()) || geometryFromEnvelope->contains(g.get())) 
 
  118       GetLines(dynamic_cast<te::gm::GeometryCollection*>(geom), lines);
 
  122       GetLines(dynamic_cast<te::gm::Polygon*>(geom), lines);
 
  126       GetLines(dynamic_cast<te::gm::LineString*>(geom), lines);
 
  146   std::vector<te::gm::Curve*>& rings = p->
getRings();
 
  148   for(std::size_t i = 0; i < rings.size(); ++i) 
 
  149     GetLines(dynamic_cast<te::gm::LineString*>(rings[i]), lines);
 
  161   assert(index.
m_line < lines.size());
 
  165   assert(index.
m_pos < l->getNPoints());
 
  170     l->setPoint(l->getNPoints() - 1, x, y);
 
  173     l->setPoint(index.
m_pos, x, y);
 
  179   assert(index.
m_line < lines.size());
 
  186   for(std::size_t i = 0; i < currentLine->getNPoints(); ++i)
 
  192     if(
IsSpecialRingVertex(currentLine, index) && ((i == 0) || (i == currentLine->getNPoints() - 1)))
 
  195     newLine->
setPoint(pos, currentLine->getX(i), currentLine->getY(i));
 
  199   if(currentLine->isClosed())
 
  203   *currentLine = *newLine;
 
  216                                                        currentLine->getGeomTypeId(), currentLine->getSRID());
 
  219   for(std::size_t i = 0; i < currentLine->getNPoints(); ++i)
 
  221     newLine->
setPoint(pos, currentLine->getX(i), currentLine->getY(i));
 
  232   *currentLine = *newLine;
 
  246   for(std::size_t i = 0; i < lines.size(); ++i) 
 
  250     for(std::size_t j = 0; j < line->
getNPoints() - 1; ++j) 
 
  254       segment->setPoint(0, line->
getX(j), line->
getY(j));
 
  255       segment->setPoint(1, line->
getX(j + 1), line->
getY(j + 1));
 
  257       if(geometryFromEnvelope->intersects(segment.get()))
 
  277   std::vector<te::gm::LineString*> lines;
 
  280   for(std::size_t i = 0; i < lines.size(); ++i)
 
  285     for(std::size_t j = 0; j < l->
getNPoints(); ++j)
 
  297   return sqrt(((c1.
x - c2.
x) * (c1.
x - c2.
x)) + ((c1.
y - c2.
y) * (c1.
y - c2.
y)));
 
  305   std::vector<te::gm::LineString*> lines;
 
  310     for(std::size_t i = 0; i < lines.size(); ++i) 
 
  313       for(std::size_t j = 0; j < line->
getNPoints(); ++j) 
 
  349     if(SnapManager::getInstance().search(coord, srid, result) == 
false)
 
  363   static boost::uuids::basic_random_generator<boost::mt19937> gen;
 
  365   boost::uuids::uuid u = gen();
 
  366   std::string 
id = boost::uuids::to_string(u);
 
std::size_t getNumGeometries() const 
It returns the number of geometries in this GeometryCollection. 
 
int getSRID() const 
It returns the Spatial Reference System ID associated to this geometric object. 
 
SimpleData< std::string, STRING_TYPE > String
 
std::vector< Curve * > & getRings()
It returns the polygon rings. 
 
Utility functions for the data access module. 
 
virtual const double & getY() const =0
It returns the point y-coordinate value. 
 
TEEDITEXPORT void MoveVertex(std::vector< te::gm::LineString * > &lines, const VertexIndex &index, const double &x, const double &y)
 
bool intersects(const Envelope &rhs) const 
It returns true if the envelopes "spatially intersects". 
 
TEEDITEXPORT te::da::ObjectId * GenerateId()
 
TEDATAACCESSEXPORT ObjectId * GenerateOID(DataSet *dataset, const std::vector< std::string > &names)
 
An utility struct for representing 2D coordinates. 
 
void addValue(te::dt::AbstractData *data)
It adds a property value to uniquely identify a data set element. 
 
This is a singleton for managing edit repositories. 
 
This class represents a geographic feature. 
 
virtual const double & getX() const =0
It returns the point x-coordinate value. 
 
TEEDITEXPORT void GetCoordinates(te::gm::Geometry *geom, std::vector< te::gm::Coord2D > &coords)
 
bool isClosed() const 
It returns true if the curve is closed (startPoint = endPoint). 
 
const double & getY(std::size_t i) const 
It returns the n-th y coordinate value. 
 
Coord2D getCenter() const 
It returns the rectangle's center coordinate. 
 
TEEDITEXPORT void RemoveVertex(std::vector< te::gm::LineString * > &lines, const VertexIndex &index)
 
MultiPoint is a GeometryCollection whose elements are restricted to points. 
 
LineString is a curve with linear interpolation between points. 
 
A point with x and y coordinate values. 
 
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point. 
 
An Envelope defines a 2D rectangular region. 
 
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib. 
 
const double & getX(std::size_t i) const 
It returns the n-th x coordinate value. 
 
This class represents an unique id for a data set element. 
 
TEEDITEXPORT Feature * PickFeature(const te::map::AbstractLayerPtr &layer, const te::gm::Envelope &env, int srid)
 
TEEDITEXPORT double GetDistance(const te::gm::Coord2D &c1, const te::gm::Coord2D &c2)
 
std::size_t getNPoints() const 
It returns the number of points (vertexes) in the linestring. 
 
GeomType getGeomTypeId() const 
It returns the geometry subclass type identifier. 
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
This is a singleton for managing geometries snap. 
 
TEEDITEXPORT void MoveGeometry(te::gm::Geometry *geom, const double &deltax, const double &deltay)
 
TEEDITEXPORT void AddVertex(std::vector< te::gm::LineString * > &lines, const double &x, const double &y, const te::gm::Envelope &env, int srid)
 
Geometry * getGeometryN(std::size_t i) const 
It returns the n-th geometry in this GeometryCollection. 
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
TEEDITEXPORT void TrySnap(te::gm::Coord2D &coord, int srid)
 
TEEDITEXPORT void GetLines(te::gm::Geometry *geom, std::vector< te::gm::LineString * > &lines)
 
TEEDITEXPORT bool IsSpecialRingVertex(te::gm::LineString *l, const VertexIndex &index)
 
TEDATAACCESSEXPORT void GetOIDPropertyNames(const DataSetType *type, std::vector< std::string > &pnames)
 
A template for atomic data types (integers, floats, strings and others). 
 
It is a collection of other geometric objects. 
 
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one. 
 
A base abstract class for 0-dimensional geometric objects that represents a single location in coordi...
 
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope. 
 
std::size_t size() const 
It returns the number of points (vertexes) in the geometry. 
 
TEEDITEXPORT VertexIndex FindSegment(std::vector< te::gm::LineString * > &lines, const te::gm::Envelope &env, int srid)