PipeControlPoint pcp = getControlPoint();
// Second check is needed, when remove process is initiated from control point.
if (pcp != null && pcp.getPipelineComponent() != null) {
+ if (pcp.isSizeChange()) {
+ mergeWithAlternative();
+ }
+
pcp.remove();
}
+
setPipeRun(null);
super.remove();
}
+
+ private void mergeWithAlternative() {
+ PipeRun run = getPipeRun();
+ PipeRun alternative = getAlternativePipeRun();
+ if (alternative != null) {
+ // Move components from alternative pipe run to main run
+ PipelineComponent p = getNext();
+ while (p != null && p.getPipeRun() == alternative) {
+ if (p.getParent() == alternative) {
+ p.deattach(); // For components
+ run.addChild(p);
+ }
+ else {
+ p.setPipeRun(run); // For nozzles
+ }
+
+ p.updateParameters();
+ PipingRules.requestUpdate(p.getControlPoint());
+
+ p = p.getNext();
+ }
+
+ setAlternativePipeRun(run);
+
+ if (alternative.getChild().isEmpty())
+ alternative.remove();
+ }
+ }
public void removeAndSplit() {
PipeControlPoint pcp = getControlPoint();
if (link) {
if (currentPrev.isDirected() && currentNext.isDirected())
link = false;
- else if (this.isDualInline()) {
- link = false;
- } else if (this.isDualSub()) {
+ else if (this.isDualSub()) {
throw new RuntimeException("_remove() is called for parent point, somehow got to child point. " + this);
}
}