/******************************************************************************* * 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.EllipticCylinder) public class EllipticCylinderNode extends CSGnode { private double r1 = 0.5; private double r2 = 1.0; private double h = 1.0; @RelatedSetValue(CSG.URIs.HasMinorRadius) @SetPropertyValue(CSG.URIs.HasMinorRadius) public void setR1(double r1) { this.r1 = r1; firePropertyChanged(CSG.URIs.HasMinorRadius); } @RelatedSetValue(CSG.URIs.HasMajorRadius) @SetPropertyValue(CSG.URIs.HasMajorRadius) public void setR2(double r2) { this.r2 = r2; firePropertyChanged(CSG.URIs.HasMajorRadius); } @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.HasMinorRadius) @GetPropertyValue(value=CSG.URIs.HasMinorRadius, name = "Minor Radius") public double getR1() { return r1; } @RelatedGetValue(CSG.URIs.HasMajorRadius) @GetPropertyValue(value=CSG.URIs.HasMajorRadius, name = "Major Radius") public double getR2() { return r2; } @Override public TopoDS_Shape getBaseGeometry() { return OccTriangulator.makeEllipticCylinder(h, r1, r2); } }