CSCI3081W Drone Delivery System
IEntity.h
1 #ifndef ENTITY_H_
2 #define ENTITY_H_
3 
4 #include <vector>
5 
6 #include "Graph.h"
7 #include "IPublisher.h"
8 #include "math/vector3.h"
9 #include "util/json.h"
10 
11 class SimulationModel;
12 
22 class IEntity : public IPublisher {
23  public:
28 
33  IEntity(const JsonObject& details);
34 
38  virtual ~IEntity();
39 
46  virtual void linkModel(SimulationModel* model);
47 
52  virtual int getId() const;
53 
58  virtual Vector3 getPosition() const;
59 
64  virtual Vector3 getDirection() const;
65 
70  virtual const JsonObject& getDetails() const;
71 
76  virtual std::string getColor() const;
77 
82  virtual std::string getName() const;
83 
88  virtual double getSpeed() const;
89 
94  virtual void setPosition(Vector3 pos_);
95 
100  virtual void setDirection(Vector3 dir_);
101 
106  virtual void setColor(std::string col_);
107 
112  virtual void rotate(double angle);
113 
118  virtual void update(double dt) = 0;
119 
120  virtual SimulationModel* getModel() const;
121 
122  protected:
123  SimulationModel* model = nullptr;
124  int id = -1;
125  JsonObject details;
126  Vector3 position;
127  Vector3 direction;
128  std::string color;
129  std::string name;
130  double speed = 0;
131 };
132 
133 #endif
Represents an entity in a physical system.
Definition: IEntity.h:22
virtual Vector3 getDirection() const
Gets the direction of the entity.
virtual std::string getColor() const
Gets the color of the entity.
virtual const JsonObject & getDetails() const
Gets the details of the entity.
virtual int getId() const
Gets the ID of the entity.
virtual std::string getName() const
Gets the name of the entity.
virtual Vector3 getPosition() const
Gets the position of the entity.
virtual void setPosition(Vector3 pos_)
Sets the position of the entity.
virtual ~IEntity()
Virtual destructor for IEntity.
virtual void linkModel(SimulationModel *model)
Links this entity to a simulation model, giving it access to the model's public variables and functio...
virtual void setColor(std::string col_)
Sets the color of the entity.
virtual void update(double dt)=0
Updates the entity's position in the physical system.
virtual double getSpeed() const
Gets the speed of the entity.
virtual void setDirection(Vector3 dir_)
Set the direction of the entity.
IEntity()
Constructor that assigns a unique ID to the entity.
virtual void rotate(double angle)
Rotate the entity around y axis.
IEntity(const JsonObject &details)
Constructor with JsonObject details to define the entity.
Interface for Publisher.
Definition: IPublisher.h:13
Manages a picojson::object, works with JsonValue to provide implicit casting.
Class SimulationModel handling the transit simulation. it can communicate with the controller.
Definition: SimulationModel.h:30
a simple class used for vector math, most function are self explanatory
Definition: vector3.h:12