Planeshift
psPathNetwork Class Reference

A network of Waypoint and psPath objects. More...

#include <pspathnetwork.h>

Classes

class  RouteFilter
 Template class for implementing waypoint filtering when calculating routes. More...
 

Public Member Functions

size_t AddWaypointToGroup (csString group, Waypoint *wp)
 Add a new waypoint to the given group. More...
 
psPathCreatePath (iDataConnection *db, const csString &name, Waypoint *wp1, Waypoint *wp2, const csString &flags)
 Create a new path/connection/link between two waypoints. More...
 
psPathCreatePath (iDataConnection *db, psPath *path)
 Create a new path/connection/link between two waypoints from an external created path object. More...
 
psPathCreatePath (psPath *path)
 Create a new path/connection/link between two waypoints from an external created path object. More...
 
WaypointCreateWaypoint (iDataConnection *db, csString &name, csVector3 &pos, csString &sectorName, float radius, csString &flags)
 Create a new waypoint and insert in db. More...
 
WaypointCreateWaypoint (csString &name, csVector3 &pos, csString &sectorName, float radius, csString &flags)
 Create a new waypoint. More...
 
bool Delete (psPath *path)
 Delete the given path from the db. More...
 
EdgeFindEdge (const Waypoint *wp1, const Waypoint *wp2)
 Find a given edge from starting waypoint wp1 to end waypoint wp2. More...
 
csList< Edge * > FindEdgeRoute (Waypoint *start, Waypoint *end, const RouteFilter *routeFilter)
 Find the shortest route between waypoint start and stop. More...
 
psPathFindNearestPath (const csVector3 &v, iSector *sector, float range, float *found_range=NULL, int *index=NULL, float *fraction=NULL)
 Find the path nearest to a point in the world. More...
 
psPathPointFindNearestPoint (const psPath *path, const csVector3 &v, const iSector *sector, float range)
 Find the path nearest to a point in the world. More...
 
psPathFindNearestPoint (const csVector3 &v, iSector *sector, float range, float *found_range=NULL, int *index=NULL)
 Find the point nearest to a point in the world. More...
 
WaypointFindNearestWaypoint (const csVector3 &v, iSector *sector, float range, float *found_range=NULL)
 Find waypoint nearest to a point in the world. More...
 
WaypointFindNearestWaypoint (int group, const csVector3 &v, iSector *sector, float range, float *found_range=NULL)
 Find waypoint nearest to a point in the world in the given group. More...
 
psPathFindPath (const char *name)
 Find the named path. More...
 
psPathFindPath (int id)
 Find the path. More...
 
psPathPointFindPathPoint (int id)
 Find path point by id. More...
 
psPathPointFindPoint (const psPath *path, const csVector3 &pos, iSector *sector, float range, int &index)
 Find the point nearest to the path. More...
 
size_t FindPointsInSector (iSector *sector, csList< psPathPoint * > &list)
 Get a list of points in a sector. More...
 
WaypointFindRandomWaypoint (const csVector3 &v, iSector *sector, float range, float *found_range=NULL)
 Find random waypoint within a given range to a point in the world. More...
 
WaypointFindRandomWaypoint (int group, const csVector3 &v, iSector *sector, float range, float *found_range=NULL)
 Find random waypoint within a given range to a point in the world. More...
 
WaypointFindWaypoint (int id)
 Find waypoint by id. More...
 
WaypointFindWaypoint (const char *name, WaypointAlias **alias=NULL)
 Find waypoint by name. More...
 
WaypointFindWaypoint (const csVector3 &v, iSector *sector)
 Find waypoint at a given point in the world. More...
 
int FindWaypointGroup (const char *groupName)
 Find the index for the given group name, return -1 if no group is found. More...
 
csList< Waypoint * > FindWaypointRoute (Waypoint *start, Waypoint *end, const RouteFilter *routeFilter)
 Find the shortest route between waypoint start and stop. More...
 
size_t FindWaypointsInSector (iSector *sector, csList< Waypoint * > &list)
 Get a list of waypoints in a sector. More...
 
int GetNextWaypointCheck ()
 Get next unique number for waypoint checking. More...
 
