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;
88 const std::vector<Cell*>& adjacents = nextCell->
getNeighbors();
89 for (std::vector<Cell*>::const_iterator i = adjacents.begin(); i != adjacents.end(); ++i) {
93 if ((*i)->getLayer()->getCellCache() !=
m_cellCache) {
96 int32_t adjacentInt = (*i)->getCellId();
97 if (
m_sf[adjacentInt] != -1 &&
m_spt[adjacentInt] != -1) {
100 if (zLimited &&
ABS(cellZ-(*i)->getLayerCoordinates().z) > maxZ) {
117 Location adjacentLoc((*i)->getLayer());
121 std::vector<ModelCoordinate> coords = grid-> toMultiCoordinates(adjacentLoc.getLayerCoordinates(),
m_route->
getOccupiedCells(rotation));
122 std::vector<ModelCoordinate>::iterator coord_it = coords.begin();
123 for (; coord_it != coords.end(); ++coord_it) {
142 bool sameAreas =
false;
144 std::list<std::string>::const_iterator area_it = areas.begin();
145 for (; area_it != areas.end(); ++area_it) {
163 if (
m_sf[adjacentInt] == -1) {
167 }
else if (gCost <
m_gCosts[adjacentInt] &&
m_spt[adjacentInt] == -1) {
182 path.push_back(newnode);
183 while(current != end) {
184 if (
m_spt[current] < 0 ) {
190 current =
m_spt[current];
192 newnode.setLayerCoordinates(currentCoord);
193 path.push_front(newnode);
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.
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.
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.
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
const value_type getPriorityElement(void) const
Retrieves the element with the highest priority.
ModelCoordinate convertIntToCoord(const int32_t cell) const
Convertes unique identifier to coordinate.
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.
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.
CellGrid * getCellGrid() const
Get the Cellgrid.
void calcPath()
Calculates final path.
const ModelCoordinate getLayerCoordinates() const
Returns the layer coordinates of this cell.
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.
bool m_multicell
Indicates if the route is for a multi cell object.
~SingleLayerSearch()
Destructor.
std::vector< int32_t > m_sf
The search frontier.
bool empty(void) const
Determines whether the queue is currently empty.
A pq which stores index-value pairs for elements.
Route * m_route
Pointer to route.
int32_t getMaxIndex() const
Returns the number of cells on this CellCache.
std::vector< double > m_gCosts
A table to hold the costs.