use of org.vcell.util.graphlayout.ContainedGraph.Container in project vcell by virtualcell.
the class GenericLogicGraphLayouter method getOrAddEdge.
protected static void getOrAddEdge(ContainerContext context, Edge edge) {
Node node1 = edge.getNode1();
Node node2 = edge.getNode2();
Container container = context.getContainer();
if (container.equals(node1.getContainer()) && container.equals(node2.getContainer())) {
GlgGraphEdge glgEdge = context.getEdgeMap().get(edge);
if (glgEdge == null) {
GlgGraphNode glgNode1 = getOrAddInternalNode(context, node1);
GlgGraphNode glgNode2 = getOrAddInternalNode(context, node2);
if (!context.getGlgGraph().NodesConnected(glgNode1, glgNode2)) {
glgEdge = context.getGlgGraph().AddEdge(glgNode1, glgNode2, edge);
context.getEdgeMap().put(edge, glgEdge);
}
}
} else if (container.equals(node1.getContainer())) {
GlgGraphEdge glgEdge = context.getEdgeMap().get(edge);
if (glgEdge == null) {
GlgGraphNode glgNode1 = getOrAddInternalNode(context, node1);
GlgGraphNode glgNodeExternal2 = getOrAddExternalNode(context, node2, node1);
if (!context.getGlgGraph().NodesConnected(glgNode1, glgNodeExternal2)) {
glgEdge = context.getGlgGraph().AddEdge(glgNode1, glgNodeExternal2, edge);
context.getEdgeMap().put(edge, glgEdge);
}
}
} else if (container.equals(node2.getContainer())) {
GlgGraphEdge glgEdge = context.getEdgeMap().get(edge);
if (glgEdge == null) {
GlgGraphNode glgNodeExternal1 = getOrAddExternalNode(context, node1, node2);
GlgGraphNode glgNode2 = getOrAddInternalNode(context, node2);
if (!context.getGlgGraph().NodesConnected(glgNodeExternal1, glgNode2)) {
glgEdge = context.getGlgGraph().AddEdge(glgNode2, glgNodeExternal1, edge);
context.getEdgeMap().put(edge, glgEdge);
}
}
}
}
use of org.vcell.util.graphlayout.ContainedGraph.Container in project vcell by virtualcell.
the class ShrinkCanvasLayouter method layout.
@Override
public void layout(ContainedGraph graph) {
for (Container container : graph.getContainers()) {
container.setWidth(SCALE * container.getWidth());
container.setHeight(SCALE * container.getHeight());
}
stretchLayouter.layout(graph);
}
Aggregations