Took care of a LOW TODO about custom recovery speed warning.
This commit is contained in:
parent
eae24f68a9
commit
eb3f77df39
@ -92,6 +92,37 @@ public abstract class Warning {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A <code>Warning</code> indicating recovery device deployment at high speed was encountered.
|
||||||
|
*
|
||||||
|
* @author Craig Earls <enderw88@gmail.com>
|
||||||
|
*/
|
||||||
|
public static class HighSpeedDeployment extends Warning {
|
||||||
|
private double recoverySpeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sole constructor. The argument is the speed that caused this warning.
|
||||||
|
*
|
||||||
|
* @param speed the speed that caused this warning
|
||||||
|
*/
|
||||||
|
public HighSpeedDeployment(double speed) {
|
||||||
|
this.recoverySpeed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (Double.isNaN(recoverySpeed)) {
|
||||||
|
return trans.get("Warning.RECOVERY_HIGH_SPEED");
|
||||||
|
}
|
||||||
|
return trans.get("Warning.RECOVERY_HIGH_SPEED") + " (" + UnitGroup.UNITS_VELOCITY.toStringUnit(recoverySpeed) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replaceBy(Warning other) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class MissingMotor extends Warning {
|
public static class MissingMotor extends Warning {
|
||||||
|
|
||||||
private Motor.Type type = null;
|
private Motor.Type type = null;
|
||||||
|
@ -23,7 +23,6 @@ import net.sf.openrocket.simulation.exception.SimulationLaunchException;
|
|||||||
import net.sf.openrocket.simulation.listeners.SimulationListenerHelper;
|
import net.sf.openrocket.simulation.listeners.SimulationListenerHelper;
|
||||||
import net.sf.openrocket.simulation.listeners.system.OptimumCoastListener;
|
import net.sf.openrocket.simulation.listeners.system.OptimumCoastListener;
|
||||||
import net.sf.openrocket.startup.Application;
|
import net.sf.openrocket.startup.Application;
|
||||||
import net.sf.openrocket.unit.UnitGroup;
|
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
import net.sf.openrocket.util.Pair;
|
import net.sf.openrocket.util.Pair;
|
||||||
@ -494,11 +493,7 @@ public class BasicEventSimulationEngine implements SimulationEngine {
|
|||||||
|
|
||||||
// Check current velocity
|
// Check current velocity
|
||||||
if (status.getRocketVelocity().length() > 20) {
|
if (status.getRocketVelocity().length() > 20) {
|
||||||
// TODO: LOW: Custom warning.
|
status.getWarnings().add(new Warning.HighSpeedDeployment(status.getRocketVelocity().length()));
|
||||||
status.getWarnings().add(Warning.fromString(trans.get("Warning.RECOVERY_HIGH_SPEED") +
|
|
||||||
" ("
|
|
||||||
+ UnitGroup.UNITS_VELOCITY.toStringUnit(status.getRocketVelocity().length())
|
|
||||||
+ ")."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status.setLiftoff(true);
|
status.setLiftoff(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user