Add missing change from resolution of merge

Missed a change resolving merges for PhotoPanel.java

Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
Billy Olsen 2021-08-14 20:52:09 -07:00
parent c95d7df327
commit 31f52cec18

View File

@ -80,7 +80,7 @@ public class PhotoPanel extends JPanel implements GLEventListener {
private PhotoSettings p; private PhotoSettings p;
private OpenRocketDocument document; private OpenRocketDocument document;
private DocumentChangeListener changeListener; private DocumentChangeListener changeListener;
interface ImageCallback { interface ImageCallback {
public void performAction(BufferedImage i); public void performAction(BufferedImage i);
} }
@ -94,7 +94,7 @@ public class PhotoPanel extends JPanel implements GLEventListener {
document = doc; document = doc;
cachedBounds = null; cachedBounds = null;
this.configuration = doc.getSelectedConfiguration(); this.configuration = doc.getSelectedConfiguration();
changeListener = new DocumentChangeListener() { changeListener = new DocumentChangeListener() {
@Override @Override
public void documentChanged(DocumentChangeEvent event) { 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) { PhotoPanel(OpenRocketDocument document, PhotoSettings p) {
this.p = p; this.p = p;
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
PhotoPanel.this.configuration = document.getSelectedConfiguration(); PhotoPanel.this.configuration = document.getSelectedConfiguration();
@ -406,7 +416,7 @@ public class PhotoPanel extends JPanel implements GLEventListener {
} }
rr.render(drawable, configuration, new HashSet<RocketComponent>()); rr.render(drawable, configuration, new HashSet<RocketComponent>());
//Figure out the lowest stage shown //Figure out the lowest stage shown
AxialStage bottomStage = configuration.getBottomStage(); AxialStage bottomStage = configuration.getBottomStage();
@ -415,25 +425,25 @@ public class PhotoPanel extends JPanel implements GLEventListener {
bottomStage.getStageNumber(); bottomStage.getStageNumber();
//final int currentStageNumber = configuration.getActiveStages()[configuration.getActiveStages().length-1]; //final int currentStageNumber = configuration.getActiveStages()[configuration.getActiveStages().length-1];
//final AxialStage currentStage = (AxialStage)configuration.getRocket().getChild( bottomStageNumber); //final AxialStage currentStage = (AxialStage)configuration.getRocket().getChild( bottomStageNumber);
final FlightConfigurationId motorID = configuration.getFlightConfigurationID(); final FlightConfigurationId motorID = configuration.getFlightConfigurationID();
final Iterator<MotorConfiguration> iter = configuration.getActiveMotors().iterator(); final Iterator<MotorConfiguration> iter = configuration.getActiveMotors().iterator();
while( iter.hasNext()){ while( iter.hasNext()){
MotorConfiguration curConfig = iter.next(); MotorConfiguration curConfig = iter.next();
final MotorMount mount = curConfig.getMount(); final MotorMount mount = curConfig.getMount();
int curStageNumber = ((RocketComponent)mount).getStageNumber(); int curStageNumber = ((RocketComponent)mount).getStageNumber();
//If this mount is not in currentStage continue on to the next one. //If this mount is not in currentStage continue on to the next one.
if( curStageNumber != bottomStageNumber ){ if( curStageNumber != bottomStageNumber ){
continue; continue;
} }
final Motor motor = mount.getMotorConfig(motorID).getMotor(); final Motor motor = mount.getMotorConfig(motorID).getMotor();
final double length = motor.getLength(); final double length = motor.getLength();
Coordinate[] position = ((RocketComponent) mount) Coordinate[] position = ((RocketComponent) mount)
.toAbsolute(new Coordinate(((RocketComponent) mount) .toAbsolute(new Coordinate(((RocketComponent) mount)
.getLength() + mount.getMotorOverhang() - length)); .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); gl.glTranslated(-b.xMin - b.xSize / 2.0, 0, 0);
} }
} }