SimList to observe
the SimView to add DisplayObjects to
function to use for resizing the
simulation rectangle of the SimView; if null
then resizing is not done
Optional
opt_expand: numberfactor to multiply the width and height by to expand the path bounds, which yields the rectangle used for resizing the SimView. For example, 1.1 will make the bounds 10% larger.
Private
addCreates DisplayPath for the NumericalPath, and adds DisplayPath to SimView.
Notifies this Observer that a change has occurred in the Subject.
contains information about what has changed in the Subject: typically either a one-time GenericEvent, or a change to the value of a Parameter
Private
removeRemoves DisplayPath for the given NumericalPath from SimView.
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Generated using TypeDoc
Automatically creates a DisplayPath when a NumericalPath is added to a SimList. Observes the SimList of a Simulation, adding or removing DisplayPath to represent the NumericalPath in SimView with a
zIndex
of -10 so that it appears underneath other objects.Note that the DisplayPath shows only a single NumericalPath, and is destroyed when that NumericalPath is removed from the SimList.
Setting Style of DisplayPath
To control the style (color, line thickness, etc) used for a particular DisplayPath there are two approaches:
1. Modify the DisplayPath style directly
Modify the DisplayPath's style directly, for example:
2. Modify the prototype
PathObserver has a prototype DisplayPath. When a display property of a DisplayPath is
undefined
, then the property is fetched from the prototype DisplayPath. If it is alsoundefined
on the prototype then a default value is used.Keep in mind that all objects with a given prototype will be affected by any changes made to the prototype.
Here is an example where we set the prototype to have a thin blue line.
Resize the SimView to match NumericalPath
Often we want the SimView's dimensions to match that of the NumericalPath. To have the PathObserver change the bounding rectangle of the SimView to match that of the NumericalPath, specify the
simRectSetter
argument in the constructor. This will occur whenever the NumericalPath changes.