]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/EllipticCylinderNode.java
Copyrights
[simantics/3d.git] / org.simantics.g3d.csg / src / org / simantics / g3d / csg / scenegraph2 / EllipticCylinderNode.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g3d.csg.scenegraph2;\r
13 \r
14 import org.jcae.opencascade.jni.TopoDS_Shape;\r
15 import org.simantics.g3d.csg.ontology.CSG;\r
16 import org.simantics.g3d.property.annotations.GetPropertyValue;\r
17 import org.simantics.g3d.property.annotations.SetPropertyValue;\r
18 import org.simantics.objmap.graph.annotations.GraphType;\r
19 import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
20 import org.simantics.objmap.graph.annotations.RelatedSetValue;\r
21 import org.simantics.opencascade.OccTriangulator;\r
22 \r
23 @GraphType(CSG.URIs.EllipticCylinder)\r
24 public class EllipticCylinderNode extends CSGnode {\r
25 \r
26         private double r1 = 0.5;\r
27         private double r2 = 1.0;\r
28         private double h = 1.0;\r
29         \r
30         @RelatedSetValue(CSG.URIs.HasMinorRadius)\r
31         @SetPropertyValue(CSG.URIs.HasMinorRadius)\r
32         public void setR1(double r1) {\r
33                 this.r1 = r1;\r
34                 firePropertyChanged(CSG.URIs.HasMinorRadius);\r
35         }\r
36         \r
37         @RelatedSetValue(CSG.URIs.HasMajorRadius)\r
38         @SetPropertyValue(CSG.URIs.HasMajorRadius)\r
39         public void setR2(double r2) {\r
40                 this.r2 = r2;\r
41                 firePropertyChanged(CSG.URIs.HasMajorRadius);\r
42         }\r
43         \r
44         @RelatedSetValue(CSG.URIs.HasHeight)\r
45         @SetPropertyValue(CSG.URIs.HasHeight)\r
46         public void setH(double h) {\r
47                 this.h = h;\r
48                 firePropertyChanged(CSG.URIs.HasHeight);\r
49         }\r
50         \r
51         @RelatedGetValue(CSG.URIs.HasHeight)\r
52         @GetPropertyValue(value=CSG.URIs.HasHeight, name = "Height")\r
53         public double getH() {\r
54                 return h;\r
55         }\r
56         \r
57         @RelatedGetValue(CSG.URIs.HasMinorRadius)\r
58         @GetPropertyValue(value=CSG.URIs.HasMinorRadius, name = "Minor Radius")\r
59         public double getR1() {\r
60                 return r1;\r
61         }\r
62         \r
63         @RelatedGetValue(CSG.URIs.HasMajorRadius)\r
64         @GetPropertyValue(value=CSG.URIs.HasMajorRadius, name = "Major Radius")\r
65         public double getR2() {\r
66                 return r2;\r
67         }\r
68         \r
69         @Override\r
70         public TopoDS_Shape getBaseGeometry() {\r
71                 return OccTriangulator.makeEllipticCylinder(h, r1, r2);\r
72         }\r
73 \r
74 }\r