All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ScatterStyle.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/charts/scatterStyle.h
22 
23  \brief A class used to define the style of a scatter's chart
24 */
25 
26 //TerraLib
27 #include "../../../se/Fill.h"
28 #include "../../../se/ParameterValue.h"
29 #include "../../../se/Graphic.h"
30 #include "../../../se/Mark.h"
31 #include "../../../se/Stroke.h"
32 #include"MarkSymbol.h"
33 #include "ScatterStyle.h"
34 #include "Utils.h"
35 
37 {
38  //Configuring a default mark
39  te::se::Mark* mark = new te::se::Mark();
40  std::string* markName = new std::string("circle");
41  mark->setFill(new te::se::Fill());
42  mark->setStroke(new te::se::Stroke());
43  mark->setWellKnownName(markName);
44 
45 //Configuring a default graphic
46  m_graphic = new te::se::Graphic();
48  m_graphic->add(mark);
49  m_graphic->setSize(grSize);
50 }
51 
53 : m_graphic(graphic)
54 {
55 }
56 
58 {
59  delete m_graphic;
60 }
61 
63 {
65  style->setGraphic(this->getGraphic()->clone());
66  return style;
67 }
68 
70 {
71  return m_graphic;
72 }
73 
75 {
76  delete m_graphic;
77  m_graphic = newGraphic;
78 }
79 
81 {
82  if(!m_graphic->getMarks().empty())
83  {
84  return m_graphic->getMarks()[0]->getFill()->clone();
85  }
86  else
87  {
88  return 0;
89  }
90 }
91 
93 {
94  if(!m_graphic->getMarks().empty())
95  {
96  m_graphic->getMarks()[0]->setFill(newFill);
97  }
98  else
99  {
100  delete newFill;
101  }
102 }
103 
105 {
106  if(!m_graphic->getMarks().empty())
107  {
108  return m_graphic->getMarks()[0]->getStroke()->clone();
109  }
110  else
111  {
112  return 0;
113  }
114 }
115 
117 {
118  if(!m_graphic->getMarks().empty())
119  {
120  m_graphic->getMarks()[0]->setStroke(newStroke);
121  }
122  else
123  {
124  delete newStroke;
125  }
126 }
127 
129 {
130  return m_graphic->getMarks()[0]->clone();
131 }
132 
134 {
135  m_graphic->setMark(0, newMark);
136 }
137 
139 {
140  return te::qt::widgets::Terralib2Qwt(m_graphic);
141 }
Stroke * clone() const
It creates a new copy of this object.
Definition: Stroke.cpp:158
te::se::Mark * getMark()
Returns a copy of the pointer to the scatter's Mark.
te::se::Stroke * getStroke()
Returns a copy of thepointer to the scatter point's stroke.
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
void setGraphic(te::se::Graphic *newGraphic)
It sets the he scatter's graphic.
te::se::Graphic * getGraphic()
Returns a pointer to the scatter's graphic.
TEQTWIDGETSEXPORT QwtText * Terralib2Qwt(const std::string &title)
Definition: Utils.cpp:1035
A class used to define the style of a scatter's chart.
void setSize(ParameterValue *value)
The Size element gives the absolute size of the graphic in uoms encoded as a floating-point number...
Definition: Graphic.cpp:114
void setFill(Fill *f)
Definition: Mark.cpp:108
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
te::se::Graphic * m_graphic
The graphic used to edit the symbol's style.
Definition: ScatterStyle.h:157
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
void setStroke(te::se::Stroke *newStroke)
It sets the scatter point's stroke.
void add(ExternalGraphic *g)
Graphics can either be referenced from an external URL in a common format (such as GIF or SVG)...
Definition: Graphic.cpp:59
void setMark(te::se::Mark *newMark)
It sets the he scatter's mark.
QwtSymbol * getSymbol()
Returns a pointer to a QwtSymbol representing the current scatter's point style.
This file contains a set of utility chart functions.
te::se::Fill * getFill()
Returns a copy of the pointer to the scatter point's fill.
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
ScatterStyle * clone()
Returns a pointer to a clone of this ScatterStyle.
Fill * clone() const
It creates a new copy of this object.
Definition: Fill.cpp:86
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:67
void setFill(te::se::Fill *newFill)
It sets the scatter point's fill.
void setStroke(Stroke *s)
Definition: Mark.cpp:119
Mark * clone() const
It creates a new copy of this object.
Definition: Mark.cpp:130
void setWellKnownName(std::string *name)
The WellKnownName element gives the well-known name of the shape of the mark.
Definition: Mark.cpp:54
This file contains a class that specialize the QwtSymbol to draw a Terralib Mark. ...