Merge pull request #1110 from SiboVG/issue-1070
[fixes #1070] Add backward compatibility OR 15.03
This commit is contained in:
commit
669e17ae83
@ -3,6 +3,8 @@ package net.sf.openrocket.file.openrocket.savers;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.sf.openrocket.rocketcomponent.FinSet;
|
||||||
|
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||||
import net.sf.openrocket.util.MathUtil;
|
import net.sf.openrocket.util.MathUtil;
|
||||||
|
|
||||||
public class FinSetSaver extends ExternalComponentSaver {
|
public class FinSetSaver extends ExternalComponentSaver {
|
||||||
@ -28,6 +30,22 @@ public class FinSetSaver extends ExternalComponentSaver {
|
|||||||
|
|
||||||
elements.add("<tabheight>" + fins.getTabHeight() + "</tabheight>");
|
elements.add("<tabheight>" + fins.getTabHeight() + "</tabheight>");
|
||||||
elements.add("<tablength>" + fins.getTabLength() + "</tablength>");
|
elements.add("<tablength>" + fins.getTabLength() + "</tablength>");
|
||||||
|
// TODO: delete this when no backward compatibility with OR 15.03 is needed anymore
|
||||||
|
String offset = "center";
|
||||||
|
double offsetVal = fins.getTabOffset();
|
||||||
|
switch (fins.getTabOffsetMethod()) {
|
||||||
|
case TOP:
|
||||||
|
offset = "front";
|
||||||
|
break;
|
||||||
|
case BOTTOM:
|
||||||
|
offset = "end";
|
||||||
|
break;
|
||||||
|
case MIDDLE:
|
||||||
|
offset = "center";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
elements.add("<tabposition relativeto=\"" + offset + "\">" +
|
||||||
|
offsetVal + "</tabposition>");
|
||||||
elements.add("<tabposition relativeto=\"" +
|
elements.add("<tabposition relativeto=\"" +
|
||||||
fins.getTabOffsetMethod().name().toLowerCase(Locale.ENGLISH) + "\">" +
|
fins.getTabOffsetMethod().name().toLowerCase(Locale.ENGLISH) + "\">" +
|
||||||
fins.getTabOffset() + "</tabposition>");
|
fins.getTabOffset() + "</tabposition>");
|
||||||
|
@ -83,6 +83,10 @@ public class RocketComponentSaver {
|
|||||||
// no-op. Instance counts are set via named cluster configurations
|
// no-op. Instance counts are set via named cluster configurations
|
||||||
} else {
|
} else {
|
||||||
emitInteger(elements, "instancecount", c.getInstanceCount());
|
emitInteger(elements, "instancecount", c.getInstanceCount());
|
||||||
|
// TODO: delete this when no backward compatibility with OR 15.03 is needed anymore
|
||||||
|
if (c instanceof FinSet || c instanceof TubeFinSet) {
|
||||||
|
emitInteger(elements, "fincount", c.getInstanceCount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c instanceof LineInstanceable) {
|
if (c instanceof LineInstanceable) {
|
||||||
@ -103,6 +107,13 @@ public class RocketComponentSaver {
|
|||||||
final String angleMethod = anglePos.getAngleMethod().name().toLowerCase(Locale.ENGLISH);
|
final String angleMethod = anglePos.getAngleMethod().name().toLowerCase(Locale.ENGLISH);
|
||||||
final double angleOffset = anglePos.getAngleOffset()*180.0/Math.PI;
|
final double angleOffset = anglePos.getAngleOffset()*180.0/Math.PI;
|
||||||
elements.add("<angleoffset method=\"" + angleMethod + "\">" + angleOffset + "</angleoffset>");
|
elements.add("<angleoffset method=\"" + angleMethod + "\">" + angleOffset + "</angleoffset>");
|
||||||
|
// TODO: delete this when no backward compatibility with OR 15.03 is needed anymore
|
||||||
|
if (c instanceof FinSet || c instanceof TubeFinSet) {
|
||||||
|
elements.add("<rotation>" + angleOffset + "</rotation>");
|
||||||
|
}
|
||||||
|
else if (!(c instanceof RailButton)) {
|
||||||
|
elements.add("<radialdirection>" + angleOffset + "</radialdirection>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save position unless "AFTER"
|
// Save position unless "AFTER"
|
||||||
@ -110,6 +121,8 @@ public class RocketComponentSaver {
|
|||||||
// The type names are currently equivalent to the enum names except for case.
|
// The type names are currently equivalent to the enum names except for case.
|
||||||
String axialMethod = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH);
|
String axialMethod = c.getAxialMethod().name().toLowerCase(Locale.ENGLISH);
|
||||||
elements.add("<axialoffset method=\"" + axialMethod + "\">" + c.getAxialOffset() + "</axialoffset>");
|
elements.add("<axialoffset method=\"" + axialMethod + "\">" + c.getAxialOffset() + "</axialoffset>");
|
||||||
|
// TODO: delete this when no backward compatibility with OR 15.03 is needed anymore
|
||||||
|
elements.add("<position type=\"" + axialMethod + "\">" + c.getAxialOffset() + "</position>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
|
Loading…
x
Reference in New Issue
Block a user