Module org.bzdev.anim2d
Package org.bzdev.anim2d
Class PlacedObject2DFactory<Obj extends PlacedAnimationObject2D>
java.lang.Object
org.bzdev.obnaming.NamedObjectFactory<F,Simulation,SimObject,OBJ>
org.bzdev.devqsim.SimObjectFactory<AnimationObject2DFactory<Obj>,Animation2D,Obj>
org.bzdev.anim2d.AnimationObject2DFactory<Obj>
org.bzdev.anim2d.PlacedObject2DFactory<Obj>
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
DirectedObject2DFactory
public abstract class PlacedObject2DFactory<Obj extends PlacedAnimationObject2D>
extends AnimationObject2DFactory<Obj>
Abstract factory for PlacedAnimationObject2D.
This factory inherits two parameters from its superclass:
- "zorder" - the initial stacking order (objects with smaller zorder values are rendered first). The zorder is defined as a long integer. The default value is 0. If two objects have the same zorder value the rendering order is technically indeterminate, but in practice the object created first will be rendered first (valid for the first 263-1 objects created).
- "visible" - true if the object is visible; false if it is not. The default value is "true".
- "timeline" - an integer-keyed set of values that define
changes in the object's configuration. This class provides
additional timeline parameters as described below.
- "timeline.time" - the time at which timeline parameters are to change (typically measured in seconds, not simulation ticks). This parameter is must be provided.
- "timeline.traceSetMode" - indicates how the parameter
"timeline.traceSets" is interpretted. the values are
enumeration constants of type
TraceSetModeand are used as follows:-
KEEP- keep the existing trace sets, adding additional ones specified by the parameter "timeline.traceSets". -
REMOVE- remove the trace sets specified by the parameter "timeline.traceSets". -
REPLACE- remove all existing trace sets and repalce those with the ones specified by the timeline.traceSets parameter.
-
- "timeline.traceSets" - a parameter representing a set of TraceSet objects (the three-argument 'add' method is used to add entries).
- "timeline.visible" -the visibility of the object. This parameter has the value true if visible, false if not visible. If this parameter is not defined for the key, the previous value is not changed.
- "timeline.zorder" - the zorder for the object. If this parameter is not defined for the key, the previous value is not changed.
- "traceSets" - a set of TraceSets a SimObject will use for tracing. One should use the add and remove factory methods as this parameter refers to a set of values.
The additional parameters supported are the following:
- "refPointMode" - the configuration mode. For each value,
there are one or two parameters that can be set. The
configuration-mode values are
-
BY_NAME- for this value the following parameter must be used:- "refPointName" - a symbolic name for a
reference point (
UPPER_LEFT,UPPER_CENTER,UPPER_RIGHT,LOWER_LEFT,CENTER_LEFT,CENTER,CENTER_RIGHT,LOWER_CENTER, orLOWER_RIGHT) relative to the object's bounding box.
- "refPointName" - a symbolic name for a
reference point (
-
BY_COORD- "refPointX" - the X coordinate of the reference point in graph coordinate space (the default is 0.0, and by convention should correspond to a centered object or some distinguished feature). The object will be drawn at this point when given coordinates of (0,0, 0.0) in graph coordinate space.
- "refPointY" - the Y coordinate of the reference point in graph coordinate space (the default is 0.0, and by convention should correspond to a centered object or some distinguished feature). The object will be drawn at this point when given coordinates of (0,0, 0.0) in graph coordinate space.
-
BY_FRACTION- "refPointFractX" - the X position of the reference point as a fractional distance between the smallest X value of the object's bounding box and the largest X value of the object's bounding box, with the smallest value indicated by 0.0 and the largest value by 1.0.
- "refPointFractY" - the Y position of the reference point as a fractional distance between the smallest Y value of the object's bounding box and the largest Y value of the object's bounding box, with the smallest value indicated by 0.0 and the largest value by 1.0.
-
- "initialX" - the initial X coordinate of the object in graph coordinate space.
- "initialY" - the initial Y coordinate of the object in graph coordinate space.
- "initialAngle" - the initial angle of the object in graph coordinate space, measured in degrees.
- "timeline" - additional "timeline" parameters are provided:
- "timeline.x" - the X coordinate of the reference point at the specified time, provided in graph coordinate space units. If this parameter is not defined for the key, the previous value is not changed.
- "timeline.y" - the Y coordinate of the reference point at the specified time, provided in graph coordinate space units. If this parameter is not defined for the key, the previous value is not changed.
- "timeline.angle" - the angle about the reference point at the specified time, with 0.0 referring to a reference direction (increasing angles are in the counterclockwise direction with 0.0 being a default, typically relative to a the coordinate system or to a path the object follows). If this parameter is not defined for the key, the previous value is not changed. The angle is measured in degrees, not radians.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumReferencePoint2D factory configuration mode.Nested classes/interfaces inherited from class org.bzdev.obnaming.NamedObjectFactory
NamedObjectFactory.ConfigException, NamedObjectFactory.IndexedSetter, NamedObjectFactory.ParmNameIterator -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPlacedObject2DFactory(Animation2D animation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToTimelineRequest(Obj object, int key, double time) Request subclasses to add entries to the timeline.voidclear()Clear all entries and restore to default values.protected voidinitObject(Obj object) Initialize an object.protected voidAssert that the timeline parameter "angle" is not used.Methods inherited from class org.bzdev.anim2d.AnimationObject2DFactory
getAnimation, getVisibility, getZorder, setAnimationObjectDefaultsMethods inherited from class org.bzdev.devqsim.SimObjectFactory
addToTimelineResponse, getSimulationMethods inherited from class org.bzdev.obnaming.NamedObjectFactory
add, add, add, add, add, add, add, add, addDocResourceBundle, addDocResourceBundle, addJDoc, addJDoc, addLabelResourceBundle, addLabelResourceBundle, addTipResourceBundle, addTipResourceBundle, arrayInit, canAdd3, clear, configure, configureSupported, containsParm, createObject, createObject, createObject, createObject, createObjects, createObjects, createObjects, createObjects, createObjects, createObjects, doAfterInits, endObjectCreation, getDoc, getFactoryClass, getGLB, getLabel, getLayoutResource, getListedFactories, getLUB, getNextName, getNextNameIndex, getObjectNamer, getParmKeyType, getParmPrefix, getRVMode, getTemplateKeyMap, getTemplateKeyMapForFactories, getTemplateKeyMapForFactories, getTemplateKeyMapForFactories, getTip, getType, glbInRange, initParm, initParms, initParms, isClearOnly, isNamedObject, isRandomVariable, keyType, lubInRange, mustAdd, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newConfigExceptionInstance, newInstance, newInstance, newObject, parmNames, parmNameSet, parmPrefixes, remove, remove, remove, remove, remove, remove, remove, remove, removeParm, removeParms, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setDocAPIBase, setInterned, setLayoutResource, setLayoutResource, setNameRoot, setTarget, startObjectCreation, unset, unset, unset, unset, unset, unset, willIntern
-
Constructor Details
-
PlacedObject2DFactory
Constructor.- Parameters:
animation- the animation
-
-
Method Details
-
clear
public void clear()Description copied from class:NamedObjectFactoryClear all entries and restore to default values. Note: each subclass that implements this method should callsuper.clear(). Any subclass that defines parameters should call this method in order to restore the parameters to their default values. When an annotation processor is used for some parameters, those parameters can be restored to their default value by calling the parm manager's setDefaults method with the factory as its argument.- Overrides:
clearin classAnimationObject2DFactory<Obj extends PlacedAnimationObject2D>
-
mayIgnoreTimelineAngle
protected void mayIgnoreTimelineAngle()Assert that the timeline parameter "angle" is not used. This should normally be called by a subclass during initialization but in any case before the factory's parameters are set. It should rarely be necessary to use this method as most instances of PlacedObject2D have an angle. The current exception is the GraphView factory as graph views cannot currently be rotated. -
addToTimelineRequest
Request subclasses to add entries to the timeline. Each subclass adding entries should create a Callable that performs any necessary operations at the specified time, and that Callable should be returned via a call to addToTimelineResponse. Each subclass that implements addToTimelineRequest must call super.addToTimelineRequest(object, key, time) as the first statement in addToTimelineRequest.- Overrides:
addToTimelineRequestin classAnimationObject2DFactory<Obj extends PlacedAnimationObject2D>- Parameters:
object- the object being configured.key- the timeline keytime- the time for with the timeline entry
-
initObject
Description copied from class:NamedObjectFactoryInitialize an object. This method will call the methods for the object necessary to initialize it based on how the factory was configured, and is called bycreateObject()andcreateObjectsunless these methods are overridden. The default method does nothing. Subclasses that override this method to provide subclass-specific initializations must start with the statement "super.initObject(object);".- Overrides:
initObjectin classAnimationObject2DFactory<Obj extends PlacedAnimationObject2D>- Parameters:
object- the object to initialize
-