Package ptolemy.domains.gr.lib
Class ViewScreen2D
- java.lang.Object
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- Actor,- Executable,- FiringsRecordable,- Placeable,- Initializable,- TypedActor,- ViewScreenInterface,- Changeable,- Debuggable,- DebugListener,- Derivable,- Instantiable,- ModelErrorHandler,- MoMLExportable,- Moveable,- Nameable
 
 public class ViewScreen2D extends GRActor2D implements Placeable, ViewScreenInterface A sink actor that renders a two-dimensional scene into a display screen. All mouse and keyboard events within the viewscreen are handled by a ViewScreen2DListener.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Steve Neuendorffer, Ismael M. Sarmiento
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (ismael)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classViewScreen2D.ViewScreen2DListenerListen for Layer, LayerMotion and Key events.- 
Nested classes/interfaces inherited from class ptolemy.kernel.EntityEntity.ContainedObjectsIterator
 
- 
 - 
Field SummaryFields Modifier and Type Field Description ColorAttributebackgroundColorThe red, green, blue, and alpha components of the background color of the viewscreen.ParameterhorizontalPixelsThe horizontal resolution of the display screen.ParameterlowerRightXThe x coordinate of the canvas point visible in the lower right corner of the display screen.ParameterlowerRightYThe y coordinate of the canvas point visible in the lower right corner of the display screen.ParameterrotatableBoolean variable that determines if the user is allowed to rotate the scene.ParameterscalableBoolean variable that determines if the user is allowed to scale the scene.TypedIOPortsceneGraphInThe input scene graph.ParametershowAxesBoolean variable that determines if the axes crosshairs are shown This parameter should contain a BooleanToken.ParametertranslatableBoolean variable that determines if the user is allowed to translate the scene.ParameterupperLeftXThe x coordinate of the canvas point visible in the upper left corner of the display screen.ParameterupperLeftYThe y coordinate of the canvas point visible in the upper left corner of the display screen.ParameterverticalPixelsThe vertical resolution of the display screen.- 
Fields inherited from class ptolemy.domains.gr.kernel.GRActor2D_viewScreen
 - 
Fields inherited from class ptolemy.domains.gr.kernel.GRActor_allowAttributeChanges, _isSceneGraphInitialized
 - 
Fields inherited from class ptolemy.actor.TypedAtomicActor_typesValid
 - 
Fields inherited from class ptolemy.actor.AtomicActor_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
 - 
Fields inherited from class ptolemy.kernel.util.NamedObj_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 - 
Fields inherited from interface ptolemy.actor.ExecutableCOMPLETED, NOT_READY, STOP_ITERATING
 
- 
 - 
Constructor SummaryConstructors Constructor Description ViewScreen2D(CompositeEntity container, java.lang.String name)Construct a ViewScreen2D in the given container with the given name.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_addChild(Figure figure)Add a figure to the figure layer and set its interactor.protected void_createViewScreen2D()Create the view screen component.protected int_getHorizontalPixels()Return the horizontal pixels by reading the horizontalPixels parameter.protected int_getVerticalPixels()Return the vertical pixels by reading the verticalPixels parameter.protected boolean_isRotatable()Return the value of the rotatable parameter.protected boolean_isScalable()Return the value of the scalable parameter.protected boolean_isTranslatable()Return the value of the translatable parameter.protected void_makeSceneGraphConnection()Set up the scene graph connections of this actor.voidfire()Repaint the canvas.JCanvasgetCanvas()Return the Diva canvas used by this view screen.BasicFiguregetCrosshairX()Return the horizontal component of the crosshair which marks the origin.BasicFiguregetCrosshairY()Return the vertical component of the crosshair which marks the origin.java.awt.geom.Point2D.DoublegetOrigin()Return the location of the origin of the viewscreen.FiguregetSelectedFigure()Return the figure currently selected in the viewscreen.voidinitialize()Initialize the execution.voidplace(java.awt.Container container)Set the container that this actor should display data in.voidsetSelectedFigure(Figure figure)Update the state of this object to reflect which figure is currently selected in the viewscreen.voidwrapup()Wrap up an execution.- 
Methods inherited from class ptolemy.domains.gr.kernel.GRActor2D_setViewScreen
 - 
