]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java
Remove edge visualization from solid objects when not highlighted
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / GeometryComponent.java
index 9b2b750fde45a5a812f90eac25e2f47ea030cc07..a25bd4ef63523e11f27a85a7f3b8cd7b5583899a 100644 (file)
@@ -7,6 +7,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 
 import org.jcae.opencascade.jni.TopoDS_Shape;
@@ -42,8 +43,8 @@ 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(VtkView panel) {
@@ -117,6 +118,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;
        }
@@ -126,8 +134,11 @@ public class GeometryComponent {
                for (String id : parameters.keySet()) {
                        Object currentValue = currentParameters.get(id);
                        Object newValue = parameters.get(id);
-                       if (currentValue == newValue)
+                       if (Objects.equals(currentValue, newValue))
                                continue;
+                       if (newValue == null) {
+                           continue;
+                       }
                        if (currentValue instanceof Double) {
                                if (Math.abs((Double)currentValue-(Double)newValue) < MathTools.NEAR_ZERO)
                                        continue;
@@ -247,6 +258,7 @@ public class GeometryComponent {
                                if (hover)
                                        color = new double[]{1,0,1};
                                for (vtkProp3D prop : solidObject.getEdges()) {
+                                       prop.SetVisibility(hover ? 1 : 0);
                                        vtkProperty property = ((vtkActor)prop).GetProperty();
                                        property.SetColor(color);
                                        property.Delete();