27 #include "../../../common/STLUtils.h"
28 #include "../../../dataaccess/dataset/DataSet.h"
29 #include "../../../dataaccess/dataset/DataSetType.h"
30 #include "../../../dataaccess/utils/Utils.h"
31 #include "../../../geometry/Coord2D.h"
32 #include "../../../geometry/Envelope.h"
33 #include "../../../geometry/Geometry.h"
34 #include "../../../geometry/GeometryProperty.h"
35 #include "../../../geometry/Point.h"
36 #include "../../../geometry/Utils.h"
37 #include "../../../maptools/MarkRendererManager.h"
38 #include "../../../raster/Raster.h"
39 #include "../../../raster/RasterProperty.h"
40 #include "../../../raster/Utils.h"
41 #include "../../../se/Fill.h"
42 #include "../../../se/Stroke.h"
43 #include "../../../se/Mark.h"
44 #include "../../../se/Utils.h"
45 #include "../../../srs/Config.h"
46 #include "../canvas/Canvas.h"
47 #include "../canvas/MapDisplay.h"
52 #include <QtCore/QPointF>
53 #include <QtCore/QString>
54 #include <QtCore/QStringList>
55 #include <QMessageBox>
56 #include <QMouseEvent>
65 m_infoWidget(new QTreeWidget(display))
77 labels << tr(
"Property") << tr(
"Value");
83 QPixmap* draft = m_display->getDraftPixmap();
84 draft->fill(Qt::transparent);
86 m_infoWidget->close();
93 if(e->button() != Qt::LeftButton)
99 QPointF pixelOffset(4.0, 4.0);
100 #if (QT_VERSION >= 0x050000)
101 QRectF rect = QRectF(e->localPos() - pixelOffset, e->localPos() + pixelOffset);
103 QRectF rect = QRectF(e->posF() - pixelOffset, e->posF() + pixelOffset);
107 QPointF ll(rect.left(), rect.bottom());
108 QPointF ur(rect.right(), rect.top());
109 ll = m_display->transform(ll);
110 ur = m_display->transform(ur);
116 QPixmap* draft = m_display->getDraftPixmap();
117 draft->fill(Qt::transparent);
120 m_infoWidget->clear();
123 std::list<te::map::AbstractLayerPtr>::const_iterator it;
124 for(it = m_layers.begin(); it != m_layers.end(); ++it)
125 getInfo(*it, envelope);
127 if(m_infoWidget->topLevelItemCount() > 0)
129 m_infoWidget->expandAll();
130 m_infoWidget->resizeColumnToContents(0);
131 m_infoWidget->show();
134 m_infoWidget->hide();
136 m_display->repaint();
151 bool needRemap =
false;
156 (layer->getSRID() != m_display->getSRID()))
159 reprojectedEnvelope.
transform(m_display->getSRID(), layer->getSRID());
162 if(!reprojectedEnvelope.
within(layer->getExtent()))
166 QTreeWidgetItem* layerItem =
new QTreeWidgetItem;
167 layerItem->setIcon(0, QIcon::fromTheme(
"layer"));
168 layerItem->setText(0, tr(
"Layer"));
169 layerItem->setText(1, layer->getTitle().c_str());
174 std::auto_ptr<const te::map::LayerSchema> ls(layer->getSchema());
177 std::string spatialPropertyName = layer->getGeomPropertyName();
183 if(spatialPropertyName.empty())
191 std::auto_ptr<te::da::DataSet> dataset(layer->getData(gp->
getName(), &reprojectedEnvelope,
te::gm::INTERSECTS).release());
193 getGeometryInfo(layerItem, dataset.get(), layer->getGeomPropertyName(), reprojectedEnvelope, layer->getSRID(), needRemap);
200 if(spatialPropertyName.empty())
208 std::auto_ptr<te::da::DataSet> dataset(layer->getData(rp->
getName(), &reprojectedEnvelope,
te::gm::INTERSECTS).release());
210 if(!dataset->moveNext())
213 std::auto_ptr<te::rst::Raster> raster(dataset->getRaster(rp->
getName()));
214 assert(raster.get());
216 getRasterInfo(layerItem, raster.get(), reprojectedEnvelope, layer->getSRID(), needRemap);
219 layerItem->childCount() != 0 ? m_infoWidget->addTopLevelItem(layerItem) :
delete layerItem;
237 std::size_t gpos = std::string::npos;
242 std::auto_ptr<te::gm::Geometry> g(dataset->
getGeometry(gpos));
245 if(g->contains(&point) || g->crosses(geometryFromEnvelope.get()) || geometryFromEnvelope->contains(g.get()))
253 QTreeWidgetItem* propertyItem =
new QTreeWidgetItem(layerItem);
257 propertyItem->setIcon(0, QIcon::fromTheme(
"geometry"));
265 std::string value = dataset->
getString(i);
272 propertyItem->setText(1, qvalue);
275 propertyItem->setText(1,
"");
281 g->transform(m_display->getSRID());
284 drawGeometry(g.get());
304 QTreeWidgetItem* lineItem =
new QTreeWidgetItem(layerItem);
305 lineItem->setText(0, tr(
"Line"));
306 lineItem->setText(1, QString::number(y));
308 QTreeWidgetItem* columnItem =
new QTreeWidgetItem(layerItem);
309 columnItem->setText(0, tr(
"Column"));
310 columnItem->setText(1, QString::number(x));
312 QTreeWidgetItem* coordXItem =
new QTreeWidgetItem(layerItem);
313 coordXItem->setText(0, tr(
"Coordinate X"));
314 coordXItem->setText(1, QString::number(center.
x));
316 QTreeWidgetItem* coordYItem =
new QTreeWidgetItem(layerItem);
317 coordYItem->setText(0, tr(
"Coordinate Y"));
318 coordYItem->setText(1, QString::number(center.
y));
326 QTreeWidgetItem* bandValueItem =
new QTreeWidgetItem(layerItem);
327 bandValueItem->setIcon(0, QIcon::fromTheme(
"channel-gray"));
328 bandValueItem->setText(0, tr(
"Band") +
" " + QString::number(b));
329 bandValueItem->setText(1, QString::number(value));
335 QPixmap* draft = m_display->getDraftPixmap();
383 std::size_t size = 24;
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
CharEncoding
Supported charsets (character encoding).
A Mark specifies a geometric shape and applies coloring to it.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
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.
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.
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
bool within(const Envelope &rhs) const
It returns true if this envelope is "spatially within" the rhs envelope.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
An abstract class for raster data strucutures.
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
virtual te::common::CharEncoding getPropertyCharEncoding(std::size_t i) const =0
It returns the property character encoding at position pos.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
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.
GeomType getGeomTypeId() const
It returns the geometry subclass type identifier.
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
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 std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
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.
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
A Stroke specifies the appearance of a linear geometry.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
This class implements a concrete tool to get informations about a specified feature using pointing op...
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
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.
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.