Search in sources :

Example 16 with ReactionContainerShape

use of cbit.vcell.graph.ReactionContainerShape in project vcell by virtualcell.

the class ReactionCartoonTool method mouseMoved.

@Override
public void mouseMoved(MouseEvent event) {
    if (getReactionCartoon() == null) {
        return;
    }
    Point startPointWorld = getGraphModel().getResizeManager().unzoom(event.getPoint());
    if (mode == Mode.STRUCTURE) {
        RXContainerDropTargetInfo lastTrueRXContainerDropTargetInfo = getSelectedContainerDropTargetInfo();
        lastRXContainerDropTargetInfoMap = updateRXContainerDropTargetInfoMap(startPointWorld);
        RXContainerDropTargetInfo currentTrueRXContainerDropTargetInfo = getSelectedContainerDropTargetInfo();
        if (!Compare.isEqualOrNull(lastTrueRXContainerDropTargetInfo, currentTrueRXContainerDropTargetInfo)) {
            activateDropTargetEnable();
            getGraphPane().repaint();
        }
        return;
    }
    Shape mouseShape = getReactionCartoon().pickWorld(startPointWorld);
    if (mouseShape instanceof ReactionContainerShape) {
        Rectangle labelOutlineRectangle = ((ReactionContainerShape) mouseShape).getLabelOutline(mouseShape.getAbsX(), mouseShape.getAbsY());
        boolean bLabel = labelOutlineRectangle.contains(startPointWorld.x, startPointWorld.y);
        if (bLabel) {
            if (!getGraphPane().getCursor().equals(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))) {
                getGraphPane().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            }
        } else {
            if (!getGraphPane().getCursor().equals(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR))) {
                getGraphPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            }
        }
    } else {
        if (!getGraphPane().getCursor().equals(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR))) {
            getGraphPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
    }
}
Also used : SpeciesContextShape(cbit.vcell.graph.SpeciesContextShape) RubberBandRectShape(cbit.gui.graph.RubberBandRectShape) ProductShape(cbit.vcell.graph.ProductShape) ContainerShape(cbit.gui.graph.ContainerShape) CatalystShape(cbit.vcell.graph.CatalystShape) FluxReactionShape(cbit.vcell.graph.FluxReactionShape) ContainerContainerShape(cbit.vcell.graph.ContainerContainerShape) ReactantShape(cbit.vcell.graph.ReactantShape) ElipseShape(cbit.gui.graph.ElipseShape) SimpleReactionShape(cbit.vcell.graph.SimpleReactionShape) ReactionStepShape(cbit.vcell.graph.ReactionStepShape) ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) Shape(cbit.gui.graph.Shape) RuleParticipantSignatureDiagramShape(cbit.vcell.graph.RuleParticipantSignatureDiagramShape) ReactionRuleDiagramShape(cbit.vcell.graph.ReactionRuleDiagramShape) RubberBandEdgeShape(cbit.gui.graph.RubberBandEdgeShape) ReactionParticipantShape(cbit.vcell.graph.ReactionParticipantShape) ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) Rectangle(java.awt.Rectangle) Point(java.awt.Point)

Example 17 with ReactionContainerShape

use of cbit.vcell.graph.ReactionContainerShape in project vcell by virtualcell.

the class GraphContainerLayoutVCellClassical method getPreferedSizeContainerContainerShape.

public Dimension getPreferedSizeContainerContainerShape(ContainerContainerShape shape, Graphics2D g) throws GraphModel.NotReadyException {
    // get size when empty
    Dimension emptySize = shape.getPreferedSizeSelf(g);
    // make larger than empty size so that children fit
    for (Shape child : shape.getChildren()) {
        if (child instanceof ReactionContainerShape) {
            emptySize.width = Math.max(emptySize.width, child.getSpaceManager().getRelPos().x + getPreferedSize(child, g).width);
            // emptySize.width += 8; // spaces between compartments
            emptySize.height = Math.max(emptySize.height, child.getSpaceManager().getRelPos().y + getPreferedSize(child, g).height);
        }
    }
    return emptySize;
}
Also used : SubVolumeContainerShape(cbit.vcell.graph.SubVolumeContainerShape) SpeciesContextShape(cbit.vcell.graph.SpeciesContextShape) MembraneShape(cbit.vcell.graph.MembraneShape) ReactionStepShape(cbit.vcell.graph.ReactionStepShape) GeometryContextStructureShape(cbit.vcell.graph.GeometryContextStructureShape) FeatureShape(cbit.vcell.graph.FeatureShape) StructureMappingStructureShape(cbit.vcell.graph.StructureMappingStructureShape) ContainerContainerShape(cbit.vcell.graph.ContainerContainerShape) ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) GeometryContextContainerShape(cbit.vcell.graph.GeometryContextContainerShape) GeometryContextGeometryShape(cbit.vcell.graph.GeometryContextGeometryShape) StructureShape(cbit.vcell.graph.StructureShape) GeometryClassLegendShape(cbit.vcell.graph.GeometryClassLegendShape) BioPaxShape(cbit.vcell.client.desktop.biomodel.pathway.shapes.BioPaxShape) ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) Dimension(java.awt.Dimension)

Example 18 with ReactionContainerShape

use of cbit.vcell.graph.ReactionContainerShape in project vcell by virtualcell.

