Loading...
Searching...
No Matches
SymbolizerEditInfoDialog.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/SymbolizerEditInfoDialog.h
22
23 \brief A dialog used to create or edit a specific symbol.
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOLIZER_EDITINFO_WIDGET_H
27#define __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOLIZER_EDITINFO_WIDGET_H
28
29// TerraLib
30#include "../Config.h"
31
32// Qt
33#include <QWidget>
34#include <QMap>
35#include <QDialog>
36
37// STL
38#include <memory>
39#include <map>
40#include <utility>
41#include <vector>
42#include <string>
43
44class QString;
45class QGridLayout;
46
47namespace Ui
48{
49 class SymbolizerEditInfoDialogForm;
50}
51
52namespace te
53{
54 // Forward declarations
55 namespace se
56 {
57 class Rule;
58 class TextSymbolizer;
59 }
60 namespace qt
61 {
62 namespace widgets
63 {
64 // Forward declarations
65 class Symbol;
66 struct SymbolInfo;
67 class SymbolPreviewWidget;
68 class Symbolizer;
69 class TextSymbolizerProperty;
70
71 /*!
72 \class SymbolizerEditInfoDialog
73
74 \brief A dialog used to create or edit a specific symbol.
75 */
77 {
78 Q_OBJECT
79
80 public:
81
82 /** @name Initializer Methods
83 * Methods related to instantiation and destruction.
84 */
85 //@{
86
87 /*!
88 \brief Constructs a symbol selector dialog which is a child of parent, with widget flags set to f.
89
90 \note field names from dataset for text symbolizer (no geometry)
91 */
92 SymbolizerEditInfoDialog(const std::vector<std::string>& fieldsNames, te::se::Symbolizer* symbolizer = nullptr, QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
93
94 /*! \brief Destructor. */
96
97 /*!
98 \brief Gets the selected symbol.
99
100 \return The selected fill element.
101
102 \note The caller will take the ownership of the returned symbol.
103 \note It return a NULL pointer if there is not a symbol yet created.
104 */
106
107 virtual void setSymbolizerType(const std::string& symbolizerType);
108
109 protected slots:
110
111 virtual void onCmbSymbolsCurrentIndexChanged ( const QString & text );
112
113 virtual void onSymbolizerChanged();
114
116
118
120
121 protected:
122
123 /*! \brief Initialize symbol configuration frame. */
124 virtual void initialize();
125
126 /*! \brief Initialize symbol options combobox. */
127 virtual void initializeCombo();
128
130
131 /*! \brief Set a symbol configuration widget inside a frame */
132 virtual void setWidgetOnFrame(QWidget* widget);
133
134 /*! \brief Remove a symbol configuration widget from the frame */
135 virtual void removeWidgetFromFrame(QWidget* widget);
136
137 /*! \brief If the symbol already exists, only the symbol configuration widget to which it belongs will be created. */
138 virtual void loadSymbolizers();
139
140 /*! \brief Will create the symbol configuration widgets of various types. */
141 virtual void createInterfaces();
142
143 /*! \brief Will create the symbol configuration widget for Point type. */
144 virtual void createPointSymbolizerInterface(te::se::Symbolizer* symbolizer = nullptr);
145
146 /*! \brief Will create the symbol configuration widget for Line type. */
147 virtual void createLineSymbolizerInterface(te::se::Symbolizer* symbolizer = nullptr);
148
149 /*! \brief Will create the symbol configuration widget for Polygon type. */
150 virtual void createPolygonSymbolizerInterface(te::se::Symbolizer* symbolizer = nullptr);
151
152 /*! \brief Will create the symbol configuration widget for Text type. */
153 virtual void createTextSymbolizerInterface(te::se::Symbolizer* symbolizer = nullptr);
154
155 /*! \brief Will create a new symbol */
157
159
160 virtual std::string getGeomType(const std::string& symbolizerType);
161
162 private:
163
164 std::unique_ptr<Ui::SymbolizerEditInfoDialogForm> m_ui; //!< Dialog form.
165 QWidget* m_widget; //!< Current symbol configuration widget
166 std::map<std::string, std::pair<QString, QWidget*>> m_interfaces; //!< symbol configuration widget map
167 QGridLayout* m_layoutFrame; //!< Layout, within a frame, which will contain the symbol configuration widget
168 std::vector<std::string> m_fieldsNames; //!< Dataset fields names for text symbolizer
169 std::unique_ptr<te::se::Symbolizer> m_currentSymbolizer; //!< current symbolizer
170 std::string m_symbolizerType;
171 };
172
173 } // end namespace widgets
174 } // end namespace qt
175} // end namespace te
176
177#endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOLIZER_EDITINFO_WIDGET_H
A dialog used to create or edit a specific symbol.
virtual void onCmbSymbolsCurrentIndexChanged(const QString &text)
virtual te::se::Symbolizer * createSymbolizer()
Will create a new symbol.
std::vector< std::string > m_fieldsNames
Dataset fields names for text symbolizer.
virtual void initialize()
Initialize symbol configuration frame.
virtual te::se::TextSymbolizer * createTextSymbolizer()
QGridLayout * m_layoutFrame
Layout, within a frame, which will contain the symbol configuration widget.
virtual void createLineSymbolizerInterface(te::se::Symbolizer *symbolizer=nullptr)
Will create the symbol configuration widget for Line type.
virtual void createPolygonSymbolizerInterface(te::se::Symbolizer *symbolizer=nullptr)
Will create the symbol configuration widget for Polygon type.
virtual void createPointSymbolizerInterface(te::se::Symbolizer *symbolizer=nullptr)
Will create the symbol configuration widget for Point type.
virtual te::se::Symbolizer * getSymbolizer()
Gets the selected symbol.
virtual void loadSymbolizers()
If the symbol already exists, only the symbol configuration widget to which it belongs will be create...
virtual void removeWidgetFromFrame(QWidget *widget)
Remove a symbol configuration widget from the frame.
virtual void initializeCombo()
Initialize symbol options combobox.
virtual ~SymbolizerEditInfoDialog()
Destructor.
virtual std::string getGeomType(const std::string &symbolizerType)
SymbolizerEditInfoDialog(const std::vector< std::string > &fieldsNames, te::se::Symbolizer *symbolizer=nullptr, QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
Constructs a symbol selector dialog which is a child of parent, with widget flags set to f.
QWidget * m_widget
Current symbol configuration widget.
virtual void setSymbolizerType(const std::string &symbolizerType)
std::unique_ptr< te::se::Symbolizer > m_currentSymbolizer
current symbolizer
virtual void initializeTextSymbolizerLabels(te::qt::widgets::TextSymbolizerProperty *textSymbolizer)
virtual void createTextSymbolizerInterface(te::se::Symbolizer *symbolizer=nullptr)
Will create the symbol configuration widget for Text type.
virtual void createInterfaces()
Will create the symbol configuration widgets of various types.
virtual void setWidgetOnFrame(QWidget *widget)
Set a symbol configuration widget inside a frame.
std::map< std::string, std::pair< QString, QWidget * > > m_interfaces
symbol configuration widget map
std::unique_ptr< Ui::SymbolizerEditInfoDialogForm > m_ui
Dialog form.
A widget used to define the text symbolizer properties, such as:
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
A TextSymbolizer is used to render text labels according to various graphical parameters.
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