27 #include "../../../common/STLUtils.h" 28 #include "../../../geometry/Envelope.h" 29 #include "../../../geometry/MultiPolygon.h" 30 #include "../../../geometry/Point.h" 31 #include "../../../geometry/Utils.h" 32 #include "../../../qt/widgets/canvas/MapDisplay.h" 33 #include "../../../qt/widgets/Utils.h" 34 #include "../../../dataaccess/utils/Utils.h" 35 #include "../../Feature.h" 36 #include "../../RepositoryManager.h" 37 #include "../../Utils.h" 38 #include "../Renderer.h" 40 #include "../core/command/AddCommand.h" 41 #include "../core/UndoStackManager.h" 45 #include <QMessageBox> 46 #include <QMouseEvent> 49 #include <QInputDialog> 68 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
95 while (
ds->moveNext())
96 m_gc->
add(dynamic_cast<te::gm::Geometry*>(
ds->getGeometry(geomProp->getName()).release()));
102 QMessageBox::critical(
m_display, tr(
"Error"), QString(tr(
"All geometries selected must touch!")));
106 getBaseOID(*objSet, tr(
"Allow to merge geometries selecting the geom_id that will keep the attributes."));
114 QMessageBox::warning(
m_display, tr(
"Merge Geometries"), tr(
"Invalid bounding box."));
121 QMessageBox::information(
m_display, tr(
"Merge Geometries"), tr(
"Pick Feature Failed."));
129 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
149 catch (std::exception& e)
151 QMessageBox::critical(
m_display, tr(
"Merge Geometries"), QString(tr(
"Could not merge.") +
" %1.").arg(e.what()));
192 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
194 for (it = objSet.
begin(); it != objSet.
end(); ++it)
195 qValues.append((*it)->getValueAsString().c_str());
197 QString qValue = QInputDialog::getItem(
m_display, QString(tr(
"Merge Geometries")), QObject::tr(msg.toUtf8().data()), qValues, 0,
false, &ok);
199 if (qValue.isEmpty() || !ok)
202 for (it = objSet.
begin(); it != objSet.
end(); ++it)
204 if ((*it)->getValueAsString() == qValue.toUtf8().data())
213 std::size_t pType = 0;
215 std::vector<std::string> oidPropertyNames;
228 ds->moveBeforeFirst();
229 while (ds->moveNext())
234 convOid = boost::lexical_cast<std::string>(ds->getInt16(oidPropertyNames[0]));
238 convOid = boost::lexical_cast<std::string>(ds->getInt32(oidPropertyNames[0]));
242 convOid = boost::lexical_cast<std::string>(ds->getInt64(oidPropertyNames[0]));
246 convOid = boost::lexical_cast<std::string>(ds->getFloat(oidPropertyNames[0]));
250 convOid = boost::lexical_cast<std::string>(ds->getDouble(oidPropertyNames[0]));
254 convOid = boost::lexical_cast<std::string>(ds->getNumeric(oidPropertyNames[0]));
258 convOid = ds->getString(oidPropertyNames[0]);
263 env = *((ds->getGeometry(geomProp->getName()))->getMBR());
283 draft->fill(Qt::transparent);
302 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
335 catch (std::exception& e)
337 QMessageBox::critical(
m_display, tr(
"Error"), QString(tr(
"The geometry cannot be selected from the layer. Details:") +
" %1.").arg(e.what()));
343 QPointF pixelOffset(4.0, 4.0);
345 QRectF rect(pos - pixelOffset, pos + pixelOffset);
348 QPointF ll(rect.left(), rect.bottom());
349 QPointF ur(rect.right(), rect.top());
std::size_t getNumGeometries() const
It returns the number of geometries in this GeometryCollection.
virtual const std::string & getId() const
It returns the layer id.
void setId(te::da::ObjectId *id)
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
virtual bool disjoint(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns true if the geometry object is spatially disjoint from rhs geometry.
te::gm::Geometry * getGeometry() const
static te::dt::Date ds(2010, 01, 01)
void removeGeometryN(std::size_t i)
It removes the n-th geometry in this geometry collection.
virtual Geometry * Union(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns a geometric object that represents the point set union with another geometry.
te::gm::GeometryCollection * gc
void setOperationTypeId(const te::edit::OperationType ¤tOperationType)
static RepositoryManager & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
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...
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
virtual std::unique_ptr< LayerSchema > getSchema() const =0
It returns the layer schema.
TEEDITEXPORT Feature * PickFeature(const te::map::AbstractLayerPtr &layer, const te::gm::Envelope &env, int srid)
static te::dt::TimeDuration dt(20, 30, 50, 11)
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
void draw(te::gm::Geometry *geom, bool showVertexes=false)
virtual AbstractData * clone() const =0
It returns a clone of this object.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
This is a singleton for rendering geometries and features.
Geometry * getGeometryN(std::size_t i) const
It returns the n-th geometry in this GeometryCollection.
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 add(Geometry *g)
It adds the geometry into the collection.
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.
void setGeometry(te::gm::Geometry *geom)
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.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const
Returns an iterator for the object ids in container.
TEGEOMEXPORT te::gm::Geometry * Validate(te::gm::Geometry *geom)
Get/create a valid version of the geometry given. If the geometry is a polygon or multi polygon...
bool isValid() const
It tells if the rectangle is valid or not.