44 m_coordinate(coordinate),
58 (*it)->onCellDeleted(
this);
76 for (std::list<Instance*>::const_iterator it = instances.begin(); it != instances.end(); ++it) {
77 std::pair<std::set<Instance*>::iterator,
bool> ret =
m_instances.insert(*it);
79 if ((*it)->isSpecialCost()) {
80 cache->
registerCost((*it)->getCostId(), (*it)->getCost());
83 if ((*it)->isSpecialSpeed()) {
86 if ((*it)->getObject()->getArea() !=
"") {
96 std::pair<std::set<Instance*>::iterator,
bool> ret =
m_instances.insert(instance);
120 FL_ERR(
_log,
"Tried to remove an instance from cell, but given instance could not be found.");
131 std::set<Instance*>::iterator it =
m_instances.begin();
133 if ((*it)->isSpecialSpeed()) {
148 std::vector<Cell*>::iterator it =
m_neighbors.begin();
167 uint8_t stackpos = (*it)->getCellStackPosition();
168 if (stackpos < pos) {
172 if (
m_coordinate.
z < (*it)->getLocationRef().getLayerCoordinates().z && (*it)->getObject()->isStatic()) {
173 m_coordinate.
z = (*it)->getLocationRef().getLayerCoordinates().z;
175 if ((*it)->getCellStackPosition() > pos) {
176 pos = (*it)->getCellStackPosition();
177 if ((*it)->isBlocking()) {
178 if (!(*it)->getObject()->isStatic()) {
189 if (!(*it)->getObject()->isStatic()) {
366 std::vector<Cell*>::iterator it =
m_neighbors.begin();
391 if (*it == listener) {
399 std::vector<Cell*>::iterator it =
m_neighbors.begin();
415 if (*it == listener) {
430 (*i)->onInstanceEnteredCell(
this, instance);
444 (*i)->onInstanceExitedCell(
this, instance);
458 (*i)->onBlockingChangedCell(
this,
m_type, blocks);
void setZoneProtected(bool protect)
Mark zone on this cell as protected.
double getSpeedMultiplier(Cell *cell)
Returns speed multiplier for the cell.
std::string getCostId()
Returns cost id.
double getCostMultiplier()
Returns the current cell cost.
Layer * m_layer
target layer
double getCostMultiplier(Cell *cell)
Returns cost multiplier for the cell.
bool isNeighbor(Cell *cell)
Called to check if given cell is a neighbor.
std::vector< CellChangeListener * > m_changeListeners
change listener
void setSpeedMultiplier(Cell *cell, double multi)
Sets speed multiplier for the cell.
bool m_difflayer
is target on another layer
void callOnInstanceEntered(Instance *instance)
Called when a instance entered this cell.
void addInstance(Instance *instance)
Adds a instance to this cell.
static const double MIN_CELL_Z
Layer * getLayer()
Returns the current layer.
bool isDefaultSpeed(Cell *cell)
Gets if cell uses default speed multiplier.
void removeTransition(Cell *cell)
Removes a cell as transition.
double getSpeedMultiplier()
Returns the current cell speed.
void callOnInstanceExited(Instance *instance)
Called when a instance exited this cell.
Listener interface for changes happening on a cell.
std::set< Instance * > m_instances
void removeCellFromCost(Cell *cell)
Removes a cell from costs.
bool isSpecialSpeed()
Returns true if instance or object have special speed modifier otherwise false.
A CellCache is an abstract depiction of one or a few layers and contains additional information...
void setSpeedMultiplier(double multi)
Changes the cell speed.
void addCellToCost(const std::string &costId, Cell *cell)
Assigns a cell to a cost identifier.
bool isDefaultCost(Cell *cell)
Gets if cell uses default cost multiplier.
CellCache * getCellCache()
Returns the CellCache of this layer.
void setCellType(CellTypeInfo type)
Sets blocker type.
void setBlockingUpdate(bool update)
static Logger _log(LM_AUDIO)
void addInstances(const std::list< Instance *> &instances)
Adds instances to this cell.
void registerCost(const std::string &costId, double cost)
Adds a cost with the given id and value.
void removeInstance(Instance *instance)
Removes a instance from this cell.
int32_t getCellId()
Returns the cell identifier.
void resetSpeedMultiplier(Cell *cell)
Resets the speed multiplier for the cell.
void addChangeListener(CellChangeListener *listener)
Adds new cell change listener.
bool defaultCost()
Returns if cell use default cost.
void resetCostMultiplier()
Resets the cell cost to default, 1.0.
void removeCell(Cell *cell)
Removes a cell from this zone.
void deleteTransition()
Removes the transistion from Cell and CellCache.
bool isSpecialCost()
Returns true if instance or object have special cost otherwise false.
void onCellDeleted(Cell *cell)
Called when a cell gets deleted on this cell.
void removeCellFromArea(Cell *cell)
Removes the cell from all areas.
std::string getArea() const
Gets the area id that the instances of this object adds to their cells.
#define FL_ERR(logger, msg)
Listener interface for deletions happening on a cell, used for transistions.
void setZone(Zone *zone)
Sets zone.
Simple class to hold the data for transistions.
void addNeighbor(Cell *cell)
Adds a neighbor cell to this cell.
int32_t m_coordId
holds coordinate as a unique integer id
static bool Equal(T _val1, T _val2)
Object * getObject()
Gets object where this instance is instantiated from.
Cell * getCell(const ModelCoordinate &mc)
Returns cell on this coordinate.
const std::set< Instance * > & getInstances()
Returns all instances on this cell.
bool isZoneProtected()
Returns whether the zone on this cell is protected.
CellTypeInfo getCellType()
Returns blocker type.
TransitionInfo * m_transition
Pointer to Transistion.
Layer * m_layer
parent layer
const ModelCoordinate getLayerCoordinates() const
Returns the layer coordinates of this cell.
const std::vector< Cell * > & getNeighbors()
Returns the layer coordinates of this cell.
void removeDeleteListener(CellDeleteListener *listener)
Removes cell delete listener.
A basic cell on a CellCache.
void updateCellInfo()
Called to update cell data.
Cell(int32_t coordint, ModelCoordinate coordinate, Layer *layer)
Constructor.
void changeInstance(Instance *instance)
Changes a instance on this cell.
Zone * getZone()
Returns zone.
void updateCellBlockingInfo()
void addCellToArea(const std::string &id, Cell *cell)
Adds a cell to a specific area group.
void setCellId(int32_t id)
Sets the cell identifier.
void setCostMultiplier(double multi)
Changes the cell cost.
ModelCoordinate m_coordinate
holds coordinate
CellTypeInfo m_type
CellType.
double getCost()
Returns cost value.
void setInserted(bool inserted)
Mark cell as inserted.
void removeCell(Cell *cell)
Removes cell from CellCache.
std::vector< Cell * > m_neighbors
neighbor cells
void createTransition(Layer *layer, const ModelCoordinate &mc, bool immediate=false)
Creates a transistion from this cell to the given layer and coordinates.
void resetNeighbors()
Removes all neighbors from cell.
std::vector< CellDeleteListener * > m_deleteListeners
delete listener
bool m_inserted
already inserted
void addTransition(Cell *cell)
Adds a cell as transition.
TransitionInfo * getTransition()
Returns the transition.
bool isInserted()
Returns whether the cell is part of a zone.
bool defaultSpeed()
Returns if cell use default speed.
void addDeleteListener(CellDeleteListener *listener)
Adds new cell delete listener.
void resetZone()
Resets zone.
An Instance is an "instantiation" of an Object at a Location.
bool m_immediate
use immediate
void resetCostMultiplier(Cell *cell)
Resets the cost multiplier for the cell.
A Zone is an abstract depiction of a CellCache or of a part of it.
ModelCoordinate m_mc
target coordinates
void removeChangeListener(CellChangeListener *listener)
Removes cell change listener.
void setCostMultiplier(Cell *cell, double multi)
Sets cost multiplier for the cell.
void callOnBlockingChanged(bool blocks)
Called when the blocking property of this cell changed.
double getSpeed()
Returns speed modifier.
void resetSpeedMultiplier()
Resets the cell speed to default, 1.0.