Methods inherited from class ptolemy.actor.TypedAtomicActor_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
 - 
Methods inherited from class ptolemy.actor.AtomicActor_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
 - 
Methods inherited from class ptolemy.kernel.ComponentEntity_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
 - 
Methods inherited from class ptolemy.kernel.Entity_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
 - 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 - 
Methods inherited from class ptolemy.kernel.util.NamedObj_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface ptolemy.actor.ActorcreateReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 - 
Methods inherited from interface ptolemy.kernel.util.DerivablegetDerivedLevel, getDerivedList, propagateValue
 - 
Methods inherited from interface ptolemy.actor.ExecutableisFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 - 
Methods inherited from interface ptolemy.actor.InitializableaddInitializable, preinitialize, removeInitializable
 - 
Methods inherited from interface ptolemy.kernel.util.Nameabledescription, getContainer, getDisplayName, getFullName, getName, getName, setName
 
- 
 
- 
- 
- 
Field Detail- 
backgroundColorpublic ColorAttribute backgroundColor The red, green, blue, and alpha components of the background color of the viewscreen. This parameter must contain an array of double values. The default value is {1.0, 1.0, 1.0, 1.0}, corresponding to opaque white.
 - 
sceneGraphInpublic TypedIOPort sceneGraphIn The input scene graph.
 - 
horizontalPixelspublic Parameter horizontalPixels The horizontal resolution of the display screen. This parameter should contain a IntToken. The default value of this parameter is the IntToken 400.
 - 
rotatablepublic Parameter rotatable Boolean variable that determines if the user is allowed to rotate the scene. This parameter should contain a BooleanToken. The default value of this parameter is BooleanToken true.
 - 
scalablepublic Parameter scalable Boolean variable that determines if the user is allowed to scale the scene. This parameter should contain a BooleanToken. The default value of this parameter is BooleanToken false.
 - 
showAxespublic Parameter showAxes Boolean variable that determines if the axes crosshairs are shown This parameter should contain a BooleanToken. The default value of this parameter is BooleanToken true.
 - 
translatablepublic Parameter translatable Boolean variable that determines if the user is allowed to translate the scene. This parameter should contain a BooleanToken. The default value of this parameter is BooleanToken false.
 - 
verticalPixelspublic Parameter verticalPixels The vertical resolution of the display screen. This parameter should contain a IntToken. The default value of this parameter is IntToken 400.
 - 
upperLeftXpublic Parameter upperLeftX The x coordinate of the canvas point visible in the upper left corner of the display screen.
 - 
upperLeftYpublic Parameter upperLeftY The y coordinate of the canvas point visible in the upper left corner of the display screen.
 - 
lowerRightXpublic Parameter lowerRightX The x coordinate of the canvas point visible in the lower right corner of the display screen.
 - 
lowerRightYpublic Parameter lowerRightY The y coordinate of the canvas point visible in the lower right corner of the display screen.
 
- 
 - 
