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  void setList(std::list<te::map::AbstractLayerPtr>& layerList);
91 
92  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
93 
94  public slots:
95 
96  void colorTransformTypeComboBoxActivated(int index);
97 
98  void rgbRComboBoxActivated(int index);
99  void rgbGComboBoxActivated(int index);
100  void rgbBComboBoxActivated(int index);
101 
102  void ihsIComboBoxActivated(int index);
103  void ihsHComboBoxActivated(int index);
104  void ihsSComboBoxActivated(int index);
105 
106  void rgb2hlsRComboBoxActivated(int index);
107  void rgb2hlsGComboBoxActivated(int index);
108  void rgb2hlsBComboBoxActivated(int index);
109 
110  void hlsHComboBoxActivated(int index);
111  void hlsLComboBoxActivated(int index);
112  void hlsSComboBoxActivated(int index);
113 
114  void onNewROIPushButtonClicked();
115 
116  void onOkPushButtonClicked();
117 
118  void onEnvelopeAcquired(te::gm::Envelope env);
119  void onMapDisplayExtentChanged();
120 
121  void onSearchLayerToolButtonClicked();
122 
123  signals:
124 
125  void geomAquired(te::gm::Polygon* poly);
126 
127  void addLayer(te::map::AbstractLayerPtr layer);
128 
129  void closeTool();
130 
131  protected:
132 
133  bool execute();
134 
135  bool executeRGB2IHS();
136 
137  bool executeIHS2RGB();
138 
139  bool executeRGB2HLS();
140 
141  bool executeHLS2RGB();
142 
143  te::rst::Raster* buildOutputRaster();
144 
145  te::rst::Raster* buildMemRaster();
146 
147  void fillColorTransformTypes();
148 
149  te::rst::Raster* getRRaster();
150 
151  te::rst::Raster* getGRaster();
152 
153  te::rst::Raster* getBRaster();
154 
155  te::rst::Raster* getIRaster();
156 
157  te::rst::Raster* getHRaster();
158 
159  te::rst::Raster* getSRaster();
160 
161  te::rst::Raster* getLRaster();
162 
163  int getNBits(int index);
164 
165  void getRasterBands(QComboBox* layer, int index, QComboBox* band);
166 
167  void getRasterFromROI();
168 
169  void applyPreview();
170 
171  void applyPreviewRGB2IHS();
172 
173  void applyPreviewIHS2RGB();
174 
175  void applyPreviewRGB2HLS();
176 
177  void applyPreviewHLS2RGB();
178 
179  void drawPreview(te::rst::Raster* raster);
180 
181  void drawGeom();
182 
183  void clearCanvas();
184 
185  void closeEvent(QCloseEvent* e);
186 
187  private:
188 
189  std::unique_ptr<Ui::ColorTransformDialogForm> m_ui;
190 
191  std::list<te::map::AbstractLayerPtr> m_layerList;
192 
203 
204  };
205 
206  } // end namespace widgets
207  } // end namespace qt
208 } // end namespace te
209 
210 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_COLORTRANSFORMDIALOG_H
#define slots
std::unique_ptr< Ui::ColorTransformDialogForm > m_ui
A widget to control the display of a set of layers.
Definition: MapDisplay.h:71
te::qt::widgets::MapDisplay * m_mapDisplay
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:75
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...