- All Implemented Interfaces:
Graph.Graphic
,NamedObjectOps
Class representing a bicycle. The bicycle's reference point is at
the location of the seat, which is at the center of the bicycle's
bounding box for the default configuration.
-
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 bicycle using default dimensions.void
Configure the the object representing a bicycle using default dimensions but with helmet scaling.void
configure
(Color helmetColor, Color bikeColor, double helmetScaleFactor, double lookStringScaleFactor) Configure the the object representing a bicycle using default dimensions but with helmet scaling and look-string scaling.void
configure
(Color helmetColor, Color bikeColor, double bikeHead, double bikeTail, double bikeWidth, double handlebarPosition, double handlebarHalfLength, double handlebarTail) Configure the the object representing a bicycle with default helmet dimensions.void
configure
(Color helmetColor, Color bikeColor, double bikeHead, double bikeTail, double bikeWidth, double handlebarPosition, double handlebarHalfLength, double handlebarTail, double helmetScaleFactor) Configure the the object representing a bicycle and helmet, providing a helmet-scaling factor.void
configure
(Color helmetColor, Color bikeColor, double bikeHead, double bikeTail, double bikeWidth, double handlebarPosition, double handlebarHalfLength, double handlebarTail, double helmetScaleFactor, double lookStringScaleFactor) Configure the the object representing a bicycle and helmet, providing a helmet-scaling factor and look-string scaling factor.final boolean
delete()
final boolean
double
Get the angle of the helmet relative to the bicycle.Get the string to display when setLooking is given the argument 'true'.final String
getName()
protected Simulation
double
Get the X coordinate of the seat in graph coordinate space.double
Get the Y coordinate of the seat in graph coordinate space.final boolean
boolean
void
printConfiguration
(String iPrefix, String prefix, boolean printName, PrintWriter out) Print the configuration for an instance of Bicycle.void
printState
(String iPrefix, String prefix, boolean printName, PrintWriter out) Print the state for an instance of Bicycle.void
setHelmetAngle
(double angle) Set the angle of the helmet relative to the bicycle.void
setLooking
(boolean value) Set whether or not the word "Look", or the value provided by the method setLookString, should be displayed in front of the helmet.void
setLookParams
(Color color) Set the font color for a "looking" indication.void
setLookString
(String string) Set the string to display when setLooking is given the argument 'true'.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
-
Bicycle
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 bicycle using default dimensions.- Parameters:
helmetColor
- the color of the rider's helmetbikeColor
- the color of the bicycle
-
configure
Configure the the object representing a bicycle using default dimensions but with helmet scaling.- Parameters:
helmetColor
- the color of the rider's helmetbikeColor
- the color of the bicyclehelmetScaleFactor
- the factor by which the dimensions of a helmet will be multiplied when the helmet is configured
-
configure
public void configure(Color helmetColor, Color bikeColor, double helmetScaleFactor, double lookStringScaleFactor) Configure the the object representing a bicycle using default dimensions but with helmet scaling and look-string scaling.The scale factor used to size the 'look' string will be lookStringScaleFactor when helmetScaleFactor is less than 1.0, and helmetScaleFactor*lookStringScaleFactor otherwise. The value of lookStringScaleFactor must not be less than 1.0.
- Parameters:
helmetColor
- the color of the rider's helmetbikeColor
- the color of the bicyclehelmetScaleFactor
- the factor by which the dimensions of a helmet will be multiplied when the helmet is configuredlookStringScaleFactor
- the fraction by which the dimensions of the look-string text will be scaled.
-
configure
public void configure(Color helmetColor, Color bikeColor, double bikeHead, double bikeTail, double bikeWidth, double handlebarPosition, double handlebarHalfLength, double handlebarTail) Configure the the object representing a bicycle with default helmet dimensions.- Parameters:
helmetColor
- the color of the rider's helmetbikeColor
- the color of the bicyclebikeHead
- the distance from the seat to the front of the bicyclebikeTail
- the distance from the seat to the rear of the bicyclebikeWidth
- the width of the bicycle tubing (e.g., the frame)handlebarPosition
- the distance from the seat to the handle barshandlebarHalfLength
- the distance the handlebars extend perpendicular to the frame, measured from the frame and excluding the portion of the handlebars parallel to the framehandlebarTail
- the length of the portion of the handlebars parallel to the bicycle
-
configure
public void configure(Color helmetColor, Color bikeColor, double bikeHead, double bikeTail, double bikeWidth, double handlebarPosition, double handlebarHalfLength, double handlebarTail, double helmetScaleFactor) throws IllegalArgumentException Configure the the object representing a bicycle and helmet, providing a helmet-scaling factor. When the helemtScaleFactor argument is larger than 1.0, the position and font size of the string displayed whensetLooking(true)
is called will be changed from the default value.- Parameters:
helmetColor
- the color of the rider's helmetbikeColor
- the color of the bicyclebikeHead
- the distance from the seat to the front of the bicyclebikeTail
- the distance from the seat to the rear of the bicyclebikeWidth
- the width of the bicycle tubing (e.g., the frame)handlebarPosition
- the distance from the seat to the handle barshandlebarHalfLength
- the distance the handlebars extend perpendicular to the frame, measured from the frame and excluding the portion of the handlebars parallel to the framehandlebarTail
- the length of the portion of the handlebars parallel to the bicyclehelmetScaleFactor
- the factor by which the dimensions of a helmet will be multiplied when the helmet is configured- Throws:
IllegalArgumentException
-
configure
public void configure(Color helmetColor, Color bikeColor, double bikeHead, double bikeTail, double bikeWidth, double handlebarPosition, double handlebarHalfLength, double handlebarTail, double helmetScaleFactor, double lookStringScaleFactor) throws IllegalArgumentException Configure the the object representing a bicycle and helmet, providing a helmet-scaling factor and look-string scaling factor. When the helemtScaleFactor argument is larger than 1.0, the position and font size of the string displayed whensetLooking(true)
is called will be changed from the default value.The scale factor used to size the 'look' string will be lookStringScaleFactor when helmetScaleFactor is less than 1.0, and helmetScaleFactor*lookStringScaleFactor otherwise. The value of lookStringScaleFactor must not be less than 1.0.
- Parameters:
helmetColor
- the color of the rider's helmetbikeColor
- the color of the bicyclebikeHead
- the distance from the seat to the front of the bicyclebikeTail
- the distance from the seat to the rear of the bicyclebikeWidth
- the width of the bicycle tubing (e.g., the frame)handlebarPosition
- the distance from the seat to the handle barshandlebarHalfLength
- the distance the handlebars extend perpendicular to the frame, measured from the frame and excluding the portion of the handlebars parallel to the framehandlebarTail
- the length of the portion of the handlebars parallel to the bicyclehelmetScaleFactor
- the factor by which the dimensions of a helmet will be multiplied when the helmet is configuredlookStringScaleFactor
- the fraction by which the dimensions of the look-string text will be scaled.- Throws:
IllegalArgumentException
-
getLookString
Get the string to display when setLooking is given the argument 'true'.- Returns:
- the string to display
-
setLookString
Set the string to display when setLooking is given the argument 'true'.- Parameters:
string
- the string to display; null or an empty string for the default (the string "Look")
-
setLooking
public void setLooking(boolean value) Set whether or not the word "Look", or the value provided by the method setLookString, should be displayed in front of the helmet.- Parameters:
value
- true if the string should be displayed, false otherwise.
-
setLookParams
Set the font color for a "looking" indication. Calling any of the methods namedconfigure
will set the color to the default value, so to set the color to a different value, call this method after the config method is called.- Parameters:
color
- the text color
-
setHelmetAngle
public void setHelmetAngle(double angle) Set the angle of the helmet relative to the bicycle. An angle of zero points in the direction in which the bicycle is pointed, and angles are measured counterclockwise in radians.- Parameters:
angle
- the angle
-
getHelmetAngle
public double getHelmetAngle()Get the angle of the helmet relative to the bicycle. An angle of zero points in the direction in which the bicycle is pointed.- Returns:
- the helmet angle
-
getSeatXGCS
public double getSeatXGCS()Get the X coordinate of the seat in graph coordinate space.- Returns:
- the X coordinate of the seat in graph coordinate space.
-
getSeatYGCS
public double getSeatYGCS()Get the Y coordinate of the seat in graph coordinate space.- Returns:
- the Y coordinate of the seat in graph coordinate space.
-
addTo
-
printConfiguration
Print the configuration for an instance of Bicycle. 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 of this class. The data that will be printed when this method is called is the following.For class
Bicycle
:- the bicycle's color.
- the color of the rider's helmet.
- the helmet scale factor (when "looking", the helmet can be magnified to make it more obvious).
- the bicycle head (the distance from the seat to the front of the bicycle).
- the bicycle tail (the distance from the seat to the rear of the bicycle).
- the width of the bicycle.
- the handlebar position (the distance from the seat to the handlebars).
- the handlebar half length (extent to which one half of the hanglebars extends outwards).
- the handlebar tail (the length of a line drawn parallel to the bicycle to represent the ends of the handlebars).
- the helmet angle (the angle from the direction in which the bicycle is pointed, indicating the direction in which a rider would be looking).
- the look string (the string that will be displayed to indicate that a rider is looking at something).
- looking (a boolean that, when true, indicates that the look string is displayed).
- look-string color (the color of the font used for the look string).
- 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 Bicycle. 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 of this class. The data that will be printed when this method is called is the following.For class
Bicycle
:- the helmet angle (the angle from the direction in which the bicycle is pointed, indicating the direction in which a rider would be looking).
- the look string (the string that will be displayed to indicate that a rider is looking at something).
- looking (a boolean that, when true, indicates that the look string is displayed).
- 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
-