Search in sources :

Example 1 with SubVolumeContainerShape

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

the class StructureMappingCartoon method refreshAll.

/**
 * This method was created by a SmartGuide.
 */
@Override
public void refreshAll() {
    clearAllShapes();
    if (getSimulationContext() == null) {
        fireGraphChanged(new GraphEvent(this));
        return;
    }
    GeometryContextGeometryShape geometryShape = new GeometryContextGeometryShape(this, getGeometryContext().getGeometry());
    // GeometryContextStructureShape structureShape = new GeometryContextStructureShape(this,getGeometryContext().getModel());
    // GeometryContextContainerShape containerShape = new GeometryContextContainerShape(this,getGeometryContext(),structureShape,geometryShape);
    // addShape(containerShape);
    addShape(geometryShape);
    // addShape(structureShape);
    getGeometryContext().removePropertyChangeListener(this);
    getGeometryContext().addPropertyChangeListener(this);
    // 
    // create all StructureShapes
    // 
    // Structure structures[] = getGeometryContext().getModel().getStructures();
    // for (int i=0;i<structures.length;i++){
    // if (structures[i] instanceof Feature){
    // //addShape(new FeatureShape((Feature)structures[i],getGeometryContext().getModel(),this));
    // StructureMappingFeatureShape smShape = new StructureMappingFeatureShape((Feature)structures[i],getGeometryContext().getModel(),this);
    // addShape(smShape);
    // containerShape.addChildShape(smShape);
    // structures[i].removePropertyChangeListener(this);
    // structures[i].addPropertyChangeListener(this);
    // }
    // }
    // create all SubvolumeLegendShapes (for legend)
    // 
    GeometrySpec geometrySpec = getGeometryContext().getGeometry().getGeometrySpec();
    SubVolume[] subVolumes = geometrySpec.getSubVolumes();
    for (int i = 0; i < subVolumes.length; i++) {
        cbit.vcell.geometry.SubVolume subvolume = subVolumes[i];
        GeometryClassLegendShape subvolumeLegendShape = new GeometryClassLegendShape(subvolume, getGeometryContext().getGeometry(), this, 10);
        addShape(subvolumeLegendShape);
        geometryShape.addChildShape(subvolumeLegendShape);
    }
    // --------------------------------------------------
    if ((subVolumeContainerShape == null) || (subVolumeContainerShape.getModelObject() != getGeometryContext().getGeometry())) {
        subVolumeContainerShape = new SubVolumeContainerShape(getGeometryContext().getGeometry(), this);
    }
    subVolumeContainerShape.removeAllChildren();
    addShape(subVolumeContainerShape);
    geometryShape.addChildShape(subVolumeContainerShape);
    // --------------------------------------------------
    // // create all SubvolumeShapes (for image)
    // //
    // for (int i=0;i<subVolumes.length;i++){
    // cbit.vcell.geometry.SubVolume subvolume = (cbit.vcell.geometry.SubVolume)subVolumes[i];
    // SubvolumeShape subvolumeShape = new SubvolumeShape(subvolume,getGeometryContext().getGeometry(),this);
    // addShape(subvolumeShape);
    // subVolumeContainerShape.addChildShape(subvolumeShape);
    // }
    // 
    // create all FeatureMappingShapes
    // 
    // StructureMapping structureMappings[] = getGeometryContext().getStructureMappings();
    // for (int i=0;i<structureMappings.length;i++){
    // StructureMapping structureMapping = structureMappings[i];
    // if (structureMapping instanceof FeatureMapping){
    // FeatureMapping featureMapping = (FeatureMapping)structureMapping;
    // if (featureMapping.getSubVolume()!=null){
    // FeatureShape featureShape = (FeatureShape)getShapeFromModelObject(featureMapping.getFeature());
    // SubvolumeLegendShape subvolumeLegendShape = (SubvolumeLegendShape)getShapeFromModelObject(featureMapping.getSubVolume());
    // FeatureMappingShape fmShape = new FeatureMappingShape(featureMapping,featureShape,subvolumeLegendShape,this);
    // //FeatureMappingShape fmShape = new FeatureMappingShape(featureMapping,featureShape,featureMapping.getSubVolume(),imageShape,this);
    // addShape(fmShape);
    // containerShape.addChildShape(fmShape);
    // }
    // }
    // }
    // 
    // assign children to shapes according to heirarchy in Model
    // 
    // int nullParentCount=0;
    // Enumeration enum_shape = getShapes();
    // while (enum_shape.hasMoreElements()){
    // Shape shape = (Shape)enum_shape.nextElement();
    // //
    // // for each featureShape, find corresponding featureShape
    // //
    // if (shape instanceof FeatureShape){
    // FeatureShape fs = (FeatureShape)shape;
    // Membrane membrane = fs.getFeature().getMembrane();
    // if (membrane!=null){
    // //
    // // add this feature as child to parent feature
    // //
    // Feature parentFeature = membrane.getOutsideFeature();
    // FeatureShape parentFeatureShape = (FeatureShape)getShapeFromModelObject(parentFeature);
    // if (!parentFeatureShape.contains(fs)){
    // parentFeatureShape.addChildShape(fs);
    // }
    // }else{
    // if (!structureShape.contains(fs)){
    // structureShape.addChildShape(fs);
    // }
    // nullParentCount++;
    // }
    // }
    // }
    fireGraphChanged(new GraphEvent(this));
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) GeometryClassLegendShape(cbit.vcell.graph.GeometryClassLegendShape) SubVolume(cbit.vcell.geometry.SubVolume) GeometryContextGeometryShape(cbit.vcell.graph.GeometryContextGeometryShape) GraphEvent(cbit.gui.graph.GraphEvent) SubVolume(cbit.vcell.geometry.SubVolume) SubVolumeContainerShape(cbit.vcell.graph.SubVolumeContainerShape)

