Cytoscape 2.8.0 API

cytoscape.render.stateful
Class EdgeDetails

java.lang.Object
  extended by cytoscape.render.stateful.EdgeDetails

public class EdgeDetails
extends Object

Defines the visual properties of an edge. Even though this class is not declared abstract, in most situations it makes sense to override at least some of its methods (especially segmentThickness()) in order to gain control over edge visual properties.

To understand the significance of each method's return value, it makes sense to become familiar with the API cytoscape.render.immed.GraphGraphics.


Field Summary
static byte EDGE_ANCHOR_MIDPOINT
          Specifies that an anchor point lies at the midpoint of an edge.
static byte EDGE_ANCHOR_SOURCE
          Specifies that an anchor point lies at an edge's endpoint at source node.
static byte EDGE_ANCHOR_TARGET
          Specifies that an anchor point lies at an edge's endpoint at target node.
 
Constructor Summary
EdgeDetails()
          Instantiates edge details with defaults.
 
Method Summary
 Paint anchorPaint(int edge, int anchorInx)
          Returns the paint to use when rendering an edge anchor.
 EdgeAnchors anchors(int edge)
          Returns edge anchors to use when rendering this edge.
 float anchorSize(int edge, int anchorInx)
          For edges with anchors, the anchors can be rendered as squares.
 Color colorLowDetail(int edge)
          Returns the color of edge in low detail rendering mode.
 int labelCount(int edge)
          Returns the number of labels that this edge has.
 byte labelEdgeAnchor(int edge, int labelInx)
          By returning one of the EDGE_ANCHOR_* constants, specifies where on an edge an anchor point lies.
 Font labelFont(int edge, int labelInx)
          Returns the font to use when rendering this label.
 byte labelJustify(int edge, int labelInx)
          By returning one of the NodeDetails.LABEL_WRAP_JUSTIFY_* constants, determines how to justify an edge label spanning multiple lines.
 float labelOffsetVectorX(int edge, int labelInx)
          Specifies the X component of the vector that separates a text anchor point from an edge anchor point.
 float labelOffsetVectorY(int edge, int labelInx)
          Specifies the Y component of the vector that separates a text anchor point from an edge anchor point.
 Paint labelPaint(int edge, int labelInx)
          Returns the paint of a text label.
 double labelScaleFactor(int edge, int labelInx)
          Returns an additional scaling factor that is to be applied to the font used to render this label; this scaling factor, applied to the point size of the font returned by labelFont(edge, labelInx), yields a new virtual font that is used to render the text label.
 String labelText(int edge, int labelInx)
          Returns a label's text.
 byte labelTextAnchor(int edge, int labelInx)
          By returning one of the NodeDetails.ANCHOR_* constants, specifies where on a text label's logical bounds box an anchor point lies.
 double labelWidth(int edge)
          Returns the width of the label.
 Paint segmentPaint(int edge)
          Returns the paint of the edge segment.
 Stroke segmentStroke(int edge)
           
 float segmentThickness(int edge)
          Returns the thickness of the edge segment.
 byte sourceArrow(int edge)
          Returns a GraphGraphics.ARROW_* constant; this defines the arrow to use when rendering the edge endpoint touching source node.
 Paint sourceArrowPaint(int edge)
          Returns the paint of the arrow at edge endpoint touching source node.
 float sourceArrowSize(int edge)
          Returns the size of the arrow at edge endpoint touching source node.
 byte targetArrow(int edge)
          Returns a GraphGraphics.ARROW_* constant; this defines the arrow to use when rendering the edge endpoint at the target node.
 Paint targetArrowPaint(int edge)
          Returns the paint of the arrow at edge endpoint touching target node.
 float targetArrowSize(int edge)
          Returns the size of the arrow at edge endpoint touching target node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_ANCHOR_MIDPOINT

public static final byte EDGE_ANCHOR_MIDPOINT
Specifies that an anchor point lies at the midpoint of an edge.

See Also:
Constant Field Values

EDGE_ANCHOR_SOURCE

public static final byte EDGE_ANCHOR_SOURCE
Specifies that an anchor point lies at an edge's endpoint at source node.

See Also:
Constant Field Values

