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
Fields Modifier and Type Field Description protected saf.v3d.Canvas2D
canvas
protected Map<Class<?>,StyledDisplayLayerOGL2D>
classStyleMap
protected saf.v3d.scene.VLayer
decoratorLayer
protected Map<String,ProjectionDecorator2D<?>>
decoratorMap
protected DisplayData<?>
displayData
protected boolean
doRender
protected boolean
glInitialized
protected boolean
iconified
protected Layout<?,?>
layout
protected LayoutUpdater
layoutUpdater
protected Map<Network<?>,NetworkLayerOGL2D>
networkStyleMap
protected JPanel
panel
protected Component
tabChild
protected JTabbedPane
tabParent
protected Runnable
updater
protected Map<ValueLayer,ValueLayerDisplayLayer>
valueLayerStyleMap
-
Fields inherited from class repast.simphony.visualization.AbstractDisplay
dlSupport, FRAME_UPDATE_INTERVAL, INFO_CURSOR, lastRenderTS, probeSupport
-
-
Constructor Summary
Constructors Constructor Description DisplayOGL2D(DisplayData<?> data, Layout<?,?> layout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addObject(Object o)
void
closed()
Notifies this IDisplay that its associated gui widget has been closed.DisplayEditorLifecycle
createEditor(JPanel panel)
Creates an DisplayEditor appropriate for editing this display.void
createPanel()
void
deIconified()
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
findLayer(Object obj)
Finds the layer associated with this object.Color
getBackgroundColor()
Gets the background color of this display.saf.v3d.Canvas2D
getCanvas()
Layout<?,?>
getLayout()
Gets the layout the display usesJPanel
getPanel()
Gets a panel that contains the actual gui for visualization.void
iconified()
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
removeObject(Object o)
void
render()
Render the display.void
resetHomeView()
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
setLayout(Layout<?,?> layout)
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 Detail
-
updater
protected Runnable updater
-
panel
protected JPanel panel
-
layout
protected Layout<?,?> layout
-
canvas
protected saf.v3d.Canvas2D canvas
-
displayData
protected DisplayData<?> displayData
-
classStyleMap
protected Map<Class<?>,StyledDisplayLayerOGL2D> classStyleMap
-
networkStyleMap
protected Map<Network<?>,NetworkLayerOGL2D> networkStyleMap
-
valueLayerStyleMap
protected Map<ValueLayer,ValueLayerDisplayLayer> valueLayerStyleMap
-
decoratorMap
protected Map<String,ProjectionDecorator2D<?>> decoratorMap
-
layoutUpdater
protected LayoutUpdater layoutUpdater
-
doRender
protected boolean doRender
-
glInitialized
protected boolean glInitialized
-
iconified
protected boolean iconified
-
tabParent
protected JTabbedPane tabParent
-
tabChild
protected Component tabChild
-
decoratorLayer
protected saf.v3d.scene.VLayer decoratorLayer
-
-
Constructor Detail
-
DisplayOGL2D
public DisplayOGL2D(DisplayData<?> data, Layout<?,?> layout)
-
-
Method Detail
-
init
public void init()
Description copied from interface:IDisplay
Initializes the display. Called once before the display is made visible.
-
setBackgroundColor
public void setBackgroundColor(Color color)
Sets the background color of this display.- Parameters:
color
- the new background color
-
getBackgroundColor
public Color getBackgroundColor()
Gets the background color of this display.- Returns:
- the background color.
-
moveObject
protected void moveObject(Object o)
- Specified by:
moveObject
in classAbstractDisplay
-
addObject
protected void addObject(Object o)
- Specified by:
addObject
in classAbstractDisplay
-
removeObject
protected void removeObject(Object o)
- 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
public DisplayEditorLifecycle createEditor(JPanel panel)
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
public Layout<?,?> getLayout()
Description copied from interface:IDisplay
Gets the layout the display uses
-
getPanel
public JPanel getPanel()
Description copied from interface:IDisplay
Gets a panel that contains the actual gui for visualization.
-
createPanel
public void createPanel()
-
stateChanged
public void stateChanged(ChangeEvent evt)
- Specified by:
stateChanged
in interfaceChangeListener
-
setLayout
public void setLayout(Layout<?,?> layout)
Description copied from interface:IDisplay
Sets the Layout for the display to use.
-
setLayoutFrequency
public void setLayoutFrequency(IDisplay.LayoutFrequency frequency, int interval)
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
public void registerDecorator(ProjectionDecorator2D<?> decorator)
-
findLayer
protected StyledDisplayLayerOGL2D findLayer(Object obj)
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
public void registerStyle(Class<?> clazz, StyleOGL2D<?> style)
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
public void registerNetworkStyle(Network<?> network, EdgeStyleOGL2D style)
Registers the specified style for the specified network.- Parameters:
network
- the networkstyle
-
-
registerValueLayerStyle
public void registerValueLayerStyle(ValueLayer layer, ValueLayerStyleOGL style)
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()
-
-