Cytoscape 2.8.0 API

cytoscape.render.stateful
Class GraphLOD

java.lang.Object
  extended by cytoscape.render.stateful.GraphLOD
Direct Known Subclasses:
CyGraphLOD, PrintLOD

public class GraphLOD
extends Object

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.


Constructor Summary
GraphLOD()
           
 
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.
 double getNestedNetworkImageScaleFactor()
           
 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.
 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
 

Constructor Detail

GraphLOD

public GraphLOD()
Method Detail

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.

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

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.

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.

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.

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.

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.

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.

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.

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.

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

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.