FIFE
|
#include <location.h>
Public Member Functions | |
Location () | |
Default constructor. More... | |
Location (const Location &loc) | |
Copy constructor. More... | |
Location (Layer *layer) | |
Utility constructor. More... | |
~Location () | |
Destructor. More... | |
void | reset () |
Resets location (so that layer and coordinate information becomes invalid) More... | |
Location & | operator= (const Location &rhs) |
Assignment operator. More... | |
bool | operator== (const Location &loc) const |
Compares equality of two locations. More... | |
bool | operator!= (const Location &loc) const |
Compares unequality of two locations. More... | |
Map * | getMap () const |
Gets the map where this location is pointing to. More... | |
void | setLayer (Layer *layer) |
Sets layer where this location is pointing to. More... | |
Layer * | getLayer () const |
Gets the layer where this location is pointing to. More... | |
void | setExactLayerCoordinates (const ExactModelCoordinate &coordinates) |
Sets precise layer coordinates to this location. More... | |
void | setLayerCoordinates (const ModelCoordinate &coordinates) |
Sets "cell precise" layer coordinates to this location. More... | |
void | setMapCoordinates (const ExactModelCoordinate &coordinates) |
Sets map coordinates to this location. More... | |
ExactModelCoordinate & | getExactLayerCoordinatesRef () |
Gets reference to exact layer coordinates. More... | |
ExactModelCoordinate | getExactLayerCoordinates () const |
Gets exact layer coordinates set to this location. More... | |
ExactModelCoordinate | getExactLayerCoordinates (const Layer *layer) const |
Gets exact layer coordinates of this location mapped on given layer. More... | |
ModelCoordinate | getLayerCoordinates () const |
Gets cell precision layer coordinates set to this location. More... | |
ModelCoordinate | getLayerCoordinates (const Layer *layer) const |
Gets cell precision layer coordinates of this location mapped on given layer. More... | |
ExactModelCoordinate | getMapCoordinates () const |
Gets map coordinates set to this location. More... | |
double | getCellOffsetDistance () const |
Gets offset distance from cell center. More... | |
bool | isValid () const |
Tells if location is valid Location is valid if: More... | |
double | getMapDistanceTo (const Location &location) const |
Gets distance in map coordinates to another location on the Map. More... | |
double | getLayerDistanceTo (const Location &location) const |
Gets layer distance to another location. More... | |
Private Member Functions | |
bool | isValid (const Layer *layer) const |
Private Attributes | |
Layer * | m_layer |
ExactModelCoordinate | m_exact_layer_coords |
Definition at line 41 of file location.h.
FIFE::Location::Location | ( | ) |
FIFE::Location::Location | ( | const Location & | loc | ) |
Copy constructor.
Definition at line 43 of file location.cpp.
References m_exact_layer_coords, m_layer, and reset().
FIFE::Location::Location | ( | Layer * | layer | ) |
FIFE::Location::~Location | ( | ) |
Destructor.
Definition at line 54 of file location.cpp.
double FIFE::Location::getCellOffsetDistance | ( | ) | const |
Gets offset distance from cell center.
Definition at line 157 of file location.cpp.
References m_exact_layer_coords, FIFE::Math< T >::Sqrt(), FIFE::PointType3D< T >::x, and FIFE::PointType3D< T >::y.
ExactModelCoordinate FIFE::Location::getExactLayerCoordinates | ( | ) | const |
Gets exact layer coordinates set to this location.
Definition at line 109 of file location.cpp.
References m_exact_layer_coords.
Referenced by FIFE::Map::addInstanceForTransfer(), FIFE::RoutePather::followRoute(), FIFE::InstanceDistanceSortLocation::operator()(), FIFE::operator<<(), FIFE::Map::update(), and FIFE::Camera::update().
ExactModelCoordinate FIFE::Location::getExactLayerCoordinates | ( | const Layer * | layer | ) | const |
Gets exact layer coordinates of this location mapped on given layer.
NotSet | in the following cases:
|
Definition at line 129 of file location.cpp.
References FIFE::Layer::getCellGrid(), FIFE::INVALID_LAYER_GET, isValid(), m_exact_layer_coords, m_layer, FIFE::CellGrid::toExactLayerCoordinates(), and FIFE::CellGrid::toMapCoordinates().
ExactModelCoordinate & FIFE::Location::getExactLayerCoordinatesRef | ( | ) |
Gets reference to exact layer coordinates.
This means that if you modify the coordinates, location gets modified directly
Definition at line 105 of file location.cpp.
References m_exact_layer_coords.
Referenced by FIFE::SingleLayerSearch::calcPath(), FIFE::MultiLayerSearch::calcPathStep(), FIFE::Layer::getInstancesAt(), FIFE::Camera::getMatchingInstances(), FIFE::Instance::Instance(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), FIFE::InstanceDistanceSortCameraAndLocation::operator()(), and FIFE::Camera::update().
Layer * FIFE::Location::getLayer | ( | ) | const |
Gets the layer where this location is pointing to.
Definition at line 83 of file location.cpp.
References m_layer.
Referenced by FIFE::Map::addInstanceForTransfer(), FIFE::Camera::attach(), FIFE::Instance::bindTimeProvider(), FIFE::Instance::follow(), FIFE::RoutePather::followRoute(), FIFE::getAngleBetween(), FIFE::RendererNode::getCalculatedPoint(), FIFE::Camera::getCellImageDimensions(), FIFE::getFacing(), FIFE::Camera::getMatchingInstances(), FIFE::Camera::getOriginalZToY(), FIFE::Instance::getRuntime(), FIFE::Instance::getTotalTimeMultiplier(), FIFE::Instance::initializeChanges(), FIFE::Instance::Instance(), FIFE::CellCache::isInCellCache(), FIFE::RoutePather::locationsEqual(), FIFE::Instance::move(), FIFE::Instance::processMovement(), FIFE::CellSelectionRenderer::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::RoutePatherSearch::RoutePatherSearch(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), FIFE::Instance::setLocation(), FIFE::Camera::setLocation(), FIFE::RoutePather::solveRoute(), FIFE::Map::update(), FIFE::Camera::update(), FIFE::Instance::InstanceActivity::update(), FIFE::Camera::updateMatrices(), and FIFE::Camera::updateReferenceScale().
ModelCoordinate FIFE::Location::getLayerCoordinates | ( | ) | const |
Gets cell precision layer coordinates set to this location.
Definition at line 113 of file location.cpp.
References FIFE::doublePt2intPt(), and m_exact_layer_coords.
Referenced by FIFE::InstanceTree::addInstance(), FIFE::CoordinateRenderer::adjustLayerArea(), FIFE::SingleLayerSearch::calcPath(), FIFE::CellSelectionRenderer::deselectLocation(), FIFE::Instance::follow(), FIFE::RoutePather::followRoute(), FIFE::Layer::getInstancesAt(), getLayerCoordinates(), getLayerDistanceTo(), FIFE::Camera::getLayerViewPort(), FIFE::Camera::getMatchingInstances(), FIFE::CellCache::isInCellCache(), FIFE::RoutePather::locationsEqual(), FIFE::Instance::move(), FIFE::MultiLayerSearch::MultiLayerSearch(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), FIFE::Instance::processMovement(), FIFE::GridRenderer::render(), FIFE::CellSelectionRenderer::render(), FIFE::BlockingInfoRenderer::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::CellSelectionRenderer::selectLocation(), FIFE::Instance::setLocation(), FIFE::RoutePather::solveRoute(), FIFE::Instance::InstanceActivity::update(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().
ModelCoordinate FIFE::Location::getLayerCoordinates | ( | const Layer * | layer | ) | const |
Gets cell precision layer coordinates of this location mapped on given layer.
Definition at line 143 of file location.cpp.
References FIFE::Layer::getCellGrid(), getLayerCoordinates(), FIFE::INVALID_LAYER_GET, isValid(), m_exact_layer_coords, m_layer, FIFE::CellGrid::toLayerCoordinates(), and FIFE::CellGrid::toMapCoordinates().
double FIFE::Location::getLayerDistanceTo | ( | const Location & | location | ) | const |
Gets layer distance to another location.
location | is the location you want to get the distance to In case location resides on different layer, it is mapped to this layer |
Definition at line 180 of file location.cpp.
References getLayerCoordinates(), m_layer, FIFE::Math< T >::Sqrt(), FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by FIFE::Instance::processMovement(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), and FIFE::MultiLayerSearch::searchBetweenTargetsNeighbor().
Map * FIFE::Location::getMap | ( | ) | const |
Gets the map where this location is pointing to.
Definition at line 72 of file location.cpp.
References FIFE::Layer::getMap(), and m_layer.
Referenced by FIFE::Camera::render(), FIFE::Camera::setLocation(), and FIFE::Camera::updateRenderLists().
ExactModelCoordinate FIFE::Location::getMapCoordinates | ( | ) | const |
Gets map coordinates set to this location.
Definition at line 117 of file location.cpp.
References FIFE::Layer::getCellGrid(), m_exact_layer_coords, m_layer, and FIFE::CellGrid::toMapCoordinates().
Referenced by FIFE::Camera::calculateZValue(), FIFE::RoutePather::followRoute(), FIFE::getAngleBetween(), FIFE::RendererNode::getCalculatedPoint(), FIFE::getFacing(), getMapDistanceTo(), FIFE::Map::getMinMaxCoordinates(), FIFE::Camera::getOriginalZToY(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::Camera::setLocation(), FIFE::Camera::updateMatrices(), FIFE::Instance::updateMultiInstances(), and FIFE::LayerCache::updatePosition().
double FIFE::Location::getMapDistanceTo | ( | const Location & | location | ) | const |
Gets distance in map coordinates to another location on the Map.
location | is the location you want to get the distance to |
Definition at line 169 of file location.cpp.
References getMapCoordinates(), FIFE::Math< T >::Sqrt(), FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
bool FIFE::Location::isValid | ( | ) | const |
Tells if location is valid Location is valid if:
Definition at line 121 of file location.cpp.
References m_layer.
Referenced by getExactLayerCoordinates(), getLayerCoordinates(), setExactLayerCoordinates(), and setMapCoordinates().
|
private |
Definition at line 125 of file location.cpp.
References FIFE::Layer::getCellGrid().
|
inline |
Compares unequality of two locations.
Definition at line 75 of file location.h.
Assignment operator.
Definition at line 64 of file location.cpp.
References m_exact_layer_coords, m_layer, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
|
inline |
Compares equality of two locations.
Definition at line 69 of file location.h.
References m_exact_layer_coords, and m_layer.
void FIFE::Location::reset | ( | ) |
Resets location (so that layer and coordinate information becomes invalid)
Definition at line 57 of file location.cpp.
References m_exact_layer_coords, m_layer, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by Location().
void FIFE::Location::setExactLayerCoordinates | ( | const ExactModelCoordinate & | coordinates | ) |
Sets precise layer coordinates to this location.
NotSet | in the following cases:
|
coordinates | coordinates to set |
Definition at line 87 of file location.cpp.
References FIFE::INVALID_LAYER_SET, isValid(), and m_exact_layer_coords.
Referenced by FIFE::Layer::addInstance(), FIFE::Map::addInstanceForTransfer(), FIFE::SingleLayerSearch::calcPath(), FIFE::Layer::createInstance(), FIFE::Map::getMinMaxCoordinates(), setLayerCoordinates(), and FIFE::Instance::updateMultiInstances().
void FIFE::Location::setLayer | ( | Layer * | layer | ) |
Sets layer where this location is pointing to.
layer | layer to set |
Definition at line 79 of file location.cpp.
References m_layer.
Referenced by FIFE::Layer::addInstance(), FIFE::Map::addInstanceForTransfer(), FIFE::Camera::Camera(), FIFE::RoutePather::followRoute(), FIFE::CoordinateRenderer::render(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), and FIFE::MultiLayerSearch::searchBetweenTargetsNeighbor().
void FIFE::Location::setLayerCoordinates | ( | const ModelCoordinate & | coordinates | ) |
Sets "cell precise" layer coordinates to this location.
NotSet | in the following cases:
|
Definition at line 94 of file location.cpp.
References FIFE::intPt2doublePt(), and setExactLayerCoordinates().
Referenced by FIFE::MultiLayerSearch::calcPath(), FIFE::MultiLayerSearch::calcPathStep(), FIFE::RoutePather::followRoute(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::Instance::processMovement(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), FIFE::MultiLayerSearch::searchBetweenTargetsNeighbor(), FIFE::Instance::updateMultiInstances(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().
void FIFE::Location::setMapCoordinates | ( | const ExactModelCoordinate & | coordinates | ) |
Sets map coordinates to this location.
coordinates | coordinates to set |
Definition at line 98 of file location.cpp.
References FIFE::Layer::getCellGrid(), FIFE::INVALID_LAYER_SET, isValid(), m_exact_layer_coords, m_layer, and FIFE::CellGrid::toExactLayerCoordinates().
Referenced by FIFE::CoordinateRenderer::adjustLayerArea(), FIFE::RoutePather::followRoute(), FIFE::getFacing(), FIFE::Camera::getLayerViewPort(), and FIFE::Instance::updateMultiInstances().
|
private |
Definition at line 177 of file location.h.
Referenced by getCellOffsetDistance(), getExactLayerCoordinates(), getExactLayerCoordinatesRef(), getLayerCoordinates(), getMapCoordinates(), Location(), operator=(), operator==(), reset(), setExactLayerCoordinates(), and setMapCoordinates().
|
private |
Definition at line 176 of file location.h.
Referenced by getExactLayerCoordinates(), getLayer(), getLayerCoordinates(), getLayerDistanceTo(), getMap(), getMapCoordinates(), isValid(), Location(), operator=(), operator==(), reset(), setLayer(), and setMapCoordinates().