]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java
Allow multiple radii for turns.
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / GeometryComponent.java
index a11f912d1609230e34bccf1246fac5dc178d44f1..6c6c1b66a7f555b4097197a6473c6312b258abce 100644 (file)
@@ -16,6 +16,7 @@ import org.simantics.g3d.scenegraph.MeshProvider;
 import org.simantics.g3d.scenegraph.NodeHighlighter.HighlightEventType;
 import org.simantics.g3d.scenegraph.ParametricGeometryProvider;
 import org.simantics.g3d.shape.Mesh;
+import org.simantics.g3d.vtk.common.VtkView;
 import org.simantics.g3d.vtk.shape.MeshActor;
 import org.simantics.g3d.vtk.shape.vtkMeshObject;
 import org.simantics.opencascade.OccTriangulator;
@@ -23,7 +24,6 @@ import org.simantics.opencascade.SolidModelProvider;
 import org.simantics.opencascade.vtk.vtkSolidObject;
 
 import vtk.vtkActor;
-import vtk.vtkPanel;
 import vtk.vtkProp3D;
 import vtk.vtkProperty;
 
@@ -42,11 +42,11 @@ public class GeometryComponent {
        private GeometryProvider geometryProvider;
        
        public GeometryComponent() {
-               currentParameters = new HashMap<String, Object>();
-               calculatedParameters = new HashMap<String, Object>();
+               currentParameters = new HashMap<>();
+               calculatedParameters = new HashMap<>();
        }
        
-       public void visualize(vtkPanel panel) {
+       public void visualize(VtkView panel) {
                if (geometryProvider != null) {
                        updateParameters();
                        
@@ -117,6 +117,13 @@ public class GeometryComponent {
                return calculatedParameters;
        }
        
+       public Map<String, Object> getTotalParameters() {
+        Map<String,Object> params = new HashMap<>();
+        params.putAll(currentParameters);
+        params.putAll(calculatedParameters);
+        return params;
+    }
+       
        public void setParametersUpdated(boolean parametersUpdated) {
                this.parametersUpdated = parametersUpdated;
        }
@@ -128,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;
@@ -183,7 +193,7 @@ public class GeometryComponent {
        
        public void stopVisualize() {
                if (solidObject != null) {
-                       solidObject.clearActorsAWT();
+                       solidObject.clearActorsVTK();
                        solidObject = null;
                }
                if (solidModel != null) {
@@ -191,7 +201,7 @@ public class GeometryComponent {
                        solidModel = null;
                }
                if (meshObject != null) {
-                       meshObject.clearActorsAWT();
+                       meshObject.clearActorsVTK();
                        meshObject = null;
                }
                if (mesh != null)