[bugfix] 'remove motor' button now works correctly
This commit is contained in:
parent
a32b303069
commit
a43fbe79bc
@ -1,6 +1,9 @@
|
|||||||
package net.sf.openrocket.rocketcomponent;
|
package net.sf.openrocket.motor;
|
||||||
|
|
||||||
import net.sf.openrocket.motor.MotorInstance;
|
import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
|
||||||
|
import net.sf.openrocket.rocketcomponent.FlightConfigurationID;
|
||||||
|
import net.sf.openrocket.rocketcomponent.ParameterSet;
|
||||||
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FlightConfigurationSet for motors.
|
* FlightConfigurationSet for motors.
|
@ -6,6 +6,7 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.motor.Motor;
|
import net.sf.openrocket.motor.Motor;
|
||||||
|
import net.sf.openrocket.motor.MotorConfigurationSet;
|
||||||
import net.sf.openrocket.motor.MotorInstance;
|
import net.sf.openrocket.motor.MotorInstance;
|
||||||
import net.sf.openrocket.preset.ComponentPreset;
|
import net.sf.openrocket.preset.ComponentPreset;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
@ -373,8 +374,8 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMotorInstance(final FlightConfigurationID fcid, final MotorInstance newMotorInstance){
|
public void setMotorInstance(final FlightConfigurationID fcid, final MotorInstance newMotorInstance){
|
||||||
if( null == newMotorInstance){
|
if((null == newMotorInstance)||(newMotorInstance.equals( MotorInstance.EMPTY_INSTANCE ))){
|
||||||
throw new NullPointerException(" null passed as MotorInstance to add to MotorSet ... bug ");
|
this.motors.set( fcid, null);
|
||||||
}else{
|
}else{
|
||||||
if( null == newMotorInstance.getMount()){
|
if( null == newMotorInstance.getMount()){
|
||||||
newMotorInstance.setMount(this);
|
newMotorInstance.setMount(this);
|
||||||
|
@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
import net.sf.openrocket.motor.Motor;
|
import net.sf.openrocket.motor.Motor;
|
||||||
|
import net.sf.openrocket.motor.MotorConfigurationSet;
|
||||||
import net.sf.openrocket.motor.MotorInstance;
|
import net.sf.openrocket.motor.MotorInstance;
|
||||||
import net.sf.openrocket.preset.ComponentPreset;
|
import net.sf.openrocket.preset.ComponentPreset;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
@ -237,30 +238,6 @@ public class InnerTube extends ThicknessRingComponent implements Clusterable, Ra
|
|||||||
return newArray;
|
return newArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public Coordinate[] getLocations(){
|
|
||||||
// if (null == this.parent) {
|
|
||||||
// throw new BugException(" Attempted to get absolute position Vector of a Stage without a parent. ");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final Coordinate center = parentInstances[0].add( this.position);
|
|
||||||
// Coordinate[] instanceLocations = this.getInstanceOffsets();
|
|
||||||
// Coordinate[] toReturn = new Coordinate[ instanceLocations.length];
|
|
||||||
// for( int i = 0; i < toReturn.length; i++){
|
|
||||||
// toReturn[i] = center.add( instanceLocations[i]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return toReturn;
|
|
||||||
//
|
|
||||||
// Coordinate[] parentInstances = this.parent.getLocations();
|
|
||||||
// for( int i=0; i< parentInstances.length; i++){
|
|
||||||
// parentInstances[i] = parentInstances[i].add( this.position );
|
|
||||||
// }
|
|
||||||
// Coordinate[] toReturn = this.shiftCoordinates(parentInstances);
|
|
||||||
//
|
|
||||||
// return toReturn;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// protected Coordinate[] shiftCoordinates(Coordinate[] array) {
|
// protected Coordinate[] shiftCoordinates(Coordinate[] array) {
|
||||||
// array = super.shiftCoordinates(array);
|
// array = super.shiftCoordinates(array);
|
||||||
@ -298,8 +275,8 @@ public class InnerTube extends ThicknessRingComponent implements Clusterable, Ra
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMotorInstance(final FlightConfigurationID fcid, final MotorInstance newMotorInstance){
|
public void setMotorInstance(final FlightConfigurationID fcid, final MotorInstance newMotorInstance){
|
||||||
if( null == newMotorInstance){
|
if((null == newMotorInstance)||(newMotorInstance.equals( MotorInstance.EMPTY_INSTANCE ))){
|
||||||
throw new NullPointerException(" null passed as MotorInstance to add to MotorSet ... bug ");
|
this.motors.set( fcid, null);
|
||||||
}else{
|
}else{
|
||||||
if( null == newMotorInstance.getMount()){
|
if( null == newMotorInstance.getMount()){
|
||||||
newMotorInstance.setMount(this);
|
newMotorInstance.setMount(this);
|
||||||
|
@ -236,9 +236,7 @@ public class MotorConfigurationPanel extends FlightConfigurablePanel<MotorMount>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curMount.setMotorInstance( fcid, null);
|
||||||
MotorInstance curInstance = MotorInstance.EMPTY_INSTANCE;
|
|
||||||
curMount.setMotorInstance( fcid, curInstance);
|
|
||||||
|
|
||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user