Variety of changes to the orc file processing. Added unit annotations to all lengths and masses so a vendor can hand craft a file in units other than MKS system. Fixed a bug in the nose cone where the outerdiameter and shoulder diameter were flipped.
This commit is contained in:
parent
573706323f
commit
42c74f71a1
@ -1,19 +1,21 @@
|
||||
|
||||
package net.sf.openrocket.preset.xml;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
import net.sf.openrocket.database.Databases;
|
||||
import net.sf.openrocket.material.Material;
|
||||
import net.sf.openrocket.motor.Manufacturer;
|
||||
import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.preset.InvalidComponentPresetException;
|
||||
import net.sf.openrocket.preset.TypedPropertyMap;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
import java.util.List;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
|
||||
/**
|
||||
* Base class for the external representation of all component presets.
|
||||
@ -30,7 +32,7 @@ public abstract class BaseComponentDTO {
|
||||
@XmlElement(name = "Material")
|
||||
private AnnotatedMaterialDTO material;
|
||||
@XmlElement(name = "Mass")
|
||||
private Double mass;
|
||||
private AnnotatedMassDTO mass;
|
||||
@XmlElement(name="Filled")
|
||||
private Boolean filled;
|
||||
|
||||
@ -97,11 +99,15 @@ public abstract class BaseComponentDTO {
|
||||
}
|
||||
|
||||
public double getMass() {
|
||||
return mass;
|
||||
return mass.getValue();
|
||||
}
|
||||
|
||||
public void setMass(final AnnotatedMassDTO theMass) {
|
||||
mass = theMass;
|
||||
}
|
||||
|
||||
public void setMass(final double theMass) {
|
||||
mass = theMass;
|
||||
mass = new AnnotatedMassDTO(theMass);
|
||||
}
|
||||
|
||||
public Boolean getFilled() {
|
||||
@ -125,10 +131,10 @@ public abstract class BaseComponentDTO {
|
||||
props.put(ComponentPreset.MATERIAL, find(materialList, material));
|
||||
}
|
||||
if ( mass != null ) {
|
||||
props.put(ComponentPreset.MASS, mass);
|
||||
props.put(ComponentPreset.MASS, getMass());
|
||||
}
|
||||
if ( filled != null ) {
|
||||
props.put(ComponentPreset.FILLED, filled);
|
||||
props.put(ComponentPreset.FILLED, getFilled());
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,4 +162,38 @@ public abstract class BaseComponentDTO {
|
||||
material = theMaterial.getName();
|
||||
}
|
||||
}
|
||||
|
||||
static class AnnotatedLengthDTO {
|
||||
@XmlAttribute(name="Unit", required=false)
|
||||
private String unitName = "m";
|
||||
@XmlValue
|
||||
private double length;
|
||||
|
||||
AnnotatedLengthDTO() {}
|
||||
|
||||
AnnotatedLengthDTO( double length ) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return UnitGroup.UNITS_LENGTH.getUnit(unitName).fromUnit(length);
|
||||
}
|
||||
}
|
||||
|
||||
static class AnnotatedMassDTO {
|
||||
@XmlAttribute(name="Unit", required=false)
|
||||
private String unitName = "kg";
|
||||
@XmlValue
|
||||
private double mass;
|
||||
|
||||
AnnotatedMassDTO() {}
|
||||
|
||||
AnnotatedMassDTO( double mass ) {
|
||||
this.mass = mass;
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return UnitGroup.UNITS_MASS.getUnit(unitName).fromUnit(mass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ import java.util.List;
|
||||
public class BodyTubeDTO extends BaseComponentDTO {
|
||||
|
||||
@XmlElement(name = "InsideDiameter")
|
||||
private double insideDiameter;
|
||||
private AnnotatedLengthDTO insideDiameter;
|
||||
@XmlElement(name = "OutsideDiameter")
|
||||
private double outsideDiameter;
|
||||
private AnnotatedLengthDTO outsideDiameter;
|
||||
@XmlElement(name = "Length")
|
||||
private double length;
|
||||
private AnnotatedLengthDTO length;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@ -47,29 +47,42 @@ public class BodyTubeDTO extends BaseComponentDTO {
|
||||
}
|
||||
|
||||
public double getInsideDiameter() {
|
||||
return insideDiameter;
|
||||
return insideDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setInsideDiameter( final AnnotatedLengthDTO theLength ) {
|
||||
insideDiameter = theLength;
|
||||
}
|
||||
|
||||
public void setInsideDiameter(final double theId) {
|
||||
insideDiameter = theId;
|
||||
insideDiameter = new AnnotatedLengthDTO(theId);
|
||||
}
|
||||
|
||||
public double getOutsideDiameter() {
|
||||
return outsideDiameter;
|
||||
return outsideDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setOutsideDiameter(final double theOd) {
|
||||
public void setOutsideDiameter(final AnnotatedLengthDTO theOd) {
|
||||
outsideDiameter = theOd;
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
public void setOutsideDiameter(final double theOd) {
|
||||
outsideDiameter = new AnnotatedLengthDTO(theOd);
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
public double getLength() {
|
||||
return length.getValue();
|
||||
}
|
||||
|
||||
public void setLength(final AnnotatedLengthDTO theLength) {
|
||||
length = theLength;
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
length = new AnnotatedLengthDTO(theLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentPreset asComponentPreset(java.util.List<MaterialDTO> materials) throws InvalidComponentPresetException {
|
||||
return asComponentPreset(ComponentPreset.Type.BODY_TUBE, materials);
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ import java.util.List;
|
||||
public class BulkHeadDTO extends BaseComponentDTO {
|
||||
|
||||
@XmlElement(name = "OutsideDiameter")
|
||||
private double outsideDiameter;
|
||||
private AnnotatedLengthDTO outsideDiameter;
|
||||
@XmlElement(name = "Length")
|
||||
private double length;
|
||||
private AnnotatedLengthDTO length;
|
||||
|
||||
public BulkHeadDTO() {
|
||||
}
|
||||
@ -41,21 +41,30 @@ public class BulkHeadDTO extends BaseComponentDTO {
|
||||
}
|
||||
|
||||
public double getOutsideDiameter() {
|
||||
return outsideDiameter;
|
||||
return outsideDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setOutsideDiameter(final double theOutsideDiameter) {
|
||||
public void setOutsideDiameter(final AnnotatedLengthDTO theOutsideDiameter) {
|
||||
outsideDiameter = theOutsideDiameter;
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
public void setOutsideDiameter(final double theOutsideDiameter) {
|
||||
outsideDiameter = new AnnotatedLengthDTO(theOutsideDiameter);
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
public double getLength() {
|
||||
return length.getValue();
|
||||
}
|
||||
|
||||
public void setLength(final AnnotatedLengthDTO theLength) {
|
||||
length = theLength;
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
length = new AnnotatedLengthDTO(theLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
|
||||
TypedPropertyMap props = new TypedPropertyMap();
|
||||
addProps(props, materials);
|
||||
|
@ -1,30 +1,21 @@
|
||||
|
||||
package net.sf.openrocket.preset.xml;
|
||||
|
||||
import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.preset.ComponentPresetFactory;
|
||||
import net.sf.openrocket.preset.InvalidComponentPresetException;
|
||||
import net.sf.openrocket.preset.TypedPropertyMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.preset.InvalidComponentPresetException;
|
||||
|
||||
/**
|
||||
* Centering ring preset XML handler.
|
||||
* Centering Ring preset XML handler.
|
||||
*/
|
||||
@XmlRootElement(name = "CenteringRing")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class CenteringRingDTO extends BaseComponentDTO {
|
||||
|
||||
@XmlElement(name = "InsideDiameter")
|
||||
private double insideDiameter;
|
||||
@XmlElement(name = "OutsideDiameter")
|
||||
private double outsideDiameter;
|
||||
@XmlElement(name = "Length")
|
||||
private double length;
|
||||
public class CenteringRingDTO extends BodyTubeDTO {
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@ -33,55 +24,18 @@ public class CenteringRingDTO extends BaseComponentDTO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Most-useful constructor that maps a CenteringRing preset to a CenteringRingDTO.
|
||||
* Most-useful constructor that maps a TubeCoupler preset to a TubeCouplerDTO.
|
||||
*
|
||||
* @param thePreset the preset
|
||||
*
|
||||
* @throws net.sf.openrocket.util.BugException thrown if the expected centering ring keys are not in the preset
|
||||
* @throws net.sf.openrocket.util.BugException thrown if the expected tube coupler keys are not in the preset
|
||||
*/
|
||||
public CenteringRingDTO(final ComponentPreset thePreset) {
|
||||
public CenteringRingDTO(ComponentPreset thePreset) {
|
||||
super(thePreset);
|
||||
setInsideDiameter(thePreset.get(ComponentPreset.INNER_DIAMETER));
|
||||
setOutsideDiameter(thePreset.get(ComponentPreset.OUTER_DIAMETER));
|
||||
setLength(thePreset.get(ComponentPreset.LENGTH));
|
||||
}
|
||||
|
||||
public double getInsideDiameter() {
|
||||
return insideDiameter;
|
||||
}
|
||||
|
||||
public void setInsideDiameter(final double theInsideDiameter) {
|
||||
insideDiameter = theInsideDiameter;
|
||||
}
|
||||
|
||||
public double getOutsideDiameter() {
|
||||
return outsideDiameter;
|
||||
}
|
||||
|
||||
public void setOutsideDiameter(final double theOutsideDiameter) {
|
||||
outsideDiameter = theOutsideDiameter;
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
length = theLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
|
||||
return asComponentPreset(ComponentPreset.Type.CENTERING_RING, materials);
|
||||
}
|
||||
|
||||
public ComponentPreset asComponentPreset(ComponentPreset.Type type, List<MaterialDTO> materials) throws InvalidComponentPresetException {
|
||||
TypedPropertyMap props = new TypedPropertyMap();
|
||||
addProps(props, materials);
|
||||
props.put(ComponentPreset.INNER_DIAMETER, this.getInsideDiameter());
|
||||
props.put(ComponentPreset.OUTER_DIAMETER, this.getOutsideDiameter());
|
||||
props.put(ComponentPreset.LENGTH, this.getLength());
|
||||
props.put(ComponentPreset.TYPE, type);
|
||||
|
||||
return ComponentPresetFactory.create(props);
|
||||
return super.asComponentPreset(ComponentPreset.Type.CENTERING_RING, materials);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
@XmlRootElement(name = "EngineBlock")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class EngineBlockDTO extends CenteringRingDTO {
|
||||
public class EngineBlockDTO extends BodyTubeDTO {
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -1,15 +1,18 @@
|
||||
|
||||
package net.sf.openrocket.preset.xml;
|
||||
|
||||
import net.sf.openrocket.database.Databases;
|
||||
import net.sf.openrocket.material.Material;
|
||||
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import net.sf.openrocket.database.Databases;
|
||||
import net.sf.openrocket.material.Material;
|
||||
import net.sf.openrocket.util.Chars;
|
||||
|
||||
/**
|
||||
* XML handler for materials.
|
||||
*/
|
||||
@ -79,4 +82,34 @@ public class MaterialDTO {
|
||||
Material asMaterial() {
|
||||
return Databases.findMaterial(type.getORMaterialType(), name, density, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Special directive to the JAXB system. After the object is parsed from xml,
|
||||
* we replace the '2' with Chars.SQUARED, and '3' with Chars.CUBED. Just the
|
||||
* opposite transformation as doen in beforeMarshal.
|
||||
* @param unmarshaller
|
||||
* @param parent
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void afterUnmarshal( Unmarshaller unmarshaller, Object parent ) {
|
||||
if (uom != null) {
|
||||
uom = uom.replace('2', Chars.SQUARED);
|
||||
uom = uom.replace('3', Chars.CUBED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special directive to the JAXB system. Before the object is serialized into xml,
|
||||
* we strip out the special unicode characters for cubed and squared so they appear
|
||||
* as simple "3" and "2" chars. The reverse transformation is done in afterUnmarshal.
|
||||
* @param marshaller
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private void beforeMarshal( Marshaller marshaller ) {
|
||||
if (uom != null ) {
|
||||
uom = uom.replace(Chars.SQUARED, '2');
|
||||
uom = uom.replace(Chars.CUBED, '3');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
package net.sf.openrocket.preset.xml;
|
||||
|
||||
import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.preset.ComponentPresetFactory;
|
||||
import net.sf.openrocket.preset.InvalidComponentPresetException;
|
||||
import net.sf.openrocket.preset.TypedPropertyMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.openrocket.preset.ComponentPreset;
|
||||
import net.sf.openrocket.preset.ComponentPresetFactory;
|
||||
import net.sf.openrocket.preset.InvalidComponentPresetException;
|
||||
import net.sf.openrocket.preset.TypedPropertyMap;
|
||||
|
||||
/**
|
||||
* A NoseCone preset XML handler.
|
||||
@ -21,14 +22,16 @@ public class NoseConeDTO extends BaseComponentDTO {
|
||||
@XmlElement(name = "Shape")
|
||||
private ShapeDTO shape;
|
||||
@XmlElement(name = "OutsideDiameter")
|
||||
private double outsideDiameter;
|
||||
private AnnotatedLengthDTO outsideDiameter;
|
||||
@XmlElement(name = "ShoulderDiameter")
|
||||
private double shoulderDiameter;
|
||||
private AnnotatedLengthDTO shoulderDiameter;
|
||||
@XmlElement(name = "ShoulderLength")
|
||||
private AnnotatedLengthDTO shoulderLength;
|
||||
@XmlElement(name = "Length")
|
||||
private double length;
|
||||
private AnnotatedLengthDTO length;
|
||||
|
||||
@XmlElement(name = "Thickness")
|
||||
private Double thickness;
|
||||
private AnnotatedLengthDTO thickness;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@ -47,7 +50,12 @@ public class NoseConeDTO extends BaseComponentDTO {
|
||||
super(thePreset);
|
||||
setShape(ShapeDTO.asDTO(thePreset.get(ComponentPreset.SHAPE)));
|
||||
setOutsideDiameter(thePreset.get(ComponentPreset.AFT_OUTER_DIAMETER));
|
||||
setShoulderDiameter(thePreset.get(ComponentPreset.AFT_SHOULDER_DIAMETER));
|
||||
if ( thePreset.has(ComponentPreset.AFT_SHOULDER_DIAMETER)) {
|
||||
setShoulderDiameter(thePreset.get(ComponentPreset.AFT_SHOULDER_DIAMETER));
|
||||
}
|
||||
if ( thePreset.has(ComponentPreset.AFT_SHOULDER_LENGTH)) {
|
||||
setShoulderLength(thePreset.get(ComponentPreset.AFT_SHOULDER_LENGTH));
|
||||
}
|
||||
setLength(thePreset.get(ComponentPreset.LENGTH));
|
||||
if ( thePreset.has(ComponentPreset.THICKNESS)) {
|
||||
setThickness(thePreset.get(ComponentPreset.THICKNESS));
|
||||
@ -63,47 +71,81 @@ public class NoseConeDTO extends BaseComponentDTO {
|
||||
}
|
||||
|
||||
public double getOutsideDiameter() {
|
||||
return outsideDiameter;
|
||||
return outsideDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setOutsideDiameter(final double theOutsideDiameter) {
|
||||
public void setOutsideDiameter(final AnnotatedLengthDTO theOutsideDiameter) {
|
||||
outsideDiameter = theOutsideDiameter;
|
||||
}
|
||||
|
||||
public double getShoulderDiameter() {
|
||||
return shoulderDiameter;
|
||||
public void setOutsideDiameter(final double theOutsideDiameter) {
|
||||
outsideDiameter = new AnnotatedLengthDTO(theOutsideDiameter);
|
||||
}
|
||||
|
||||
public void setShoulderDiameter(final double theShoulderDiameter) {
|
||||
public double getShoulderDiameter() {
|
||||
return shoulderDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setShoulderDiameter(final AnnotatedLengthDTO theShoulderDiameter) {
|
||||
shoulderDiameter = theShoulderDiameter;
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
public void setShoulderDiameter(final double theShoulderDiameter) {
|
||||
shoulderDiameter = new AnnotatedLengthDTO(theShoulderDiameter);
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
public double getShoulderLength() {
|
||||
return shoulderLength.getValue();
|
||||
}
|
||||
|
||||
public void setShoulderLength(final AnnotatedLengthDTO theShoulderLength) {
|
||||
shoulderLength = theShoulderLength;
|
||||
}
|
||||
|
||||
public void setShoulderLength(final double theShoulderLength) {
|
||||
shoulderLength = new AnnotatedLengthDTO(theShoulderLength);
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length.getValue();
|
||||
}
|
||||
|
||||
public void setLength(final AnnotatedLengthDTO theLength) {
|
||||
length = theLength;
|
||||
}
|
||||
|
||||
public Double getThickness() {
|
||||
return thickness;
|
||||
public void setLength(final double theLength) {
|
||||
length = new AnnotatedLengthDTO(theLength);
|
||||
}
|
||||
|
||||
public double getThickness() {
|
||||
return thickness.getValue();
|
||||
}
|
||||
|
||||
public void setThickness(Double thickness) {
|
||||
public void setThickness(AnnotatedLengthDTO thickness) {
|
||||
this.thickness = thickness;
|
||||
}
|
||||
|
||||
public void setThickness(double thickness) {
|
||||
this.thickness = new AnnotatedLengthDTO(thickness);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
|
||||
TypedPropertyMap props = new TypedPropertyMap();
|
||||
addProps(props, materials);
|
||||
props.put(ComponentPreset.SHAPE, shape.getORShape());
|
||||
props.put(ComponentPreset.AFT_OUTER_DIAMETER, this.getShoulderDiameter());
|
||||
props.put(ComponentPreset.AFT_SHOULDER_DIAMETER, this.getOutsideDiameter());
|
||||
props.put(ComponentPreset.AFT_OUTER_DIAMETER, this.getOutsideDiameter());
|
||||
if ( shoulderLength != null ) {
|
||||
props.put(ComponentPreset.AFT_SHOULDER_LENGTH, this.getShoulderLength());
|
||||
}
|
||||
if ( shoulderDiameter != null ) {
|
||||
props.put(ComponentPreset.AFT_SHOULDER_DIAMETER, this.getShoulderDiameter());
|
||||
}
|
||||
props.put(ComponentPreset.LENGTH, this.getLength());
|
||||
props.put(ComponentPreset.TYPE, ComponentPreset.Type.NOSE_CONE);
|
||||
if ( thickness != null ) {
|
||||
props.put(ComponentPreset.THICKNESS, thickness);
|
||||
props.put(ComponentPreset.THICKNESS, this.getThickness());
|
||||
}
|
||||
|
||||
return ComponentPresetFactory.create(props);
|
||||
|
@ -23,24 +23,24 @@ public class TransitionDTO extends BaseComponentDTO {
|
||||
private ShapeDTO shape;
|
||||
|
||||
@XmlElement(name = "ForeOutsideDiameter")
|
||||
private double foreOutsideDiameter;
|
||||
private AnnotatedLengthDTO foreOutsideDiameter;
|
||||
@XmlElement(name = "ForeShoulderDiameter")
|
||||
private double foreShoulderDiameter;
|
||||
private AnnotatedLengthDTO foreShoulderDiameter;
|
||||
@XmlElement(name = "ForeShoulderLength")
|
||||
private double foreShoulderLength;
|
||||
private AnnotatedLengthDTO foreShoulderLength;
|
||||
|
||||
@XmlElement(name = "AftOutsideDiameter")
|
||||
private double aftOutsideDiameter;
|
||||
private AnnotatedLengthDTO aftOutsideDiameter;
|
||||
@XmlElement(name = "AftShoulderDiameter")
|
||||
private double aftShoulderDiameter;
|
||||
private AnnotatedLengthDTO aftShoulderDiameter;
|
||||
@XmlElement(name = "AftShoulderLength")
|
||||
private double aftShoulderLength;
|
||||
private AnnotatedLengthDTO aftShoulderLength;
|
||||
|
||||
@XmlElement(name = "Length")
|
||||
private double length;
|
||||
private AnnotatedLengthDTO length;
|
||||
|
||||
@XmlElement(name = "Thickness")
|
||||
private Double thickness;
|
||||
private AnnotatedLengthDTO thickness;
|
||||
|
||||
|
||||
/**
|
||||
@ -80,69 +80,102 @@ public class TransitionDTO extends BaseComponentDTO {
|
||||
}
|
||||
|
||||
public double getForeOutsideDiameter() {
|
||||
return foreOutsideDiameter;
|
||||
return foreOutsideDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setForeOutsideDiameter(final double theForeOutsideDiameter) {
|
||||
public void setForeOutsideDiameter(final AnnotatedLengthDTO theForeOutsideDiameter) {
|
||||
foreOutsideDiameter = theForeOutsideDiameter;
|
||||
}
|
||||
|
||||
public double getForeShoulderDiameter() {
|
||||
return foreShoulderDiameter;
|
||||
public void setForeOutsideDiameter(final double theForeOutsideDiameter) {
|
||||
foreOutsideDiameter = new AnnotatedLengthDTO(theForeOutsideDiameter);
|
||||
}
|
||||
|
||||
public void setForeShoulderDiameter(final double theForeShoulderDiameter) {
|
||||
public double getForeShoulderDiameter() {
|
||||
return foreShoulderDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setForeShoulderDiameter(final AnnotatedLengthDTO theForeShoulderDiameter) {
|
||||
foreShoulderDiameter = theForeShoulderDiameter;
|
||||
}
|
||||
|
||||
public double getForeShoulderLength() {
|
||||
return foreShoulderLength;
|
||||
public void setForeShoulderDiameter(final double theForeShoulderDiameter) {
|
||||
foreShoulderDiameter = new AnnotatedLengthDTO(theForeShoulderDiameter);
|
||||
}
|
||||
|
||||
public void setForeShoulderLength(final double theForeShoulderLength) {
|
||||
public double getForeShoulderLength() {
|
||||
return foreShoulderLength.getValue();
|
||||
}
|
||||
|
||||
public void setForeShoulderLength(final AnnotatedLengthDTO theForeShoulderLength) {
|
||||
foreShoulderLength = theForeShoulderLength;
|
||||
}
|
||||
|
||||
public double getAftOutsideDiameter() {
|
||||
return aftOutsideDiameter;
|
||||
public void setForeShoulderLength(final double theForeShoulderLength) {
|
||||
foreShoulderLength = new AnnotatedLengthDTO(theForeShoulderLength);
|
||||
}
|
||||
|
||||
public void setAftOutsideDiameter(final double theAftOutsideDiameter) {
|
||||
public double getAftOutsideDiameter() {
|
||||
return aftOutsideDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setAftOutsideDiameter(final AnnotatedLengthDTO theAftOutsideDiameter) {
|
||||
aftOutsideDiameter = theAftOutsideDiameter;
|
||||
}
|
||||
|
||||
public double getAftShoulderDiameter() {
|
||||
return aftShoulderDiameter;
|
||||
public void setAftOutsideDiameter(final double theAftOutsideDiameter) {
|
||||
aftOutsideDiameter = new AnnotatedLengthDTO(theAftOutsideDiameter);
|
||||
}
|
||||
|
||||
public void setAftShoulderDiameter(final double theAftShoulderDiameter) {
|
||||
public double getAftShoulderDiameter() {
|
||||
return aftShoulderDiameter.getValue();
|
||||
}
|
||||
|
||||
public void setAftShoulderDiameter(final AnnotatedLengthDTO theAftShoulderDiameter) {
|
||||
aftShoulderDiameter = theAftShoulderDiameter;
|
||||
}
|
||||
|
||||
public double getAftShoulderLength() {
|
||||
return aftShoulderLength;
|
||||
public void setAftShoulderDiameter(final double theAftShoulderDiameter) {
|
||||
aftShoulderDiameter = new AnnotatedLengthDTO(theAftShoulderDiameter);
|
||||
}
|
||||
|
||||
public void setAftShoulderLength(final double theAftShoulderLength) {
|
||||
public double getAftShoulderLength() {
|
||||
return aftShoulderLength.getValue();
|
||||
}
|
||||
|
||||
public void setAftShoulderLength(final AnnotatedLengthDTO theAftShoulderLength) {
|
||||
aftShoulderLength = theAftShoulderLength;
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
public void setAftShoulderLength(final double theAftShoulderLength) {
|
||||
aftShoulderLength = new AnnotatedLengthDTO(theAftShoulderLength);
|
||||
}
|
||||
|
||||
public void setLength(final double theLength) {
|
||||
public double getLength() {
|
||||
return length.getValue();
|
||||
}
|
||||
|
||||
public void setLength(final AnnotatedLengthDTO theLength) {
|
||||
length = theLength;
|
||||
}
|
||||
|
||||
public Double getThickness() {
|
||||
return thickness;
|
||||
public void setLength(final double theLength) {
|
||||
length = new AnnotatedLengthDTO(theLength);
|
||||
}
|
||||
|
||||
public double getThickness() {
|
||||
return thickness.getValue();
|
||||
}
|
||||
|
||||
public void setThickness(Double thickness) {
|
||||
public void setThickness(AnnotatedLengthDTO thickness) {
|
||||
this.thickness = thickness;
|
||||
}
|
||||
|
||||
public void setThickness(double thickness) {
|
||||
this.thickness = new AnnotatedLengthDTO(thickness);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentPreset asComponentPreset(List<MaterialDTO> materials) throws InvalidComponentPresetException {
|
||||
TypedPropertyMap props = new TypedPropertyMap();
|
||||
addProps(props, materials);
|
||||
@ -156,7 +189,7 @@ public class TransitionDTO extends BaseComponentDTO {
|
||||
props.put(ComponentPreset.LENGTH, this.getLength());
|
||||
props.put(ComponentPreset.TYPE, ComponentPreset.Type.TRANSITION);
|
||||
if ( thickness != null ) {
|
||||
props.put(ComponentPreset.THICKNESS, thickness);
|
||||
props.put(ComponentPreset.THICKNESS, this.getThickness());
|
||||
}
|
||||
|
||||
return ComponentPresetFactory.create(props);
|
||||
|
Loading…
x
Reference in New Issue
Block a user