Loading...
Searching...
No Matches
StyleExplorer.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/StyleExplorer.h
22
23 \brief A widget used to explore a style.
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_STYLEEXPLORER_H
27#define __TERRALIB_QT_WIDGETS_SE_INTERNAL_STYLEEXPLORER_H
28
29// TerraLib
30#include "../Config.h"
31
32// Qt
33#include <QtCore/QString>
34#include <QTreeWidget>
35
36// STL
37#include <map>
38
39namespace te
40{
41// Forward declarations
42 namespace se
43 {
44 class Rule;
45 class Style;
46 class Symbolizer;
47 }
48
49 namespace qt
50 {
51 namespace widgets
52 {
53 /*!
54 \class StyleExplorer
55
56 \brief A widget used to explore a style.
57
58 \ingroup widgets
59 */
60 class TEQTWIDGETSEXPORT StyleExplorer : public QTreeWidget
61 {
62 Q_OBJECT
63
64 private:
65
66 /*!
67 \enum NodeType
68
69 \brief Auxiliary internal enumeration to control the StyleExplorer tree nodes.
70 */
72 {
73 STYLE = 0, /*!< Style root node. */
74 RULE = 1, /*!< Rule node. */
75 SYMBOLIZER = 2 /*!< Symbolizer node. */
76 };
77
78 public:
79
80 /** @name Initializer Methods
81 * Methods related to instantiation and destruction.
82 */
83 //@{
84
85 /*! \brief Constructs a style explorer widget which is a child of parent. */
86 StyleExplorer(QWidget* parent = 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, te::se::Rule* currentRule = 0);
104
105 /*! \brief This method updates the Style Explorer. */
106 void updateStyleTree(te::se::Rule* currentRule = 0);
107
108 /*!
109 \brief Gets the current rule.
110
111 \return The current rule on Style Explorer.
112
113 \note If there is not a current rule a NULL point will be returned.
114 */
116
117 /*!
118 \brief Gets the current symbolizer.
119
120 \return The current symbolizer on Style Explorer.
121
122 \note If there is not a current symbolizer a NULL point will be returned.
123 */
125
127
129
130 void setLegendIconSize(int size);
131
132 void importStyle(te::se::Style* style, bool isVisual);
133
134 public slots:
135
137
138 private:
139
140 /*! \brief Auxiliary internal method to retrieve a rule from a QTreeWidgetItem. */
141 te::se::Rule* getRule(QTreeWidgetItem* item);
142
143 /*! \brief Auxiliary internal method to retrieve a symbolizer from a QTreeWidgetItem. */
144 te::se::Symbolizer* getSymbolizer(QTreeWidgetItem* item);
145
146 /*!
147 \brief Auxiliary internal method to retrieve the selected item on Style Explorer.
148
149 \return The selected QTreeWidgetItem on Style Explorer.
150
151 \note If there is not a selected QTreeWidgetItem a NULL point will be returned.
152 */
153 QTreeWidgetItem* getSelectedItem() const;
154
155 void swapSymbolizers(te::se::Rule* r, int indexFirst, int indexSecond);
156
157 private slots:
158
159 void onItemClicked(QTreeWidgetItem* item, int column);
160
161 signals:
162
163 /*! This signal is emitted when a rule is clicked. */
165
166 /*! This signal is emitted when a symbolizer is clicked. */
168
169 void styleImported(te::se::Style* style, bool isVisual);
170
171 private:
172
173 te::se::Style* m_style; //!< Style element that will be explored by this widget.
174 std::map<QString, QString> m_symbolizerNames; //!< A map of symbolizers names to user interface names.
175 };
176
177 } // end namespace widgets
178 } // end namespace qt
179} // end namespace te
180
181#endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_STYLEEXPLORER_H
A widget used to explore a style.
Definition: StyleExplorer.h:61
void setStyle(te::se::Style *style, te::se::Rule *currentRule=0)
Sets a style element to this widget.
te::se::Symbolizer * getCurrentSymbolizer()
Gets the current symbolizer.
QTreeWidgetItem * getSelectedItem() const
Auxiliary internal method to retrieve the selected item on Style Explorer.
void onItemClicked(QTreeWidgetItem *item, int column)
void importStyle(te::se::Style *style, bool isVisual)
std::map< QString, QString > m_symbolizerNames
A map of symbolizers names to user interface names.
NodeType
Auxiliary internal enumeration to control the StyleExplorer tree nodes.
Definition: StyleExplorer.h:72
void onSymbolizerChanged(te::se::Symbolizer *symb)
void updateStyleTree(te::se::Rule *currentRule=0)
This method updates the Style Explorer.
void symbolizerClicked(te::se::Symbolizer *symb)
te::se::Rule * getCurrentRule()
Gets the current rule.
te::se::Symbolizer * getSymbolizer(QTreeWidgetItem *item)
Auxiliary internal method to retrieve a symbolizer from a QTreeWidgetItem.
void swapSymbolizers(te::se::Rule *r, int indexFirst, int indexSecond)
StyleExplorer(QWidget *parent=0)
Constructs a style explorer widget which is a child of parent.
te::se::Rule * getRule(QTreeWidgetItem *item)
Auxiliary internal method to retrieve a rule from a QTreeWidgetItem.
te::se::Style * m_style
Style element that will be explored by this widget.
void ruleClicked(te::se::Rule *rule)
void styleImported(te::se::Style *style, bool isVisual)
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition: Rule.h:77
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:66
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63