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.Torus)
\r
13 public class TorusNode extends CSGnode {
\r
15 private double r1 = 1.0;
\r
16 private double r2 = 1.0;
\r
19 @RelatedSetValue(CSG.URIs.HasMinorRadius)
\r
20 @SetPropertyValue(CSG.URIs.HasMinorRadius)
\r
21 public void setR1(double r1) {
\r
23 firePropertyChanged(CSG.URIs.HasMinorRadius);
\r
26 @RelatedSetValue(CSG.URIs.HasMajorRadius)
\r
27 @SetPropertyValue(CSG.URIs.HasMajorRadius)
\r
28 public void setR2(double r2) {
\r
30 firePropertyChanged(CSG.URIs.HasMajorRadius);
\r
33 @RelatedGetValue(CSG.URIs.HasMinorRadius)
\r
34 @GetPropertyValue(value=CSG.URIs.HasMinorRadius, name="Minor Radius")
\r
35 public double getR1() {
\r
39 @RelatedGetValue(CSG.URIs.HasMajorRadius)
\r
40 @GetPropertyValue(value=CSG.URIs.HasMajorRadius, name="Major Radius")
\r
41 public double getR2() {
\r
46 public TopoDS_Shape getBaseGeometry() {
\r
47 return OccTriangulator.makeTorus(new double[] { 0.0, 0.0, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r2, r1);
\r