Search in sources :

Example 6 with Shape

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

the class PathwayGraphModel method relationshipChanged.

public void relationshipChanged(RelationshipEvent event) {
    Shape shape = getShapeFromModelObject(event.getRelationshipObject());
    refreshRelationshipInfo(shape);
    refreshAll();
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape)

Example 7 with Shape

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

the class ShapeGroupUtil method shapesCanBeMadeGroup.

/*
	 * Shapes can be made a group if they each are eligible and if for any two
	 * shapes the next non-eligible ancestor (e.g. compartment) is the same.
	 * This excludes nodes in different compartments
	 */
public static boolean shapesCanBeMadeGroup(Set<Shape> shapes) {
    boolean bCanBeMadeGroup = true;
    Set<Shape> eligibleAncestors = new HashSet<Shape>();
    Set<Shape> ineligibleAncestors = new HashSet<Shape>();
    for (Shape shape : shapes) {
        if (!willBeSkippedWhenGrouping(shape)) {
            if (!isEligibleAsGroupMember(shape)) {
                bCanBeMadeGroup = false;
                break;
            }
            Shape parent = shape.getParent();
            if (parent != null) {
                if (isEligibleAsGroupMember(parent)) {
                    eligibleAncestors.add(parent);
                } else {
                    ineligibleAncestors.add(parent);
                    if (ineligibleAncestors.size() > 1) {
                        bCanBeMadeGroup = false;
                        break;
                    }
                }
            }
        }
    }
    while (bCanBeMadeGroup && !eligibleAncestors.isEmpty()) {
        Set<Shape> eligibleAncestorsNew = new HashSet<Shape>();
        for (Shape ancestor : eligibleAncestors) {
            Shape parent = ancestor.getParent();
            if (isEligibleAsGroupMember(parent)) {
                eligibleAncestorsNew.add(parent);
            } else {
                ineligibleAncestors.add(parent);
                if (ineligibleAncestors.size() > 1) {
                    bCanBeMadeGroup = false;
                    break;
                }
            }
        }
        eligibleAncestors = eligibleAncestorsNew;
    }
    return bCanBeMadeGroup;
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) HashSet(java.util.HashSet)

Example 8 with Shape

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

the class VCGroupManager method collapseExistingGroups.

public void collapseExistingGroups() {
    GraphModel graphModel = graphView.getGraphModel();
    List<Shape> selectedShapes = graphModel.getSelectedShapes();
    for (Shape selectedShape : selectedShapes) {
        Shape parentShape = selectedShape.getParent();
        if (parentShape != null) {
            ShapeGroupUtil.collapseGroup(parentShape);
        }
    }
    graphView.repaint();
}
Also used : Shape(cbit.gui.graph.Shape) GraphModel(cbit.gui.graph.GraphModel)

Example 9 with Shape

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

the class ModelCartoon method refreshRelationshipInfo.

public final void refreshRelationshipInfo(RelationshipModel relationshipModel) {
    for (RelationshipObject relationship : relationshipModel.getRelationshipObjects()) {
        BioModelEntityObject bioModelEntity = relationship.getBioModelEntityObject();
        Shape shape = getShapeFromModelObject(bioModelEntity);
        if (shape instanceof SpeciesContextShape) {
            SpeciesContextShape scShape = (SpeciesContextShape) shape;
            scShape.setLinkText("L");
        } else if (shape instanceof SimpleReactionShape) {
            SimpleReactionShape srShape = (SimpleReactionShape) shape;
            srShape.setLinkText("L");
        } else if (shape instanceof ReactionRuleDiagramShape) {
            ReactionRuleDiagramShape srShape = (ReactionRuleDiagramShape) shape;
            srShape.setLinkText("L");
        }
    }
}
Also used : Shape(cbit.gui.graph.Shape) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 10 with Shape

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

the class ModelCartoon method relationshipChanged.

public void relationshipChanged(RelationshipEvent event) {
    RelationshipObject relationshipObject = event.getRelationshipObject();
    if (event.getOperationType() == event.ADDED) {
        Shape shape = getShapeFromModelObject(relationshipObject.getBioModelEntityObject());
        if (shape instanceof SpeciesContextShape) {
            SpeciesContextShape scShape = (SpeciesContextShape) shape;
            scShape.setLinkText("L");
        } else if (shape instanceof SimpleReactionShape) {
            SimpleReactionShape srShape = (SimpleReactionShape) shape;
            srShape.setLinkText("L");
        } else if (shape instanceof ReactionRuleDiagramShape) {
            ReactionRuleDiagramShape srShape = (ReactionRuleDiagramShape) shape;
            srShape.setLinkText("L");
        }
    } else if (event.getOperationType() == event.REMOVED) {
        Shape shape = getShapeFromModelObject(relationshipObject.getBioModelEntityObject());
        if (shape instanceof SpeciesContextShape) {
            SpeciesContextShape scShape = (SpeciesContextShape) shape;
            scShape.setLinkText("");
            // if the BioModelEntity Object is still linked with other BioPax objects, we add the "L" shape back
            if (((RelationshipModel) event.getSource()).getRelationshipObjects(relationshipObject.getBioModelEntityObject()).size() > 0) {
                scShape.setLinkText("L");
            }
        } else if (shape instanceof SimpleReactionShape) {
            SimpleReactionShape srShape = (SimpleReactionShape) shape;
            srShape.setLinkText("");
            if (((RelationshipModel) event.getSource()).getRelationshipObjects(relationshipObject.getBioModelEntityObject()).size() > 0) {
                srShape.setLinkText("L");
            }
        } else if (shape instanceof ReactionRuleDiagramShape) {
            ReactionRuleDiagramShape srShape = (ReactionRuleDiagramShape) shape;
            srShape.setLinkText("");
            if (((RelationshipModel) event.getSource()).getRelationshipObjects(relationshipObject.getBioModelEntityObject()).size() > 0) {
                srShape.setLinkText("L");
            }
        }
    }
}
Also used : Shape(cbit.gui.graph.Shape) RelationshipModel(org.vcell.relationship.RelationshipModel) RelationshipObject(org.vcell.relationship.RelationshipObject)

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