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