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  void clear();
108 
109  private:
110 
111  bool checkSymbolizer(std::string file);
112 
113  protected:
114 
115  /*! \brief Updates the widget form based on internal mark element. */
116  void updateUi();
117 
118  protected slots:
119 
120  void onAddTextSymbolizerClicked();
121 
122  void onAddSymbolizerClicked();
123 
124  void onRemoveSymbolizerClicked();
125 
126  void onUpSymbolizerClicked();
127 
128  void onDownSymbolizerClicked();
129 
130  void onLibraryManagerClicked();
131 
132  void onExportClicked();
133 
134  void onImportClicked();
135 
136  void onMapRefreshClicked();
137 
138  void changeLegendIconSize(int size);
139 
140  void onVisualStyleChecked(bool state);
141 
142  void onSelectionStyleChecked(bool state);
143 
144  signals:
145 
146  void mapRefresh();
147 
148  private:
149 
150  std::unique_ptr<Ui::StyleControllerWidgetForm> m_ui; //!< Widget form.
151  te::qt::widgets::StyleExplorer* m_explorer; //!< A style explorer used to explore the style.
152  te::se::Style* m_currentStyle; //!< current style.
153 
154  te::map::AbstractLayer* m_currentLayer; //!< Current Layer pointer (used for raster symbolizer information)
155  };
156 
157  } // end namespace widgets
158  } // end namespace qt
159 } // end namespace te
160 
161 #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
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.