27 #include "../../../geometry/GeometryProperty.h" 28 #include "../../../geometry/MultiPolygon.h" 29 #include "../../../dataaccess/dataset/ObjectIdSet.h" 30 #include "../../../dataaccess/utils/Utils.h" 31 #include "../../../datatype/SimpleData.h" 32 #include "../../../qt/widgets/canvas/MapDisplay.h" 33 #include "../../../qt/widgets/utils/ScopedCursor.h" 34 #include "../../../qt/widgets/Utils.h" 35 #include "../../Feature.h" 36 #include "../../RepositoryManager.h" 37 #include "../../Utils.h" 38 #include "../Renderer.h" 43 #include <QMessageBox> 44 #include <QMouseEvent> 52 m_selectionStarted(false),
53 m_keepPreviousSelection(false),
54 m_selectionByPointing(false),
64 if (e->button() != Qt::LeftButton)
86 pos += QPointF(0.0001, 0.0001);
105 if (e->button() == Qt::MiddleButton)
116 Qt::KeyboardModifiers keys = e->modifiers();
118 if (keys & Qt::ControlModifier)
161 if (!schema->hasGeom())
172 if (!schema->hasGeom())
179 assert(dataset.get());
181 std::vector<std::string> pnames;
186 while (dataset->moveNext())
188 std::unique_ptr<te::gm::Geometry> g(dataset->getGeometry(gp->
getName()));
190 if (g.get() ==
nullptr)
196 if (!g->intersects(
m_area))
219 while (dataset->moveNext())
221 std::unique_ptr<te::gm::Geometry> g(dataset->getGeometry(gp->
getName()));
223 if (g.get() ==
nullptr)
245 catch (std::exception& e)
247 QMessageBox::critical(
m_display, tr(
"Error"), QString(tr(
"The selection cannot be retrieved from the layer. Details:") +
" %1.").arg(e.what()));
260 display->fill(Qt::transparent);
269 renderer.
setPolygonStyle(QColor(255, 255, 255, 0), QColor(255, 0, 0), 1);
297 for (std::size_t i = 0; i <
m_coords.size(); ++i)
317 QPointF pixelOffset(4.0, 4.0);
319 QRectF rect(pos - pixelOffset, pos + pixelOffset);
322 QPointF ll(rect.left(), rect.bottom());
323 QPointF ur(rect.right(), rect.top());
virtual const std::string & getId() const
It returns the layer id.
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
void transform(int srid)
It converts the coordinate values of the geometry to the new spatial reference system.
TEDATAACCESSEXPORT ObjectId * GenerateOID(DataSet *dataset, const std::vector< std::string > &names)
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
virtual const std::string & getType() const =0
It returns the layer type.
virtual Visibility getVisibility() const
It returns the layer visibility.
An utility struct for representing 2D coordinates.
te::edit::OperationType getOperationTypeId() const
virtual bool isValid() const =0
It returns true if the layer can be used for instance to draw, otherwise, it returns false...
A LinearRing is a LineString that is both closed and simple.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
void setOperationTypeId(const te::edit::OperationType ¤tOperationType)
static RepositoryManager & getInstance()
It returns a reference to the singleton instance.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
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.
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.
TEEDITQTEXPORT QPointF GetPosition(QMouseEvent *e)
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)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
This is a singleton for rendering geometries and features.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
TEEDITEXPORT void TrySnap(te::gm::Coord2D &coord, int srid)
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.
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)
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
void setPolygonStyle(const QColor &fillColor, const QColor &contourColor, const std::size_t &contourWidth)
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.
bool isValid() const
It tells if the rectangle is valid or not.
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.
const std::string & getName() const
It returns the property name.