--- /dev/null
+package org.simantics.g3d.csg.scenegraph2;\r
+\r
+import org.jcae.opencascade.jni.TopoDS_Shape;\r
+import org.simantics.g3d.csg.ontology.CSG;\r
+import org.simantics.g3d.property.annotations.GetPropertyValue;\r
+import org.simantics.g3d.property.annotations.SetPropertyValue;\r
+import org.simantics.objmap.graph.annotations.GraphType;\r
+import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
+import org.simantics.objmap.graph.annotations.RelatedSetValue;\r
+import org.simantics.opencascade.OccTriangulator;\r
+\r
+@GraphType(CSG.URIs.Cylinder)\r
+public class CylinderNode extends CSGnode {\r
+\r
+ private double r = 1.0;\r
+ private double h = 1.0;\r
+ \r
+ @RelatedSetValue(CSG.URIs.HasRadius)\r
+ @SetPropertyValue(CSG.URIs.HasRadius)\r
+ public void setR(double r) {\r
+ this.r = r;\r
+ firePropertyChanged(CSG.URIs.HasRadius);\r
+ }\r
+\r
+ @RelatedSetValue(CSG.URIs.HasHeight)\r
+ @SetPropertyValue(CSG.URIs.HasHeight)\r
+ public void setH(double h) {\r
+ this.h = h;\r
+ firePropertyChanged(CSG.URIs.HasHeight);\r
+ }\r
+ \r
+ @RelatedGetValue(CSG.URIs.HasHeight)\r
+ @GetPropertyValue(value=CSG.URIs.HasHeight, name = "Height")\r
+ public double getH() {\r
+ return h;\r
+ }\r
+ \r
+ @RelatedGetValue(CSG.URIs.HasRadius)\r
+ @GetPropertyValue(value=CSG.URIs.HasRadius, name = "Radius")\r
+ public double getR() {\r
+ return r;\r
+ }\r
+ \r
+ @Override\r
+ public TopoDS_Shape getBaseGeometry() {\r
+ return OccTriangulator.makeCylinder(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r, h);\r
+ }\r
+\r
+}\r