Added special Warning object for when the system does not have motors for the ork file.
This commit is contained in:
parent
8d488430a2
commit
6bdefe103c
@ -1,6 +1,7 @@
|
||||
package net.sf.openrocket.aerodynamics;
|
||||
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import net.sf.openrocket.motor.Motor;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
|
||||
@ -91,6 +92,100 @@ public abstract class Warning {
|
||||
}
|
||||
}
|
||||
|
||||
public static class MissingMotor extends Warning {
|
||||
|
||||
private Motor.Type type = null;
|
||||
private String manufacturer = null;
|
||||
private String designation = null;
|
||||
private String digest = null;
|
||||
private double diameter = Double.NaN;
|
||||
private double length = Double.NaN;
|
||||
private double delay = Double.NaN;
|
||||
|
||||
public String toString() {
|
||||
String str = "No motor with designation '" + designation + "'";
|
||||
if (manufacturer != null)
|
||||
str += " for manufacturer '" + manufacturer + "'";
|
||||
str += " found.";
|
||||
return str;
|
||||
}
|
||||
|
||||
public Motor.Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void setType(Motor.Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
public String getManufacturer() {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
|
||||
public void setManufacturer(String manufacturer) {
|
||||
this.manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
|
||||
public String getDesignation() {
|
||||
return designation;
|
||||
}
|
||||
|
||||
|
||||
public void setDesignation(String designation) {
|
||||
this.designation = designation;
|
||||
}
|
||||
|
||||
|
||||
public String getDigest() {
|
||||
return digest;
|
||||
}
|
||||
|
||||
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
|
||||
|
||||
public double getDiameter() {
|
||||
return diameter;
|
||||
}
|
||||
|
||||
|
||||
public void setDiameter(double diameter) {
|
||||
this.diameter = diameter;
|
||||
}
|
||||
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
public void setLength(double length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
||||
public double getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
||||
public void setDelay(double delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean replaceBy(Warning other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1002,11 +1002,14 @@ class MotorHandler extends ElementHandler {
|
||||
|
||||
// No motors
|
||||
if (motors.size() == 0) {
|
||||
String str = "No motor with designation '" + designation + "'";
|
||||
if (manufacturer != null)
|
||||
str += " for manufacturer '" + manufacturer + "'";
|
||||
str += " found.";
|
||||
warnings.add(str);
|
||||
Warning.MissingMotor mmw = new Warning.MissingMotor();
|
||||
mmw.setDesignation(designation);
|
||||
mmw.setDigest(digest);
|
||||
mmw.setDiameter(diameter);
|
||||
mmw.setLength(length);
|
||||
mmw.setManufacturer(manufacturer);
|
||||
mmw.setType(type);
|
||||
warnings.add(mmw);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user