Search in sources :

Example 6 with Container

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);
            }
        }
    }
}
Also used : Container(org.vcell.util.graphlayout.ContainedGraph.Container) Node(org.vcell.util.graphlayout.ContainedGraph.Node)

Example 7 with Container

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);
}
Also used : Container(org.vcell.util.graphlayout.ContainedGraph.Container)

Aggregations

Container (org.vcell.util.graphlayout.ContainedGraph.Container)7 Node (org.vcell.util.graphlayout.ContainedGraph.Node)5 ReactionRuleDiagramShape (cbit.vcell.graph.ReactionRuleDiagramShape)1 ReactionStepShape (cbit.vcell.graph.ReactionStepShape)1 RuleParticipantSignatureDiagramShape (cbit.vcell.graph.RuleParticipantSignatureDiagramShape)1 SpeciesContextShape (cbit.vcell.graph.SpeciesContextShape)1 Dimension (java.awt.Dimension)1 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 Edge (org.vcell.util.graphlayout.ContainedGraph.Edge)1