Module org.bzdev.anim2d
Package org.bzdev.anim2d
Class AnimationObject2DFactory<Obj extends AnimationObject2D>
java.lang.Object
org.bzdev.obnaming.NamedObjectFactory<F,Simulation,SimObject,OBJ>
org.bzdev.devqsim.SimObjectFactory<AnimationObject2DFactory<Obj>,Animation2D,Obj>
org.bzdev.anim2d.AnimationObject2DFactory<Obj>
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AbstrAnimLayer2DFactory
,AbstrAnimPath2DFactory
,AbstrAnimShape2DFactory
,AbstrCartGrid2DFactory
,AbstrConnLine2DFactory
,AbstrM3DViewFactory
,AbstrPolarGridFactory
,PlacedObject2DFactory
public abstract class AnimationObject2DFactory<Obj extends AnimationObject2D>
extends SimObjectFactory<AnimationObject2DFactory<Obj>,Animation2D,Obj>
Abstract factory for animation objects.
The parameters supported are the following:
- "timeline" - an integer-keyed set of values that define
changes in the object's configuration. Subclasses may provide
additional parameters. The parameters are:
- "timeline.time" - the time at which timeline parameters are to change. This parameter must be provided if a timeline entry exists. The units are those used by the double-precision time unit for the simulation (for animations, this is generally seconds).
- "timeline.traceSetMode" - indicates how the parameter
"timeline.traceSets" is interpreted. the values are
enumeration constants of type
TraceSetMode
and 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 replace 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 (true if visible; false if not visible; not defined for a given key indicates no change);
- "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.
- "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".
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.obnaming.NamedObjectFactory
NamedObjectFactory.ConfigException, NamedObjectFactory.IndexedSetter, NamedObjectFactory.ParmNameIterator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToTimelineRequest
(Obj object, int key, double time) Request subclasses to add entries to the timeline.void
clear()
Clear all entries and restore to default values.protected Animation2D
Get the animation associated with this factory.boolean
Get the visibility for a new object.long
Get Z order for a new object.protected void
initObject
(Obj object) Initialize an object.protected void
setAnimationObjectDefaults
(boolean visibility, long zorder) Set the default Z order and visibility for this factory.Methods inherited from class org.bzdev.devqsim.SimObjectFactory
addToTimelineResponse, getSimulation
Methods 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
-
AnimationObject2DFactory
Constructor.- Parameters:
a2d
- the Animation2D associated with this factory
-
-
Method Details
-
getAnimation
Get the animation associated with this factory.- Returns:
- the animation.
-
setAnimationObjectDefaults
protected void setAnimationObjectDefaults(boolean visibility, long zorder) Set the default Z order and visibility for this factory. Most subclasses should not call this method. For this package, there is one exception: factories that create an AnimationShape2D. The exception occurs because the AnimationShape2D class was added to simplify creating animation layers when a graphics editor (e.g., the epts program) was used to create a series of paths to represent a boundary. Since instances of AnimationShape2D will frequently be used in an animation layer, the appropriate default visibility for this special case isfalse
. In nearly all other cases, and all other cases in this package, the appropriate default istrue
.- Parameters:
visibility
- the default visibility (true
for visible andfalse
for not visible)zorder
- the default Z order for objects created by this factory.
-
getZorder
public long getZorder()Get Z order for a new object.- Returns:
- the Z order.
-
getVisibility
public boolean getVisibility()Get the visibility for a new object.- Returns:
- true if the object should be visible; false otherwise
-
clear
public void clear()Description copied from class:NamedObjectFactory
Clear 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:
clear
in classSimObjectFactory<AnimationObject2DFactory<Obj extends AnimationObject2D>,
Animation2D, Obj extends AnimationObject2D>
-
initObject
Description copied from class:NamedObjectFactory
Initialize 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()
andcreateObjects
unless 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:
initObject
in classSimObjectFactory<AnimationObject2DFactory<Obj extends AnimationObject2D>,
Animation2D, Obj extends AnimationObject2D> - Parameters:
object
- the object to initialize
-
addToTimelineRequest
Description copied from class:SimObjectFactory
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:
addToTimelineRequest
in classSimObjectFactory<AnimationObject2DFactory<Obj extends AnimationObject2D>,
Animation2D, Obj extends AnimationObject2D> - Parameters:
object
- the object being configured.key
- the timeline keytime
- the time for the timeline entry
-