Class Land
raft.kilavuz.runtime
java.lang.Object
  raft.kilavuz.runtime.Land
All Implemented Interfaces:

public class Land
extends Object
implements Serializable
runtime pathfinding information

Nested Class Summary
static class
Land.Point
a point in grid space.
class
Land.Portal
line of (generally) border cells which leads to same sector with same action.
class
Land.Sector
a rectangular region which is freely traversable with simple steps
Field Summary
static short
ACTION_FALLDOWN
fall dwon action
static short
ACTION_JUMP
jump action
static short
ACTION_NONE
no action required
float
cellHeight
height of a cell
float
cellWidth
width of a cell
static short
DEFAULT_TERRAIN
default terrain
static float
SAME_ELEVATION_LIMIT
ratio to cellHeight to consider two cells at same elevation.
Constructor Summary
Land(Grid grid)
creates Land using information in Grid
Method Summary
getLocation(Land.Point p)
returns the location in world space
getOrigin()
returns origin, first cell 0,0 at world space
getPoint(SimpleVector v)
returns point in grid space, or null if no sector contains the point.
getPoint(float x, float y, float z)
returns point in grid space, or null if no sector contains the point.
getPortal(int portalId)
return sector with given id or null of there is no such sector
getPortals()
returns an unmodifiable view of sectors
getSector(int sectorId)
return sector with given id or null of there is no such sector
getSectors()
returns an unmodifiable view of sectors
getUserObject()
returns user defined object
static Land
loadFromStream(InputStream in)
loads Land from serialized stream and closes stream
void
saveToStream(OutputStream out)
serializes this Land to stream and closes stream
void
setPenalties(Map<Short,Float> penalties)
sets penalties for costs of portals of specific actions.
void
setUserObject(Object userObject)
sets user defined object.
Field Detail
SAME_ELEVATION_LIMIT
public static float SAME_ELEVATION_LIMIT
ratio to cellHeight to consider two cells at same elevation. sectors store elevations at cell positions as a float array. to save memory if all sector is at same elevation only a single value is stored. default value is 1/20
See Also:

DEFAULT_TERRAIN
public static final short DEFAULT_TERRAIN
default terrain

ACTION_NONE
public static final short ACTION_NONE
no action required

ACTION_JUMP
public static final short ACTION_JUMP
jump action

ACTION_FALLDOWN
public static final short ACTION_FALLDOWN
fall dwon action

cellWidth
public final float cellWidth
width of a cell

cellHeight
public final float cellHeight
height of a cell
Constructor Detail
Land
public Land(Grid grid)
creates Land using information in Grid
Method Detail
getPoint
public Land.Point getPoint(SimpleVector v)
returns point in grid space, or null if no sector contains the point. given coordinates are in world space
Parameters:
v - location in world space

getPoint
public Land.Point getPoint(float x,
                           float y,
                           float z)
returns point in grid space, or null if no sector contains the point. given coordinates are in world space
Parameters:
x - coordinate in world space
y - coordinate in world space
z - coordinate in world space

getOrigin
public Vector3 getOrigin()
returns origin, first cell 0,0 at world space

getLocation
public Vector3 getLocation(Land.Point p)
returns the location in world space

getSector
public Land.Sector getSector(int sectorId)
return sector with given id or null of there is no such sector

getSectors
public Collection<Land.SectorgetSectors()
returns an unmodifiable view of sectors

getPortal
public Land.Portal getPortal(int portalId)
return sector with given id or null of there is no such sector

getPortals
public Collection<Land.PortalgetPortals()
returns an unmodifiable view of sectors

setUserObject
public void setUserObject(Object userObject)
sets user defined object. use when you want to store additional information about this Land. note given object is also serialized when Land is serialized
Parameters:
userObject - user object, null to clear user object
See Also:

getUserObject
public Object getUserObject()
returns user defined object
See Also:

setPenalties
public void setPenalties(Map<Short,Float> penalties)
sets penalties for costs of portals of specific actions. setting to null clears all penalties. this method re-calculates portal costs if necessary

saveToStream
public void saveToStream(OutputStream out)
                  throws IOException
serializes this Land to stream and closes stream
Throws:

loadFromStream
public static Land loadFromStream(InputStream in)
                           throws IOException,
                                  ClassNotFoundException
loads Land from serialized stream and closes stream
Throws:
Java API documentation generated with DocFlex/Doclet v1.5.2
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com