[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui PopupMenu.java, 1.58, 1.59 GUI.java, 1.7
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-10-29 18:13:01
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24125/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java GUI.java Log Message: changed make union operation to use method in space Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** PopupMenu.java 26 Oct 2007 13:01:24 -0000 1.58 --- PopupMenu.java 29 Oct 2007 18:13:04 -0000 1.59 *************** *** 9,17 **** import java.awt.event.ActionEvent; import java.util.Collection; - import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; - import java.util.Map; import java.util.Set; --- 9,15 ---- *************** *** 237,240 **** --- 235,239 ---- Space space = (Space)iter.next(); Space spaceCopy = space.copy(); + space.getOwner().add(spaceCopy); Selection.primary().set(spaceCopy); Project.getInstance().checkpoint(); *************** *** 419,517 **** if (ent instanceof Space) { interior.add((Space) ent); - } else if (ent instanceof Surface) { - surfaces.add((Surface)ent); } } ! for (Space space : interior) { ! surfaces.addAll(space.getEnvelope()); ! spaces.add(space); ! owner = space.getOwner(); ! } ! ! for (Surface surface : surfaces) { ! owner = surface.getOwner(); ! Space empty = owner.getEmpty(); ! if (surface.getFrontDomain() != empty) { ! spaces.add(surface.getFrontDomain()); ! } ! if (surface.getBackDomain() != empty) { ! spaces.add(surface.getBackDomain()); ! } ! } ! ! Collection<Surface> inside = new LinkedList<Surface>(); ! Collection<Surface> border = new LinkedList<Surface>(); ! for (Surface surface : surfaces) { ! if (interior.contains(surface.getFrontDomain()) && ! interior.contains(surface.getBackDomain())) { ! inside.add(surface); ! } else { ! border.add(surface); ! } ! } ! Space union = owner.createUnion("Union"); ! ! Map<Geometric, Geometric> map = new HashMap<Geometric, Geometric>(); ! ! for (Space space : spaces) { ! Space copy = space.simpleCopy(); ! map.put(space, copy); ! union.add(copy); ! } ! ! Collection<Surface> all = new LinkedList<Surface>(); ! Collection<Surface> deletion = new LinkedList<Surface>(); ! ! for (Surface surface : inside) { ! Surface copy = (Surface) surface.copy(map); ! Space front = surface.getFrontDomain(); ! if (front != owner.getEmpty()) { ! Space newFront = (Space) map.get(front); ! if (newFront != null) { ! copy.setFrontDomain(newFront); ! } ! } ! Space back = surface.getBackDomain(); ! if (back != owner.getEmpty()) { ! Space newBack = (Space) map.get(back); ! if (newBack != null) { ! copy.setBackDomain(newBack); ! } ! } ! all.add(copy); ! deletion.add(surface); ! } ! for (Surface surface : border) { ! Surface copy = (Surface) surface.copy(map); ! Space front = surface.getFrontDomain(); ! if (front != owner.getEmpty()) { ! Space newFront = (Space) map.get(front); ! if (newFront != null) { ! copy.setFrontDomain(newFront); ! } ! } ! Space back = surface.getBackDomain(); ! if (back != owner.getEmpty()) { ! Space newBack = (Space) map.get(back); ! if (newBack != null) { ! copy.setBackDomain(newBack); ! } ! } ! all.add(copy); ! if (front == owner.getEmpty() || back == owner.getEmpty()) { ! deletion.add(surface); ! } ! } ! union.addAll(all); ! for (Geometric geometric : deletion) { ! geometric.delete(); ! } ! for (Space space : spaces) { ! space.delete(); ! } ! owner.add(union); Project.getInstance().changed(owner); - Selection.primary().set(union); Project.getInstance().checkpoint(); } --- 418,426 ---- if (ent instanceof Space) { interior.add((Space) ent); } } ! Space.makeUnion(interior); Project.getInstance().changed(owner); Project.getInstance().checkpoint(); } Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** GUI.java 22 Oct 2007 10:00:17 -0000 1.78 --- GUI.java 29 Oct 2007 18:13:04 -0000 1.79 *************** *** 403,407 **** Geometric g = iter.next(); if (g instanceof Space) { ! copied.add(((Space)g).copy()); } else if (g instanceof Edge) { Edge copy = ((Edge)g).copy(); --- 403,409 ---- Geometric g = iter.next(); if (g instanceof Space) { ! Space copy = ((Space)g).copy(); ! g.getOwner().add(copy); ! copied.add(copy); } else if (g instanceof Edge) { Edge copy = ((Edge)g).copy(); *************** *** 430,433 **** --- 432,437 ---- } Selection.primary().set(copied); + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } }); |