EDGE_ANCHOR_TARGET

public static final byte EDGE_ANCHOR_TARGET
Specifies that an anchor point lies at an edge's endpoint at target node.

See Also:
Constant Field Values
Constructor Detail

EdgeDetails

public EdgeDetails()
Instantiates edge details with defaults. Documentation on each method describes defaults. To override defaults, extend this class.

Method Detail

colorLowDetail

public Color colorLowDetail(int edge)
Returns the color of edge in low detail rendering mode. By default this method returns Color.blue. It is an error to return null in this method.

In low detail rendering mode, this is the only method from this class that is looked at. The rest of the methods in this class define visual properties that are used in full detail rendering mode. In low detail rendering mode translucent colors are not supported whereas in full detail rendering mode they are.


sourceArrow

public byte sourceArrow(int edge)
Returns a GraphGraphics.ARROW_* constant; this defines the arrow to use when rendering the edge endpoint touching source node. By default this method returns GraphGraphics.ARROW_NONE. Take note of certain constraints specified in GraphGraphics.drawEdgeFull().


sourceArrowSize

public float sourceArrowSize(int edge)
Returns the size of the arrow at edge endpoint touching source node. By default this method returns zero. This return value is ignored if sourceArrow(edge) returns GraphGraphics.ARROW_NONE. Take note of certain constraints specified in GraphGraphics.drawEdgeFull().


sourceArrowPaint

public Paint sourceArrowPaint(int edge)
Returns the paint of the arrow at edge endpoint touching source node. By default this method returns null. This return value is ignored if sourceArrow(edge) returns GraphGraphics.ARROW_NONE it is an error to return null.


targetArrow

public byte targetArrow(int edge)
Returns a GraphGraphics.ARROW_* constant; this defines the arrow to use when rendering the edge endpoint at the target node. By default this method returns GraphGraphics.ARROW_NONE. Take note of certain constraints specified in GraphGraphics.drawEdgeFull().


targetArrowSize

public float targetArrowSize(int edge)
Returns the size of the arrow at edge endpoint touching target node. By default this method returns zero. Take note of certain constraints specified in GraphGraphics.drawEdgeFull().


targetArrowPaint

public Paint targetArrowPaint(int edge)
Returns the paint of the arrow at edge endpoint touching target node. By default this method returns null. This return value is ignored if targetArrow(edge) returns GraphGraphics.ARROW_NONE, it is an error to return null.


anchors

public EdgeAnchors anchors(int edge)
Returns edge anchors to use when rendering this edge. By default this method returns null; returning null is the optimal way to specify that this edge has no anchors. Take note of certain constraints, specified in GraphGraphics.drawEdgeFull(), pertaining to edge anchors.

The anchors returned are interpreted such that the anchor at index zero (the "first" anchor) is the anchor next to the source node of this edge; the last anchor is the anchor next to the target node of this edge. The rendering engine works such that if the first anchor lies inside the source node shape or if the last anchor lies inside the target node shape, the edge is not rendered.


anchorSize

public float anchorSize(int edge,
                        int anchorInx)
For edges with anchors, the anchors can be rendered as squares. To render an anchor, return a positive value in this method. If zero is returned no edge anchor is rendered. By default this method returns zero.


anchorPaint

public Paint anchorPaint(int edge,
                         int anchorInx)
Returns the paint to use when rendering an edge anchor. The output of this method is ignored if anchorSize(edge, anchorInx) returned zero; otherwise, a non-null value must be returned. By default this method returns null.


segmentThickness

public float segmentThickness(int edge)
Returns the thickness of the edge segment. By default this method returns zero. Take note of certain constraints specified in GraphGraphics.drawEdgeFull().


segmentStroke

public Stroke segmentStroke(int edge)

segmentPaint

public Paint segmentPaint(int edge)
Returns the paint of the edge segment. By default this method returns Color.blue. It is an error to return null in this method.


labelCount

public int labelCount(int edge)
Returns the number of labels that this edge has. By default this method returns zero.


labelText

public String labelText(int edge,
                        int labelInx)
Returns a label's text. By default this method always returns null. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero. It is an error to return null if this method is called by the rendering engine.

