From 31f52cec18838731fe20dfa317a0ef13f7120f3e Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Sat, 14 Aug 2021 20:52:09 -0700 Subject: [PATCH] Add missing change from resolution of merge Missed a change resolving merges for PhotoPanel.java Signed-off-by: Billy Olsen --- .../gui/figure3d/photo/PhotoPanel.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoPanel.java b/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoPanel.java index 8100e9125..2a7ad567d 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoPanel.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/photo/PhotoPanel.java @@ -80,7 +80,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { private PhotoSettings p; private OpenRocketDocument document; private DocumentChangeListener changeListener; - + interface ImageCallback { public void performAction(BufferedImage i); } @@ -94,7 +94,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { document = doc; cachedBounds = null; this.configuration = doc.getSelectedConfiguration(); - + changeListener = new DocumentChangeListener() { @Override public void documentChanged(DocumentChangeEvent event) { @@ -116,8 +116,18 @@ public class PhotoPanel extends JPanel implements GLEventListener { }); } + void clearDoc() { + document.removeDocumentChangeListener(changeListener); + changeListener = null; + document = null; + } + + PhotoSettings getSettings() { + return p; + } + PhotoPanel(OpenRocketDocument document, PhotoSettings p) { - this.p = p; + this.p = p; this.setLayout(new BorderLayout()); PhotoPanel.this.configuration = document.getSelectedConfiguration(); @@ -406,7 +416,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { } rr.render(drawable, configuration, new HashSet()); - + //Figure out the lowest stage shown AxialStage bottomStage = configuration.getBottomStage(); @@ -415,25 +425,25 @@ public class PhotoPanel extends JPanel implements GLEventListener { bottomStage.getStageNumber(); //final int currentStageNumber = configuration.getActiveStages()[configuration.getActiveStages().length-1]; //final AxialStage currentStage = (AxialStage)configuration.getRocket().getChild( bottomStageNumber); - + final FlightConfigurationId motorID = configuration.getFlightConfigurationID(); - - - + + + final Iterator iter = configuration.getActiveMotors().iterator(); while( iter.hasNext()){ MotorConfiguration curConfig = iter.next(); final MotorMount mount = curConfig.getMount(); int curStageNumber = ((RocketComponent)mount).getStageNumber(); - + //If this mount is not in currentStage continue on to the next one. if( curStageNumber != bottomStageNumber ){ continue; } - + final Motor motor = mount.getMotorConfig(motorID).getMotor(); final double length = motor.getLength(); - + Coordinate[] position = ((RocketComponent) mount) .toAbsolute(new Coordinate(((RocketComponent) mount) .getLength() + mount.getMotorOverhang() - length)); @@ -536,4 +546,4 @@ public class PhotoPanel extends JPanel implements GLEventListener { gl.glTranslated(-b.xMin - b.xSize / 2.0, 0, 0); } -} +} \ No newline at end of file