1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.csg.scenegraph2;
\r
14 import java.util.Objects;
\r
16 import org.jcae.opencascade.jni.TopoDS_Shape;
\r
17 import org.simantics.g3d.csg.ontology.CSG;
\r
18 import org.simantics.g3d.property.annotations.GetPropertyValue;
\r
19 import org.simantics.g3d.property.annotations.SetPropertyValue;
\r
20 import org.simantics.objmap.graph.annotations.GraphType;
\r
21 import org.simantics.objmap.graph.annotations.RelatedGetValue;
\r
22 import org.simantics.objmap.graph.annotations.RelatedSetValue;
\r
23 import org.simantics.opencascade.OccTriangulator;
\r
25 @GraphType(CSG.URIs.Cylinder)
\r
26 public class CylinderNode extends CSGnode {
\r
28 private double r = 1.0;
\r
29 private double h = 1.0;
\r
31 @RelatedSetValue(CSG.URIs.HasRadius)
\r
32 @SetPropertyValue(CSG.URIs.HasRadius)
\r
33 public void setR(double r) {
\r
37 firePropertyChanged(CSG.URIs.HasRadius);
\r
40 @RelatedSetValue(CSG.URIs.HasHeight)
\r
41 @SetPropertyValue(CSG.URIs.HasHeight)
\r
42 public void setH(double h) {
\r
46 firePropertyChanged(CSG.URIs.HasHeight);
\r
49 @RelatedGetValue(CSG.URIs.HasHeight)
\r
50 @GetPropertyValue(value=CSG.URIs.HasHeight, name = "Height")
\r
51 public double getH() {
\r
55 @RelatedGetValue(CSG.URIs.HasRadius)
\r
56 @GetPropertyValue(value=CSG.URIs.HasRadius, name = "Radius")
\r
57 public double getR() {
\r
62 public TopoDS_Shape getBaseGeometry() {
\r
63 return OccTriangulator.makeCylinder(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r, h);
\r