Search in sources :

Example 36 with Shape

use of cbit.gui.graph.Shape in project vcell by virtualcell.

the class ShapeGroupUtil method disbandGroup.

public static void disbandGroup(GraphModel graphModel, Shape groupShape) {
    List<Shape> memberShapes = new ArrayList<Shape>(groupShape.getChildren());
    Shape parentShape = groupShape.getParent();
    if (parentShape != null) {
        for (Shape memberShape : memberShapes) {
            parentShape.addChildShape(memberShape);
        }
        parentShape.removeChild(groupShape);
    }
    groupShape.removeAllChildren();
    graphModel.removeShape(groupShape);
    for (Shape edge : ShapeUtil.getEdges(graphModel, groupShape)) {
        graphModel.removeShape(edge);
    }
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) ArrayList(java.util.ArrayList)

Example 37 with Shape

use of cbit.gui.graph.Shape in project vcell by virtualcell.

the class ShapeGroupUtil method moveMembersToGroup.

public static void moveMembersToGroup(Shape groupShape, Collection<Shape> memberShapes) {
    for (Shape memberShape : memberShapes) {
        if (!willBeSkippedWhenGrouping(memberShape)) {
            Point absLocation = memberShape.getSpaceManager().getAbsLoc();
            groupShape.addChildShape(memberShape);
            memberShape.getSpaceManager().setAbsLoc(absLocation);
        }
    }
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) Point(java.awt.Point)

Example 38 with Shape

use of cbit.gui.graph.Shape in project vcell by virtualcell.

the class VCGroupManager method disbandSelectedGroups.

public void disbandSelectedGroups() {
    GraphModel graphModel = graphView.getGraphModel();
    List<Shape> selectedShapes = graphModel.getSelectedShapes();
    Set<Shape> groups = new HashSet<Shape>();
    for (Shape selectedShape : selectedShapes) {
        if (ShapeGroupUtil.isGroup(selectedShape)) {
            groups.add(selectedShape);
        }
    // else {
    // Shape parent = selectedShape.getParent();
    // if(parent != null && ShapeGroupUtil.isGroup(parent)) {
    // groups.add(parent);
    // }
    // }
    }
    for (Shape group : groups) {
        ShapeGroupUtil.disbandGroup(graphModel, group);
    }
    graphView.repaint();
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel) HashSet(java.util.HashSet)

Example 39 with Shape

use of cbit.gui.graph.Shape in project vcell by virtualcell.

the class VCGroupManager method expandSelectedGroups.

public void expandSelectedGroups() {
    GraphModel graphModel = graphView.getGraphModel();
    List<Shape> selectedShapes = graphModel.getSelectedShapes();
    for (Shape selectedShape : selectedShapes) {
        ShapeGroupUtil.expandGroup(selectedShape);
    }
    graphView.repaint();
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel)

Example 40 with Shape

use of cbit.gui.graph.Shape in project vcell by virtualcell.

the class VCGroupManager method collapseAsNewGroup.

public void collapseAsNewGroup() {
    GraphModel graphModel = graphView.getGraphModel();
    List<Shape> selectedShapes = graphModel.getSelectedShapes();
    try {
        GroupShape groupShape = ShapeGroupUtil.createGroup(graphModel, groupNamer.createName(), selectedShapes);
        ShapeGroupUtil.collapseGroup(groupShape);
        graphView.repaint();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel)

Aggregations

Shape (cbit.gui.graph.Shape)57 Point (java.awt.Point)30 ContainerShape (cbit.gui.graph.ContainerShape)21 EdgeShape (cbit.gui.graph.EdgeShape)20 RubberBandRectShape (cbit.gui.graph.RubberBandRectShape)20 ArrayList (java.util.ArrayList)15 ElipseShape (cbit.gui.graph.ElipseShape)14 RubberBandEdgeShape (cbit.gui.graph.RubberBandEdgeShape)14 ReactionContainerShape (cbit.vcell.graph.ReactionContainerShape)14 CatalystShape (cbit.vcell.graph.CatalystShape)13 ContainerContainerShape (cbit.vcell.graph.ContainerContainerShape)13 FluxReactionShape (cbit.vcell.graph.FluxReactionShape)13 ProductShape (cbit.vcell.graph.ProductShape)13 ReactantShape (cbit.vcell.graph.ReactantShape)13 ReactionParticipantShape (cbit.vcell.graph.ReactionParticipantShape)13 ReactionRuleDiagramShape (cbit.vcell.graph.ReactionRuleDiagramShape)13 ReactionStepShape (cbit.vcell.graph.ReactionStepShape)13 RuleParticipantSignatureDiagramShape (cbit.vcell.graph.RuleParticipantSignatureDiagramShape)13 SimpleReactionShape (cbit.vcell.graph.SimpleReactionShape)13 SpeciesContextShape (cbit.vcell.graph.SpeciesContextShape)13