[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui PopupMenu.java, 1.5, 1.6
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-10-03 09:19:29
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25945/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Startet implemention of union Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PopupMenu.java 2 Oct 2006 06:10:15 -0000 1.5 --- PopupMenu.java 3 Oct 2006 09:19:20 -0000 1.6 *************** *** 9,13 **** --- 9,15 ---- import java.awt.event.ActionEvent; import java.util.Collection; + import java.util.HashSet; import java.util.Iterator; + import java.util.Set; import javax.swing.AbstractAction; *************** *** 24,27 **** --- 26,30 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Project; *************** *** 30,33 **** --- 33,37 ---- import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Space; + import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; *************** *** 124,127 **** --- 128,164 ---- }; pm.add(instantiate); + AbstractAction makeunion = new AbstractAction("Make Union") { + public void actionPerformed(ActionEvent arg0) { + Set internal = new HashSet(); + { + Iterator iter = Selection.primary().iterator(); + while (iter.hasNext()) { + Geometric current = (Geometric) iter.next(); + if (current instanceof Space) { + internal.add(current); + } + } + } + Set envelope = new HashSet(); + { + Iterator iter = internal.iterator(); + while (iter.hasNext()) { + Space current = (Space) iter.next(); + Iterator sit = current.getEnvelope().iterator(); + while (sit.hasNext()) { + Surface surface = (Surface) sit.next(); + if (!internal.contains(surface.getBackDomain())) { + envelope.add(surface); + } else if (!internal.contains(surface.getFrontDomain())) { + envelope.add(surface); + } + } + } + } + Selection.primary().clear(); + Selection.primary().addAll(envelope); + } + }; + pm.add(makeunion); if (s.getLevel() < Space.PART_LEVEL) { AbstractAction edit = new SpaceMenuAction(s, "Edit") { |