SymbolEditInfoDialog.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/SymbolSelectorDialog.h
22 
23  \brief A dialog used to create or edit a specific symbol.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOL_EDITINFO_WIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOL_EDITINFO_WIDGET_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // Qt
33 #include <QWidget>
34 #include <QMap>
35 #include <QDialog>
36 #include <QSize>
37 
38 // STL
39 #include <memory>
40 #include <map>
41 #include <utility>
42 #include <vector>
43 
44 class QString;
45 class QGridLayout;
46 class QTableWidgetItem;
47 
48 namespace Ui
49 {
50  class SymbolEditInfoDialogForm;
51 }
52 
53 namespace te
54 {
55  // Forward declarations
56  namespace se
57  {
58  class Rule;
59  class TextSymbolizer;
60  }
61  namespace qt
62  {
63  namespace widgets
64  {
65  // Forward declarations
66  class Symbol;
67  struct SymbolInfo;
68  class SymbolPreviewWidget;
69  class Symbolizer;
70  class TextSymbolizerProperty;
71 
72  /*!
73  \class SymbolSelectorDialog
74 
75  \brief A dialog used to create or edit a specific symbol.
76  */
77  class TEQTWIDGETSEXPORT SymbolEditInfoDialog : public QDialog
78  {
79  Q_OBJECT
80 
81  public:
82 
83  /** @name Initializer Methods
84  * Methods related to instantiation and destruction.
85  */
86  //@{
87 
88  /*!
89  \brief Constructs a symbol selector dialog which is a child of parent, with widget flags set to f.
90 
91  \note field names from dataset for text symbolizer (no geometry)
92  */
93  SymbolEditInfoDialog(const std::vector<std::string>& fieldsNames, te::qt::widgets::Symbol* currentSymbol = nullptr, QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
94 
95  /*! \brief Destructor. */
97 
98  /*!
99  \brief Gets the selected symbol.
100 
101  \return The selected fill element.
102 
103  \note The caller will take the ownership of the returned symbol.
104  \note It return a NULL pointer if there is not a symbol yet created.
105  */
107 
108  virtual void setEnableObligatoryFields(bool enable);
109 
110  void setAuthor(const std::string& author);
111 
112  void setDescription(const std::string& description);
113 
114  void setName(const std::string& name);
115 
116  void setTags(const std::string& tags);
117 
118  virtual void setSymbolizerType(const std::string& symbolizerType);
119 
120  protected slots:
121 
123 
125 
127 
129 
131 
133 
134  void onCurrentItemChanged(QTableWidgetItem * current, QTableWidgetItem * previous);
135 
136  protected:
137 
138  /*! \brief Initialize symbol configuration frame. */
139  virtual void initialize();
140 
141  /*! \brief Initialize symbol information fields. */
142  virtual void initializeInfo();
143 
144  /*! \brief Will create a new symbol */
146 
147  /*! \brief Will create a new symbol infomation from interface fields. */
149 
150  virtual bool isInfoFieldsEmpty();
151 
152  virtual bool addSymbolizer(te::se::Symbolizer* symbolizer);
153 
154  virtual bool updateSymbolizer(te::se::Symbolizer* symbolizer);
155 
156  virtual bool removeCurrentSymbolizer();
157 
158  virtual void initializeTable();
159 
160  private:
161 
162  std::unique_ptr<Ui::SymbolEditInfoDialogForm> m_ui; //!< Dialog form.
163  std::unique_ptr<te::qt::widgets::Symbol> m_currentSymbol; //!< Current symbol
164  std::string m_id; //!< Symbol ID
165  std::vector<std::string> m_fieldsNames; //!< Dataset fields names for text symbolizer
166  std::unique_ptr<te::se::Symbolizer> m_currentSymbolizer; //!< Current symbol
167  QSize m_currentIconSize; //!< current icons size
168  std::string m_symbolizerType;
169  };
170 
171  } // end namespace widgets
172  } // end namespace qt
173 } // end namespace te
174 
175 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_SYMBOL_EDITINFO_WIDGET_H
virtual te::qt::widgets::Symbol * getSymbol()
Gets the selected symbol.
void onCurrentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
virtual void initialize()
Initialize symbol configuration frame.
virtual ~SymbolEditInfoDialog()
Destructor.
virtual te::qt::widgets::Symbol * createOrUpdateSymbol()
Will create a new symbol.
virtual bool addSymbolizer(te::se::Symbolizer *symbolizer)
virtual void setSymbolizerType(const std::string &symbolizerType)
virtual void initializeInfo()
Initialize symbol information fields.
virtual void setEnableObligatoryFields(bool enable)
std::unique_ptr< Ui::SymbolEditInfoDialogForm > m_ui
Dialog form.
std::vector< std::string > m_fieldsNames
Dataset fields names for text symbolizer.
void setTags(const std::string &tags)
void setAuthor(const std::string &author)
SymbolEditInfoDialog(const std::vector< std::string > &fieldsNames, te::qt::widgets::Symbol *currentSymbol=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.
std::unique_ptr< te::qt::widgets::Symbol > m_currentSymbol
Current symbol.
void setDescription(const std::string &description)
virtual te::qt::widgets::SymbolInfo createSymbolInfo()
Will create a new symbol infomation from interface fields.
void setName(const std::string &name)
std::unique_ptr< te::se::Symbolizer > m_currentSymbolizer
Current symbol.
virtual bool updateSymbolizer(te::se::Symbolizer *symbolizer)
This class represents a symbol. TODO: More description!
Definition: Symbol.h:55
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
TerraLib.
#define slots
Information about a given Symbol.
Definition: SymbolInfo.h:61
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63