From 9025171a28342d2d9d965cbde51bc27ed55faf7c Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Sat, 29 Jan 2022 19:04:42 +0100 Subject: [PATCH 1/5] Remove redundant imports --- core/src/net/sf/openrocket/rocketcomponent/FinSet.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index d23625e88..5d46927bb 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -5,8 +5,6 @@ import java.util.*; import java.util.ArrayList; -import net.sf.openrocket.appearance.Appearance; -import net.sf.openrocket.appearance.Decal; import net.sf.openrocket.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From f06ad1ec357992ed8ec2db747017476188b40855 Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Sat, 29 Jan 2022 19:05:30 +0100 Subject: [PATCH 2/5] [fixes #1090] Rename setTabPosition It's more of an update-function instead of a set --- core/src/net/sf/openrocket/rocketcomponent/FinSet.java | 8 ++++---- .../sf/openrocket/rocketcomponent/TrapezoidFinSet.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index 5d46927bb..6095cb014 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -289,12 +289,12 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona tabLength = lengthRequest; - setTabPosition(); + updateTabPosition(); fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); } - - protected void setTabPosition(){ + + protected void updateTabPosition(){ this.tabPosition = this.tabOffsetMethod.getAsPosition(tabOffset, tabLength, length); } @@ -305,7 +305,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona */ public void setTabOffset( final double offsetRequest) { tabOffset = offsetRequest; - setTabPosition(); + updateTabPosition(); fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); } diff --git a/core/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java b/core/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java index 34b29525b..e03951405 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/TrapezoidFinSet.java @@ -77,7 +77,7 @@ public class TrapezoidFinSet extends FinSet { if (length == r) return; length = Math.max(r, 0); - setTabPosition(); + updateTabPosition(); fireComponentChangeEvent(ComponentChangeEvent.AEROMASS_CHANGE); } From dc6c5d8c4a4bdff0b2bb252a008ab14908668870 Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Sat, 29 Jan 2022 19:07:06 +0100 Subject: [PATCH 3/5] [fixes #1090] Make updateTabPosition public We will need this in the next commit --- core/src/net/sf/openrocket/rocketcomponent/FinSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index 6095cb014..15b6a8b07 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -294,7 +294,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE); } - protected void updateTabPosition(){ + public void updateTabPosition(){ this.tabPosition = this.tabOffsetMethod.getAsPosition(tabOffset, tabLength, length); } From 36ff302586e9835bbd176d3ffb6c7ae24e60e93c Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Sat, 29 Jan 2022 19:10:38 +0100 Subject: [PATCH 4/5] [fixes #1090] Update tabPosition after FinSetPoint loading --- .../file/openrocket/importt/FinSetPointHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/file/openrocket/importt/FinSetPointHandler.java b/core/src/net/sf/openrocket/file/openrocket/importt/FinSetPointHandler.java index 50dd7f10d..05f3386e2 100644 --- a/core/src/net/sf/openrocket/file/openrocket/importt/FinSetPointHandler.java +++ b/core/src/net/sf/openrocket/file/openrocket/importt/FinSetPointHandler.java @@ -62,6 +62,10 @@ class FinSetPointHandler extends AbstractElementHandler { public void endHandler(String element, HashMap attributes, String content, WarningSet warnings) { finset.setPoints(coordinates.toArray(new Coordinate[0])); - + // Update the tab position. This is because the tab position relies on the finset length, but because the + // tag comes before the tag in the .ork file, the tab position will be set first, + // using the default finset length, not the intended finset length that we extract in this part. So we update + // the tab position here to cope for the wrongly calculated tab position earlier. + finset.updateTabPosition(); } } \ No newline at end of file From cf0af1d59cf0618c2a0e4cf4997f7c94e7f97fd7 Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Sat, 29 Jan 2022 19:16:26 +0100 Subject: [PATCH 5/5] Fix small typo --- core/src/net/sf/openrocket/rocketcomponent/FinSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java index 15b6a8b07..57f3156d1 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FinSet.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FinSet.java @@ -101,7 +101,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona private static final double minimumTabArea = 1e-8; private double tabHeight = 0; private double tabLength = 0.05; - // this is always measured from the the root-lead point. + // this is always measured from the root-lead point. private double tabPosition = 0.0; private AxialMethod tabOffsetMethod = AxialMethod.MIDDLE; private double tabOffset = 0.;