RasterSlicingWizardPage.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9 
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib 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 #endif
29 #include "../Config.h"
30 
31 //Qt
32 #include <QWizardPage>
33 
34 //STL
35 #include <memory>
36 
37 //Forward declarations
38 namespace Ui
39 {
40  class RasterSlicingWizardPageForm;
41 }
42 
43 namespace te
44 {
45  namespace se
46  {
47  class ColorMap;
48  }
49 
50  namespace qt
51  {
52  namespace widgets
53  {
54  class ChartStyle;
55  class ChartDisplay;
56  class SlicingColorMapWidget;
57  class Histogram;
58  class HistogramChart;
59 
60  class TEQTWIDGETSEXPORT RasterSlicingWizardPage : public QWizardPage
61  {
62  Q_OBJECT
63 
64  public:
65 
66  /*! \brief Constructor. */
67  RasterSlicingWizardPage(QWidget* parent = 0);
68 
69  /*! \brief Destructor. */
71 
72  /*!
73  \brief This function returns the Color Map generated by the user.
74 
75  \return A color map representing the legend created by the user.
76 
77  /note The caller will take ownership of the returned pointer
78  */
79  te::se::ColorMap* getColorMap();
80 
81  /*!
82  \brief This function returns the band from the raster taht will be used.
83 
84  \return A string that represents the band that will be used to slice the raster.
85  */
86  std::string getCurrentBand();
87 
88  /*!
89  \brief This function returns the envelope that can be used to trim the raster if the user requests it.
90 
91  \return A reference to the Envelope that can be used to trim the raster if the user requests it.
92  */
93  const te::gm::Envelope& getExtent();
94 
95  /*!
96  \brief This function returns the srid of the display when the wizard was initiated.
97 
98  \return The srid of the display when the wizard was initiated.
99  */
100  int getSRID();
101 
102  /*!
103  \brief This function will check if the conditions required to trim the raster have been met.
104 
105  In order for this function to return true:
106 
107  The user must select the option to use the visible area;
108  The extent must be valid;
109  The extent must be within the raster;
110 
111  \return A boolean that indicates if the raster can be trimmed.
112  */
113  bool trimRaster();
114 
115  /*!
116  \brief This function sets the layer that contains the raster that will be sliced.
117 
118  \param layer The layer from which the raster will be obtained.
119  */
120  void setLayer(te::map::AbstractLayerPtr layer);
121 
122  /*!
123  \brief This function sets the envelope that will be used to trim tha raster if the user requests it.
124 
125  \param extent A reference to the envelope that can be used to trim tha raster.
126  */
127  void setExtent(const te::gm::Envelope& extent);
128 
129  /*!
130  \brief This function sets the srid of the display when the wizard was initiated.
131 
132  \param srid The current srid of the display.
133  */
134  void setSRID(int srid = 0);
135 
136  /*!
137  \brief This function returns the parameters as configured by the user.
138 
139  \param inputRasterBand The band from the raster selected by the user.
140  \param slicesNumber The number of slices that will be used to generate the histogram.
141  \param eqHistogram A boolean that holds weather the histogram will be equalized or not.
142  */
143  void getParameters(unsigned int& inputRasterBand, bool& eqHistogram);
144 
145  /*!
146  \brief This function evaluates the page to confirm if the user has completed the minimum configuration required to slice the raster.
147 
148  In order for this function to return true:
149 
150  The color map taht will be used on the output layer can not be empty.
151 
152  \param A boolean that indicates if the page is complete.
153  */
154  bool isComplete() const;
155 
156  protected:
157 
158  std::auto_ptr<Ui::RasterSlicingWizardPageForm> m_ui; //!< The wizard page form
159  te::qt::widgets::ChartDisplay* m_chartDisplay; //!< The display used to draw the preview histogram
160  te::qt::widgets::SlicingColorMapWidget* m_colorMapWidget; //!< The widget used to edit the legend of the output layer
161  te::qt::widgets::HistogramChart* m_histogramChart; //!< The preview histogram chart
162  std::auto_ptr<te::rst::Raster> m_raster; //!< The raster that will be sliced
163  te::map::AbstractLayerPtr m_rasterLayer; //!< Testing a better way to show the chart
164 
165  protected slots:
166 
167  void updateHistogram();
168  void onSliceBandComboBoxIndexCHanged(int index);
169 
170  private:
171 
172  //No copy allowed
174  RasterSlicingWizardPage& operator=(const RasterSlicingWizardPage& rhs);
175 
176  te::gm::Envelope m_extent; //!< The envelope that can be used to trim the output raster
177  int m_srid; //!< The current srid from the display
178  };
179  } // namespace widgets
180  } // namespace qt
181 } // namespace te
182 
183 #endif // TE_QT_WIDGETS_RASTERSLICINGWIZARDPAGE_H
184 
te::map::AbstractLayerPtr m_rasterLayer
Testing a better way to show the chart.
te::qt::widgets::HistogramChart * m_histogramChart
The preview histogram chart.
std::auto_ptr< te::rst::Raster > m_raster
The raster that will be sliced.
te::gm::Envelope m_extent
The envelope that can be used to trim the output raster.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
A class to represent a chart display.
Definition: ChartDisplay.h:65
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::qt::widgets::SlicingColorMapWidget * m_colorMapWidget
The widget used to edit the legend of the output layer.
te::qt::widgets::ChartDisplay * m_chartDisplay
The display used to draw the preview histogram.
int m_srid
The current srid from the display.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
Definition: ColorMap.h:61
std::auto_ptr< Ui::RasterSlicingWizardPageForm > m_ui
The wizard page form.