FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
#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.
Referenced by operator!=().
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(), operator!=(), FIFE::InstanceDistanceSortLocation::operator()(), FIFE::operator<<(), and FIFE::Map::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(), 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(), operator!=(), and FIFE::InstanceDistanceSortCameraAndLocation::operator()().
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::Instance::bindTimeProvider(), FIFE::TriggerController::createTriggerOnLocation(), FIFE::Instance::follow(), FIFE::RoutePather::followRoute(), FIFE::getAngleBetween(), FIFE::RendererNode::getCalculatedPoint(), FIFE::getFacing(), FIFE::Camera::getLocation(), 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::Trigger::moveTo(), operator!=(), FIFE::Instance::processMovement(), FIFE::Camera::removeLayer(), FIFE::TriggerController::removeTriggerFromLocation(), FIFE::CellSelectionRenderer::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::InstanceRenderer::renderUnsorted(), FIFE::RoutePatherSearch::RoutePatherSearch(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), FIFE::Instance::setLocation(), FIFE::Camera::setLocation(), FIFE::RoutePather::solveRoute(), FIFE::Map::update(), and FIFE::Instance::InstanceActivity::update().
ModelCoordinate FIFE::Location::getLayerCoordinates | ( | ) | const |
Gets cell precision layer coordinates set to this location.
Definition at line 113 of file location.cpp.
References FIFE::Layer::getCellGrid(), m_exact_layer_coords, m_layer, and FIFE::CellGrid::toLayerCoordinatesFromExactLayerCoordinates().
Referenced by FIFE::InstanceTree::addInstance(), FIFE::CoordinateRenderer::adjustLayerArea(), FIFE::SingleLayerSearch::calcPath(), FIFE::TriggerController::createTriggerOnLocation(), 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::Trigger::move(), FIFE::Instance::move(), FIFE::MultiLayerSearch::MultiLayerSearch(), FIFE::CellCacheChangeListener::onInstanceCreate(), FIFE::CellCacheChangeListener::onInstanceDelete(), operator!=(), FIFE::Instance::processMovement(), FIFE::TriggerController::removeTriggerFromLocation(), FIFE::GridRenderer::render(), FIFE::CellSelectionRenderer::render(), FIFE::BlockingInfoRenderer::render(), 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(), 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 operator!=(), 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 operator!=().
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::RoutePather::followRoute(), FIFE::getAngleBetween(), FIFE::RendererNode::getCalculatedPoint(), FIFE::getFacing(), getMapDistanceTo(), FIFE::Map::getMinMaxCoordinates(), FIFE::Camera::getOriginalZToY(), operator!=(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::InstanceRenderer::renderAlreadySorted(), FIFE::InstanceRenderer::renderUnsorted(), FIFE::SoundSource::setDirection(), FIFE::Camera::setLocation(), FIFE::SoundSource::setPosition(), FIFE::Camera::update(), FIFE::Instance::updateMultiInstances(), FIFE::LayerCache::updatePosition(), and FIFE::SoundSource::updateSoundEmitter().
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.
Referenced by operator!=().
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(), operator!=(), 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.
References getCellOffsetDistance(), getExactLayerCoordinates(), getExactLayerCoordinatesRef(), getLayer(), getLayerCoordinates(), getLayerDistanceTo(), getMap(), getMapCoordinates(), getMapDistanceTo(), isValid(), setExactLayerCoordinates(), setLayer(), setLayerCoordinates(), and setMapCoordinates().
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(), and FIFE::Camera::removeLayer().
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 isValid(), and m_exact_layer_coords.
Referenced by FIFE::Layer::addInstance(), FIFE::Map::addInstanceForTransfer(), FIFE::SingleLayerSearch::calcPath(), FIFE::Layer::createInstance(), FIFE::Map::getMinMaxCoordinates(), operator!=(), 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::RoutePather::followRoute(), FIFE::Camera::getLocation(), operator!=(), FIFE::CoordinateRenderer::render(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), FIFE::MultiLayerSearch::searchBetweenTargetsNeighbor(), and FIFE::Instance::InstanceActivity::update().
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(), operator!=(), FIFE::Instance::processMovement(), FIFE::CoordinateRenderer::render(), FIFE::CellRenderer::render(), FIFE::MultiLayerSearch::searchBetweenTargetsMap(), FIFE::MultiLayerSearch::searchBetweenTargetsNeighbor(), FIFE::Instance::InstanceActivity::update(), 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(), isValid(), m_exact_layer_coords, m_layer, and FIFE::CellGrid::toExactLayerCoordinates().
Referenced by FIFE::CoordinateRenderer::adjustLayerArea(), FIFE::RoutePather::followRoute(), FIFE::getFacing(), FIFE::Camera::getLayerViewPort(), FIFE::Camera::getLocation(), operator!=(), 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().