43 m_to(route->getEndNode()),
44 m_from(route->getStartNode()),
45 m_cellCache(m_from.getLayer()->getCellCache()),
46 m_startCoordInt(m_cellCache->convertCoordToInt(m_from.getLayerCoordinates())),
47 m_destCoordInt(m_cellCache->convertCoordToInt(m_to.getLayerCoordinates())),
52 m_spt.resize(max_index, -1);
53 m_sf.resize(max_index, -1);
87 bool zLimited = maxZ != -1;
90 const std::vector<Cell*>& adjacents = nextCell->
getNeighbors();
91 for (std::vector<Cell*>::const_iterator i = adjacents.begin(); i != adjacents.end(); ++i) {
95 if ((*i)->getLayer()->getCellCache() !=
m_cellCache) {
98 int32_t adjacentInt = (*i)->getCellId();
99 if (
m_sf[adjacentInt] != -1 &&
m_spt[adjacentInt] != -1) {
102 if (zLimited &&
ABS(cellZ-(*i)->getLayerCoordinates().z) > maxZ) {
105 bool blocker = (*i)->getCellType() > blockerThreshold;
119 Location adjacentLoc((*i)->getLayer());
124 std::vector<ModelCoordinate>::iterator coord_it = coords.begin();
125 for (; coord_it != coords.end(); ++coord_it) {
137 bool sameAreas =
false;
139 std::list<std::string>::const_iterator area_it = areas.begin();
140 for (; area_it != areas.end(); ++area_it) {
159 }
else if (limitedArea) {
161 bool sameAreas =
false;
163 std::list<std::string>::const_iterator area_it = areas.begin();
164 for (; area_it != areas.end(); ++area_it) {
182 if (
m_sf[adjacentInt] == -1) {
186 }
else if (gCost <
m_gCosts[adjacentInt] &&
m_spt[adjacentInt] == -1) {
201 path.push_back(newnode);
202 while(current != end) {
203 if (
m_spt[current] < 0 ) {
209 current =
m_spt[current];
211 newnode.setLayerCoordinates(currentCoord);
212 path.push_front(newnode);
virtual std::vector< ModelCoordinate > toMultiCoordinates(const ModelCoordinate &position, const std::vector< ModelCoordinate > &orig, bool reverse=false)=0
Returns point vector with coordinates for a multi object.
int32_t m_destCoordInt
The destination coordinate as an int32_t.
PriorityQueue< int32_t, double > m_sortedfrontier
Priority queue to hold nodes on the sf in order.
int32_t getAngleBetween(const Location &loc1, const Location &loc2)
Gets angle of vector defined by given locations.
void setLayerCoordinates(const ModelCoordinate &coordinates)
Sets "cell precise" layer coordinates to this location.
int32_t m_next
The next coordinate to check out.
void setSearchStatus(const SearchStatus status)
Sets the current status of the search.
int32_t getMaxIndex() const
Returns the number of cells on this CellCache.
void setExactLayerCoordinates(const ExactModelCoordinate &coordinates)
Sets precise layer coordinates to this location.
std::list< Location > Path
A path is a list with locations. Each location holds the coordinate for one cell. ...
int32_t getZStepRange()
Returns z-step range from object.
bool empty(void) const
Determines whether the queue is currently empty.
Layer * getLayer()
Returns the current layer.
Location m_from
A location object representing where the search ended.
bool isCellInArea(const std::string &id, Cell *cell)
Returns true if cell is part of the area, otherwise false.
void setRouteStatus(RouteStatusInfo status)
Sets route status.
Layer * getLayer()
Returns layer.
int32_t m_startCoordInt
The start coordinate as an int32_t.
bool m_specialCost
Indicates if the search should use special costs.
std::vector< int32_t > m_spt
The shortest path tree.
void pushElement(const value_type &element)
Pushes a new element onto the queue.
CellCache * m_cellCache
A pointer to the CellCache.
const std::list< std::string > getLimitedAreas()
void updateSearch()
Updates the search.
double getAdjacentCost(const ModelCoordinate &adjacent, const ModelCoordinate &next)
Returns cost for movement between these two adjacent coordinates.
void setPath(const Path &path)
Sets the path for the route.
Location m_to
A location object representing where the search started.
virtual double getHeuristicCost(const ModelCoordinate &curpos, const ModelCoordinate &target)=0
Returns distance const from curpos to target point.
Cell * getCell(const ModelCoordinate &mc)
Returns cell on this coordinate.
std::vector< Cell * > m_ignoredBlockers
Blockers from a multi cell object which should be ignored.
CellTypeInfo getCellType()
Returns blocker type.
bool m_ignoreDynamicBlockers
Indicates if dynamic blockers should be ignored.
const ModelCoordinate getLayerCoordinates() const
Returns the layer coordinates of this cell.
const value_type getPriorityElement(void) const
Retrieves the element with the highest priority.
const std::vector< Cell * > & getNeighbors()
Returns the layer coordinates of this cell.
ExactModelCoordinate & getExactLayerCoordinatesRef()
Gets reference to exact layer coordinates.
A basic cell on a CellCache.
ModelCoordinate convertIntToCoord(const int32_t cell) const
Convertes unique identifier to coordinate.
void calcPath()
Calculates final path.
CellGrid * getCellGrid() const
Get the Cellgrid.
void popElement(void)
Pops the element with the highest priority from the queue.
RoutePatherSearch using A*.
SingleLayerSearch(Route *route, const int32_t sessionId)
Constructor.
DoublePoint intPt2doublePt(Point pt)
Convert from 2D int32_t point to 2D double point.
const std::string & getCostId()
Returns cost identifier which is used for pathfinding.
bool changeElementPriority(const index_type &index, const priority_type &newPriority)
Changes the priority of an element.
std::vector< ModelCoordinate > getOccupiedCells(int32_t rotation)
Returns relative coordinates for multi cell object based on rotation.
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
bool m_multicell
Indicates if the route is for a multi cell object.
~SingleLayerSearch()
Destructor.
std::vector< int32_t > m_sf
The search frontier.
A pq which stores index-value pairs for elements.
Route * m_route
Pointer to route.
std::vector< double > m_gCosts
A table to hold the costs.