PolygonSymbolizerProperty.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/PolygonSymbolizerProperty.cpp
22 
23  \brief A widget used to define the polygon symbolizer
24  properties, such as:
25  - basic fill
26  - basic stroke
27 */
28 
29 // Terralib
30 #include "../../../se/Fill.h"
31 #include "../../../se/PolygonSymbolizer.h"
32 #include "BasicFillPropertyItem.h"
34 #include "GraphicProperty.h"
36 
37 // Qt
38 #include <QGridLayout>
39 #include <QToolBox>
40 
41 // QtPropertyBrowser
42 #include <QtPropertyBrowser/QtTreePropertyBrowser>
43 #include <QtPropertyBrowser/QtVariantPropertyManager>
44 
45 // STL
46 #include <cassert>
47 
49  QWidget* /*parent*/)
50  : m_setLocalSymbol(false), m_symb(new te::se::PolygonSymbolizer)
51 {
52  QGridLayout* layout = new QGridLayout(this);
53  this->setLayout(layout);
54 
55  QToolBox* tb = new QToolBox(this);
56  layout->addWidget(tb);
57 
58  QtTreePropertyBrowser* basicPropBrowser = new QtTreePropertyBrowser(this);
59  basicPropBrowser->setIndentation(10);
60  basicPropBrowser->setPropertiesWithoutValueMarked(true);
61  basicPropBrowser->setRootIsDecorated(false);
62  basicPropBrowser->setResizeMode(QtTreePropertyBrowser::ResizeToContents);
63 
64  layout->addWidget(basicPropBrowser);
65 
66  m_bf = new te::qt::widgets::BasicFillPropertyItem(basicPropBrowser);
67  m_bs = new te::qt::widgets::BasicStrokePropertyItem(basicPropBrowser);
68 
69  tb->addItem(basicPropBrowser, "Basic Symbology");
70 
72 
73  tb->addItem(m_graph, "Graphic Symbology");
74 
75  connect(m_bf, SIGNAL(fillChanged()), this, SLOT(onFillChanged()));
76  connect(m_bs, SIGNAL(strokeChanged()), this, SLOT(onStrokeChanged()));
77  connect(m_graph, SIGNAL(graphicChanged()), this, SLOT(onPolyGraphicChanged()));
78 }
79 
81  default;
82 
84 {
85  m_symb = symb;
86 
87  m_setLocalSymbol = true;
88 
89  if(m_symb->getFill())
90  {
91  if(m_symb->getFill()->getGraphicFill())
93  else
95  }
96 
97  if(m_symb->getStroke())
99 
100  m_setLocalSymbol = false;
101 }
102 
104 {
105  return m_symb;
106 }
107 
109 {
110  if (m_setLocalSymbol)
111  return;
112 
114 
115  emit symbolizerChanged();
116 }
117 
119 {
120  if (m_setLocalSymbol)
121  return;
122 
123  m_symb->setFill(m_bf->getFill());
124 
125  emit symbolizerChanged();
126 }
127 
129 {
130  if (m_setLocalSymbol)
131  return;
132 
133  if(m_symb->getFill())
134  {
135  te::se::Fill* fill = m_symb->getFill()->clone();
136 
138 
139  m_symb->setFill(fill);
140 
141  emit symbolizerChanged();
142  }
143 }
void setSymbolizer(te::se::PolygonSymbolizer *symb)
Sets a polygon symbolizer element to this widget.
const Fill * getFill() const
Gets the Fill associates with the PolygonSymbolizer.
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
te::se::PolygonSymbolizer * m_symb
Polygon symbolizer element that will be configured by this widget.
A widget used to define the general properties of a se object.
A widget used to define the basic fill se object.
const Graphic * getGraphicFill() const
Gets the GraphicFill element associate to this Fill.
Definition: Fill.cpp:52
URI C++ Library.
Definition: Attributes.h:37
te::se::Stroke * getStroke() const
Gets the configured stroke element.
const Stroke * getStroke() const
Gets the Stroke associates with the PolygonSymbolizer.
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
void setGraphicFill(Graphic *g)
Sets the GraphicFill element to this Fill. GraphicFill defines that the pixels of the area will be dr...
Definition: Fill.cpp:46
Fill * clone() const
It creates a new copy of this object.
Definition: Fill.cpp:86
te::qt::widgets::BasicFillPropertyItem * m_bf
te::se::Graphic * getGraphic() const
void setStroke(Stroke *stroke)
A Stroke specifies the appearance of a linear geometry.
bool setGraphic(const te::se::Graphic *graphic)
A widget used to define the basic fill se object.
void setFill(Fill *f)
A Fill specifies the pattern for filling an area geometry.
te::se::Symbolizer * getSymbolizer() const
Gets the configured polygon symbolizer element.
A widget used to define the basic fill se object.
void setStroke(const te::se::Stroke *stroke)
Sets a stroke element to this widget.
A widget used to define the polygon symbolizer properties, such as:
te::qt::widgets::BasicStrokePropertyItem * m_bs