Fix transition and body tube aft radius import
This commit is contained in:
parent
ecc13684aa
commit
3625abb07a
@ -70,7 +70,8 @@ public class BodyTubeHandler extends BaseHandler<BodyTube> {
|
||||
public void endHandler(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {
|
||||
super.endHandler(element, attributes, content, warnings);
|
||||
this.bodyTube.setLength(length / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH);
|
||||
this.bodyTube.setOuterRadius(diameter/2 / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH);
|
||||
this.bodyTube.setOuterRadius(diameter/2 / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH); // Not really useful, but included for completeness
|
||||
this.bodyTube.setOuterRadiusAutomatic(true);
|
||||
this.bodyTube.setThickness(0.002); // Arbitrary value; RASAero doesn't specify this
|
||||
|
||||
if (launchLugDiameter > 0 && launchLugLength > 0) {
|
||||
|
@ -22,6 +22,7 @@ public class BoosterHandler extends BodyTubeHandler {
|
||||
final AxialStage boosterStage;
|
||||
private double boatTailLength;
|
||||
private double boatTailRearDiameter;
|
||||
private double shoulderLength;
|
||||
|
||||
public BoosterHandler(DocumentLoadingContext context, RocketComponent parent) {
|
||||
super(context);
|
||||
@ -39,7 +40,8 @@ public class BoosterHandler extends BodyTubeHandler {
|
||||
|
||||
@Override
|
||||
public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) throws SAXException {
|
||||
if (RASAeroCommonConstants.BOAT_TAIL_LENGTH.equals(element) || RASAeroCommonConstants.BOAT_TAIL_REAR_DIAMETER.equals(element)) {
|
||||
if (RASAeroCommonConstants.BOAT_TAIL_LENGTH.equals(element) || RASAeroCommonConstants.BOAT_TAIL_REAR_DIAMETER.equals(element)
|
||||
|| RASAeroCommonConstants.SHOULDER_LENGTH.equals(element)) {
|
||||
return PlainTextHandler.INSTANCE;
|
||||
}
|
||||
return super.openElement(element, attributes, warnings);
|
||||
@ -52,6 +54,8 @@ public class BoosterHandler extends BodyTubeHandler {
|
||||
this.boatTailLength = Double.parseDouble(content) / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH;
|
||||
} else if (RASAeroCommonConstants.BOAT_TAIL_REAR_DIAMETER.equals(element)) {
|
||||
this.boatTailRearDiameter = Double.parseDouble(content) / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH;
|
||||
} else if (RASAeroCommonConstants.SHOULDER_LENGTH.equals(element)) {
|
||||
this.shoulderLength = Double.parseDouble(content) / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,6 +63,20 @@ public class BoosterHandler extends BodyTubeHandler {
|
||||
public void endHandler(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {
|
||||
super.endHandler(element, attributes, content, warnings);
|
||||
this.bodyTube.setName(this.boosterStage.getName() + " Body Tube");
|
||||
this.bodyTube.setOuterRadiusAutomatic(false);
|
||||
|
||||
// Add shoulder (transition) if it exists
|
||||
if (shoulderLength > 0) {
|
||||
Transition shoulder = new Transition();
|
||||
shoulder.setName(boosterStage.getName() + " Shoulder");
|
||||
shoulder.setColor(this.bodyTube.getColor());
|
||||
shoulder.setShapeType(Transition.Shape.CONICAL);
|
||||
shoulder.setLength(shoulderLength);
|
||||
shoulder.setAftRadiusAutomatic(false);
|
||||
shoulder.setForeRadiusAutomatic(true);
|
||||
shoulder.setAftRadius(this.bodyTube.getOuterRadius());
|
||||
this.boosterStage.addChild(shoulder, 0);
|
||||
}
|
||||
|
||||
// Add boat tail if it exists
|
||||
if (this.boatTailLength > 0 && this.boatTailRearDiameter > 0) {
|
||||
|
@ -55,11 +55,6 @@ public class FinCanHandler extends BodyTubeHandler {
|
||||
this.finCan.setAngleOffset(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) throws SAXException {
|
||||
return super.openElement(element, attributes, warnings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeElement(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {
|
||||
super.closeElement(element, attributes, content, warnings);
|
||||
@ -77,6 +72,7 @@ public class FinCanHandler extends BodyTubeHandler {
|
||||
@Override
|
||||
public void endHandler(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {
|
||||
super.endHandler(element, attributes, content, warnings);
|
||||
this.bodyTube.setOuterRadiusAutomatic(false);
|
||||
|
||||
// Add the shoulder to the front of the fin can
|
||||
Transition shoulder = new Transition();
|
||||
|
@ -61,7 +61,8 @@ public class TransitionHandler extends BaseHandler<Transition> {
|
||||
public void endHandler(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {
|
||||
super.endHandler(element, attributes, content, warnings);
|
||||
this.transition.setLength(length / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH);
|
||||
this.transition.setForeRadius(diameter/2 / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH);
|
||||
this.transition.setForeRadius(diameter/2 / RASAeroCommonConstants.RASAERO_TO_OPENROCKET_LENGTH); // Not really useful, but adding it for completeness
|
||||
this.transition.setForeRadiusAutomatic(true);
|
||||
this.transition.setThickness(0.002); // Arbitrary value; RASAero doesn't specify this
|
||||
}
|
||||
|
||||
|
@ -1296,6 +1296,10 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
mutex.verify();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getRadiusOffset(RadiusMethod method) {
|
||||
return method.getRadius(this.parent, this, getRadiusOffset());
|
||||
}
|
||||
|
||||
public RadiusMethod getRadiusMethod() {
|
||||
return RadiusMethod.COAXIAL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user