Class FxGraphRenderer

java.lang.Object
org.graphstream.ui.javafx.FxGraphRenderer
All Implemented Interfaces:
org.graphstream.ui.graphicGraph.StyleGroupListener, org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>

public class FxGraphRenderer
extends Object
implements org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>, org.graphstream.ui.graphicGraph.StyleGroupListener
2D renderer. The role of this class is to equip each style group with a specific renderer and to call these renderer to redraw the graph when needed. The renderers then equip each node, edge and sprite with a skeleton that gives is main geometry, then selects a shape according to the group style. The shape will be "applied" to each element to draw in the group. The shape will be moved and scaled according to the skeleton. A render pass begins by using the camera instance to set up the projection (allows to pass from graph units to pixels, make a rotation a zoom or a translation) and render each style group once for the shadows, and once for the real rendering in Z order. This class also handles a "selection" object that represents the current selection and renders it. The renderer uses a backend so that it can adapt to multiple rendering targets. As the shapes are finally responsible for drawing the graph, the backend is also responsible for the shape creation.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static String DEFAULT_RENDERER  
  • Constructor Summary

    Constructors 
    Constructor Description
    FxGraphRenderer()  
  • Method Summary

    Modifier and Type Method Description
    Collection<org.graphstream.ui.graphicGraph.GraphicElement> allGraphicElementsIn​(EnumSet<org.graphstream.ui.view.util.InteractiveElement> types, double x1, double y1, double x2, double y2)  
    void beginSelectionAt​(double x, double y)  
    void close()  
    org.graphstream.ui.view.View createDefaultView​(org.graphstream.ui.view.Viewer viewer, String id)  
    void elementStyleChanged​(org.graphstream.graph.Element element, org.graphstream.ui.graphicGraph.StyleGroup oldStyle, org.graphstream.ui.graphicGraph.StyleGroup style)  
    void endSelectionAt​(double x, double y)  
    org.graphstream.ui.graphicGraph.GraphicElement findGraphicElementAt​(EnumSet<org.graphstream.ui.view.util.InteractiveElement> types, double x, double y)  
    org.graphstream.ui.view.camera.Camera getCamera()  
    void moveElementAtPx​(org.graphstream.ui.graphicGraph.GraphicElement element, double x, double y)  
    void open​(org.graphstream.ui.graphicGraph.GraphicGraph graph, javafx.scene.layout.Pane drawingSurface)  
    void render​(javafx.scene.canvas.GraphicsContext g, int x, int y, int width, int height)  
    javafx.scene.layout.Pane renderingSurface()  
    void screenshot​(String filename, int width, int height)  
    void selectionGrowsAt​(double x, double y)  
    void setBackLayerRenderer​(org.graphstream.ui.view.LayerRenderer<javafx.scene.canvas.GraphicsContext> renderer)  
    void setForeLayoutRenderer​(org.graphstream.ui.view.LayerRenderer<javafx.scene.canvas.GraphicsContext> renderer)  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • open

      public void open​(org.graphstream.ui.graphicGraph.GraphicGraph graph, javafx.scene.layout.Pane drawingSurface)
      Specified by:
      open in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • close

      public void close()
      Specified by:
      close in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • getCamera

      public org.graphstream.ui.view.camera.Camera getCamera()
      Specified by:
      getCamera in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • renderingSurface

      public javafx.scene.layout.Pane renderingSurface()
    • beginSelectionAt

      public void beginSelectionAt​(double x, double y)
      Specified by:
      beginSelectionAt in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • selectionGrowsAt

      public void selectionGrowsAt​(double x, double y)
      Specified by:
      selectionGrowsAt in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • endSelectionAt

      public void endSelectionAt​(double x, double y)
      Specified by:
      endSelectionAt in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • moveElementAtPx

      public void moveElementAtPx​(org.graphstream.ui.graphicGraph.GraphicElement element, double x, double y)
      Specified by:
      moveElementAtPx in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • render

      public void render​(javafx.scene.canvas.GraphicsContext g, int x, int y, int width, int height)
      Specified by:
      render in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • screenshot

      public void screenshot​(String filename, int width, int height)
      Specified by:
      screenshot in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • setBackLayerRenderer

      public void setBackLayerRenderer​(org.graphstream.ui.view.LayerRenderer<javafx.scene.canvas.GraphicsContext> renderer)
      Specified by:
      setBackLayerRenderer in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • setForeLayoutRenderer

      public void setForeLayoutRenderer​(org.graphstream.ui.view.LayerRenderer<javafx.scene.canvas.GraphicsContext> renderer)
      Specified by:
      setForeLayoutRenderer in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • elementStyleChanged

      public void elementStyleChanged​(org.graphstream.graph.Element element, org.graphstream.ui.graphicGraph.StyleGroup oldStyle, org.graphstream.ui.graphicGraph.StyleGroup style)
      Specified by:
      elementStyleChanged in interface org.graphstream.ui.graphicGraph.StyleGroupListener
    • createDefaultView

      public org.graphstream.ui.view.View createDefaultView​(org.graphstream.ui.view.Viewer viewer, String id)
      Specified by:
      createDefaultView in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • findGraphicElementAt

      public org.graphstream.ui.graphicGraph.GraphicElement findGraphicElementAt​(EnumSet<org.graphstream.ui.view.util.InteractiveElement> types, double x, double y)
      Specified by:
      findGraphicElementAt in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>
    • allGraphicElementsIn

      public Collection<org.graphstream.ui.graphicGraph.GraphicElement> allGraphicElementsIn​(EnumSet<org.graphstream.ui.view.util.InteractiveElement> types, double x1, double y1, double x2, double y2)
      Specified by:
      allGraphicElementsIn in interface org.graphstream.ui.view.GraphRenderer<javafx.scene.layout.Pane,​javafx.scene.canvas.GraphicsContext>