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 
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 
126 
128 
130 
132 
134 
136 
138 
140 
142 
144 
146 
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
te::qt::widgets::StyleControllerWidget::readVectorStyle
void readVectorStyle(const std::string &path)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::StyleControllerWidget::onUpSymbolizerClicked
void onUpSymbolizerClicked()
te::qt::widgets::StyleControllerWidget
A widget used to controll the style se element.
Definition: StyleControllerWidget.h:75
te::qt::widgets::StyleControllerWidget::m_ui
std::unique_ptr< Ui::StyleControllerWidgetForm > m_ui
Widget form.
Definition: StyleControllerWidget.h:163
te::qt::widgets::StyleControllerWidget::onExportClicked
void onExportClicked()
te::qt::widgets::StyleControllerWidget::m_isSelectionStyle
bool m_isSelectionStyle
Definition: StyleControllerWidget.h:175
te::qt::widgets::StyleExplorer
A widget used to explore a style.
Definition: StyleExplorer.h:61
te::qt::widgets::StyleControllerWidget::onAddRuleClicked
void onAddRuleClicked()
te::qt::widgets::StyleControllerWidget::m_dataSourceId
std::string m_dataSourceId
Definition: StyleControllerWidget.h:173
te::qt::widgets::StyleControllerWidget::~StyleControllerWidget
~StyleControllerWidget()
Destructor.
TEQTWIDGETSEXPORT
#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::StyleControllerWidget::readRasterStyle
void readRasterStyle(const std::string &path)
te::qt::widgets::StyleControllerWidget::onAddSymbolizerClicked
void onAddSymbolizerClicked()
te::qt::widgets::StyleControllerWidget::onImportClicked
void onImportClicked()
te::qt::widgets::StyleControllerWidget::onRemoveRuleClicked
void onRemoveRuleClicked()
te::qt::widgets::StyleControllerWidget::onEditRuleClicked
void onEditRuleClicked()
te::qt::widgets::StyleControllerWidget::StyleControllerWidget
StyleControllerWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a StyleControllerWidget which is a child of parent, with widget flags set to f.
Ui
Definition: ConfigInputAddressDialog.h:44
te::qt::widgets::StyleControllerWidget::m_currentLayer
te::map::AbstractLayer * m_currentLayer
Current Layer pointer (used for raster symbolizer information)
Definition: StyleControllerWidget.h:169
te::qt::widgets::StyleControllerWidget::onMapRefreshClicked
void onMapRefreshClicked()
te::qt::widgets::StyleControllerWidget::onSelectionStyleChecked
void onSelectionStyleChecked(bool state)
te::qt::widgets::StyleControllerWidget::onRemoveSymbolizerClicked
void onRemoveSymbolizerClicked()
te::map::AbstractLayer
This is the base class for layers.
Definition: AbstractLayer.h:78
te::qt::widgets::StyleControllerWidget::writeStyle
void writeStyle(const te::se::Style *style, const std::string &path)
slots
#define slots
Definition: VirtualMachine.h:48
te::qt::widgets::StyleControllerWidget::updateLayer
void updateLayer()
te::qt::widgets::StyleControllerWidget::mapRefresh
void mapRefresh()
te::qt::widgets::StyleControllerWidget::checkSymbolizer
bool checkSymbolizer(std::string file)
te::qt::widgets::StyleControllerWidget::onLibraryManagerClicked
void onLibraryManagerClicked()
te::qt::widgets::StyleControllerWidget::onVisualStyleChecked
void onVisualStyleChecked(bool state)
te::qt::widgets::StyleControllerWidget::onDownSymbolizerClicked
void onDownSymbolizerClicked()
te::qt::widgets::StyleControllerWidget::onAddTextSymbolizerClicked
void onAddTextSymbolizerClicked()
te::se::Style
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:66
te::qt::widgets::StyleControllerWidget::clear
void clear()
te::qt::widgets::StyleControllerWidget::m_dsType
std::unique_ptr< te::da::DataSetType > m_dsType
Definition: StyleControllerWidget.h:171
te::qt::widgets::StyleControllerWidget::m_currentStyle
te::se::Style * m_currentStyle
current style.
Definition: StyleControllerWidget.h:167
te::qt::widgets::StyleControllerWidget::setLayer
void setLayer(te::map::AbstractLayer *layer, te::se::Style *style, bool isSelectionStyle)
te::qt::widgets::StyleControllerWidget::getStyleExplorer
StyleExplorer * getStyleExplorer() const
te::qt::widgets::StyleControllerWidget::changeLegendIconSize
void changeLegendIconSize(int size)
te::qt::widgets::StyleControllerWidget::setStyle
void setStyle(te::se::Style *style, std::string dataSourceId="", std::string dataSetName="")
Sets a style element to this widget.
StyleExplorer.h
A widget used to explore a style.
te::qt::widgets::StyleControllerWidget::readStyle
void readStyle(const std::string &path)
te::qt::widgets::StyleControllerWidget::m_explorer
te::qt::widgets::StyleExplorer * m_explorer
style explorer widget
Definition: StyleControllerWidget.h:165