ColorTransformDialog.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  \file terralib/qt/widgets/rp/ColorTransformDialog.h
22 
23  \brief This file defines a class for a ColorTransform dialog.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_COLORTRANSFORMDIALOG_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_COLORTRANSFORMDIALOG_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "../Config.h"
34 #include "OutputRasterWidget.h"
35 
36 // STL
37 #include <memory>
38 
39 // Qt
40 #include <QComboBox>
41 #include <QDialog>
42 
43 
44 // Forward declaration
45 namespace Ui { class ColorTransformDialogForm; }
46 
47 namespace te
48 {
49  namespace qt
50  {
51  namespace widgets
52  {
53  //forward declaration
54  class Canvas;
55  class MapDisplay;
56 
57  /*!
58  \class ColorTransformDialog
59 
60  \brief This class is GUI used to define the colorTransform parameters for the RP colorTransform operation.
61  */
62  class TEQTWIDGETSEXPORT ColorTransformDialog : public QDialog
63  {
64  Q_OBJECT
65 
67  {
71  COLORTRANSFORM_HLS2RGB
72  };
73 
74  public:
75 
76  ColorTransformDialog(QWidget* parent = 0);
77 
79 
80  public:
81 
82  bool isRGB2IHS();
83 
84  bool isIHS2RGB();
85 
86  bool isRGB2HLS();
87 
88  bool isHLS2RGB();
89 
90  //unsigned int getRGBRBand();
91  //unsigned int getRGBGBand();
92  //unsigned int getRGBBBand();
93 
94  //unsigned int getIHSIBand();
95  //unsigned int getIHSHBand();
96  //unsigned int getIHSSBand();
97 
98  void setList(std::list<te::map::AbstractLayerPtr>& layerList);
99 
100  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
101 
102  public slots:
103 
104  void colorTransformTypeComboBoxActivated(int index);
105 
106  void rgbRComboBoxActivated(int index);
107  void rgbGComboBoxActivated(int index);
108  void rgbBComboBoxActivated(int index);
109 
110  void ihsIComboBoxActivated(int index);
111  void ihsHComboBoxActivated(int index);
112  void ihsSComboBoxActivated(int index);
113 
114  void rgb2hlsRComboBoxActivated(int index);
115  void rgb2hlsGComboBoxActivated(int index);
116  void rgb2hlsBComboBoxActivated(int index);
117 
118  void hlsHComboBoxActivated(int index);
119  void hlsLComboBoxActivated(int index);
120  void hlsSComboBoxActivated(int index);
121 
122  void onNewROIPushButtonClicked();
123 
124  void onOkPushButtonClicked();
125 
126  void onEnvelopeAcquired(te::gm::Envelope env);
127  void onMapDisplayExtentChanged();
128 
129  signals:
130 
131  void geomAquired(te::gm::Polygon* poly);
132 
133  void addLayer(te::map::AbstractLayerPtr layer);
134 
135  void closeTool();
136 
137  protected:
138 
139  bool execute();
140 
141  bool executeRGB2IHS();
142 
143  bool executeIHS2RGB();
144 
145  bool executeRGB2HLS();
146 
147  bool executeHLS2RGB();
148 
149  te::rst::Raster* buildOutputRaster();
150 
151  te::rst::Raster* buildMemRaster();
152 
153  void fillColorTransformTypes();
154 
155  te::rst::Raster* getRRaster();
156 
157  te::rst::Raster* getGRaster();
158 
159  te::rst::Raster* getBRaster();
160 
161  te::rst::Raster* getIRaster();
162 
163  te::rst::Raster* getHRaster();
164 
165  te::rst::Raster* getSRaster();
166 
167  te::rst::Raster* getLRaster();
168 
169  double getRGBMinValue();
170 
171  double getRGBMaxValue();
172 
173  double getRGB_HLSMinValue();
174 
175  double getRGB_HLSMaxValue();
176 
177  double getIHSMinValue();
178 
179  double getIHSMaxValue();
180 
181  double getHLSMinValue();
182 
183  double getHLSMaxValue();
184 
185  void getRasterBands(QComboBox* layer, int index, QComboBox* band);
186 
187  void getRasterFromROI();
188 
189  void applyPreview();
190 
191  void applyPreviewRGB2IHS();
192 
193  void applyPreviewIHS2RGB();
194 
195  void applyPreviewRGB2HLS();
196 
197  void applyPreviewHLS2RGB();
198 
199  void drawPreview(te::rst::Raster* raster);
200 
201  void drawGeom();
202 
203  void clearCanvas();
204 
205  void closeEvent(QCloseEvent* e);
206 
207  private:
208 
209  std::auto_ptr<Ui::ColorTransformDialogForm> m_ui;
210 
211  std::list<te::map::AbstractLayerPtr> m_layerList;
212 
223 
224  };
225 
226  } // end namespace widgets
227  } // end namespace qt
228 } // end namespace te
229 
230 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_COLORTRANSFORMDIALOG_H
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
te::qt::widgets::MapDisplay * m_mapDisplay
std::auto_ptr< Ui::ColorTransformDialogForm > m_ui
This file has the OutputRasterWidget class.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
This class is used to set output layer.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
std::list< te::map::AbstractLayerPtr > m_layerList
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
#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::OutputRasterWidget * m_outputWidget
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
This class is GUI used to define the colorTransform parameters for the RP colorTransform operation...