]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/SphereNode.java
a2cc65801333fa22ebbf100be2c180f8b6977ba4
[simantics/3d.git] / org.simantics.g3d.csg / src / org / simantics / g3d / csg / scenegraph2 / SphereNode.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.Sphere)\r
13 public class SphereNode extends CSGnode {\r
14 \r
15         private double r = 1.0;\r
16         \r
17         @RelatedSetValue(CSG.URIs.HasRadius)\r
18         @SetPropertyValue(CSG.URIs.HasRadius)\r
19         public void setR(double r) {\r
20                 this.r = r;\r
21                 firePropertyChanged(CSG.URIs.HasRadius);\r
22         }\r
23         \r
24         @RelatedGetValue(CSG.URIs.HasRadius)\r
25         @GetPropertyValue(value=CSG.URIs.HasRadius, name="Radius")\r
26         public double getR() {\r
27                 return r;\r
28         }\r
29         \r
30         @Override\r
31         public TopoDS_Shape getBaseGeometry() {\r
32                 return OccTriangulator.makeSphere(0, 0, 0, r);\r
33         }\r
34 \r
35 }\r