X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d.vtk%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fvtk%2Fcommon%2FAbstractVTKNodeMap.java;h=953ef198b2d43cbbd18c7f7285596fffaf88935c;hb=790fd1f45553169b0fdc646f85c86d9e933912a4;hp=b762200786217a0434515a068a8d0f89cbe222e6;hpb=b32696a059ab6f9e01e16df26f1cdf0d8fbf1e91;p=simantics%2F3d.git diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java index b7622007..953ef198 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/common/AbstractVTKNodeMap.java @@ -48,12 +48,12 @@ import org.simantics.utils.ui.ExceptionUtils; import vtk.vtkProp; -public abstract class AbstractVTKNodeMap implements VTKNodeMap, IMappingListener, RenderListener, NodeListener, UndoRedoSupport.ChangeListener{ +public abstract class AbstractVTKNodeMap implements VTKNodeMap, IMappingListener, RenderListener, NodeListener, UndoRedoSupport.ChangeListener{ - private static final boolean DEBUG = true; + private static final boolean DEBUG = false; protected Session session; - protected IMapping mapping; + protected IMapping mapping; protected VtkView view; protected MapList nodeToActor = new MapList(); @@ -66,7 +66,7 @@ public abstract class AbstractVTKNodeMap implements VTKNodeMap< protected int redoOpCount = 0; protected boolean runUndo = false; protected boolean runRedo = false; - public AbstractVTKNodeMap(Session session, IMapping mapping, VtkView view, ParentNode rootNode) { + public AbstractVTKNodeMap(Session session, IMapping mapping, VtkView view, ParentNode rootNode) { this.session = session; this.mapping = mapping; this.view = view; @@ -143,6 +143,10 @@ public abstract class AbstractVTKNodeMap implements VTKNodeMap< private boolean rangeModified = false; + public boolean isRangeModified() { + return rangeModified; + } + @Override public void onChanged() { try { @@ -317,10 +321,11 @@ public abstract class AbstractVTKNodeMap implements VTKNodeMap< protected void reset(ReadGraph graph) throws MappingException { if (DEBUG) System.out.println("Reset"); + synchronized (syncMutex) { graphUpdates = true; mapping.getRangeModified().clear(); - for (Object o : mapping.getDomain()) + for (DBObject o : mapping.getDomain()) mapping.domainModified(o); mapping.updateRange(graph); graphModified.clear(); @@ -337,7 +342,7 @@ public abstract class AbstractVTKNodeMap implements VTKNodeMap< } else { synchronized (syncMutex) { graphUpdates = true; - for (Object domainObject : mapping.getDomainModified()) { + for (DBObject domainObject : mapping.getDomainModified()) { E rangeObject = mapping.get(domainObject); if (rangeObject != null) graphModified.add(rangeObject); @@ -456,7 +461,10 @@ public abstract class AbstractVTKNodeMap implements VTKNodeMap< E n = stack.pop(); boolean conflict = filterChange(removed, n); if (conflict) { - filterChange(added, n); + System.out.println("Prevent removing " + n); + //filterChange(added, n) + if (filterChange(added, n)) + System.out.println("Prevent adding " + n); } if (n instanceof ParentNode) { ParentNode pn = (ParentNode)n; @@ -657,7 +665,7 @@ public abstract class AbstractVTKNodeMap implements VTKNodeMap< } - public IMapping getMapping() { + public IMapping getMapping() { return mapping; }