Class myphysicslab.lab.view.SimView

Provided By
All Implemented Interfaces

Defines a rectangular region where a myphysicslab.lab.view.DisplayList draws a set of myphysicslab.lab.view.DisplayObjects. A DisplayObject typically represents a myphysicslab.lab.model.SimObject, but not always.

A SimView is shown inside a myphysicslab.lab.view.LabCanvas, possibly overlaid with other SimViews.

Boundary Rectangles

A SimView keeps track of two boundary rectangles: the simulation and screen rectangles.

  • The screen rectangle gives the size and location of this LabView within the containing LabCanvas. See #getScreenRect. The screen rectangle is initially set to a default size of 800 by 600.

  • The simulation rectangle specifies what area of the simulation to display in this LabView. See #getSimRect.

A myphysicslab.lab.view.CoordMap maps the simulation rectangle onto the screen rectangle, in accordance with various alignment options; see #setHorizAlign, #setVerticalAlign, #setAspectRatio. The CoordMap is available via #getCoordMap. The CoordMap is passed to each DisplayObject during the #paint method.

Pan-Zoom Controls

The methods such as #panUp, #panLeft, #zoomIn, #zoomOut are used to make a 'pan-zoom control' in myphysicslab.sims.layout.CommonControls#makePanZoomControls. The amount of pan-zoom that is done by each invocation of those methods can be changed via the properties #panX, #panY, #zoom.

Events Broadcast

SimView broadcasts these myphysicslab.lab.util.GenericEvents to its Observers:

Parameters Created

new SimView( name, simRect )


name of this SimView.


specifies what area of the simulation to display

Instance Methods

Instance Properties

Static Properties

Type Definitions