To specify multiple lines of text in an edge label, simply insert the '\n' character between lines of text.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.

labelFont

public Font labelFont(int edge,
                      int labelInx)
Returns the font to use when rendering this label. By default this method always returns null. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero. It is an error to return null if this method is called by the rendering engine.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.

labelScaleFactor

public double labelScaleFactor(int edge,
                               int labelInx)
Returns an additional scaling factor that is to be applied to the font used to render this label; this scaling factor, applied to the point size of the font returned by labelFont(edge, labelInx), yields a new virtual font that is used to render the text label. By default this method always returns 1.0. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.

labelPaint

public Paint labelPaint(int edge,
                        int labelInx)
Returns the paint of a text label. By default this method always returns null. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero. It is an error to return null if this method is called by the rendering engine.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.

labelTextAnchor

public byte labelTextAnchor(int edge,
                            int labelInx)
By returning one of the NodeDetails.ANCHOR_* constants, specifies where on a text label's logical bounds box an anchor point lies. This text anchor point together with the edge anchor point and label offset vector determines where, relative to the edge, the text's logical bounds box is to be placed. The text's logical bounds box is placed such that the label offset vector plus the edge anchor point equals the text anchor point.

By default this method always returns NodeDetails.ANCHOR_CENTER. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.
See Also:
NodeDetails.ANCHOR_CENTER, labelEdgeAnchor(int, int), labelOffsetVectorX(int, int), labelOffsetVectorY(int, int)

labelEdgeAnchor

public byte labelEdgeAnchor(int edge,
                            int labelInx)
By returning one of the EDGE_ANCHOR_* constants, specifies where on an edge an anchor point lies. This edge anchor point together with the text anchor point and label offset vector determines where, relative to the edge, the text's logical bounds box is to be placed. The text's logical bounds box is placed such that the label offset vector plus the edge anchor point equals the text anchor point.

By default this method always returns EDGE_ANCHOR_MIDPOINT. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.
See Also:
EDGE_ANCHOR_MIDPOINT, labelTextAnchor(int, int), labelOffsetVectorX(int, int), labelOffsetVectorY(int, int)

labelOffsetVectorX

public float labelOffsetVectorX(int edge,
                                int labelInx)
Specifies the X component of the vector that separates a text anchor point from an edge anchor point. This label offset vector together with the text anchor point and edge anchor point determines where, relative to the edge, the text's logical bounds box is to be placed. The text's logical bounds box is placed such that the label offset vector plus the edge anchor point equals the text anchor point.

By default this method always returns zero. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.
See Also:
labelOffsetVectorY(int, int), labelTextAnchor(int, int), labelEdgeAnchor(int, int)

labelOffsetVectorY

public float labelOffsetVectorY(int edge,
                                int labelInx)
Specifies the Y component of the vector that separates a text anchor point from an edge anchor point. This label offset vector together with the text anchor point and edge anchor point determines where, relative to the edge, the text's logical bounds box is to be placed. The text's logical bounds box is placed such that the label offset vector plus the edge anchor point equals the text anchor point.

By default this method always returns zero. This method is only called by the rendering engine if labelCount(edge) returns a value greater than zero.

Parameters:
labelInx - a value in the range [0, labelCount(edge)-1] indicating which edge label in question.
See Also:
labelOffsetVectorX(int, int), labelTextAnchor(int, int), labelEdgeAnchor(int, int)

labelJustify

public byte labelJustify(int edge,
                         int labelInx)
By returning one of the NodeDetails.LABEL_WRAP_JUSTIFY_* constants, determines how to justify an edge label spanning multiple lines. The choice made here does not affect the size of the logical bounding box of an edge label's text. The lines of text are justified within that logical bounding box.

By default this method always returns NodeDetails.LABEL_WRAP_JUSTIFY_CENTER. This return value is ignored if labelText(edge, labelInx) returns a text string that does not span multiple lines.

See Also:
NodeDetails.LABEL_WRAP_JUSTIFY_CENTER

labelWidth

public double labelWidth(int edge)
Returns the width of the label. By default this method returns 100. Take note of certain constraints specified in GraphGraphics.drawEdgeFull().


Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.