[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool SpaceTool.java,1.12,1.13
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-02-06 14:27:10
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5071/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Draws interior mesh in spaces. PopupMenu for adding LayerModellor (does not work properly yet). Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SpaceTool.java 6 Feb 2006 07:41:15 -0000 1.12 --- SpaceTool.java 6 Feb 2006 14:26:57 -0000 1.13 *************** *** 27,30 **** --- 27,31 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.LayerModellor; import net.sourceforge.bprocessor.model.Modellor; import net.sourceforge.bprocessor.model.Project; *************** *** 82,85 **** --- 83,120 ---- } + + /** + * MenuAction for making layers on spaces + */ + protected class LayerAction extends MenuAction { + /** The space */ + private Space space; + + /** The surface */ + private Surface surface; + + /** + * Constructor + * @param space The space + * @param surface The surface + */ + public LayerAction(Space space, Surface surface) { + super(); + this.space = space; + this.surface = surface; + } + + /** + * ActionPerformed + * @param event The action event + */ + public void actionPerformed(ActionEvent event) { + if (space != null) { + Modellor modellor = new LayerModellor(space, surface, 0.5); + modellor.update(modellor); + } + } + } + /** * Create a popup for performing operations on selection *************** *** 87,112 **** */ protected JPopupMenu makeSelectionMenu() { ! JPopupMenu menu = new JPopupMenu(); ! JMenuItem offsetItem = new JMenuItem("Offset Constraint"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! addOffsetConstraint(selection); } ! } ! ); ! menu.add(offsetItem); ! menu.addSeparator(); ! JMenuItem cylinderItem = new JMenuItem("Cylinder"); ! cylinderItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! createCylinder(selection); ! } ! } ! ); ! menu.add(cylinderItem); ! return menu; } --- 122,177 ---- */ protected JPopupMenu makeSelectionMenu() { ! ! if (target instanceof String) { ! String type = (String) target; ! JPopupMenu menu = new JPopupMenu(); ! JMenuItem layerItem = new JMenuItem("Layer"); ! System.out.println(target); ! Surface surface = null; ! Space space = null; ! ! Iterator iter = selection.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (current instanceof Surface) { ! surface = (Surface) current; ! } } ! if (surface != null) { ! if (type.equals("front")) { ! space = surface.getFrontDomain(); ! } ! if (type.equals("back")) { ! space = surface.getBackDomain(); ! } ! } ! layerItem.addActionListener(new LayerAction(space, surface)); ! menu.add(layerItem); ! return menu; ! } else { ! JPopupMenu menu = new JPopupMenu(); ! JMenuItem offsetItem = new JMenuItem("Offset Constraint"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! addOffsetConstraint(selection); ! } ! } ! ); ! menu.add(offsetItem); ! menu.addSeparator(); ! JMenuItem cylinderItem = new JMenuItem("Cylinder"); ! cylinderItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! createCylinder(selection); ! } ! } ! ); ! menu.add(cylinderItem); ! ! return menu; ! } } |