void ListPaths (const char *pattern)
 List all paths matching pattern to console. More...
 
void ListWaypoints (const char *pattern)
 List all waypoints matching pattern to console. More...
 
bool Load (iEngine *engine, iDataConnection *db, psWorld *world)
 Load all waypoins and paths from db. More...
 

Public Attributes

csWeakRef< iDataConnection > db
 
csWeakRef< iEngine > engine
 
csPDelArray< psPathpaths
 
csArray< csString > waypointGroupNames
 
csArray< csList< Waypoint * > > waypointGroups
 
csPDelArray< Waypointwaypoints
 
psWorldworld
 

Detailed Description

A network of Waypoint and psPath objects.

Definition at line 42 of file pspathnetwork.h.

Member Function Documentation

size_t psPathNetwork::AddWaypointToGroup ( csString  group,
Waypoint wp 
)

Add a new waypoint to the given group.

psPath* psPathNetwork::CreatePath ( iDataConnection *  db,
const csString &  name,
Waypoint wp1,
Waypoint wp2,
const csString &  flags 
)

Create a new path/connection/link between two waypoints.

psPath* psPathNetwork::CreatePath ( iDataConnection *  db,
psPath path 
)

Create a new path/connection/link between two waypoints from an external created path object.

psPath* psPathNetwork::CreatePath ( psPath path)

Create a new path/connection/link between two waypoints from an external created path object.

Waypoint* psPathNetwork::CreateWaypoint ( iDataConnection *  db,
csString &  name,
csVector3 &  pos,
csString &  sectorName,
float  radius,
csString &  flags 
)

Create a new waypoint and insert in db.

Waypoint* psPathNetwork::CreateWaypoint ( csString &  name,
csVector3 &  pos,
csString &  sectorName,
float  radius,
csString &  flags 
)

Create a new waypoint.

bool psPathNetwork::Delete ( psPath path)

Delete the given path from the db.

Edge* psPathNetwork::FindEdge ( const Waypoint wp1,
const Waypoint wp2 
)

Find a given edge from starting waypoint wp1 to end waypoint wp2.

csList<Edge*> psPathNetwork::FindEdgeRoute ( Waypoint start,
Waypoint end,
const RouteFilter routeFilter 
)

Find the shortest route between waypoint start and stop.

psPath* psPathNetwork::FindNearestPath ( const csVector3 &  v,
iSector *  sector,
float  range,
float found_range = NULL,
int index = NULL,
float fraction = NULL 
)

Find the path nearest to a point in the world.

Parameters
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only paths within range from given position, -1 if range dosn't matter
[out]found_rangeThe range the path was found at.
[out]indexReturn the index of the path found.
[out]fractionReturn the fraction of the path where the positions is closesed.
Returns
The found path or NULL if no path was found.
psPathPoint* psPathNetwork::FindNearestPoint ( const psPath path,
const csVector3 &  v,
const iSector *  sector,
float  range 
)

Find the path nearest to a point in the world.

Parameters
pathThe path containging the point to search for.
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only points within range from given position, -1 if range dosn't matter
psPath* psPathNetwork::FindNearestPoint ( const csVector3 &  v,
iSector *  sector,
float  range,
float found_range = NULL,
int index = NULL 
)

Find the point nearest to a point in the world.

Parameters
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only points within range from given position, -1 if range dosn't matter
[out]found_rangeThe range the point was found at.
[out]indexReturn the index of the point found.
Returns
The found path or NULL if no path was found.
Waypoint* psPathNetwork::FindNearestWaypoint ( const csVector3 &  v,
iSector *  sector,
float  range,
float found_range = NULL 
)

Find waypoint nearest to a point in the world.

Parameters
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only waypoints within range from waypoint, -1 if range dosn't matter
[out]found_rangeThe range the waypoint was found at.
Returns
The found waypoint or NULL if no wapoint was found.
Waypoint* psPathNetwork::FindNearestWaypoint ( int  group,
const csVector3 &  v,
iSector *  sector,
float  range,
float found_range = NULL 
)

Find waypoint nearest to a point in the world in the given group.

