4 #include "../../../../geometry/Envelope.h" 5 #include "../../../widgets/canvas/MapDisplay.h" 6 #include "../../../../common/STLUtils.h" 7 #include "../../../../dataaccess/dataset/DataSet.h" 8 #include "../../../../dataaccess/dataset/DataSetType.h" 9 #include "../../../../dataaccess/utils/Utils.h" 10 #include "../../../../geometry/Coord2D.h" 11 #include "../../../../geometry/Envelope.h" 12 #include "../../../../geometry/Geometry.h" 13 #include "../../../../geometry/GeometryProperty.h" 14 #include "../../../../geometry/Point.h" 15 #include "../../../..//geometry/Utils.h" 16 #include "../../../../maptools/MarkRendererManager.h" 17 #include "../../../../raster/Raster.h" 18 #include "../../../../raster/RasterProperty.h" 19 #include "../../../../raster/Utils.h" 20 #include "../../../../se/Fill.h" 21 #include "../../../../se/Stroke.h" 22 #include "../../../../se/Mark.h" 23 #include "../../../../se/Utils.h" 24 #include "../../../../srs/Config.h" 25 #include "../../canvas/Canvas.h" 26 #include "../../canvas/MapDisplay.h" 27 #include "../../Utils.h" 30 #include <QtCore/QPointF> 31 #include <QtCore/QString> 32 #include <QtCore/QStringList> 33 #include <QMessageBox> 34 #include <QMouseEvent> 51 bool needRemap =
false;
56 (layer->getSRID() != display->
getSRID()))
62 if(!reprojectedEnvelope.
intersects(layer->getExtent()))
68 std::unique_ptr<const te::map::LayerSchema> ls(layer->getSchema());
71 std::string spatialPropertyName = layer->getGeomPropertyName();
77 if(spatialPropertyName.empty())
81 ls->getProperty(spatialPropertyName));
86 std::unique_ptr<te::da::DataSet> dataset(
87 layer->getData(gp->
getName(), &reprojectedEnvelope,
90 getGeometryInfo(layerItem, display, dataset.get(), layer->getGeomPropertyName(),
91 reprojectedEnvelope, layer->getSRID(), needRemap);
98 if(spatialPropertyName.empty())
102 ls->getProperty(spatialPropertyName));
107 std::unique_ptr<te::da::DataSet> dataset(
108 layer->getData(rp->
getName(), &reprojectedEnvelope,
111 if(!dataset->moveNext())
114 std::unique_ptr<te::rst::Raster> raster(dataset->getRaster(rp->
getName()));
115 assert(raster.get());
117 getRasterInfo(layerItem, display, raster.get(), reprojectedEnvelope,
118 layer->getSRID(), needRemap);
131 const std::string& geomPropertyName,
137 std::unique_ptr<te::gm::Geometry> geometryFromEnvelope(
144 std::size_t gpos = std::string::npos;
145 geomPropertyName.empty()
151 std::unique_ptr<te::gm::Geometry> g(dataset->
getGeometry(gpos));
153 if(g.get() ==
nullptr)
160 QString message = QObject::tr(
"Invalid geometry: ") + err.
m_message.c_str();
161 QMessageBox::warning(display, QObject::tr(
"Information"), message);
167 if(g->contains(&point) || g->crosses(geometryFromEnvelope.get()) ||
168 geometryFromEnvelope->contains(g.get()))
180 propertyItem->setIcon(0, QIcon::fromTheme(
"geometry"));
188 std::string value = dataset->
getString(i);
189 qvalue = QString::fromUtf8(value.c_str());
201 propertyItem->setText(1, qvalue);
204 propertyItem->setText(1,
"");
210 g->transform(display->
getSRID());
237 lineItem->setText(0, QObject::tr(
"Line"));
238 lineItem->setText(1, QString::number(y));
241 columnItem->setText(0, QObject::tr(
"Column"));
242 columnItem->setText(1, QString::number(x));
245 coordXItem->setText(0, QObject::tr(
"Coordinate X"));
246 coordXItem->setText(1, QString::number(center.
x));
249 coordYItem->setText(0, QObject::tr(
"Coordinate Y"));
250 coordYItem->setText(1, QString::number(center.
y));
259 bandValueItem->setIcon(0, QIcon::fromTheme(
"channel-gray"));
260 bandValueItem->setText(0, QObject::tr(
"Band") +
" " + QString::number(
b));
261 bandValueItem->setText(1, QString::number(value));
315 std::size_t size = 24;
324 canvas.
setPointPattern(rgba, static_cast<int>(size), static_cast<int>(size));
virtual std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
A Mark specifies a geometric shape and applies coloring to it.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
GeomType getGeomTypeId() const _NOEXCEPT_OP(true)
It returns the geometry subclass type identifier.
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
double m_urx
Upper right corner x-coordinate.
An utility struct for representing 2D coordinates.
DefaultFeatureInfoMaker is a default implementation of AbstractFeatureInfoMaker that could be used to...
void geoToGrid(const double &x, const double &y, double &col, double &row) const
Get the grid point associated to a spatial location.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
Coord2D getCenter() const
It returns the rectangle's center coordinate.
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers.
double m_llx
Lower left corner x-coordinate.
static MarkRendererManager & getInstance()
It returns a reference to the singleton instance.
A point with x and y coordinate values.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
virtual std::string getAsString(std::size_t i, int precision=0) const
Method for retrieving a data value as a string plain representation.
A Fill specifies the pattern for filling an area geometry.
Grid * getGrid()
It returns the raster grid.
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
double m_lly
Lower left corner y-coordinate.
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke.
A dataset is the unit of information manipulated by the data access module of TerraLib.
double m_ury
Upper right corner y-coordinate.
A Stroke specifies the appearance of a linear geometry.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
TEGEOMEXPORT bool CheckValidity(const Geometry *geom, te::gm::TopologyValidationError &error)
It check geometry validity using GEOS.
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
This struct contains informations about GEOS TopologyValidationError.
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.
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.
const std::string & getName() const
It returns the property name.