X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=dev%2Forg.simantics.proconf.processeditor%2Fsrc%2Ffi%2Fvtt%2Fsimantics%2Fprocesseditor%2Fscenegraph%2FPipeComponentNode.java;fp=dev%2Forg.simantics.proconf.processeditor%2Fsrc%2Ffi%2Fvtt%2Fsimantics%2Fprocesseditor%2Fscenegraph%2FPipeComponentNode.java;h=0000000000000000000000000000000000000000;hb=08b4270a57ad14a50efa10bf36236d24d8e12fd9;hp=2c204a278fb50f62d7056403cc29fad6cad4bae4;hpb=c438604e3e6917205b9def75b17d5050041a3a1b;p=simantics%2F3d.git diff --git a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeComponentNode.java b/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeComponentNode.java deleted file mode 100644 index 2c204a27..00000000 --- a/dev/org.simantics.proconf.processeditor/src/fi/vtt/simantics/processeditor/scenegraph/PipeComponentNode.java +++ /dev/null @@ -1,107 +0,0 @@ -package fi.vtt.simantics.processeditor.scenegraph; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.vecmath.AxisAngle4d; -import javax.vecmath.Quat4d; - -import org.simantics.db.Graph; -import org.simantics.db.Resource; -import org.simantics.layer0.utils.EntityFactory; -import org.simantics.layer0.utils.IEntity; -import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase; -import org.simantics.proconf.g3d.scenegraph.IGraphicsNode; -import org.simantics.proconf.g3d.scenegraph.ShapeNode; - -import com.jme.math.Quaternion; -import com.jme.renderer.ColorRGBA; -import com.jme.scene.Geometry; -import com.jme.scene.state.MaterialState; -import com.jme.scene.state.RenderState; - -import fi.vtt.simantics.processeditor.ProcessResource; -import fi.vtt.simantics.processeditor.common.ControlPointTools; -import fi.vtt.simantics.processeditor.common.PipingTools; -import fi.vtt.simantics.processeditor.stubs.CodedComponent; -import fi.vtt.simantics.processeditor.stubs.PipeControlPoint; -import fi.vtt.simantics.processeditor.stubs.Plant3DResource; -import fi.vtt.simantics.processeditor.stubs.SizeChangeControlPoint; - - -/** - * This is for hard-coded geometries - * TODO : we need an extension point for geometries, - * so that other code-based geometries can be supported - * - * - * @author Marko Luukkainen - * - */ -public class PipeComponentNode extends ShapeNode { - - enum Type{ELBOW,STRAIGHT,REDUCER}; - - Type type; - Resource controlPoint; - - - public PipeComponentNode(ThreeDimensionalEditorBase editor, IGraphicsNode parent, Graph graph, Resource resource) { - super(editor, parent, graph, resource); - CodedComponent component = new CodedComponent(graph,resource); - PipeControlPoint cp = component.getControlPoint(); - Plant3DResource p3r = ProcessResource.plant3Dresource; - controlPoint = cp.getResource(); - - if (component.isInstanceOf(p3r.Elbow)) { - type = Type.ELBOW; - } else if (component.isInstanceOf(p3r.Straight)) { - type = Type.STRAIGHT; - } else if (component.isInstanceOf(p3r.Elbow)) { - type = Type.REDUCER; - } - - - } - - @Override - public Collection getMaterial() { - MaterialState ms = null; - ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState(); - ms.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.f)); - ms.setSpecular(new ColorRGBA(1.f,1.f,1.f,1.f)); - ms.setEnabled(true); - ms.setShininess(128.f); - if (type == Type.ELBOW) { - ms.setDiffuse(new ColorRGBA(0.5f,0.5f,0.5f,0.f)); - ms.setAmbient(new ColorRGBA(0.5f,0.5f,0.5f,0.f)); - } else if (type == Type.STRAIGHT) { - ms.setDiffuse(new ColorRGBA(0.75f,0.75f,0.75f,0.f)); - ms.setAmbient(new ColorRGBA(0.75f,0.75f,0.75f,0.f)); - } else { - ms.setDiffuse(new ColorRGBA(0.6f,0.6f,0.6f,0.f)); - ms.setAmbient(new ColorRGBA(0.6f,0.6f,0.6f,0.f)); - } - List states = new ArrayList(); - states.add(ms); - return states; - } - - - @Override - public void updateTransform(Graph graph) { - if (type == Type.REDUCER) { - SizeChangeControlPoint sccp = new SizeChangeControlPoint(graph, controlPoint); - Quat4d q = ControlPointTools.getControlPointLocalOrientationQuat(sccp, sccp.getRotationAngle()[0], true); - update(q); - } - if (type != Type.STRAIGHT) { - super.updateTransform(graph); - } else { - transform.setLocalTranslation(0.f,0.f,0.f); - transform.setLocalRotation(new Quaternion()); - } - } - -}