public class IOPGraph extends BufferedGlyphList
Manifold
. One can also request a thumbnail Image
of the graph.
Important methods are:
public boolean delete(IOPSubgraph subgraph)
public void expand(IOPNode contracted)
public void contract(IOPSubgraph subgraph, IOPNode replacement)
public IOPGraph collapse(IOPSubgraph subgraph, IOPNode replacement)
public IOPSubgraph makeSubgraph(Collection<GraphItem> items)
public IOPSubgraph makeSubgraph(IOPNode[] nodes, IOPEdge[] edges, IOPSubgraph[] subgraphs)
public IOPSubgraph makeSubgraph(String name, IOPNode[] nodes, IOPEdge[] edges, IOPSubgraph[] subgraphs)
public IOPSubgraph makeSubgraph(Collection<IOPNode> nodes, Collection<IOPEdge> edges, Collection<IOPSubgraph> subgraphs)
public IOPSubgraph makeSubgraph(String name, Collection<IOPNode> nodes, Collection<IOPEdge> edges, Collection<IOPSubgraph> subgraphs)
public GraphItem getGraphItemByGid(Integer gid)
public void addSubgraph(IOPSubgraph s)
public void removeSubgraph(IOPSubgraph subgraph)
public void addNode(IOPNode n)
public void rmNode(IOPNode n)
public void addEdge(IOPEdge e)
public void rmEdge(IOPEdge e)
public IOPSubgraph getSubgraph(String id)
public IOPNode[] getNodesInArray()
public Collection<IOPNode> getNodesInCollection()
public Collection<IOPSubgraph> getSubgraphInCollection()
public GraphItem[] getGraphItemsInArray()
public Collection<GraphItem> getGraphItemsInCollection()
public IOPNode getNode(String id)
public IOPEdge[] getEdgesInArray()
public IOPEdge getEdge(IOPNode source, IOPNode sink)
public IOPNode getIOPNode(String longname)
Modifier and Type | Field and Description |
---|---|
Closure |
colorClosure |
static java.awt.Color |
cxtBorderColor |
java.lang.String |
description |
static boolean |
expandAndContractDebug |
java.util.HashMap<java.lang.Integer,GraphItem> |
graphItemsByGid |
static int |
hitDelta |
java.lang.String |
images |
Closure |
menuBarClosure |
Closure |
mouseClickedClosure |
java.lang.String |
name |
Closure |
panelClosure |
protected java.lang.String |
rankdir |
java.lang.String |
title |
Closure |
toolBarClosure |
buffered, displayable, EDGE_THRESHOLD, LARGE, NODE_THRESHOLD, paintCount, paintDebug, THRESHOLD, version
Constructor and Description |
---|
IOPGraph()
Constructs an IOPGraph object.
|
IOPGraph(java.lang.String r)
Constructs an IOPGraph object with given layout.
|
IOPGraph(java.lang.String name,
java.lang.String title,
java.lang.String description,
IOPGraph parent,
Closure colorC,
Closure toolBarC,
Closure menuBarC) |
Modifier and Type | Method and Description |
---|---|
void |
add2Manifold(Glyphish glyph)
Adds a glyph to the appropriate charts in the manifold.
|
void |
addEdge(IOPEdge e)
Adds an edge to the graph.
|
void |
addNode(IOPNode n)
Adds a node to the graph.
|
void |
addSubgraph(IOPSubgraph s)
Adds a subgraph to the graph.
|
void |
clear()
Resets the graph to be empty.
|
void |
cloneFromGraph(IOPGraph clone)
Clone nodes and edges in this graph from given graph.
|
IOPGraph |
collapse(IOPSubgraph subgraph,
IOPNode replacement)
collapses the given subgraph to a single new given node.
|
void |
contract(IOPSubgraph subgraph,
IOPNode replacement)
contracts the given subgraph to a single new given node.
|
void |
createManifold()
This procedure creates, but doesn't initialize, the covering manifold.
|
boolean |
delete(IOPSubgraph subgraph)
Removes the given subgraph from the graph.
|
boolean |
doLayout()
Lays out an already existing graph.
|
boolean |
doLayout(IOPGraph context)
Layout graph.
|
void |
expand(IOPNode contracted)
Expands a contracted node in the graph.
|
void |
fireChange()
Is used to notify all those listeners registered that the glyphlist
has changed.
|
void |
fireChange(GraphItem item) |
static boolean |
getAntiAliased()
Fetches the current antialiasing setting.
|
IOPGraph[] |
getChildren() |
boolean |
getDisplayable() |
IOPEdge |
getEdge(IOPNode source,
IOPNode sink)
Obtain edge between given source and sink nodes.
|
IOPEdge |
getEdge(java.awt.geom.Point2D p)
Obtain (one) edge that contains given point or
null if
none of the edges intersects with point. |
IOPEdge |
getEdge(java.awt.geom.Point2D p,
double distance)
Obtain edge that intersects with square around given point of
side length distance/2, or
null if no such edge is found. |
IOPEdge[] |
getEdgesInArray()
Returns the edges in an array of
IOPEdge s. |
Glyphish |
getGlyphThing(java.awt.geom.Point2D p)
Overrides the method in the
Glyphish hierarchy. |
java.lang.String |
getGraphInfo() |
GraphItem |
getGraphItem(java.awt.geom.Point2D p,
double distance)
Find a graph item (node or edge) that
contains given point.
|
GraphItem |
getGraphItemByGid(java.lang.Integer gid) |
GraphItem[] |
getGraphItemsInArray() |
java.util.Collection<GraphItem> |
getGraphItemsInCollection() |
IOPNode |
getIOPNode(java.lang.String longname)
Find node associated with given long name in this graph.
|
IOPNode |
getNode(java.awt.geom.Point2D p)
Attempt to find a node located at a particular point.
|
IOPNode |
getNode(java.lang.String id)
Obtain node with given ID in this graph.
|
IOPNode[] |
getNodesInArray()
Returns the nodes in an array of
IOPNode s. |
java.util.Collection<IOPNode> |
getNodesInCollection() |
IOPGraph |
getParent() |
IOPSubgraph |
getParentSubgraph(IOPSubgraph subgraph) |
IOPSubgraph |
getSmallestSubgraph(IOPSubgraph s,
java.awt.geom.Point2D p) |
IOPSubgraph |
getSubgraph(java.awt.geom.Point2D p) |
IOPSubgraph |
getSubgraph(java.lang.String id) |
java.util.Collection<IOPSubgraph> |
getSubgraphInCollection() |
IOPSubgraph[] |
getSubgraphsInArray() |
boolean |
isDotLayout()
Obtain current layout mode of this graph.
|
java.util.HashMap<IOPNode,java.util.Vector<IOPNode>> |
makeAdjacencyList()
Creates a new adjacency list.
|
java.lang.String |
makeDotInput()
Produces a string that describes this graph, in dot format.
|
IOPSubgraph |
makeSubgraph(java.util.Collection<GraphItem> items) |
IOPSubgraph |
makeSubgraph(java.util.Collection<IOPNode> nodes,
java.util.Collection<IOPEdge> edges,
java.util.Collection<IOPSubgraph> subgraphs) |
IOPSubgraph |
makeSubgraph(IOPNode[] nodes,
IOPEdge[] edges,
IOPSubgraph[] subgraphs) |
IOPSubgraph |
makeSubgraph(java.lang.String name,
java.util.Collection<IOPNode> nodes,
java.util.Collection<IOPEdge> edges,
java.util.Collection<IOPSubgraph> subgraphs) |
IOPSubgraph |
makeSubgraph(java.lang.String name,
IOPNode[] nodes,
IOPEdge[] edges,
IOPSubgraph[] subgraphs) |
void |
paint(java.awt.Graphics2D g2d) |
void |
paint(java.awt.Graphics2D g2d,
java.awt.geom.Rectangle2D r)
Overrides the method in the
Glyphish hierarchy. |
void |
printAdjacencyList()
Prints, to the error stream, the adjacency list.
|
void |
removeSubgraph(IOPSubgraph subgraph)
Removes the subgraph from the graph.
|
void |
resetAllStatus()
Go through all nodes and remove flags.
|
void |
resetDotLayout()
Reset the cached position information of a previous DOT layout.
|
void |
rmEdge(IOPEdge e)
Removes an edge from the graph.
|
void |
rmNode(IOPNode n)
Removes a node the graph.
|
static void |
setAntiAliased(boolean value)
Sets whether or not antialiasing is used in drawing the graph.
|
void |
setDisplayable() |
boolean |
setGraph(java.io.File file)
Creates a graph from a stored file, in dot format.
|
void |
setParent(IOPGraph parent) |
void |
setStrokeWidth(float width)
Sets the stroke width of all edges.
|
int |
size()
The size of the glyph, i.e. the sum of the number of nodes and edges.
|
java.lang.String |
toInfoString() |
java.lang.String |
toString() |
void |
writeGraph(java.io.File file)
Writes the graph out to a file, in dot format.
|
void |
writeGraph(java.io.File file,
Dot.DotFormat dotFormat) |
void |
writeGraph(java.lang.String filepath,
Dot.DotFormat dotFormat) |
add, add, add, addChangeListener, fireChange, getBufferedImage, getBufferedImage, isLarge, remove, removeChangeListener, setDisplayable, setDisplayable
contains, dump, get, getBounds, getGlyphishInArray, getGlyphishInCollection, getHeight, getListIterator, getWidth, inside, intersects, length, setHeight, setWidth, transform
keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, rotate, rotate, scale, setKeyAction, setMouseAction, shear, translate, unsetMouseAction
_getAttribute, _setAttribute, getAttribute, getAttributeAsBoolean, getAttributeAsByte, getAttributeAsChar, getAttributeAsClosure, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsShort, getAttributeAsString, getKeys, getStaticAttribute, getStaticKeys, isAttribute, isStaticAttribute, removeAllAttributes, removeAllStaticAttributes, removeAttribute, removeStaticAttribute, setAttribute, setStaticAttribute, showAttributes, showAttributes
public static int hitDelta
protected final java.lang.String rankdir
public final java.util.HashMap<java.lang.Integer,GraphItem> graphItemsByGid
public java.lang.String name
public java.lang.String title
public java.lang.String description
public java.lang.String images
public Closure colorClosure
public Closure toolBarClosure
public Closure menuBarClosure
public Closure panelClosure
public Closure mouseClickedClosure
public static boolean expandAndContractDebug
public static java.awt.Color cxtBorderColor
public IOPGraph()
"TB"
for
top to bottom.public IOPGraph(java.lang.String r)
r
- String indicating how to layout the graph, it should
either be "LR"
for left to right, or "TB"
for
top to bottom.public IOPGraph getParent()
public void setParent(IOPGraph parent)
public IOPGraph[] getChildren()
public void cloneFromGraph(IOPGraph clone)
clone
- IOPGraph to be cloned in this graph
Ian asks in 2013: Why is this necessary?public void setDisplayable()
setDisplayable
in class BufferedGlyphList
public boolean getDisplayable()
public java.lang.String getGraphInfo()
public void createManifold()
Manifold
class.public void add2Manifold(Glyphish glyph)
glyph
- the glyph to be added to all those charts that it's
bounding rectangle has non-trivial intersection with.public void paint(java.awt.Graphics2D g2d, java.awt.geom.Rectangle2D r)
Glyphish
hierarchy.
Is optimized to use the manifold, if it is present.g2d
- the graphics object to be used to do the painting.r
- the rectangle that requires painting.public void paint(java.awt.Graphics2D g2d)
paint
in class BufferedGlyphList
public Glyphish getGlyphThing(java.awt.geom.Point2D p)
Glyphish
hierarchy.
Is optimized to use the manifold, if it is present.getGlyphThing
in class GlyphList
p
- the point where a glyph is sort.public int size()
THRESHOLD
in the Manifold
then a manifold is constructed for
this graph.public static void setAntiAliased(boolean value)
value
- the desired settinggetAntiAliased()
public static boolean getAntiAliased()
setAntiAliased(boolean)
public void setStrokeWidth(float width)
width
- the desired stroke width, a float.public boolean delete(IOPSubgraph subgraph)
subgraph
- the thing to be deleted.public void expand(IOPNode contracted)
contracted
- the node to be expanded.public void contract(IOPSubgraph subgraph, IOPNode replacement)
subgraph
- the graph to be contractedreplacement
- the optional node supplied to replace the collapsed subgraph.
The node can be null. It can be used to control how the collapsed node appears.public IOPGraph collapse(IOPSubgraph subgraph, IOPNode replacement)
subgraph
- the graph to be contractedreplacement
- the optional node supplied to replace the collapsed subgraph.
The node can be null. It can be used to control how the collapsed node appears.public IOPSubgraph getParentSubgraph(IOPSubgraph subgraph)
public IOPSubgraph makeSubgraph(java.util.Collection<GraphItem> items)
public IOPSubgraph makeSubgraph(IOPNode[] nodes, IOPEdge[] edges, IOPSubgraph[] subgraphs)
public IOPSubgraph makeSubgraph(java.lang.String name, IOPNode[] nodes, IOPEdge[] edges, IOPSubgraph[] subgraphs)
public IOPSubgraph makeSubgraph(java.util.Collection<IOPNode> nodes, java.util.Collection<IOPEdge> edges, java.util.Collection<IOPSubgraph> subgraphs)
public IOPSubgraph makeSubgraph(java.lang.String name, java.util.Collection<IOPNode> nodes, java.util.Collection<IOPEdge> edges, java.util.Collection<IOPSubgraph> subgraphs)
public GraphItem getGraphItemByGid(java.lang.Integer gid)
public void addSubgraph(IOPSubgraph s)
null
.
Notifies all the registered change listeners otherwise.s
- IOPSubgraph to be added
You should have made the subgraph by one of the makeSubgraph
routines.public void removeSubgraph(IOPSubgraph subgraph)
subgraph
- IOPSubgraph to be removed.
Tries to keep the graph sane.public void addNode(IOPNode n)
null
.
Notifies all the registered change listeners otherwise.n
- IOPNode to be addedpublic void rmNode(IOPNode n)
null
.
Notifies all the registered change listeners otherwise.n
- IOPNode to be removedpublic void clear()
clear
in class BufferedGlyphList
public void addEdge(IOPEdge e)
null
.
Notifies all the registered change listeners otherwise.e
- IOPEdge to be addedpublic void rmEdge(IOPEdge e)
null
.
Notifies all the registered change listeners otherwise.e
- IOPEdge to be removedpublic java.util.HashMap<IOPNode,java.util.Vector<IOPNode>> makeAdjacencyList()
public void printAdjacencyList()
public boolean setGraph(java.io.File file)
file
- from which the graph is to be loadedpublic java.lang.String makeDotInput()
public boolean doLayout()
public void writeGraph(java.io.File file)
file
- to be written.public void writeGraph(java.io.File file, Dot.DotFormat dotFormat)
public void writeGraph(java.lang.String filepath, Dot.DotFormat dotFormat)
public IOPEdge getEdge(java.awt.geom.Point2D p)
null
if
none of the edges intersects with point.p
- Point that indicates edge to be retrievednull
if no edge is found intersecting)public IOPEdge getEdge(java.awt.geom.Point2D p, double distance)
null
if no such edge is found.
This method first computes all eligible candidates by intersecting
all edges with a square of side length distance/2 and then
determines the (approximately) closest one among these.p
- Point to define center of square where to look for edgedistance
- side length of square to find edgenull
if no edge is found intersecting)public IOPNode getNode(java.awt.geom.Point2D p)
p
- the desired locationnull
if there is nonepublic IOPSubgraph getSubgraph(java.awt.geom.Point2D p)
public IOPSubgraph getSmallestSubgraph(IOPSubgraph s, java.awt.geom.Point2D p)
public GraphItem getGraphItem(java.awt.geom.Point2D p, double distance)
p
- Point to use for finding graph item (cannot be NULL)distance
- Maximum distance that clicked point may be away from edgepublic IOPSubgraph getSubgraph(java.lang.String id)
public IOPNode[] getNodesInArray()
IOPNode
s.public java.util.Collection<IOPNode> getNodesInCollection()
public IOPSubgraph[] getSubgraphsInArray()
public java.util.Collection<IOPSubgraph> getSubgraphInCollection()
public GraphItem[] getGraphItemsInArray()
public java.util.Collection<GraphItem> getGraphItemsInCollection()
public IOPNode getNode(java.lang.String id)
id
- String with ID of desired nodenull
otherwisepublic IOPEdge[] getEdgesInArray()
IOPEdge
s.public IOPEdge getEdge(IOPNode source, IOPNode sink)
source
- IOPNode that is source of desired edge
(cannot be null
!)sink
- IOPNode that is sink of desired edge
(cannot be null
!)null
otherwisepublic void fireChange()
BufferedGlyphList
fireChange
in class BufferedGlyphList
public void fireChange(GraphItem item)
public IOPNode getIOPNode(java.lang.String longname)
longname
- String of long name to look forpublic void resetAllStatus()
public boolean doLayout(IOPGraph context)
null
will invoke
dot
to position nodes and edges in graph. This results
in compact layout. If given context is not null
, will use
it as the super graph to position all nodes and edges exactly as they
are in super graph. This will add context nodes and edges from super
graph that are not currently in this graph.context
- IOPGraph that is used as a super graph to perform the
layout of graph elementspublic boolean isDotLayout()
dot
layout and false
otherwisepublic void resetDotLayout()
doLayout()
to invoke DOT again.public java.lang.String toInfoString()