Loading...
Searching...
No Matches
RasterSlicingWizardPage.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5TerraLib is free software: you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation, either version 3 of the License,
8or (at your option) any later version.
9
10TerraLib is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License
16along with TerraLib. See COPYING. If not, write to
17TerraLib Team at <terralib-team@terralib.org>.
18*/
19
20
21#ifndef TE_QT_WIDGETS_RASTERSLICINGWIZARDPAGE_H
22#define TE_QT_WIDGETS_RASTERSLICINGWIZARDPAGE_H
23
24//Terralib
25#ifndef Q_MOC_RUN
26#include "../../../dataaccess/datasource/DataSourceInfo.h"
27#include "../../../maptools/AbstractLayer.h"
28#include "../../../qt/widgets/rp/RpToolsWidget.h"
29#include "../canvas/Canvas.h"
30#include "../canvas/MapDisplay.h"
31#endif
32#include "../Config.h"
33
34//Qt
35#include <QWizardPage>
36
37//STL
38#include <memory>
39
40//Forward declarations
41namespace Ui
42{
43 class RasterSlicingWizardPageForm;
44}
45
46namespace te
47{
48 namespace se
49 {
50 class ColorMap;
51 }
52
53 namespace qt
54 {
55 namespace widgets
56 {
57 class ChartStyle;
58 class ChartDisplay;
59 class SlicingColorMapWidget;
60 class Histogram;
61 class HistogramChart;
62
63 class TEQTWIDGETSEXPORT RasterSlicingWizardPage : public QWizardPage
64 {
65 Q_OBJECT
66
67 public:
68
69 /*! \brief Constructor. */
70 RasterSlicingWizardPage(QWidget* parent = 0);
71
72 /*! \brief Destructor. */
74
75 /*!
76 \brief This function returns the Color Map generated by the user.
77
78 \return A color map representing the legend created by the user.
79
80 /note The caller will take ownership of the returned pointer
81 */
83
84 /*!
85 \brief This function returns the band from the raster taht will be used.
86
87 \return A string that represents the band that will be used to slice the raster.
88 */
89 std::string getCurrentBand();
90
91 /*!
92 \brief This function returns the envelope that can be used to trim the raster if the user requests it.
93
94 \return A reference to the Envelope that can be used to trim the raster if the user requests it.
95 */
97
98 /*!
99 \brief This function returns the srid of the display when the wizard was initiated.
100
101 \return The srid of the display when the wizard was initiated.
102 */
103 int getSRID();
104
105 /*!
106 \brief This function will check if the conditions required to trim the raster have been met.
107
108 In order for this function to return true:
109
110 The user must select the option to use the visible area;
111 The extent must be valid;
112 The extent must be within the raster;
113
114 \return A boolean that indicates if the raster can be trimmed.
115 */
117
118 /*!
119 \brief This function sets the layer that contains the raster that will be sliced.
120
121 \param layer The layer from which the raster will be obtained.
122 */
124
125 /*!
126 \brief This function sets the envelope that will be used to trim tha raster if the user requests it.
127
128 \param extent A reference to the envelope that can be used to trim tha raster.
129 */
130 void setExtent(const te::gm::Envelope& extent);
131
132 /*!
133 \brief This function sets the srid of the display when the wizard was initiated.
134
135 \param srid The current srid of the display.
136 */
137 void setSRID(int srid = 0);
138
139 /*!
140 \brief This function sets the map display.
141
142 \param Map display.
143 */
145
146 /*!
147 \brief This function sets the QActionGroup.
148
149 \param QActionGroup.
150 */
151 void setActionGroup(QActionGroup* actionGroup);
152
153 /*!
154 \brief This function returns the parameters as configured by the user.
155
156 \param inputRasterBand The band from the raster selected by the user.
157 \param slicesNumber The number of slices that will be used to generate the histogram.
158 \param eqHistogram A boolean that holds weather the histogram will be equalized or not.
159 */
160 void getParameters(unsigned int& inputRasterBand, bool& eqHistogram);
161
162 /*!
163 \brief This function evaluates the page to confirm if the user has completed the minimum configuration required to slice the raster.
164
165 In order for this function to return true:
166
167 The color map taht will be used on the output layer can not be empty.
168
169 \param A boolean that indicates if the page is complete.
170 */
171 bool isComplete() const;
172
173 /*!
174 \brief This function draws geometry after the envelope was acquired.
175 */
176 void drawGeom();
177
178 /*!
179 \brief This function cleans the canvas.
180 */
182
183 /*!
184 \brief This function applies preview of raster slicing result.
185 */
187
188 /*!
189 \brief Returns the output indexes values vector.
190 */
191 void getIndexes( std::vector< double >& indexesVector ) const;
192
193 protected:
194
196
198
199 protected:
200
201 std::unique_ptr<Ui::RasterSlicingWizardPageForm> m_ui; //!< The wizard page form
202 std::unique_ptr<te::qt::widgets::RpToolsWidget> m_tool; //!< Toolbar
203 te::qt::widgets::ChartDisplay* m_chartDisplay; //!< The display used to draw the preview histogram
204 te::qt::widgets::SlicingColorMapWidget* m_colorMapWidget; //!< The widget used to edit the legend of the output layer
205 te::qt::widgets::HistogramChart* m_histogramChart; //!< The preview histogram chart
206 std::unique_ptr<te::rst::Raster> m_raster; //!< The raster that will be sliced
207 te::map::AbstractLayerPtr m_rasterLayer; //!< Testing a better way to show the chart
209 std::unique_ptr<te::gm::Geometry> m_geom; //!< The geometry
210 std::unique_ptr<te::rst::Raster> m_rasterPreview; //!< The raster used for preview
211
212 protected slots:
213
217
218 private:
219
220 //No copy allowed
223
224 te::gm::Envelope m_extent; //!< The envelope that can be used to trim the output raster
225 int m_srid; //!< The current srid from the display
226 };
227 } // namespace widgets
228 } // namespace qt
229} // namespace te
230
231#endif // TE_QT_WIDGETS_RASTERSLICINGWIZARDPAGE_H
232
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
A class to represent a chart display.
Definition: ChartDisplay.h:66
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
bool trimRaster()
This function will check if the conditions required to trim the raster have been met.
te::qt::widgets::HistogramChart * m_histogramChart
The preview histogram chart.
te::qt::widgets::SlicingColorMapWidget * m_colorMapWidget
The widget used to edit the legend of the output layer.
void setLayer(te::map::AbstractLayerPtr layer)
This function sets the layer that contains the raster that will be sliced.
te::qt::widgets::MapDisplay * m_mapDisplay
The map display.
void applyPreview()
This function applies preview of raster slicing result.
RasterSlicingWizardPage(const RasterSlicingWizardPage &rhs)
void getParameters(unsigned int &inputRasterBand, bool &eqHistogram)
This function returns the parameters as configured by the user.
std::string getCurrentBand()
This function returns the band from the raster taht will be used.
bool isComplete() const
This function evaluates the page to confirm if the user has completed the minimum configuration requi...
te::gm::Envelope m_extent
The envelope that can be used to trim the output raster.
te::qt::widgets::ChartDisplay * m_chartDisplay
The display used to draw the preview histogram.
std::unique_ptr< te::rst::Raster > m_rasterPreview
The raster used for preview.
std::unique_ptr< te::gm::Geometry > m_geom
The geometry.
void drawGeom()
This function draws geometry after the envelope was acquired.
int m_srid
The current srid from the display.
std::unique_ptr< Ui::RasterSlicingWizardPageForm > m_ui
The wizard page form.
void clearCanvas()
This function cleans the canvas.
te::map::AbstractLayerPtr m_rasterLayer
Testing a better way to show the chart.
int getSRID()
This function returns the srid of the display when the wizard was initiated.
void setSRID(int srid=0)
This function sets the srid of the display when the wizard was initiated.
RasterSlicingWizardPage & operator=(const RasterSlicingWizardPage &rhs)
void drawPreview(te::rst::Raster *raster)
void getIndexes(std::vector< double > &indexesVector) const
Returns the output indexes values vector.
std::unique_ptr< te::rst::Raster > m_raster
The raster that will be sliced.
void setExtent(const te::gm::Envelope &extent)
This function sets the envelope that will be used to trim tha raster if the user requests it.
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_tool
Toolbar.
void onEnvelopeAcquired(te::gm::Envelope env)
void setActionGroup(QActionGroup *actionGroup)
This function sets the QActionGroup.
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
This function sets the map display.
const te::gm::Envelope & getExtent()
This function returns the envelope that can be used to trim the raster if the user requests it.
RasterSlicingWizardPage(QWidget *parent=0)
Constructor.
te::se::ColorMap * getColorMap()
This function returns the Color Map generated by the user.
An abstract class for raster data strucutures.
Definition: Raster.h:72
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
Definition: ColorMap.h:62
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63