create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / file / rocksim / export / ParachuteDTO.java
1 package net.sf.openrocket.file.rocksim.export;
2
3 import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
4 import net.sf.openrocket.file.rocksim.importt.BaseHandler;
5 import net.sf.openrocket.rocketcomponent.Parachute;
6
7 import javax.xml.bind.annotation.XmlAccessType;
8 import javax.xml.bind.annotation.XmlAccessorType;
9 import javax.xml.bind.annotation.XmlElement;
10 import javax.xml.bind.annotation.XmlRootElement;
11
12 /**
13  */
14 @XmlRootElement(name = RocksimCommonConstants.PARACHUTE)
15 @XmlAccessorType(XmlAccessType.FIELD)
16 public class ParachuteDTO extends BasePartDTO {
17
18     @XmlElement(name = RocksimCommonConstants.DIAMETER)
19     private double dia = 0d;
20     @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_COUNT)
21     private int ShroudLineCount = 0;
22     @XmlElement(name = RocksimCommonConstants.THICKNESS)
23     private double thickness = 0d;
24     @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_LEN)
25     private double shroudLineLen = 0d;
26     @XmlElement(name = RocksimCommonConstants.CHUTE_COUNT)
27     private int chuteCount = 1;
28     @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_MASS_PER_MM)
29     private double shroudLineMassPerMM = 0d;
30     @XmlElement(name = RocksimCommonConstants.SHROUD_LINE_MATERIAL)
31     private String shroudLineMaterial = "";
32     @XmlElement(name = RocksimCommonConstants.DRAG_COEFFICIENT)
33     private double dragCoefficient = 0.75d;
34
35     /**
36      * Default constructor.
37      */
38     public ParachuteDTO() {
39     }
40
41     /**
42      * Copy constructor.  Fully populates this instance with values taken from the corresponding OR Parachute.
43      *
44      * @param theORParachute  the OR Parachute instance
45      */
46     public ParachuteDTO(Parachute theORParachute) {
47         super(theORParachute);
48         
49         setChuteCount(1);
50         setDia(theORParachute.getDiameter() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
51         setDragCoefficient(theORParachute.getCD());
52         setShroudLineCount(theORParachute.getLineCount());
53         setShroudLineLen(theORParachute.getLineLength() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
54
55         String material = theORParachute.getLineMaterial().getName();
56         setShroudLineMassPerMM(theORParachute.getLineMaterial().getDensity() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LINE_DENSITY);
57
58         if (material.startsWith(BaseHandler.ROCKSIM_MATERIAL_PREFIX)) {
59             material = material.substring(BaseHandler.ROCKSIM_MATERIAL_PREFIX.length());
60         }
61         setShroudLineMaterial(material);
62     }
63
64     public double getDia() {
65         return dia;
66     }
67
68     public void setDia(double theDia) {
69         dia = theDia;
70     }
71
72     public int getShroudLineCount() {
73         return ShroudLineCount;
74     }
75
76     public void setShroudLineCount(int theShroudLineCount) {
77         ShroudLineCount = theShroudLineCount;
78     }
79
80     public double getThickness() {
81         return thickness;
82     }
83
84     public void setThickness(double theThickness) {
85         thickness = theThickness;
86     }
87
88     public double getShroudLineLen() {
89         return shroudLineLen;
90     }
91
92     public void setShroudLineLen(double theShroudLineLen) {
93         shroudLineLen = theShroudLineLen;
94     }
95
96     public int getChuteCount() {
97         return chuteCount;
98     }
99
100     public void setChuteCount(int theChuteCount) {
101         chuteCount = theChuteCount;
102     }
103
104     public double getShroudLineMassPerMM() {
105         return shroudLineMassPerMM;
106     }
107
108     public void setShroudLineMassPerMM(double theShroudLineMassPerMM) {
109         shroudLineMassPerMM = theShroudLineMassPerMM;
110     }
111
112     public String getShroudLineMaterial() {
113         return shroudLineMaterial;
114     }
115
116     public void setShroudLineMaterial(String theShroudLineMaterial) {
117         shroudLineMaterial = theShroudLineMaterial;
118     }
119
120     public double getDragCoefficient() {
121         return dragCoefficient;
122     }
123
124     public void setDragCoefficient(double theDragCoefficient) {
125         dragCoefficient = theDragCoefficient;
126     }
127 }