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 "../../../raster/RasterFactory.h" 38 #include "../../../raster/RasterProperty.h" 39 #include "../../../raster/RasterSummary.h" 40 #include "../../../raster/RasterSummaryManager.h" 41 #include "../../../raster/Utils.h" 42 #include "../../../se/CoverageStyle.h" 43 #include "../../../se/ChannelSelection.h" 44 #include "../../../se/RasterSymbolizer.h" 45 #include "../../../se/Rule.h" 46 #include "../../../se/SelectedChannel.h" 47 #include "../../../se/Utils.h" 48 #include "../../widgets/tools/AbstractTool.h" 49 #include "../../widgets/tools/CoordTracking.h" 50 #include "../../widgets/tools/ExtentAcquire.h" 51 #include "../../widgets/tools/Pan.h" 52 #include "../../widgets/tools/PolygonAcquire.h" 53 #include "../../widgets/tools/PointPicker.h" 54 #include "../../widgets/tools/PointMove.h" 55 #include "../../widgets/tools/ReadPixelTool.h" 56 #include "../../widgets/tools/ZoomArea.h" 57 #include "../../widgets/tools/ZoomClick.h" 58 #include "../../widgets/tools/ZoomWheel.h" 59 #include "../canvas/Canvas.h" 60 #include "../canvas/EyeBirdMapDisplayWidget.h" 61 #include "../canvas/MultiThreadMapDisplay.h" 62 #include "../canvas/ZoomInMapDisplayWidget.h" 64 #include "ui_RasterNavigatorWidgetForm.h" 72 m_ui(new
Ui::RasterNavigatorWidgetForm),
73 m_symbolizer(nullptr),
74 m_tool(nullptr), m_panTool(nullptr), m_zoomTool(nullptr),
75 m_draftOriginal(nullptr)
80 QGridLayout* displayLayout =
new QGridLayout(
m_ui->m_frame);
84 displayLayout->setContentsMargins(0,0,0,0);
86 QGridLayout* eyeBirdDisplayLayout =
new QGridLayout(
m_ui->m_eyeBirdFrame);
89 eyeBirdDisplayLayout->setContentsMargins(0,0,0,0);
91 QGridLayout* zoomInDisplayLayout =
new QGridLayout(
m_ui->m_zoomInFrame);
94 zoomInDisplayLayout->setContentsMargins(0,0,0,0);
105 connect(
m_ui->m_zoomInActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onZoomAreaToggled(
bool)));
106 connect(
m_ui->m_zoomOutActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onZoomOutToggled(
bool)));
107 connect(
m_ui->m_panActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onPanToggled(
bool)));
110 connect(
m_ui->m_geomActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onGeomToggled(
bool)));
111 connect(
m_ui->m_extentActionToolButtontoolButton, SIGNAL(toggled(
bool)),
this, SLOT(
onBoxToggled(
bool)));
127 connect(
m_ui->m_horizontalSlider, SIGNAL(valueChanged(
int)),
this, SLOT(
onHSliderChanged(
int)));
133 m_ui->m_previewToolButton->setIcon(QIcon::fromTheme(
"check"));
134 m_ui->m_zoomInActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"zoom-area"));
135 m_ui->m_zoomOutActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"zoom-out"));
136 m_ui->m_panActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"pan"));
137 m_ui->m_recomposeActionToolButton->setIcon(QIcon::fromTheme(
"zoom-extent"));
138 m_ui->m_pointActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"placemark"));
139 m_ui->m_geomActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"edit-polygon"));
140 m_ui->m_extentActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"edit-box"));
141 m_ui->m_readPixelActionToolButton->setIcon(QIcon::fromTheme(
"color-picker"));
142 m_ui->m_extraDisplaysToolButton->setIcon(QIcon::fromTheme(
"view-map-display-extra"));
143 m_ui->m_monoLabel->setPixmap(QIcon::fromTheme(
"bullet-black").pixmap(16,16));
144 m_ui->m_redLabel->setPixmap(QIcon::fromTheme(
"bullet-red").pixmap(16,16));
145 m_ui->m_greenLabel->setPixmap(QIcon::fromTheme(
"bullet-green").pixmap(16,16));
146 m_ui->m_blueLabel->setPixmap(QIcon::fromTheme(
"bullet-blue").pixmap(16,16));
147 m_ui->m_monoToolButton->setIcon(QIcon::fromTheme(
"channel-gray"));
148 m_ui->m_compositionToolButton->setIcon(QIcon::fromTheme(
"channels"));
149 m_ui->m_redToolButton->setIcon(QIcon::fromTheme(
"channel-red"));
150 m_ui->m_greenToolButton->setIcon(QIcon::fromTheme(
"channel-green"));
151 m_ui->m_blueToolButton->setIcon(QIcon::fromTheme(
"channel-blue"));
153 m_ui->m_pointMoveActionToolButton->setIcon(QIcon::fromTheme(
"move_placemark"));
156 m_ui->m_previewToolButton->setVisible(
false);
157 m_ui->m_horizontalSlider->setVisible(
false);
158 m_ui->m_verticalSlider->setVisible(
false);
185 std::list<te::map::AbstractLayerPtr> list;
199 std::unique_ptr<te::da::DataSet>
ds(
m_layer->getData());
201 std::unique_ptr<te::rst::Raster> inputRst =
ds->getRaster(rpos);
206 double resX = inputRst->getResolutionX();
207 double resY = inputRst->getResolutionY();
208 te::gm::Coord2D cc(inputRst->getExtent()->getCenter().x, inputRst->getExtent()->getCenter().y);
209 te::gm::Coord2D bowerLeftWorld(cc.x - (resX * ( w / 2 )), cc.y - (resY * ( h / 2 )));
210 te::gm::Coord2D bowerUpperWorld(cc.x + (resX * ( w / 2 )), cc.y + (resY * ( h / 2 )));
212 te::gm::Envelope env(bowerLeftWorld.x, bowerLeftWorld.y, bowerUpperWorld.
x, bowerUpperWorld.
y);
229 std::list<te::map::AbstractLayerPtr> list;
230 list.push_back(layer);
248 std::list<te::map::AbstractLayerPtr> list;
277 std::unique_ptr<te::da::DataSet>
ds(
m_layer->getData());
279 std::unique_ptr<te::rst::Raster> inputRst =
ds->getRaster(rpos);
288 int w = (
int)endGrid.
x - (
int)startGrid.
x;
289 int h = (
int)startGrid.
y - (
int)endGrid.
y;
307 draft->fill(Qt::transparent);
314 bool hasToDelete =
false;
329 const std::complex<double>* cmin = rsMin->at(
b).m_minVal;
330 const std::complex<double>* cmax = rsMax->at(
b).m_maxVal;
331 double min = cmin->real();
332 double max = cmax->real();
352 disconnect(
m_ui->m_verticalSlider, SIGNAL(valueChanged(
int)),
this, SLOT(
onVSliderChanged(
int)));
353 disconnect(
m_ui->m_horizontalSlider, SIGNAL(valueChanged(
int)),
this, SLOT(
onHSliderChanged(
int)));
361 connect(
m_ui->m_horizontalSlider, SIGNAL(valueChanged(
int)),
this, SLOT(
onHSliderChanged(
int)));
374 m_ui->m_toolsFrame->setVisible(!asPreview);
375 m_ui->m_label->setVisible(!asPreview);
376 m_ui->m_previewToolButton->setVisible(asPreview);
378 m_ui->m_horizontalSlider->setVisible(asPreview);
379 m_ui->m_verticalSlider->setVisible(asPreview);
398 m_ui->m_ccFrame->setVisible(!hide);
403 m_ui->m_toolLine->setVisible(!hide);
412 m_ui->m_pointActionToolButtontoolButton->setVisible(!hide);
417 m_ui->m_geomActionToolButtontoolButton->setVisible(!hide);
422 m_ui->m_extentActionToolButtontoolButton->setVisible(!hide);
427 m_ui->m_readPixelActionToolButton->setVisible(!hide);
432 m_ui->m_extraDisplaysToolButton->setChecked(
false);
434 m_ui->m_extraLine->setVisible(!hide);
435 m_ui->m_extraDisplaysToolButton->setVisible(!hide);
442 m_ui->m_pointActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"pointer-selection"));
447 m_ui->m_pointActionToolButtontoolButton->setIcon(QIcon::fromTheme(
"placemark"));
456 if(
m_ui->m_extraDisplaysToolButton->isChecked())
481 std::unique_ptr<te::da::DataSet>
ds =
m_layer->getData();
486 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
491 te::gm::Coord2D pixelLocation = inputRst->getGrid()->geoToGrid((
double) coordinate.rx(), (double)coordinate.ry());
496 xStr.append(QString::number(coordinate.rx(),
'f', 5));
498 yStr.append(QString::number(coordinate.ry(),
'f', 5));
499 QString cStr(tr(
"Column: "));
501 QString lStr(tr(
"Line: "));
512 m_ui->m_label->setText(label);
543 emit
pointMoved(pointoriginal.x(), pointoriginal.y(), pointnew.x(), pointnew.y());
563 QCursor zoomAreaCursor(QIcon::fromTheme(
"zoom-in").pixmap(QSize(20, 20)));
574 QCursor zoomOutCursor(QIcon::fromTheme(
"zoom-out").pixmap(QSize(20, 20)));
598 connect(pp, SIGNAL(pointPickerMoving(QPointF&)),
this, SLOT(
onPointMoving(QPointF&)));
606 QCursor pointMoveCursor(QIcon::fromTheme(
"pointer_move_cursor").pixmap(QSize(20, 20)),0,0);
612 connect(pp, SIGNAL(pointMoveMoving(QPointF&)),
this, SLOT(
onPointMoving(QPointF&)));
648 m_ui->m_extraDisplaysFrame->setVisible(checked);
664 std::string name =
m_ui->m_redComboBox->itemText(index).toUtf8().data();
673 std::string name =
m_ui->m_greenComboBox->itemText(index).toUtf8().data();
682 std::string name =
m_ui->m_blueComboBox->itemText(index).toUtf8().data();
691 std::string name =
m_ui->m_monoComboBox->itemText(index).toUtf8().data();
819 m_ui->m_redComboBox->clear();
820 m_ui->m_greenComboBox->clear();
821 m_ui->m_blueComboBox->clear();
822 m_ui->m_monoComboBox->clear();
824 std::unique_ptr<te::da::DataSet>
ds =
m_layer->getData();
830 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
834 for(
unsigned int i = 0; i < inputRst->getNumberOfBands(); ++i)
836 m_ui->m_redComboBox->addItem(QString::number(i));
837 m_ui->m_greenComboBox->addItem(QString::number(i));
838 m_ui->m_blueComboBox->addItem(QString::number(i));
839 m_ui->m_monoComboBox->addItem(QString::number(i));
859 const std::vector<te::se::Symbolizer*>& symbolizers = rule->
getSymbolizers();
860 assert(!symbolizers.empty());
864 assert(m_symbolizer);
866 if(m_symbolizer->getChannelSelection())
868 m_ui->m_monoComboBox->setEnabled(
false);
869 m_ui->m_redComboBox->setEnabled(
false);
870 m_ui->m_greenComboBox->setEnabled(
false);
871 m_ui->m_blueComboBox->setEnabled(
false);
877 m_ui->m_compositionToolButton->setChecked(
true);
886 m_ui->m_redComboBox->setEnabled(
true);
887 m_ui->m_greenComboBox->setEnabled(
true);
888 m_ui->m_blueComboBox->setEnabled(
true);
892 m_ui->m_monoToolButton->setChecked(
true);
897 m_ui->m_monoComboBox->setEnabled(
true);
901 m_ui->m_redToolButton->setChecked(
true);
906 m_ui->m_redComboBox->setEnabled(
true);
910 m_ui->m_greenToolButton->setChecked(
true);
915 m_ui->m_greenComboBox->setEnabled(
true);
919 m_ui->m_blueToolButton->setChecked(
true);
924 m_ui->m_blueComboBox->setEnabled(
true);
931 QString name = value.c_str();
935 for(
int i = 0; i < cb->count(); ++i)
937 if(cb->itemText(i) == name)
939 cb->setCurrentIndex(i);
948 cb->setCurrentIndex(cb->count() - 1);
961 draft->fill(Qt::transparent);
964 p.drawImage(0, 0, img, 0, 0,
m_ui->m_horizontalSlider->value(),
m_ui->m_verticalSlider->value());
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
void setRedChannel(SelectedChannel *c)
A selected channel to be display.
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
double m_min
Minimum pixel value (default is std::numeric_limits<double>::max() which means no value set)...
double m_urx
Upper right corner x-coordinate.
te::se::ChannelSelection * getChannelSelection() const
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
SelectedChannel * getRedChannel() const
void setGrayChannel(SelectedChannel *c)
An utility struct for representing 2D coordinates.
static te::dt::Date ds(2010, 01, 01)
SelectedChannel * getBlueChannel() const
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
double m_max
Maximum pixel value (default is std::numeric_limits<double>::max() which means no value set)...
std::string getSourceChannelName() const
Rule * getRule(std::size_t i) const
virtual void setLayerList(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the layer list to be showed in the Map Display.
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, te::map::RasterContrast *rc, const double &scale, bool *cancel)
double m_llx
Lower left corner x-coordinate.
static RasterSummaryManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
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.
BandProperty * getProperty()
Returns the band property.
void setColorCompositionType(ColorCompositionType cct)
ColorCompositionType getColorCompositionType() const
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
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...
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
const std::vector< Symbolizer * > & getSymbolizers() const
double m_lly
Lower left corner y-coordinate.
int getSRID() const
Returns the raster spatial reference system identifier.
SelectedChannel * getGreenChannel() const
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
double m_ury
Upper right corner y-coordinate.
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
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)
void setSourceChannelName(const std::string &name)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
void setBlueChannel(SelectedChannel *c)
SelectedChannel * getGrayChannel() const
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 setGreenChannel(SelectedChannel *c)
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...