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 org.jcae.opencascade.jni.TopoDS_Shape;
\r
15 import org.simantics.g3d.csg.ontology.CSG;
\r
16 import org.simantics.g3d.property.annotations.GetPropertyValue;
\r
17 import org.simantics.g3d.property.annotations.SetPropertyValue;
\r
18 import org.simantics.objmap.graph.annotations.GraphType;
\r
19 import org.simantics.objmap.graph.annotations.RelatedGetValue;
\r
20 import org.simantics.objmap.graph.annotations.RelatedSetValue;
\r
21 import org.simantics.opencascade.OccTriangulator;
\r
23 @GraphType(CSG.URIs.Box)
\r
24 public class BoxNode extends CSGnode {
\r
26 private double sx = 1.0;
\r
27 private double sy = 1.0;
\r
28 private double sz = 1.0;
\r
31 System.out.println();
\r
34 @RelatedSetValue(CSG.URIs.HasXAxisSize)
\r
35 @SetPropertyValue(CSG.URIs.HasXAxisSize)
\r
36 public void setSX(double d) {
\r
38 firePropertyChanged(CSG.URIs.HasXAxisSize);
\r
41 @RelatedSetValue(CSG.URIs.HasYAxisSize)
\r
42 @SetPropertyValue(CSG.URIs.HasYAxisSize)
\r
43 public void setSY(double d) {
\r
45 firePropertyChanged(CSG.URIs.HasYAxisSize);
\r
48 @RelatedSetValue(CSG.URIs.HasZAxisSize)
\r
49 @SetPropertyValue(CSG.URIs.HasZAxisSize)
\r
50 public void setSZ(double d) {
\r
52 firePropertyChanged(CSG.URIs.HasZAxisSize);
\r
55 @RelatedGetValue(CSG.URIs.HasXAxisSize)
\r
56 @GetPropertyValue(value=CSG.URIs.HasXAxisSize, name = "X Size")
\r
57 public double getSx() {
\r
61 @RelatedGetValue(CSG.URIs.HasYAxisSize)
\r
62 @GetPropertyValue(value=CSG.URIs.HasYAxisSize, name = "Y Size")
\r
63 public double getSy() {
\r
67 @RelatedGetValue(CSG.URIs.HasZAxisSize)
\r
68 @GetPropertyValue(value=CSG.URIs.HasZAxisSize, name = "Z Size")
\r
69 public double getSz() {
\r
75 public TopoDS_Shape getBaseGeometry() {
\r
76 return OccTriangulator.makeBox(-sx * 0.5, -sy * 0.5, -sz * 0.5, sx * 0.5, sy * 0.5, sz * 0.5);
\r