All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ItemModelObservable.h
Go to the documentation of this file.
1 /* Copyright (C) 2014-2014 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 ItemModelObservable.h
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 #ifndef __TERRALIB_LAYOUT_INTERNAL_ITEM_MODEL_H
29 #define __TERRALIB_LAYOUT_INTERNAL_ITEM_MODEL_H
30 
31 // TerraLib
32 #include "Observable.h"
33 
34 // STL
35 #include <set>
36 
37 namespace te
38 {
39  namespace layout
40  {
41  class Observer;
42  class SharedProperties;
43 
45  {
46  public:
48  virtual ~ItemModelObservable();
49 
50  virtual bool addObserver(Observer* o);
51  virtual bool removeObserver(Observer* o);
52  virtual Properties* getProperties() const;
53 
55  virtual void setType(LayoutAbstractObjectType type);
56 
57  virtual te::gm::Envelope getBox();
58  virtual void setBox(te::gm::Envelope box);
59 
60  virtual void setBackgroundColor(te::color::RGBAColor color);
62  virtual void setBorderColor(te::color::RGBAColor color);
64 
65  virtual void setName(std::string name);
66  virtual std::string getName();
67 
68  virtual int getId();
69  virtual void setId(int id);
70 
71  virtual void setPosition(const double& x, const double& y);
72  virtual void draw( ContextItem context ) = 0;
73 
74  virtual bool contains(const te::gm::Coord2D &coord) const;
75 
76  virtual void updateProperties(te::layout::Properties* properties);
77 
78  virtual int getZValue();
79 
80  virtual void setZValue(int zValue);
81 
82  virtual bool isBorder();
83 
84  virtual void setBorder(bool value);
85 
86  /* Resize Box */
87  virtual void resize(double w, double h);
88 
89  protected:
90  virtual void notifyAll(ContextItem context);
91 
92  protected:
93  std::set<Observer*> m_observers;
94  int m_id;
101  int m_zValue;
103  bool m_border;
104 
105  private:
106  std::string m_name;
107  };
108  }
109 }
110 
111 #endif
virtual void setPosition(const double &x, const double &y)
virtual void setType(LayoutAbstractObjectType type)
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
virtual void updateProperties(te::layout::Properties *properties)
virtual void setBorder(bool value)
virtual te::color::RGBAColor getBorderColor()
virtual void notifyAll(ContextItem context)
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
virtual void setZValue(int zValue)
virtual void setBackgroundColor(te::color::RGBAColor color)
std::set< Observer * > m_observers
virtual LayoutAbstractObjectType getType()
te::color::RGBAColor m_backgroundColor
virtual void setName(std::string name)
virtual te::color::RGBAColor getBackgroundColor()
LayoutAbstractObjectType
Enum TdkAbstractComponentType. This is the enumeration of the components types.
Definition: AbstractType.h:38
virtual Properties * getProperties() const
virtual void draw(ContextItem context)=0
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
virtual bool addObserver(Observer *o)
LayoutAbstractObjectType m_type
virtual te::gm::Envelope getBox()
virtual void resize(double w, double h)
virtual void setBorderColor(te::color::RGBAColor color)
virtual bool contains(const te::gm::Coord2D &coord) const
virtual void setBox(te::gm::Envelope box)
virtual bool removeObserver(Observer *o)