X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2FGeometryComponent.java;h=a25bd4ef63523e11f27a85a7f3b8cd7b5583899a;hb=HEAD;hp=a11f912d1609230e34bccf1246fac5dc178d44f1;hpb=86739231beb0535bde4abae49d2011e3a042810b;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java index a11f912d..a25bd4ef 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java @@ -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; @@ -16,6 +17,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 +25,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 +43,11 @@ public class GeometryComponent { private GeometryProvider geometryProvider; public GeometryComponent() { - currentParameters = new HashMap(); - calculatedParameters = new HashMap(); + currentParameters = new HashMap<>(); + calculatedParameters = new HashMap<>(); } - public void visualize(vtkPanel panel) { + public void visualize(VtkView panel) { if (geometryProvider != null) { updateParameters(); @@ -117,6 +118,13 @@ public class GeometryComponent { return calculatedParameters; } + public Map getTotalParameters() { + Map 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; @@ -183,7 +194,7 @@ public class GeometryComponent { public void stopVisualize() { if (solidObject != null) { - solidObject.clearActorsAWT(); + solidObject.clearActorsVTK(); solidObject = null; } if (solidModel != null) { @@ -191,7 +202,7 @@ public class GeometryComponent { solidModel = null; } if (meshObject != null) { - meshObject.clearActorsAWT(); + meshObject.clearActorsVTK(); meshObject = null; } if (mesh != null) @@ -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();