1 package net.sf.openrocket.file.rocksim.export;
3 import net.sf.openrocket.file.TipShapeCode;
4 import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
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;
16 * This class models XML elements for Rocksim finsets.
18 @XmlRootElement(name = RocksimCommonConstants.FIN_SET)
19 @XmlAccessorType(XmlAccessType.FIELD)
20 public class FinSetDTO extends BasePartDTO {
22 @XmlElement(name = RocksimCommonConstants.FIN_COUNT)
23 private int finCount = 0;
24 @XmlElement(name = RocksimCommonConstants.ROOT_CHORD)
25 private double rootChord = 0d;
26 @XmlElement(name = RocksimCommonConstants.TIP_CHORD)
27 private double tipChord = 0d;
28 @XmlElement(name = RocksimCommonConstants.SEMI_SPAN)
29 private double semiSpan = 0d;
30 @XmlElement(name = RocksimCommonConstants.SWEEP_DISTANCE)
31 private double sweepDistance = 0d;
32 @XmlElement(name = RocksimCommonConstants.THICKNESS)
33 private double thickness = 0d;
34 @XmlElement(name = RocksimCommonConstants.SHAPE_CODE)
35 private int shapeCode = 0;
36 @XmlElement(name = RocksimCommonConstants.TIP_SHAPE_CODE)
37 private int tipShapeCode = 0;
38 @XmlElement(name = RocksimCommonConstants.TAB_LENGTH)
39 private double tabLength = 0d;
40 @XmlElement(name = RocksimCommonConstants.TAB_DEPTH)
41 private double tabDepth = 0d;
42 @XmlElement(name = RocksimCommonConstants.TAB_OFFSET)
43 private double tabOffset = 0d;
44 @XmlElement(name = RocksimCommonConstants.SWEEP_MODE)
45 private int sweepMode = 1;
46 @XmlElement(name = RocksimCommonConstants.CANT_ANGLE)
47 private double cantAngle = 0d;
56 * Full copy constructor.
58 * @param theORFinSet the OpenRocket finset
60 public FinSetDTO(FinSet theORFinSet) {
63 setFinCount(theORFinSet.getFinCount());
64 setCantAngle(theORFinSet.getCantAngle());
65 setTabDepth(theORFinSet.getTabHeight() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
66 setTabLength(theORFinSet.getTabLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
67 setTabOffset(theORFinSet.getTabShift() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
68 setThickness(theORFinSet.getThickness() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
70 setRadialAngle(theORFinSet.getBaseRotation());
71 setTipShapeCode(TipShapeCode.convertTipShapeCode(theORFinSet.getCrossSection()));
72 if (theORFinSet instanceof TrapezoidFinSet) {
73 TrapezoidFinSet tfs = (TrapezoidFinSet) theORFinSet;
75 setRootChord(theORFinSet.getLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
76 setSemiSpan(tfs.getHeight() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
77 setTipChord(tfs.getTipChord() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
78 setSweepDistance(tfs.getSweep() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
80 else if (theORFinSet instanceof EllipticalFinSet) {
81 EllipticalFinSet efs = (EllipticalFinSet) theORFinSet;
83 setRootChord(theORFinSet.getLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
84 setSemiSpan(efs.getHeight() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
86 else if (theORFinSet instanceof FreeformFinSet) {
91 public int getFinCount() {
95 public void setFinCount(int theFinCount) {
96 finCount = theFinCount;
99 public double getRootChord() {
103 public void setRootChord(double theRootChord) {
104 rootChord = theRootChord;
107 public double getTipChord() {
111 public void setTipChord(double theTipChord) {
112 tipChord = theTipChord;
115 public double getSemiSpan() {
119 public void setSemiSpan(double theSemiSpan) {
120 semiSpan = theSemiSpan;
123 public double getSweepDistance() {
124 return sweepDistance;
127 public void setSweepDistance(double theSweepDistance) {
128 sweepDistance = theSweepDistance;
131 public double getThickness() {
135 public void setThickness(double theThickness) {
136 thickness = theThickness;
139 public int getShapeCode() {
143 public void setShapeCode(int theShapeCode) {
144 shapeCode = theShapeCode;
147 public int getTipShapeCode() {
151 public void setTipShapeCode(int theTipShapeCode) {
152 tipShapeCode = theTipShapeCode;
155 public double getTabLength() {
159 public void setTabLength(double theTabLength) {
160 tabLength = theTabLength;
163 public double getTabDepth() {
167 public void setTabDepth(double theTabDepth) {
168 tabDepth = theTabDepth;
171 public double getTabOffset() {
175 public void setTabOffset(double theTabOffset) {
176 tabOffset = theTabOffset;
179 public int getSweepMode() {
183 public void setSweepMode(int theSweepMode) {
184 sweepMode = theSweepMode;
187 public double getCantAngle() {
191 public void setCantAngle(double theCantAngle) {
192 cantAngle = theCantAngle;