Fire Core  8.0.0.alpha
GIS framework per tutti gli usi
 Tutto Classi Namespace Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Friend
Entity.hpp
1 // Copyright 2015 GEOSYSTEMS SRL
2 // All Rights Reserved.
3 
4 #ifndef FIRE_GEAR_ENTITY_HPP_INCLUDED
5 #define FIRE_GEAR_ENTITY_HPP_INCLUDED
6 
7 #include <vector>
8 
9 #include "fire/export.hpp"
10 
11 #include "fire/gear/event/EntityEvent.hpp"
12 #include "fire/gear/geom/GeometryType.hpp"
13 #include "fire/gear/geom/event/GeometryEventListener.hpp"
14 
15 namespace fire {
16 namespace gear {
17 namespace geom {
18 class Geometry;
19 class Envelope;
20 } // namespace geom
21 } // namespace gear
22 } // namespace fire
23 
30 namespace fire {
37 namespace gear {
44 class FIRE_ENGINE_DLL Entity : public fire::Object {
45  private:
52  class GeometryEventListener : public geom::event::GeometryEventListener {
53  private:
60  gear::event::EntityEvent* _entityEvent;
61 
62  public:
74  explicit GeometryEventListener(gear::event::EntityEvent* entityEvent) {
75  try {
76  _entityEvent = entityEvent;
77  } catch (const std::exception& exception) {
78  throw;
79  }
80  }
92  void handle(const geom::event::GeometryEvent& geometryEvent) {
93  try {
94  switch (geometryEvent.getType()) {
95  case geom::event::GeometryEventType::Unknown:
96  case geom::event::GeometryEventType::AfterDestroy: {
97  _entityEvent->raise(gear::event::EntityEventType::Unknown);
98  break;
99  }
100  case geom::event::GeometryEventType::BeforeUpdate: {
101  _entityEvent->raise(gear::event::EntityEventType::BeforeUpdate);
102  break;
103  }
104  case geom::event::GeometryEventType::AfterUpdate: {
105  _entityEvent->raise(gear::event::EntityEventType::AfterUpdate);
106  break;
107  }
108  case geom::event::GeometryEventType::BeforeDestroy: {
109  _entityEvent->raise(gear::event::EntityEventType::BeforeDestroy);
110  break;
111  }
112  }
113  } catch (const std::exception& exception) {
114  throw;
115  }
116  }
117  };
118 
119  public:
120  typedef std::vector< geom::Geometry* > vectorGeomType;
127  typedef std::vector< geom::Geometry* >::iterator iterator;
134  typedef std::vector< geom::Geometry* >::const_iterator const_iterator;
141  typedef std::vector< geom::Geometry* >::reverse_iterator reverse_iterator;
148  typedef std::vector< geom::Geometry* >::const_reverse_iterator const_reverse_iterator;
149 
150  private:
157  vectorGeomType _geometriesVector;
164  gear::event::EntityEvent _entityEvent;
171  std::auto_ptr< GeometryEventListener > _geometryEventListener;
178  void clearGeometry();
179 
180  protected:
192  void addGeometry(geom::Geometry* geometry);
204  void removeGeometry(geom::Geometry* geometry);
205 
206  public:
213  Entity();
225  Entity(const Entity& entity);
237  Entity& operator=(const Entity& entity);
244  virtual ~Entity();
256  virtual vectorGeomType getGeometries();
268  virtual iterator begin();
269  virtual const_iterator begin() const;
281  virtual iterator end();
282  virtual const_iterator end() const;
294  virtual reverse_iterator rbegin();
295  virtual const_reverse_iterator rbegin() const;
307  virtual reverse_iterator rend();
308  virtual const_reverse_iterator rend() const;
325  virtual geom::Envelope* getEnvelope(int srid);
337  gear::event::EntityEvent& getEvent();
349  virtual geom::GeometryType::GeometryType getGeometryType() const;
350 };
351 } // namespace gear
352 } // namespace fire
353 
354 #endif
Definition: Entity.hpp:44
std::vector< geom::Geometry * >::const_iterator const_iterator
Definition: Entity.hpp:134
Classe per la gestione di un evento di geometria.
Definition: GeometryEvent.hpp:46
Classe per la gestione di un oggetto.
Definition: Object.hpp:29
Definition: Envelope.hpp:31
Classe per la gestione di un eventi di entità
Definition: EntityEvent.hpp:39
GeometryType
Definition: GeometryType.hpp:43
fire::gear::geom::event::GeometryEventType::GeometryEventType getType() const
Restituisce il tipo dell'evento di geometria.
Classe per la gestione di un ascoltare di un evento di geometria.
Definition: GeometryEventListener.hpp:39
Definition: Geometry.hpp:69
std::vector< geom::Geometry * >::const_reverse_iterator const_reverse_iterator
Definition: Entity.hpp:148
std::vector< geom::Geometry * >::iterator iterator
Definition: Entity.hpp:127
std::vector< geom::Geometry * >::reverse_iterator reverse_iterator
Definition: Entity.hpp:141
void raise(fire::gear::event::EntityEventType::EntityEventType type)
Scatena l'evento di entitÃ