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