Merge pull request #1095 from SiboVG/issue-1090
[fixes #1090] Wrong FinSet tab position upon file opening
This commit is contained in:
commit
d459ba4bd8
@ -62,6 +62,10 @@ class FinSetPointHandler extends AbstractElementHandler {
|
|||||||
public void endHandler(String element, HashMap<String, String> attributes,
|
public void endHandler(String element, HashMap<String, String> attributes,
|
||||||
String content, WarningSet warnings) {
|
String content, WarningSet warnings) {
|
||||||
finset.setPoints(coordinates.toArray(new Coordinate[0]));
|
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
|
||||||
|
// <tabposition> tag comes before the <finpoints> 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,8 +5,6 @@ import java.util.*;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
import net.sf.openrocket.appearance.Appearance;
|
|
||||||
import net.sf.openrocket.appearance.Decal;
|
|
||||||
import net.sf.openrocket.util.*;
|
import net.sf.openrocket.util.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -103,7 +101,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
private static final double minimumTabArea = 1e-8;
|
private static final double minimumTabArea = 1e-8;
|
||||||
private double tabHeight = 0;
|
private double tabHeight = 0;
|
||||||
private double tabLength = 0.05;
|
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 double tabPosition = 0.0;
|
||||||
private AxialMethod tabOffsetMethod = AxialMethod.MIDDLE;
|
private AxialMethod tabOffsetMethod = AxialMethod.MIDDLE;
|
||||||
private double tabOffset = 0.;
|
private double tabOffset = 0.;
|
||||||
@ -291,12 +289,12 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
|
|
||||||
tabLength = lengthRequest;
|
tabLength = lengthRequest;
|
||||||
|
|
||||||
setTabPosition();
|
updateTabPosition();
|
||||||
|
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setTabPosition(){
|
public void updateTabPosition(){
|
||||||
this.tabPosition = this.tabOffsetMethod.getAsPosition(tabOffset, tabLength, length);
|
this.tabPosition = this.tabOffsetMethod.getAsPosition(tabOffset, tabLength, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +305,7 @@ public abstract class FinSet extends ExternalComponent implements AxialPositiona
|
|||||||
*/
|
*/
|
||||||
public void setTabOffset( final double offsetRequest) {
|
public void setTabOffset( final double offsetRequest) {
|
||||||
tabOffset = offsetRequest;
|
tabOffset = offsetRequest;
|
||||||
setTabPosition();
|
updateTabPosition();
|
||||||
|
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class TrapezoidFinSet extends FinSet {
|
|||||||
if (length == r)
|
if (length == r)
|
||||||
return;
|
return;
|
||||||
length = Math.max(r, 0);
|
length = Math.max(r, 0);
|
||||||
setTabPosition();
|
updateTabPosition();
|
||||||
|
|
||||||
fireComponentChangeEvent(ComponentChangeEvent.AEROMASS_CHANGE);
|
fireComponentChangeEvent(ComponentChangeEvent.AEROMASS_CHANGE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user