LineSymbolizerProperty.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/LineSymbolizerProperty.cpp
22 
23  \brief A widget used to define the line symbolizer
24  properties, such as:
25  - basic stroke
26 */
27 
28 // TerraLib
29 #include "../../../se/LineSymbolizer.h"
31 #include "LineSymbolizerProperty.h"
32 
33 // Qt
34 #include <QGridLayout>
35 #include <QToolBox>
36 
37 // QtPropertyBrowser
38 #include <QtPropertyBrowser/QtTreePropertyBrowser>
39 #include <QtPropertyBrowser/QtVariantPropertyManager>
40 
41 // STL
42 #include <cassert>
43 
45  QWidget* /*parent*/)
46  : m_setLocalSymbol(false), m_symb(new te::se::LineSymbolizer)
47 {
48  QGridLayout* layout = new QGridLayout(this);
49  this->setLayout(layout);
50 
51  QToolBox* tb = new QToolBox(this);
52  layout->addWidget(tb);
53 
54  QtTreePropertyBrowser* basicPropBrowser = new QtTreePropertyBrowser(this);
55  basicPropBrowser->setIndentation(10);
56  basicPropBrowser->setPropertiesWithoutValueMarked(true);
57  basicPropBrowser->setRootIsDecorated(false);
58  basicPropBrowser->setResizeMode(QtTreePropertyBrowser::ResizeToContents);
59 
60  layout->addWidget(basicPropBrowser);
61 
62  m_bs = new te::qt::widgets::BasicStrokePropertyItem(basicPropBrowser);
63 
64  tb->addItem(basicPropBrowser, "Basic Symbology");
65 
66  connect(m_bs, SIGNAL(strokeChanged()), this, SLOT(onStrokeChanged()));
67 }
68 
70 
72 {
73  m_symb = symb;
74 
75  m_setLocalSymbol = true;
76 
77  if(m_symb->getStroke())
79 
80  m_setLocalSymbol = false;
81 }
82 
84 {
85  return m_symb;
86 }
87 
89 {
90  if (m_setLocalSymbol)
91  return;
92 
94 
95  emit symbolizerChanged();
96 }
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
te::qt::widgets::BasicStrokePropertyItem * m_bs
A widget used to define the line symbolizer properties, such as:
A widget used to define the basic fill se object.
URI C++ Library.
Definition: Attributes.h:37
void setStroke(Stroke *stroke)
A Stroke specifies the appearance of a linear geometry. The Stroke element is optional inside of Line...
te::se::Stroke * getStroke() const
Gets the configured stroke element.
void setSymbolizer(te::se::LineSymbolizer *symb)
Sets a line symbolizer element to this widget.
te::se::LineSymbolizer * m_symb
Line symbolizer element that will be configured by this widget.
const Stroke * getStroke() const
te::se::Symbolizer * getSymbolizer() const
Gets the configured line symbolizer element.
A LineSymbolizer is used to style a stroke along a linear geometry type, such as a string of line seg...
LineSymbolizerProperty(QWidget *parent)
Constructor.
void setStroke(const te::se::Stroke *stroke)
Sets a stroke element to this widget.