Added optional Thickness element/property.
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Thu, 26 Apr 2012 18:18:35 +0000 (18:18 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Thu, 26 Apr 2012 18:18:35 +0000 (18:18 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@617 180e2498-e6e9-4542-8430-84ac67f01cd8

core/src/net/sf/openrocket/preset/xml/NoseConeDTO.java

index dcab26f24e5a1ad5af21931828f88ceb41dba1af..41368db630b5b5b48d806d4a6e3294e28c50f5ba 100644 (file)
@@ -27,6 +27,9 @@ public class NoseConeDTO extends BaseComponentDTO {
     @XmlElement(name = "Length")
     private double length;
 
+    @XmlElement(name = "Thickness")
+    private Double thickness;
+    
     /**
      * Default constructor.
      */
@@ -46,6 +49,9 @@ public class NoseConeDTO extends BaseComponentDTO {
         setOutsideDiameter(thePreset.get(ComponentPreset.AFT_OUTER_DIAMETER));
         setShoulderDiameter(thePreset.get(ComponentPreset.AFT_SHOULDER_DIAMETER));
         setLength(thePreset.get(ComponentPreset.LENGTH));
+        if ( thePreset.has(ComponentPreset.THICKNESS)) {
+               setThickness(thePreset.get(ComponentPreset.THICKNESS));
+        }
     }
 
     public ShapeDTO getShape() {
@@ -80,7 +86,15 @@ public class NoseConeDTO extends BaseComponentDTO {
         length = theLength;
     }
 
-    public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
+    public Double getThickness() {
+               return thickness;
+       }
+
+       public void setThickness(Double thickness) {
+               this.thickness = thickness;
+       }
+
+       public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
         TypedPropertyMap props = new TypedPropertyMap();
         addProps(props, materials);
         props.put(ComponentPreset.SHAPE, shape.getORShape());
@@ -88,6 +102,9 @@ public class NoseConeDTO extends BaseComponentDTO {
         props.put(ComponentPreset.AFT_SHOULDER_DIAMETER, this.getOutsideDiameter());
         props.put(ComponentPreset.LENGTH, this.getLength());
         props.put(ComponentPreset.TYPE, ComponentPreset.Type.NOSE_CONE);
+        if ( thickness != null ) {
+               props.put(ComponentPreset.THICKNESS, thickness);
+        }
 
         return ComponentPresetFactory.create(props);
     }