the class GraphContainerLayoutVCellClassical method refreshLayoutChildrenContainerContainerShape.

public void refreshLayoutChildrenContainerContainerShape(ContainerContainerShape shape) {
    List<ReactionContainerShape> structureContainers = shape.getStructureContainers();
    int currentX = 4;
    int currentY = 0;
    for (int i = 0; i < structureContainers.size(); i++) {
        structureContainers.get(i).getSpaceManager().setRelPos(currentX, currentY);
        currentX += structureContainers.get(i).getSpaceManager().getSize().width;
        int padding = 8;
        if (i < structureContainers.size() - 1) {
            Structure structure1 = structureContainers.get(i).getStructure();
            Structure structure2 = structureContainers.get(i + 1).getStructure();
            if (StructureUtil.areAdjacent(structure1, structure2)) {
                padding = 0;
            }
        }
        currentX += padding;
    }
}
Also used : ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) Structure(cbit.vcell.model.Structure) Point(java.awt.Point)

Example 19 with ReactionContainerShape

use of cbit.vcell.graph.ReactionContainerShape in project vcell by virtualcell.

the class GraphContainerLayoutReactions method getPreferedSizeContainerContainerShape.

public Dimension getPreferedSizeContainerContainerShape(ContainerContainerShape shape, Graphics2D g) {
    // get size when empty
    Dimension emptySize = shape.getPreferedSizeSelf(g);
    // make larger than empty size so that children fit
    int widthSum = 0;
    for (Shape child : shape.getChildren()) {
        if (child instanceof ReactionContainerShape) {
            Dimension preferedSizeChild = getPreferedSize(child, g);
            emptySize.width = Math.max(emptySize.width, child.getSpaceManager().getRelPos().x + preferedSizeChild.width);
            widthSum += preferedSizeChild.width;
            // emptySize.width += 8; // spaces between compartments
            emptySize.height = Math.max(emptySize.height, child.getSpaceManager().getRelPos().y + preferedSizeChild.height);
        }
    }
    emptySize.width = Math.max(emptySize.width, widthSum);
    return emptySize;
}
Also used : SpeciesContextShape(cbit.vcell.graph.SpeciesContextShape) ReactionStepShape(cbit.vcell.graph.ReactionStepShape) RuleParticipantSignatureFullDiagramShape(cbit.vcell.graph.RuleParticipantSignatureFullDiagramShape) RuleParticipantSignatureShortDiagramShape(cbit.vcell.graph.RuleParticipantSignatureShortDiagramShape) ReactionRuleDiagramShape(cbit.vcell.graph.ReactionRuleDiagramShape) ReactionRuleFullDiagramShape(cbit.vcell.graph.ReactionRuleFullDiagramShape) ContainerContainerShape(cbit.vcell.graph.ContainerContainerShape) ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) Dimension(java.awt.Dimension) Point(java.awt.Point)

Example 20 with ReactionContainerShape

use of cbit.vcell.graph.ReactionContainerShape in project vcell by virtualcell.

the class GraphContainerLayoutReactions method getBoundaryForAutomaticLayout.

public Rectangle getBoundaryForAutomaticLayout(Shape shape) {
    if (shape instanceof ReactionContainerShape) {
        Point absLoc = shape.getAbsPos();
        Dimension size = shape.getSize();
        return new Rectangle(absLoc.x + WIDTH_PADDING, absLoc.y + HEIGHT_PADDING + TOP_LABEL_HEIGHT, size.width - 2 * WIDTH_PADDING, size.height - 2 * HEIGHT_PADDING - TOP_LABEL_HEIGHT);
    }
    return new Rectangle(shape.getAbsPos(), shape.getSize());
}
Also used : ReactionContainerShape(cbit.vcell.graph.ReactionContainerShape) Rectangle(java.awt.Rectangle) Point(java.awt.Point) Dimension(java.awt.Dimension)

Aggregations

ReactionContainerShape (cbit.vcell.graph.ReactionContainerShape)21 Point (java.awt.Point)16 SpeciesContextShape (cbit.vcell.graph.SpeciesContextShape)13 ReactionStepShape (cbit.vcell.graph.ReactionStepShape)12 ContainerContainerShape (cbit.vcell.graph.ContainerContainerShape)11 ReactionRuleDiagramShape (cbit.vcell.graph.ReactionRuleDiagramShape)11 CatalystShape (cbit.vcell.graph.CatalystShape)9 RubberBandRectShape (cbit.gui.graph.RubberBandRectShape)8 Shape (cbit.gui.graph.Shape)8 FluxReactionShape (cbit.vcell.graph.FluxReactionShape)8 ProductShape (cbit.vcell.graph.ProductShape)8 ReactantShape (cbit.vcell.graph.ReactantShape)8 RuleParticipantSignatureDiagramShape (cbit.vcell.graph.RuleParticipantSignatureDiagramShape)8 SimpleReactionShape (cbit.vcell.graph.SimpleReactionShape)8 Structure (cbit.vcell.model.Structure)8 Dimension (java.awt.Dimension)8 ContainerShape (cbit.gui.graph.ContainerShape)7 ElipseShape (cbit.gui.graph.ElipseShape)7 RubberBandEdgeShape (cbit.gui.graph.RubberBandEdgeShape)7 ReactionParticipantShape (cbit.vcell.graph.ReactionParticipantShape)7