Class AbstrGraphViewFactory<Obj extends GraphView>

All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
GraphViewFactory

public abstract class AbstrGraphViewFactory<Obj extends GraphView> extends DirectedObject2DFactory<Obj>
Abstract GraphView factory. This class extends the class DirectedObject2DFactory. The class GraphViewFactory creates a full implementation. The additional parameters this factory provides are
  • "xFrameFraction" - the fractional distance from the graph's left offset to its right offset at which the point specifying the X coordinate of a GraphView's location appears. This point's graph coordinate space coordinates are (initialX, initialY). The graph is the Graph used by Animation2D to display an animation.
  • "yFrameFraction" - the fractional distance from the graph's lower offset to its upper offset at which the point specifying the Y coordinate of the graph's location appears. This point's graph coordinate space coordinates are (initialX, initialY). The graph is the Graph used by Animation2D to display an animation.
  • "scaleX" - the scale factor for the X direction (the amount by which to multiple a distance in graph coordinate space along the X axis to get the corresponding distance in user space).
  • "scaleY" - the scale factor for the X direction (the amount by which to multiple a distance in graph coordinate space along the Y axis to get the corresponding distance in user space).
  • "zoom" - the zoom level, which must be a positive real number.
  • "timeline" - a table of entries with integer keys providing the following parameters in addition to those provided by the class DirectedObject2DFactory:
    • "timeline.zoomMode" - a selector of type GraphView.ZoomMode indicating which of the following 4 parameters are valid. The values are SET_VALUE (indicating the "timeline.zoom" is valid), SET_RATE (indicating that "timeline.zoomRate is valid), or SET_TARGET (indicating that "timeline.zoomTarget" and "timeline.zoomInterval" are valid). The default value, KEEP, indicates that nothing will be changed.
    • "timeline.zoom" - the zoom level, which must be a positive real number, to be set at a specified time (see DirectedObject2DFactory). This parameter is valid if "timeline.zoomMode" is set to SET_VALUE;
    • "timeline.zoomRate" - the zoom rate, to be set at a specified time. The value of zoom will vary as exp(timeline.zoomRate * (t - time) where t > time and where time is value specified by "timeline.time" (see DirectedObject2DFactory). This parameter is valid if "timeline.zoomMode" is set to SET_RATE;
    • "timeline.zoomTarget" - the desired zoom level, which must be a positive real number. This parameter is valid if "timeline.zoomMode" is set to SET_TARGET;
    • "timeline.zoomInterval" - the interval, starting at a time specified by "timeline.time" (see DirectedObject2DFactory) over which the zoom level should change from its value at the the time specified by "timeline.time" to the value specified by "timeline.zoomTarget. This parameter is valid if "timeline.zoomMode" is set to SET_TARGET;
The parameters that are inherited from DirectedObject2DFactory and its superclasses are:
  • "initialX" - the initial X coordinate of the object in graph coordinate space.
  • "initialY" - the initial Y coordinate of the object in graph coordinate space.
  • "timeline" - an integer-keyed set of values that define changes in an object as it traverses a path, extended by the "timeline" parameters defined above.
    • "timeline.time" - the time at which timeline parameters are to change (typically measured in seconds, not simulation ticks).
    • "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.path" - the path that the object should follow. If 'animation' is the current Animation2D, animation.nullPath() will provide a constant path that indicates that the path should no longer be used. If no value is given, the value is not changed.
    • "timeline.t0" - the initial time interval from the time at which the path is set to the time at which the path traversal starts
    • "timeline.t0" - the initial time interval from the time at which the path is set to wait before the object can move.
    • "timeline.u0" - the initial value of the path's parameter (the default is 0.0).
    • "timeline.velocity" - the velocity along the path.
    • "timeline.acceleration" - the acceleration along the path.
    • "timeline.distanceFunction" - a SimFunction object associated with this animation giving the distance along the path as a function of time. If 'animation' is the current Animation2D, animation.nullFunction() will provide a function that indicates that the current function should no longer be used. If no value is given, the function is not changed.
    • "timeline.angleFunction" - a SimFunction object associated with this animation giving the angle of the object as it moves along the path as a function of time. If 'animation' is the current Animation2D, animation.nullFunction() will provide a function that indicates that the current function should no longer be used. If no value is given, the function is not changed. The value returned is in radians, not degrees. If a path is currently defined, the time argument treats an argument of zero as the time indicated by the path's "timeline.t0" parameter. Otherwise the argument refers to simulation time. The argument uses double-precision time units (not ticks).
    • "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).
  • "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.

Note that some of the parameters defined by superclasses are not shown. These have been removed because they are not appropriate for a GraphView.

  • Constructor Details

    • AbstrGraphViewFactory

      protected AbstrGraphViewFactory(Animation2D a2d)
      Constructor.
      Parameters:
      a2d - the animation
  • Method Details

    • 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 DirectedObject2DFactory<Obj extends GraphView>
    • addToTimelineRequest

      protected void addToTimelineRequest(Obj object, int key, double time)
      Description copied from class: DirectedObject2DFactory
      Request subclasses to add entries to the timeline. Each subclass adding entries should create a Callable that performs any necessary changes, which should be returned via a call to addToTimelineResponse, and each subclass that implements addToTimelineRequest must call super.addToTimelineRequest(object, key).
      Overrides:
      addToTimelineRequest in class DirectedObject2DFactory<Obj extends GraphView>
      Parameters:
      object - the object being configured.
      key - the timeline key
      time - the time for with the timeline entry
    • 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 PlacedObject2DFactory<Obj extends GraphView>
      Parameters:
      object - the object to initialize