]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Allow multiple radii for turns. 40/3440/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 1 Nov 2019 13:09:15 +0000 (15:09 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 1 Nov 2019 13:09:15 +0000 (15:09 +0200)
Now PipeRun turnRadius is an double array. TurnComponents contain
turnRadiusIndex, which then picks specific radius for the turn.

This change also contains minor refactoring for NodeMap implementations

gitlab #43

Change-Id: I626a641135b5eff5819ce74288366ac0d9199ab8

org.simantics.g3d.csg/src/org/simantics/g3d/csg/editor/CSGNodeMap.java
org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java
org.simantics.plant3d.ontology/graph/plant3d.pgraph
org.simantics.plant3d.ontology/src/org/simantics/plant3d/ontology/Plant3D.java
org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DNodeMap.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipeRun.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java

index bcd28db4dd214fce84f9ac717c3171c18642715c..48b710f606895b789ed8e8c7a7d52104c0d777dc 100644 (file)
@@ -88,11 +88,8 @@ public class CSGNodeMap extends AbstractVTKNodeMap<Resource,ICSGnode> {
                view.lock();
                
                node.visualize(view);
-
-               for (vtkProp3D act : node.getActors()) {
-                       nodeToActor.add(node, act);
-                       actorToNode.put(act, node);
-               }
+               
+               map(node, node.getActors());
 
                view.unlock();
 
@@ -101,7 +98,7 @@ public class CSGNodeMap extends AbstractVTKNodeMap<Resource,ICSGnode> {
        
        
        private boolean hasActor(ICSGnode node) {
-               List<vtkProp> list = nodeToActor.getValues(node);
+               Collection<vtkProp> list = getRenderObjects(node);
                if (list == null || list.size() == 0)
                        return false;
                return true;
@@ -111,16 +108,11 @@ public class CSGNodeMap extends AbstractVTKNodeMap<Resource,ICSGnode> {
                if (Thread.currentThread() != view.getThreadQueue().getThread())
                        throw new RuntimeException("Illegal thread.");
 
-               List<vtkProp> list = nodeToActor.getValues(node);
-               if (list != null) {
-                       for (vtkProp obj : list) {
-                               actorToNode.remove(obj);        
-                       }
-                       nodeToActor.remove(node);
+               Collection<vtkProp> list = getRenderObjects(node);
+               if (list.size() > 0) {
+                   removeMap(node);
                        view.lock();
-                       
                        node.stopVisualize();
-                       
                        view.unlock();
                }
        }
index 953ef198b2d43cbbd18c7f7285596fffaf88935c..2c37521b8367b751451d3a73c5b02cbca60977cd 100644 (file)
@@ -56,8 +56,8 @@ public abstract class AbstractVTKNodeMap<DBObject,E extends INode> implements VT
        protected IMapping<DBObject,E> mapping;
        protected VtkView view;
        
-       protected MapList<E, vtkProp> nodeToActor = new MapList<E, vtkProp>();
-       protected Map<vtkProp,E> actorToNode = new HashMap<vtkProp, E>();
+       private MapList<E, vtkProp> nodeToActor = new MapList<E, vtkProp>();
+       private Map<vtkProp,E> actorToNode = new HashMap<vtkProp, E>();
 
        protected ParentNode<E> rootNode;
        
@@ -85,9 +85,7 @@ public abstract class AbstractVTKNodeMap<DBObject,E extends INode> implements VT
                        e.printStackTrace();
                }
        }
-       
-       
-       
+
        protected abstract void addActor(E node);
        protected abstract void removeActor(E node);
        protected abstract void updateActor(E node,Set<String> ids);
@@ -114,6 +112,21 @@ public abstract class AbstractVTKNodeMap<DBObject,E extends INode> implements VT
                return nodeToActor.getValues((E)node);
        }
        
+       protected <T extends vtkProp> void map(E node, Collection<T> props) {
+           for (vtkProp p : props) {
+               nodeToActor.add(node, p);
+               actorToNode.put(p, node);
+           }
+       }
+       
+       protected void removeMap(E node) {
+           Collection<vtkProp> coll = nodeToActor.getValuesUnsafe(node);
+           for (vtkProp p : coll) {
+               actorToNode.remove(p);
+           }
+           nodeToActor.remove(node);
+       }
+       
        @SuppressWarnings("unchecked")
        @Override
        public ParentNode<E> getRootNode() {
@@ -218,7 +231,7 @@ public abstract class AbstractVTKNodeMap<DBObject,E extends INode> implements VT
                        added.add(new Pair<E, String>(node, id));
                        rangeModified = true;
                }
-               view.refresh();
+               repaint();
        }
        
        @SuppressWarnings("unchecked")
@@ -394,7 +407,7 @@ public abstract class AbstractVTKNodeMap<DBObject,E extends INode> implements VT
        
        /**
         * When objects are removed (either from Java or Graph), after remove processing the Java objects remain in mapping cache.
-        * This causes problems with Undo and Redo, whcih the end up re-using the removed objects from mapping cache.
+        * This causes problems with Undo and Redo, which cause re-using the removed objects from mapping cache.
         * 
         * This code here synchronizes removed and added objects to collect deletable objects. (a deletable object is one which is removed but not added).  
         * 
index 7d0e4976891f8d807d24af669a6e56e704494ea8..5621443ec380e1dc77feb9f8f956dd524e17d15b 100644 (file)
@@ -113,32 +113,24 @@ P3D.HasLength <R G3D.hasNonTransformation
 P3D.HasTurnAngle <R G3D.hasNonTransformation
     L0.HasRange L0.Double
 
-//P3D.HasOffset <R L0.HasProperty
-//    L0.HasRange L0.Double
-//HasRelativePosition <R HasProperty
-//    HasRange [Position]
-//HasRelativeDirection <R HasProperty
-//    HasRange [Tuple3]
-//HasDirection <R HasProperty
-//    HasRange [Tuple3]  
+
 P3D.HasTurnRadius <R G3D.hasNonTransformation
-    L0.HasRange L0.Double   
+    L0.HasRange L0.Double
+    @L0.tag L0.Deprecated
+P3D.HasTurnRadiusArray <R G3D.hasNonTransformation
+    L0.HasRange L0.DoubleArray
+P3D.HasTurnRadiusIndex <R G3D.hasNonTransformation
+    L0.HasRange L0.Integer
 P3D.IsReversed <R L0.HasProperty
     L0.HasRange L0.Boolean
 P3D.HasTurnAxis <R G3D.hasTransformation
     L0.HasRange G3D.Tuple3D
     
-//P3D.HasNozzleDefinition <R L0.HasProperty
-//    L0.HasDomain P3D.Equipment
-//    L0.HasRange P3D.Nozzle
-//    L0.HasDescription "This relation is used to connect nozzles to equipment in the template. For instantiated equipment nozzles must be connected with HasNozzle relation." : L0.String  
 P3D.HasNozzle <R G3D.children
     L0.InverseOf P3D.NozzleOf
     L0.HasDomain P3D.Equipment
     L0.HasRange P3D.Nozzle
     L0.HasDescription "Used to connect nozzles to equipment." : L0.String
-//P3D.HasNozzleRestriction <R L0.HasProperty
-//    L0.HasDescription "Used in template equipment to restrict amount of nozzles. If template has as many nozzleDefinitions that maximum count in this restriction, user cannot add new nozzles to the equipment instance." : L0.String
 P3D.HasFixedNozzles <R L0.HasProperty
     L0.HasDescription "Number of fixed nozzles" : L0.String
     L0.HasDomain P3D.Equipment
index 69603a5230019f76bb407d53cf7528c50ced2569..1ab46e342e9f9391fa77fda930e497e13530fd35 100644 (file)
@@ -80,7 +80,11 @@ public class Plant3D {
     public final Resource HasTurnAngle_Inverse;
     public final Resource HasTurnAxis;
     public final Resource HasTurnAxis_Inverse;
-    public final Resource HasTurnRadius;
+    @Deprecated public final Resource HasTurnRadius;
+    public final Resource HasTurnRadiusArray;
+    public final Resource HasTurnRadiusArray_Inverse;
+    public final Resource HasTurnRadiusIndex;
+    public final Resource HasTurnRadiusIndex_Inverse;
     public final Resource HasTurnRadius_Inverse;
     public final Resource Images;
     public final Resource Images_Component;
@@ -195,7 +199,11 @@ public class Plant3D {
         public static final String HasTurnAngle_Inverse = "http://www.simantics.org/Plant3D-0.1/HasTurnAngle/Inverse";
         public static final String HasTurnAxis = "http://www.simantics.org/Plant3D-0.1/HasTurnAxis";
         public static final String HasTurnAxis_Inverse = "http://www.simantics.org/Plant3D-0.1/HasTurnAxis/Inverse";
-        public static final String HasTurnRadius = "http://www.simantics.org/Plant3D-0.1/HasTurnRadius";
+        @Deprecated public static final String HasTurnRadius = "http://www.simantics.org/Plant3D-0.1/HasTurnRadius";
+        public static final String HasTurnRadiusArray = "http://www.simantics.org/Plant3D-0.1/HasTurnRadiusArray";
+        public static final String HasTurnRadiusArray_Inverse = "http://www.simantics.org/Plant3D-0.1/HasTurnRadiusArray/Inverse";
+        public static final String HasTurnRadiusIndex = "http://www.simantics.org/Plant3D-0.1/HasTurnRadiusIndex";
+        public static final String HasTurnRadiusIndex_Inverse = "http://www.simantics.org/Plant3D-0.1/HasTurnRadiusIndex/Inverse";
         public static final String HasTurnRadius_Inverse = "http://www.simantics.org/Plant3D-0.1/HasTurnRadius/Inverse";
         public static final String Images = "http://www.simantics.org/Plant3D-0.1/Images";
         public static final String Images_Component = "http://www.simantics.org/Plant3D-0.1/Images/Component";
@@ -321,6 +329,10 @@ public class Plant3D {
         HasTurnAxis = getResourceOrNull(graph, URIs.HasTurnAxis);
         HasTurnAxis_Inverse = getResourceOrNull(graph, URIs.HasTurnAxis_Inverse);
         HasTurnRadius = getResourceOrNull(graph, URIs.HasTurnRadius);
+        HasTurnRadiusArray = getResourceOrNull(graph, URIs.HasTurnRadiusArray);
+        HasTurnRadiusArray_Inverse = getResourceOrNull(graph, URIs.HasTurnRadiusArray_Inverse);
+        HasTurnRadiusIndex = getResourceOrNull(graph, URIs.HasTurnRadiusIndex);
+        HasTurnRadiusIndex_Inverse = getResourceOrNull(graph, URIs.HasTurnRadiusIndex_Inverse);
         HasTurnRadius_Inverse = getResourceOrNull(graph, URIs.HasTurnRadius_Inverse);
         Images = getResourceOrNull(graph, URIs.Images);
         Images_Component = getResourceOrNull(graph, URIs.Images_Component);
index fce61be4abc5ef5e4146a341e4f7b3f9eea801ae..8daee3a530e9286a725bf5b0a113f711fd507f86 100644 (file)
@@ -71,7 +71,7 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                                if (ids.contains(id)) {
                                        node.visualize(view);
                                        updateRenderObjectsFor(node);
-                                       updateTransform(node);
+                                       //updateTransform(node);
                                        break;
                                }
                        }
@@ -83,7 +83,7 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                        for (PipeControlPoint pcp : run.getControlPoints()) {
                                updateActor(pcp, ids2);
                        }
-               }
+               } 
                
                if (ids.contains(G3D.URIs.hasPosition) || 
                        ids.contains(G3D.URIs.hasOrientation) ||
@@ -91,6 +91,10 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                        ids.contains(G3D.URIs.hasWorldOrientation)) {
                        updateTransform(node);
                }
+               if (ids.contains(Plant3D.URIs.HasTurnRadiusIndex)) {
+                   node.visualize(view);
+                   updateRenderObjectsFor(node);
+               }
        }
        
        private void updateTransform(IP3DNode node) {
@@ -150,10 +154,8 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                
                node.visualize(view);
 
-               for (vtkProp3D act : node.getActors()) {
-                       nodeToActor.add(node, act);
-                       actorToNode.put(act, node);
-               }
+               map(node, node.getActors());
+               
                if (DEBUG) System.out.println("Added " + node.getActors().size() + " actors");
                
                if (node instanceof P3DParentNode<?>) {
@@ -171,7 +173,7 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
        
        
        private boolean hasActor(IP3DVisualNode node) {
-               List<vtkProp> list = nodeToActor.getValues(node);
+               Collection<vtkProp> list = getRenderObjects(node);
                if (list == null || list.size() == 0)
                        return false;
                return true;
@@ -181,17 +183,12 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                if (Thread.currentThread() != view.getThreadQueue().getThread())
                        throw new RuntimeException("Illegal thread.");
 
-               List<vtkProp> list = nodeToActor.getValues(node);
-               if (list != null) {
-                       for (vtkProp obj : list) {
-                               actorToNode.remove(obj);        
-                       }
-                       nodeToActor.remove(node);
-                       view.lock();
-                       
-                       node.stopVisualize();
-                       
-                       view.unlock();
+               Collection<vtkProp> list = getRenderObjects(node);
+               if (list.size() > 0) {
+                   removeMap(node);
+                   view.lock();
+                   node.stopVisualize();
+                   view.unlock();
                }
        }
        
index 0e53c1b6402860f002ef301b8b0ccadd706392c5..6c6c1b66a7f555b4097197a6473c6312b258abce 100644 (file)
@@ -135,6 +135,9 @@ public class GeometryComponent {
                        Object newValue = parameters.get(id);
                        if (currentValue == newValue)
                                continue;
+                       if (newValue == null) {
+                           continue;
+                       }
                        if (currentValue instanceof Double) {
                                if (Math.abs((Double)currentValue-(Double)newValue) < MathTools.NEAR_ZERO)
                                        continue;
index 748141a586ed7438a3e4d6a329be3a51756dc420..36710e4fee17d16a5c10bed8f16b0059a38485e8 100644 (file)
@@ -29,7 +29,7 @@ import vtk.vtkRenderer;
 public class PipeRun extends P3DParentNode<IP3DNode> {
        
        private double pipeDiameter = 0.1;
-       private double turnRadius = 0.2;
+       private double[] turnRadius = new double[] {0.2};
        
        @Override
        public void update(vtkRenderer ren) {
@@ -54,15 +54,31 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
        @RelatedGetValue(Plant3D.URIs.HasTurnRadius)
        @GetPropertyValue(value=Plant3D.URIs.HasTurnRadius, name = "Elbow radius")
        public double getTurnRadius() {
-               return turnRadius;
+               return turnRadius[0];
        }
        
        @RelatedSetValue(Plant3D.URIs.HasTurnRadius)
        @SetPropertyValue(Plant3D.URIs.HasTurnRadius)
        public void setTurnRadius(double turnRadius) {
-               this.turnRadius = turnRadius;
+               this.turnRadius[0] = turnRadius;
                firePropertyChanged(Plant3D.URIs.HasTurnRadius);
-       }
+               firePropertyChanged(Plant3D.URIs.HasTurnRadiusArray);
+       }
+       
+       @RelatedGetValue(Plant3D.URIs.HasTurnRadiusArray)
+    @GetPropertyValue(value=Plant3D.URIs.HasTurnRadiusArray, name = "Elbow radius array")
+    public double[] getTurnRadiusArray() {
+        return turnRadius;
+    }
+    
+    @RelatedSetValue(Plant3D.URIs.HasTurnRadiusArray)
+    @SetPropertyValue(Plant3D.URIs.HasTurnRadiusArray)
+    public void setTurnRadiusArray(double[] turnRadiusArray) {
+        if (turnRadiusArray == null || turnRadiusArray.length == 0)
+            return;
+        this.turnRadius = turnRadiusArray;
+        firePropertyChanged(Plant3D.URIs.HasTurnRadiusArray);
+    }
        
        @RelatedGetValue(Plant3D.URIs.HasPipeDiameter)
        @GetPropertyValue(value=Plant3D.URIs.HasPipeDiameter, name = "Diameter")
@@ -131,8 +147,12 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
        public boolean equalSpecs(PipeRun other) {
                if (!MathTools.equals(pipeDiameter,other.pipeDiameter))
                        return false;
-               if (!MathTools.equals(turnRadius,other.turnRadius))
-                       return false;
+               if (turnRadius.length != other.turnRadius.length)
+                   return false;
+               for (int i = 0; i < turnRadius.length; i++) {
+                   if (!MathTools.equals(turnRadius[i],other.turnRadius[i]))
+                       return false;
+               }
                return true;
        }
        
index 35df6121bb9575b30375619cad1b83f228ebbb49..c0feb668d183ff090dad98fa81ed844cce02ab0b 100644 (file)
@@ -467,12 +467,7 @@ public abstract class PipelineComponent extends GeometryNode {
                super.setOrientation(orientation);
                if (getControlPoint() != null) {
                        getControlPoint()._setWorldOrientation(getWorldOrientation());
-                       try {
-                               PipingRules.requestUpdate(getControlPoint());
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }       
+                       PipingRules.requestUpdate(getControlPoint());
                }
        }
        
@@ -483,12 +478,7 @@ public abstract class PipelineComponent extends GeometryNode {
                super.setPosition(position);
                if (getControlPoint() != null) {
                        getControlPoint()._setWorldPosition(getWorldPosition());
-                       try {
-                               PipingRules.requestUpdate(getControlPoint());
-                       } catch (Exception e) {
-                               // TODO Auto-generated catch block
-                               e.printStackTrace();
-                       }
+                       PipingRules.requestUpdate(getControlPoint());
                }
        }
        
@@ -514,7 +504,7 @@ public abstract class PipelineComponent extends GeometryNode {
                        case END:
                                return null;
                        case TURN: {
-                               double r = getPipeRun().getTurnRadius();
+                               double r = ((TurnComponent)this).getTurnRadius();
                                double a = pcp.getTurnAngle();
                                return a*r;
                        }
@@ -523,6 +513,24 @@ public abstract class PipelineComponent extends GeometryNode {
                }
        }
        
+       /**
+        * Returns diameter of the pipe
+        * @return
+        */
+       public Double getDiameter() {
+           return getPipeRun().getPipeDiameter();
+       }
+       
+       /**
+        * Returns secondary diameter of the pipe for size change components
+        * @return
+        */
+       public Double getDiameter2() {
+           if (getAlternativePipeRun() == null)
+               return null;
+           return getAlternativePipeRun().getPipeDiameter();
+       }
+       
        public void getEnds(Tuple3d p1, Tuple3d p2) {
                getControlPoint().getControlPointEnds(p1, p2);
        }
@@ -574,7 +582,7 @@ public abstract class PipelineComponent extends GeometryNode {
                case TURN: {
                        Vector3d loc = pcp.getRealPosition(PositionType.PREVIOUS);
                        
-                       double r = getPipeRun().getTurnRadius();
+                       double r = ((TurnComponent)this).getTurnRadius();
                        double a = pcp.getTurnAngle();
                        double pipeRadius = pcp.getPipeRun().getPipeDiameter() / 2;
                        
@@ -631,7 +639,7 @@ public abstract class PipelineComponent extends GeometryNode {
                        double r2 = getAlternativePipeRun().getPipeDiameter() / 2;
                        return pcp.getLength() * Math.PI * (r1*r1 + r1*r2 + r2*r2) / 4;
                case TURN: {
-                       double r = getPipeRun().getTurnRadius();
+                       double r = ((TurnComponent)this).getTurnRadius();
                        double a = pcp.getTurnAngle();
                        return r * a * Math.PI * pipeRadius * pipeRadius;
                }
index 9a124349e7f7b950af3cf9b1423285a188fb1332..e25fd8d4ad206fbb2faae13cf9cc8a301af27676 100644 (file)
@@ -25,6 +25,7 @@ public class TurnComponent extends PipelineComponent {
        
        private String type;
        private PipeControlPoint controlPoint;
+       private Integer turnRadiusIndex;
        
        @GetType(Plant3D.URIs.TurnComponent)
        public String getType() {
@@ -52,10 +53,9 @@ public class TurnComponent extends PipelineComponent {
        public Map<String, Object> updateParameterMap() {
                Map<String,Object> map = new HashMap<String, Object>();
                
-               PipeRun pipeRun = getPipeRun();
-               if (pipeRun != null) {
-                       map.put("turnRadius", pipeRun.getTurnRadius());
-                       map.put("radius", pipeRun.getPipeDiameter() * 0.5);
+               if (getPipeRun() != null) {
+               map.put("turnRadius", getTurnRadius());
+               map.put("radius", getDiameter() * 0.5);
                }
                if (controlPoint != null && controlPoint.getTurnAngle() != null  && !Double.isNaN(controlPoint.getTurnAngle())) {
                        map.put("turnAngle", controlPoint.getTurnAngle());
@@ -103,6 +103,40 @@ public class TurnComponent extends PipelineComponent {
                return getControlPoint().getTurnAxis();
        }
        
+       @GetPropertyValue(name="Turn Radius", value=Plant3D.URIs.HasTurnRadius, tabId = "Default")
+       public Double getTurnRadius() {
+           if (turnRadiusIndex != null)
+               return getPipeRun().getTurnRadiusArray()[turnRadiusIndex];
+           return getPipeRun().getTurnRadiusArray()[0];
+       }
+       
+       @RelatedGetValue(Plant3D.URIs.HasTurnRadiusIndex)
+       @GetPropertyValue(name="Turn Radius Index", value=Plant3D.URIs.HasTurnRadiusIndex, tabId = "Default")
+       public Integer getTurnRadiusIndex() 
+       {
+        // TODO: For backwards compatibility, we do not accept null values. 
+        //       One development path would allow null index, and setting custom turn radius for the component.
+        if (turnRadiusIndex == null)
+               return 0;
+           return turnRadiusIndex;
+       }
+       
+       @RelatedSetValue(Plant3D.URIs.HasTurnRadiusIndex)
+       @SetPropertyValue(value=Plant3D.URIs.HasTurnRadiusIndex)
+    public void setTurnRadiusIndex(Integer turnRadiusIndex) {
+           if (this.turnRadiusIndex == turnRadiusIndex)
+               return;
+           if (turnRadiusIndex == null)
+               return;
+           if (turnRadiusIndex != null) {
+               if (getPipeRun().getTurnRadiusArray().length <= turnRadiusIndex)
+                   return;
+           }
+           this.turnRadiusIndex = turnRadiusIndex;
+        firePropertyChanged(Plant3D.URIs.HasTurnRadiusIndex);
+        PipingRules.requestUpdate(getControlPoint());
+    }
+       
        @RelatedGetValue(Plant3D.URIs.HasRotationAngle)
        @GetPropertyValue(name="Rotation Angle", value=Plant3D.URIs.HasRotationAngle, tabId = "Default")
        public Double getRotationAngle() {
@@ -126,12 +160,7 @@ public class TurnComponent extends PipelineComponent {
                if (controlPoint.getRotationAngle() != null && Math.abs(controlPoint.getRotationAngle()-angle) < MathTools.NEAR_ZERO)
                        return;
                controlPoint.setRotationAngle(angle);
-               try {
-                       PipingRules.requestUpdate(getControlPoint());
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }   
+               PipingRules.requestUpdate(getControlPoint());
        }
        
        @RelatedGetValue(Plant3D.URIs.IsReversed)
@@ -143,7 +172,6 @@ public class TurnComponent extends PipelineComponent {
                return d;
        }
        @RelatedSetValue(Plant3D.URIs.IsReversed)
-       //@SetPropertyValue(value=Plant3D.URIs.IsReversed)
        public void setReversed(Boolean reverse) {
                if (!controlPoint.isFixed())
                        return;
@@ -152,12 +180,7 @@ public class TurnComponent extends PipelineComponent {
                        return;
                }
                controlPoint.setReversed(reverse);
-               try {
-                       PipingRules.requestUpdate(getControlPoint());
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }   
+               PipingRules.requestUpdate(getControlPoint()); 
        }
        
        @Override
index 6c932ad853fac389f56c2a444264151afb76705e..cb76b74fe292d553215376c9468c0edb22809098 100644 (file)
@@ -1160,7 +1160,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
             
             PipeRun previousRun = previous.getPipeRun();
             nextPipeRun.setPipeDiameter(previousRun.getPipeDiameter());
-            nextPipeRun.setTurnRadius(previousRun.getTurnRadius());
+            nextPipeRun.setTurnRadiusArray(previousRun.getTurnRadiusArray());
             
             PipelineComponent n = next.getPipelineComponent();
             while (n != null) {
index 6c121d80857da7b7c920c37f73d774b14d191b62..727cf1a882e8d513fa1ab583ef2584a692054954 100644 (file)
@@ -1083,7 +1083,7 @@ public class PipingRules {
                // TODO : this returns now space for 90 deg turn.
                // The challenge: position of tcp affects the turn angle, which then affects the required space. Perhaps we need to iterate...
                // Additionally, if the path legs contain offset, using just positions of opposite path leg ends is not enough,    
-               return tcp.getPipeRun().getTurnRadius();
+               return ((TurnComponent)tcp.getPipelineComponent()).getTurnRadius();
        }
 
        private static void insertElbowUpdate(UpdateStruct2 u, PipeControlPoint dcp, PipeControlPoint next, boolean dcpStart, Vector3d position, Vector3d directedDirection) throws Exception{
@@ -1579,7 +1579,7 @@ public class PipingRules {
                        Vector3d turnAxis = new Vector3d();
                        turnAxis.cross(prev, next);
                        if (turnAxis.lengthSquared() > MathTools.NEAR_ZERO) {
-                               double elbowRadius = tcp.getPipelineComponent().getPipeRun().getTurnRadius();
+                               double elbowRadius = ((TurnComponent)tcp.getPipelineComponent()).getTurnRadius();
                                double R = elbowRadius / Math.tan(angle * 0.5);
                                
                                turnAxis.normalize();