Gephi Toolkit Javadoc

org.gephi.preview.plugin.renderers
Class EdgeLabelRenderer

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

public class EdgeLabelRenderer
extends java.lang.Object
implements Renderer

Author:
Yudi Xue, Mathieu Bastian

Field Summary
protected  DependantOriginalColor defaultColor
           
protected  java.awt.Font defaultFont
           
protected  int defaultMaxChar
           
protected  DependantColor defaultOutlineColor
           
protected  float defaultOutlineOpacity
           
protected  float defaultOutlineSize
           
protected  boolean defaultShorten
           
protected  boolean defaultShowLabels
           
static java.lang.String EDGE_COLOR
           
protected  java.awt.Font font
           
static java.lang.String LABEL_X
           
static java.lang.String LABEL_Y
           
 
Constructor Summary
EdgeLabelRenderer()
           
 
Method Summary
protected  PVector bezierPoint(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float c)
           
 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.
protected  PVector linearInterpolation(float x1, float y1, float x2, float y2, float c)
           
 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 renderPDF(PDFTarget target, java.lang.String label, float x, float y, java.awt.Color color, float outlineSize, java.awt.Color outlineColor)
           
 void renderProcessing(ProcessingTarget target, java.lang.String label, float x, float y, java.awt.Color color, float outlineSize, java.awt.Color outlineColor)
           
 void renderSVG(SVGTarget target, Edge edge, java.lang.String label, float x, float y, java.awt.Color color, float outlineSize, java.awt.Color outlineColor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_COLOR

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

LABEL_X

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

LABEL_Y

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

defaultShowLabels

protected final boolean defaultShowLabels
See Also:
Constant Field Values

defaultFont

protected final java.awt.Font defaultFont

defaultShorten

protected final boolean defaultShorten
See Also:
Constant Field Values

defaultColor

protected final DependantOriginalColor defaultColor

defaultMaxChar

protected final int defaultMaxChar
See Also:
Constant Field Values

defaultOutlineSize

protected final float defaultOutlineSize
See Also:
Constant Field Values

defaultOutlineColor

protected final DependantColor defaultOutlineColor

defaultOutlineOpacity

protected final float defaultOutlineOpacity
See Also:
Constant Field Values

font

protected java.awt.Font font
Constructor Detail

EdgeLabelRenderer

public EdgeLabelRenderer()
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

renderProcessing

public void renderProcessing(ProcessingTarget target,
                             java.lang.String label,
                             float x,
                             float y,
                             java.awt.Color color,
                             float outlineSize,
                             java.awt.Color outlineColor)

renderSVG

public void renderSVG(SVGTarget target,
                      Edge edge,
                      java.lang.String label,
                      float x,
                      float y,
                      java.awt.Color color,
                      float outlineSize,
                      java.awt.Color outlineColor)

renderPDF

public void renderPDF(PDFTarget target,
                      java.lang.String label,
                      float x,
                      float y,
                      java.awt.Color color,
                      float outlineSize,
                      java.awt.Color outlineColor)

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

bezierPoint

protected PVector bezierPoint(float x1,
                              float y1,
                              float x2,
                              float y2,
                              float x3,
                              float y3,
                              float x4,
                              float y4,
                              float c)

linearInterpolation

protected PVector linearInterpolation(float x1,
                                      float y1,
                                      float x2,
                                      float y2,
                                      float c)

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