CSCI3081W Drone Delivery System
|
Represents an entity in a physical system. More...
#include <IEntity.h>
Public Member Functions | |
IEntity () | |
Constructor that assigns a unique ID to the entity. | |
IEntity (const JsonObject &details) | |
Constructor with JsonObject details to define the entity. More... | |
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 functions. More... | |
virtual int | getId () const |
Gets the ID of the entity. More... | |
virtual Vector3 | getPosition () const |
Gets the position of the entity. More... | |
virtual Vector3 | getDirection () const |
Gets the direction of the entity. More... | |
virtual const JsonObject & | getDetails () const |
Gets the details of the entity. More... | |
virtual std::string | getColor () const |
Gets the color of the entity. More... | |
virtual std::string | getName () const |
Gets the name of the entity. More... | |
virtual double | getSpeed () const |
Gets the speed of the entity. More... | |
virtual void | setPosition (Vector3 pos_) |
Sets the position of the entity. More... | |
virtual void | setDirection (Vector3 dir_) |
Set the direction of the entity. More... | |
virtual void | setColor (std::string col_) |
Sets the color of the entity. More... | |
virtual void | rotate (double angle) |
Rotate the entity around y axis. More... | |
virtual void | update (double dt)=0 |
Updates the entity's position in the physical system. More... | |
virtual SimulationModel * | getModel () const |
Public Member Functions inherited from IPublisher | |
void | addObserver (const IObserver *o) |
adds an observer to the simulation More... | |
void | removeObserver (const IObserver *o) |
removes an observer in the simulation More... | |
void | notifyObservers (const std::string &message) const |
notifies all observers with a specific message More... | |
Protected Attributes | |
SimulationModel * | model = nullptr |
int | id = -1 |
JsonObject | details |
Vector3 | position |
Vector3 | direction |
std::string | color |
std::string | name |
double | speed = 0 |
Represents an entity in a physical system.
An IEntity object has a unique ID, a position, a direction, a destination, and details. It also has a speed, which determines how fast the entity moves in the physical system. Subclasses of IEntity can override the Update
function to implement their own movement behavior.
IEntity::IEntity | ( | const JsonObject & | details | ) |
Constructor with JsonObject details to define the entity.
details | The JsonObject to define the entity |
|
virtual |
Gets the color of the entity.
Reimplemented in IEntityDecorator< T >.
|
virtual |
Gets the details of the entity.
Reimplemented in IEntityDecorator< T >.
|
virtual |
Gets the direction of the entity.
Reimplemented in IEntityDecorator< T >.
|
virtual |
|
virtual |
|
virtual |
Gets the position of the entity.
Reimplemented in IEntityDecorator< T >.
|
virtual |
Gets the speed of the entity.
Reimplemented in IEntityDecorator< T >.
|
virtual |
Links this entity to a simulation model, giving it access to the model's public variables and functions.
[in] | model | The simulation model to link. |
Reimplemented in IEntityDecorator< T >.
|
virtual |
Rotate the entity around y axis.
angle | The angle to rotate the entity by. |
Reimplemented in IEntityDecorator< T >.
|
virtual |
Sets the color of the entity.
col_ | The new color of the entity |
Reimplemented in IEntityDecorator< T >.
|
virtual |
Set the direction of the entity.
dir_ | The new direction of the entity. |
Reimplemented in IEntityDecorator< T >.
|
virtual |
Sets the position of the entity.
pos_ | The desired position of the entity. |
Reimplemented in IEntityDecorator< T >.
|
pure virtual |
Updates the entity's position in the physical system.
dt | The time step of the update. |
Implemented in Robot, RechargeStation, RechargeDrone, POI, Package, Human, Helicopter, Drone, and IEntityDecorator< T >.