30 #include "../../../common/STLUtils.h"
31 #include "../../../dataaccess/dataset/DataSet.h"
32 #include "../../../dataaccess/utils/Utils.h"
33 #include "../../../geometry.h"
34 #include "../../../maptools/DataSetLayer.h"
35 #include "../../../maptools/RasterTransform.h"
36 #include "../../../maptools/RasterTransformConfigurer.h"
37 #include "../../../maptools/Utils.h"
38 #include "../../../qt/widgets/canvas/Canvas.h"
39 #include "../../../qt/widgets/canvas/MapDisplay.h"
40 #include "../../../raster/Raster.h"
41 #include "../../../raster/RasterSummary.h"
42 #include "../../../raster/RasterSummaryManager.h"
43 #include "../../../raster/Utils.h"
44 #include "../../../se.h"
48 #include <QtGui/QMouseEvent>
49 #include <QtGui/QToolTip>
67 if(e->button() != Qt::LeftButton)
71 QPointF qpoint = m_display->transform(e->posF());
83 std::size_t nRules = cs->
getRules().size();
89 const std::vector<te::se::Symbolizer*>& symbolizers = rule->
getSymbolizers();
90 assert(!symbolizers.empty());
97 std::auto_ptr<te::da::DataSet> ds = m_layer->getData();
114 const std::complex<double>* cmin = rsMin->at(0).m_minVal;
115 const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
126 te::gm::Coord2D coord = inputRst->getGrid()->geoToGrid(qpoint.x(), qpoint.y());
131 if((x >=0 && x < (
int)inputRst->getNumberOfColumns()) && (y >=0 && y < (
int)inputRst->getNumberOfRows()))
133 QString information(
"<h2>Read Pixel</h2><ul>");
135 information +=
"<h3>Location</h3>";
137 QString column, line, xCoord, yCoord;
140 xCoord.setNum(qpoint.x());
141 yCoord.setNum(qpoint.y());
143 information +=
"<li><b>" + QString(
"Line ") +
":</b> " + line +
"</li>";
144 information +=
"<li><b>" + QString(
"Column ") +
":</b> " + column +
"</li>";
145 information +=
"<li><b>" + QString(
"Coord X ") +
":</b> " + xCoord +
"</li>";
146 information +=
"<li><b>" + QString(
"Coord Y ") +
":</b> " + yCoord +
"</li>";
148 information +=
"<h3>Original Values</h3>";
150 for(
size_t t = 0; t < inputRst->getNumberOfBands(); ++t )
153 inputRst->getValue(x, y, val, t);
159 information +=
"<li><b>" + QString(
"Value for band ") + band +
":</b> " + value +
"</li>";
165 information +=
"<h3>Transformed Values</h3>";
167 QString red, green, blue, alpha;
168 red.setNum(color.
getRed());
173 QString rBand, gBand, bBand;
178 information +=
"<li><b>" + QString(
"Red Channel: </b>") + rBand +
"<b> - Value:</b> " + red +
"</li>";
179 information +=
"<li><b>" + QString(
"Green Channel: </b>") + gBand +
"<b> - Value:</b> " + green +
"</li>";
180 information +=
"<li><b>" + QString(
"Blue Channel: </b>") + bBand +
"<b> - Value:</b> " + blue +
"</li>";
181 information +=
"<li><b>" + QString(
"Alpha Channel value") +
":</b> " + alpha +
"</li>";
184 information +=
"<h3>Symbolizer</h3>";
190 type =
"RGB Composition";
194 type =
"Gray Composition";
198 type =
"Unknown Composition";
201 information +=
"<li><b>" + QString(
"Color Composition ") +
":</b> " + type +
"</li>";
206 information +=
"<li><b>" + QString(
"Opacity Value ") +
":</b> " + opacity +
"</li>";
212 information +=
"<li><b>" + QString(
"Gain Value ") +
":</b> " + gain +
"</li>";
218 information +=
"<li><b>" + QString(
"Offset Value ") +
":</b> " + offset +
"</li>";
221 if(rs->getChannelSelection()->getRedChannel() &&
222 rs->getChannelSelection()->getRedChannel()->getContrastEnhancement())
225 c.setNum(rs->getChannelSelection()->getRedChannel()->getContrastEnhancement()->getGammaValue());
227 information +=
"<li><b>" + QString(
"Red Contrast") +
":</b> " + c +
"</li>";
230 if(rs->getChannelSelection()->getGreenChannel() &&
231 rs->getChannelSelection()->getGreenChannel()->getContrastEnhancement())
234 c.setNum(rs->getChannelSelection()->getGreenChannel()->getContrastEnhancement()->getGammaValue());
236 information +=
"<li><b>" + QString(
"Green Contraste") +
":</b> " + c +
"</li>";
239 if(rs->getChannelSelection()->getBlueChannel() &&
240 rs->getChannelSelection()->getBlueChannel()->getContrastEnhancement())
243 c.setNum(rs->getChannelSelection()->getBlueChannel()->getContrastEnhancement()->getGammaValue());
245 information +=
"<li><b>" + QString(
"Blue Contraste") +
":</b> " + c +
"</li>";
248 if(rs->getChannelSelection()->getGrayChannel() &&
249 rs->getChannelSelection()->getGrayChannel()->getContrastEnhancement())
252 c.setNum(rs->getChannelSelection()->getGrayChannel()->getContrastEnhancement()->getGammaValue());
254 information +=
"<li><b>" + QString(
"Gray Contraste") +
":</b> " + c +
"</li>";
257 information +=
"</ul>";
260 QToolTip::showText(QCursor::pos(), information, m_display, m_display->rect());
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
const std::vector< Rule * > & getRules() const
A layer with reference to a dataset.
Rule * getRule(std::size_t i) const
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
An example of MapDisplay Tool. The only purpose of this tool is to show how you can implement a new t...
This class defines an interface for objects that can receive application events and respond to them...
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
const std::vector< Symbolizer * > & getSymbolizers() const
int getGreen() const
It returns the green component color value (a value from 0 to 255).
An utility struct for representing 2D coordinates.
bool mouseReleaseEvent(QMouseEvent *e)
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
te::map::AbstractLayerPtr m_layer
A Raster Transform configurer generates a Raster Transform given a RasterSymbolzier.
ReadPixelTool(te::qt::widgets::MapDisplay *display, te::map::AbstractLayerPtr layer, QObject *parent=0)
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
void setLinearTransfParameters(double vmin, double vmax, double rmin, double rmax)
Set parameters of linear transformation.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
void configure()
Configure Transformation.
TEMAPEXPORT std::string GetString(const te::se::ParameterValue *param)
Gets the parameter value as string.
virtual te::se::Style * getStyle() const
It returns the Style associated to the layer.
A widget to control the display of a set of layers.
std::map< RGBChannels, short > & getRGBMap()
A Raster Transform is a class that defines functions to transform a styled raster.
An abstract class for raster data strucutures.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void apply(double icol, double ilin, double ocol, double olin)
static RasterSummaryManager & getInstance()
It returns a reference to the singleton instance.
int getBlue() const
It returns the blue component color value (a value from 0 to 255).
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
int getRed() const
It returns the red component color value (a value from 0 to 255).