Search in sources :

Example 1 with MembraneShape

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

the class GraphContainerLayoutVCellClassical method refreshLayoutChildrenMembraneShape.

public void refreshLayoutChildrenMembraneShape(MembraneShape shape) {
    // this is like a row/column layout  (1 column)
    // find featureShape child
    FeatureShape featureShape = null;
    for (Shape child : shape.getChildren()) {
        if (child instanceof FeatureShape) {
            featureShape = (FeatureShape) child;
        }
    }
    // calculate total height of all children (not including label)
    // position featureShape (and label)
    int centerX = shape.getSpaceManager().getSize().width / 2;
    int currentY = MembraneShape.memSpacingY;
    if (featureShape != null) {
        featureShape.getSpaceManager().setRelPos(centerX - featureShape.getSpaceManager().getSize().width / 2, currentY);
        currentY += featureShape.getSpaceManager().getSize().height + MembraneShape.memSpacingY;
    }
    // position speciesContextShapes
    // angle = 0 at north pole and increases counter clockwise
    int numSpeciesContexts = shape.countChildren() - 1;
    if (numSpeciesContexts > 0) {
        double deltaAngle = MembraneShape.TotalAngle / (numSpeciesContexts + 1);
        double currentAngle = MembraneShape.BeginAngle + deltaAngle;
        for (Shape child : shape.getChildren()) {
            if (child instanceof SpeciesContextShape) {
                child.getSpaceManager().setRelPos(shape.getRadialPosition(currentAngle));
                currentAngle = (currentAngle + deltaAngle) % (2 * Math.PI);
            }
        }
    }
}
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) FeatureShape(cbit.vcell.graph.FeatureShape) SpeciesContextShape(cbit.vcell.graph.SpeciesContextShape) Point(java.awt.Point)

Aggregations

BioPaxShape (cbit.vcell.client.desktop.biomodel.pathway.shapes.BioPaxShape)1 ContainerContainerShape (cbit.vcell.graph.ContainerContainerShape)1 FeatureShape (cbit.vcell.graph.FeatureShape)1 GeometryClassLegendShape (cbit.vcell.graph.GeometryClassLegendShape)1 GeometryContextContainerShape (cbit.vcell.graph.GeometryContextContainerShape)1 GeometryContextGeometryShape (cbit.vcell.graph.GeometryContextGeometryShape)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 SubVolumeContainerShape (cbit.vcell.graph.SubVolumeContainerShape)1 Point (java.awt.Point)1