/******************************************************************************* * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. * 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 fi.vtt.simantics.processeditor.scenegraph; import javax.vecmath.AxisAngle4d; import org.simantics.db.Graph; import org.simantics.db.Resource; import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase; import org.simantics.proconf.g3d.scenegraph.IGraphicsNode; import org.simantics.proconf.g3d.scenegraph.ParameterizedModelNode; import fi.vtt.simantics.processeditor.ProcessResource; import fi.vtt.simantics.processeditor.common.ControlPointTools; import fi.vtt.simantics.processeditor.stubs.PipeControlPoint; import fi.vtt.simantics.processeditor.stubs.PipelineComponent; public class PipelineComponentNode extends ParameterizedModelNode { boolean updating = false; public PipelineComponentNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource resource) { super(editor,parent,graph, resource, ProcessResource.plant3Dresource.HasGraphics); PipelineComponent component = new PipelineComponent(graph, resource); if(!component.isInstanceOf(ProcessResource.plant3Dresource.PipelineComponent)) throw new RuntimeException("Resource must be instance of Inline Component " + resource); if (!(parent instanceof PipeRunNode)) throw new RuntimeException("Parent must be instance of PipelineNode " + parent.getResource() + " " + resource); //PipeControlPoint pcp = component.getControlPoint(); // monitor = new StructuralChangeMonitor( // new StructuralChangeListener[] { this }, pcp.getResource(), GlobalIdMap // .get(Layer0Mapping.HAS_PROPERTY)); updateTransform(graph); } // public void handleUpdate(StructuralChangeMonitor monitor, GraphChangeEvent event) { // if (updating) // return; // if (event.getParameter() instanceof InlineComponentNode) // return; // if (event.getTransactionId() == null) // return; // if (event.getParameter() instanceof AbstractGraphicsNode) // return; // // updating = true; // updateTransform(); // updating = false; // } public void updateTransform(Graph graph) { super.updateTransform(graph); /* PipelineComponent component = new PipelineComponent(graph,shapeResource); PipeControlPoint pcp = component.getControlPoint(); Double angle = component.getAtMostOneRelatedScalarDouble(ProcessResource.plant3Dresource.HasRotationAngle); double componentAngle = 0.0; if (angle != null) componentAngle = angle; AxisAngle4d aa = ControlPointTools.getControlPointRotation(pcp, componentAngle); update(aa); */ } public void dispose() { //monitor.dispose(); super.dispose(); } }