FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
SingleLayerSearch using A*. More...
#include <singlelayersearch.h>
Public Member Functions | |
SingleLayerSearch (Route *route, const int32_t sessionId) | |
Constructor. More... | |
~SingleLayerSearch () | |
Destructor. More... | |
void | updateSearch () |
Updates the search. More... | |
void | calcPath () |
Calculates final path. More... | |
Public Member Functions inherited from FIFE::RoutePatherSearch | |
RoutePatherSearch (Route *route, const int32_t sessionId) | |
Constructor. More... | |
virtual | ~RoutePatherSearch () |
int32_t | getSessionId () const |
Retrieves the session id. More... | |
int32_t | getSearchStatus () const |
A small function which returns the current status of the search. More... | |
Route * | getRoute () |
Returns the associated route for this search. More... | |
Private Attributes | |
Location | m_to |
A location object representing where the search started. More... | |
Location | m_from |
A location object representing where the search ended. More... | |
CellCache * | m_cellCache |
A pointer to the CellCache. More... | |
int32_t | m_startCoordInt |
The start coordinate as an int32_t. More... | |
int32_t | m_destCoordInt |
The destination coordinate as an int32_t. More... | |
int32_t | m_next |
The next coordinate to check out. More... | |
std::vector< int32_t > | m_spt |
The shortest path tree. More... | |
std::vector< int32_t > | m_sf |
The search frontier. More... | |
std::vector< double > | m_gCosts |
A table to hold the costs. More... | |
PriorityQueue< int32_t, double > | m_sortedfrontier |
Priority queue to hold nodes on the sf in order. More... | |
Additional Inherited Members | |
Public Types inherited from FIFE::RoutePatherSearch | |
enum | SearchStatus { search_status_failed, search_status_complete, search_status_incomplete } |
An enumeration of the different status the search can be in. More... | |
Protected Member Functions inherited from FIFE::RoutePatherSearch | |
void | setSearchStatus (const SearchStatus status) |
Sets the current status of the search. More... | |
Protected Attributes inherited from FIFE::RoutePatherSearch | |
Route * | m_route |
Pointer to route. More... | |
bool | m_specialCost |
Indicates if the search should use special costs. More... | |
bool | m_multicell |
Indicates if the route is for a multi cell object. More... | |
bool | m_ignoreDynamicBlockers |
Indicates if dynamic blockers should be ignored. More... | |
std::vector< Cell * > | m_ignoredBlockers |
Blockers from a multi cell object which should be ignored. More... | |
SingleLayerSearch using A*.
Definition at line 44 of file singlelayersearch.h.
FIFE::SingleLayerSearch::SingleLayerSearch | ( | Route * | route, |
const int32_t | sessionId | ||
) |
Constructor.
route | A pointer to the route for which a path should be searched. |
sessionId | A integer containing the session id for this search. |
Definition at line 41 of file singlelayersearch.cpp.
References FIFE::CellCache::getMaxIndex(), m_cellCache, m_gCosts, m_sf, m_sortedfrontier, m_spt, m_startCoordInt, and FIFE::PriorityQueue< index_type, priority_type >::pushElement().
FIFE::SingleLayerSearch::~SingleLayerSearch | ( | ) |
Destructor.
Definition at line 57 of file singlelayersearch.cpp.
|
virtual |
Calculates final path.
If the search is successful then a path is created.
Implements FIFE::RoutePatherSearch.
Definition at line 194 of file singlelayersearch.cpp.
References FIFE::CellCache::convertIntToCoord(), FIFE::Location::getExactLayerCoordinatesRef(), FIFE::CellCache::getLayer(), FIFE::Location::getLayerCoordinates(), FIFE::intPt2doublePt(), m_cellCache, m_destCoordInt, m_from, FIFE::RoutePatherSearch::m_route, m_spt, m_startCoordInt, m_to, FIFE::ROUTE_FAILED, FIFE::RoutePatherSearch::search_status_failed, FIFE::Location::setExactLayerCoordinates(), FIFE::Route::setPath(), FIFE::Route::setRouteStatus(), and FIFE::RoutePatherSearch::setSearchStatus().
|
virtual |
Updates the search.
Each update checks all neighbors of the last checked coordinate and selects the most favorable.
Implements FIFE::RoutePatherSearch.
Definition at line 60 of file singlelayersearch.cpp.
References ABS, FIFE::PriorityQueue< index_type, priority_type >::changeElementPriority(), FIFE::CellCache::convertIntToCoord(), FIFE::PriorityQueue< index_type, priority_type >::empty(), FIFE::CellCache::getAdjacentCost(), FIFE::getAngleBetween(), FIFE::CellCache::getCell(), FIFE::Layer::getCellGrid(), FIFE::Cell::getCellType(), FIFE::Route::getCostId(), FIFE::CellGrid::getHeuristicCost(), FIFE::CellCache::getLayer(), FIFE::Cell::getLayer(), FIFE::Location::getLayerCoordinates(), FIFE::Cell::getLayerCoordinates(), FIFE::Route::getLimitedAreas(), FIFE::Cell::getNeighbors(), FIFE::Route::getOccupiedCells(), FIFE::PriorityQueue< index_type, priority_type >::getPriorityElement(), FIFE::Route::getZStepRange(), FIFE::Route::isAreaLimited(), FIFE::CellCache::isCellInArea(), m_cellCache, m_destCoordInt, m_gCosts, FIFE::RoutePatherSearch::m_ignoredBlockers, FIFE::RoutePatherSearch::m_ignoreDynamicBlockers, FIFE::RoutePatherSearch::m_multicell, m_next, FIFE::RoutePatherSearch::m_route, m_sf, m_sortedfrontier, FIFE::RoutePatherSearch::m_specialCost, m_spt, m_to, FIFE::PriorityQueue< index_type, priority_type >::popElement(), FIFE::PriorityQueue< index_type, priority_type >::pushElement(), FIFE::ROUTE_FAILED, FIFE::ROUTE_SEARCHED, FIFE::RoutePatherSearch::search_status_complete, FIFE::RoutePatherSearch::search_status_failed, FIFE::Location::setLayerCoordinates(), FIFE::Route::setRouteStatus(), FIFE::RoutePatherSearch::setSearchStatus(), FIFE::CellGrid::toMultiCoordinates(), and FIFE::PointType3D< T >::z.
|
private |
A pointer to the CellCache.
Definition at line 77 of file singlelayersearch.h.
Referenced by calcPath(), SingleLayerSearch(), and updateSearch().
|
private |
The destination coordinate as an int32_t.
Definition at line 83 of file singlelayersearch.h.
Referenced by calcPath(), and updateSearch().
|
private |
A location object representing where the search ended.
Definition at line 74 of file singlelayersearch.h.
Referenced by calcPath().
|
private |
A table to hold the costs.
Definition at line 95 of file singlelayersearch.h.
Referenced by SingleLayerSearch(), and updateSearch().
|
private |
The next coordinate to check out.
Definition at line 86 of file singlelayersearch.h.
Referenced by updateSearch().
|
private |
The search frontier.
Definition at line 92 of file singlelayersearch.h.
Referenced by SingleLayerSearch(), and updateSearch().
|
private |
Priority queue to hold nodes on the sf in order.
Definition at line 98 of file singlelayersearch.h.
Referenced by SingleLayerSearch(), and updateSearch().
|
private |
The shortest path tree.
Definition at line 89 of file singlelayersearch.h.
Referenced by calcPath(), SingleLayerSearch(), and updateSearch().
|
private |
The start coordinate as an int32_t.
Definition at line 80 of file singlelayersearch.h.
Referenced by calcPath(), and SingleLayerSearch().
|
private |
A location object representing where the search started.
Definition at line 71 of file singlelayersearch.h.
Referenced by calcPath(), and updateSearch().