Initial XML generating code for .orc format.
[debian/openrocket] / core / src / net / sf / openrocket / preset / xml / NoseConeDTO.java
1 package net.sf.openrocket.preset.xml;
2
3 import net.sf.openrocket.preset.ComponentPreset;
4
5 import javax.xml.bind.annotation.XmlAccessType;
6 import javax.xml.bind.annotation.XmlAccessorType;
7 import javax.xml.bind.annotation.XmlElement;
8 import javax.xml.bind.annotation.XmlRootElement;
9
10 /**
11  * A NoseCone preset XML handler.
12  */
13 @XmlRootElement(name = "NoseCone")
14 @XmlAccessorType(XmlAccessType.FIELD)
15 public class NoseConeDTO extends BaseComponentDTO {
16
17     @XmlElement(name = "Shape")
18     private ShapeDTO shape;
19     @XmlElement(name = "OutsideDiameter")
20     private double outsideDiameter;
21     @XmlElement(name = "ShoulderDiameter")
22     private double shoulderDiameter;
23     @XmlElement(name = "Length")
24     private double length;
25
26     /**
27      * Default constructor.
28      */
29     public NoseConeDTO() {
30     }
31
32     /**
33      * Constructor that
34      *
35      * @param thePreset
36      *
37      * @throws net.sf.openrocket.util.BugException thrown if the expected body tube keys are not in the preset
38      */
39     public NoseConeDTO(final ComponentPreset thePreset) {
40         super(thePreset);
41         setShape(ShapeDTO.asDTO(thePreset.get(ComponentPreset.SHAPE)));
42         setOutsideDiameter(thePreset.get(ComponentPreset.AFT_OUTER_DIAMETER));
43         setShoulderDiameter(thePreset.get(ComponentPreset.AFT_SHOULDER_DIAMETER));
44         setLength(thePreset.get(ComponentPreset.LENGTH));
45     }
46
47     public ShapeDTO getShape() {
48         return shape;
49     }
50
51     public void setShape(final ShapeDTO theShape) {
52         shape = theShape;
53     }
54
55     public double getOutsideDiameter() {
56         return outsideDiameter;
57     }
58
59     public void setOutsideDiameter(final double theOutsideDiameter) {
60         outsideDiameter = theOutsideDiameter;
61     }
62
63     public double getShoulderDiameter() {
64         return shoulderDiameter;
65     }
66
67     public void setShoulderDiameter(final double theShoulderDiameter) {
68         shoulderDiameter = theShoulderDiameter;
69     }
70
71     public double getLength() {
72         return length;
73     }
74
75     public void setLength(final double theLength) {
76         length = theLength;
77     }
78 }