use of cbit.vcell.graph.ContainerContainerShape 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;
}
use of cbit.vcell.graph.ContainerContainerShape 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;
}
Aggregations