Fix #907 by re-adding ABSOLUTE axial offset

This commit is contained in:
Neil Balch 2021-05-13 00:01:45 -07:00
parent c48c31c725
commit 93633a27c3

View File

@ -3,7 +3,7 @@ package net.sf.openrocket.rocketcomponent.position;
import net.sf.openrocket.startup.Application; import net.sf.openrocket.startup.Application;
public enum AxialMethod implements DistanceMethod { public enum AxialMethod implements DistanceMethod {
// subject component is simply located absolutely, from the origin (tip-of-rocket) // subject component is simply located absolutely, from the origin (tip-of-rocket)
ABSOLUTE (Application.getTranslator().get("RocketComponent.Position.Method.Axial.ABSOLUTE")){ ABSOLUTE (Application.getTranslator().get("RocketComponent.Position.Method.Axial.ABSOLUTE")){
@Override @Override
public boolean clampToZero() { return false; } public boolean clampToZero() { return false; }
@ -18,8 +18,8 @@ public enum AxialMethod implements DistanceMethod {
return position; return position;
} }
}, },
// subject component will trail the target component, in the increasing coordinate direction // subject component will trail the target component, in the increasing coordinate direction
AFTER (Application.getTranslator().get("RocketComponent.Position.Method.Axial.AFTER")){ AFTER (Application.getTranslator().get("RocketComponent.Position.Method.Axial.AFTER")){
@Override @Override
public boolean clampToZero() { return false; } public boolean clampToZero() { return false; }
@ -51,7 +51,7 @@ public enum AxialMethod implements DistanceMethod {
return position; return position;
} }
}, },
// This coordinate is measured from the middle of the parent component to the middle of this component // This coordinate is measured from the middle of the parent component to the middle of this component
MIDDLE (Application.getTranslator().get("RocketComponent.Position.Method.Axial.MIDDLE")) { MIDDLE (Application.getTranslator().get("RocketComponent.Position.Method.Axial.MIDDLE")) {
@Override @Override
@ -70,7 +70,7 @@ public enum AxialMethod implements DistanceMethod {
return position + (innerLength - outerLength) / 2; return position + (innerLength - outerLength) / 2;
} }
}, },
// This coordinate is measured from the bottom of the parent component to the bottom of this component // This coordinate is measured from the bottom of the parent component to the bottom of this component
BOTTOM (Application.getTranslator().get("RocketComponent.Position.Method.Axial.BOTTOM")){ BOTTOM (Application.getTranslator().get("RocketComponent.Position.Method.Axial.BOTTOM")){
@Override @Override
@ -94,15 +94,15 @@ public enum AxialMethod implements DistanceMethod {
// just as a reminder: // just as a reminder:
// public T[] getEnumConstants() // public T[] getEnumConstants()
public static final AxialMethod[] axialOffsetMethods = { TOP, MIDDLE, BOTTOM }; public static final AxialMethod[] axialOffsetMethods = { ABSOLUTE, TOP, MIDDLE, BOTTOM };
public final String description; public final String description;
AxialMethod( final String newDescription ) { AxialMethod( final String newDescription ) {
this.description=newDescription; this.description=newDescription;
} }
public abstract boolean clampToZero(); public abstract boolean clampToZero();
public abstract double getAsOffset(double position, double innerLength, double outerLength); public abstract double getAsOffset(double position, double innerLength, double outerLength);
@ -113,5 +113,5 @@ public enum AxialMethod implements DistanceMethod {
public String toString() { public String toString() {
return description; return description;
} }
} }