Add dots to warning/error texts
This commit is contained in:
parent
de8ab74b2d
commit
8c9a04b74e
@ -71,7 +71,7 @@ public class BasePartDTO {
|
|||||||
setPartType(RASAeroCommonConstants.NOSE_CONE);
|
setPartType(RASAeroCommonConstants.NOSE_CONE);
|
||||||
NoseCone noseCone = (NoseCone) component;
|
NoseCone noseCone = (NoseCone) component;
|
||||||
if (noseCone.isFlipped()) {
|
if (noseCone.isFlipped()) {
|
||||||
throw new RASAeroExportException("Nose cone may not be flipped");
|
throw new RASAeroExportException("Nose cone may not be flipped.");
|
||||||
}
|
}
|
||||||
setDiameter(((NoseCone) component).getAftRadius() * 2 * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
setDiameter(((NoseCone) component).getAftRadius() * 2 * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
||||||
} else if (component instanceof Transition) {
|
} else if (component instanceof Transition) {
|
||||||
@ -83,11 +83,11 @@ public class BasePartDTO {
|
|||||||
setPartType(RASAeroCommonConstants.BOOSTER);
|
setPartType(RASAeroCommonConstants.BOOSTER);
|
||||||
AxialStage stage = (AxialStage) component;
|
AxialStage stage = (AxialStage) component;
|
||||||
if (stage.getChildCount() == 0 || !(stage.getChild(0) instanceof BodyTube)) {
|
if (stage.getChildCount() == 0 || !(stage.getChild(0) instanceof BodyTube)) {
|
||||||
throw new RASAeroExportException("First component of booster must be body tube");
|
throw new RASAeroExportException("First component of booster must be body tube.");
|
||||||
}
|
}
|
||||||
setDiameter(stage.getBoundingRadius() * 2 * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
setDiameter(stage.getBoundingRadius() * 2 * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
throw new RASAeroExportException("Unsupported component: " + component.getComponentName());
|
throw new RASAeroExportException("Unsupported component: ." + component.getComponentName());
|
||||||
}
|
}
|
||||||
|
|
||||||
setLength(component.getLength() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
setLength(component.getLength() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
||||||
@ -109,7 +109,7 @@ public class BasePartDTO {
|
|||||||
|
|
||||||
public void setLength(Double length) throws RASAeroExportException {
|
public void setLength(Double length) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(length, 0)) {
|
if (MathUtil.equals(length, 0)) {
|
||||||
throw new RASAeroExportException(String.format("Length of '%s' must be greater than 0", component.getName()));
|
throw new RASAeroExportException(String.format("Length of '%s' must be greater than 0.", component.getName()));
|
||||||
}
|
}
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ public class BasePartDTO {
|
|||||||
|
|
||||||
public void setDiameter(Double diameter) throws RASAeroExportException {
|
public void setDiameter(Double diameter) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(diameter, 0)) {
|
if (MathUtil.equals(diameter, 0)) {
|
||||||
throw new RASAeroExportException(String.format("Diameter of '%s' must be greater than 0", component.getName()));
|
throw new RASAeroExportException(String.format("Diameter of '%s' must be greater than 0.", component.getName()));
|
||||||
}
|
}
|
||||||
this.diameter = diameter;
|
this.diameter = diameter;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class BodyTubeDTO extends BasePartDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setLaunchLugDiameter(Double launchLugDiameter) throws RASAeroExportException {
|
public void setLaunchLugDiameter(Double launchLugDiameter) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(launchLugDiameter, 0)) {
|
if (MathUtil.equals(launchLugDiameter, 0)) {
|
||||||
throw new RASAeroExportException("Launch lug diameter can not be 0");
|
throw new RASAeroExportException("Launch lug diameter can not be 0.");
|
||||||
}
|
}
|
||||||
this.launchLugDiameter = launchLugDiameter;
|
this.launchLugDiameter = launchLugDiameter;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ public class BodyTubeDTO extends BasePartDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setLaunchLugLength(Double launchLugLength) throws RASAeroExportException {
|
public void setLaunchLugLength(Double launchLugLength) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(launchLugLength, 0)) {
|
if (MathUtil.equals(launchLugLength, 0)) {
|
||||||
throw new RASAeroExportException("Launch lug length can not be 0");
|
throw new RASAeroExportException("Launch lug length can not be 0.");
|
||||||
}
|
}
|
||||||
this.launchLugLength = launchLugLength;
|
this.launchLugLength = launchLugLength;
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public class BodyTubeDTO extends BasePartDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setRailGuideDiameter(Double railGuideDiameter) throws RASAeroExportException {
|
public void setRailGuideDiameter(Double railGuideDiameter) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(railGuideDiameter, 0)) {
|
if (MathUtil.equals(railGuideDiameter, 0)) {
|
||||||
throw new RASAeroExportException("Rail button diameter can not be 0");
|
throw new RASAeroExportException("Rail button diameter can not be 0.");
|
||||||
}
|
}
|
||||||
this.railGuideDiameter = railGuideDiameter;
|
this.railGuideDiameter = railGuideDiameter;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public class BodyTubeDTO extends BasePartDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setRailGuideHeight(Double railGuideHeight) throws RASAeroExportException {
|
public void setRailGuideHeight(Double railGuideHeight) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(railGuideHeight, 0)) {
|
if (MathUtil.equals(railGuideHeight, 0)) {
|
||||||
throw new RASAeroExportException("Rail button height can not be 0");
|
throw new RASAeroExportException("Rail button height can not be 0.");
|
||||||
}
|
}
|
||||||
this.railGuideHeight = railGuideHeight;
|
this.railGuideHeight = railGuideHeight;
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ public class BodyTubeDTO extends BasePartDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setLaunchShoeArea(Double launchShoeArea) throws RASAeroExportException {
|
public void setLaunchShoeArea(Double launchShoeArea) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(launchShoeArea, 0)) {
|
if (MathUtil.equals(launchShoeArea, 0)) {
|
||||||
throw new RASAeroExportException("Launch shoe area can not be 0");
|
throw new RASAeroExportException("Launch shoe area can not be 0.");
|
||||||
}
|
}
|
||||||
this.launchShoeArea = launchShoeArea;
|
this.launchShoeArea = launchShoeArea;
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,11 @@ public interface BodyTubeDTOAdapter {
|
|||||||
setFin(new FinDTO((TrapezoidFinSet) child));
|
setFin(new FinDTO((TrapezoidFinSet) child));
|
||||||
} else if (child instanceof LaunchLug) {
|
} else if (child instanceof LaunchLug) {
|
||||||
if (!MathUtil.equals(getRailGuideDiameter(), 0) || !MathUtil.equals(getRailGuideHeight(), 0)) { // only one check on diameter or length should be sufficient, but just to be safe
|
if (!MathUtil.equals(getRailGuideDiameter(), 0) || !MathUtil.equals(getRailGuideHeight(), 0)) { // only one check on diameter or length should be sufficient, but just to be safe
|
||||||
warnings.add(String.format("Already added a rail button, ignoring launch lug '%s'", child.getName()));
|
warnings.add(String.format("Already added a rail button, ignoring launch lug '%s'.", child.getName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!MathUtil.equals(getLaunchShoeArea(), 0)) {
|
if (!MathUtil.equals(getLaunchShoeArea(), 0)) {
|
||||||
warnings.add(String.format("Already added a launch shoe, ignoring launch lug '%s'", child.getName()));
|
warnings.add(String.format("Already added a launch shoe, ignoring launch lug '%s'.", child.getName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,11 +38,11 @@ public interface BodyTubeDTOAdapter {
|
|||||||
}
|
}
|
||||||
} else if (child instanceof RailButton) {
|
} else if (child instanceof RailButton) {
|
||||||
if (!MathUtil.equals(getLaunchLugDiameter(), 0) || !MathUtil.equals(getLaunchLugLength(), 0)) { // only one check on diameter or length should be sufficient, but just to be safe
|
if (!MathUtil.equals(getLaunchLugDiameter(), 0) || !MathUtil.equals(getLaunchLugLength(), 0)) { // only one check on diameter or length should be sufficient, but just to be safe
|
||||||
warnings.add(String.format("Already added a launch lug, ignoring rail button '%s'", child.getName()));
|
warnings.add(String.format("Already added a launch lug, ignoring rail button '%s'.", child.getName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!MathUtil.equals(getLaunchShoeArea(), 0)) {
|
if (!MathUtil.equals(getLaunchShoeArea(), 0)) {
|
||||||
warnings.add(String.format("Already added a launch shoe, ignoring rail button '%s'", child.getName()));
|
warnings.add(String.format("Already added a launch shoe, ignoring rail button '%s'.", child.getName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ public interface BodyTubeDTOAdapter {
|
|||||||
setRailGuideHeight(button.getTotalHeight() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
setRailGuideHeight(button.getTotalHeight() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
||||||
|
|
||||||
if (button.getInstanceCount() != 2) {
|
if (button.getInstanceCount() != 2) {
|
||||||
warnings.add(String.format("Instance count of '%s' equals %d, defaulting to 2",
|
warnings.add(String.format("Instance count of '%s' equals %d, defaulting to 2.",
|
||||||
button.getName(), button.getInstanceCount()));
|
button.getName(), button.getInstanceCount()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,7 +14,6 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementRef;
|
import javax.xml.bind.annotation.XmlElementRef;
|
||||||
import javax.xml.bind.annotation.XmlElementRefs;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
@ -24,11 +23,8 @@ import net.sf.openrocket.rocketcomponent.SymmetricComponent;
|
|||||||
import net.sf.openrocket.rocketcomponent.Transition;
|
import net.sf.openrocket.rocketcomponent.Transition;
|
||||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||||
import net.sf.openrocket.util.ArrayList;
|
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@XmlRootElement(name = RASAeroCommonConstants.BOOSTER)
|
@XmlRootElement(name = RASAeroCommonConstants.BOOSTER)
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class BoosterDTO implements BodyTubeDTOAdapter {
|
public class BoosterDTO implements BodyTubeDTOAdapter {
|
||||||
@ -105,43 +101,43 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
int stageNr = rocket.getChildPosition(stage); // Use this instead of stage.getStageNumber() in case there are parallel stages in the design
|
int stageNr = rocket.getChildPosition(stage); // Use this instead of stage.getStageNumber() in case there are parallel stages in the design
|
||||||
if (stageNr != 1 && stageNr != 2) {
|
if (stageNr != 1 && stageNr != 2) {
|
||||||
throw new RASAeroExportException(String.format("Invalid stage number '%d' for booster stage '%s'", stageNr, stage.getName()));
|
throw new RASAeroExportException(String.format("Invalid stage number '%d' for booster stage '%s'.", stageNr, stage.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stage.getChildCount() == 0) {
|
if (stage.getChildCount() == 0) {
|
||||||
throw new RASAeroExportException(String.format("Stage '%s' can not be empty", stage.getName()));
|
throw new RASAeroExportException(String.format("Stage '%s' may not be empty.", stage.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RocketComponent firstChild = stage.getChild(0);
|
RocketComponent firstChild = stage.getChild(0);
|
||||||
if (!(firstChild instanceof BodyTube) &&
|
if (!(firstChild instanceof BodyTube) &&
|
||||||
!(firstChild instanceof Transition && !(firstChild instanceof NoseCone))) {
|
!(firstChild instanceof Transition && !(firstChild instanceof NoseCone))) {
|
||||||
throw new RASAeroExportException(String.format("First component of stage '%s' must be a body tube or transition", stage.getName()));
|
throw new RASAeroExportException(String.format("First component of stage '%s' must be a body tube or transition.", stage.getName()));
|
||||||
}
|
}
|
||||||
final BodyTube firstTube;
|
final BodyTube firstTube;
|
||||||
if (firstChild instanceof Transition) {
|
if (firstChild instanceof Transition) {
|
||||||
if (stage.getChildCount() == 1 || !(stage.getChild(1) instanceof BodyTube)) {
|
if (stage.getChildCount() == 1 || !(stage.getChild(1) instanceof BodyTube)) {
|
||||||
throw new RASAeroExportException(
|
throw new RASAeroExportException(
|
||||||
String.format("When the first component of stage '%s' is a transition, the second one must be a body tube",
|
String.format("When the first component of stage '%s' is a transition, the second one must be a body tube.",
|
||||||
stage.getName()));
|
stage.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Transition transition = (Transition) firstChild;
|
Transition transition = (Transition) firstChild;
|
||||||
SymmetricComponent previousComponent = transition.getPreviousSymmetricComponent();
|
SymmetricComponent previousComponent = transition.getPreviousSymmetricComponent();
|
||||||
if (previousComponent == null) {
|
if (previousComponent == null) {
|
||||||
throw new RASAeroExportException(String.format("No previous component for '%s' in stage '%s'",
|
throw new RASAeroExportException(String.format("No previous component for '%s' in stage '%s'.",
|
||||||
firstChild.getName(), stage.getName()));
|
firstChild.getName(), stage.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MathUtil.equals(transition.getForeRadius(), previousComponent.getAftRadius())) {
|
if (!MathUtil.equals(transition.getForeRadius(), previousComponent.getAftRadius())) {
|
||||||
throw new RASAeroExportException(
|
throw new RASAeroExportException(
|
||||||
String.format("Transition '%s' in stage '%s' must have the same fore radius as the aft radius of its previous component '%s'",
|
String.format("Transition '%s' in stage '%s' must have the same fore radius as the aft radius of its previous component '%s'.",
|
||||||
transition.getName(), stage.getName(), previousComponent.getName()));
|
transition.getName(), stage.getName(), previousComponent.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
firstTube = (BodyTube) stage.getChild(1);
|
firstTube = (BodyTube) stage.getChild(1);
|
||||||
if (!MathUtil.equals(firstTube.getOuterRadius(), transition.getAftRadius())) {
|
if (!MathUtil.equals(firstTube.getOuterRadius(), transition.getAftRadius())) {
|
||||||
throw new RASAeroExportException(
|
throw new RASAeroExportException(
|
||||||
String.format("Radius of '%s' in stage '%s' must be the same as the aft radius of '%s",
|
String.format("Radius of '%s' in stage '%s' must be the same as the aft radius of '%s'.",
|
||||||
firstTube.getName(), stage.getName(), transition.getName()));
|
firstTube.getName(), stage.getName(), transition.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,13 +146,13 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
|||||||
setInsideDiameter(transition.getForeRadius() * 2 * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
setInsideDiameter(transition.getForeRadius() * 2 * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
|
||||||
|
|
||||||
if (stage.getChildCount() > 2) {
|
if (stage.getChildCount() > 2) {
|
||||||
warnings.add(String.format("Stage '%s' can only contain a body tube and transition shoulder, ignoring other %d components",
|
warnings.add(String.format("Stage '%s' can only contain a body tube and transition shoulder, ignoring other %d components.",
|
||||||
stage.getName(), stage.getChildCount() - 2));
|
stage.getName(), stage.getChildCount() - 2));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
firstTube = (BodyTube) stage.getChild(0);
|
firstTube = (BodyTube) stage.getChild(0);
|
||||||
if (stage.getChildCount() > 1) {
|
if (stage.getChildCount() > 1) {
|
||||||
warnings.add(String.format("Stage '%s' can only contain a body tube, ignoring other %d components",
|
warnings.add(String.format("Stage '%s' can only contain a body tube, ignoring other %d components.",
|
||||||
stage.getName(), stage.getChildCount() - 1));
|
stage.getName(), stage.getChildCount() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +162,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
|||||||
TrapezoidFinSet finSet = getFinSetFromBodyTube(firstTube);
|
TrapezoidFinSet finSet = getFinSetFromBodyTube(firstTube);
|
||||||
if (finSet == null) {
|
if (finSet == null) {
|
||||||
throw new RASAeroExportException(
|
throw new RASAeroExportException(
|
||||||
String.format("Body tube '%s' in stage '%s' must have a TrapezoidFinSet",
|
String.format("Body tube '%s' in stage '%s' must have a TrapezoidFinSet.",
|
||||||
firstTube.getName(), stage.getName()));
|
firstTube.getName(), stage.getName()));
|
||||||
}
|
}
|
||||||
setFin(new FinDTO(finSet));
|
setFin(new FinDTO(finSet));
|
||||||
@ -201,7 +197,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setLength(Double length) {
|
public void setLength(Double length) {
|
||||||
if (MathUtil.equals(length, 0)) {
|
if (MathUtil.equals(length, 0)) {
|
||||||
errors.add(String.format("Length of '%s' must be greater than 0", component.getName()));
|
errors.add(String.format("Length of '%s' must be greater than 0.", component.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.length = length;
|
this.length = length;
|
||||||
@ -213,7 +209,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setDiameter(Double diameter) throws RASAeroExportException {
|
public void setDiameter(Double diameter) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(diameter, 0)) {
|
if (MathUtil.equals(diameter, 0)) {
|
||||||
throw new RASAeroExportException(String.format("Diameter of '%s' must be greater than 0", component.getName()));
|
throw new RASAeroExportException(String.format("Diameter of '%s' must be greater than 0.", component.getName()));
|
||||||
}
|
}
|
||||||
this.diameter = diameter;
|
this.diameter = diameter;
|
||||||
}
|
}
|
||||||
@ -224,7 +220,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
|
|||||||
|
|
||||||
public void setInsideDiameter(Double insideDiameter) throws RASAeroExportException {
|
public void setInsideDiameter(Double insideDiameter) throws RASAeroExportException {
|
||||||
if (MathUtil.equals(insideDiameter, 0)) {
|
if (MathUtil.equals(insideDiameter, 0)) {
|
||||||
throw new RASAeroExportException(String.format("Inside diameter of '%s' must be greater than 0", component.getName()));
|
throw new RASAeroExportException(String.format("Inside diameter of '%s' must be greater than 0.", component.getName()));
|
||||||
}
|
}
|
||||||
this.insideDiameter = insideDiameter;
|
this.insideDiameter = insideDiameter;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class FinDTO {
|
|||||||
int finCount = fin.getFinCount();
|
int finCount = fin.getFinCount();
|
||||||
if (finCount < 3 || finCount > 8) {
|
if (finCount < 3 || finCount > 8) {
|
||||||
throw new RASAeroExportException(
|
throw new RASAeroExportException(
|
||||||
String.format("Fin set '%s' must have a fin count between 3 and 8", fin.getName()));
|
String.format("Fin set '%s' must have a fin count between 3 and 8.", fin.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
setCount(fin.getFinCount());
|
setCount(fin.getFinCount());
|
||||||
|
@ -82,17 +82,17 @@ public class RocketDesignDTO {
|
|||||||
try {
|
try {
|
||||||
RocketComponent component = sustainer.getChild(i);
|
RocketComponent component = sustainer.getChild(i);
|
||||||
if (i == 0 && !(component instanceof NoseCone)) {
|
if (i == 0 && !(component instanceof NoseCone)) {
|
||||||
errors.add("First component of the sustainer must be a nose cone");
|
errors.add("First component of the sustainer must be a nose cone.");
|
||||||
return;
|
return;
|
||||||
} else if (i == 1 && !(component instanceof BodyTube)) {
|
} else if (i == 1 && !(component instanceof BodyTube)) {
|
||||||
errors.add("Second component of the sustainer must be a body tube");
|
errors.add("Second component of the sustainer must be a body tube.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (component instanceof BodyTube) {
|
if (component instanceof BodyTube) {
|
||||||
addExternalPart(new BodyTubeDTO((BodyTube) component, warnings, errors));
|
addExternalPart(new BodyTubeDTO((BodyTube) component, warnings, errors));
|
||||||
} else if (component instanceof NoseCone) {
|
} else if (component instanceof NoseCone) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
errors.add("A nose cone can only be the first component of the rocket");
|
errors.add("A nose cone can only be the first component of the rocket.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addExternalPart(new NoseConeDTO((NoseCone) component, warnings, errors));
|
addExternalPart(new NoseConeDTO((NoseCone) component, warnings, errors));
|
||||||
|
@ -36,16 +36,16 @@ public class TransitionDTO extends BasePartDTO {
|
|||||||
super(transition, warnings, errors);
|
super(transition, warnings, errors);
|
||||||
|
|
||||||
if (!transition.getShapeType().equals(Transition.Shape.CONICAL)) {
|
if (!transition.getShapeType().equals(Transition.Shape.CONICAL)) {
|
||||||
throw new RASAeroExportException("RASAero only supports conical transitions");
|
throw new RASAeroExportException("RASAero only supports conical transitions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
SymmetricComponent previousComp = transition.getPreviousSymmetricComponent();
|
SymmetricComponent previousComp = transition.getPreviousSymmetricComponent();
|
||||||
if (previousComp == null) {
|
if (previousComp == null) {
|
||||||
throw new RASAeroExportException(String.format("Transition '%s' has no previous component", transition.getName()));
|
throw new RASAeroExportException(String.format("Transition '%s' has no previous component.", transition.getName()));
|
||||||
}
|
}
|
||||||
if (!MathUtil.equals(transition.getForeRadius(), previousComp.getAftRadius())) {
|
if (!MathUtil.equals(transition.getForeRadius(), previousComp.getAftRadius())) {
|
||||||
throw new RASAeroExportException(
|
throw new RASAeroExportException(
|
||||||
String.format("Transition '%s' should have the same fore radius as the aft radius (%f) of its previous component, not (%f)",
|
String.format("Transition '%s' should have the same fore radius as the aft radius (%f) of its previous component, not %f.",
|
||||||
transition.getName(), previousComp.getAftRadius(), transition.getForeRadius()));
|
transition.getName(), previousComp.getAftRadius(), transition.getForeRadius()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user