StyleControllerWidget.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/se/StyleControllerWidget.h
22 
23  \brief A widget used to controll the style se element.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_STYLECONTROLLERWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_STYLECONTROLLERWIDGET_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "../Config.h"
34 
35 // Qt
36 #include <QWidget>
37 
38 // STL
39 #include <memory>
40 #include <string>
41 #include <vector>
42 
43 // Forward declaraion
44 namespace Ui { class StyleControllerWidgetForm; }
45 
46 namespace te
47 {
48 // Forward declarations
49  namespace se
50  {
51  class Style;
52  class Symbolizer;
53  class Rule;
54  }
55 
56  namespace qt
57  {
58  namespace widgets
59  {
60 // Forward declarations
61  class StyleExplorer;
62 
63  /*!
64  \class StyleControllerWidget
65 
66  \brief A widget used to controll the style se element.
67  */
69  {
70  Q_OBJECT
71 
72  public:
73 
74  /** @name Initializer Methods
75  * Methods related to instantiation and destruction.
76  */
77  //@{
78 
79  /*! \brief Constructs a StyleControllerWidget which is a child of parent, with widget flags set to f. */
80  StyleControllerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
81 
82  /*! \brief Destructor. */
84 
85  //@}
86 
87  public:
88 
89  /*!
90  \brief Sets a style element to this widget.
91 
92  \param style A valid style element.
93 
94  \note The widget will NOT take the ownership of the given style.
95  \note The widget will be update based on given style parameters.
96  */
97  void setStyle(te::se::Style* style);
98 
99  void setLayer(te::map::AbstractLayer* layer, std::string selColor);
100 
101  StyleExplorer* getStyleExplorer() const;
102 
103  void writeStyle(const te::se::Style* style, std::string path);
104 
105  void readStyle(std::string path);
106 
107  private:
108 
109  bool checkSymbolizer(std::string file);
110 
111  protected:
112 
113  /*! \brief Updates the widget form based on internal mark element. */
114  void updateUi();
115 
116  protected slots:
117 
118  void onAddTextSymbolizerClicked();
119 
120  void onAddSymbolizerClicked();
121 
122  void onRemoveSymbolizerClicked();
123 
124  void onUpSymbolizerClicked();
125 
126  void onDownSymbolizerClicked();
127 
128  void onLibraryManagerClicked();
129 
130  void onExportClicked();
131 
132  void onImportClicked();
133 
134  void onMapRefreshClicked();
135 
136  void changeLegendIconSize(int size);
137 
138  void onVisualStyleChecked(bool state);
139 
140  void onSelectionStyleChecked(bool state);
141 
142  signals:
143 
144  void mapRefresh();
145 
146  private:
147 
148  std::auto_ptr<Ui::StyleControllerWidgetForm> m_ui; //!< Widget form.
149  te::qt::widgets::StyleExplorer* m_explorer; //!< A style explorer used to explore the style.
150  te::se::Style* m_currentStyle; //!< current style.
151 
152  te::map::AbstractLayer* m_currentLayer; //!< Current Layer pointer (used for raster symbolizer information)
153  };
154 
155  } // end namespace widgets
156  } // end namespace qt
157 } // end namespace te
158 
159 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_STYLECONTROLLERWIDGET_H
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
This is the base class for layers.
Definition: AbstractLayer.h:76
std::auto_ptr< Ui::StyleControllerWidgetForm > m_ui
Widget form.
A widget used to explore a style.
Definition: StyleExplorer.h:60
te::map::AbstractLayer * m_currentLayer
Current Layer pointer (used for raster symbolizer information)
A widget used to controll the style se element.
URI C++ Library.
#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::StyleExplorer * m_explorer
A style explorer used to explore the style.
te::se::Style * m_currentStyle
current style.