FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::Location Class Reference

#include <location.h>

+ Collaboration diagram for FIFE::Location:

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...
 
Locationoperator= (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...
 
MapgetMap () const
 Gets the map where this location is pointing to. More...
 
void setLayer (Layer *layer)
 Sets layer where this location is pointing to. More...
 
LayergetLayer () 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...
 
ExactModelCoordinategetExactLayerCoordinatesRef ()
 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

Layerm_layer
 
ExactModelCoordinate m_exact_layer_coords
 

Detailed Description

Definition at line 41 of file location.h.

Constructor & Destructor Documentation

FIFE::Location::Location ( )

Default constructor.

Definition at line 39 of file location.cpp.

References reset().

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)

Utility constructor.

Definition at line 49 of file location.cpp.

References m_layer, and reset().

FIFE::Location::~Location ( )

Destructor.

Definition at line 54 of file location.cpp.

Member Function Documentation

double FIFE::Location::getCellOffsetDistance ( ) const

Gets offset distance from cell center.

Returns
offset distance

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!=().

+ Here is the caller graph for this function:

ExactModelCoordinate FIFE::Location::getExactLayerCoordinates ( ) const

Gets exact layer coordinates set to this location.

Returns
exact layer coordinates

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<<(), FIFE::Map::update(), and FIFE::Camera::update().

+ Here is the caller graph for this function:

ExactModelCoordinate FIFE::Location::getExactLayerCoordinates ( const Layer layer) const

Gets exact layer coordinates of this location mapped on given layer.

Exceptions
NotSetin the following cases:
  • given layer is not set (NULL)
  • given layer does not have cellgrid assigned
Returns
exact layer coordinates

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

Returns
reference to exact layer coordinates

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!=(), FIFE::InstanceDistanceSortCameraAndLocation::operator()(), and FIFE::Camera::update().

+ Here is the caller graph for this function:

Layer * FIFE::Location::getLayer ( ) const
ModelCoordinate FIFE::Location::getLayerCoordinates ( ) const

Gets cell precision layer coordinates set to this location.

See also
getExactLayerCoordinates()

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::InstanceRenderer::renderAlreadySorted(), FIFE::InstanceRenderer::renderUnsorted(), FIFE::CellSelectionRenderer::selectLocation(), FIFE::Instance::setLocation(), FIFE::RoutePather::solveRoute(), FIFE::Instance::InstanceActivity::update(), FIFE::SingleLayerSearch::updateSearch(), and FIFE::MultiLayerSearch::updateSearch().

+ Here is the caller graph for this function:

ModelCoordinate FIFE::Location::getLayerCoordinates ( const Layer layer) const

Gets cell precision layer coordinates of this location mapped on given layer.

See also
getExactLayerCoordinates(const Layer* 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.

Parameters
locationis 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().

+ Here is the caller graph for this function:

Map * FIFE::Location::getMap ( ) const

Gets the map where this location is pointing to.

Note
this information is fetched from the set layer
Returns
map where this location is pointing to, NULL in case its invalid

Definition at line 72 of file location.cpp.

References FIFE::Layer::getMap(), and m_layer.

Referenced by operator!=(), FIFE::Camera::render(), FIFE::Camera::setLocation(), and FIFE::Camera::updateRenderLists().

+ Here is the caller graph for this function:

double FIFE::Location::getMapDistanceTo ( const Location location) const

Gets distance in map coordinates to another location on the Map.

Parameters
locationis 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!=().

+ Here is the caller graph for this function:

bool FIFE::Location::isValid ( ) const

Tells if location is valid Location is valid if:

  • layer is set
  • layer has cellgrid

Definition at line 121 of file location.cpp.

References m_layer.

Referenced by getExactLayerCoordinates(), getLayerCoordinates(), operator!=(), setExactLayerCoordinates(), and setMapCoordinates().

+ Here is the caller graph for this function:

bool FIFE::Location::isValid ( const Layer layer) const
private

Definition at line 125 of file location.cpp.

References FIFE::Layer::getCellGrid().

Location & FIFE::Location::operator= ( const Location rhs)
bool FIFE::Location::operator== ( const Location loc) const
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().

+ Here is the caller graph for this function:

void FIFE::Location::setExactLayerCoordinates ( const ExactModelCoordinate coordinates)

Sets precise layer coordinates to this location.

Exceptions
NotSetin the following cases:
  • layer is not set (NULL)
  • layer does not have cellgrid assigned
Parameters
coordinatescoordinates 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().

+ Here is the caller graph for this function:

void FIFE::Location::setLayer ( Layer layer)
void FIFE::Location::setLayerCoordinates ( const ModelCoordinate coordinates)
void FIFE::Location::setMapCoordinates ( const ExactModelCoordinate coordinates)

Sets map coordinates to this location.

Parameters
coordinatescoordinates 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(), operator!=(), and FIFE::Instance::updateMultiInstances().

+ Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following files: