public class SwingBasicGraphRenderer extends GraphRendererBase
This is a minimal implementation of a renderer that only supports a subset of the CSS :
Modifier and Type | Field and Description |
---|---|
protected LayerRenderer |
backRenderer |
protected DefaultCamera |
camera
Set the view on the view port defined by the metrics.
|
protected EdgeRenderer |
edgeRenderer |
protected LayerRenderer |
foreRenderer |
protected PrintStream |
fpsLog |
protected NodeRenderer |
nodeRenderer |
protected SpriteRenderer |
spriteRenderer |
protected long |
steps |
protected double |
sumFps |
protected long |
T1 |
graph, renderingSurface, selection
Constructor and Description |
---|
SwingBasicGraphRenderer() |
Modifier and Type | Method and Description |
---|---|
ArrayList<GraphicElement> |
allNodesOrSpritesIn(double x1,
double y1,
double x2,
double y2)
Search for all the nodes and sprites contained inside the rectangle
(x1,y1)-(x2,y2).
|
protected void |
beginFrame() |
void |
close() |
protected void |
debugVisibleArea(Graphics2D g)
Show the centre, the low and high points of the graph, and the visible
area (that should always map to the window borders).
|
void |
elementStyleChanged(Element element,
StyleGroup oldStyle,
StyleGroup style)
The style of the element changed.
|
protected void |
endFrame() |
GraphicElement |
findNodeOrSpriteAt(double x,
double y)
Search for the first node or sprite (in that order) that contains the
point at coordinates (x, y).
|
Camera |
getCamera()
Get a camera object to provide control commands on the view.
|
void |
moveElementAtPx(GraphicElement element,
double x,
double y)
Force an element to move at the given location in pixels.
|
void |
open(GraphicGraph graph,
Container renderingSurface) |
void |
render(Graphics2D g,
int x,
int y,
int width,
int height)
Redisplay or update the graph.
|
protected void |
renderBackLayer(Graphics2D g) |
protected void |
renderForeLayer(Graphics2D g) |
protected void |
renderGraph(Graphics2D g) |
protected void |
renderGraphBackground(Graphics2D g)
Render the background of the graph.
|
protected void |
renderGraphElements(Graphics2D g)
Render the element of the graph.
|
protected void |
renderGroup(Graphics2D g,
StyleGroup group)
Render a style group.
|
protected void |
renderLayer(Graphics2D g,
LayerRenderer renderer) |
protected void |
renderSelection(Graphics2D g) |
void |
screenshot(String filename,
int width,
int height) |
void |
setBackLayerRenderer(LayerRenderer renderer)
Set a layer renderer that will be called each time the graph needs to be
redrawn before the graph is rendered.
|
void |
setForeLayoutRenderer(LayerRenderer renderer)
Set a layer renderer that will be called each time the graph needs to be
redrawn after the graph is rendered.
|
protected void |
setupGraphics(Graphics2D g) |
protected void |
setupSpriteStyle(Graphics2D g,
StyleGroup group) |
beginSelectionAt, displayNothingToDo, endSelectionAt, getRenderingSurface, selectionGrowsAt
protected DefaultCamera camera
protected NodeRenderer nodeRenderer
protected EdgeRenderer edgeRenderer
protected SpriteRenderer spriteRenderer
protected LayerRenderer backRenderer
protected LayerRenderer foreRenderer
protected PrintStream fpsLog
protected long T1
protected long steps
protected double sumFps
public SwingBasicGraphRenderer()
public void open(GraphicGraph graph, Container renderingSurface)
open
in interface GraphRenderer
open
in class GraphRendererBase
public void close()
close
in interface GraphRenderer
close
in class GraphRendererBase
public Camera getCamera()
GraphRenderer
public ArrayList<GraphicElement> allNodesOrSpritesIn(double x1, double y1, double x2, double y2)
GraphRenderer
x1
- The rectangle lowest point abscissa.y1
- The rectangle lowest point ordinate.x2
- The rectangle highest point abscissa.y2
- The rectangle highest point ordinate.public GraphicElement findNodeOrSpriteAt(double x, double y)
GraphRenderer
x
- The point abscissa.y
- The point ordinate.public void render(Graphics2D g, int x, int y, int width, int height)
GraphRenderer
protected void beginFrame()
protected void endFrame()
public void moveElementAtPx(GraphicElement element, double x, double y)
GraphRenderer
element
- The element.x
- The requested position abscissa in pixels.y
- The requested position ordinate in pixels.protected void renderGraph(Graphics2D g)
protected void setupGraphics(Graphics2D g)
protected void renderGraphBackground(Graphics2D g)
g
- The Swing graphics.protected void renderGraphElements(Graphics2D g)
g
- The Swing graphics.protected void renderGroup(Graphics2D g, StyleGroup group)
g
- The Swing graphics.group
- The group to render.protected void setupSpriteStyle(Graphics2D g, StyleGroup group)
protected void renderSelection(Graphics2D g)
protected void renderBackLayer(Graphics2D g)
protected void renderForeLayer(Graphics2D g)
protected void renderLayer(Graphics2D g, LayerRenderer renderer)
protected void debugVisibleArea(Graphics2D g)
public void screenshot(String filename, int width, int height)
public void setBackLayerRenderer(LayerRenderer renderer)
GraphRenderer
renderer
- The renderer (or null to remove it).public void setForeLayoutRenderer(LayerRenderer renderer)
GraphRenderer
renderer
- The renderer (or null to remove it).public void elementStyleChanged(Element element, StyleGroup oldStyle, StyleGroup style)
StyleGroupListener
element
- The element.oldStyle
- The old style.style
- The changed style or the new style of the element.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses