Added optional Thickness element/property.

This commit is contained in:
Kevin Ruland 2012-04-26 18:18:35 +00:00
parent 85fe891980
commit c71049a88d

View File

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