|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.architecture.traffic.infrastructure.Road
public class Road
Basic Road.
| Field Summary | |
|---|---|
protected Drivelane[] |
alphaLanes
Lanes where Roadusers move towards alphaNode. |
protected Node |
alphaNode
Alpha Node of this Road. |
protected Drivelane[] |
betaLanes
Lanes where Roadusers move towards betaNode. |
protected Node |
betaNode
Beta Node of this Road. |
protected int |
length
Length of this Road in blocks. |
protected org.jscience.architecture.traffic.infrastructure.Road.TwoStageLoaderData |
loadData
Container object to 1tranfer information from the first stage loader to the second stage loader. |
protected java.lang.String |
parentName
DOCUMENT ME! |
protected int |
roadId
Id of this Road. |
protected Turn[] |
turns
Turns in the Road. |
| Constructor Summary | |
|---|---|
Road()
Empty constructor for loading |
|
Road(Node _alpha,
Node _beta,
int _length)
Constructs a new Road |
|
| Method Summary | |
|---|---|
void |
addAlphaLane(Drivelane l)
Adds a Drivelane leading to the alpha node |
void |
addBetaLane(Drivelane l)
Adds a Drivelane leading to the beta node |
void |
addLane(Drivelane lane,
Node to)
Adds a Drivelane to this road |
void |
addTurn(Turn t)
Adds a Turn to this road |
Drivelane[] |
getAllLanes()
Returns an array of Drivelanes which are part of this road |
Drivelane[] |
getAlphaLanes()
Returns the Drivelanes where Roadusers move towards the alphaNode |
Node |
getAlphaNode()
Returns the alpha Node of this road |
Drivelane[] |
getBetaLanes()
Returns the Drivelanes where Roadusers move towards the betaNode |
Node |
getBetaNode()
Returns the beta Node of this road |
java.awt.Rectangle |
getBounds()
Returns the bounding box of this Selectable |
java.awt.Point |
getCenterPoint()
DOCUMENT ME! |
java.util.Enumeration |
getChildren()
DOCUMENT ME! |
java.awt.Shape |
getComplexBounds()
DOCUMENT ME! |
int |
getDistance(java.awt.Point p)
DOCUMENT ME! |
protected int[] |
getDrivelaneIdList(Drivelane[] list)
DOCUMENT ME! |
int |
getId()
Returns the Id of this Road |
Drivelane[] |
getInboundLanes(Node n)
Returns an array of Drivelanes which are inbound on the node given. |
int |
getLength()
Returns the length of this Road in blocks |
java.lang.String |
getName()
Returns the name of this road. |
int |
getNumAllLanes()
Returns the number of total Drivelanes in this road |
int |
getNumAlphaLanes()
DOCUMENT ME! |
int |
getNumBetaLanes()
DOCUMENT ME! |
int |
getNumInboundLanes(Node n)
Returns the number of Drivelanes that are inbound on the given node |
int |
getNumOutboundLanes(Node n)
Returns the number of Drivelanes that are outbound from the given node |
Node |
getOtherNode(Node seenfrom)
Returns the other node this road is connected to, seen from the given node |
Drivelane[] |
getOutboundLanes(Node n)
Returns an array of Drivelanes which are outbound from the given node. |
java.awt.Point |
getSelectionPoint()
DOCUMENT ME! |
java.awt.Point[] |
getSelectionPoints()
DOCUMENT ME! |
Turn[] |
getTurns()
Returns the Turns that this Road makes in the representation |
int |
getWidth()
Returns the width of this road in number of lanes |
java.lang.String |
getXMLName()
DOCUMENT ME! |
boolean |
hasChildren()
DOCUMENT ME! |
boolean |
isSelectable()
DOCUMENT ME! |
void |
load(XMLElement myElement,
XMLLoader loader)
Load this XMLSerializable |
void |
loadSecondStage(java.util.Dictionary dictionaries)
DOCUMENT ME! |
void |
paint(java.awt.Graphics g)
DOCUMENT ME! |
void |
paint(java.awt.Graphics g,
int x,
int y,
float zf)
Draws this Road, with all it's DriveLanes and Roadusers onto a Graphics object, mostly a View |
void |
paint(java.awt.Graphics g,
int x,
int y,
float zf,
double bogus)
Paint this road with it's roadusers |
void |
paintDrivelaneAttributes(java.awt.Graphics g,
java.awt.Point p,
double a,
Drivelane d)
DOCUMENT ME! |
java.awt.Shape |
paintDrivelaneSegment(java.awt.Graphics g,
java.awt.Point p1_1,
java.awt.Point p1_2,
java.awt.Point p2_1,
java.awt.Point p2_2,
double a1,
double a2,
Drivelane dl)
Paints an arbitrary segment of a drivelane and returns the outlines of this segment as a Shape |
void |
paintRoaduser(java.awt.Graphics g,
Roaduser r,
java.awt.Point p1,
java.awt.Point p2,
double a1,
double a2,
int pos)
Draws a Roaduser on a (segment of a) Drivelane |
void |
paintRoaduserOnNode(java.awt.Graphics g,
Roaduser ru,
Node node,
java.awt.Point p,
int pos,
Drivelane d)
Draws a Roaduser on a Node |
void |
remAlphaLane(Drivelane l)
Removes a Drivelane leading to the alpha node |
void |
remBetaLane(Drivelane l)
Removes a Drivelane leading to the beta node |
void |
remLane(Drivelane lane)
Removes a Drivelane from this road |
void |
remTurn(Turn t)
Removes a Turn from this road |
void |
reset()
Resets the road. |
void |
saveChilds(XMLSaver saver)
DOCUMENT ME! |
XMLElement |
saveSelf()
DOCUMENT ME! |
void |
setAlphaLanes(Drivelane[] l)
Sets the Drivelanes where Roadusers move towards the alphaNode |
void |
setAlphaNode(Node n)
Sets the alpha Node of this road |
void |
setBetaLanes(Drivelane[] l)
Sets the Drivelanes where Roadusers move towards the betaNode |
void |
setBetaNode(Node n)
Sets the beta Node of this road |
void |
setId(int id)
Sets the Id of this Road |
void |
setLength(int l)
Sets the length of this Road in blocks |
void |
setParentName(java.lang.String parentName)
DOCUMENT ME! |
void |
setTurns(Turn[] t)
Sets the Turns that this Road makes in the representation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int roadId
protected int length
protected Node alphaNode
protected Node betaNode
protected Drivelane[] alphaLanes
protected Drivelane[] betaLanes
protected Turn[] turns
protected org.jscience.architecture.traffic.infrastructure.Road.TwoStageLoaderData loadData
protected java.lang.String parentName
| Constructor Detail |
|---|
public Road(Node _alpha,
Node _beta,
int _length)
_alpha - The alpha node of this road_beta - The beta node of this road_length - The length of this roadpublic Road()
| Method Detail |
|---|
public void load(XMLElement myElement,
XMLLoader loader)
throws XMLTreeException,
java.io.IOException,
XMLInvalidInputException
XMLSerializable
load in interface XMLSerializablemyElement - The XMLElement which represents this object in the XML
tree. It can contain attributes which hold information about the
object.loader - The XMLLoader which this XMLSerializable can use to load
child objects.
XMLTreeException - The parser can throw this exception if it is
called by the XMLSerializable. The XMLSerializable should NOT
throw this exception by itself and preferrably not catch it
too.
java.io.IOException - Thrown in case of an read error in the XML file.
XMLInvalidInputException - The XMLSerializable can throw this
exception if it cannot load itself or one of its child objects
for whatever reason.
public XMLElement saveSelf()
throws XMLCannotSaveException
saveSelf in interface XMLSerializableXMLCannotSaveException - DOCUMENT ME!
public void saveChilds(XMLSaver saver)
throws XMLTreeException,
java.io.IOException,
XMLCannotSaveException
saveChilds in interface XMLSerializablesaver - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLCannotSaveException - DOCUMENT ME!public java.lang.String getXMLName()
getXMLName in interface XMLSerializablepublic void setParentName(java.lang.String parentName)
setParentName in interface XMLSerializableparentName - DOCUMENT ME!protected int[] getDrivelaneIdList(Drivelane[] list)
list - DOCUMENT ME!
public void loadSecondStage(java.util.Dictionary dictionaries)
throws XMLInvalidInputException,
XMLTreeException
loadSecondStage in interface TwoStageLoaderdictionaries - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!public int getId()
public void setId(int id)
id - DOCUMENT ME!public Node getAlphaNode()
public void setAlphaNode(Node n)
n - DOCUMENT ME!public Node getBetaNode()
public void setBetaNode(Node n)
n - DOCUMENT ME!public int getLength()
public void setLength(int l)
l - DOCUMENT ME!public Turn[] getTurns()
public void setTurns(Turn[] t)
t - DOCUMENT ME!public Drivelane[] getAlphaLanes()
public void setAlphaLanes(Drivelane[] l)
l - DOCUMENT ME!public Drivelane[] getBetaLanes()
public void setBetaLanes(Drivelane[] l)
l - DOCUMENT ME!public java.lang.String getName()
public java.awt.Rectangle getBounds()
Selectable
getBounds in interface Selectablepublic java.awt.Shape getComplexBounds()
getComplexBounds in interface Selectablepublic int getDistance(java.awt.Point p)
getDistance in interface Selectablep - DOCUMENT ME!
public java.awt.Point getSelectionPoint()
getSelectionPoint in interface Selectablepublic java.awt.Point[] getSelectionPoints()
getSelectionPoints in interface Selectablepublic java.awt.Point getCenterPoint()
getCenterPoint in interface Selectablepublic boolean hasChildren()
hasChildren in interface SelectionStarterpublic boolean isSelectable()
isSelectable in interface Selectablepublic java.util.Enumeration getChildren()
getChildren in interface SelectionStarterpublic void reset()
Drivelane.reset()
public void addAlphaLane(Drivelane l)
throws InfraException
l - The drivelane to add
InfraException - if l is null
public void remAlphaLane(Drivelane l)
throws InfraException
l - The drivelane to remove
InfraException - if l is null
public void addBetaLane(Drivelane l)
throws InfraException
l - The drivelane to add
InfraException - if l is null
public void remBetaLane(Drivelane l)
throws InfraException
l - The drivelane to remove
InfraException - if l is null
public void addTurn(Turn t)
throws InfraException
t - The turn to add
InfraException - if t is null
public void remTurn(Turn t)
throws InfraException
t - The turn to remove
InfraException - if t is null
public void addLane(Drivelane lane,
Node to)
throws InfraException
lane - The drivelane to addto - The Node this Drivelane leads to
InfraException - if lane or to is null
public void remLane(Drivelane lane)
throws InfraException
lane - The drivelane to remove
InfraException - if lane is nullpublic Node getOtherNode(Node seenfrom)
seenfrom - DOCUMENT ME!
public int getWidth()
public int getNumAllLanes()
public int getNumAlphaLanes()
public int getNumBetaLanes()
public int getNumOutboundLanes(Node n)
throws InfraException
n - DOCUMENT ME!
InfraException - if n is null
public int getNumInboundLanes(Node n)
throws InfraException
n - DOCUMENT ME!
InfraException - if n is null
public Drivelane[] getOutboundLanes(Node n)
throws InfraException
n - DOCUMENT ME!
InfraException - if n is null
public Drivelane[] getInboundLanes(Node n)
throws InfraException
n - DOCUMENT ME!
InfraException - if n is nullpublic Drivelane[] getAllLanes()
public void paint(java.awt.Graphics g,
int x,
int y,
float zf)
throws TrafficException
g - The Graphics object of the Viewx - The horizontal scroll number of the Viewy - The vertical scroll number of the Viewzf - The zoom factor of the View
TrafficException - DOCUMENT ME!
public void paint(java.awt.Graphics g)
throws TrafficException
g - DOCUMENT ME!
TrafficException - DOCUMENT ME!
public java.awt.Shape paintDrivelaneSegment(java.awt.Graphics g,
java.awt.Point p1_1,
java.awt.Point p1_2,
java.awt.Point p2_1,
java.awt.Point p2_2,
double a1,
double a2,
Drivelane dl)
g - DOCUMENT ME!p1_1 - DOCUMENT ME!p1_2 - DOCUMENT ME!p2_1 - DOCUMENT ME!p2_2 - DOCUMENT ME!a1 - DOCUMENT ME!a2 - DOCUMENT ME!dl - DOCUMENT ME!
public void paintRoaduser(java.awt.Graphics g,
Roaduser r,
java.awt.Point p1,
java.awt.Point p2,
double a1,
double a2,
int pos)
g - The Graphics object to draw ontor - The Roaduser to drawp1 - The first point of the segmentp2 - The last point of the segmenta1 - The angle of the first point of the segmenta2 - The angle of the last point of the segmentpos - The position of the Roaduser relative to the start of the
segment
public void paintRoaduserOnNode(java.awt.Graphics g,
Roaduser ru,
Node node,
java.awt.Point p,
int pos,
Drivelane d)
g - The Graphics object to draw ontoru - The Roaduser to drawnode - The Node this Roaduser is onp - The first point of the new Drivelane the Roaduser will be onpos - The position of the Roaduser on the Noded - The new Drivelane
public void paintDrivelaneAttributes(java.awt.Graphics g,
java.awt.Point p,
double a,
Drivelane d)
g - DOCUMENT ME!p - DOCUMENT ME!a - DOCUMENT ME!d - DOCUMENT ME!
public void paint(java.awt.Graphics g,
int x,
int y,
float zf,
double bogus)
throws TrafficException
g - DOCUMENT ME!x - DOCUMENT ME!y - DOCUMENT ME!zf - DOCUMENT ME!bogus - DOCUMENT ME!
TrafficException - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||