MixtureModelDialog.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/MixtureModelDialog.h
22 
23  \brief A dialog used to execute mixture model decomposition.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELDIALOG_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELDIALOG_H
28 
29 // TerraLib
30 #include "../Config.h"
31 #include "../../../color/RGBAColor.h"
32 #ifndef Q_MOC_RUN
33 #include "../../../maptools/DataSetLayer.h"
34 #include "../../../raster/Raster.h"
35 #endif
36 
37 // Qt
38 #include <QDialog>
39 #include <QPointF>
40 
41 // STL
42 #include <map>
43 #include <string>
44 
45 // Boost
46 #ifndef Q_MOC_RUN
47 #include <boost/shared_ptr.hpp>
48 #endif
49 
50 // Forward user interface declaration
51 namespace Ui
52 {
53  class MixtureModelForm;
54 }
55 
56 namespace te
57 {
58  namespace qt
59  {
60  namespace widgets
61  {
62  class CoordTracking;
63  class MapDisplay;
64  class Pan;
65  class ZoomWheel;
66 
67  /*!
68  \class MixtureModelDialogMDEventFilter
69 
70  \brief A event filter to handle map display events.
71  */
73  {
74  Q_OBJECT
75 
76  public:
77 
79 
81 
82 //overload
83  bool eventFilter(QObject* watched, QEvent* event);
84 
85  signals:
86 
87  /*! This signal is emitted when a keyboar key was pressed. */
88  void keyPressedOverMapDisplay( int key );
89 
90  protected:
91 
93 
94  };
95 
96  /*!
97  \class MixtureModelDialog
98 
99  \brief A dialog used to execute mixture model decomposition.
100  */
101  class TEQTWIDGETSEXPORT MixtureModelDialog : public QDialog
102  {
103  Q_OBJECT
104 
105  public:
106 
107  /*!
108  \brief Constructs a basic dialog which is a child of parent, with widget flags set to f.
109 
110  \param inputRasterPtr Input raster pointer.
111  \param outpuRasterDSType Output raster data source type (as described in te::rst::RasterFactory).
112  \param outpuRasterInfo The necessary information to create the raster (as described in te::rst::RasterFactory).
113  \param parent Parent widget pointer.
114  \param f Widget flags.
115  */
116  MixtureModelDialog(//const te::rst::Raster* inputRasterPtr,
117  const te::map::DataSetLayerPtr& inputLayerPtr,
118  const std::string& outpuRasterDSType,
119  const std::map<std::string, std::string>& outpuRasterInfo,
120  QWidget* parent = 0,
121  Qt::WindowFlags f = 0);
122 
123  /*! \brief Destructor. */
125 
126  /*!
127  \brief Returns the output result raster.
128 
129  \param outputRasterPtr A pointer to the output result raster
130 
131  \return true if OK, false on errors.
132  */
133  bool getOutputRaster(boost::shared_ptr< te::rst::Raster >& outputRasterPtr);
134 
135  protected slots:
136 
137  void on_okPushButton_clicked();
138  void on_coordTracked_changed(QPointF& coordinate);
139  void on_keyPressedOverMapDisplay(int key);
140  void on_removeButton_clicked();
141  void on_mapDisplay_extentChanged();
142  void updateComponentsGrid();
143 
144  private:
145 
146  Ui::MixtureModelForm* m_uiPtr; //!< User interface.
147  const te::rst::Raster* m_inputRasterPtr; //!< Input raster pointer.
148  std::string m_outpuRasterDSType; //!< Output raster data source type (as described in te::rst::RasterFactory).
149  std::map<std::string, std::string> m_outpuRasterInfo; //!< The necessary information to create the raster (as described in te::rst::RasterFactory).
150  boost::shared_ptr<te::rst::Raster> m_outputRasterPtr; //!< Output raster pointer.
151  int currentColumn; //!< The column position of mouse in map display.
152  int currentRow; //!< The row position of mouse in map display.
153  te::qt::widgets::MapDisplay* m_mapDisplay; //!< The map display to show the input raster.
154  te::qt::widgets::Pan* m_panClickEvent; //!< Pan click event for map display.
155  te::qt::widgets::ZoomWheel* m_zoomScroolEvent; //!< Zoom event using mouse scrool for map display.
156  CoordTracking* m_coordTracking; //!< Coordinate tracking for map display.
157  MixtureModelDialogMDEventFilter* m_keyboardPressTracking; //!< The event filter to detect when user press space bar.
158  std::map<std::string, std::vector<double> > m_components; //!< The map of selected components (name -> values).
159  std::map<std::string, te::gm::Coord2D> m_coordinates; //!< The map of selected coordinates (name -> coordinates).
160  unsigned int m_maxComponentsInserted; //!< The maximum number of components inserted.
161  te::color::RGBAColor** m_selectedPointPattern; //!< The display draw pattern used for selected points.
162  // te::color::RGBAColor** m_unselectedPointPattern; //!< The display draw pattern used for unselected points.
163  // te::color::RGBAColor** m_tempPointPattern; //!< The display draw pattern used for temporary points.
164  };
165 
166  } // end namespace widgets
167  } // end namespace qt
168 } // end namespace te
169 
170 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELDIALOG_H
std::map< std::string, te::gm::Coord2D > m_coordinates
The map of selected coordinates (name -> coordinates).
A dialog used to execute mixture model decomposition.
std::string m_outpuRasterDSType
Output raster data source type (as described in te::rst::RasterFactory).
int currentColumn
The column position of mouse in map display.
te::color::RGBAColor ** m_selectedPointPattern
The display draw pattern used for selected points.
std::map< std::string, std::string > m_outpuRasterInfo
The necessary information to create the raster (as described in te::rst::RasterFactory).
unsigned int m_maxComponentsInserted
The maximum number of components inserted.
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
const te::rst::Raster * m_inputRasterPtr
Input raster pointer.
boost::shared_ptr< te::rst::Raster > m_outputRasterPtr
Output raster pointer.
This class implements a concrete tool to geographic pan operation.
Definition: Pan.h:49
int currentRow
The row position of mouse in map display.
te::qt::widgets::Pan * m_panClickEvent
Pan click event for map display.
Ui::MixtureModelForm * m_uiPtr
User interface.
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
te::qt::widgets::ZoomWheel * m_zoomScroolEvent
Zoom event using mouse scrool for map display.
This class implements a concrete tool to geographic coordinate tracking on mouse move operation...
Definition: CoordTracking.h:52
This event signals that the pan button toggled.
CoordTracking * m_coordTracking
Coordinate tracking for map display.
This class implements a concrete tool to geographic zoom operation using the mouse wheel...
Definition: ZoomWheel.h:49
boost::intrusive_ptr< DataSetLayer > DataSetLayerPtr
Definition: DataSetLayer.h:146
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
#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::MapDisplay * m_mapDisplay
The map display to show the input raster.
std::map< std::string, std::vector< double > > m_components
The map of selected components (name -> values).
MixtureModelDialogMDEventFilter * m_keyboardPressTracking
The event filter to detect when user press space bar.
A event filter to handle map display events.