Fill in missing warnings

This commit is contained in:
SiboVG 2023-04-01 09:35:31 +02:00
parent 027a7008a0
commit b6af7220c6
5 changed files with 12 additions and 10 deletions

View File

@ -312,7 +312,7 @@ public class RASAeroCommonConstants {
} }
} }
public static String OPENROCKET_TO_RASAERO_FIN_CROSSSECTION(FinSet.CrossSection crossSection) { public static String OPENROCKET_TO_RASAERO_FIN_CROSSSECTION(FinSet.CrossSection crossSection, WarningSet warnings) {
if (FinSet.CrossSection.SQUARE.equals(crossSection)) { if (FinSet.CrossSection.SQUARE.equals(crossSection)) {
return CROSS_SECTION_SQUARE; return CROSS_SECTION_SQUARE;
} else if (FinSet.CrossSection.ROUNDED.equals(crossSection)) { } else if (FinSet.CrossSection.ROUNDED.equals(crossSection)) {
@ -320,7 +320,7 @@ public class RASAeroCommonConstants {
} else if (FinSet.CrossSection.AIRFOIL.equals(crossSection)) { } else if (FinSet.CrossSection.AIRFOIL.equals(crossSection)) {
return CROSS_SECTION_SUBSONIC_NACA; return CROSS_SECTION_SUBSONIC_NACA;
} else { } else {
//TODO: warnings.add("Unknown fin cross section: " + crossSection + "."); warnings.add("Unknown fin cross section: " + crossSection + ".");
return null; return null;
} }
} }
@ -350,7 +350,7 @@ public class RASAeroCommonConstants {
} }
} }
public static String OPENROCKET_TO_RASAERO_SURFACE(ExternalComponent.Finish finish) { public static String OPENROCKET_TO_RASAERO_SURFACE(ExternalComponent.Finish finish, WarningSet warnings) {
if (finish.equals(ExternalComponent.Finish.MIRROR)) { if (finish.equals(ExternalComponent.Finish.MIRROR)) {
return FINISH_SMOOTH; return FINISH_SMOOTH;
} else if (finish.equals(ExternalComponent.Finish.FINISHPOLISHED)) { } else if (finish.equals(ExternalComponent.Finish.FINISHPOLISHED)) {
@ -366,8 +366,7 @@ public class RASAeroCommonConstants {
} else if (finish.equals(ExternalComponent.Finish.ROUGHUNFINISHED)) { } else if (finish.equals(ExternalComponent.Finish.ROUGHUNFINISHED)) {
return FINISH_CAST_IRON; return FINISH_CAST_IRON;
} else { } else {
// TODO warnings.add("Unknown surface finish: " + finish + ", defaulting to Smooth.");
//warnings.add("Unknown surface finish: " + finish + ", defaulting to Smooth.");
return FINISH_SMOOTH; return FINISH_SMOOTH;
} }
} }

View File

@ -16,7 +16,7 @@ public interface BodyTubeDTOAdapter {
default void applyBodyTubeSettings(BodyTube bodyTube, WarningSet warnings, ErrorSet errors) throws RASAeroExportException { default void applyBodyTubeSettings(BodyTube bodyTube, WarningSet warnings, ErrorSet errors) throws RASAeroExportException {
for (RocketComponent child : bodyTube.getChildren()) { for (RocketComponent child : bodyTube.getChildren()) {
if (child instanceof TrapezoidFinSet) { if (child instanceof TrapezoidFinSet) {
setFin(new FinDTO((TrapezoidFinSet) child)); setFin(new FinDTO((TrapezoidFinSet) child, warnings, errors));
} 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()));

View File

@ -165,7 +165,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter {
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, warnings, errors));
setPartType(RASAeroCommonConstants.BOOSTER); setPartType(RASAeroCommonConstants.BOOSTER);
setLength(firstTube.getLength() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setLength(firstTube.getLength() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);

View File

@ -2,6 +2,8 @@ package net.sf.openrocket.file.rasaero.export;
import net.sf.openrocket.file.rasaero.CustomDoubleAdapter; import net.sf.openrocket.file.rasaero.CustomDoubleAdapter;
import net.sf.openrocket.file.rasaero.RASAeroCommonConstants; import net.sf.openrocket.file.rasaero.RASAeroCommonConstants;
import net.sf.openrocket.logging.ErrorSet;
import net.sf.openrocket.logging.WarningSet;
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.file.rasaero.export.RASAeroSaver.RASAeroExportException; import net.sf.openrocket.file.rasaero.export.RASAeroSaver.RASAeroExportException;
@ -53,7 +55,7 @@ public class FinDTO {
public FinDTO() { public FinDTO() {
} }
public FinDTO(TrapezoidFinSet fin) throws RASAeroExportException { public FinDTO(TrapezoidFinSet fin, WarningSet warnings, ErrorSet errors) throws RASAeroExportException {
int finCount = fin.getFinCount(); int finCount = fin.getFinCount();
if (finCount < 3 || finCount > 8) { if (finCount < 3 || finCount > 8) {
throw new RASAeroExportException( throw new RASAeroExportException(
@ -66,7 +68,7 @@ public class FinDTO {
setSpan(fin.getSpan() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setSpan(fin.getSpan() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
setSweepDistance(fin.getSweep() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setSweepDistance(fin.getSweep() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
setThickness(fin.getThickness() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setThickness(fin.getThickness() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
setAirfoilSection(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_FIN_CROSSSECTION(fin.getCrossSection())); setAirfoilSection(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_FIN_CROSSSECTION(fin.getCrossSection(), warnings));
setLocation((-fin.getAxialOffset(AxialMethod.BOTTOM) + fin.getLength()) * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); setLocation((-fin.getAxialOffset(AxialMethod.BOTTOM) + fin.getLength()) * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);
} }

View File

@ -97,7 +97,8 @@ public class RocketDesignDTO {
} }
addExternalPart(new NoseConeDTO((NoseCone) component, warnings, errors)); addExternalPart(new NoseConeDTO((NoseCone) component, warnings, errors));
// Set the global surface finish to that of the first nose cone // Set the global surface finish to that of the first nose cone
setSurface(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_SURFACE(((NoseCone) component).getFinish())); setSurface(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_SURFACE(((NoseCone) component).getFinish(),
warnings));
} else if (component instanceof Transition) { } else if (component instanceof Transition) {
addExternalPart(new TransitionDTO((Transition) component, warnings, errors)); addExternalPart(new TransitionDTO((Transition) component, warnings, errors));
} }