Search in sources :

Example 51 with Shape

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

the class ReactionCartoonRule method refreshAll.

@Override
protected void refreshAll(boolean reallocateShapes) {
    try {
        if (getModel() == null || getStructureSuite() == null) {
            return;
        }
        System.out.println("ReactionCartoonRule, RefreshAll()");
        for (Structure structure : structureSuite.getStructures()) {
            Diagram diagram = getModel().getDiagram(structure);
            if (diagram != null) {
                // Maintain consistency between rule participant nodes, signatures and
                // species pattern when a molecule is being modified.
                rebindAll(diagram);
            }
        }
        Set<Shape> unwantedShapes = new HashSet<Shape>();
        Set<RuleParticipantSignature> unwantedSignatures = new HashSet<RuleParticipantSignature>();
        Set<ReactionRuleShortSignature> unwantedRuleSignatures = new HashSet<ReactionRuleShortSignature>();
        unwantedShapes.addAll(getShapes());
        unwantedSignatures.addAll(ruleParticipantSignatures);
        unwantedRuleSignatures.addAll(reactionRuleShortSignatures);
        // ContainerContainerShape containerShape = (ContainerContainerShape) getShapeFromModelObject(getModel());
        // List<ReactionContainerShape> reactionContainerShapeList = new ArrayList<ReactionContainerShape>();
        // List<Structure> structureList = new ArrayList<Structure>(getStructureSuite().getStructures());
        // 
        // // create all ReactionContainerShapes (one for each Structure)
        // for(Structure structure : structureList) {
        // if (structure instanceof Membrane) {
        // Membrane membrane = (Membrane) structure;
        // ReactionContainerShape membraneShape =
        // (ReactionContainerShape) getShapeFromModelObject(membrane);
        // if (membraneShape == null) {
        // membraneShape = new ReactionContainerShape(membrane, structureSuite, this);
        // addShape(membraneShape);
        // membrane.getMembraneVoltage().removePropertyChangeListener(this);
        // membrane.getMembraneVoltage().addPropertyChangeListener(this);
        // } else {
        // membraneShape.setStructureSuite(structureSuite);
        // }
        // membrane.removePropertyChangeListener(this);
        // membrane.addPropertyChangeListener(this);
        // membraneShape.refreshLabel();
        // unwantedShapes.remove(membraneShape);
        // reactionContainerShapeList.add(membraneShape);
        // }else if (structure instanceof Feature){
        // Feature feature = (Feature) structure;
        // ReactionContainerShape featureShape = (ReactionContainerShape) getShapeFromModelObject(feature);
        // if (featureShape == null) {
        // featureShape = new ReactionContainerShape(feature, structureSuite, this);
        // addShape(featureShape);
        // } else {
        // featureShape.setStructureSuite(structureSuite);
        // }
        // feature.removePropertyChangeListener(this);
        // feature.addPropertyChangeListener(this);
        // featureShape.refreshLabel();
        // unwantedShapes.remove(featureShape);
        // reactionContainerShapeList.add(featureShape);
        // }
        // }
        // if (containerShape == null) {
        // containerShape = new ContainerContainerShape(this, getModel(), reactionContainerShapeList);
        // addShape(containerShape);
        // } else {
        // containerShape.setReactionContainerShapeList(reactionContainerShapeList);
        // }
        // containerShape.refreshLabel();
        // unwantedShapes.remove(containerShape);
        // // add all species context shapes within the structures
        // for(Structure structure : getStructureSuite().getStructures()) {
        // ReactionContainerShape reactionContainerShape =	(ReactionContainerShape) getShapeFromModelObject(structure);
        // structure.removePropertyChangeListener(this);
        // structure.addPropertyChangeListener(this);
        // for(SpeciesContext structSpeciesContext : getModel().getSpeciesContexts(structure)) {
        // SpeciesContextShape ss = (SpeciesContextShape) getShapeFromModelObject(structSpeciesContext);
        // if (ss == null) {
        // ss = new SpeciesContextShape(structSpeciesContext, this);
        // ss.truncateLabelName(false);
        // structSpeciesContext.getSpecies().removePropertyChangeListener(this);
        // structSpeciesContext.getSpecies().addPropertyChangeListener(this);
        // reactionContainerShape.addChildShape(ss);
        // addShape(ss);
        // ss.getSpaceManager().setRelPos(reactionContainerShape.getRandomPosition());
        // }
        // structSpeciesContext.removePropertyChangeListener(this);
        // structSpeciesContext.addPropertyChangeListener(this);
        // ss.refreshLabel();
        // unwantedShapes.remove(ss);
        // }
        // }
        // // add all reactionSteps that are in this structure (ReactionContainerShape), and draw the lines
        // getModel().removePropertyChangeListener(this);
        // getModel().addPropertyChangeListener(this);
        // //
        // // =================================== Rules ================================================
        // //
        // for(ReactionRule rr : getModel().getRbmModelContainer().getReactionRuleList()) {
        // rr.removePropertyChangeListener(this);
        // rr.addPropertyChangeListener(this);
        // Structure structure = rr.getStructure();
        // if(getStructureSuite().areReactionsShownFor(structure)) {
        // ReactionContainerShape reactionContainerShape =	(ReactionContainerShape) getShapeFromModelObject(structure);
        // 
        // ReactionRuleShortSignature ruleSignature = null;
        // int matches = 0;	// any rule must be part of one and only one ReactionRuleShortSignature object
        // for(ReactionRuleShortSignature rrss : reactionRuleShortSignatures) {
        // if(rrss.compareBySignature(rr)) {
        // ruleSignature = rrss;
        // matches++;
        // // 							break;		// once this code gets stable uncomment the break and remove the matches counter
        // } else {
        // // remove the rule if it's in the list even though the signature doesn't match
        // rrss.remove(rr);
        // }
        // }
        // if(matches > 1) {
        // throw new RuntimeException("Rule " + rr.getDisplayName() + " found in multiple ReactionRuleShortSignatures");
        // }
        // 
        // ReactionRuleShortDiagramShape rrShape = null;
        // if(ruleSignature == null) {
        // ruleSignature = new ReactionRuleShortSignature(rr);
        // reactionRuleShortSignatures.add(ruleSignature);
        // rrShape = new ReactionRuleShortDiagramShape(ruleSignature, this);
        // addShape(rrShape);
        // rrShape.getSpaceManager().setRelPos(reactionContainerShape.getRandomPosition());
        // reactionContainerShape.addChildShape(rrShape);
        // rrShape.getSpaceManager().setRelPos(reactionContainerShape.getRandomPosition());
        // } else {
        // ruleSignature.add(rr);	// add the rule if it's not there
        // rrShape = (ReactionRuleShortDiagramShape) getShapeFromModelObject(ruleSignature);
        // }
        // 
        // rrShape.refreshLabel();
        // unwantedShapes.remove(rrShape);
        // unwantedRuleSignatures.remove(ruleSignature);
        // if(matches != 0) {
        // continue;		// don't make other shapes or edges for this rule, the rule signature already has them from a previous rule
        // }
        // 
        // //
        // // add reaction participants as edges and SignatureShapes as needed
        // //
        // List<ReactionRuleParticipant> participants = rr.getReactionRuleParticipants();
        // List<RuleParticipantEdgeDiagramShape> ruleEdges = new ArrayList<> ();
        // for(ReactionRuleParticipant participant : participants) {
        // participant.getSpeciesPattern().removePropertyChangeListener(this);
        // participant.getSpeciesPattern().addPropertyChangeListener(this);
        // Structure speciesStructure = participant.getStructure();
        // Structure reactionStructure = rr.getStructure();
        // 
        // if(getStructureSuite().getStructures().contains(speciesStructure) && getStructureSuite().areReactionsShownFor(reactionStructure)) {
        // //
        // // find existing RuleParticipantSignatureShape in cartoon
        // //
        // RuleParticipantShortSignature ruleParticipantShortSignature = null;
        // for (RuleParticipantSignature signature : ruleParticipantSignatures) {
        // if (signature instanceof RuleParticipantLongSignature && signature.getStructure() == participant.getStructure()) {
        // System.out.println("ReactionCartoonMolecule, refreshAll(), RuleParticipantLongSignature");
        // break;
        // }
        // }
        // for (RuleParticipantSignature signature : ruleParticipantSignatures) {
        // if (signature instanceof RuleParticipantShortSignature && signature.getStructure() == participant.getStructure() &&
        // signature.compareByCriteria(participant.getSpeciesPattern(), GroupingCriteria.molecule)) {
        // ruleParticipantShortSignature = (RuleParticipantShortSignature)signature;
        // break;
        // }
        // }
        // //
        // // if didn't find signature in cartoons list of signatures, then create one (and create a shape for it).
        // //
        // RuleParticipantSignatureShortDiagramShape signatureShape = null;
        // if (ruleParticipantShortSignature == null) {
        // ruleParticipantShortSignature = RuleParticipantShortSignature.fromReactionRuleParticipant(participant, this);
        // ruleParticipantSignatures.add(ruleParticipantShortSignature);
        // signatureShape = new RuleParticipantSignatureShortDiagramShape(ruleParticipantShortSignature, this);
        // addShape(signatureShape);
        // ReactionContainerShape participantContainerShape =	(ReactionContainerShape) getShapeFromModelObject(participant.getStructure());
        // signatureShape.getSpaceManager().setRelPos(participantContainerShape.getRandomPosition());
        // participantContainerShape.addChildShape(signatureShape);
        // signatureShape.getSpaceManager().setRelPos(participantContainerShape.getRandomPosition());
        // } else {
        // signatureShape = (RuleParticipantSignatureShortDiagramShape) getShapeFromModelObject(ruleParticipantShortSignature);
        // }
        // 
        // unwantedShapes.remove(signatureShape);
        // unwantedSignatures.remove(ruleParticipantShortSignature);
        // signatureShape.refreshLabel();
        // signatureShape.setVisible(true);
        // 
        // //
        // // add edge for ReactionRuleParticipant if not already present.
        // //
        // RuleParticipantEdgeDiagramShape ruleParticipantShape = (RuleParticipantEdgeDiagramShape) getShapeFromModelObject(participant);
        // if (ruleParticipantShape == null || ruleParticipantShape.getRuleParticipantSignatureShape() != signatureShape) {
        // if (participant instanceof ReactantPattern && signatureShape.isVisible()) {
        // ruleParticipantShape = new ReactantPatternEdgeDiagramShape((ReactantPattern) participant, (ElipseShape)rrShape, signatureShape, this);
        // } else if (participant instanceof ProductPattern && signatureShape.isVisible()) {
        // ruleParticipantShape = new ProductPatternEdgeDiagramShape((ProductPattern) participant, (ElipseShape)rrShape, signatureShape, this);
        // } else {
        // throw new RuntimeException("unsupported ReactionRuleParticipant " + participant.getClass());
        // }
        // addShape(ruleParticipantShape);
        // }
        // if(!containerShape.getChildren().contains(ruleParticipantShape)) {
        // containerShape.addChildShape(ruleParticipantShape);
        // }
        // unwantedShapes.remove(ruleParticipantShape);
        // ruleParticipantShape.refreshLabel();
        // ruleEdges.add(ruleParticipantShape);	// all the edges for this rule
        // }
        // }
        // // now let's see if any reactant and product pair have the same signature - means we need to draw a reactant and
        // // a product edge (a closed loop) between the rule diagram shape and the signature diagram shape
        // for(RuleParticipantEdgeDiagramShape ours : ruleEdges) {
        // ours.setSibling(false);		// reset them all
        // }
        // for(RuleParticipantEdgeDiagramShape ours : ruleEdges) {
        // for(RuleParticipantEdgeDiagramShape theirs : ruleEdges) {
        // if(ours == theirs) {
        // continue;			// don't compare with self
        // }
        // if(ours.getRuleParticipantSignatureShape() == theirs.getRuleParticipantSignatureShape()) {
        // ours.setSibling(true);
        // theirs.setSibling(true);
        // }
        // }
        // }
        // }
        // }
        ruleParticipantSignatures.removeAll(unwantedSignatures);
        reactionRuleShortSignatures.removeAll(unwantedRuleSignatures);
        // }
        for (Shape unwantedShape : unwantedShapes) {
            removeShape(unwantedShape);
        }
    // // update diagrams
    // for(Structure structure : structureSuite.getStructures()) {
    // Diagram diagram = getModel().getDiagram(structure);
    // if (diagram != null) {
    // applyDefaults(diagram);
    // }
    // }
    // fireGraphChanged(new GraphEvent(this));
    } catch (Throwable e) {
        handleException(e);
    }
}
Also used : RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) Shape(cbit.gui.graph.Shape) ReactionRuleShortSignature(cbit.vcell.model.ReactionRuleShortSignature) Structure(cbit.vcell.model.Structure) Diagram(cbit.vcell.model.Diagram) HashSet(java.util.HashSet)

