27 #include "../../../color/RGBAColor.h"
28 #include "../../../dataaccess/dataset/DataSet.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../geometry/Coord2D.h"
31 #include "../../../geometry/Geometry.h"
32 #include "../../../geometry/Point.h"
33 #include "../../../geometry/Utils.h"
34 #include "../../../maptools/Utils.h"
35 #include "../../../raster/Grid.h"
36 #include "../../../raster/Raster.h"
37 #include "../../../se/CoverageStyle.h"
38 #include "../../../se/ChannelSelection.h"
39 #include "../../../se/RasterSymbolizer.h"
40 #include "../../../se/Rule.h"
41 #include "../../../se/SelectedChannel.h"
42 #include "../../../se/Utils.h"
43 #include "../../widgets/tools/AbstractTool.h"
44 #include "../../widgets/tools/CoordTracking.h"
45 #include "../../widgets/tools/Pan.h"
46 #include "../../widgets/tools/PolygonAcquire.h"
47 #include "../../widgets/tools/PointPicker.h"
48 #include "../../widgets/tools/ReadPixelTool.h"
49 #include "../../widgets/tools/ZoomArea.h"
50 #include "../../widgets/tools/ZoomClick.h"
51 #include "../../widgets/tools/ZoomWheel.h"
52 #include "../canvas/Canvas.h"
53 #include "../canvas/EyeBirdMapDisplayWidget.h"
54 #include "../canvas/MultiThreadMapDisplay.h"
55 #include "../canvas/ZoomInMapDisplayWidget.h"
57 #include "ui_RasterNavigatorWidgetForm.h"
65 m_ui(new Ui::RasterNavigatorWidgetForm),
67 m_tool(0), m_panTool(0), m_zoomTool(0)
72 QGridLayout* displayLayout =
new QGridLayout(
m_ui->m_frame);
76 displayLayout->setContentsMargins(0,0,0,0);
78 QGridLayout* eyeBirdDisplayLayout =
new QGridLayout(
m_ui->m_eyeBirdFrame);
81 eyeBirdDisplayLayout->setContentsMargins(0,0,0,0);
83 QGridLayout* zoomInDisplayLayout =
new QGridLayout(
m_ui->m_zoomInFrame);
86 zoomInDisplayLayout->setContentsMargins(0,0,0,0);
95 connect(
m_ui->m_zoomInActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onZoomAreaToggled(
bool)));
96 connect(
m_ui->m_zoomOutActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onZoomOutToggled(
bool)));
97 connect(
m_ui->m_panActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onPanToggled(
bool)));
99 connect(
m_ui->m_geomActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onGeomToggled(
bool)));
118 m_ui->m_previewToolButton->setIcon(QIcon::fromTheme(
"check"));
119 m_ui->m_zoomInActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"zoom-area"));
120 m_ui->m_zoomOutActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"zoom-out"));
121 m_ui->m_panActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"pan"));
122 m_ui->m_recomposeActionToolButton->setIcon(QIcon::fromTheme(
"zoom-extent"));
123 m_ui->m_pointActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"placemark"));
124 m_ui->m_geomActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"edit-polygon"));
125 m_ui->m_readPixelActionToolButton->setIcon(QIcon::fromTheme(
"color-picker"));
126 m_ui->m_extraDisplaysToolButton->setIcon(QIcon::fromTheme(
"view-map-display-extra"));
127 m_ui->m_monoLabel->setPixmap(QIcon::fromTheme(
"bullet-black").pixmap(16,16));
128 m_ui->m_redLabel->setPixmap(QIcon::fromTheme(
"bullet-red").pixmap(16,16));
129 m_ui->m_greenLabel->setPixmap(QIcon::fromTheme(
"bullet-green").pixmap(16,16));
130 m_ui->m_blueLabel->setPixmap(QIcon::fromTheme(
"bullet-blue").pixmap(16,16));
131 m_ui->m_monoToolButton->setIcon(QIcon::fromTheme(
"channel-gray"));
132 m_ui->m_compositionToolButton->setIcon(QIcon::fromTheme(
"channels"));
133 m_ui->m_redToolButton->setIcon(QIcon::fromTheme(
"channel-red"));
134 m_ui->m_greenToolButton->setIcon(QIcon::fromTheme(
"channel-green"));
135 m_ui->m_blueToolButton->setIcon(QIcon::fromTheme(
"channel-blue"));
137 m_ui->m_previewToolButton->setVisible(
false);
145 m_layer->setVisibility(m_visibility);
156 m_visibility = m_layer->getVisibility();
160 std::list<te::map::AbstractLayerPtr> list;
161 list.push_back(m_layer);
165 m_mapDisplay->setMouseTracking(
true);
166 m_mapDisplay->setLayerList(list);
167 m_mapDisplay->setSRID(m_layer->getSRID(),
false);
170 m_mapDisplay->setExtent(e,
false);
174 std::auto_ptr<te::da::DataSet> ds(m_layer->getData());
176 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
179 int w = m_mapDisplay->getWidth();
180 int h = m_mapDisplay->getHeight();
181 double resX = inputRst->getResolutionX();
182 double resY = inputRst->getResolutionY();
183 te::gm::Coord2D cc(inputRst->getExtent()->getCenter().x, inputRst->getExtent()->getCenter().y);
184 te::gm::Coord2D bowerLeftWorld(cc.x - (resX * ( w / 2 )), cc.y - (resY * ( h / 2 )));
185 te::gm::Coord2D bowerUpperWorld(cc.x + (resX * ( w / 2 )), cc.y + (resY * ( h / 2 )));
187 te::gm::Envelope env(bowerLeftWorld.x, bowerLeftWorld.y, bowerUpperWorld.
x, bowerUpperWorld.
y);
189 m_mapDisplay->setExtent(env,
false);
192 m_zoomInMapDisplay->setList(list, m_layer->getSRID());
193 m_eyeBirdMapDisplay->setList(list, m_layer->getSRID());
199 getCompositionInfo();
204 return m_mapDisplay->getExtent();
216 reprojectedBBOX.
transform(m_mapDisplay->getSRID(), m_layer->getSRID());
220 std::auto_ptr<te::da::DataSet> ds(m_layer->getData());
222 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
231 int w = (int)endGrid.
x - (
int)startGrid.
x;
232 int h = (int)startGrid.
y - (
int)endGrid.
y;
234 raster =
te::map::GetExtentRaster(inputRst.get(), w, h, reprojectedBBOX, m_mapDisplay->getSRID(), ibbox, m_layer->getSRID());
238 raster =
te::map::GetExtentRaster(inputRst.get(), m_mapDisplay->getWidth(), m_mapDisplay->getHeight(), reprojectedBBOX, m_mapDisplay->getSRID(), ibbox, m_layer->getSRID());
249 QPixmap* draft = m_mapDisplay->getDraftPixmap();
250 draft->fill(Qt::transparent);
253 Canvas canvas(m_mapDisplay->width(), m_mapDisplay->height());
257 bool hasToDelete =
false;
274 m_mapDisplay->repaint();
282 m_ui->m_toolsFrame->setVisible(!asPreview);
283 m_ui->m_label->setVisible(!asPreview);
284 m_ui->m_previewToolButton->setVisible(asPreview);
286 hideExtraDisplaysTool(asPreview);
293 m_mapDisplay->installEventFilter(m_panTool);
294 m_mapDisplay->installEventFilter(m_zoomTool);
300 m_ui->m_ccFrame->setVisible(!hide);
305 m_ui->m_toolLine->setVisible(!hide);
306 hidePickerTool(hide);
313 m_ui->m_pointActionToolButtontoolButton->setVisible(!hide);
318 m_ui->m_geomActionToolButtontoolButton->setVisible(!hide);
323 m_ui->m_readPixelActionToolButton->setVisible(!hide);
328 m_ui->m_extraDisplaysToolButton->setChecked(
false);
330 m_ui->m_extraLine->setVisible(!hide);
331 m_ui->m_extraDisplaysToolButton->setVisible(!hide);
336 assert(m_layer.get());
338 if(m_ui->m_extraDisplaysToolButton->isChecked())
341 m_zoomInMapDisplay->drawCursorPosition((
double) coordinate.rx(), (double)coordinate.ry());
347 m_mapDisplay->getDraftPixmap()->fill(QColor(0, 0, 0, 0));
356 canvasInstance.draw(geom);
359 m_mapDisplay->repaint();
363 std::auto_ptr<te::da::DataSet> ds = m_layer->getData();
368 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
373 te::gm::Coord2D pixelLocation = inputRst->getGrid()->geoToGrid((
double) coordinate.rx(), (double)coordinate.ry());
374 m_currentColumn = pixelLocation.
x;
375 m_currentRow = pixelLocation.
y;
378 xStr.append(QString::number(coordinate.rx()));
380 yStr.append(QString::number(coordinate.ry()));
381 QString cStr(tr(
"Column: "));
382 cStr.append(QString::number(m_currentColumn));
383 QString lStr(tr(
"Line: "));
384 lStr.append(QString::number(m_currentRow));
394 m_ui->m_label->setText(label);
402 geomAquired(poly, m_mapDisplay);
408 emit pointPicked(point.x(), point.y(), m_mapDisplay);
417 emit mapDisplayExtentChanged();
426 setCurrentTool(zoomArea);
435 setCurrentTool(zoomOut);
455 connect(pp, SIGNAL(pointPicked(QPointF&)),
this, SLOT(onPointPicked(QPointF&)));
480 m_ui->m_extraDisplaysFrame->setVisible(checked);
481 m_eyeBirdMapDisplay->setEnabled(checked);
482 m_zoomInMapDisplay->setEnabled(checked);
489 m_mapDisplay->setExtent(env);
496 std::string name = m_ui->m_redComboBox->itemText(index).toStdString();
498 m_symbolizer->getChannelSelection()->getRedChannel()->setSourceChannelName(name);
500 m_mapDisplay->refresh();
505 std::string name = m_ui->m_greenComboBox->itemText(index).toStdString();
507 m_symbolizer->getChannelSelection()->getGreenChannel()->setSourceChannelName(name);
509 m_mapDisplay->refresh();
514 std::string name = m_ui->m_blueComboBox->itemText(index).toStdString();
516 m_symbolizer->getChannelSelection()->getBlueChannel()->setSourceChannelName(name);
518 m_mapDisplay->refresh();
523 std::string name = m_ui->m_monoComboBox->itemText(index).toStdString();
525 m_symbolizer->getChannelSelection()->getGrayChannel()->setSourceChannelName(name);
527 m_mapDisplay->refresh();
532 if(m_symbolizer->getChannelSelection()->getGrayChannel() == 0)
536 m_symbolizer->getChannelSelection()->setGrayChannel(scMono);
541 getCompositionInfo();
543 m_mapDisplay->refresh();
548 if(m_symbolizer->getChannelSelection()->getRedChannel() == 0)
552 m_symbolizer->getChannelSelection()->setRedChannel(scRed);
557 getCompositionInfo();
559 m_mapDisplay->refresh();
564 if(m_symbolizer->getChannelSelection()->getGreenChannel() == 0)
568 m_symbolizer->getChannelSelection()->setGreenChannel(scGreen);
573 getCompositionInfo();
575 m_mapDisplay->refresh();
580 if(m_symbolizer->getChannelSelection()->getBlueChannel() == 0)
584 m_symbolizer->getChannelSelection()->setBlueChannel(scBlue);
589 getCompositionInfo();
591 m_mapDisplay->refresh();
596 if(m_symbolizer->getChannelSelection()->getRedChannel() == 0)
600 m_symbolizer->getChannelSelection()->setRedChannel(scRed);
603 if(m_symbolizer->getChannelSelection()->getGreenChannel() == 0)
607 m_symbolizer->getChannelSelection()->setGreenChannel(scGreen);
610 if(m_symbolizer->getChannelSelection()->getBlueChannel() == 0)
614 m_symbolizer->getChannelSelection()->setBlueChannel(scBlue);
619 getCompositionInfo();
621 m_mapDisplay->refresh();
626 emit previewClicked();
634 m_mapDisplay->installEventFilter(m_tool);
639 m_ui->m_redComboBox->clear();
640 m_ui->m_greenComboBox->clear();
641 m_ui->m_blueComboBox->clear();
642 m_ui->m_monoComboBox->clear();
644 std::auto_ptr<te::da::DataSet> ds = m_layer->getData();
650 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
654 for(
unsigned int i = 0; i < inputRst->getNumberOfBands(); ++i)
656 m_ui->m_redComboBox->addItem(QString::number(i));
657 m_ui->m_greenComboBox->addItem(QString::number(i));
658 m_ui->m_blueComboBox->addItem(QString::number(i));
659 m_ui->m_monoComboBox->addItem(QString::number(i));
677 std::size_t nRules = cs->
getRules().size();
683 const std::vector<te::se::Symbolizer*>& symbolizers = rule->
getSymbolizers();
684 assert(!symbolizers.empty());
688 assert(m_symbolizer);
690 if(m_symbolizer->getChannelSelection())
692 m_ui->m_monoComboBox->setEnabled(
false);
693 m_ui->m_redComboBox->setEnabled(
false);
694 m_ui->m_greenComboBox->setEnabled(
false);
695 m_ui->m_blueComboBox->setEnabled(
false);
701 m_ui->m_compositionToolButton->setChecked(
true);
704 setComboBoxText(m_ui->m_redComboBox, name);
706 setComboBoxText(m_ui->m_greenComboBox, name);
708 setComboBoxText(m_ui->m_blueComboBox, name);
710 m_ui->m_redComboBox->setEnabled(
true);
711 m_ui->m_greenComboBox->setEnabled(
true);
712 m_ui->m_blueComboBox->setEnabled(
true);
716 m_ui->m_monoToolButton->setChecked(
true);
719 setComboBoxText(m_ui->m_redComboBox, name);
721 m_ui->m_monoComboBox->setEnabled(
true);
725 m_ui->m_redToolButton->setChecked(
true);
728 setComboBoxText(m_ui->m_redComboBox, name);
730 m_ui->m_redComboBox->setEnabled(
true);
734 m_ui->m_greenToolButton->setChecked(
true);
737 setComboBoxText(m_ui->m_greenComboBox, name);
739 m_ui->m_greenComboBox->setEnabled(
true);
743 m_ui->m_blueToolButton->setChecked(
true);
746 setComboBoxText(m_ui->m_blueComboBox, name);
748 m_ui->m_blueComboBox->setEnabled(
true);
755 QString name = value.c_str();
759 for(
int i = 0; i < cb->count(); ++i)
761 if(cb->itemText(i) == name)
763 cb->setCurrentIndex(i);
772 cb->setCurrentIndex(cb->count() - 1);
void hideInfoTool(bool hide)
void onBlueComboBoxActivated(int index)
void setSourceChannelName(const std::string &name)
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
const std::vector< Rule * > & getRules() const
te::qt::widgets::MapDisplay * getDisplay()
bool isValid() const
It tells if the rectangle is valid or not.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
This class implements a concrete tool to geographic zoom operation using the mouse click...
void onRecomposeClicked()
virtual void setResizePolicy(const ResizePolicy &policy)
Sets the resize policy to this map display.
This file has the RasterNavigatorWidget class.
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...
void hidePickerTool(bool hide)
Rule * getRule(std::size_t i) const
te::rst::Raster * getExtentRaster(bool fullScale=false)
void onCoordTrackedChanged(QPointF &coordinate)
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
SelectedChannel * getRedChannel() const
void set(te::map::AbstractLayerPtr layer, bool setFullScaleBox=false)
This method is used to set the selected layer for mixture model operation.
void onPanToggled(bool checked)
te::qt::widgets::ZoomInMapDisplayWidget * m_zoomInMapDisplay
te::qt::widgets::EyeBirdMapDisplayWidget * m_eyeBirdMapDisplay
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
This class implements a concrete tool to geographic coordinate picker on mouse click operation...
This class defines an interface for objects that can receive application events and respond to them...
RasterNavigatorWidget(QWidget *parent=0, Qt::WindowFlags f=0)
void onPointPickerToggled(bool checked)
This class implements a concrete tool to geographic zoom operation using the mouse wheel...
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
This class implements a concrete tool to geographic pan operation.
const std::vector< Symbolizer * > & getSymbolizers() const
void onReadPixelToggled(bool checked)
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
void hideColorCompositionTool(bool hide)
void setDevice(QPaintDevice *device, bool takeOwnerShip)
It sets new device as QPrinter.
An utility struct for representing 2D coordinates.
void drawRaster(te::rst::Raster *rst, te::se::Style *style=0)
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
void setComboBoxText(QComboBox *cb, std::string value)
A selected channel to be display.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
void onPointPicked(QPointF &point)
void getCompositionInfo()
te::gm::Envelope getCurrentExtent()
ColorCompositionType getColorCompositionType() const
void hideGeomTool(bool hide)
This class implements a concrete tool to geographic zoom in operation using a boundary rectangle...
void onRedToolClicked(bool flag)
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
double m_lly
Lower left corner y-coordinate.
void onExtraDisplaysToggled(bool checked)
void onMapDisplayExtentChanged()
int getSRID() const
Returns the raster spatial reference system identifier.
TEMAPEXPORT te::rst::Raster * GetExtentRaster(te::rst::Raster *raster, int w, int h, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid)
This class defines the map display ZoomIn, this component is only a specific map that shows the curre...
double m_ury
Upper right corner y-coordinate.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
A canvas built on top of Qt.
void onGreenToolClicked(bool flag)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
void onMonoToolClicked(bool flag)
double m_urx
Upper right corner x-coordinate.
A widget to control the display of a set of layers.
void hideEditionTools(bool hide)
SelectedChannel * getBlueChannel() const
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
void setCurrentTool(te::qt::widgets::AbstractTool *tool)
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
SelectedChannel * getGreenChannel() const
void onZoomOutToggled(bool checked)
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
void onZoomAreaToggled(bool checked)
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
void onGeomToggled(bool checked)
A multi thread Qt4 widget to control the display of a set of layers.
void onCompositionToolClicked(bool flag)
te::qt::widgets::MapDisplay * m_mapDisplay
std::auto_ptr< Ui::RasterNavigatorWidgetForm > m_ui
void onRedComboBoxActivated(int index)
void showAsPreview(bool asPreview)
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
double m_llx
Lower left corner x-coordinate.
SelectedChannel * getGrayChannel() const
This class implements a concrete tool to acquire a polygon geometry.
This class implements a concrete tool to geographic coordinate tracking on mouse move operation...
An abstract class for raster data strucutures.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
void onMonoComboBoxActivated(int index)
std::string getSourceChannelName() const
void onBlueToolClicked(bool flag)
void onGreenComboBoxActivated(int index)
TEMAPEXPORT void DrawRaster(te::da::DataSetType *type, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid, te::se::CoverageStyle *style)
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
An Envelope defines a 2D rectangular region.
void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)
It sets the world (or window) coordinates area (supposing a cartesian reference system).
void onGeomAquired(te::gm::Polygon *poly)
void hideExtraDisplaysTool(bool hide)