[fix] fixed stack overflow in RocketFigure

This commit is contained in:
Daniel_M_Williams 2020-07-03 10:40:35 -04:00
parent 04476ecc98
commit 7c20b64135

View File

@ -418,13 +418,16 @@ public class RocketFigure extends AbstractScaleFigure {
@Override @Override
protected void updateSubjectDimensions() { protected void updateSubjectDimensions() {
// calculate bounds, and store in class variables // calculate bounds, and store in class variables
final BoundingBox bounds = rocket.getSelectedConfiguration().getBoundingBox(); BoundingBox newBounds = rocket.getSelectedConfiguration().getBoundingBox();
final double maxR = Math.max(Math.hypot(bounds.min.y, bounds.min.z), if(newBounds.isEmpty())
Math.hypot(bounds.max.y, bounds.max.z)); newBounds = new BoundingBox(Coordinate.ZERO,Coordinate.X_UNIT);
final double maxR = Math.max(Math.hypot(newBounds.min.y, newBounds.min.z),
Math.hypot(newBounds.max.y, newBounds.max.z));
switch (currentViewType) { switch (currentViewType) {
case SideView: case SideView:
subjectBounds_m = new Rectangle2D.Double(bounds.min.x, -maxR, bounds.span().x, 2 * maxR); subjectBounds_m = new Rectangle2D.Double(newBounds.min.x, -maxR, newBounds.span().x, 2 * maxR);
break; break;
case BackView: case BackView:
subjectBounds_m = new Rectangle2D.Double(-maxR, -maxR, 2 * maxR, 2 * maxR); subjectBounds_m = new Rectangle2D.Double(-maxR, -maxR, 2 * maxR, 2 * maxR);