protected void removeMap(E node) {
Collection<vtkProp> coll = nodeToActor.getValuesUnsafe(node);
- for (vtkProp p : coll) {
- actorToNode.remove(p);
+ if (coll.size() > 0) {
+ view.lock();
+ for (vtkProp p : coll) {
+ actorToNode.remove(p);
+ if (p.GetVTKId() != 0) {
+ view.getRenderer().RemoveActor(p);
+ p.Delete();
+ }
+ }
+ view.unlock();
}
nodeToActor.remove(node);
}
if (runUndo && useFullSyncWithUndo) {
reset(graph);
} else {
- synchronized (syncMutex) {
+ synchronized (syncMutex) {
graphUpdates = true;
for (DBObject domainObject : mapping.getDomainModified()) {
@SuppressWarnings("unchecked")
syncDeletes();
clearDeletes();
graphUpdates = false;
- }
+ }
}
if (mapping.isRangeModified() && !runUndo && !runRedo)
E n = stack.pop();
boolean conflict = filterChange(removed, n);
if (conflict) {
- System.out.println("Prevent removing " + n);
+ if (DEBUG) System.out.println("Prevent removing " + n);
//filterChange(added, n)
if (filterChange(added, n))
- System.out.println("Prevent adding " + n);
+ if (DEBUG) System.out.println("Prevent adding " + n);
}
if (n instanceof ParentNode) {
ParentNode<INode> pn = (ParentNode<INode>)n;
}
-
for (Pair<E, String> n : rem) {
stopListening(n.first);
removeActor(n.first);
+ n.first.remove();
}
- for (Pair<E, String> n : add) {
- addActor(n.first);
- listen(n.first);
- }
+ for (Pair<E, String> n : add) {
+ addActor(n.first);
+ listen(n.first);
+ }
for (E e : mod.getKeys()) {
Set<String> ids = mod.getValues(e);
}
}
-// synchronized (syncMutex) {
-// rem.addAll(removed);
-// add.addAll(added);
-// //mod.addAll(updated);
-// for (E e : updated.getKeys()) {
-// for (String s : updated.getValues(e))
-// mod.add(e, s);
-// }
-//
-// removed.clear();
-// added.clear();
-// updated.clear();
-// }
-
for (E e : mod.getKeys()) {
Set<String> ids = mod.getValues(e);
updateActor(e,ids);
}
-
-
+
for (Pair<E, String> n : rem) {
for (NodeListener l : nodeListeners)
l.nodeRemoved(null, n.first, n.second);
//FIXME : 1. sometimes removed structural models cause ObjMap to add their children again.
// removing the listener here prevents corruption of visual model, but better fix is needed.
- // 2. detach causes nodeRemoved event, which then causes other critical events to be missed. Took out th
+ // 2. detach causes nodeRemoved event, which then causes other critical events to be missed. Took out call:
//stopListening(child);
}
}
@RelatedElementsRem(Plant3D.URIs.children)
+ public void _remChild(PipelineComponent node) {
+ //since we do not now, if DB remove is actually remove or detach, we have to use detach. NodeMap will handle Component removals.
+ deattachNode(Plant3D.URIs.children, node);
+ }
+
public void remChild(PipelineComponent node) {
- removeNode(Plant3D.URIs.children, node);
+ removeNode(Plant3D.URIs.children, node);
+ }
+
+ @Override
+ public void remove() {
+ // since we do not now, if DB remove is actually remove or detach, we have to use detach. NodeMap will handle Component removals.
+ Collection<PipelineComponent> comps = getChild();
+ for (PipelineComponent c : comps)
+ c.deattach();
+ super.remove();
}
if (pcp != null && pcp.getPipelineComponent() != null) {
pcp.remove();
}
+ setPipeRun(null);
super.remove();
}
if (pcp != null && pcp.getPipelineComponent() != null) {
pcp.removeAndSplit();
}
+ setPipeRun(null);
super.remove();
}
private boolean isSizeChange = false; // changes size of the pipe. The next control point / component is on different PipeRun
private boolean isSub = false; // child point for offset / size change
+ private boolean disposed = false;
+
public PipeControlPoint(PipelineComponent component) {
this.component = component;
if (component.getPipeRun() != null)
public void _remove(boolean renconnect) {
- if (component == null && next == null && previous == null)
- return;
- if (DEBUG) System.out.println(this + " Remove " + renconnect);
+ if (disposed)
+ return;
+
+ if (DEBUG) System.out.println(this + " Remove " + renconnect);
if (getParentPoint() != null) {
getParentPoint()._remove(renconnect);
return;
}
PipeRun pipeRun = getPipeRun();
- if (pipeRun == null)
- return;
+// PipeRUn removal has been changed, so pipeRun may be null.
+// if (pipeRun == null)
+// return;
PipeControlPoint additionalRemove = null;
if (!PipingRules.isEnabled()) {
PipeControlPoint currentNext = next;
if (currentNext == null && currentPrev == null) {
removeComponent();
- pipeRun.remChild(this);
- checkRemove(pipeRun);
+ if (pipeRun != null) {
+ pipeRun.remChild(this);
+ checkRemove(pipeRun);
+ }
return;
}
if (currentNext != null && currentPrev != null) {
}
removeComponent();
- pipeRun.remChild(this);
- checkRemove(pipeRun);
- if (PipingRules.isEnabled() && pipeRun.getParent() != null && pipeRun.getControlPoints().size() > 0)
- PipingRules.validate(pipeRun);
+ if (pipeRun != null) {
+ pipeRun.remChild(this);
+ checkRemove(pipeRun);
+ if (PipingRules.isEnabled() && pipeRun.getParent() != null && pipeRun.getControlPoints().size() > 0)
+ PipingRules.validate(pipeRun);
+ }
if (additionalRemove != null)
additionalRemove.remove();
+ disposed = true;
}
/**
}
private boolean checkRemove(PipeRun pipeRun) {
+ if (pipeRun == null)
+ return false;
Collection<PipeControlPoint> points = pipeRun.getControlPoints();
if (points.size() == 0) {
pipeRun.remove();