Constructor Detail- 
ViewScreen2Dpublic ViewScreen2D(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException Construct a ViewScreen2D in the given container with the given name. If the container argument is null, a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace.- Parameters:
- container- Container of the director.
- name- Name of this ViewScreen2D.
- Throws:
- IllegalActionException- If this actor is not compatible with the specified container.
- NameDuplicationException- If the container not a CompositeActor and the name collides with an entity in the container.
 
 
- 
 - 
Method Detail- 
firepublic void fire() throws IllegalActionExceptionRepaint the canvas.- Specified by:
- firein interface- Executable
- Overrides:
- firein class- GRActor
- Throws:
- IllegalActionException- If an error occurs during the scene graph initialization.
 
 - 
getCanvaspublic JCanvas getCanvas() Return the Diva canvas used by this view screen.- Returns:
- The Diva canvas.
 
 - 
getCrosshairXpublic BasicFigure getCrosshairX() Return the horizontal component of the crosshair which marks the origin.- Returns:
- The horizontal component of the crosshair which marks the origin.
 
 - 
getCrosshairYpublic BasicFigure getCrosshairY() Return the vertical component of the crosshair which marks the origin.- Returns:
- The vertical component of the crosshair which marks the origin.
 
 - 
getOriginpublic java.awt.geom.Point2D.Double getOrigin() Return the location of the origin of the viewscreen.- Returns:
- The origin of the viewscreen.
 
 - 
getSelectedFigurepublic Figure getSelectedFigure() Return the figure currently selected in the viewscreen.- Returns:
- The figure currently selected in the viewscreen.
- See Also:
- setSelectedFigure(Figure figure)
 
 - 
initializepublic void initialize() throws IllegalActionExceptionInitialize the execution. Create the ViewScreen2D frame if it hasn't been set using the place() method.- Specified by:
- initializein interface- Initializable
- Overrides:
- initializein class- GRActor
- Throws:
- IllegalActionException- If the base class throws it.
 
 - 
placepublic void place(java.awt.Container container) Set the container that this actor should display data in. If place is not called, then the actor will create its own frame for display.
 - 
setSelectedFigurepublic void setSelectedFigure(Figure figure) Update the state of this object to reflect which figure is currently selected in the viewscreen.- Parameters:
- figure- The figure currently selected.
- See Also:
- getSelectedFigure()
 
 - 
wrapuppublic void wrapup() throws IllegalActionExceptionWrap up an execution.- Specified by:
- wrapupin interface- Initializable
- Overrides:
- wrapupin class- GRActor
- Throws:
- IllegalActionException- If the base class throws it.
 
 - 
_addChildprotected void _addChild(Figure figure) throws IllegalActionException Add a figure to the figure layer and set its interactor.- Parameters:
- figure- The figure that is to be added.
- Throws:
- IllegalActionException- Always thrown for this base class.
 
 - 
_createViewScreen2Dprotected void _createViewScreen2D() throws IllegalActionExceptionCreate the view screen component. If place() was called with a container, then use the container. Otherwise, create a new frame and use that.- Throws:
- IllegalActionException- If there is a problem reading a parameter.
 
 - 
_getHorizontalPixelsprotected int _getHorizontalPixels() throws IllegalActionExceptionReturn the horizontal pixels by reading the horizontalPixels parameter.- Returns:
- the horizontal pixels.
- Throws:
- IllegalActionException- If thrown while reading the parameter.
 
 - 
_getVerticalPixelsprotected int _getVerticalPixels() throws IllegalActionExceptionReturn the vertical pixels by reading the verticalPixels parameter.- Returns:
- the vertical pixels.
- Throws:
- IllegalActionException- If thrown while reading the parameter.
 
 - 
_isRotatableprotected boolean _isRotatable() throws IllegalActionExceptionReturn the value of the rotatable parameter.- Returns:
- The value of the rotatable parameter.
- Throws:
- IllegalActionException- If thrown while reading the parameter.
 
 - 
_isScalableprotected boolean _isScalable() throws IllegalActionExceptionReturn the value of the scalable parameter.- Returns:
- The value of the scalable parameter.
- Throws:
- IllegalActionException- If thrown while reading the parameter.
 
 - 
_isTranslatableprotected boolean _isTranslatable() throws IllegalActionExceptionReturn the value of the translatable parameter.- Returns:
- The value of the tranlatable parameter.
- Throws:
- IllegalActionException- If thrown while reading the parameter.
 
 - 
_makeSceneGraphConnectionprotected void _makeSceneGraphConnection() throws IllegalActionExceptionSet up the scene graph connections of this actor.- Specified by:
- _makeSceneGraphConnectionin class- GRActor
- Throws:
- IllegalActionException- Always thrown for this base class.
 
 
- 
 
-