All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LineSymbolizerProperty.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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 "../../../../../third-party/qt/propertybrowser/qttreepropertybrowser.h"
35 #include <QtGui/QGridLayout>
36 #include <QtGui/QToolBox>
37 
38 // STL
39 #include <cassert>
40 
41 te::qt::widgets::LineSymbolizerProperty::LineSymbolizerProperty(QWidget* parent) : m_symb(new te::se::LineSymbolizer)
42 {
43  QGridLayout* layout = new QGridLayout(this);
44  this->setLayout(layout);
45 
46  QToolBox* tb = new QToolBox(this);
47  layout->addWidget(tb);
48 
49  QtTreePropertyBrowser* basicPropBrowser = new QtTreePropertyBrowser(this);
50  basicPropBrowser->setIndentation(10);
51  basicPropBrowser->setPropertiesWithoutValueMarked(true);
52  basicPropBrowser->setRootIsDecorated(false);
53  basicPropBrowser->setResizeMode(QtTreePropertyBrowser::ResizeToContents);
54 
55  layout->addWidget(basicPropBrowser);
56 
57  m_bs = new te::qt::widgets::BasicStrokePropertyItem(basicPropBrowser);
58 
59  tb->addItem(basicPropBrowser, "Basic Symbology");
60 
61  connect(m_bs, SIGNAL(strokeChanged()), this, SLOT(onStrokeChanged()));
62 }
63 
65 {
66 }
67 
69 {
70  m_symb = symb;
71 
72  if(m_symb->getStroke())
73  m_bs->setStroke(m_symb->getStroke());
74 }
75 
77 {
78  return m_symb;
79 }
80 
82 {
83  m_symb->setStroke(m_bs->getStroke());
84 
85  emit symbolizerChanged();
86 }
A LineSymbolizer is used to style a stroke along a linear geometry type, such as a string of line seg...
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
te::se::Symbolizer * getSymbolizer() const
Gets the configured line symbolizer element.
void setSymbolizer(te::se::LineSymbolizer *symb)
Sets a line symbolizer element to this widget.
te::qt::widgets::BasicStrokePropertyItem * m_bs
A widget used to define the line symbolizer properties, such as:
LineSymbolizerProperty(QWidget *parent)
Constructor.
A widget used to define the basic fill se object.
void setStroke(Stroke *stroke)
A Stroke specifies the appearance of a linear geometry. The Stroke element is optional inside of Line...