Class StyleRenderer
java.lang.Object
org.graphstream.ui.javafx.renderer.StyleRenderer
- All Implemented Interfaces:
org.graphstream.ui.graphicGraph.GraphicElement.SwingElementRenderer
- Direct Known Subclasses:
EdgeRenderer
,NodeRenderer
,SpriteRenderer
public abstract class StyleRenderer extends Object implements org.graphstream.ui.graphicGraph.GraphicElement.SwingElementRenderer
-
Constructor Summary
Constructors Constructor Description StyleRenderer(org.graphstream.ui.graphicGraph.StyleGroup group)
-
Method Summary
Modifier and Type Method Description static StyleRenderer
apply(org.graphstream.ui.graphicGraph.StyleGroup style, FxGraphRenderer mainRenderer)
abstract void
elementInvisible(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)
Called during rendering in place of#renderElement(GraphicsContext, DefaultCamera2D, GraphicElement)
to signal that the given element is not inside the view.abstract void
endRenderingPass(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean forShadow)
Called at the end of the rendering pass.abstract void
pushDynStyle(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)
Called before the rendering of elements on dynamic styles.abstract void
pushStyle(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean forShadow)
Called before the rendering of bulk and event elements.void
render(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Render all the (visible) elements of the group.void
render(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean shadow, org.graphstream.ui.javafx.renderer.FunctionInVoid<Backend,org.graphstream.ui.view.camera.DefaultCamera2D,org.graphstream.ui.graphicGraph.GraphicElement> render)
Main rendering method.abstract void
renderElement(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)
Render a single element knowing the style is already prepared.void
renderShadow(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera)
Render the shadow of all (visible) elements of the group.abstract void
renderShadow(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)
Render the shadow of the element.abstract void
setupRenderingPass(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean forShadow)
Called before the whole rendering pass for all elements.
-
Constructor Details
-
StyleRenderer
public StyleRenderer(org.graphstream.ui.graphicGraph.StyleGroup group)
-
-
Method Details
-
apply
public static StyleRenderer apply(org.graphstream.ui.graphicGraph.StyleGroup style, FxGraphRenderer mainRenderer) -
renderShadow
Render the shadow of all (visible) elements of the group. -
render
Render all the (visible) elements of the group. -
render
public void render(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean shadow, org.graphstream.ui.javafx.renderer.FunctionInVoid<Backend,org.graphstream.ui.view.camera.DefaultCamera2D,org.graphstream.ui.graphicGraph.GraphicElement> render)Main rendering method. This works in three phases: - draw all "bulk" elements using renderElement() - draw all "dynamic" elements using renderElement(). - draw all "event" elements using renderElement(). Before drawing, the setupRenderingPass() and pushStyle() methods are called. The phase 1 is run. Then for each dynamic element in phase 2, before calling renderElement, for each element the pushDynStyle() method is called. Then for each element modified by an event, in phase 3, the before drawing the element, the event is enabled, then pushStyle() is called, then the element is drawn, and finally the event is disabled. This rendering pass is made both for shadows and for regular drawing. The shadow and render arguments allow to specify that we are rendering for shadow, and what element rendering method to use (renderElement() or renderShadow()). -
setupRenderingPass
public abstract void setupRenderingPass(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean forShadow)Called before the whole rendering pass for all elements.- Parameters:
bck
- The rendering back-end.camera
- The camera.forShadow
- true if we are in the shadow rendering pass.
-
pushStyle
public abstract void pushStyle(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean forShadow)Called before the rendering of bulk and event elements.- Parameters:
bck
- The rendering back-end.camera
- The camera.forShadow
- true if we are in the shadow rendering pass.
-
pushDynStyle
public abstract void pushDynStyle(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)Called before the rendering of elements on dynamic styles. This must only change the style properties that can change dynamically.- Parameters:
bck
- The rendering back-end.camera
- The camera.element
- The graphic element concerned by the dynamic style change.
-
renderElement
public abstract void renderElement(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)Render a single element knowing the style is already prepared. Elements that are not visible are not drawn.- Parameters:
bck
- The rendering back-end.camera
- The camera.element
- The element to render.
-
renderShadow
public abstract void renderShadow(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)Render the shadow of the element.- Parameters:
bck
- The rendering back-end.camera
- The camera.element
- The element to render.
-
elementInvisible
public abstract void elementInvisible(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, org.graphstream.ui.graphicGraph.GraphicElement element)Called during rendering in place of#renderElement(GraphicsContext, DefaultCamera2D, GraphicElement)
to signal that the given element is not inside the view. The renderElement() method will be called as soon as the element becomes visible anew.- Parameters:
bck
- The rendering back-end.camera
- The camera.element
- The element to render.
-
endRenderingPass
public abstract void endRenderingPass(Backend bck, org.graphstream.ui.view.camera.DefaultCamera2D camera, boolean forShadow)Called at the end of the rendering pass.- Parameters:
bck
- The rendering back-end.camera
- The camera.forShadow
- true if we are in the shadow rendering pass.
-