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
  • Field Details

  • Constructor Details

  • Method Details

    • init

      public void init()
      Description copied from interface: IDisplay
      Initializes the display. Called once before the display is made visible.
      Specified by:
      init in interface IDisplay
    • 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 class AbstractDisplay
    • addObject

      protected void addObject(Object o)
      Specified by:
      addObject in class AbstractDisplay
    • removeObject

      protected void removeObject(Object o)
      Specified by:
      removeObject in class AbstractDisplay
    • closed

      public void closed()
      Description copied from interface: IDisplay
      Notifies this IDisplay that its associated gui widget has been closed.
      Specified by:
      closed in interface IDisplay
    • createEditor

      public DisplayEditorLifecycle createEditor(JPanel panel)
      Description copied from interface: IDisplay
      Creates an DisplayEditor appropriate for editing this display.
      Specified by:
      createEditor in interface IDisplay
      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 interface IDisplay
    • iconified

      public void iconified()
      Description copied from interface: IDisplay
      Notifies this IDisplay that its associated gui widget has been iconified.
      Specified by:
      iconified in interface IDisplay
    • resetHomeView

      public void resetHomeView()
      Description copied from interface: IDisplay
      Resets the home (initial) view of the display
      Specified by:
      resetHomeView in interface IDisplay
    • getLayout

      public Layout<?,?> getLayout()
      Description copied from interface: IDisplay
      Gets the layout the display uses
      Specified by:
      getLayout in interface IDisplay
      Returns:
      a layout object
    • getPanel

      public JPanel getPanel()
      Description copied from interface: IDisplay
      Gets a panel that contains the actual gui for visualization.
      Specified by:
      getPanel in interface IDisplay
      Returns:
      a panel that contains the actual gui for visualization.
    • createPanel

      public void createPanel()
    • stateChanged

      public void stateChanged(ChangeEvent evt)
      Specified by:
      stateChanged in interface ChangeListener
    • setLayout

      public void setLayout(Layout<?,?> layout)
      Description copied from interface: IDisplay
      Sets the Layout for the display to use.
      Specified by:
      setLayout in interface IDisplay
      Parameters:
      layout - the layout 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 interface IDisplay
      Parameters:
      frequency - the frequency of the layout
      interval - 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.
      Specified by:
      setPause in interface Renderer
    • update

      public void update()
      Description copied from interface: IDisplay
      Updates the state of the display to reflect whatever it is that it is displaying.
      Specified by:
      update in interface IDisplay
    • render

      public void render()
      Description copied from interface: Renderer
      Render the display. This rendering should take place asynchronously on the AWT thread.
      Specified by:
      render in interface Renderer
    • 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 for
      style - the style to register
    • registerNetworkStyle

      public void registerNetworkStyle(Network<?> network, EdgeStyleOGL2D style)
      Registers the specified style for the specified network.
      Parameters:
      network - the network
      style -
    • registerValueLayerStyle

      public void registerValueLayerStyle(ValueLayer layer, ValueLayerStyleOGL style)
      Registers the specified style and layer for display.
      Parameters:
      style - the styling info for displaying the layer
      layer - 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 interface IDisplay
      Overrides:
      destroy in class AbstractDisplay
    • pickPerformed

      public void pickPerformed(saf.v3d.picking.PickEvent evt)
      Specified by:
      pickPerformed in interface saf.v3d.picking.PickListener
    • init

      public void init(com.jogamp.opengl.GLAutoDrawable drawable, saf.v3d.scene.VRoot root)
      Specified by:
      init in interface saf.v3d.CanvasListener
    • reshape

      public void reshape(com.jogamp.opengl.GLAutoDrawable drawable, float width, float height, saf.v3d.scene.VRoot root)
      Specified by:
      reshape in interface saf.v3d.CanvasListener
    • vSpatialMoved

      public void vSpatialMoved(saf.v3d.scene.VSpatial spatial, org.jogamp.vecmath.Point3f localTrans)
      Specified by:
      vSpatialMoved in interface saf.v3d.CanvasListener
    • dispose

      public void dispose(com.jogamp.opengl.GLAutoDrawable drawable)
      Specified by:
      dispose in interface saf.v3d.CanvasListener
    • getCanvas

      public saf.v3d.Canvas2D getCanvas()