moving to core/
[debian/openrocket] / core / src / net / sf / openrocket / file / rocksim / export / AbstractTransitionDTO.java
1 package net.sf.openrocket.file.rocksim.export;
2
3 import net.sf.openrocket.file.rocksim.importt.RocksimHandler;
4 import net.sf.openrocket.file.rocksim.importt.RocksimNoseConeCode;
5 import net.sf.openrocket.rocketcomponent.Transition;
6
7 import javax.xml.bind.annotation.XmlAccessType;
8 import javax.xml.bind.annotation.XmlAccessorType;
9 import javax.xml.bind.annotation.XmlElement;
10
11 /**
12  */
13 @XmlAccessorType(XmlAccessType.FIELD)
14 public class AbstractTransitionDTO extends BasePartDTO {
15     @XmlElement(name = "ShapeCode")
16     private int shapeCode = 1;
17     @XmlElement(name = "ConstructionType")
18     private int constructionType = 1;
19     @XmlElement(name = "WallThickness")
20     private double wallThickness = 0d;
21     @XmlElement(name = "ShapeParameter")
22     private double shapeParameter = 0d;
23
24     protected AbstractTransitionDTO() {
25
26     }
27
28     protected AbstractTransitionDTO(Transition nc) {
29         super(nc);
30         setConstructionType(nc.isFilled() ? 0 : 1);
31         setShapeCode(RocksimNoseConeCode.toCode(nc.getType()));
32
33         if (Transition.Shape.POWER.equals(nc.getType()) ||
34                 Transition.Shape.HAACK.equals(nc.getType()) ||
35                 Transition.Shape.PARABOLIC.equals(nc.getType())) {
36             setShapeParameter(nc.getShapeParameter());
37         }
38
39         setWallThickness(nc.getThickness() * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
40
41     }
42
43     public int getShapeCode() {
44         return shapeCode;
45     }
46
47     public void setShapeCode(int theShapeCode) {
48         shapeCode = theShapeCode;
49     }
50
51     public int getConstructionType() {
52         return constructionType;
53     }
54
55     public void setConstructionType(int theConstructionType) {
56         constructionType = theConstructionType;
57     }
58
59     public double getWallThickness() {
60         return wallThickness;
61     }
62
63     public void setWallThickness(double theWallThickness) {
64         wallThickness = theWallThickness;
65     }
66
67     public double getShapeParameter() {
68         return shapeParameter;
69     }
70
71     public void setShapeParameter(double theShapeParameter) {
72         shapeParameter = theShapeParameter;
73     }
74 }