Class AnimationObject2DFactory<Obj extends AnimationObject2D>

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".
  • Constructor Details

    • AnimationObject2DFactory

      protected AnimationObject2DFactory(Animation2D a2d)
      Constructor.
      Parameters:
      a2d - the Animation2D associated with this factory
  • Method Details

    • getAnimation

      protected Animation2D 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 is false. In nearly all other cases, and all other cases in this package, the appropriate default is true.
      Parameters:
      visibility - the default visibility (true for visible and false 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 call super.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 class SimObjectFactory<AnimationObject2DFactory<Obj extends AnimationObject2D>,Animation2D,Obj extends AnimationObject2D>
    • initObject

      protected void initObject(Obj object)
      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 by createObject() and createObjects 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 class SimObjectFactory<AnimationObject2DFactory<Obj extends AnimationObject2D>,Animation2D,Obj extends AnimationObject2D>
      Parameters:
      object - the object to initialize
    • addToTimelineRequest

      protected void addToTimelineRequest(Obj object, int key, double time)
      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 class SimObjectFactory<AnimationObject2DFactory<Obj extends AnimationObject2D>,Animation2D,Obj extends AnimationObject2D>
      Parameters:
      object - the object being configured.
      key - the timeline key
      time - the time for the timeline entry