Cytoscape 2.8.0 API

cytoscape.ding
Class CyGraphLOD

java.lang.Object
  extended by cytoscape.render.stateful.GraphLOD
      extended by cytoscape.ding.CyGraphLOD
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class CyGraphLOD
extends GraphLOD
implements PropertyChangeListener

An instance of this class defines the level of detail that goes into a single rendering of a graph. This class is meant to be subclassed; its methods are meant to be overridden; nonetheless, sane defaults are used in the default method implementations.

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
protected  int coarseDetailThreshold
           
protected  int edgeArrowThreshold
           
protected  int edgeLabelThreshold
           
protected  int nodeBorderThreshold
           
protected  int nodeLabelThreshold
           
 
Constructor Summary
CyGraphLOD()
          Creates a new CyGraphLOD object.
 
Method Summary
 boolean customGraphics(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to render custom graphics on nodes.
 boolean dashedEdges(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to honor dashed edges.
 boolean detail(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to render a graph at full detail.
 boolean edgeAnchors(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to honor edge anchors.
 boolean edgeArrows(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to render edge arrows.
 boolean edgeLabels(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to render edge labels.
protected  boolean getBoolean(String key, boolean defaultValue)
          Deprecated. Use PropUtil.getBoolean(..) instead. Leaving Feb 2011.
protected  int getInt(String key, int defaultValue)
          Deprecated. Use PropUtil.getInt(..) instead. Leaving Feb 2011.
 double getNestedNetworkImageScaleFactor()
           
protected  void init()
           
 boolean nodeBorders(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to render node borders.
 boolean nodeLabels(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to render node labels.
 void propertyChange(PropertyChangeEvent e)
          DOCUMENT ME!
 byte renderEdges(int visibleNodeCount, int totalNodeCount, int totalEdgeCount)
          Determines whether or not to render all edges in a graph, no edges, or only those edges which touch a visible node.
 boolean textAsShape(int renderNodeCount, int renderEdgeCount)
          Determines whether or not to draw text as shape when rendering node and edge labels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coarseDetailThreshold

protected int coarseDetailThreshold

nodeBorderThreshold

protected int nodeBorderThreshold

nodeLabelThreshold

protected int nodeLabelThreshold

edgeArrowThreshold

protected int edgeArrowThreshold

edgeLabelThreshold

protected int edgeLabelThreshold
Constructor Detail

CyGraphLOD

public CyGraphLOD()
Creates a new CyGraphLOD object.

Method Detail

propertyChange

public void propertyChange(PropertyChangeEvent e)
DOCUMENT ME!

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - DOCUMENT ME!

init

protected void init()

getInt

@Deprecated
protected int getInt(String key,
                                int defaultValue)
Deprecated. Use PropUtil.getInt(..) instead. Leaving Feb 2011.


getBoolean

@Deprecated
protected boolean getBoolean(String key,
                                        boolean defaultValue)
Deprecated. Use PropUtil.getBoolean(..) instead. Leaving Feb 2011.


renderEdges

public byte renderEdges(int visibleNodeCount,
                        int totalNodeCount,
                        int totalEdgeCount)
Determines whether or not to render all edges in a graph, no edges, or only those edges which touch a visible node. By default this method returns zero, which leads the rendering engine to render only those edges that touch at least one visible node. If a positive value is returned, all edges in the graph will be rendered. If a negative value is returned, no edges will be rendered. This is the first method called on an instance of GraphLOD by the rendering engine; the renderEdgeCount parameter passed to other methods will have a value which reflects the decision made by the return value of this method call.

Note that rendering all edges leads to a dramatic performance decrease when rendering large graphs.

Overrides:
renderEdges in class GraphLOD
Parameters:
visibleNodeCount - the number of nodes visible in the current viewport; note that a visible node is not necessarily a rendered node, because visible nodes with zero width or height are not rendered.
totalNodeCount - the total number of nodes in the graph that is being rendered.
totalEdgeCount - the total number of edges in the graph that is being rendered.
Returns:
zero if only edges touching a visible node are to be rendered, positive if all edges are to be rendered, or negative if no edges are to be rendered.

detail

public boolean detail(int renderNodeCount,
                      int renderEdgeCount)
Determines whether or not to render a graph at full detail. By default this method returns true if and only if the sum of rendered nodes and rendered edges is less than 1200.

The following table describes the difference between full and low rendering detail in terms of what methods on an instance of GraphGraphics get called:

full detail low detail
nodes drawNodeFull() drawNodeLow()
edges drawEdgeFull() drawEdgeLow()
node labels drawTextFull() not rendered
edge labels drawTextFull() not rendered
custom node graphics drawCustomGraphicFull() not rendered

Overrides:
detail in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true for full detail, false for low detail.

nodeBorders

public boolean nodeBorders(int renderNodeCount,
                           int renderEdgeCount)
Determines whether or not to render node borders. By default this method returns true if and only if the number of rendered nodes is less than 200.

It is only possible to draw node borders at the full detail level. If low detail is chosen, the output of this method is ignored.

Overrides:
nodeBorders in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if node borders are to be rendered.
See Also:
detail(int, int)

nodeLabels

public boolean nodeLabels(int renderNodeCount,
                          int renderEdgeCount)
Determines whether or not to render node labels. By default this method returns true if and only if the number of rendered nodes is less than 60.

Node labels are only rendered at the full detail level. If low detail is chosen, the output of this method is ignored.

Overrides:
nodeLabels in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if node labels are to be rendered.
See Also:
detail(int, int)

customGraphics

public boolean customGraphics(int renderNodeCount,
                              int renderEdgeCount)
Determines whether or not to render custom graphics on nodes. By default this method returns true if and only if the number of rendered nodes is less than 60.

Custom node graphics are only rendered at the full detail level. If low detail is chosen, the output of this method is ignored.

Overrides:
customGraphics in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if custom node graphics are to be rendered.
See Also:
detail(int, int)

edgeArrows

public boolean edgeArrows(int renderNodeCount,
                          int renderEdgeCount)
Determines whether or not to render edge arrows. By default this method returns true if and only if the number of rendered edges is less than 300.

It is only possible to draw edge arrows at the full detail level. If low detail is chosen, the output of this method is ignored.

Overrides:
edgeArrows in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if edge arrows are to be rendered.
See Also:
detail(int, int)

dashedEdges

public boolean dashedEdges(int renderNodeCount,
                           int renderEdgeCount)
Determines whether or not to honor dashed edges. By default this method always returns true. If false is returned, edges that claim to be dashed will be rendered as solid.

It is only possible to draw dashed edges at the full detail level. If low detail is chosen, the output of this method is ignored. Note that drawing dashed edges is computationally expensive; the default implementation of this method does not make a very performance-minded decision if a lot of edges happen to be dashed.

Overrides:
dashedEdges in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if dashed edges are to be honored.
See Also:
detail(int, int)

edgeAnchors

public boolean edgeAnchors(int renderNodeCount,
                           int renderEdgeCount)
Determines whether or not to honor edge anchors. By default this method always returns true. If false is returned, edges that claim to have edge anchors will be rendered as simple straight edges.

It is only possible to draw poly-edges at the full detail level. If low detail is chosen, the output of this method is ignored.

Overrides:
edgeAnchors in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if edge anchors are to be honored.
See Also:
detail(int, int)

edgeLabels

public boolean edgeLabels(int renderNodeCount,
                          int renderEdgeCount)
Determines whether or not to render edge labels. By default this method returns true if and only if the number of rendered edges is less than 80.

Edge labels are only rendered at the full detail level. If low detail is chosen, the output of this method is ignored.

Overrides:
edgeLabels in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if edge labels are to be rendered.
See Also:
detail(int, int)

textAsShape

public boolean textAsShape(int renderNodeCount,
                           int renderEdgeCount)
Determines whether or not to draw text as shape when rendering node and edge labels. By default this method always returns false.

This method affects the boolean parameter drawTextAsShape in the method call GraphGraphics.drawTextFull(). If neither node nor edge labels are rendered then the output of this method is ignored.

Overrides:
textAsShape in class GraphLOD
Parameters:
renderNodeCount - the number of nodes that are about to be rendered.
renderEdgeCount - the number of edges that are about to be rendered.
Returns:
true if and only if rendered label text should be drawn as primitive shapes.
See Also:
nodeLabels(int, int), edgeLabels(int, int)

getNestedNetworkImageScaleFactor

public double getNestedNetworkImageScaleFactor()
Overrides:
getNestedNetworkImageScaleFactor in class GraphLOD

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.