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