Merged l10n branch to trunk
[debian/openrocket] / src / net / sf / openrocket / rocketcomponent / LaunchLug.java
index f61ce7ed6bb2275ea0961b48b119da1b7f45aad1..8a6b2751da247f3136f99fcf76714b716500884e 100644 (file)
@@ -16,13 +16,13 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
 
        private double radius;
        private double thickness;
-       
+
        private double radialDirection = 0;
-       
+
        /* These are calculated when the component is first attached to any Rocket */
        private double shiftY, shiftZ;
-       
-       
+
+
 
        public LaunchLug() {
                super(Position.MIDDLE);
@@ -30,12 +30,12 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                thickness = 0.001;
                length = 0.03;
        }
-       
-       
+
+
        public double getOuterRadius () {
                return radius;
        }
-       
+
        public void setOuterRadius (double radius) {
                if (MathUtil.equals(this.radius, radius))
                        return;
@@ -43,31 +43,31 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                this.thickness = Math.min(this.thickness, this.radius);
                fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
        }
-       
+
        public double getInnerRadius() {
                return radius - thickness;
        }
-       
+
        public void setInnerRadius(double innerRadius) {
                setOuterRadius(innerRadius + thickness);
        }
-       
+
        public double getThickness() {
                return thickness;
        }
-       
+
        public void setThickness(double thickness) {
                if (MathUtil.equals(this.thickness, thickness))
                        return;
                this.thickness = MathUtil.clamp(thickness, 0, radius);
                fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
        }
-       
-       
+
+
        public double getRadialDirection() {
                return radialDirection;
        }
-       
+
        public void setRadialDirection(double direction) {
                direction = MathUtil.reduce180(direction);
                if (MathUtil.equals(this.radialDirection, direction))
@@ -75,8 +75,8 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                this.radialDirection = direction;
                fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
        }
-       
-       
+
+
 
        public void setLength(double length) {
                if (MathUtil.equals(this.length, length))
@@ -84,8 +84,8 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                this.length = length;
                fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
        }
-       
-       
+
+
 
 
 
@@ -94,44 +94,44 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                super.setRelativePosition(position);
                fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
        }
-       
-       
+
+
        @Override
        public void setPositionValue(double value) {
                super.setPositionValue(value);
                fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
        }
-       
-       
+
+
 
        @Override
        public Coordinate[] shiftCoordinates(Coordinate[] array) {
                array = super.shiftCoordinates(array);
-               
+
                for (int i = 0; i < array.length; i++) {
                        array[i] = array[i].add(0, shiftY, shiftZ);
                }
-               
+
                return array;
        }
-       
-       
+
+
        @Override
        public void componentChanged(ComponentChangeEvent e) {
                super.componentChanged(e);
-               
-               /* 
+
+               /*
                 * shiftY and shiftZ must be computed here since calculating them
                 * in shiftCoordinates() would cause an infinite loop due to .toRelative
                 */
                RocketComponent body;
                double parentRadius;
-               
+
                for (body = this.getParent(); body != null; body = body.getParent()) {
                        if (body instanceof SymmetricComponent)
                                break;
                }
-               
+
                if (body == null) {
                        parentRadius = 0;
                } else {
@@ -143,21 +143,21 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                        x2 = MathUtil.clamp(x2, 0, body.getLength());
                        parentRadius = Math.max(s.getRadius(x1), s.getRadius(x2));
                }
-               
+
                shiftY = Math.cos(radialDirection) * (parentRadius + radius);
                shiftZ = Math.sin(radialDirection) * (parentRadius + radius);
-               
+
                //              System.out.println("Computed shift: y="+shiftY+" z="+shiftZ);
        }
-       
-       
+
+
 
 
        @Override
        public double getComponentVolume() {
                return length * Math.PI * (MathUtil.pow2(radius) - MathUtil.pow2(radius - thickness));
        }
-       
+
        @Override
        public Collection<Coordinate> getComponentBounds() {
                ArrayList<Coordinate> set = new ArrayList<Coordinate>();
@@ -165,50 +165,40 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
                addBound(set, length, radius);
                return set;
        }
-       
+
        @Override
        public Coordinate getComponentCG() {
                return new Coordinate(length / 2, 0, 0, getComponentMass());
        }
-       
+
        @Override
        public String getComponentName() {
                //// Launch lug
                return trans.get("LaunchLug.Launchlug");
        }
-       
+
        @Override
        public double getLongitudinalUnitInertia() {
                // 1/12 * (3 * (r1^2 + r2^2) + h^2)
                return (3 * (MathUtil.pow2(getInnerRadius())) + MathUtil.pow2(getOuterRadius()) +
                                MathUtil.pow2(getLength())) / 12;
        }
-       
+
        @Override
        public double getRotationalUnitInertia() {
                // 1/2 * (r1^2 + r2^2)
                return (MathUtil.pow2(getInnerRadius()) + MathUtil.pow2(getOuterRadius()))/2;
        }
-       
+
        @Override
        public boolean allowsChildren() {
                return false;
        }
-       
+
        @Override
        public boolean isCompatible(Class<? extends RocketComponent> type) {
                // Allow nothing to be attached to a LaunchLug
                return false;
        }
-       
-    /**
-     * Accept a visitor to this LaunchLug in the component hierarchy.
-     * 
-     * @param theVisitor  the visitor that will be called back with a reference to this LaunchLug
-     */    
-    @Override 
-    public void accept (final ComponentVisitor theVisitor) {
-        theVisitor.visit(this);
-    }
-    
+
 }