1 package org.simantics.g3d.csg.scenegraph2;
\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
12 @GraphType(CSG.URIs.Cylinder)
\r
13 public class CylinderNode extends CSGnode {
\r
15 private double r = 1.0;
\r
16 private double h = 1.0;
\r
18 @RelatedSetValue(CSG.URIs.HasRadius)
\r
19 @SetPropertyValue(CSG.URIs.HasRadius)
\r
20 public void setR(double r) {
\r
22 firePropertyChanged(CSG.URIs.HasRadius);
\r
25 @RelatedSetValue(CSG.URIs.HasHeight)
\r
26 @SetPropertyValue(CSG.URIs.HasHeight)
\r
27 public void setH(double h) {
\r
29 firePropertyChanged(CSG.URIs.HasHeight);
\r
32 @RelatedGetValue(CSG.URIs.HasHeight)
\r
33 @GetPropertyValue(value=CSG.URIs.HasHeight, name = "Height")
\r
34 public double getH() {
\r
38 @RelatedGetValue(CSG.URIs.HasRadius)
\r
39 @GetPropertyValue(value=CSG.URIs.HasRadius, name = "Radius")
\r
40 public double getR() {
\r
45 public TopoDS_Shape getBaseGeometry() {
\r
46 return OccTriangulator.makeCylinder(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r, h);
\r