/******************************************************************************* * Copyright (c) 2012, 2013 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.g3d.csg.scenegraph2; import org.jcae.opencascade.jni.TopoDS_Shape; import org.simantics.g3d.csg.ontology.CSG; import org.simantics.g3d.property.annotations.GetPropertyValue; import org.simantics.g3d.property.annotations.SetPropertyValue; import org.simantics.objmap.graph.annotations.GraphType; import org.simantics.objmap.graph.annotations.RelatedGetValue; import org.simantics.objmap.graph.annotations.RelatedSetValue; import org.simantics.opencascade.OccTriangulator; @GraphType(CSG.URIs.Cylinder) public class CylinderNode extends CSGnode { private double r = 1.0; private double h = 1.0; @RelatedSetValue(CSG.URIs.HasRadius) @SetPropertyValue(CSG.URIs.HasRadius) public void setR(double r) { this.r = r; firePropertyChanged(CSG.URIs.HasRadius); } @RelatedSetValue(CSG.URIs.HasHeight) @SetPropertyValue(CSG.URIs.HasHeight) public void setH(double h) { this.h = h; firePropertyChanged(CSG.URIs.HasHeight); } @RelatedGetValue(CSG.URIs.HasHeight) @GetPropertyValue(value=CSG.URIs.HasHeight, name = "Height") public double getH() { return h; } @RelatedGetValue(CSG.URIs.HasRadius) @GetPropertyValue(value=CSG.URIs.HasRadius, name = "Radius") public double getR() { return r; } @Override public TopoDS_Shape getBaseGeometry() { return OccTriangulator.makeCylinder(new double[] { 0.0, -h * 0.5, 0.0 }, new double[] { 0.0, 1.0, 0.0 }, r, h); } }