]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/EllipticCylinderNode.java
3D framework (Simca 2012)
[simantics/3d.git] / org.simantics.g3d.csg / src / org / simantics / g3d / csg / scenegraph2 / EllipticCylinderNode.java
1 package org.simantics.g3d.csg.scenegraph2;\r
2 \r
3 import org.jcae.opencascade.jni.TopoDS_Shape;\r
4 import org.simantics.g3d.csg.ontology.CSG;\r
5 import org.simantics.g3d.property.annotations.GetPropertyValue;\r
6 import org.simantics.g3d.property.annotations.SetPropertyValue;\r
7 import org.simantics.objmap.graph.annotations.GraphType;\r
8 import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
9 import org.simantics.objmap.graph.annotations.RelatedSetValue;\r
10 import org.simantics.opencascade.OccTriangulator;\r
11 \r
12 @GraphType(CSG.URIs.EllipticCylinder)\r
13 public class EllipticCylinderNode extends CSGnode {\r
14 \r
15         private double r1 = 0.5;\r
16         private double r2 = 1.0;\r
17         private double h = 1.0;\r
18         \r
19         @RelatedSetValue(CSG.URIs.HasMinorRadius)\r
20         @SetPropertyValue(CSG.URIs.HasMinorRadius)\r
21         public void setR1(double r1) {\r
22                 this.r1 = r1;\r
23                 firePropertyChanged(CSG.URIs.HasMinorRadius);\r
24         }\r
25         \r
26         @RelatedSetValue(CSG.URIs.HasMajorRadius)\r
27         @SetPropertyValue(CSG.URIs.HasMajorRadius)\r
28         public void setR2(double r2) {\r
29                 this.r2 = r2;\r
30                 firePropertyChanged(CSG.URIs.HasMajorRadius);\r
31         }\r
32         \r
33         @RelatedSetValue(CSG.URIs.HasHeight)\r
34         @SetPropertyValue(CSG.URIs.HasHeight)\r
35         public void setH(double h) {\r
36                 this.h = h;\r
37                 firePropertyChanged(CSG.URIs.HasHeight);\r
38         }\r
39         \r
40         @RelatedGetValue(CSG.URIs.HasHeight)\r
41         @GetPropertyValue(value=CSG.URIs.HasHeight, name = "Height")\r
42         public double getH() {\r
43                 return h;\r
44         }\r
45         \r
46         @RelatedGetValue(CSG.URIs.HasMinorRadius)\r
47         @GetPropertyValue(value=CSG.URIs.HasMinorRadius, name = "Minor Radius")\r
48         public double getR1() {\r
49                 return r1;\r
50         }\r
51         \r
52         @RelatedGetValue(CSG.URIs.HasMajorRadius)\r
53         @GetPropertyValue(value=CSG.URIs.HasMajorRadius, name = "Major Radius")\r
54         public double getR2() {\r
55                 return r2;\r
56         }\r
57         \r
58         @Override\r
59         public TopoDS_Shape getBaseGeometry() {\r
60                 return OccTriangulator.makeEllipticCylinder(h, r1, r2);\r
61         }\r
62 \r
63 }\r