Search in sources :

Example 1 with GroupNeighbor

use of org.vcell.pathway.GroupNeighbor in project vcell by virtualcell.

the class PathwayGraphModel method refreshGroup.

private BioPaxGroupNeighborShape refreshGroup(PathwayContainerShape pathwayContainerShape, BioPaxObject ancObject, BioPaxShape bioPaxShape, InteractionParticipant participant) {
    if (ancObject == null)
        return null;
    if (ancObject instanceof GroupObject) {
        GroupObject groupObject = (GroupObject) ancObject;
        Shape shapeG = getShapeFromModelObject(groupObject);
        if (shapeG instanceof BioPaxGroupShape) {
            BioPaxGroupShape groupShape = (BioPaxGroupShape) shapeG;
            if (bioPaxShape instanceof BioPaxInteractionShape) {
                BioPaxInteractionShape interactionShape = (BioPaxInteractionShape) bioPaxShape;
                GroupNeighbor groupNeighbor = new GroupNeighbor(groupObject, interactionShape.getInteraction(), participant.getType());
                BioPaxGroupNeighborShape neighborShape = (BioPaxGroupNeighborShape) getShapeFromModelObject(groupNeighbor);
                if (neighborShape == null) {
                    neighborShape = new BioPaxGroupNeighborShape(groupNeighbor, interactionShape, groupShape, this);
                    pathwayContainerShape.addChildShape(neighborShape);
                    addShape(neighborShape);
                }
                return neighborShape;
            } else if (bioPaxShape instanceof BioPaxGroupShape) {
                BioPaxGroupShape groupConversionShape = (BioPaxGroupShape) bioPaxShape;
                GroupNeighbor groupNeighbor = new GroupNeighbor(groupConversionShape.getGroupObject(), groupObject, participant.getType());
                BioPaxGroupNeighborShape neighborShape = (BioPaxGroupNeighborShape) getShapeFromModelObject(groupNeighbor);
                if (neighborShape == null) {
                    neighborShape = new BioPaxGroupNeighborShape(groupNeighbor, groupConversionShape, groupShape, this);
                    pathwayContainerShape.addChildShape(neighborShape);
                    addShape(neighborShape);
                }
                return neighborShape;
            }
        }
    }
    return null;
}
Also used : EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) GroupNeighbor(org.vcell.pathway.GroupNeighbor) GroupObject(org.vcell.pathway.GroupObject)

Example 2 with GroupNeighbor

use of org.vcell.pathway.GroupNeighbor in project vcell by virtualcell.

the class PathwayGraphModel method refreshGroupInteraction.

private void refreshGroupInteraction(GroupObject groupObject, InteractionParticipant participant) {
    BioPaxGroupShape groupShape = (BioPaxGroupShape) getShapeFromModelObject(groupObject);
    PhysicalEntity physicalEntity = participant.getPhysicalEntity();
    GroupNeighbor groupNeighbor = new GroupNeighbor(groupObject, physicalEntity, participant.getType());
    BioPaxGroupNeighborShape edgeShape = (BioPaxGroupNeighborShape) getShapeFromModelObject(groupNeighbor);
    BioPaxObject ancestorObject = pathwayModel.findTopLevelGroupAncestor(physicalEntity);
    if (edgeShape == null) {
        Shape shape = getShapeFromModelObject(physicalEntity);
        if (shape instanceof BioPaxPhysicalEntityShape) {
            BioPaxPhysicalEntityShape physicalEntityShape = (BioPaxPhysicalEntityShape) shape;
            edgeShape = new BioPaxGroupNeighborShape(groupNeighbor, groupShape, physicalEntityShape, this);
            pathwayContainerShape.addChildShape(edgeShape);
            addShape(edgeShape);
        }
    } else {
        // edges without end objects will be removed
        if (ancestorObject != physicalEntity) {
            // for grouped objects
            removeEdgeShape(edgeShape);
        }
    }
    unwantedShapes.remove(refreshGroup(pathwayContainerShape, ancestorObject, groupShape, participant));
    unwantedShapes.remove(edgeShape);
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) EdgeShape(cbit.gui.graph.EdgeShape) Shape(cbit.gui.graph.Shape) GroupNeighbor(org.vcell.pathway.GroupNeighbor) BioPaxObject(org.vcell.pathway.BioPaxObject)

Aggregations

EdgeShape (cbit.gui.graph.EdgeShape)2 Shape (cbit.gui.graph.Shape)2 GroupNeighbor (org.vcell.pathway.GroupNeighbor)2 BioPaxObject (org.vcell.pathway.BioPaxObject)1 GroupObject (org.vcell.pathway.GroupObject)1 PhysicalEntity (org.vcell.pathway.PhysicalEntity)1