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 #include "../../../dataaccess/datasource/DataSourceInfo.h"
26 #include "../../../maptools/AbstractLayer.h"
27 #include "../Config.h"
28 
29 //Qt
30 #include <QWizardPage>
31 
32 //STL
33 #include <memory>
34 
35 //Forward declarations
36 namespace Ui
37 {
38  class RasterSlicingWizardPageForm;
39 }
40 
41 namespace te
42 {
43  namespace se
44  {
45  class ColorMap;
46  }
47 
48  namespace qt
49  {
50  namespace widgets
51  {
52  class ChartStyle;
53  class ChartDisplay;
54  class SlicingColorMapWidget;
55  class Histogram;
56  class HistogramChart;
57 
58  class TEQTWIDGETSEXPORT RasterSlicingWizardPage : public QWizardPage
59  {
60  Q_OBJECT
61 
62  public:
63 
64  /*! \brief Constructor. */
65  RasterSlicingWizardPage(QWidget* parent = 0);
66 
67  /*! \brief Destructor. */
69 
70  /*!
71  \brief This function returns the Color Map generated by the user.
72 
73  \return A color map representing the legend created by the user.
74 
75  /note The caller will take ownership of the returned pointer
76  */
77  te::se::ColorMap* getColorMap();
78 
79  /*!
80  \brief This function returns the band from the raster taht will be used.
81 
82  \return A string that represents the band that will be used to slice the raster.
83  */
84  std::string getCurrentBand();
85 
86  /*!
87  \brief This function returns the envelope that can be used to trim the raster if the user requests it.
88 
89  \return A reference to the Envelope that can be used to trim the raster if the user requests it.
90  */
91  const te::gm::Envelope& getExtent();
92 
93  /*!
94  \brief This function returns the srid of the display when the wizard was initiated.
95 
96  \return The srid of the display when the wizard was initiated.
97  */
98  int getSRID();
99 
100  /*!
101  \brief This function will check if the conditions required to trim the raster have been met.
102 
103  In order for this function to return true:
104 
105  The user must select the option to use the visible area;
106  The extent must be valid;
107  The extent must be within the raster;
108 
109  \return A boolean that indicates if the raster can be trimmed.
110  */
111  bool trimRaster();
112 
113  /*!
114  \brief This function sets the layer that contains the raster that will be sliced.
115 
116  \param layer The layer from which the raster will be obtained.
117  */
118  void setLayer(te::map::AbstractLayerPtr layer);
119 
120  /*!
121  \brief This function sets the envelope that will be used to trim tha raster if the user requests it.
122 
123  \param extent A reference to the envelope that can be used to trim tha raster.
124  */
125  void setExtent(const te::gm::Envelope& extent);
126 
127  /*!
128  \brief This function sets the srid of the display when the wizard was initiated.
129 
130  \param srid The current srid of the display.
131  */
132  void setSRID(int srid = 0);
133 
134  /*!
135  \brief This function returns the parameters as configured by the user.
136 
137  \param inputRasterBand The band from the raster selected by the user.
138  \param slicesNumber The number of slices that will be used to generate the histogram.
139  \param eqHistogram A boolean that holds weather the histogram will be equalized or not.
140  */
141  void getParameters(unsigned int& inputRasterBand,
142  unsigned int& slicesNumber, bool& eqHistogram);
143 
144  /*!
145  \brief This function evaluates the page to confirm if the user has completed the minimum configuration required to slice the raster.
146 
147  In order for this function to return true:
148 
149  The color map taht will be used on the output layer can not be empty.
150 
151  \param A boolean that indicates if the page is complete.
152  */
153  bool isComplete() const;
154 
155  protected:
156 
157  std::auto_ptr<Ui::RasterSlicingWizardPageForm> m_ui; //!< The wizard page form
158  te::qt::widgets::ChartDisplay* m_chartDisplay; //!< The display used to draw the preview histogram
159  te::qt::widgets::SlicingColorMapWidget* m_colorMapWidget; //!< The widget used to edit the legend of the output layer
160  te::qt::widgets::HistogramChart* m_histogramChart; //!< The preview histogram chart
161  std::auto_ptr<te::rst::Raster> m_raster; //!< The raster that will be sliced
162  te::map::AbstractLayerPtr m_rasterLayer; //!< Testing a better way to show the chart
163 
164  protected slots:
165 
166  void updateHistogram();
167  void onSliceBandComboBoxIndexCHanged(int index);
168 
169  private:
170 
171  //No copy allowed
173  RasterSlicingWizardPage& operator=(const RasterSlicingWizardPage& rhs);
174 
175  te::gm::Envelope m_extent; //!< The envelope that can be used to trim the output raster
176  int m_srid; //!< The current srid from the display
177  };
178  } // namespace widgets
179  } // namespace qt
180 } // namespace te
181 
182 #endif // TE_QT_WIDGETS_RASTERSLICINGWIZARDPAGE_H
183 
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.