Parameters
groupThe group to search in.
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only waypoints within range from waypoint, -1 if range dosn't matter
[out]found_rangeThe range the waypoint was found at.
Returns
The found waypoint or NULL if no wapoint was found.
psPath* psPathNetwork::FindPath ( const char *  name)

Find the named path.

psPath* psPathNetwork::FindPath ( int  id)

Find the path.

psPathPoint* psPathNetwork::FindPathPoint ( int  id)

Find path point by id.

psPathPoint* psPathNetwork::FindPoint ( const psPath path,
const csVector3 &  pos,
iSector *  sector,
float  range,
int index 
)

Find the point nearest to the path.

Parameters
pathThe path containging the point to search for.
posThe position to start searching from.
sectorThe sector to search in.
rangeFind only points within range from given position, -1 if range dosn't matter
[out]indexReturn the index of the path point at the start of this segment.
size_t psPathNetwork::FindPointsInSector ( iSector *  sector,
csList< psPathPoint * > &  list 
)

Get a list of points in a sector.

Waypoint* psPathNetwork::FindRandomWaypoint ( const csVector3 &  v,
iSector *  sector,
float  range,
float found_range = NULL 
)

Find random waypoint within a given range to a point in the world.

Parameters
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only waypoints within range from waypoint, -1 if range dosn't matter
[out]found_rangeThe range the waypoint was found at.
Returns
The found waypoint or NULL if no wapoint was found.
Waypoint* psPathNetwork::FindRandomWaypoint ( int  group,
const csVector3 &  v,
iSector *  sector,
float  range,
float found_range = NULL 
)

Find random waypoint within a given range to a point in the world.

Parameters
groupThe group to search in.
vThe position to start searching from.
sectorThe sector to search in.
rangeFind only waypoints within range from waypoint, -1 if range dosn't matter
[out]found_rangeThe range the waypoint was found at.
Returns
The found waypoint or NULL if no wapoint was found.
Waypoint* psPathNetwork::FindWaypoint ( int  id)

Find waypoint by id.

Waypoint* psPathNetwork::FindWaypoint ( const char *  name,
WaypointAlias **  alias = NULL 
)

Find waypoint by name.

Parameters
nameThe name of the waypoint to find
aliasIf not null pointer wil be set if the name is of one of the aliases for the WP found.
Waypoint* psPathNetwork::FindWaypoint ( const csVector3 &  v,
iSector *  sector 
)

Find waypoint at a given point in the world.

Return the first waypoint where the position is within the radius of the waypoint.

int psPathNetwork::FindWaypointGroup ( const char *  groupName)

Find the index for the given group name, return -1 if no group is found.

csList<Waypoint*> psPathNetwork::FindWaypointRoute ( Waypoint start,
Waypoint end,
const RouteFilter routeFilter 
)

Find the shortest route between waypoint start and stop.

size_t psPathNetwork::FindWaypointsInSector ( iSector *  sector,
csList< Waypoint * > &  list 
)

Get a list of waypoints in a sector.

int psPathNetwork::GetNextWaypointCheck ( )

Get next unique number for waypoint checking.

void psPathNetwork::ListPaths ( const char *  pattern)

List all paths matching pattern to console.

void psPathNetwork::ListWaypoints ( const char *  pattern)

List all waypoints matching pattern to console.

bool psPathNetwork::Load ( iEngine *  engine,
iDataConnection *  db,
psWorld world 
)

Load all waypoins and paths from db.

Member Data Documentation

csWeakRef<iDataConnection> psPathNetwork::db

Definition at line 66 of file pspathnetwork.h.

csWeakRef<iEngine> psPathNetwork::engine

Definition at line 65 of file pspathnetwork.h.

csPDelArray<psPath> psPathNetwork::paths

Definition at line 60 of file pspathnetwork.h.

csArray<csString> psPathNetwork::waypointGroupNames

Definition at line 62 of file pspathnetwork.h.

csArray< csList<Waypoint*> > psPathNetwork::waypointGroups

Definition at line 63 of file pspathnetwork.h.

csPDelArray<Waypoint> psPathNetwork::waypoints

Definition at line 59 of file pspathnetwork.h.

psWorld* psPathNetwork::world

Definition at line 67 of file pspathnetwork.h.


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