create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / file / rocksim / export / CenteringRingDTO.java
1 package net.sf.openrocket.file.rocksim.export;
2
3 import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
4 import net.sf.openrocket.rocketcomponent.RadiusRingComponent;
5 import net.sf.openrocket.rocketcomponent.ThicknessRingComponent;
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 import javax.xml.bind.annotation.XmlTransient;
12
13 /**
14  * Centering ring conversion from OR to Rocksim.
15  */
16 @XmlRootElement(name = RocksimCommonConstants.RING)
17 @XmlAccessorType(XmlAccessType.FIELD)
18 public class CenteringRingDTO extends BasePartDTO {
19
20     @XmlTransient
21     protected enum UsageCode {
22         //UsageCode
23         CenteringRing(0),
24         Bulkhead(1),
25         EngineBlock(2),
26         Sleeve(3),
27         TubeCoupler(4);
28
29         int ordinal;
30
31         UsageCode(int x) {
32             ordinal = x;
33         }
34     }
35
36     @XmlElement(name = RocksimCommonConstants.OD)
37     private double od = 0d;
38     @XmlElement(name = RocksimCommonConstants.ID)
39     private double id = 0d;
40     @XmlElement(name = RocksimCommonConstants.USAGE_CODE)
41     private int usageCode = UsageCode.CenteringRing.ordinal;
42     @XmlElement(name = RocksimCommonConstants.AUTO_SIZE)
43     private int autoSize = 0;
44
45     /**
46      * Default Constructor.
47      */
48     public CenteringRingDTO() {
49     }
50
51     /**
52      * Copy constructor.
53      *
54      * @param theORRadiusRing
55      */
56     public CenteringRingDTO(RadiusRingComponent theORRadiusRing) {
57         super(theORRadiusRing);
58         setId(theORRadiusRing.getInnerRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
59         setOd(theORRadiusRing.getOuterRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
60     }
61
62     /**
63      * Copy constructor.
64      *
65      * @param theORThicknessRing
66      */
67     public CenteringRingDTO(ThicknessRingComponent theORThicknessRing) {
68         super(theORThicknessRing);
69         setId(theORThicknessRing.getInnerRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
70         setOd(theORThicknessRing.getOuterRadius()* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_RADIUS);
71     }
72
73     public double getOd() {
74         return od;
75     }
76
77     public void setOd(double theOd) {
78         od = theOd;
79     }
80
81     public double getId() {
82         return id;
83     }
84
85     public void setId(double theId) {
86         id = theId;
87     }
88
89     public int getUsageCode() {
90         return usageCode;
91     }
92
93     public void setUsageCode(int theUsageCode) {
94         usageCode = theUsageCode;
95     }
96
97     public void setUsageCode(UsageCode theUsageCode) {
98         usageCode = theUsageCode.ordinal;
99     }
100
101     public int getAutoSize() {
102         return autoSize;
103     }
104
105     public void setAutoSize(int theAutoSize) {
106         autoSize = theAutoSize;
107     }
108
109 }