DGP - changes to relative position; custom fin set points
[debian/openrocket] / core / src / net / sf / openrocket / file / rocksim / export / FinSetDTO.java
1 package net.sf.openrocket.file.rocksim.export;
2
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;
9
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;
14
15 /**
16  */
17 @XmlRootElement(name = "FinSet")
18 @XmlAccessorType(XmlAccessType.FIELD)
19 public class FinSetDTO extends BasePartDTO {
20
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;
47
48     public FinSetDTO() {
49     }
50
51     public FinSetDTO(FinSet ec) {
52         super(ec);
53
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);
60
61         setRadialAngle(ec.getBaseRotation());
62         setTipShapeCode(TipShapeCode.convertTipShapeCode(ec.getCrossSection()));
63         if (ec instanceof TrapezoidFinSet) {
64             TrapezoidFinSet tfs = (TrapezoidFinSet) ec;
65             setShapeCode(0);
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);
70         }
71         else if (ec instanceof EllipticalFinSet) {
72             EllipticalFinSet efs = (EllipticalFinSet) ec;
73             setShapeCode(1);
74             setRootChord(ec.getLength() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
75             setSemiSpan(efs.getHeight() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
76         }
77         else if (ec instanceof FreeformFinSet) {
78             setShapeCode(2);
79         }
80     }
81
82     public int getFinCount() {
83         return finCount;
84     }
85
86     public void setFinCount(int theFinCount) {
87         finCount = theFinCount;
88     }
89
90     public double getRootChord() {
91         return rootChord;
92     }
93
94     public void setRootChord(double theRootChord) {
95         rootChord = theRootChord;
96     }
97
98     public double getTipChord() {
99         return tipChord;
100     }
101
102     public void setTipChord(double theTipChord) {
103         tipChord = theTipChord;
104     }
105
106     public double getSemiSpan() {
107         return semiSpan;
108     }
109
110     public void setSemiSpan(double theSemiSpan) {
111         semiSpan = theSemiSpan;
112     }
113
114     public double getSweepDistance() {
115         return sweepDistance;
116     }
117
118     public void setSweepDistance(double theSweepDistance) {
119         sweepDistance = theSweepDistance;
120     }
121
122     public double getThickness() {
123         return thickness;
124     }
125
126     public void setThickness(double theThickness) {
127         thickness = theThickness;
128     }
129
130     public int getShapeCode() {
131         return shapeCode;
132     }
133
134     public void setShapeCode(int theShapeCode) {
135         shapeCode = theShapeCode;
136     }
137
138     public int getTipShapeCode() {
139         return tipShapeCode;
140     }
141
142     public void setTipShapeCode(int theTipShapeCode) {
143         tipShapeCode = theTipShapeCode;
144     }
145
146     public double getTabLength() {
147         return tabLength;
148     }
149
150     public void setTabLength(double theTabLength) {
151         tabLength = theTabLength;
152     }
153
154     public double getTabDepth() {
155         return tabDepth;
156     }
157
158     public void setTabDepth(double theTabDepth) {
159         tabDepth = theTabDepth;
160     }
161
162     public double getTabOffset() {
163         return tabOffset;
164     }
165
166     public void setTabOffset(double theTabOffset) {
167         tabOffset = theTabOffset;
168     }
169
170     public int getSweepMode() {
171         return sweepMode;
172     }
173
174     public void setSweepMode(int theSweepMode) {
175         sweepMode = theSweepMode;
176     }
177
178     public double getCantAngle() {
179         return cantAngle;
180     }
181
182     public void setCantAngle(double theCantAngle) {
183         cantAngle = theCantAngle;
184     }
185 }