All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbstractBuildGraphicsItem.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 AbstractBuildGraphicsItem.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
31 #include "property/Property.h"
32 #include "property/Properties.h"
33 
35  m_sharedProps(0),
36  m_props(0),
37  m_zValue(0),
38  m_id(0)
39 {
41 }
42 
44 {
45  if(m_sharedProps)
46  {
47  delete m_sharedProps;
48  m_sharedProps = 0;
49  }
50 }
51 
53 {
54  /* Coordinate - x1, y1*/
55 
56  double x1 = 0;
57  double y1 = 0;
58 
59  Property pro_x1 = props->contains(m_sharedProps->getX1());
60 
61  if(!pro_x1.isNull())
62  {
63  x1 = pro_x1.getValue().toDouble();
64  }
65 
66  Property pro_y1 = props->contains(m_sharedProps->getY1());
67 
68  if(!pro_y1.isNull())
69  {
70  y1 = pro_y1.getValue().toDouble();
71  }
72 
73  te::gm::Coord2D coord(x1, y1);
74  return coord;
75 }
76 
78 {
79  int zValue = 0;
80 
81  Property pro_zValue = props->contains(m_sharedProps->getZValue());
82 
83  if(!pro_zValue.isNull())
84  {
85  zValue = pro_zValue.getValue().toInt();
86  }
87 
88  return zValue;
89 }
90 
92 {
93  m_id = 0;
94  m_zValue = 0;
95  m_props = 0;
96 }
virtual void clear()
Clear all configuration for create or build a graphic object.
virtual te::gm::Coord2D findCoordinate(te::layout::Properties *props)
Search for property of a graphic object that represent the x,y coordinate.
Variant getValue()
Returns stored value.
Definition: Property.cpp:72
Abstract class for build graphics MVC components.
bool isNull()
Returns true if no value has been set, false otherwise.
Definition: Property.cpp:146
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
Definition: Properties.h:52
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
SharedProperties * m_sharedProps
Default properties of all graphics objects.
double toDouble()
Returns the value of double type. (The setValue method received a double)
Definition: Variant.cpp:316
virtual int findZValue(te::layout::Properties *props)
Search for property of a graphic object that represent Z Value.
Default properties of all graphics objects.
The Properties class represents a persistent set of properties. The Properties can be saved to a file...
virtual bool contains(Property property)
Checks if the property is contained within the set of properties.
Definition: Properties.h:251
A property acts like a attribute member of a object and stores the state of this attribute. A set of properties stores the state of an object. Any data type, not included in the convertValue method in the class te::layout::Variant, it will be by default "std::string" value.
Definition: Property.h:47
int toInt()
Returns the value of int type. (The setValue method received a int)
Definition: Variant.cpp:321