All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PointSymbolizerWidget.cpp
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/PointSymbolizerWidget.cpp
22 
23  \brief A widget used to build a point symbolizer element.
24 */
25 
26 // TerraLib
27 #include "../../../se/PointSymbolizer.h"
28 #include "GraphicSelectorWidget.h"
29 #include "PointSymbolizerWidget.h"
30 
31 // Qt
32 #include <QGridLayout>
33 
34 // STL
35 #include <cassert>
36 
38  : QWidget(parent, f),
39  m_symb(new te::se::PointSymbolizer)
40 {
41  // Graphic dialog
43 
44  // Adjusting...
45  QGridLayout* layout = new QGridLayout(this);
46  layout->setContentsMargins(0, 0, 0, 0);
47  layout->addWidget(m_graphicSelector);
48 
49  // Setups initial point symbolizer
51 
52  // Signals & slots
53  connect(m_graphicSelector, SIGNAL(graphicChanged()), SLOT(onGraphicChanged()));
54 }
55 
57 {
58  delete m_symb;
59 }
60 
62 {
63  assert(symb);
64 
65  delete m_symb;
66 
67  m_symb = static_cast<te::se::PointSymbolizer*>(symb->clone());
68 
69  updateUi();
70 }
71 
73 {
74  return m_symb->clone();
75 }
76 
78 {
79  const te::se::Graphic* g = m_symb->getGraphic();
80  assert(g);
81 
82  m_graphicSelector->setGraphic(g);
83 }
84 
86 {
87  m_symb->setGraphic(m_graphicSelector->getGraphic());
88  emit symbolizerChanged();
89 }
A widget used to select a graphic element.
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
PointSymbolizerWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a point symbolizer widget which is a child of parent, with widget flags set to f...
void setSymbolizer(const te::se::PointSymbolizer *symb)
Sets a point symbolizer element to this widget.
A widget used to select a graphic element.
A PointSymbolizer specifies the rendering of a graphic Symbolizer at a point.
te::se::Graphic * getGraphic() const
Gets the configured graphic element.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
te::se::Symbolizer * getSymbolizer() const
Gets the configured point symbolizer element.
GraphicSelectorWidget * m_graphicSelector
Graphic selector use to select the point symbolizer graphic element.
A widget used to build a point symbolizer element.
Symbolizer * clone() const
It creates a new copy of this object.
virtual Symbolizer * clone() const =0
It creates a new copy of this object.
void setGraphic(Graphic *graphic)
te::se::PointSymbolizer * m_symb
Point symbolizer element that will be configured by this widget.
void updateUi()
Updates the widget form based on internal point symbolizer element.