Class DisplayOGL2D
java.lang.Object
repast.simphony.visualization.AbstractDisplay
repast.simphony.visualizationOGL2D.DisplayOGL2D
- All Implemented Interfaces:
EventListener
,ChangeListener
,Renderer
,ProjectionListener
,IDisplay
,saf.v3d.CanvasListener
,saf.v3d.picking.PickListener
public class DisplayOGL2D
extends AbstractDisplay
implements saf.v3d.CanvasListener, saf.v3d.picking.PickListener, ChangeListener
2D display that uses jogl for rendering.
- Author:
- Nick Collier
-
Nested Class Summary
Nested classes/interfaces inherited from interface repast.simphony.visualization.IDisplay
IDisplay.LayoutFrequency
-
Field Summary
Modifier and TypeFieldDescriptionprotected saf.v3d.Canvas2D
protected Map<Class<?>,
StyledDisplayLayerOGL2D> protected saf.v3d.scene.VLayer
protected Map<String,
ProjectionDecorator2D<?>> protected DisplayData<?>
protected boolean
protected boolean
protected boolean
protected Layout<?,
?> protected LayoutUpdater
protected Map<Network<?>,
NetworkLayerOGL2D> protected JPanel
protected Component
protected JTabbedPane
protected Runnable
protected Map<ValueLayer,
ValueLayerDisplayLayer> Fields inherited from class repast.simphony.visualization.AbstractDisplay
dlSupport, FRAME_UPDATE_INTERVAL, INFO_CURSOR, lastRenderTS, probeSupport
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
closed()
Notifies this IDisplay that its associated gui widget has been closed.createEditor
(JPanel panel) Creates an DisplayEditor appropriate for editing this display.void
void
Notifies this IDisplay that its associated gui widget has been deIconified.void
destroy()
Destroys the display, allowing it to free any resources it may have acquired.void
dispose
(com.jogamp.opengl.GLAutoDrawable drawable) protected StyledDisplayLayerOGL2D
Finds the layer associated with this object.Gets the background color of this display.saf.v3d.Canvas2D
Layout<?,
?> Gets the layout the display usesgetPanel()
Gets a panel that contains the actual gui for visualization.void
Notifies this IDisplay that its associated gui widget has been iconified.void
init()
Initializes the display.void
init
(com.jogamp.opengl.GLAutoDrawable drawable, saf.v3d.scene.VRoot root) protected void
moveObject
(Object o) void
pickPerformed
(saf.v3d.picking.PickEvent evt) void
registerDecorator
(ProjectionDecorator2D<?> decorator) void
registerNetworkStyle
(Network<?> network, EdgeStyleOGL2D style) Registers the specified style for the specified network.void
registerStyle
(Class<?> clazz, StyleOGL2D<?> style) Register the specified style for the specified class.void
registerValueLayerStyle
(ValueLayer layer, ValueLayerStyleOGL style) Registers the specified style and layer for display.protected void
void
render()
Render the display.void
Resets the home (initial) view of the displayvoid
reshape
(com.jogamp.opengl.GLAutoDrawable drawable, float width, float height, saf.v3d.scene.VRoot root) void
setBackgroundColor
(Color color) Sets the background color of this display.void
Sets the Layout for the display to use.void
setLayoutFrequency
(IDisplay.LayoutFrequency frequency, int interval) Sets the frequency of the layout.void
setPause
(boolean pause) Pause the rendering.void
stateChanged
(ChangeEvent evt) void
update()
Updates the state of the display to reflect whatever it is that it is displaying.void
vSpatialMoved
(saf.v3d.scene.VSpatial spatial, org.jogamp.vecmath.Point3f localTrans) Methods inherited from class repast.simphony.visualization.AbstractDisplay
addDisplayListener, addProbeListener, createInfoCursor, getProbeSupport, projectionEventOccurred, registerToolBar, setProbeSupport
-
Field Details
-
updater
-
panel
-
layout
-
canvas
protected saf.v3d.Canvas2D canvas -
displayData
-
classStyleMap
-
networkStyleMap
-
valueLayerStyleMap
-
decoratorMap
-
layoutUpdater
-
doRender
protected boolean doRender -
glInitialized
protected boolean glInitialized -
iconified
protected boolean iconified -
tabParent
-
tabChild
-
decoratorLayer
protected saf.v3d.scene.VLayer decoratorLayer
-
-
Constructor Details
-
DisplayOGL2D
-
-
Method Details
-
init
public void init()Description copied from interface:IDisplay
Initializes the display. Called once before the display is made visible. -
setBackgroundColor
Sets the background color of this display.- Parameters:
color
- the new background color
-
getBackgroundColor
Gets the background color of this display.- Returns:
- the background color.
-
moveObject
- Specified by:
moveObject
in classAbstractDisplay
-
addObject
- Specified by:
addObject
in classAbstractDisplay
-
removeObject
- Specified by:
removeObject
in classAbstractDisplay
-
closed
public void closed()Description copied from interface:IDisplay
Notifies this IDisplay that its associated gui widget has been closed. -
createEditor
Description copied from interface:IDisplay
Creates an DisplayEditor appropriate for editing this display.- Specified by:
createEditor
in interfaceIDisplay
- Parameters:
panel
- a JPanel with a BorderLayout to which editor components can be added- Returns:
- an DisplayEditor appropriate for editing this display or null if this display cannot be edited.
-
deIconified
public void deIconified()Description copied from interface:IDisplay
Notifies this IDisplay that its associated gui widget has been deIconified.- Specified by:
deIconified
in interfaceIDisplay
-
iconified
public void iconified()Description copied from interface:IDisplay
Notifies this IDisplay that its associated gui widget has been iconified. -
resetHomeView
public void resetHomeView()Description copied from interface:IDisplay
Resets the home (initial) view of the display- Specified by:
resetHomeView
in interfaceIDisplay
-
getLayout
Description copied from interface:IDisplay
Gets the layout the display uses -
getPanel
Description copied from interface:IDisplay
Gets a panel that contains the actual gui for visualization. -
createPanel
public void createPanel() -
stateChanged
- Specified by:
stateChanged
in interfaceChangeListener
-
setLayout
Description copied from interface:IDisplay
Sets the Layout for the display to use. -
setLayoutFrequency
Description copied from interface:IDisplay
Sets the frequency of the layout.- Specified by:
setLayoutFrequency
in interfaceIDisplay
- Parameters:
frequency
- the frequency of the layoutinterval
- the interval if the frequency is AT_INTERVAL. The interval is in terms of number of calls to update()
-
setPause
public void setPause(boolean pause) Description copied from interface:Renderer
Pause the rendering. The Renderer should update and render if pause is true, if possible. The rendering should take place asynchronously on the AWT thread. -
update
public void update()Description copied from interface:IDisplay
Updates the state of the display to reflect whatever it is that it is displaying. -
render
public void render()Description copied from interface:Renderer
Render the display. This rendering should take place asynchronously on the AWT thread. -
registerDecorator
-
findLayer
Finds the layer associated with this object. This will return the layer explicitly associated with the object. If that is not found then this will return the first layer associated with the objects parent classes or interface.- Parameters:
obj
- the object to find the layer for- Returns:
- the layer that best matches the object
-
registerStyle
Register the specified style for the specified class. All objects of that class will be styled using that style.- Parameters:
clazz
- the class to register the style forstyle
- the style to register
-
registerNetworkStyle
Registers the specified style for the specified network.- Parameters:
network
- the networkstyle
-
-
registerValueLayerStyle
Registers the specified style and layer for display.- Parameters:
style
- the styling info for displaying the layerlayer
- the layer to display
-
destroy
public void destroy()Description copied from class:AbstractDisplay
Destroys the display, allowing it to free any resources it may have acquired.- Specified by:
destroy
in interfaceIDisplay
- Overrides:
destroy
in classAbstractDisplay
-
pickPerformed
public void pickPerformed(saf.v3d.picking.PickEvent evt) - Specified by:
pickPerformed
in interfacesaf.v3d.picking.PickListener
-
init
public void init(com.jogamp.opengl.GLAutoDrawable drawable, saf.v3d.scene.VRoot root) - Specified by:
init
in interfacesaf.v3d.CanvasListener
-
reshape
public void reshape(com.jogamp.opengl.GLAutoDrawable drawable, float width, float height, saf.v3d.scene.VRoot root) - Specified by:
reshape
in interfacesaf.v3d.CanvasListener
-
vSpatialMoved
public void vSpatialMoved(saf.v3d.scene.VSpatial spatial, org.jogamp.vecmath.Point3f localTrans) - Specified by:
vSpatialMoved
in interfacesaf.v3d.CanvasListener
-
dispose
public void dispose(com.jogamp.opengl.GLAutoDrawable drawable) - Specified by:
dispose
in interfacesaf.v3d.CanvasListener
-
getCanvas
public saf.v3d.Canvas2D getCanvas()
-