Class Connection

Class Documentation

class Connection

This class represents a Connection for semantically representing doorways etc in the higher level JSON.

Public Functions

std::string getID()

Returns the id of this Connection.

Returns:

std::string the id.

std::string getName()

Returns the name of this Connection.

Returns:

std::string the name.

std::string getType()

Returns the type of this Connection.

Returns:

std::string the type.

std::string getBoundType()

Returns the bound type of this Connection.

Returns:

std::string The bound type.

std::vector<std::string> &getConnectedLocations()

Get the vector of ids of the connected locations this object. represents.

Returns:

std::vector<std::string>& The vector of connected locations.

std::vector<Pos> &getCoordinates()

Get the coordinates of this connection as a vector. The number of elements in the vector depends on the type of bound set by the user.

Returns:

std::vector<Pos>& The coordinates vector.

void setID(std::string newID)

Set the id of this connection to a new id.

Parameters:

newID – The new id to set to.

void setName(std::string newName)

Set the name of this connection to a new name.

Parameters:

newName – The new name to set to.

void setType(std::string newType)

Set the type of this connection to a new type.

Parameters:

newType – The new type to set to.

void setBoundType(std::string newBoundType)

Set the bound type of this connection to a new type. Remember to update the coordinates of the bound associated accordingly since no implicit checks are performed.

Parameters:

newBoundType – The new bound type to set to.

void addConnectedLocation(std::string id)

Add the id of a connected location.

Parameters:

id – The id of the location.

void addCoordinates(Pos &pos)

Add a coordinate to the bounds’ coordinate list. Remember to make sure that the number of coordinates you have match the bound type you set.

Parameters:

pos – The coordinate to add.

void addManyConnectedLocations(std::vector<std::string> &idVector)

Add the ids of many connected locations.

Parameters:

idVector – The vector of ids.

void addManyCoordinates(std::vector<Pos> &posVector)

Add many coordinates to the bounds’ coordinate list. Remember to make sure that the number of coordinates you have match the bound type you set.

Parameters:

posVector – The vector of coordinates.

void removeAllConnectedLocation()

Empties the list of connected locations.

void removeAllCoordinates()

Empties the list of coordinates.

virtual void toSemanticMapJSON(nlohmann::json &json_base)

Adds the JSON representation of this object to the “connections” list of the base json.

Returns:

nlohmann::json The base json.

Connection(std::string id, std::string name, std::string type, std::string boundType)

Construct a new Connection object.

Parameters:
  • id – The id for this object.

  • name – The name for the connection and what it represents.

  • type – The type of connection, ex. door.

  • boundType – The type of bound, ex. rectangle.

~Connection()

Destroy the Connection object.