- All Implemented Interfaces:
Graph.Graphic
,NamedObjectOps
Class representing a pedestrian.
The pedestrian's default reference point is at the center of the
circle representing the pedestrian. This is generally the one that
one should use as a pedestrian is a small object in a typical
animation.
A pedestrian is represented by a circle, with each half a different color (one to represent hair and the other a face). The 'face' half has two smaller ellipses representing eyes, primarily to provide a sense of direction. All the features are scaled based on the circle's radius.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTo
(Graph graph, Graphics2D g2d, Graphics2D g2dGcS) boolean
protected Object
clone()
void
Configure the the object representing a pedestrian.void
Configure the the object representing a pedestrian, providing a radius.final boolean
delete()
final boolean
Get the color used to represent the pedestrian's face.Get the color used to represent the pedestrian's hair.final String
getName()
protected Simulation
final boolean
boolean
void
printConfiguration
(String iPrefix, String prefix, boolean printName, PrintWriter out) Print the configuration for an instance of Pedestrian.void
printState
(String iPrefix, String prefix, boolean printName, PrintWriter out) Print the state for an instance of Pedestrian.Methods inherited from class org.bzdev.anim2d.DirectedObject2D
angleIsRelative, clearPath, defaultAngleRelative, getAngularVelocity, getDistance, getInitialPathTime, getInitialS, getInitialU, getMaxPathParameter, getPathAcceleration, getPathAngle, getPathDxDu, getPathDyDu, getPathInversionLimit, getPathLength, getPathLength, getPathVelocity, getPathX, getPathY, getS, getS, getU, getU, getUpdatedTime, hasPath, isClosedPath, pathExists, setAngle, setAngleByF, setAngleBySF, setAngleRelative, setAngularAcceleration, setAngularVelocity, setDistanceByF, setDistanceBySF, setPath, setPath, setPath, setPath, setPath, setPath, setPath, setPath, setPathAcceleration, setPathAngle, setPathAngleByF, setPathAngleBySF, setPathAngularAcceleration, setPathAngularVelocity, setPathImplementation, setPathInversionLimit, setPathVelocity, setPosition, update
Methods inherited from class org.bzdev.anim2d.PlacedAnimationObject2D
getAddToTransform, getAngle, getBBXMax, getBBXMin, getBBYMax, getBBYMin, getReferencePointX, getReferencePointY, getRefPointName, getX, getY, setPosition, setRefPoint, setRefPoint, setRefPointBounds, setRefPointBounds, setRefPointByFraction, setRefPointByName
Methods inherited from class org.bzdev.anim2d.AnimationObject2D
addToFrame, addToFrame, getAnimation, getZorder, isVisible, setVisible, setZorder, setZorder
Methods inherited from class org.bzdev.devqsim.SimObject
addSimulationListener, addTraceSet, bindCallable, bindCallable, bindCallable, bindCallable, bindRunnable, bindRunnable, bindRunnable, bindRunnable, callableObject, callableScript, callScriptFunction, callScriptMethod, clearTraceSets, evalScript, getEventListenerList, getScriptObject, getTraceSets, onDelete, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printState, printState, printState, printState, printState, printState, putScriptObject, removeSimulationListener, removeTraceSet, runnableObject, runnableScript, scheduleCall, scheduleCall, scheduleCall, scheduleCall, scheduleCallObject, scheduleScript, scheduleTask, scheduleTask, scheduleTask, scheduleTask, scheduleTaskObject, scheduleTaskScript, startImmediateTask, startImmediateTask, trace, trace, unscheduledTaskThread, unscheduledTaskThread, update, usesTraceSet
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.graphs.Graph.Graphic
boundingBox
Methods inherited from interface org.bzdev.obnaming.NamedObjectOps
canDelete, delete, deletePending, getName, isDeleted, isInterned
-
Constructor Details
-
Pedestrian
Constructor.- Parameters:
a2d
- the animationname
- the name of this objectintern
- true if the object is interned in the animation's name space; false otherwise.
-
-
Method Details
-
configure
Configure the the object representing a pedestrian.- Parameters:
hairColor
- the color of pedestrian's hair; null for the defaultfaceColor
- the color of the pedestrian's face; null for the defaulteyeColor
- the color of the pedestrian's eyes; null for the default
-
configure
Configure the the object representing a pedestrian, providing a radius.- Parameters:
hairColor
- the color of pedestrian's hair; null for the defaultfaceColor
- the color of the pedestrian's face; null for the defaulteyeColor
- the color of the pedestrian's eyes; null for the defaultradius
- the radius for the circular representation of a pedestrian (must be a positive real number)- Throws:
IllegalArgumentException
- the radius is less than or equal to zero
-
getHairColor
Get the color used to represent the pedestrian's hair.- Returns:
- the color used to represent the pedestrian's hair
-
getFaceColor
Get the color used to represent the pedestrian's face.- Returns:
- the color used to represent the pedestrian's face
-
addTo
-
printConfiguration
Print the configuration for an instance of Pedestrian. The documentation for methodSimObject.printConfiguration(String,String,boolean,java.io.PrintWriter)
contains a description of how this method is used and how to override it. The methodDirectedObject2D.printConfiguration(String,String,boolean,java.io.PrintWriter)
describes the data that will be printed for the superclass ofPedestrian
. The data that will be printed when this method is called is the following.For class
Pedestrian
:- the hair color.
- the face color.
- the eye color.
- the radius of the disk representing a pedestrian.
- Overrides:
printConfiguration
in classDirectedObject2D
- Parameters:
iPrefix
- the prefix to use for an initial line when printName is true with null treated as an empty stringprefix
- a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is trueprintName
- requests printing the name of an objectout
- the output print writer
-
printState
Print the state for an instance of Pedestrian. The documentation for methodSimObject.printState(String,String,boolean,java.io.PrintWriter)
contains a description of how this method is used and how to override it. The methodDirectedObject2D.printState(String,String,boolean,java.io.PrintWriter)
describes the data that will be printed for the superclass ofPedestrian
(Pedestrian
itself does not add any text).- Overrides:
printState
in classDirectedObject2D
- Parameters:
iPrefix
- the prefix to use for an initial line when printName is true with null treated as an empty stringprefix
- a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is trueprintName
- requests printing the name of an objectout
- the output print writer
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
isInterned
public boolean isInterned()- Specified by:
isInterned
in interfaceNamedObjectOps
-
getObjectNamer
-
getName
- Specified by:
getName
in interfaceNamedObjectOps
-
canDelete
public boolean canDelete()- Specified by:
canDelete
in interfaceNamedObjectOps
-
delete
public final boolean delete()- Specified by:
delete
in interfaceNamedObjectOps
-
isDeleted
public final boolean isDeleted()- Specified by:
isDeleted
in interfaceNamedObjectOps
-
deletePending
public final boolean deletePending()- Specified by:
deletePending
in interfaceNamedObjectOps
-