]> gerrit.simantics Code Review - simantics/3d.git/blob
e5bfeb955a8c8a664ebba0487a50672adc0a3bbc
[simantics/3d.git] /
1 /*******************************************************************************\r
2  * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.processeditor.scenegraph;\r
12 \r
13 import javax.vecmath.AxisAngle4d;\r
14 \r
15 import org.simantics.db.Graph;\r
16 import org.simantics.db.Resource;\r
17 import org.simantics.processeditor.ProcessResource;\r
18 import org.simantics.processeditor.common.ControlPointTools;\r
19 import org.simantics.processeditor.stubs.PipeControlPoint;\r
20 import org.simantics.processeditor.stubs.PipelineComponent;\r
21 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
22 import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
23 import org.simantics.proconf.g3d.scenegraph.ParameterizedModelNode;\r
24 \r
25 \r
26 \r
27 \r
28 public class PipelineComponentNode extends ParameterizedModelNode {\r
29 \r
30     boolean updating = false;\r
31     \r
32     public PipelineComponentNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource resource) {\r
33         super(editor,parent,graph, resource, ProcessResource.plant3Dresource.HasGraphics);\r
34         PipelineComponent component = new PipelineComponent(graph, resource);\r
35         if(!component.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent))\r
36             throw new RuntimeException("Resource must be instance of Inline Component " + resource);\r
37         if (!(parent instanceof PipeRunNode))\r
38             throw new RuntimeException("Parent must be instance of PipelineNode " + parent.getResource() + " " + resource);\r
39 \r
40         //PipeControlPoint pcp = component.getControlPoint();\r
41 //        monitor = new StructuralChangeMonitor(\r
42 //                new StructuralChangeListener[] { this }, pcp.getResource(), GlobalIdMap\r
43 //                 .get(Layer0Mapping.HAS_PROPERTY));\r
44        updateTransform(graph);\r
45     }\r
46     \r
47 //    public void handleUpdate(StructuralChangeMonitor monitor, GraphChangeEvent event) {\r
48 //        if (updating)\r
49 //            return;\r
50 //        if (event.getParameter() instanceof InlineComponentNode)\r
51 //            return;\r
52 //        if (event.getTransactionId() == null)\r
53 //            return;\r
54 //        if (event.getParameter() instanceof AbstractGraphicsNode)\r
55 //            return;\r
56 //\r
57 //        updating = true;\r
58 //        updateTransform();\r
59 //        updating = false;\r
60 //    }\r
61     \r
62     public void updateTransform(Graph graph) {\r
63         super.updateTransform(graph);\r
64         /*\r
65         PipelineComponent component = new PipelineComponent(graph,shapeResource);\r
66     \r
67         PipeControlPoint pcp = component.getControlPoint();\r
68         Double angle = component.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle);\r
69                 double componentAngle = 0.0;\r
70                 if (angle != null)\r
71                         componentAngle = angle;\r
72 \r
73                 AxisAngle4d aa = ControlPointTools.getControlPointRotation(pcp, componentAngle);\r
74                 update(aa);\r
75                 */\r
76         }\r
77     \r
78     \r
79     public void dispose() {\r
80         //monitor.dispose();\r
81         super.dispose();\r
82     }\r
83     \r
84 \r
85     \r
86 \r
87 }