From 3f17363807da21bcb39f640fb251b69b84004a3e Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Sun, 22 Mar 2020 20:38:55 -0700 Subject: [PATCH] Use FlightConfiguration.getLength() in RocketPanel Use the curConfig.getLength() for the length displayed in the RocketPanel rather than calculating it based off the bounds. The length method provided by the FlightConfiguration takes everything into account that is needed (active stages, etc) to calculate the length. Closes #452 Signed-off-by: Billy Olsen --- .../openrocket/gui/scalefigure/RocketPanel.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java b/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java index 33a014531..fee80d6c1 100644 --- a/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java +++ b/swing/src/net/sf/openrocket/gui/scalefigure/RocketPanel.java @@ -606,20 +606,8 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change figure3d.setCG(cg); figure3d.setCP(cp); - // Length bound is assumed to be tight - double length = 0; - Collection bounds = curConfig.getBounds(); - if (!bounds.isEmpty()) { - double minX = Double.POSITIVE_INFINITY, maxX = Double.NEGATIVE_INFINITY; - for (Coordinate c : bounds) { - if (c.x < minX) - minX = c.x; - if (c.x > maxX) - maxX = c.x; - } - length = maxX - minX; - } - + double length = curConfig.getLength(); + double diameter = Double.NaN; for (RocketComponent c : curConfig.getCoreComponents()) { if (c instanceof SymmetricComponent) {