Optional
opt_graphLine: GraphLinea GraphLine to display (optional)
Private
graphThe GraphLines to draw.
Private
lastto detect when redraw needed; when the coordmap changes, we need to redraw.
Private
memIndex of last point drawn within GraphPoints list of each GraphLine
Private
needset when the entire graph needs to be redrawn.
Private
offThe offscreen buffer to draw the graph into
Private
useWhether to draw into the offscreen buffer.
Add a GraphLine to be displayed.
the GraphLine to be display
Whether the DisplayObject contains the given world coordinates point.
the point in world coordinates
true
if this DisplayObject contains the given point
Draws this DisplayObject using the given CoordMap.
the canvas's context to draw this object into
the mapping to use for translating between simulation and screen coordinates
Private
drawDraws a highly visible mark at the most recent point of the graph. Draws a small 5 pixel wide rectangle with the color set by GraphLine.setHotSpotColor. If the hot spot color is the empty string, then the hot spot is not drawn.
Private
drawPrivate
fullDraws the entire graph into the given Graphics context.
the canvas's context to draw into
the CoordMap specifying sim to screen conversion
Returns the set of MassObjects that this DisplayObject represents. Returns an empty list if this DisplayObject doesn't represent a MassObject.
the set of MassObjects that this DisplayObject represents
Returns the screen rectangle that this DisplayGraph is occupying within the SimView, in screen coordinates.
the screen rectangle of this DisplayGraph in screen coordinates
Private
incrementalDraws only the recent points into the given Graphics context. Keeps track of what was the last point drawn.
the canvas's context to draw into
the CoordMap specifying sim to screen conversion
Remove a GraphLine from set of those to display.
the GraphLine to not display
Causes entire graph to be redrawn, when draw is next called.
Sets this DisplayObject's position in simulation coordinates of the containing SimView. Each type of DisplayObject has a different policy regarding whether this will have an effect. Generally the policies are:
If the DisplayObject does not represent a SimObject, then the position can be set. Examples are DisplayClock, EnergyBarGraph.
If the SimObject's position is dependent on other objects, then the position cannot be set. Examples are DisplayConnector, DisplayRope, DisplaySpring.
If the SimObject can be moved independently and isDragable
is true
, then the position of the SimObject is modified. Example: DisplayShape.
this DisplayObject's position, in simulation coordinates.
Sets the screen rectangle that this DisplayGraph should occupy within the SimView, in screen coordinates.
the screen coordinates of the area this DisplayGraph should occupy.
Generated using TypeDoc
Displays one or more GraphLine. The GraphLines are drawn in the simulation coordinates of the containing SimView.
The screen rectangle that the DisplayGraph should occupy within the SimView must be set with setScreenRect before drawing can be done.
Additional GraphLines can be shown in the DisplayGraph, see addGraphLine.
The GraphLine can be drawn into an offscreen image, see setUseBuffer. The default is to use an offscreen image; this saves time by not needing to redraw the entire graph every frame.
Discontinuity
A change to a variable is either continuous or discontinuous. DisplayGraph doesn't draw a line at a point of discontinuity, but draws a dot instead. A discontinuity is indicated by incrementing the sequence number, see VarsList.