+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.processeditor.common;\r
-\r
-\r
-public class PipingTools {\r
-// private static final boolean DEBUG = true;\r
-// \r
-//\r
-// \r
-// /**\r
-// * Splits straigth by inserting new controlpoint between straight ends.\r
-// * @param straight\r
-// * @param newPcp\r
-// * @throws TransactionException\r
-// */\r
-//// public static void insertControlPoint(Straight straight, PipeControlPoint newPcp) throws TransactionException {\r
-//// if (straight == null || newPcp == null) {\r
-//// ErrorLogger.defaultLogError("Routing pipe, cannot make branch: straight or control point is null", null);\r
-//// return;\r
-//// }\r
-//// PipeControlPoint scp = straight.getHasControlPoint();\r
-//// PipeControlPoint straightStart = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getPreviousPoint().getResource());\r
-//// PipeControlPoint straightEnd = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getNext().getResource());\r
-//// if (DEBUG) System.out.println("PipingTools inserting control point between " + straightStart.getResource() + " " + straightEnd.getResource() + " straight " + straight.getResource());\r
-//// \r
-//// // remove the straight pipe \r
-//// PipeControlPoint temp = PipeControlPointFactory.instantiate(newPcp.getGraph());\r
-//// //straight.setHasNextControlPoint(temp);\r
-//// //straight.setHasPreviousControlPoint(temp); \r
-//// straight.setHasControlPoint(temp);\r
-//// \r
-//// PipeRun pipeRun = getPipeRun(straight);\r
-//// if (pipeRun != null) {\r
-//// pipeRun.getHasSubnodesSet().remove(straight.getResource());\r
-//// }\r
-//// insertControlPoint(pipeRun, newPcp, straightStart, straightEnd);\r
-//// \r
-//// }\r
-// \r
-//\r
-//\r
-// \r
-// \r
-// \r
-// \r
-// \r
-// public static void getStraightPipeEnds(Straight straight, Point3d end1, Point3d end2) {\r
-// getStraightPipeEnds(getPipeRun(straight), straight, end1, end2);\r
-// }\r
-// \r
-// public static void getStraightPipeEnds(PipeRun pipeRun,Straight straight, Point3d end1, Point3d end2) {\r
-// if (DEBUG) System.out.println("PipingTools.getStraightPipeEnds() " + straight.getResource());\r
-// PipeControlPoint scp = straight.getHasControlPoint();\r
-// PipeControlPoint startControlPoint = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getPrevious().getResource());\r
-// PipeControlPoint endControlPoint = (PipeControlPoint)StubFactory.getStubForResource(straight.getClass().getClassLoader(),scp.getNext().getResource());\r
-// if (startControlPoint == null || endControlPoint == null) {\r
-// ErrorLogger.defaultLogError("Pipe ends null", new NullPointerException());\r
-// }\r
-// // start and end position of the pipe\r
-// // positions may be linked to other components, like nozzles\r
-// // and then their coordinates are in component's local coordinates\r
-// // which must be transformed into pipeRun's local coordinates\r
-// \r
-// //Point3d startPipe = getLocalPoint(pipeRun,startControlPoint);\r
-//\r
-// \r
-// //Point3d endPipe = getLocalPoint(pipeRun, endControlPoint);\r
-// Point3d startPipe = G3DTools.getPoint(startControlPoint.getLocalPosition());\r
-// Point3d endPipe = G3DTools.getPoint(endControlPoint.getLocalPosition());\r
-// if (startPipe == null || endPipe == null) {\r
-// end1.x = Double.NaN;\r
-// end1.y = Double.NaN;\r
-// end1.z = Double.NaN;\r
-// end2.x = Double.NaN;\r
-// end2.y = Double.NaN;\r
-// end2.z = Double.NaN;\r
-// if (DEBUG) System.out.println("no positions");\r
-// return;\r
-// }\r
-// \r
-// Vector3d dir = new Vector3d(endPipe);\r
-// dir.sub(startPipe);\r
-// \r
-//\r
-// if (startControlPoint instanceof TurnControlPoint) {\r
-// TurnControlPoint t = (TurnControlPoint)startControlPoint;\r
-// double R = t.getComponentOffsetValue();\r
-// Vector3d n = new Vector3d(dir);\r
-// n.normalize();\r
-// n.scale(R);\r
-// startPipe.add(n);\r
-// } else if (startControlPoint instanceof InlineControlPoint && !(startControlPoint instanceof BranchControlPoint)) {\r
-// InlineControlPoint t = (InlineControlPoint)startControlPoint;\r
-// double R = t.getNextComponentOffsetValue();\r
-// Vector3d n = new Vector3d(dir);\r
-// n.normalize();\r
-// n.scale(R);\r
-// startPipe.add(n);\r
-// }\r
-//\r
-// if (endControlPoint instanceof TurnControlPoint) {\r
-// TurnControlPoint t = (TurnControlPoint)endControlPoint;\r
-// double R = t.getComponentOffsetValue();\r
-// Vector3d n = new Vector3d(dir);\r
-// n.normalize();\r
-// n.scale(R);\r
-// endPipe.sub(n);\r
-// } else if (endControlPoint instanceof InlineControlPoint && !(endControlPoint instanceof BranchControlPoint)) {\r
-// InlineControlPoint t = (InlineControlPoint)endControlPoint;\r
-// double R = t.getPreviousComponentOffsetValue();\r
-// Vector3d n = new Vector3d(dir);\r
-// n.normalize();\r
-// n.scale(R);\r
-// endPipe.sub(n);\r
-// }\r
-// \r
-// end1.x = startPipe.x;\r
-// end1.y = startPipe.y;\r
-// end1.z = startPipe.z;\r
-// \r
-// end2.x = endPipe.x;\r
-// end2.y = endPipe.y;\r
-// end2.z = endPipe.z;\r
-// \r
-// }\r
-// \r
-// /**\r
-// * Finds direction and ends where inline component, reducer or branch can be moved.\r
-// * @param icp\r
-// * @param s\r
-// * @param e\r
-// * @param d\r
-// */\r
-// public static void getInlineEnds(InlineControlPoint icp, Vector3d s, Vector3d e, Vector3d d) {\r
-// \r
-// PipeControlPoint next = (PipeControlPoint)StubFactory.getStubForResource(icp.getClass().getClassLoader(), icp.getNext().getResource());\r
-// PipeControlPoint prev = (PipeControlPoint)StubFactory.getStubForResource(icp.getClass().getClassLoader(), icp.getPrevious().getResource());\r
-// Vector3d start = G3DTools.getVector(prev.getLocalPosition());\r
-// Vector3d end = G3DTools.getVector(next.getLocalPosition());\r
-// if (icp.getResource().isInstanceOf(GlobalIdMap.get(PSK3DModelingOntologyMapping.SIZE_CHANGE_CONTROL_POINT))) {\r
-// SizeChangeControlPoint sccp = SizeChangeControlPointFactory.create(icp.getResource());\r
-// Vector3d tDir = new Vector3d(G3DTools.getVector(sccp.getLocalPosition()));\r
-// Vector3d offset = getSizeChangeOffsetVector(sccp, tDir);\r
-// end.sub(offset);\r
-// }\r
-// Vector3d dir = new Vector3d(end);\r
-// dir.sub(start);\r
-// Vector3d n = new Vector3d(dir);\r
-// n.normalize();\r
-// \r
-// double offset = icp.getNextComponentOffsetValue();\r
-// if (next instanceof InlineControlPoint) {\r
-// InlineControlPoint ip = (InlineControlPoint) next;\r
-// offset += ip.getPreviousComponentOffsetValue(); \r
-// }\r
-// else if (next instanceof TurnControlPoint) {\r
-// TurnControlPoint tcp = (TurnControlPoint)next;\r
-// offset += tcp.getComponentOffsetValue();\r
-// }\r
-// Vector3d t = new Vector3d(n);\r
-// t.scale(offset);\r
-// end.sub(t);\r
-// \r
-// offset = icp.getPreviousComponentOffsetValue();\r
-// if (prev instanceof InlineControlPoint) {\r
-// InlineControlPoint ip = (InlineControlPoint) prev;\r
-// offset += ip.getPreviousComponentOffsetValue();\r
-// }\r
-// else if (prev instanceof TurnControlPoint) {\r
-// TurnControlPoint tcp = (TurnControlPoint)prev;\r
-// offset += tcp.getComponentOffsetValue();\r
-// }\r
-// t = new Vector3d(n);\r
-// t.scale(offset);\r
-// start.add(t);\r
-// \r
-// dir= new Vector3d(end);\r
-// dir.sub(start);\r
-// \r
-// s.x = start.x;\r
-// s.y = start.y;\r
-// s.z = start.z;\r
-// \r
-// e.x = end.x;\r
-// e.y = end.y;\r
-// e.z = end.z;\r
-// \r
-// d.x = dir.x;\r
-// d.y = dir.y;\r
-// d.z = dir.z;\r
-// \r
-// System.out.println("PipingTools.getInlineEnds() " + s + " " + e + " " + d);\r
-// }\r
-// \r
-// \r
-// public static void setSame(fi.vtt.simantics.layer0.stubs.Double d1, fi.vtt.simantics.layer0.stubs.Double d2) {\r
-// d1.getResource().createRelation(d2.getResource(), GlobalIdMap.get(PSK3DModelingOntologyMapping.IS_SAME_VALUE));\r
-// }\r
-// \r
-// public static void setHalf(fi.vtt.simantics.layer0.stubs.Double d1, fi.vtt.simantics.layer0.stubs.Double d2) {\r
-// d1.getResource().createRelation(d2.getResource(), GlobalIdMap.get(PSK3DModelingOntologyMapping.IS_HALF_OF_THE_VALUE));\r
-// }\r
-// \r
-// \r
-// \r
-\r
-// \r
-//\r
-// \r
-// \r
-// \r
-// \r
-// \r
-// \r
-\r
-}
\ No newline at end of file