/******************************************************************************* * 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.RegularPrism) public class RegularPrismNode extends CSGnode { private double r = 1.0; private double h = 1.0; private int n = 3; @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); } @RelatedSetValue(CSG.URIs.HasCorners) @SetPropertyValue(CSG.URIs.HasCorners) public void setN(int n) { if (n < 3) n = 3; this.n = n; firePropertyChanged(CSG.URIs.HasCorners); } @RelatedGetValue(CSG.URIs.HasHeight) @GetPropertyValue(value=CSG.URIs.HasHeight, name="Height") public double getH() { return h; } @RelatedGetValue(CSG.URIs.HasCorners) @GetPropertyValue(value=CSG.URIs.HasCorners, name="Corners") public int getN() { return n; } @RelatedGetValue(CSG.URIs.HasRadius) @GetPropertyValue(value=CSG.URIs.HasRadius, name="Radius") public double getR() { return r; } @Override public TopoDS_Shape getBaseGeometry() { return OccTriangulator.makeReqularPrism(h, r, n); } }