[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view PopupMenu.java, 1.58, 1.59
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2013-06-01 08:02:37
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv922/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: Cleanup Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** PopupMenu.java 6 Mar 2012 09:28:16 -0000 1.58 --- PopupMenu.java 1 Jun 2013 08:02:32 -0000 1.59 *************** *** 102,133 **** }; menu.add(focus); - AbstractAction holeanalysis = new EntityMenuAction(s, "Hole analysis") { - public void actionPerformed(ActionEvent arg0) { - Surface surface = (Surface)entity; - Geometry.holeAnalysis(surface); - } - }; - menu.add(holeanalysis); - /* - AbstractAction flip = new EntityMenuAction(s, "Flip") { - public void actionPerformed(ActionEvent arg0) { - Surface surface = (Surface) entity; - surface.flip(); - } - }; - menu.add(flip); - */ - { - AbstractAction action = new EntityMenuAction(s, "Assign from Neighbours") { - public void actionPerformed(ActionEvent event) { - Surface surface = (Surface) entity; - SpaceAnalysis analysis = new SpaceAnalysis(); - analysis.subsume(surface, 1); - analysis.subsume(surface, -1); - } - }; - menu.add(action); - } - { AbstractAction action = new GeometricMenuAction(surfaces, "Offset Planar...") { --- 102,105 ---- *************** *** 328,355 **** menu.add(action); } - { - AbstractAction action = new CollectionMenuAction(s, "Remove Instances") { - public void actionPerformed(ActionEvent event) { - List<Space> spaces = new LinkedList(col); - for (Space space : spaces) { - List<Instance> instances = space.collectInstances(); - for (Instance current : instances) { - Space duplicate = current.duplicate(); - Space owner = current.getOwner(); - owner.add(duplicate); - current.delete(); - } - } - Project.getInstance().changed(); - Project.getInstance().checkpoint(); - } - }; - menu.add(action); - } if (s.size() == 1) { // Some options do only apply to one space Space target = (Space) s.iterator().next(); ! AbstractAction edit = new SpaceMenuAction(target, "Edit") { public void actionPerformed(ActionEvent arg0) { space.edit(); --- 300,308 ---- menu.add(action); } if (s.size() == 1) { // Some options do only apply to one space Space target = (Space) s.iterator().next(); ! AbstractAction edit = new SpaceMenuAction(target, "Enter Space") { public void actionPerformed(ActionEvent arg0) { space.edit(); *************** *** 367,401 **** menu.add(action); } - { - AbstractAction action = new SpaceMenuAction(target, "Clear") { - public void actionPerformed(ActionEvent event) { - space.clear(); - Project.getInstance().changed(); - Project.getInstance().checkpoint(); - } - }; - menu.add(action); - } - if (CHECKS) { - AbstractAction action = new SpaceMenuAction(target, "Normals") { - public void actionPerformed(ActionEvent event) { - Space union = Space.createConstructionSpace("Normals"); - for (Surface surface : space.getSurfaces()) { - Vertex normal = surface.normal(); - Vertex origin = surface.center(); - CoordinateSystem system = CoordinateSystem.systemFor(origin, normal); - Space pyramid = Command.Pyramid.pyramid(0.05, 0.05, 0.2); - for (Vertex current : pyramid.getVertices()) { - current.set(system.unTranslate(current)); - } - union.add(pyramid); - } - Project.getInstance().world().add(union); - Project.getInstance().changed(); - Project.getInstance().checkpoint(); - } - }; - menu.add(action); - } { --- 320,323 ---- *************** *** 433,453 **** }; menu.add(check); - AbstractAction modCheck = new SpaceMenuAction(target, "Modellor Check") { - public void actionPerformed(ActionEvent arg0) { - log.info(space.getModellor()); - } - }; - menu.add(modCheck); - { - AbstractAction action = new SpaceMenuAction(target, "Print Classification") { - public void actionPerformed(ActionEvent event) { - Classification classification = space.getClassification(); - System.out.println("id " + classification.getFullId(space)); - ClassificationType type = space.getClassificationType(); - System.out.println("type " + type.getIndex()); - } - }; - menu.add(action); - } } --- 355,358 ---- *************** *** 478,491 **** } } - - JMenu mm = new JMenu("Modellors"); - Collection c = Modellor.getRegisteredModellors(); - Iterator iter = c.iterator(); - while (iter.hasNext()) { - Modellor m = (Modellor)iter.next(); - AbstractAction modellor = new ModellorMenuAction(target, m); - mm.add(modellor); - } - menu.add(mm); } return menu; --- 383,386 ---- *************** *** 531,550 **** }; menu.add(delete); { ! AbstractAction flip = new GeometricMenuAction(arguments, "flip normals") { ! public void actionPerformed(ActionEvent arg0) { ! //Selection.primary().clear(); ! for (Geometric current : entities) { ! if (current instanceof Surface) { ! Surface surface = (Surface) current; ! surface.flip(); } ! } } - }; - menu.add(flip); } //Submenu for normal flip algorithms ! { JMenu normalMenu = new JMenu("normals"); { --- 426,454 ---- }; menu.add(delete); + boolean containsSurface = false; + for (Geometric current : arguments) { + if (current instanceof Surface) { + containsSurface = true; + } + } { ! ! if (containsSurface) { ! AbstractAction flip = new GeometricMenuAction(arguments, "flip normals") { ! public void actionPerformed(ActionEvent arg0) { ! //Selection.primary().clear(); ! for (Geometric current : entities) { ! if (current instanceof Surface) { ! Surface surface = (Surface) current; ! surface.flip(); ! } ! } } ! }; ! menu.add(flip); } } //Submenu for normal flip algorithms ! if (containsSurface) { JMenu normalMenu = new JMenu("normals"); { |