|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vanetsim.gui.Renderer
public final class Renderer
This class performs all rendering tasks.
Method Summary | |
---|---|
void |
drawMovingObjects(java.awt.Graphics2D g2d)
This function renders all non-static objects on the supplied Graphics2D object. |
void |
drawScale(java.awt.image.BufferedImage image)
Creates an image to see the current scale. |
void |
drawStaticObjects(java.awt.image.BufferedImage image)
This function renders all non-moving objects on a supplied image. |
Vehicle |
getAttackedVehicle()
|
Vehicle |
getAttackerVehicle()
Gets the attacker vehicle. |
static Renderer |
getInstance()
Gets the single instance of this renderer. |
java.util.ArrayList<java.lang.String> |
getLocationInformationMix()
|
java.util.ArrayList<java.lang.String> |
getLocationInformationSilentPeriod_()
|
double |
getMapZoom()
Gets the current zooming factor. |
Junction |
getMarkedJunction_()
|
Vehicle |
getMarkedVehicle()
Gets a marked vehicle. |
double |
getMiddleX()
Gets the x coordinate of the middle of the current view. |
double |
getMiddleY()
Gets the y coordinate of the middle of the current view. |
int |
getMixZoneAmount()
|
int |
getTimePassed()
Gets the time passed since simulation start. |
java.awt.geom.AffineTransform |
getTransform()
Gets the currently active coordinate transformation. |
boolean |
isAutoAddMixZones()
Gets if mix zones are added automatically on each street corner |
boolean |
isConsoleStart()
|
boolean |
isShowAttackers()
|
boolean |
isShowMixZones()
Gets if mix zones are displayed |
boolean |
isShowRSUs()
Gets if RSUs are displayed |
boolean |
isShowVehicles()
Gets if vehicles are displayed. |
void |
notifySimulationRunning(boolean running)
Notify if the simulation is running or not. |
void |
pan(char direction)
Pans the viewable area. |
void |
pan(double x,
double y)
Pans the viewable area. |
void |
ReRender(boolean fullRender,
boolean forceRenderNow)
Schedules an update of the DrawingArea . |
void |
setAttackedVehicle(Vehicle attackedVehicle_)
|
void |
setAttackerVehicle(Vehicle attackerVehicle)
Sets a new attacker vehicle. |
void |
setAutoAddMixZones(boolean autoAddMixZones)
If you want to add mix zones to all street corners automatically. |
void |
setBarrierForSimulationMaster(java.util.concurrent.CyclicBarrier barrier)
Sets the barrier for synchronization with the SimulationMaster. |
void |
setConsoleStart(boolean consoleStart)
|
void |
setDisplayVehicleIDs(boolean displayVehicleIDs)
If the IDs of the vehicle shall be drawn on the map. |
void |
setDrawArea(DrawingArea drawArea)
Sets the DrawingArea this Renderer is associated with. |
void |
setDrawHeight(int drawHeight)
Set the height of the DrawingArea . |
void |
setDrawWidth(int drawWidth)
Set the width of the DrawingArea . |
void |
setHideMixZones(boolean hideMixZones)
If filled circles shall be displayed to hide the mix zones. |
void |
setHighlightCommunication(boolean highlightCommunication)
If circles shall be displayed to show communication distance. |
void |
setHighlightNodes(boolean highlightNodes)
If all nodes shall be highlighted. |
void |
setLocationInformationMix(java.util.ArrayList<java.lang.String> locationInformation)
|
void |
setLocationInformationSilentPeriod_(java.util.ArrayList<java.lang.String> locationInformationSilentPeriod_)
|
void |
setMapZoom(double zoom)
Sets a new zooming factor. |
void |
setMarkedJunction_(Junction markedJunction_)
|
void |
setMarkedStreet(Street markedStreet)
Sets a new marked street. |
void |
setMarkedVehicle(Vehicle markedVehicle)
Sets a new marked vehicle. |
void |
setMiddle(int x,
int y)
Sets the coordinates of the center of the viewable area. |
void |
setMixZoneAmount(int mixZoneAmount)
|
void |
setMonitoredBeaconZoneVariables(int beaconMonitorMinX,
int beaconMonitorMaxX,
int beaconMonitorMinY,
int beaconMonitorMaxY)
Sets the values for the monitored beacon zone. |
void |
setShowAllBlockings(boolean showAllBlockings)
If you want to show all blockings. |
void |
setShowAttackers(boolean showAttackers_)
|
void |
setShowBeaconMonitorZone(boolean showBeaconMonitorZone)
If you want to display the monitored beacon zone. |
void |
setShowMixZones(boolean showMixZones)
If you want to show all mix zones. |
void |
setShowRSUs(boolean showRSUs)
If you want to show all RSUs. |
void |
setShowVehicles(boolean showVehicles)
If you want to show all vehicles. |
void |
setTimePassed(int timePassed)
Sets the time passed since simulation start. |
void |
updateParams()
Updates various internal parameters after changes through panning or zooming. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Renderer getInstance()
public void drawMovingObjects(java.awt.Graphics2D g2d)
Graphics2D
object.
g2d
- the Graphics2D
object on which rendering takes placepublic void drawScale(java.awt.image.BufferedImage image)
image
- the BufferedImage
on which rendering should be donepublic void drawStaticObjects(java.awt.image.BufferedImage image)
draw()
or drawLine()
. This is a factor determined by the underlying graphics
subsytem and there's not much space for lot of improvement.
Multithreading approaches are not possible here: The graphics subsystem is just singlethreaded (blocks concurrent draw-Calls
even if they are done on different BufferedImages) and so there's no performance benefit.ArrayLists
instead of Iterators
(iterators create lots of object creations and calls)
image
- the BufferedImage
on which rendering should be donepublic void pan(char direction)
direction
- u
to pan up, d
to pan down, l
to pan left, r
to pan rightpublic void pan(double x, double y)
x
- the value for how far to pan in x direction (in map scale!)y
- the value for how far to pan in y direction (in map scale!)public void setMapZoom(double zoom)
zoom
- the new zooming factorpublic void updateParams()
public void ReRender(boolean fullRender, boolean forceRenderNow)
DrawingArea
. Note that depending on if a simulation is running or not, the update
might be performed at a later time!
fullRender
- true
if a full update including all static objects should be done, else false
forceRenderNow
- true
to force an immediate update regardless of consistency considerations (should only be used by the SimulationMaster
)public double getMiddleX()
public double getMiddleY()
public double getMapZoom()
public int getTimePassed()
public java.awt.geom.AffineTransform getTransform()
public void notifySimulationRunning(boolean running)
running
- true
if a simulation is currently running, false
if it's suspendedpublic void setMarkedStreet(Street markedStreet)
markedStreet
- the street to markpublic void setMarkedVehicle(Vehicle markedVehicle)
markedVehicle
- the vehicle to markpublic Vehicle getMarkedVehicle()
public void setAttackerVehicle(Vehicle attackerVehicle)
attackerVehicle
- the attacker vehiclepublic Vehicle getAttackerVehicle()
public void setMiddle(int x, int y)
x
- the new x coordinate for the center of the viewable areay
- the new y coordinate for the center of the viewable areapublic void setDrawArea(DrawingArea drawArea)
DrawingArea
this Renderer is associated with.
drawArea
- the area on which this Renderer drawspublic void setDrawHeight(int drawHeight)
DrawingArea
.
drawHeight
- the new heightpublic void setDrawWidth(int drawWidth)
DrawingArea
.
drawWidth
- the new widthpublic void setTimePassed(int timePassed)
timePassed
- the new time in millisecondspublic void setBarrierForSimulationMaster(java.util.concurrent.CyclicBarrier barrier)
barrier
- the barrier to usepublic void setHighlightNodes(boolean highlightNodes)
highlightNodes
- true
if you want to highlight nodes, else false
public void setHighlightCommunication(boolean highlightCommunication)
highlightCommunication
- true
if you want to show the circles, else false
public void setHideMixZones(boolean hideMixZones)
hideMixZones
- true
if you want to show the circles, else false
public void setDisplayVehicleIDs(boolean displayVehicleIDs)
displayVehicleIDs
- true
if you want to show the IDs, else false
public void setShowAllBlockings(boolean showAllBlockings)
showAllBlockings
- true
if you want to show all blockings, else false
public void setShowBeaconMonitorZone(boolean showBeaconMonitorZone)
showBeaconMonitorZone
- true
if you want to display the monitored beacon zones, else false
public void setMonitoredBeaconZoneVariables(int beaconMonitorMinX, int beaconMonitorMaxX, int beaconMonitorMinY, int beaconMonitorMaxY)
setShowBeaconMonitorZone(boolean)
is set to true
.
beaconMonitorMinX
- the minimum x coordinatebeaconMonitorMaxX
- the maximum x coordinatebeaconMonitorMinY
- the minimum y coordinatebeaconMonitorMaxY
- the maximum y coordinatepublic void setShowVehicles(boolean showVehicles)
showVehicles
- true
if you want to show all vehicles, else false
public boolean isShowVehicles()
true
if vehicles are displayedpublic void setShowMixZones(boolean showMixZones)
showMixZones
- true
if you want to show all mix zones, else false
public boolean isShowMixZones()
public void setAutoAddMixZones(boolean autoAddMixZones)
autoAddMixZones
- true
if you want to add mix zones to all street corners automatically else false
public boolean isAutoAddMixZones()
public void setShowRSUs(boolean showRSUs)
showRSUs
- true
if you want to show all RSUs, else false
public boolean isShowRSUs()
public Vehicle getAttackedVehicle()
public void setAttackedVehicle(Vehicle attackedVehicle_)
public boolean isShowAttackers()
public void setShowAttackers(boolean showAttackers_)
public boolean isConsoleStart()
public void setConsoleStart(boolean consoleStart)
public void setMarkedJunction_(Junction markedJunction_)
markedJunction_
- the markedJunction_ to setpublic Junction getMarkedJunction_()
public java.util.ArrayList<java.lang.String> getLocationInformationMix()
public void setLocationInformationMix(java.util.ArrayList<java.lang.String> locationInformation)
public java.util.ArrayList<java.lang.String> getLocationInformationSilentPeriod_()
public void setLocationInformationSilentPeriod_(java.util.ArrayList<java.lang.String> locationInformationSilentPeriod_)
public int getMixZoneAmount()
public void setMixZoneAmount(int mixZoneAmount)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |