1 package net.sf.openrocket.file.rocksim.export;
3 import net.sf.openrocket.file.rocksim.TipShapeCode;
4 import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
5 import net.sf.openrocket.rocketcomponent.EllipticalFinSet;
6 import net.sf.openrocket.rocketcomponent.FinSet;
7 import net.sf.openrocket.rocketcomponent.FreeformFinSet;
8 import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
10 import javax.xml.bind.annotation.XmlAccessType;
11 import javax.xml.bind.annotation.XmlAccessorType;
12 import javax.xml.bind.annotation.XmlElement;
13 import javax.xml.bind.annotation.XmlRootElement;
17 @XmlRootElement(name = "FinSet")
18 @XmlAccessorType(XmlAccessType.FIELD)
19 public class FinSetDTO extends BasePartDTO {
21 @XmlElement(name = "FinCount")
22 private int finCount = 0;
23 @XmlElement(name = "RootChord")
24 private double rootChord = 0d;
25 @XmlElement(name = "TipChord")
26 private double tipChord = 0d;
27 @XmlElement(name = "SemiSpan")
28 private double semiSpan = 0d;
29 @XmlElement(name = "SweepDistance")
30 private double sweepDistance = 0d;
31 @XmlElement(name = "Thickness")
32 private double thickness = 0d;
33 @XmlElement(name = "ShapeCode")
34 private int shapeCode = 0;
35 @XmlElement(name = "TipShapeCode")
36 private int tipShapeCode = 0;
37 @XmlElement(name = "TabLength")
38 private double tabLength = 0d;
39 @XmlElement(name = "TabDepth")
40 private double tabDepth = 0d;
41 @XmlElement(name = "TabOffset")
42 private double tabOffset = 0d;
43 @XmlElement(name = "SweepMode")
44 private int sweepMode = 1;
45 @XmlElement(name = "CantAngle")
46 private double cantAngle = 0d;
51 public FinSetDTO(FinSet ec) {
54 setFinCount(ec.getFinCount());
55 setCantAngle(ec.getCantAngle());
56 setTabDepth(ec.getTabHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
57 setTabLength(ec.getTabLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
58 setTabOffset(ec.getTabShift() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
59 setThickness(ec.getThickness() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
61 setRadialAngle(ec.getBaseRotation());
62 setTipShapeCode(TipShapeCode.convertTipShapeCode(ec.getCrossSection()));
63 if (ec instanceof TrapezoidFinSet) {
64 TrapezoidFinSet tfs = (TrapezoidFinSet) ec;
66 setRootChord(ec.getLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
67 setSemiSpan(tfs.getHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
68 setTipChord(tfs.getTipChord() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
69 setSweepDistance(tfs.getSweep() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
71 else if (ec instanceof EllipticalFinSet) {
72 EllipticalFinSet efs = (EllipticalFinSet) ec;
74 setRootChord(ec.getLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
75 setSemiSpan(efs.getHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
77 else if (ec instanceof FreeformFinSet) {
82 public int getFinCount() {
86 public void setFinCount(int theFinCount) {
87 finCount = theFinCount;
90 public double getRootChord() {
94 public void setRootChord(double theRootChord) {
95 rootChord = theRootChord;
98 public double getTipChord() {
102 public void setTipChord(double theTipChord) {
103 tipChord = theTipChord;
106 public double getSemiSpan() {
110 public void setSemiSpan(double theSemiSpan) {
111 semiSpan = theSemiSpan;
114 public double getSweepDistance() {
115 return sweepDistance;
118 public void setSweepDistance(double theSweepDistance) {
119 sweepDistance = theSweepDistance;
122 public double getThickness() {
126 public void setThickness(double theThickness) {
127 thickness = theThickness;
130 public int getShapeCode() {
134 public void setShapeCode(int theShapeCode) {
135 shapeCode = theShapeCode;
138 public int getTipShapeCode() {
142 public void setTipShapeCode(int theTipShapeCode) {
143 tipShapeCode = theTipShapeCode;
146 public double getTabLength() {
150 public void setTabLength(double theTabLength) {
151 tabLength = theTabLength;
154 public double getTabDepth() {
158 public void setTabDepth(double theTabDepth) {
159 tabDepth = theTabDepth;
162 public double getTabOffset() {
166 public void setTabOffset(double theTabOffset) {
167 tabOffset = theTabOffset;
170 public int getSweepMode() {
174 public void setSweepMode(int theSweepMode) {
175 sweepMode = theSweepMode;
178 public double getCantAngle() {
182 public void setCantAngle(double theCantAngle) {
183 cantAngle = theCantAngle;