Gephi Toolkit Javadoc

org.gephi.preview.plugin.renderers
Class EdgeRenderer

java.lang.Object
  extended by org.gephi.preview.plugin.renderers.EdgeRenderer
All Implemented Interfaces:
Renderer

public class EdgeRenderer
extends java.lang.Object
implements Renderer

Author:
Yudi Xue, Mathieu Bastian

Field Summary
static java.lang.String BEZIER_CURVENESS
           
protected  float defaultBezierCurviness
           
protected  EdgeColor defaultColor
           
protected  boolean defaultEdgeCurved
           
protected  int defaultOpacity
           
protected  float defaultRadius
           
protected  boolean defaultRescaleWeight
           
protected  boolean defaultShowEdges
           
protected  float defaultThickness
           
static java.lang.String EDGE_MAX_WEIGHT
           
static java.lang.String EDGE_MIN_WEIGHT
           
static java.lang.String SOURCE
           
static java.lang.String SOURCE_RADIUS
           
static java.lang.String TARGET
           
static java.lang.String TARGET_RADIUS
           
 
Constructor Summary
EdgeRenderer()
           
 
Method Summary
 java.lang.String getDisplayName()
          Provides an user friendly name for the renderer.
 PreviewProperty[] getProperties()
          Returns all associated properties for this renderer.
 boolean isRendererForitem(Item item, PreviewProperties properties)
          Based on properties, determine whether this renderer is valid to render Item.
 boolean needsItemBuilder(ItemBuilder itemBuilder, PreviewProperties properties)
          Based on the itemBuilder class and the properties, determine whether this renderer needs the given itemBuilder to be executed before rendering.
 void preProcess(PreviewModel previewModel)
          This method is called before rendering for all renderers and initializes items' additional attributes or run complex algorithms.
 void render(Item item, RenderTarget target, PreviewProperties properties)
          Render item to target using the global properties and item data.
 void renderCurvedEdge(Item edgeItem, Item sourceItem, Item targetItem, float thickness, java.awt.Color color, PreviewProperties properties, RenderTarget renderTarget)
           
 void renderSelfLoop(Item nodeItem, float thickness, java.awt.Color color, PreviewProperties properties, RenderTarget renderTarget)
           
 void renderStraightEdge(Item edgeItem, Item sourceItem, Item targetItem, float thickness, java.awt.Color color, PreviewProperties properties, RenderTarget renderTarget)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_MIN_WEIGHT

public static final java.lang.String EDGE_MIN_WEIGHT
See Also:
Constant Field Values

EDGE_MAX_WEIGHT

public static final java.lang.String EDGE_MAX_WEIGHT
See Also:
Constant Field Values

BEZIER_CURVENESS

public static final java.lang.String BEZIER_CURVENESS
See Also:
Constant Field Values

SOURCE

public static final java.lang.String SOURCE
See Also:
Constant Field Values

TARGET

public static final java.lang.String TARGET
See Also:
Constant Field Values

TARGET_RADIUS

public static final java.lang.String TARGET_RADIUS
See Also:
Constant Field Values

SOURCE_RADIUS

public static final java.lang.String SOURCE_RADIUS
See Also:
Constant Field Values

defaultShowEdges

protected boolean defaultShowEdges

defaultThickness

protected float defaultThickness

defaultRescaleWeight

protected boolean defaultRescaleWeight

defaultColor

protected EdgeColor defaultColor

defaultEdgeCurved

protected boolean defaultEdgeCurved

defaultBezierCurviness

protected float defaultBezierCurviness

defaultOpacity

protected int defaultOpacity

defaultRadius

protected float defaultRadius
Constructor Detail

EdgeRenderer

public EdgeRenderer()
Method Detail

preProcess

public void preProcess(PreviewModel previewModel)
Description copied from interface: Renderer
This method is called before rendering for all renderers and initializes items' additional attributes or run complex algorithms.

This method has access to any item using the getItems() methods of the preview model.

No data should be stored in the renderer itself but put in items using Item.setData(java.lang.String, java.lang.Object). Global states can be stored in properties using PreviewProperties.putValue(java.lang.String, java.lang.Object).

Specified by:
preProcess in interface Renderer
Parameters:
previewModel - the model to get items from

render

public void render(Item item,
                   RenderTarget target,
                   PreviewProperties properties)
Description copied from interface: Renderer
Render item to target using the global properties and item data.

The target can be one of the default target ProcessingTarget, SVGTarget or PDFTarget. Each target contains an access to it's drawing canvas so the renderer can draw visual items.

Specified by:
render in interface Renderer
Parameters:
item - the item to be rendered
target - the target to render the item on
properties - the central properties

renderSelfLoop

public void renderSelfLoop(Item nodeItem,
                           float thickness,
                           java.awt.Color color,
                           PreviewProperties properties,
                           RenderTarget renderTarget)

renderCurvedEdge

public void renderCurvedEdge(Item edgeItem,
                             Item sourceItem,
                             Item targetItem,
                             float thickness,
                             java.awt.Color color,
                             PreviewProperties properties,
                             RenderTarget renderTarget)

renderStraightEdge

public void renderStraightEdge(Item edgeItem,
                               Item sourceItem,
                               Item targetItem,
                               float thickness,
                               java.awt.Color color,
                               PreviewProperties properties,
                               RenderTarget renderTarget)

getProperties

public PreviewProperty[] getProperties()
Description copied from interface: Renderer
Returns all associated properties for this renderer. Properties can be built using static PreviewProperty.createProperty() methods.

Specified by:
getProperties in interface Renderer
Returns:
a properties array

isRendererForitem

public boolean isRendererForitem(Item item,
                                 PreviewProperties properties)
Description copied from interface: Renderer
Based on properties, determine whether this renderer is valid to render Item.

Additional states in properties helps to make a decision, including:

Specified by:
isRendererForitem in interface Renderer
Parameters:
item - the item to be tested
properties - the current properties
Returns:
true if item can be rendered by this renderer, false otherwise

needsItemBuilder

public boolean needsItemBuilder(ItemBuilder itemBuilder,
                                PreviewProperties properties)
Description copied from interface: Renderer
Based on the itemBuilder class and the properties, determine whether this renderer needs the given itemBuilder to be executed before rendering.

This is used for avoiding building unnecessary items while refreshing preview.

You can simply return true if the builder builds items that this renderer renders, but you can also check the current properties to see if your renderer is going to produce any graphic.

Additional states in properties helps to make a decision, including:

Specified by:
needsItemBuilder in interface Renderer
Parameters:
itemBuilder - builder that your renderer may need
properties - Current properties
Returns:
true if you are going to use built items for rendering, false otherwise

getDisplayName

public java.lang.String getDisplayName()
Description copied from interface: Renderer
Provides an user friendly name for the renderer. This name will appear in the renderers manager UI.

Specified by:
getDisplayName in interface Renderer
Returns:
User friendly renderer name, not null

Gephi Toolkit Javadoc