Example 52 with Shape

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

the class ReactionCartoonRule method applyDefaults.

public void applyDefaults(Diagram diagram) {
    List<NodeReference> nodeList = diagram.getNodeRuleList();
    List<NodeReference> orphansList = new ArrayList<NodeReference>();
    for (int i = 0; i < nodeList.size(); i++) {
        NodeReference node = nodeList.get(i);
        Object obj = null;
        Structure struct = diagram.getStructure();
        boolean found = false;
        switch(node.nodeType) {
            case NodeReference.SIMPLE_REACTION_NODE:
                obj = getModel().getReactionStep(node.name);
                if (!(obj instanceof SimpleReaction)) {
                    System.out.println("ReactionCartoon.applyDefaults(), diagram reaction " + node.name + " type mismatch in model, using location anyway");
                }
                break;
            case NodeReference.FLUX_REACTION_NODE:
                obj = getModel().getReactionStep(node.name);
                if (!(obj instanceof FluxReaction)) {
                    System.out.println("ReactionCartoon.applyDefaults(), diagram flux " + node.name + " type mismatch in model, using location anyway");
                }
                break;
            case NodeReference.SPECIES_CONTEXT_NODE:
                obj = getModel().getSpeciesContext(node.name);
                break;
            case // TODO: aici
            NodeReference.REACTION_RULE_NODE:
                obj = getModel().getRbmModelContainer().getReactionRule(node.name);
                break;
            case // obj is a RuleParticipantSignature
            NodeReference.RULE_PARTICIPANT_SIGNATURE_FULL_NODE:
                System.out.println("ReactionCartoonRule, RULE_PARTICIPANT_SIGNATURE_FULL_NODE detected");
                for (RuleParticipantSignature signature : ruleParticipantSignatures) {
                    if (signature instanceof RuleParticipantLongSignature && signature.getStructure() == struct && signature.compareByCriteria(node.getName(), GroupingCriteria.full)) {
                        obj = signature;
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    orphansList.add(node);
                }
                break;
            case NodeReference.RULE_PARTICIPANT_SIGNATURE_SHORT_NODE:
                for (RuleParticipantSignature signature : ruleParticipantSignatures) {
                    if (signature instanceof RuleParticipantShortSignature && signature.getStructure() == struct && signature.compareByCriteria(node.getName(), GroupingCriteria.full)) {
                        obj = signature;
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    orphansList.add(node);
                }
                break;
        }
        // -- switch
        Shape shape = getShapeFromModelObject(obj);
        if (shape != null) {
            Point relPosOld = shape.getRelPos();
            Point relPosNew = node.location;
            // In old models, the same node can appear in multiple diagrams.
            // Now, we have only one diagram, so if a node has multiple positions,
            // some would overwrite others.
            // This attempts to prevent overwriting a position with a worse one.
            // if(relPosOld.x + relPosOld.y < relPosNew.x + relPosNew.y) {
            shape.setRelPos(relPosNew);
        // }
        }
    }
    if (!orphansList.isEmpty()) {
        diagram.removeNodeReferences(NodeReference.Mode.rule, orphansList);
    }
}
Also used : RuleParticipantSignature(cbit.vcell.model.RuleParticipantSignature) RuleParticipantLongSignature(cbit.vcell.model.RuleParticipantLongSignature) SimpleReaction(cbit.vcell.model.SimpleReaction) Shape(cbit.gui.graph.Shape) NodeReference(cbit.vcell.model.NodeReference) ArrayList(java.util.ArrayList) FluxReaction(cbit.vcell.model.FluxReaction) Point(java.awt.Point) Point(java.awt.Point) RuleParticipantShortSignature(cbit.vcell.model.RuleParticipantShortSignature) Structure(cbit.vcell.model.Structure)

Example 53 with Shape

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

the class ReactionContainerShape method randomize.

public void randomize() {
    // then draw in the reactionParticipant edges
    for (Shape child : childShapeList) {
        if (child instanceof SpeciesContextShape || child instanceof ReactionStepShape || child instanceof ReactionRuleDiagramShape || child instanceof RuleParticipantSignatureDiagramShape) {
            // position normally about the center
            child.getSpaceManager().setRelPos(getRandomPosition());
        }
    }
    // calculate locations and sizes of reactionParticipant edges
    for (Shape child : childShapeList) {
        if (child instanceof ReactionParticipantShape || child instanceof RuleParticipantEdgeDiagramShape) {
            EdgeShape reactionParticipantShape = (EdgeShape) child;
            reactionParticipantShape.refreshLayoutSelf();
        }
    }
    // position label
    int centerX = getSpaceManager().getSize().width / 2;
    int currentY = labelSize.height;
    labelPos.x = centerX - labelSize.width / 2;
    labelPos.y = currentY;
    currentY += labelSize.height;
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) EdgeShape(cbit.gui.graph.EdgeShape) ContainerShape(cbit.gui.graph.ContainerShape) Shape(cbit.gui.graph.Shape) Point(java.awt.Point)

Example 54 with Shape

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

the class PathwayGraphTool method mouseDragged.

@Override
public void mouseDragged(MouseEvent event) {
    if ((event.getModifiers() & (InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK)) != 0) {
        return;
    }
    boolean bShift = (event.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK;
    boolean bCntrl = (event.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK;
    try {
        switch(mode) {
            case SELECT:
                {
                    Point worldPoint = screenToWorld(event.getX(), event.getY());
                    if (bMoving) {
                        List<Shape> selectedShapes = getGraphModel().getSelectedShapes();
                        // constrain to stay within the corresponding parent for the
                        // "movingShape" as well as all other selected (hence
                        // moving) shapes.
                        Point movingParentLoc = movingShape.getParent().getSpaceManager().getAbsLoc();
                        Dimension movingParentSize = movingShape.getParent().getSpaceManager().getSize();
                        worldPoint.x = Math.max(movingOffsetWorld.x + movingParentLoc.x, Math.min(movingOffsetWorld.x + movingParentLoc.x + movingParentSize.width - movingShape.getSpaceManager().getSize().width, worldPoint.x));
                        worldPoint.y = Math.max(movingOffsetWorld.y + movingParentLoc.y, Math.min(movingOffsetWorld.x + movingParentLoc.y + movingParentSize.height - movingShape.getSpaceManager().getSize().height, worldPoint.y));
                        for (Shape shape : selectedShapes) {
                            if (shape != movingShape && shape instanceof BioPaxShape) {
                                Point selectedParentLoc = shape.getParent().getSpaceManager().getAbsLoc();
                                Dimension selectedParentSize = shape.getParent().getSpaceManager().getSize();
                                int selectedMovingOffsetX = movingOffsetWorld.x + (movingShape.getSpaceManager().getAbsLoc().x - shape.getSpaceManager().getAbsLoc().x);
                                int selectedMovingOffsetY = movingOffsetWorld.y + (movingShape.getSpaceManager().getAbsLoc().y - shape.getSpaceManager().getAbsLoc().y);
                                worldPoint.x = Math.max(selectedMovingOffsetX + selectedParentLoc.x, Math.min(selectedMovingOffsetX + selectedParentLoc.x + selectedParentSize.width - shape.getSpaceManager().getSize().width, worldPoint.x));
                                worldPoint.y = Math.max(selectedMovingOffsetY + selectedParentLoc.y, Math.min(selectedMovingOffsetY + selectedParentLoc.y + selectedParentSize.height - shape.getSpaceManager().getSize().height, worldPoint.y));
                            }
                        }
                        getGraphPane().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
                        Point newMovingPoint = new Point(worldPoint.x - movingOffsetWorld.x, worldPoint.y - movingOffsetWorld.y);
                        int deltaX = newMovingPoint.x - movingPointWorld.x;
                        int deltaY = newMovingPoint.y - movingPointWorld.y;
                        movingPointWorld = newMovingPoint;
                        movingShape.getSpaceManager().setRelPos(movingPointWorld.x - movingParentLoc.x, movingPointWorld.y - movingParentLoc.y);
                        // them also
                        for (Shape shape : selectedShapes) {
                            if (shape != movingShape) {
                                shape.getSpaceManager().move(deltaX, deltaY);
                            }
                        }
                        getGraphPane().invalidate();
                        ((JViewport) getGraphPane().getParent()).revalidate();
                        getGraphPane().repaint();
                    } else if (bRectStretch) {
                        // constrain to stay within parent
                        Point parentLoc = rectShape.getParent().getSpaceManager().getAbsLoc();
                        Dimension parentSize = rectShape.getParent().getSpaceManager().getSize();
                        worldPoint.x = Math.max(1, Math.min(parentSize.width - 1, worldPoint.x - parentLoc.x)) + parentLoc.x;
                        worldPoint.y = Math.max(1, Math.min(parentSize.height - 1, worldPoint.y - parentLoc.y)) + parentLoc.y;
                        getGraphPane().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
                        // getGraphPane().repaint();
                        Graphics2D g = (Graphics2D) getGraphPane().getGraphics();
                        AffineTransform oldTransform = g.getTransform();
                        g.scale(0.01 * getGraphModel().getZoomPercent(), 0.01 * getGraphModel().getZoomPercent());
                        g.setXORMode(Color.white);
                        rectShape.setEnd(endPointWorld);
                        rectShape.paint(g, 0, 0);
                        endPointWorld = worldPoint;
                        rectShape.setEnd(endPointWorld);
                        rectShape.paint(g, 0, 0);
                        g.setTransform(oldTransform);
                    } else {
                        Shape shape = (getGraphModel().getSelectedShape() != null ? getGraphModel().getSelectedShape() : getGraphModel().pickWorld(worldPoint));
                        if (!bCntrl && !bShift && shape instanceof BioPaxShape) {
                            bMoving = true;
                            movingShape = shape;
                            movingPointWorld = shape.getSpaceManager().getAbsLoc();
                            movingOffsetWorld = new Point(worldPoint.x - movingPointWorld.x, worldPoint.y - movingPointWorld.y);
                        } else if (shape instanceof PathwayContainerShape || bShift || bCntrl) {
                            bRectStretch = true;
                            endPointWorld = new Point(worldPoint.x + 1, worldPoint.y + 1);
                            rectShape = new RubberBandRectShape(worldPoint, endPointWorld, getGraphModel());
                            rectShape.setEnd(endPointWorld);
                            if (!(shape instanceof PathwayContainerShape)) {
                                shape.getParent().addChildShape(rectShape);
                            } else {
                                shape.addChildShape(rectShape);
                            }
                            Graphics2D g = (Graphics2D) getGraphPane().getGraphics();
                            AffineTransform oldTransform = g.getTransform();
                            g.scale(0.01 * getGraphModel().getZoomPercent(), 0.01 * getGraphModel().getZoomPercent());
                            g.setXORMode(Color.white);
                            rectShape.paint(g, 0, 0);
                            g.setTransform(oldTransform);
                        }
                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    } catch (Exception e) {
        System.out.println("CartoonTool.mouseDragged: uncaught exception");
        e.printStackTrace(System.out);
    }
}
Also used : RubberBandRectShape(cbit.gui.graph.RubberBandRectShape) PathwayContainerShape(cbit.vcell.client.desktop.biomodel.pathway.shapes.PathwayContainerShape) Shape(cbit.gui.graph.Shape) BioPaxShape(cbit.vcell.client.desktop.biomodel.pathway.shapes.BioPaxShape) BioPaxShape(cbit.vcell.client.desktop.biomodel.pathway.shapes.BioPaxShape) RubberBandRectShape(cbit.gui.graph.RubberBandRectShape) AffineTransform(java.awt.geom.AffineTransform) List(java.util.List) PathwayContainerShape(cbit.vcell.client.desktop.biomodel.pathway.shapes.PathwayContainerShape) Point(java.awt.Point) Dimension(java.awt.Dimension) Graphics2D(java.awt.Graphics2D)

Example 55 with Shape

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

the class WorkflowCartoonTool method transposeLayout.

public void transposeLayout() {
    for (Shape shape : getGraphModel().getShapes()) {
        if (ShapeUtil.isMovable(shape)) {
            Point location = shape.getSpaceManager().getRelPos();
            int oldX = location.x;
            int oldY = location.y;
            location.y = oldX;
            location.x = oldY;
        }
    }
    getGraphPane().repaint();
}
Also used : RubberBandRectShape(cbit.gui.graph.RubberBandRectShape) NodeShape(cbit.gui.graph.NodeShape) EdgeShape(cbit.gui.graph.EdgeShape) ContainerShape(cbit.gui.graph.ContainerShape) Shape(cbit.gui.graph.Shape) Point(java.awt.Point) Point(java.awt.Point)

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