All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbstractGraphicWidget.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/AbstractGraphicWidget.cpp
22 
23  \brief Abstract class that represents a widget that can be used to build a graphic element.
24 */
25 
26 // TerraLib
27 #include "../../../se/AnchorPoint.h"
28 #include "../../../se/Displacement.h"
29 #include "../../../se/ParameterValue.h"
30 #include "../../../se/Graphic.h"
31 #include "AbstractGraphicWidget.h"
32 
34  : QWidget(parent, f),
35  m_graphic(new te::se::Graphic)
36 {
37 }
38 
40 {
41  delete m_graphic;
42 }
43 
45 {
46  return m_graphic->clone();
47 }
48 
50 {
51  m_graphic->setSize(new te::se::ParameterValue(size.toStdString()));
52  emit graphicChanged();
53 }
54 
56 {
57  m_graphic->setRotation(new te::se::ParameterValue(angle.toStdString()));
58  emit graphicChanged();
59 }
60 
62 {
63  double opacity = value / 100.0;
64  m_graphic->setOpacity(new te::se::ParameterValue(QString::number(opacity, 'g', 2).toStdString()));
65  emit graphicChanged();
66 }
67 
68 void te::qt::widgets::AbstractGraphicWidget::setGraphicDisplacement(const QString& dx, const QString& dy)
69 {
71  disp->setDisplacementX(new te::se::ParameterValue(dx.toStdString()));
72  disp->setDisplacementY(new te::se::ParameterValue(dy.toStdString()));
73  m_graphic->setDisplacement(disp);
74  emit graphicChanged();
75 }
76 
77 void te::qt::widgets::AbstractGraphicWidget::setGraphicAnchorPoint(const QString& ax, const QString& ay)
78 {
80  ac->setAnchorPointX(new te::se::ParameterValue(ax.toStdString()));
81  ac->setAnchorPointY(new te::se::ParameterValue(ay.toStdString()));
82  m_graphic->setAnchorPoint(ac);
83  emit graphicChanged();
84 }
A Displacement gives X and Y offset displacements to use for rendering a text label, graphic or other Symbolizer near a point.
Definition: Displacement.h:58
te::se::Graphic * getGraphic() const
Gets the configured graphic element.
void setGraphicAnchorPoint(const QString &ax, const QString &ay)
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
AbstractGraphicWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a graphic widget which is a child of parent, with widget flags set to f.
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
An AnchorPoint identifies the location inside of a text label to use an 'anchor' for positioning it r...
Definition: AnchorPoint.h:63
void setAnchorPointX(ParameterValue *x)
Definition: AnchorPoint.cpp:42
void setDisplacementY(ParameterValue *y)
Graphic * clone() const
It creates a new copy of this object.
Definition: Graphic.cpp:167
void setAnchorPointY(ParameterValue *y)
Definition: AnchorPoint.cpp:53
Abstract class that represents a widget that can be used to build a graphic element.
void setDisplacementX(ParameterValue *x)
void setGraphicDisplacement(const QString &dx, const QString &dy)