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