27 #include "../../../common/STLUtils.h" 28 #include "../../../geometry/Envelope.h" 29 #include "../../../dataaccess/utils/Utils.h" 30 #include "../../../qt/widgets/canvas/MapDisplay.h" 31 #include "../../../qt/widgets/Utils.h" 32 #include "../../Feature.h" 33 #include "../../Repository.h" 34 #include "../../RepositoryManager.h" 35 #include "../../Utils.h" 36 #include "../Renderer.h" 41 #include <QMessageBox> 42 #include <QMouseEvent> 76 if (e->button() != Qt::LeftButton)
97 if (Qt::LeftButton != e->button())
107 if (Qt::RightButton != e->button())
149 std::vector<te::gm::Polygon*> outPolygons;
154 std::unique_ptr<te::gm::Geometry> geom_bounds;
155 geom_bounds.reset(
m_vecFeatures.at(index)->getGeometry()->getBoundary());
156 geom_bounds->setSRID(srid);
158 std::unique_ptr<te::gm::Geometry> blade_in;
160 blade_in->setSRID(srid);
162 std::unique_ptr<te::gm::Geometry> vgeoms;
163 vgeoms.reset(geom_bounds->Union(blade_in.get()));
164 vgeoms->setSRID(srid);
169 while (i < outPolygons.size())
171 if (!outPolygons.at(i)->equals(
m_vecFeatures.at(index)->getGeometry()) &&
199 catch (std::exception& e)
202 QMessageBox::critical(
m_display, tr(
"Error"), QString(tr(
"Could not split.") +
" %1.").arg(e.what()));
215 draft->fill(Qt::transparent);
235 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
250 std::map<std::size_t, te::dt::AbstractData*> mapFields;
258 tr(
"To use this tool, you must select at least one geometry."));
265 std::vector<std::string> oidPropertyNames;
270 ds->moveBeforeFirst();
271 while (ds->moveNext())
273 std::unique_ptr<te::gm::Geometry> g(ds->getGeometry(gpos));
276 for (std::size_t i = 0; i < ds->getNumProperties(); ++i)
281 std::unique_ptr<te::dt::AbstractData> data(ds->getValue(pos));
282 mapFields[pos] = data.release();
286 f->setData(mapFields);
287 f->setOperationTypeId(
UPDATE);
297 catch (std::exception& e)
299 QMessageBox::critical(
m_display, tr(
"Error"), QString(tr(
"The geometry cannot be selected from the layer. Details:") +
" %1.").arg(e.what()));
virtual const std::string & getId() const
It returns the layer id.
TEEDITEXPORT te::da::ObjectId * GenerateId()
TEDATAACCESSEXPORT ObjectId * GenerateOID(DataSet *dataset, const std::vector< std::string > &names)
te::da::ObjectId * getId() const
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
static te::dt::Date ds(2010, 01, 01)
bool hasIdentifier(te::da::ObjectId *id)
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
void setOperationTypeId(const te::edit::OperationType ¤tOperationType)
static RepositoryManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
void remove(te::da::ObjectId *id)
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
std::size_t size() const
It returns the object id set size.
virtual std::unique_ptr< LayerSchema > getSchema() const =0
It returns the layer schema.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
virtual void clearSelected()
It clears the selected group of this Layer.
void setData(const std::map< std::size_t, te::dt::AbstractData * > &data)
TEGEOMEXPORT void Polygonizer(te::gm::Geometry *g, std::vector< te::gm::Polygon * > &pols)
It will get a list of polygons formed by the polygonization.
This is a singleton for rendering geometries and features.
virtual const te::da::ObjectIdSet * getSelected() const
It returns the selected group of this Layer.
virtual std::unique_ptr< te::da::DataSet > getData(te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const =0
It gets the dataset identified by the layer name.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator end() const
Returns an iterator for the object ids in container.
void begin(QPaintDevice *device, const te::gm::Envelope &e, int srid)
void drawRepository(const std::string &source, const te::gm::Envelope &e, int srid)
TEDATAACCESSEXPORT void GetOIDPropertyNames(const DataSetType *type, std::vector< std::string > &pnames)
void add(ObjectId *oid)
It adds an object id to this object id set.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
This class represents a repository of geometries and features.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const
Returns an iterator for the object ids in container.
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...
bool isValid() const
It tells if the rectangle is valid or not.