/******************************************************************************* * 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.Box) public class BoxNode extends CSGnode { private double sx = 1.0; private double sy = 1.0; private double sz = 1.0; public BoxNode() { System.out.println(); } @RelatedSetValue(CSG.URIs.HasXAxisSize) @SetPropertyValue(CSG.URIs.HasXAxisSize) public void setSX(double d) { this.sx = d; firePropertyChanged(CSG.URIs.HasXAxisSize); } @RelatedSetValue(CSG.URIs.HasYAxisSize) @SetPropertyValue(CSG.URIs.HasYAxisSize) public void setSY(double d) { this.sy = d; firePropertyChanged(CSG.URIs.HasYAxisSize); } @RelatedSetValue(CSG.URIs.HasZAxisSize) @SetPropertyValue(CSG.URIs.HasZAxisSize) public void setSZ(double d) { this.sz = d; firePropertyChanged(CSG.URIs.HasZAxisSize); } @RelatedGetValue(CSG.URIs.HasXAxisSize) @GetPropertyValue(value=CSG.URIs.HasXAxisSize, name = "X Size") public double getSx() { return sx; } @RelatedGetValue(CSG.URIs.HasYAxisSize) @GetPropertyValue(value=CSG.URIs.HasYAxisSize, name = "Y Size") public double getSy() { return sy; } @RelatedGetValue(CSG.URIs.HasZAxisSize) @GetPropertyValue(value=CSG.URIs.HasZAxisSize, name = "Z Size") public double getSz() { return sz; } @Override public TopoDS_Shape getBaseGeometry() { return OccTriangulator.makeBox(-sx * 0.5, -sy * 0.5, -sz * 0.5, sx * 0.5, sy * 0.5, sz * 0.5); } }