Initial XML generating code for .orc format.
[debian/openrocket] / core / src / net / sf / openrocket / preset / xml / TransitionDTO.java
1
2 package net.sf.openrocket.preset.xml;
3
4 import net.sf.openrocket.preset.ComponentPreset;
5
6 import javax.xml.bind.annotation.XmlAccessType;
7 import javax.xml.bind.annotation.XmlAccessorType;
8 import javax.xml.bind.annotation.XmlElement;
9 import javax.xml.bind.annotation.XmlRootElement;
10
11 /**
12  * Transition preset XML handler.
13  */
14 @XmlRootElement(name = "Transition")
15 @XmlAccessorType(XmlAccessType.FIELD)
16 public class TransitionDTO extends BaseComponentDTO {
17
18     @XmlElement(name = "Shape")
19     private ShapeDTO shape;
20
21     @XmlElement(name = "ForeOutsideDiameter")
22     private double foreOutsideDiameter;
23     @XmlElement(name = "ForeShoulderDiameter")
24     private double foreShoulderDiameter;
25     @XmlElement(name = "ForeShoulderLength")
26     private double foreShoulderLength;
27
28     @XmlElement(name = "AftOutsideDiameter")
29     private double aftOutsideDiameter;
30     @XmlElement(name = "AftShoulderDiameter")
31     private double aftShoulderDiameter;
32     @XmlElement(name = "AftShoulderLength")
33     private double aftShoulderLength;
34
35     @XmlElement(name = "Length")
36     private double length;
37
38
39     /**
40      * Default constructor.
41      */
42     public TransitionDTO() {
43     }
44
45     /**
46      * Most-useful constructor that maps a Transition preset to a TransitionDTO.
47      *
48      * @param thePreset  the preset
49      *
50      * @throws net.sf.openrocket.util.BugException thrown if the expected transition keys are not in the preset
51      */
52     public TransitionDTO(final ComponentPreset thePreset) {
53         super(thePreset);
54         setShape(ShapeDTO.asDTO(thePreset.get(ComponentPreset.SHAPE)));
55         setForeOutsideDiameter(thePreset.get(ComponentPreset.FORE_OUTER_DIAMETER));
56         setForeShoulderDiameter(thePreset.get(ComponentPreset.FORE_SHOULDER_DIAMETER));
57         setForeShoulderLength(thePreset.get(ComponentPreset.FORE_SHOULDER_LENGTH));
58         setAftOutsideDiameter(thePreset.get(ComponentPreset.AFT_OUTER_DIAMETER));
59         setAftShoulderDiameter(thePreset.get(ComponentPreset.AFT_SHOULDER_DIAMETER));
60         setAftShoulderLength(thePreset.get(ComponentPreset.AFT_SHOULDER_LENGTH));
61         setLength(thePreset.get(ComponentPreset.LENGTH));
62     }
63
64     public ShapeDTO getShape() {
65         return shape;
66     }
67
68     public void setShape(final ShapeDTO theShape) {
69         shape = theShape;
70     }
71
72     public double getForeOutsideDiameter() {
73         return foreOutsideDiameter;
74     }
75
76     public void setForeOutsideDiameter(final double theForeOutsideDiameter) {
77         foreOutsideDiameter = theForeOutsideDiameter;
78     }
79
80     public double getForeShoulderDiameter() {
81         return foreShoulderDiameter;
82     }
83
84     public void setForeShoulderDiameter(final double theForeShoulderDiameter) {
85         foreShoulderDiameter = theForeShoulderDiameter;
86     }
87
88     public double getForeShoulderLength() {
89         return foreShoulderLength;
90     }
91
92     public void setForeShoulderLength(final double theForeShoulderLength) {
93         foreShoulderLength = theForeShoulderLength;
94     }
95
96     public double getAftOutsideDiameter() {
97         return aftOutsideDiameter;
98     }
99
100     public void setAftOutsideDiameter(final double theAftOutsideDiameter) {
101         aftOutsideDiameter = theAftOutsideDiameter;
102     }
103
104     public double getAftShoulderDiameter() {
105         return aftShoulderDiameter;
106     }
107
108     public void setAftShoulderDiameter(final double theAftShoulderDiameter) {
109         aftShoulderDiameter = theAftShoulderDiameter;
110     }
111
112     public double getAftShoulderLength() {
113         return aftShoulderLength;
114     }
115
116     public void setAftShoulderLength(final double theAftShoulderLength) {
117         aftShoulderLength = theAftShoulderLength;
118     }
119
120     public double getLength() {
121         return length;
122     }
123
124     public void setLength(final double theLength) {
125         length = theLength;
126     }
127 }