Example 2 with SubVolumeContainerShape

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

the class GraphContainerLayoutVCellClassical method refreshLayoutChildrenGeometryContextStructureShape.

public void refreshLayoutChildrenGeometryContextStructureShape(GeometryContextStructureShape shape) {
    // calculate total height and max width of SubVolumeContainerShape
    int childHeight = 0;
    int childWidth = 0;
    for (Shape child : shape.getChildren()) {
        childHeight += child.getSpaceManager().getSize().height;
        childWidth = Math.max(childWidth, child.getSpaceManager().getSize().width);
    }
    int centerX = shape.getSpaceManager().getSize().width / 2;
    int centerY = shape.getSpaceManager().getSize().height / 2;
    int currY = Math.max(0, centerY - childHeight / 2) + shape.getLabelSize().height + 2;
    for (Shape child : shape.getChildren()) {
        child.getSpaceManager().setRelPos(centerX - child.getSpaceManager().getSize().width / 2, currY);
        currY += child.getSpaceManager().getSize().height;
        child.refreshLayoutSelf();
        refreshLayoutChildren(child);
    }
}
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) Point(java.awt.Point)

Aggregations

GeometryClassLegendShape (cbit.vcell.graph.GeometryClassLegendShape)2 GeometryContextGeometryShape (cbit.vcell.graph.GeometryContextGeometryShape)2 SubVolumeContainerShape (cbit.vcell.graph.SubVolumeContainerShape)2 GraphEvent (cbit.gui.graph.GraphEvent)1 BioPaxShape (cbit.vcell.client.desktop.biomodel.pathway.shapes.BioPaxShape)1 GeometrySpec (cbit.vcell.geometry.GeometrySpec)1 SubVolume (cbit.vcell.geometry.SubVolume)1 ContainerContainerShape (cbit.vcell.graph.ContainerContainerShape)1 FeatureShape (cbit.vcell.graph.FeatureShape)1 GeometryContextContainerShape (cbit.vcell.graph.GeometryContextContainerShape)1 GeometryContextStructureShape (cbit.vcell.graph.GeometryContextStructureShape)1 MembraneShape (cbit.vcell.graph.MembraneShape)1 ReactionContainerShape (cbit.vcell.graph.ReactionContainerShape)1 ReactionStepShape (cbit.vcell.graph.ReactionStepShape)1 SpeciesContextShape (cbit.vcell.graph.SpeciesContextShape)1 StructureMappingStructureShape (cbit.vcell.graph.StructureMappingStructureShape)1 StructureShape (cbit.vcell.graph.StructureShape)1 Point (java.awt.Point)1