VANET Simulator
 All Classes Functions Variables
Public Member Functions | List of all members
vanetsim.map.Street Class Reference

Public Member Functions

 Street (String name, Node startNode, Node endNode, String streetType, int oneway, int lanes, Color displayColor, Region mainRegion, int maxSpeed)
 
double getLength ()
 
double getXFactor ()
 
double getYFactor ()
 
int getSpeed ()
 
void setSpeed (int maxSpeed)
 
void changeOneWay (int oneway)
 
int getLanesCount ()
 
void setLanesCount (int laneCount)
 
LaneObject getFirstLaneObject (boolean direction)
 
LaneObject getLastLaneObject (boolean direction)
 
void addLaneObject (LaneObject object, boolean direction)
 
void delLaneObject (LaneObject object, boolean direction)
 
void updateLaneObject (LaneObject object, boolean direction, double newPosition)
 
void clearLanes ()
 
void addBridgePaintLine (double x1, double y1, double x2, double y2)
 
void addBridgePaintPolygon (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 
ArrayList< Point2D.Double > getBridgePaintLines ()
 
ArrayList< Point2D.Double > getBridgePaintPolygons ()
 
Node getStartNode ()
 
void setStartNode (Node startNode)
 
Node getEndNode ()
 
void setEndNode (Node endNode)
 
Color getDisplayColor ()
 
void setDisplayColor (Color displayColor)
 
Region getMainRegion ()
 
void setName (String name)
 
String getName ()
 
boolean isOneway ()
 
boolean equals (Object other)
 
int hashCode ()
 
String getStreetType_ ()
 
void setStreetType_ (String streetType_)
 
int getStartNodeTrafficLightState ()
 
void setStartNodeTrafficLightState (int startNodeTrafficLightState_)
 
int getEndNodeTrafficLightState ()
 
void setEndNodeTrafficLightState (int endNodeTrafficLightState_)
 
void updateStartNodeTrafficLightState ()
 
void updateEndNodeTrafficLightState ()
 
void setTrafficLightEndX_ (int trafficLightEndX_)
 
int getTrafficLightEndX_ ()
 
void setTrafficLightStartX_ (int trafficLightStartX_)
 
int getTrafficLightStartX_ ()
 
void setTrafficLightStartY_ (int trafficLightStartY_)
 
int getTrafficLightStartY_ ()
 
void setTrafficLightEndY_ (int trafficLightEndY_)
 
int getTrafficLightEndY_ ()
 
void setPriorityOnEndNode (boolean priorityOnEndNode)
 
boolean isPriorityOnEndNode ()
 
void setPriorityOnStartNode (boolean priorityOnStartNode)
 
boolean isPriorityOnStartNode ()
 

Detailed Description

A street on the map.

Constructor & Destructor Documentation

vanetsim.map.Street.Street ( String  name,
Node  startNode,
Node  endNode,
String  streetType,
int  oneway,
int  lanes,
Color  displayColor,
Region  mainRegion,
int  maxSpeed 
)
inline

Instantiates a new street.

Parameters
namethe name of this street
startNodethe start node
endNodethe end node
streetTypetype of the street
oneway0=twoway-street, 1=oneway from startNode to endNode, else: oneway from endNode to startNode
lanesthe number of lanes on this street in one direction (!). Normal streets should have 1 here, motorways 2 or more!
displayColorthe color in which to paint this street
mainRegionthe main region
maxSpeedthe maximum speed allowed on this street

Member Function Documentation

void vanetsim.map.Street.addBridgePaintLine ( double  x1,
double  y1,
double  x2,
double  y2 
)
inline

Adds a line for painting a bridge.

Parameters
x1the x coordinate of the start point
y1the y coordinate of the start point
x2the x coordinate of the end point
y2the y coordinate of the end point
void vanetsim.map.Street.addBridgePaintPolygon ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
inline

Adds a polygon for painting a bridge.

Parameters
x1the x coordinate of the first point
y1the y coordinate of the first point
x2the x coordinate of the second point
y2the y coordinate of the second point
x3the x coordinate of the third point
y3the y coordinate of the third point
x4the x coordinate of the fourth point
y4the y coordinate of the fourth point
void vanetsim.map.Street.addLaneObject ( LaneObject  object,
boolean  direction 
)
inline

Adds a lane object. The underlying lane container is synchronized during this operation.

Parameters
objectthe object to add
directiontrue in the direction from startNode to endNode, false seen from endNode to startNode
void vanetsim.map.Street.changeOneWay ( int  oneway)
inline

Changes if this street is a oneway street or not.

Parameters
oneway0=twoway-street, 1=oneway from startNode to endNode, else: oneway from endNode to startNode
void vanetsim.map.Street.clearLanes ( )
inline

Clears all objects from the lanes container.

void vanetsim.map.Street.delLaneObject ( LaneObject  object,
boolean  direction 
)
inline

Removes a lane object. The underlying lane container is synchronized during this operation.

Parameters
objectthe object to remove
directiontrue in the direction from startNode to endNode, false seen from endNode to startNode
boolean vanetsim.map.Street.equals ( Object  other)
inline

Checks if this object is equal to another.

Parameters
otherthe object to compare to
Returns
true, if equals
See Also
java.lang.Object::equals(java.lang.Object)
ArrayList<Point2D.Double> vanetsim.map.Street.getBridgePaintLines ( )
inline

Gets the lines to paint a bridge.

Returns
the ArrayList with all lines to paint (two successive points are a line)
ArrayList<Point2D.Double> vanetsim.map.Street.getBridgePaintPolygons ( )
inline

Gets the polygons to paint a bridge.

Returns
the ArrayList with all lines to paint (two successive points are a line)
Color vanetsim.map.Street.getDisplayColor ( )
inline

Gets the display color of this street.

Returns
the display color
Node vanetsim.map.Street.getEndNode ( )
inline

Gets the end node of this street.

Returns
the end node
int vanetsim.map.Street.getEndNodeTrafficLightState ( )
inline

Gets the state of the traffic light.

Returns
the state of the traffic light
LaneObject vanetsim.map.Street.getFirstLaneObject ( boolean  direction)
inline

Gets the first lane object. You may iterate through the objects using getNext() and getPrevious(). Note that the lane might change while you're iterating as it's not synchronized!

Parameters
directiontrue in the direction from startNode to endNode, false seen from endNode to startNode
Returns
the first lane object
int vanetsim.map.Street.getLanesCount ( )
inline

Gets the amount of lanes in one direction. If this is a twoway street, you need to multiply by 2 to get the total amount of lanes.

Returns
the number of lanes per direction
LaneObject vanetsim.map.Street.getLastLaneObject ( boolean  direction)
inline

Gets the last lane object. You may iterate through the objects using getNext() and getPrevious(). Note that the lane might change while you're iterating as it's not synchronized!

Parameters
directiontrue in the direction from startNode to endNode, false seen from endNode to startNode
Returns
the last lane object
double vanetsim.map.Street.getLength ( )
inline

Gets the length of the street.

Returns
the length of the street
Region vanetsim.map.Street.getMainRegion ( )
inline

Gets the region to which this street is primarily assigned to.

Returns
the region
String vanetsim.map.Street.getName ( )
inline

Gets the name of this street.

Returns
the name
int vanetsim.map.Street.getSpeed ( )
inline

Gets the speed.

Returns
the speed
Node vanetsim.map.Street.getStartNode ( )
inline

Gets the start node of this street.

Returns
the start node
int vanetsim.map.Street.getStartNodeTrafficLightState ( )
inline

Gets the state of the traffic light.

Returns
the state of the traffic light
String vanetsim.map.Street.getStreetType_ ( )
inline

Gets the type of this street.

Returns
the street-type
int vanetsim.map.Street.getTrafficLightEndX_ ( )
inline
Returns
the trafficLightEndX_
int vanetsim.map.Street.getTrafficLightEndY_ ( )
inline
Returns
the trafficLightEndY_
int vanetsim.map.Street.getTrafficLightStartX_ ( )
inline
Returns
the trafficLightStartX_
int vanetsim.map.Street.getTrafficLightStartY_ ( )
inline
Returns
the trafficLightStartY_
double vanetsim.map.Street.getXFactor ( )
inline

Gets the x correction factor of one lane for position calculation (in cm). Only valid if going from startNode to endNode (else you need to take the negative).

Returns
the x correction factor
double vanetsim.map.Street.getYFactor ( )
inline

Gets the x correction factor of one lane for position calculation (in cm). Only valid if going from startNode to endNode (else you need to take the negative).

Returns
the y correction factor
int vanetsim.map.Street.hashCode ( )
inline

Creates a hash code (needed for HashMaps or similar structures).

Returns
an Integer
See Also
java.lang.Object::hashCode()
boolean vanetsim.map.Street.isOneway ( )
inline

Indicates if this is a oneway-street or not. Oneway-streets always go from the StartNode to the EndNode!

Returns
true if it's oneway, else false
boolean vanetsim.map.Street.isPriorityOnEndNode ( )
inline
Returns
the priorityOnEndNode
boolean vanetsim.map.Street.isPriorityOnStartNode ( )
inline
Returns
the priorityOnStartNode
void vanetsim.map.Street.setDisplayColor ( Color  displayColor)
inline

Sets the display color of this street.

Parameters
displayColorthe new display color
void vanetsim.map.Street.setEndNodeTrafficLightState ( int  endNodeTrafficLightState_)
inline

Sets the status of the traffic light

Parameters
endNodeTrafficLightState_the status of the traffic light
void vanetsim.map.Street.setLanesCount ( int  laneCount)
inline

Sets the amount of lanes.

Parameters
laneCountthe number of lanes per direction
void vanetsim.map.Street.setName ( String  name)
inline

Sets the name of this street.

Parameters
namethe new name
void vanetsim.map.Street.setPriorityOnEndNode ( boolean  priorityOnEndNode)
inline
Parameters
priorityOnEndNodethe priorityOnEndNode to set
void vanetsim.map.Street.setPriorityOnStartNode ( boolean  priorityOnStartNode)
inline
Parameters
priorityOnStartNodethe priorityOnStartNode to set
void vanetsim.map.Street.setSpeed ( int  maxSpeed)
inline

Sets the maximum speed.

Parameters
maxSpeedthe new speed
void vanetsim.map.Street.setStartNodeTrafficLightState ( int  startNodeTrafficLightState_)
inline

Sets the status of the traffic light

Parameters
startNodeTrafficLightState_the status of the traffic light
void vanetsim.map.Street.setStreetType_ ( String  streetType_)
inline

Sets the type of this street.

Parameters
streetType_the type of the street
void vanetsim.map.Street.setTrafficLightEndX_ ( int  trafficLightEndX_)
inline
Parameters
trafficLightEndX_the trafficLightEndX_ to set
void vanetsim.map.Street.setTrafficLightEndY_ ( int  trafficLightEndY_)
inline
Parameters
trafficLightEndY_the trafficLightEndY_ to set
void vanetsim.map.Street.setTrafficLightStartX_ ( int  trafficLightStartX_)
inline
Parameters
trafficLightStartX_the trafficLightStartX_ to set
void vanetsim.map.Street.setTrafficLightStartY_ ( int  trafficLightStartY_)
inline
Parameters
trafficLightStartY_the trafficLightStartY_ to set
void vanetsim.map.Street.updateEndNodeTrafficLightState ( )
inline

Updates the state of the traffic light.

void vanetsim.map.Street.updateLaneObject ( LaneObject  object,
boolean  direction,
double  newPosition 
)
inline

Updates a lane object. The underlying lane container is synchronized during this operation.

Parameters
objectthe object to check for updates
directiontrue in the direction from startNode to endNode, false seen from endNode to startNode
newPositionthe new position of the object
void vanetsim.map.Street.updateStartNodeTrafficLightState ( )
inline

Updates the state of the traffic light.


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