bprocessor-commit Mailing List for B-processor (Page 93)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: rimestad <rim...@us...> - 2006-10-30 10:38:00
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26389/src/net/sourceforge/bprocessor/gui/treeview Modified Files: CameraTreeView.java Log Message: added current cam to the list of cams Index: CameraTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/CameraTreeView.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CameraTreeView.java 29 Sep 2006 15:07:28 -0000 1.8 --- CameraTreeView.java 30 Oct 2006 10:37:58 -0000 1.9 *************** *** 8,11 **** --- 8,12 ---- package net.sourceforge.bprocessor.gui.treeview; + import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; *************** *** 37,41 **** getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); this.addTreeSelectionListener(new SelectionListener()); ! update(Project.getInstance().getCameras(), root); model.nodeStructureChanged(root); } --- 38,45 ---- getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); this.addTreeSelectionListener(new SelectionListener()); ! Collection c = new ArrayList(); ! c.add(Project.getInstance().getCurrentCamera()); ! c.addAll(Project.getInstance().getCameras()); ! update(c, root); model.nodeStructureChanged(root); } *************** *** 115,119 **** */ public void update() { ! update(Project.getInstance().getCameras(), root); } --- 119,126 ---- */ public void update() { ! Collection c = new ArrayList(); ! c.add(Project.getInstance().getCurrentCamera()); ! c.addAll(Project.getInstance().getCameras()); ! update(c, root); } |
From: rimestad <rim...@us...> - 2006-10-30 10:37:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26353/src/net/sourceforge/bprocessor/gui/actions Added Files: CollectionMenuAction.java Log Message: made a new action for collections --- NEW FILE: CollectionMenuAction.java --- //--------------------------------------------------------------------------------- // $Id: CollectionMenuAction.java,v 1.1 2006/10/30 10:37:35 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import java.util.Collection; import javax.swing.AbstractAction; /** * Actions for a entity */ public abstract class CollectionMenuAction extends AbstractAction { /** The collection */ protected Collection col; /** * The constructor * @param c the collection * @param name the name of the action */ public CollectionMenuAction(Collection c, String name) { super(name); this.col = c; } } |
From: rimestad <rim...@us...> - 2006-10-30 10:34:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25137/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: refactored cylinder out of SpaceTool and changede som mouse checks to use isPopuptrigger instead of third button and isctrlpressed. THERE ARE SOME PROBLEMS ON MAC IF RIGHT CLICK IS ACHIEVED WITH CTRL MODIFIER BUT EXTERNAL MOUSE SHOULD BE USED NOT A TRACKPAD. Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** SpaceTool.java 27 Oct 2006 06:58:29 -0000 1.60 --- SpaceTool.java 30 Oct 2006 10:34:27 -0000 1.61 *************** *** 16,20 **** import java.io.StringReader; import java.util.ArrayList; - import java.util.Arrays; import java.util.Collection; import java.util.HashMap; --- 16,19 ---- *************** *** 23,27 **** import java.util.LinkedList; import java.util.List; - import java.util.Map; import java.util.Stack; --- 22,25 ---- *************** *** 35,40 **** --- 33,40 ---- import net.sourceforge.bprocessor.model.AxisRotate; import net.sourceforge.bprocessor.gui.PopupMenu; + import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Constructor; + import net.sourceforge.bprocessor.model.Cylinder; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; *************** *** 50,54 **** import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Geometry; - import net.sourceforge.bprocessor.model.constraints.OffsetConstraint; import net.sourceforge.bprocessor.model.evaluator.Environment; import net.sourceforge.bprocessor.model.evaluator.Function; --- 50,53 ---- *************** *** 91,94 **** --- 90,99 ---- findTarget(e); boolean done = false; + + if (e.isPopupTrigger()) { + glv.popup(makeSelectionMenu(), e.getX(), e.getY()); + done = true; + } + if (e.getButton() == MouseEvent.BUTTON1) { if (target != null) { *************** *** 100,109 **** } } - - if (e.getButton() == MouseEvent.BUTTON3 || e.isControlDown()) { - glv.popup(makeSelectionMenu(), e.getX(), e.getY()); - done = true; - } - if (!done) { super.pressed(e); --- 105,108 ---- *************** *** 118,137 **** /** - * SpaceAction for making actions on spaces - */ - protected abstract class SpaceAction extends MenuAction { - /** The space to operate on */ - protected Space space; - - /** - * Constructor - * @param space The space to operate on - */ - public SpaceAction(Space space) { - this.space = space; - } - } - - /** * MenuAction for making layers on spaces */ --- 117,120 ---- *************** *** 200,215 **** } else if (target instanceof Space) { return PopupMenu.getSpaceMenu((Space)target); } else if (target instanceof Entity) { ! JPopupMenu menu = PopupMenu.getEntityMenu((Entity) target); ! ! JMenuItem offsetItem = new JMenuItem("Offset Constraint"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! addOffsetConstraint(Selection.primary()); ! } ! } ! ); ! menu.add(offsetItem); ! return menu; } else { return null; --- 183,190 ---- } else if (target instanceof Space) { return PopupMenu.getSpaceMenu((Space)target); + } else if (target instanceof Surface) { + return PopupMenu.getSurfaceMenu((Surface) target); } else if (target instanceof Entity) { ! return PopupMenu.getEntityMenu((Entity) target); } else { return null; *************** *** 217,397 **** } else { Iterator sel = Selection.primary().iterator(); ! Collection entities = new LinkedList(); while (sel.hasNext()) { Object next = sel.next(); ! if (Selection.primary().size() == 1) { ! if (next instanceof Space) { ! return PopupMenu.getSpaceMenu((Space)next); ! } else { ! return PopupMenu.getEntityMenu((Entity)next); ! } } else { ! entities.add(next); } } ! return PopupMenu.getEntiesMenu(entities); ! } ! } ! ! /** ! * Add offset constraint to objects ! * @param objects The objects ! */ ! protected void addOffsetConstraint(Collection objects) { ! if (objects.size() == 2) { ! Iterator iter = objects.iterator(); ! Object arg1 = iter.next(); ! Object arg2 = iter.next(); ! Surface master = null; ! Surface slave = null; ! if (arg1 instanceof Surface) { ! master = (Surface) arg1; ! } ! if (arg2 instanceof Surface) { ! slave = (Surface) arg2; ! } ! if (master != null && slave != null) { ! OffsetConstraint constraint = new OffsetConstraint(master, slave); ! Project.getInstance().add(constraint); ! } ! } ! } ! ! /** ! * The cylinder class parametrically generates a cylinder. ! */ ! public class Cylinder extends Modellor { ! ! /** Default */ ! private static final long serialVersionUID = 1L; ! ! /** radius */ ! private double radius = 1.0; ! ! /** height */ ! private double height = 1.0; ! ! /** axis divisions */ ! private int axisDivisions = 12; ! ! /*** ! * Generate a Cylinder ! * @param entity Changed entity ! */ ! public void update(Object entity) { ! /** Origin */ ! Vertex o = new Vertex(0, 0, 0); ! /** Bottom vertices */ ! Vertex[] bv = new Vertex[axisDivisions]; ! /** Top vertices */ ! Vertex[] tv = new Vertex[axisDivisions]; ! /** Bottom edges */ ! Edge[] be = new Edge[axisDivisions]; ! /** Top edges */ ! Edge te[] = new Edge[axisDivisions]; ! /** Side edges */ ! Edge se[] = new Edge[axisDivisions]; ! /** Side faces */ ! Surface sf[] = new Surface[axisDivisions]; ! ! Surface top; ! Surface bottom; ! Space space = Project.getInstance().world(); ! ! for (int i = 0; i < axisDivisions; i++) { ! double angle = ((2 * Math.PI) * i) / (double) axisDivisions; ! double x = radius * Math.cos(angle) + o.getX(); ! double y = radius * Math.sin(angle) + o.getY(); ! double z = o.getZ(); ! bv[i] = new Vertex(x, y, z); ! tv[i] = new Vertex(x, y, z + height); ! space.add(bv[i]); ! space.add(tv[i]); ! } ! ! for (int i = 0; i < axisDivisions; i++) { ! be[i] = new Edge(bv[i], bv[(i + 1) % axisDivisions]); ! space.add(be[i]); ! } ! ! for (int i = 0; i < axisDivisions; i++) { ! te[i] = new Edge(tv[i], tv[(i + 1) % axisDivisions]); ! space.add(te[i]); ! } ! ! for (int i = 0; i < axisDivisions; i++) { ! se[i] = new Edge(bv[i], tv[i]); ! space.add(se[i]); ! } ! ! for (int i = 0; i < axisDivisions; i++) { ! List edges = new LinkedList(); ! edges.add(be[i]); ! edges.add(se[(i + 1) % axisDivisions]); ! edges.add(te[i]); ! edges.add(se[i]); ! sf[i] = new Surface(edges); ! space.add(sf[i]); ! } ! { ! List edges = new LinkedList(Arrays.asList(be)); ! bottom = new Surface(edges); ! space.add(bottom); ! } ! { ! List edges = new LinkedList(Arrays.asList(te)); ! top = new Surface(edges); ! space.add(top); } } - - /** - * Return null for center - * @return Center - */ - public Vertex center() { - return null; - } - - /** - * FIXME: empty implementation to make compile - * (pfff make sure stuff compiles before you check in please) - */ - public void delete() { - return; - } - - /** @see net.sourceforge.bprocessor.model.Parametric#setAttributes(List) */ - public void setAttributes(List attributes) { - // TODO Auto-generated method stub - } - - /** @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() */ - public List getAttributes() { - // TODO Auto-generated method stub - return null; - } - - /** @see net.sourceforge.bprocessor.model.modellor.Modellor#newInstance(Space) */ - public Modellor newInstance(Space s) { - // TODO Auto-generated method stub - return null; - } - - /** @see net.sourceforge.bprocessor.model.modellor.Modellor#setContent(Map) */ - public void setContent(Map m) { - axisDivisions = ((Integer)m.get("Axis")).intValue(); - height = ((Double)m.get("Height")).doubleValue(); - radius = ((Double)m.get("Radius")).doubleValue(); - } - - /** @see net.sourceforge.bprocessor.model.modellor.Modellor#getContent() */ - public Map getContent() { - Map m = new HashMap(); - m.put("Axis", new Integer(axisDivisions)); - m.put("Height", new Double(height)); - m.put("Radius", new Double(radius)); - return m; - } } --- 192,215 ---- } else { Iterator sel = Selection.primary().iterator(); ! Class type = null; while (sel.hasNext()) { Object next = sel.next(); ! if (type == null) { ! type = next.getClass(); ! } else if (type == next.getClass()) { ! // do nothing just continue; ! continue; } else { ! return PopupMenu.getEntiesMenu(Selection.primary()); } } ! if (type.getSimpleName().equals("Space")) { ! return PopupMenu.getSpaceMenu(Selection.primary()); ! } else if (type.getSimpleName().equals("Surface")) { ! return PopupMenu.getSurfaceMenu(Selection.primary()); ! } else { ! return PopupMenu.getEntiesMenu(Selection.primary()); } } } *************** *** 524,528 **** if (space.isContainer()) { editSpaceItem = new JMenuItem("Edit " + category); ! editSpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { if (space != null) { --- 342,346 ---- if (space.isContainer()) { editSpaceItem = new JMenuItem("Edit " + category); ! editSpaceItem.addActionListener(new SpaceMenuAction(space, "Edit") { public void actionPerformed(ActionEvent arg0) { if (space != null) { *************** *** 535,539 **** } JMenuItem copySpaceItem = new JMenuItem("Duplicate " + category); ! copySpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { if (space != null) { --- 353,357 ---- } JMenuItem copySpaceItem = new JMenuItem("Duplicate " + category); ! copySpaceItem.addActionListener(new SpaceMenuAction(space, "Duplicate") { public void actionPerformed(ActionEvent arg0) { if (space != null) { *************** *** 546,550 **** JMenuItem flipSpaceItem = new JMenuItem("Rotate " + category + " 90 degrees CCW"); ! flipSpaceItem.addActionListener(new SpaceAction(space) { public void actionPerformed(ActionEvent arg0) { if (space != null) { --- 364,368 ---- JMenuItem flipSpaceItem = new JMenuItem("Rotate " + category + " 90 degrees CCW"); ! flipSpaceItem.addActionListener(new SpaceMenuAction(space, "Rotate") { public void actionPerformed(ActionEvent arg0) { if (space != null) { *************** *** 590,599 **** menu.add(constMenu); menu.addSeparator(); ! //menu.add(voidItem); ! menu.add(copySpaceItem); ! if (editSpaceItem != null) { ! menu.add(editSpaceItem); } - menu.add(flipSpaceItem); menu.addPopupMenuListener(spl); menu.pack(); --- 408,419 ---- menu.add(constMenu); menu.addSeparator(); ! if (space != ((Space)space.parent()).getEmpty()) { ! menu.add(voidItem); ! menu.add(copySpaceItem); ! if (editSpaceItem != null) { ! menu.add(editSpaceItem); ! } ! menu.add(flipSpaceItem); } menu.addPopupMenuListener(spl); menu.pack(); |
From: rimestad <rim...@us...> - 2006-10-30 10:34:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25126/src/net/sourceforge/bprocessor/model Added Files: Cylinder.java Log Message: refactored cylinder out of SpaceTool and changede som mouse checks to use isPopuptrigger instead of third button and isctrlpressed. THERE ARE SOME PROBLEMS ON MAC IF RIGHT CLICK IS ACHIEVED WITH CTRL MODIFIER BUT EXTERNAL MOUSE SHOULD BE USED NOT A TRACKPAD. --- NEW FILE: Cylinder.java --- //--------------------------------------------------------------------------------- // $Id: Cylinder.java,v 1.1 2006/10/30 10:34:21 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import net.sourceforge.bprocessor.model.modellor.Modellor; /** * The cylinder class parametrically generates a cylinder. */ public class Cylinder extends Modellor { /** Default */ private static final long serialVersionUID = 1L; /** radius */ private double radius = 1.0; /** height */ private double height = 1.0; /** axis divisions */ private int axisDivisions = 12; /*** * Generate a Cylinder * @param entity Changed entity */ public void update(Object entity) { /** Origin */ Vertex o = new Vertex(0, 0, 0); /** Bottom vertices */ Vertex[] bv = new Vertex[axisDivisions]; /** Top vertices */ Vertex[] tv = new Vertex[axisDivisions]; /** Bottom edges */ Edge[] be = new Edge[axisDivisions]; /** Top edges */ Edge te[] = new Edge[axisDivisions]; /** Side edges */ Edge se[] = new Edge[axisDivisions]; /** Side faces */ Surface sf[] = new Surface[axisDivisions]; Surface top; Surface bottom; Space space = Project.getInstance().world(); for (int i = 0; i < axisDivisions; i++) { double angle = ((2 * Math.PI) * i) / (double) axisDivisions; double x = radius * Math.cos(angle) + o.getX(); double y = radius * Math.sin(angle) + o.getY(); double z = o.getZ(); bv[i] = new Vertex(x, y, z); tv[i] = new Vertex(x, y, z + height); space.add(bv[i]); space.add(tv[i]); } for (int i = 0; i < axisDivisions; i++) { be[i] = new Edge(bv[i], bv[(i + 1) % axisDivisions]); space.add(be[i]); } for (int i = 0; i < axisDivisions; i++) { te[i] = new Edge(tv[i], tv[(i + 1) % axisDivisions]); space.add(te[i]); } for (int i = 0; i < axisDivisions; i++) { se[i] = new Edge(bv[i], tv[i]); space.add(se[i]); } for (int i = 0; i < axisDivisions; i++) { List edges = new LinkedList(); edges.add(be[i]); edges.add(se[(i + 1) % axisDivisions]); edges.add(te[i]); edges.add(se[i]); sf[i] = new Surface(edges); space.add(sf[i]); } { List edges = new LinkedList(Arrays.asList(be)); bottom = new Surface(edges); space.add(bottom); } { List edges = new LinkedList(Arrays.asList(te)); top = new Surface(edges); space.add(top); } } /** * Return null for center * @return Center */ public Vertex center() { return null; } /** * FIXME: empty implementation to make compile * (pfff make sure stuff compiles before you check in please) */ public void delete() { return; } /** @see net.sourceforge.bprocessor.model.Parametric#setAttributes(List) */ public void setAttributes(List attributes) { // TODO Auto-generated method stub } /** @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() */ public List getAttributes() { // TODO Auto-generated method stub return null; } /** @see net.sourceforge.bprocessor.model.modellor.Modellor#newInstance(Space) */ public Modellor newInstance(Space s) { // TODO Auto-generated method stub return null; } /** @see net.sourceforge.bprocessor.model.modellor.Modellor#setContent(Map) */ public void setContent(Map m) { axisDivisions = ((Integer)m.get("Axis")).intValue(); height = ((Double)m.get("Height")).doubleValue(); radius = ((Double)m.get("Radius")).doubleValue(); } /** @see net.sourceforge.bprocessor.model.modellor.Modellor#getContent() */ public Map getContent() { Map m = new HashMap(); m.put("Axis", new Integer(axisDivisions)); m.put("Height", new Double(height)); m.put("Radius", new Double(radius)); return m; } } |
From: rimestad <rim...@us...> - 2006-10-30 10:32:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24012/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: packed enable and disabling of clip planes in methods, and turned them off for constructor drawing, need still some work, not all are shown, maybe they should. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** View.java 22 Oct 2006 14:32:56 -0000 1.158 --- View.java 30 Oct 2006 10:31:51 -0000 1.159 *************** *** 575,586 **** picking = 0; ! Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! if (cp.isActive()) { ! gl.glClipPlane(GL.GL_CLIP_PLANE0 + cp.getNumber(), cp.getPlane().getDoublev()); ! gl.glEnable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! } ! } gl.glColor3fv(lineColor); --- 575,579 ---- picking = 0; ! enableClipplanes(); gl.glColor3fv(lineColor); *************** *** 591,606 **** gl.glEnable(GL.GL_DEPTH_TEST); ! clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! if (cp.isActive()) { ! gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! } ! } ! clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); - // draw the clipping planes Collection selection = Selection.primary(); if (cp == target) { --- 584,593 ---- gl.glEnable(GL.GL_DEPTH_TEST); ! disableClipplanes(); ! //draw the clipping planes ! Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); Collection selection = Selection.primary(); if (cp == target) { *************** *** 616,620 **** } - if (glv.getTool() instanceof SpaceTool) { gl.glMatrixMode(GL.GL_PROJECTION); --- 603,606 ---- *************** *** 675,678 **** --- 661,694 ---- /** + * disable all clipping planes + */ + private void disableClipplanes() { + Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); + while (clipit.hasNext()) { + ClippingPlane cp = (ClippingPlane)clipit.next(); + if (cp.isActive()) { + gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); + if (cp.getClipdepth() != 0) { + gl.glDisable(GL.GL_CLIP_PLANE5); + } + } + } + } + + /** + * Turn all clipplanes on + */ + private void enableClipplanes() { + Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); + while (clipit.hasNext()) { + ClippingPlane cp = (ClippingPlane)clipit.next(); + if (cp.isActive()) { + gl.glClipPlane(GL.GL_CLIP_PLANE0 + cp.getNumber(), cp.getPlane().getDoublev()); + gl.glEnable(GL.GL_CLIP_PLANE0 + cp.getNumber()); + } + } + } + + /** * The camera setup function * @param gld The GLDrawable object *************** *** 1125,1132 **** gl.glDisable(GL.GL_POLYGON_STIPPLE); } else if (o instanceof ClippingPlane) { - gl.glDisable(GL.GL_DEPTH_TEST); ClippingPlane cp = (ClippingPlane) o; ! drawClipplane(cp); ! gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Constructor) { Constructor c = (Constructor) o; --- 1141,1152 ---- gl.glDisable(GL.GL_POLYGON_STIPPLE); } else if (o instanceof ClippingPlane) { ClippingPlane cp = (ClippingPlane) o; ! if (cp.isActive()) { ! gl.glDisable(GL.GL_DEPTH_TEST); ! drawClipplane(cp); ! gl.glEnable(GL.GL_DEPTH_TEST); ! } else { ! drawClipplane(cp); ! } } else if (o instanceof Constructor) { Constructor c = (Constructor) o; *************** *** 1183,1186 **** --- 1203,1208 ---- double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; if (active != null) { + // Should be drawn regardless of clipplanes + disableClipplanes(); gl.glPushMatrix(); transformTo(active); *************** *** 1189,1192 **** --- 1211,1215 ---- grid(Project.getInstance().getActiveCoordinateSystem()); gl.glPopMatrix(); + enableClipplanes(); } while (true) { *************** *** 2113,2117 **** { gl.glLineWidth(2.0f); ! gl.glBegin(GL.GL_LINE_STRIP); Iterator it = corners.iterator(); while (it.hasNext()) { --- 2136,2140 ---- { gl.glLineWidth(2.0f); ! gl.glBegin(GL.GL_LINE_LOOP); Iterator it = corners.iterator(); while (it.hasNext()) { *************** *** 2121,2136 **** v.getZ()); } - Vertex v = (Vertex) corners.iterator().next(); - gl.glVertex3d(v.getX(), - v.getY(), - v.getZ()); gl.glEnd(); } Collection lines = clipplane.getLines(); Iterator it = lines.iterator(); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawConstructor(e); ! } } --- 2144,2163 ---- v.getZ()); } gl.glEnd(); } Collection lines = clipplane.getLines(); Iterator it = lines.iterator(); ! if (clipplane.getClipdepth() == 0) { ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawConstructor(e); ! } ! } else { ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawEdge(e); ! } ! } ! } |
From: rimestad <rim...@us...> - 2006-10-30 10:30:22
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23519/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: changed the static methods to handle collections of elements, to support multi delete, union and the other multi entity methods Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PopupMenu.java 13 Oct 2006 15:44:16 -0000 1.9 --- PopupMenu.java 30 Oct 2006 10:30:11 -0000 1.10 *************** *** 11,22 **** --- 11,25 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; import java.util.Set; import javax.swing.AbstractAction; import javax.swing.JMenu; + import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import net.sourceforge.bprocessor.gui.actions.AttributeMenuAction; + import net.sourceforge.bprocessor.gui.actions.CollectionMenuAction; import net.sourceforge.bprocessor.gui.actions.EntitiesMenuAction; import net.sourceforge.bprocessor.gui.actions.EntityMenuAction; *************** *** 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; --- 29,32 ---- *************** *** 36,39 **** --- 38,42 ---- import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.constraints.OffsetConstraint; import net.sourceforge.bprocessor.model.modellor.Modellor; *************** *** 42,45 **** --- 45,100 ---- */ public class PopupMenu { + /** + * make a popup menu for a surface + * @param surface the surface + * @return the popupmenu + */ + public static JPopupMenu getSurfaceMenu(Surface surface) { + Collection c = new LinkedList(); + c.add(surface); + return getSurfaceMenu(c); + } + + /** + * Make a popupmenu for a list of surfaces + * @param c the list of surfaces + * @return the popupmenu + */ + public static JPopupMenu getSurfaceMenu(Collection c) { + JPopupMenu jm = getEntiesMenu(c); + + if (c.size() == 1) { + Surface s = (Surface)c.iterator().next(); + AbstractAction fromAbove = new EntityMenuAction(s, "See from above") { + public void actionPerformed(ActionEvent arg0) { + Vertex n = ((Surface)entity).normal(); + Project.getInstance().checkpoint(); + } + }; + jm.add(fromAbove); + AbstractAction fromBelow = new EntityMenuAction(s, "See from below") { + public void actionPerformed(ActionEvent arg0) { + Vertex n = ((Surface)entity).normal(); + Project.getInstance().checkpoint(); + } + }; + jm.add(fromBelow); + } + if (c.size() == 2) { + JMenuItem offsetItem = new JMenuItem("Offset Constraint"); + offsetItem.addActionListener(new CollectionMenuAction(c, "Offset") { + public void actionPerformed(ActionEvent event) { + OffsetConstraint.addOffsetConstraint(col); + Project p = Project.getInstance(); + p.changed(p); + p.checkpoint(); + } + } + ); + jm.add(offsetItem); + } + return jm; + } + /** *************** *** 103,132 **** /** * A popup generator for a space ! * @param s the space * @return the popup menu */ ! public static JPopupMenu getSpaceMenu(Space s) { ! JPopupMenu pm = PopupMenu.getEntityMenu(s); pm.addSeparator(); if (s != null) { ! AbstractAction copy = new SpaceMenuAction(s, "Duplicate") { public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! Space spaceCopy = space.copy(); ! Selection.primary().set(spaceCopy); ! Project.getInstance().checkpoint(); } } }; pm.add(copy); ! AbstractAction instantiate = new SpaceMenuAction(s, "Instantiate") { public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! Space instance = new Space("Instance of " + space.getName(), ! Space.CONSTRUCTION, space.getLevel(), false); ! instance.setProto(space); ! space.getOwner().add(instance); Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); --- 158,208 ---- /** * A popup generator for a space ! * @param space the space * @return the popup menu */ ! public static JPopupMenu getSpaceMenu(Space space) { ! Collection c = new LinkedList(); ! c.add(space); ! return getSpaceMenu(c); ! } ! ! /** ! * A popup generator for a collection of space ! * @param s the collection of spaces ! * @return the popup menu ! */ ! public static JPopupMenu getSpaceMenu(Collection s) { ! JPopupMenu pm = PopupMenu.getEntiesMenu(s); pm.addSeparator(); if (s != null) { ! AbstractAction copy = new CollectionMenuAction(s, "Duplicate") { public void actionPerformed(ActionEvent arg0) { ! if (col != null) { ! Iterator iter = col.iterator(); ! while (iter.hasNext()) { ! Space space = (Space)iter.next(); ! Space spaceCopy = space.copy(); ! Selection.primary().set(spaceCopy); ! Project.getInstance().checkpoint(); ! } } } }; pm.add(copy); ! AbstractAction instantiate = new CollectionMenuAction(s, "Instantiate") { public void actionPerformed(ActionEvent arg0) { ! if (col != null) { ! /*FIXME better if there were made a union if more than one ! and a instance of it */ ! Iterator iter = col.iterator(); ! while (iter.hasNext()) { ! Space space = (Space)iter.next(); ! Space instance = new Space("Instance of " + space.getName(), ! Space.CONSTRUCTION, space.getLevel(), false); ! instance.setProto(space); ! space.getOwner().add(instance); ! } Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); *************** *** 135,150 **** }; 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(); { --- 211,219 ---- }; pm.add(instantiate); ! AbstractAction makeunion = new CollectionMenuAction(s, "Make Union") { public void actionPerformed(ActionEvent arg0) { Set internal = new HashSet(); ! internal.addAll(col); ! Set envelope = new HashSet(); { *************** *** 169,236 **** }; pm.add(makeunion); ! if (s.getLevel() < Space.PART_LEVEL) { ! AbstractAction edit = new SpaceMenuAction(s, "Edit") { public void actionPerformed(ActionEvent arg0) { ! Selection.primary().clear(); ! Project.getInstance().setActiveSpace(space); } }; ! pm.add(edit); ! } ! AbstractAction envelope = new SpaceMenuAction(s, "Compute Envelope") { ! public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! space.computeEnvelope(); ! Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } ! } ! }; ! pm.add(envelope); ! AbstractAction flip = new SpaceMenuAction(s, "Rotate 90 degrees CCW") { ! public void actionPerformed(ActionEvent arg0) { ! Iterator it = space.collect().iterator(); ! Vertex center = space.center(); ! while (it.hasNext()) { ! Geometry.rotate(Math.PI / 2, ! 0, 0, 1, ! (Vertex)it.next(), ! center); ! } ! space.changed(); ! Project.getInstance().checkpoint(); ! } ! }; ! pm.add(flip); ! AbstractAction check = new SpaceMenuAction(s, "Check") { ! public void actionPerformed(ActionEvent arg0) { ! space.check(); ! } ! }; ! pm.add(check); ! pm.add(getTransformMenu(s)); ! 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(s, m) { public void actionPerformed(ActionEvent arg0) { ! Modellor created = modellor.newInstance(space); ! if (created != null) { ! space.setModellor(created); ! AttributeView.instance().display(created); ! space.changed(); ! } else { ! JOptionPane.showMessageDialog( ! null, ! "The chosen space havn't been assigned to any surface", ! "No envolope surface error", JOptionPane.ERROR_MESSAGE); ! } } }; ! mm.add(modellor); } - pm.add(mm); } return pm; --- 238,310 ---- }; pm.add(makeunion); ! ! if (s.size() == 1) { ! // Some options do only apply to one space ! Space sp = (Space)s.iterator().next(); ! if (((Space)s.iterator().next()).getLevel() < Space.PART_LEVEL) { ! AbstractAction edit = new SpaceMenuAction(sp, "Edit") { ! public void actionPerformed(ActionEvent arg0) { ! Selection.primary().clear(); ! Project.getInstance().setActiveSpace(space); ! } ! }; ! pm.add(edit); ! } ! AbstractAction envelope = new SpaceMenuAction(sp, "Compute Envelope") { public void actionPerformed(ActionEvent arg0) { ! if (space != null) { ! space.computeEnvelope(); ! Project.getInstance().changed(Project.getInstance()); ! Project.getInstance().checkpoint(); ! } } }; ! pm.add(envelope); ! AbstractAction flip = new SpaceMenuAction(sp, "Rotate 90 degrees CCW") { ! public void actionPerformed(ActionEvent arg0) { ! Iterator it = space.collect().iterator(); ! Vertex center = space.center(); ! while (it.hasNext()) { ! Geometry.rotate(Math.PI / 2, ! 0, 0, 1, ! (Vertex)it.next(), ! center); ! } ! space.changed(); Project.getInstance().checkpoint(); } ! }; ! pm.add(flip); ! AbstractAction check = new SpaceMenuAction(sp, "Check") { public void actionPerformed(ActionEvent arg0) { ! space.check(); } }; ! pm.add(check); ! pm.add(getTransformMenu(sp)); ! 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(sp, m) { ! public void actionPerformed(ActionEvent arg0) { ! Modellor created = modellor.newInstance(space); ! if (created != null) { ! space.setModellor(created); ! AttributeView.instance().display(created); ! space.changed(); ! } else { ! JOptionPane.showMessageDialog( ! null, ! "The chosen space havn't been assigned to any surface", ! "No envolope surface error", JOptionPane.ERROR_MESSAGE); ! } ! } ! }; ! mm.add(modellor); ! } ! pm.add(mm); } } return pm; *************** *** 243,260 **** */ public static JPopupMenu getEntityMenu(Entity e) { ! JPopupMenu pm = new JPopupMenu(); ! AbstractAction delete = new EntityMenuAction(e, "Delete") { ! public void actionPerformed(ActionEvent arg0) { ! if (entity != null) { ! entity.delete(); ! Selection.primary().clear(); ! Project.getInstance().changed(entity); ! Project.getInstance().checkpoint(); ! } ! } ! }; ! pm.add(delete); ! ! return pm; } --- 317,323 ---- */ public static JPopupMenu getEntityMenu(Entity e) { ! Collection c = new LinkedList(); ! c.add(e); ! return getEntiesMenu(c); } *************** *** 288,298 **** public void actionPerformed(ActionEvent arg0) { if (entities != null) { ! Iterator iter = entities.iterator(); while (iter.hasNext()) { ! ((Entity)iter.next()).delete(); } ! Project.getInstance().changed(Geometry.collect(entities)); ! Project.getInstance().checkpoint(); ! Selection.primary().clear(); } } --- 351,367 ---- public void actionPerformed(ActionEvent arg0) { if (entities != null) { ! Collection c = new LinkedList(); ! c.addAll(entities); ! Iterator iter = c.iterator(); ! Project p = Project.getInstance(); ! Selection.primary().clear(); while (iter.hasNext()) { ! Entity e = (Entity)iter.next(); ! e.delete(); ! p.changed(e); } ! p.changed(Geometry.collect(c)); ! p.checkpoint(); ! } } |
From: Michael L. <he...@us...> - 2006-10-30 06:49:34
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv389/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Space.java Log Message: LayerModellor and space deletion Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** Surface.java 22 Oct 2006 14:32:47 -0000 1.117 --- Surface.java 30 Oct 2006 06:49:24 -0000 1.118 *************** *** 268,271 **** --- 268,284 ---- /** + * Flip this surface and all holes + * + */ + public void flipall() { + flip(); + Iterator iter = getHoles().iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + current.flipall(); + } + } + + /** * Replace one edge e1 and its vertices with e2's * @param e1 The edge to replace *************** *** 457,460 **** --- 470,488 ---- /** + * Copy this surface including all holes + * @param space Target space + * @return copy + */ + public Surface copyall(Space space) { + Surface copy = copy(space); + Iterator iter = getHoles().iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + copy.addHole(current.copy(space)); + } + return copy; + } + + /** * Extrude with holes * @param delta Distance to extrude Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** Space.java 30 Oct 2006 00:02:12 -0000 1.90 --- Space.java 30 Oct 2006 06:49:24 -0000 1.91 *************** *** 919,923 **** } } ! } --- 919,954 ---- } } ! } ! ! /** ! * Delete the space and delete envelope surfaces not part of ! * another space. ! * @param space Space ! */ ! public void delete(Space space) { ! List deletion = new LinkedList(); ! { ! Iterator iter = space.getEnvelope().iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! Space other; ! if (current.getFrontDomain() == space) { ! other = current.getBackDomain(); ! } else { ! other = current.getFrontDomain(); ! } ! if (other == space || other == empty) { ! deletion.add(current); ! } ! } ! } ! { ! Iterator iter = deletion.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! delete(current); ! } ! } ! remove(space); } *************** *** 1512,1516 **** clear(); Space owner = this.getOwner(); ! owner.remove(this); } --- 1543,1547 ---- clear(); Space owner = this.getOwner(); ! owner.delete(this); } |
From: Michael L. <he...@us...> - 2006-10-30 06:49:33
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv389/src/net/sourceforge/bprocessor/model/modellor Modified Files: LayerModellor.java Log Message: LayerModellor and space deletion Index: LayerModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/LayerModellor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LayerModellor.java 14 Oct 2006 23:37:54 -0000 1.8 --- LayerModellor.java 30 Oct 2006 06:49:25 -0000 1.9 *************** *** 8,11 **** --- 8,12 ---- package net.sourceforge.bprocessor.model.modellor; + import java.util.Collection; import java.util.HashMap; import java.util.HashSet; *************** *** 58,61 **** --- 59,75 ---- /** + * Insert extrusion into space + * @param space Space + * @param extrusion Collection of surfaces + */ + public void insert(Space space, Collection extrusion) { + Iterator surfaces = extrusion.iterator(); + while (surfaces.hasNext()) { + Surface surface = (Surface) surfaces.next(); + space.insert(surface); + } + } + + /** * Update the geometry. * @param entity The changed entity *************** *** 64,70 **** space.clear(); parameters.clear(); ! Surface bottom = surface.copy(space); if (surface.getBackDomain() == space) { ! bottom.flip(); } --- 78,84 ---- space.clear(); parameters.clear(); ! Surface bottom = surface.copyall(space); if (surface.getBackDomain() == space) { ! bottom.flipall(); } *************** *** 76,81 **** bottom.setFrontDomain(layer); Set sides = new HashSet(); ! bottom = bottom.extrude(distance, sides); ! bottom.flip(); bottom.setBackDomain(layer); } catch (Exception ex) { --- 90,100 ---- bottom.setFrontDomain(layer); Set sides = new HashSet(); ! Set tops = new HashSet(); ! Set extrusion = new HashSet(); ! bottom = bottom.extrusionall(distance, sides, tops); ! extrusion.addAll(sides); ! extrusion.addAll(tops); ! insert(space, extrusion); ! bottom.flipall(); bottom.setBackDomain(layer); } catch (Exception ex) { |
From: Nikolaj B. <nbr...@us...> - 2006-10-30 00:02:18
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2677/src/net/sourceforge/bprocessor/model Modified Files: Space.java Attribute.java Log Message: Fixed the classification attribute to work as intended Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Attribute.java 24 Oct 2006 20:40:48 -0000 1.13 --- Attribute.java 30 Oct 2006 00:02:12 -0000 1.14 *************** *** 97,101 **** setValue(value); setClassification(classification); ! editable = false; } --- 97,101 ---- setValue(value); setClassification(classification); ! editable = true; } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Space.java 29 Oct 2006 11:25:04 -0000 1.89 --- Space.java 30 Oct 2006 00:02:12 -0000 1.90 *************** *** 1318,1329 **** } else if (a.getName().equals("Classification")) { if (getOwner() == Project.getInstance().world()) { ! setClassification(((Classification)a.getValue())); } if (getLevel() == Space.ELEMENT_LEVEL) { ! setClassification(((Classification)a.getValue())); getOwner().setClassification(classification.getParent()); } if (getLevel() == Space.PART_LEVEL) { ! setClassification(((Classification)a.getValue())); getOwner().setClassification(classification.getParent()); getOwner().getOwner().setClassification(classification.getParent().getParent()); --- 1318,1329 ---- } else if (a.getName().equals("Classification")) { if (getOwner() == Project.getInstance().world()) { ! setClassification(((Classification)a.getClassification())); } if (getLevel() == Space.ELEMENT_LEVEL) { ! setClassification(((Classification)a.getClassification())); getOwner().setClassification(classification.getParent()); } if (getLevel() == Space.PART_LEVEL) { ! setClassification(((Classification)a.getClassification())); getOwner().setClassification(classification.getParent()); getOwner().getOwner().setClassification(classification.getParent().getParent()); |
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1422/src/net/sourceforge/bprocessor/gui/attrview Modified Files: GenericPanel.java Added Files: ClassificationIdAttribute.java ClassificationTextAttribute.java Removed Files: ClassificationAttribute.java Log Message: Fixed the classification attribute to work as intended Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** GenericPanel.java 24 Oct 2006 20:38:28 -0000 1.22 --- GenericPanel.java 30 Oct 2006 00:00:02 -0000 1.23 *************** *** 184,190 **** where.add(new AttributeRow(ba)); } else if (a.getValue() instanceof Classification) { ! // Handles the classification ! ClassificationAttribute ca = new ClassificationAttribute(a); ! ca.addClassificationAttributeListener(new AttributeListener() { public void valueChanged(Attribute a) { obj.setAttributes(attributes); --- 184,190 ---- where.add(new AttributeRow(ba)); } else if (a.getValue() instanceof Classification) { ! // Handles the text part classification ! ClassificationTextAttribute catext = new ClassificationTextAttribute(a); ! catext.addClassificationAttributeListener(new AttributeListener() { public void valueChanged(Attribute a) { obj.setAttributes(attributes); *************** *** 197,201 **** } }); ! where.add(new AttributeRow(ca)); } else { log.info("[GenericPanel] Something were not implemented"); --- 197,218 ---- } }); ! where.add(new AttributeRow(catext)); ! if (a.getClassification() != null) { ! where.add(new AttributeRow(catext)); ! // Handles the id part of classification ! ClassificationIdAttribute caid = new ClassificationIdAttribute(a); ! caid.addClassificationAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); ! where.add(new AttributeRow(caid)); ! } } else { log.info("[GenericPanel] Something were not implemented"); *************** *** 272,276 **** this.add(ga); if (ga.attribute().isEditable() || ga instanceof LinkAttribute ! || ga instanceof ClassificationAttribute) { ga.addMouseListener(this); } --- 289,293 ---- this.add(ga); if (ga.attribute().isEditable() || ga instanceof LinkAttribute ! || ga instanceof ClassificationTextAttribute) { ga.addMouseListener(this); } --- NEW FILE: ClassificationTextAttribute.java --- //--------------------------------------------------------------------------------- // $Id: ClassificationTextAttribute.java,v 1.1 2006/10/30 00:00:02 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Classification; /** * The ClassificationTextAttributeView */ public class ClassificationTextAttribute extends GenericAttribute implements ActionListener { /** The listeners */ private List listeners; /** The attribute this gui represents */ private Attribute attribute; /** The component */ private JComponent component; /** * Constructor for ClassificationTextAttribute * @param attribute The attribute */ public ClassificationTextAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); Box column = Box.createVerticalBox(); component = Box.createHorizontalBox(); component.add(createMenu(attribute.getValue())); Box header = Box.createHorizontalBox(); header.add(Box.createHorizontalStrut(7)); header.add(component); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); this.add(column); } /** * Add a listener that are notified when the value is changed * @param listener The listener */ public void addClassificationAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeClassificationAttributeListener(AttributeListener listener) { listeners.remove(listener); } /** * Send valueChanged to all listeners */ protected void valueChanged() { Iterator iter = listeners.iterator(); while (iter.hasNext()) { AttributeListener current = (AttributeListener) iter.next(); current.valueChanged(attribute); } } /** * Create a value label * @param value The value * @return The label */ private JComponent createMenu(Object value) { JMenuBar valueLabel = new JMenuBar(); JMenu menu, subMenu; MyMenuItem mi, submi; boolean hasChildren = false; if (attribute.getClassification() != null) { menu = new JMenu(attribute.getClassification().getName()); } else { menu = new JMenu("Classification"); } Iterator it = ((Classification) value).getChildren().iterator(); while (it.hasNext()) { Classification current = (Classification) it.next(); if (current.getChildren() != null) { hasChildren = true; } if (hasChildren) { Iterator subit = current.getChildren().iterator(); subMenu = new JMenu(current.getName()); submi = new MyMenuItem(current); submi.addActionListener(this); subMenu.add(submi); while (subit.hasNext()) { Classification subcur = (Classification) subit.next(); submi = new MyMenuItem(subcur); submi.addActionListener(this); subMenu.add(submi); } menu.add(subMenu); } else { mi = new MyMenuItem(current); mi.addActionListener(this); menu.add(mi); } } valueLabel.add(menu); return valueLabel; } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * Handles the event from the classification menu * @param e is the action event */ public void actionPerformed(ActionEvent e) { MyMenuItem source = (MyMenuItem)(e.getSource()); attribute.setClassification(source.getClassification()); valueChanged(); } /** * extended version of JMenuItem that also contains a classification */ class MyMenuItem extends JMenuItem { /** the classification */ private Classification cla; /** * Constructor for a new MyMenuItem * @param classification the classification */ MyMenuItem(Classification classification) { super(classification.getName()); setClassification(classification); } /** * return the classification for the current menu item * @return the classification */ public Classification getClassification() { return cla; } /** * Sets the classification for a menu item * @param cla the classification */ public void setClassification(Classification cla) { this.cla = cla; } } /** * Not in use */ public void startEditing() { // TODO Auto-generated method stub } /** * Not in use */ public void stopEditing() { // TODO Auto-generated method stub } /** * Not in use */ public void cancelEditing() { // TODO Auto-generated method stub } } --- ClassificationAttribute.java DELETED --- --- NEW FILE: ClassificationIdAttribute.java --- //--------------------------------------------------------------------------------- // $Id: ClassificationIdAttribute.java,v 1.1 2006/10/30 00:00:02 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Dimension; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Classification; import net.sourceforge.bprocessor.model.Project; /** * The ClassificationIdAttributeView */ public class ClassificationIdAttribute extends GenericAttribute implements KeyListener, MouseListener { /** The listeners */ private List listeners; /** The attribute this gui represents */ private Attribute attribute; /** The component */ private JComponent component; /** The Label */ private JLabel label; /** The editor, when this EditableAttribute is being edited */ private JTextField editor; /** * Constructor for ClassificationIdAttribute * @param attribute The attribute */ public ClassificationIdAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); Box column = Box.createVerticalBox(); label = createLabel("Classification"); component = Box.createHorizontalBox(); if (!attribute.getClassification().getName().equalsIgnoreCase("Classification")) { component.add(createValueLabel(attribute.getClassification().getFullId())); } Box header = Box.createHorizontalBox(); header.add(Box.createHorizontalStrut(7)); header.add(label); header.add(component); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); this.add(column); } /** * Create a label for the * @param key The key * @return A JLabel */ private JLabel createLabel(String key) { JLabel keyLabel = new JLabel(key + " :"); keyLabel.setFont(AttributeView.FONT_BOLD); return keyLabel; } /** * Add a mouselisterner to the active elements in the ClassificationIdAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); } /** * Remove a mouselisterner to the active elements in the ClassificationIdAttribute * @param mouseListener the mouselistener */ public void removeMouseListener(MouseListener mouseListener) { label.removeMouseListener(mouseListener); component.removeMouseListener(mouseListener); } /** * Add a listener that are notified when the value is changed * @param listener The listener */ public void addClassificationAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeClassificationAttributeListener(AttributeListener listener) { listeners.remove(listener); } /** * Send valueChanged to all listeners */ protected void valueChanged() { Iterator iter = listeners.iterator(); while (iter.hasNext()) { AttributeListener current = (AttributeListener) iter.next(); current.valueChanged(attribute); } } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * Create a value label * @param value The value * @return The label */ private JComponent createValueLabel(Object value) { String s = ""; JLabel valueLabel; if (value instanceof String) { s = (String)value; } valueLabel = new JLabel(s); if (attribute.isEditable()) { valueLabel.setFont(AttributeView.FONT_PLAIN); } else { valueLabel.setFont(AttributeView.FONT_ITALIC); } return valueLabel; } /** * Create a value editor * @param value The value * @return The editor */ private JComponent createValueEditor(Object value) { String s = ""; if (value instanceof String) { s = (String)value; } JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); return valueEditor; } /** * Start editing the value by replacing the label with an editor */ public void startEditing() { if (editor == null) { component.remove(0); if (attribute.getClassification() != null && !attribute.getClassification().getName().equalsIgnoreCase("Classification")) { editor = (JTextField) createValueEditor(attribute.getClassification().getFullId()); } else { editor = (JTextField) createValueEditor(""); } editor.addKeyListener(this); component.add(editor); component.revalidate(); } editor.requestFocus(); editor.selectAll(); } /** * Stop editing the value by replacing the editor with an label, * and sending valueChanged to all listeners. */ public void stopEditing() { if (editor != null) { Object val = attribute.getValue(); String id = editor.getText(); StringTokenizer st = new StringTokenizer(id, "."); Classification clas = Project.getInstance().getClassification(); String curid; while (st.hasMoreTokens()) { curid = st.nextToken(); Iterator it = clas.getChildren().iterator(); while (it.hasNext()) { Classification current = (Classification) it.next(); if (curid.equalsIgnoreCase(current.getId().toString())) { clas = current; } } } attribute.setClassification(clas); component.remove(editor); editor.removeKeyListener(this); editor = null; component.add(createValueLabel(clas.getFullId())); component.revalidate(); valueChanged(); } } /** * Cancels editing the value by replacing the editor with an label, * without sending any events to listeners. */ public void cancelEditing() { if (editor != null) { component.remove(editor); editor.removeKeyListener(this); editor = null; component.add(createValueLabel(attribute.getValue())); component.revalidate(); } } /** * Respond to the enter key by stopping editing. * @param event The KeyEvent */ public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ENTER) { stopEditing(); } else if (event.getKeyCode() == KeyEvent.VK_ESCAPE) { cancelEditing(); } } /** * Not in use * @param event The KeyEvent */ public void keyTyped(KeyEvent event) { } /** * Not in use * @param event The KeyEvent */ public void keyReleased(KeyEvent event) { } /** * Start editing on the view * @param event The event */ public void mouseClicked(MouseEvent event) { startEditing(); } /** * Not in use * @param event The MouseEvent */ public void mousePressed(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseReleased(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseEntered(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseExited(MouseEvent event) { } } |
From: Nikolaj B. <nbr...@us...> - 2006-10-29 11:25:15
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29529/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: removed 2 printlines Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** Space.java 27 Oct 2006 10:25:14 -0000 1.88 --- Space.java 29 Oct 2006 11:25:04 -0000 1.89 *************** *** 1348,1353 **** if (getOwner() == Project.getInstance().world()) { if (isConstructionSpace()) { - System.out.println("The classification: " + getClassification()); - System.out.println("The name: " + getName()); res.add(new Attribute("Classification", Project.getInstance().getClassification(), getClassification())); --- 1348,1351 ---- |
From: Nikolaj B. <nbr...@us...> - 2006-10-27 10:25:52
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13324/src/net/sourceforge/bprocessor/gui/attrview Modified Files: ClassificationAttribute.java Log Message: Temporary fix that was making attribute view for spaces unstable Index: ClassificationAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/ClassificationAttribute.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClassificationAttribute.java 24 Oct 2006 20:38:28 -0000 1.2 --- ClassificationAttribute.java 27 Oct 2006 10:25:44 -0000 1.3 *************** *** 72,76 **** component1 = Box.createHorizontalBox(); component2 = Box.createHorizontalBox(); ! if (attribute.getClassification() != null) { component2.add(createValueLabel(attribute.getClassification().getFullId())); } else { --- 72,78 ---- component1 = Box.createHorizontalBox(); component2 = Box.createHorizontalBox(); ! System.out.println(); ! if (attribute.getClassification() != null ! && !attribute.getClassification().getName().equalsIgnoreCase("Classification")) { component2.add(createValueLabel(attribute.getClassification().getFullId())); } else { *************** *** 262,266 **** if (editor == null) { component2.remove(0); ! if (attribute.getClassification() != null) { editor = (JTextField) createValueEditor(attribute.getClassification().getFullId()); } else { --- 264,269 ---- if (editor == null) { component2.remove(0); ! if (attribute.getClassification() != null ! && !attribute.getClassification().getName().equalsIgnoreCase("Classification")) { editor = (JTextField) createValueEditor(attribute.getClassification().getFullId()); } else { |
From: Nikolaj B. <nbr...@us...> - 2006-10-27 10:25:29
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13301/src/net/sourceforge/bprocessor/model Modified Files: Classification.java Space.java Project.java Log Message: Temporary fix that was making attribute view for spaces unstable Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** Space.java 24 Oct 2006 20:40:48 -0000 1.87 --- Space.java 27 Oct 2006 10:25:14 -0000 1.88 *************** *** 1348,1352 **** if (getOwner() == Project.getInstance().world()) { if (isConstructionSpace()) { ! res.add(new Attribute("Classification", Project.getInstance().getClassification(), getClassification())); --- 1348,1353 ---- if (getOwner() == Project.getInstance().world()) { if (isConstructionSpace()) { ! System.out.println("The classification: " + getClassification()); ! System.out.println("The name: " + getName()); res.add(new Attribute("Classification", Project.getInstance().getClassification(), getClassification())); Index: Classification.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Classification.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Classification.java 24 Oct 2006 20:40:48 -0000 1.1 --- Classification.java 27 Oct 2006 10:25:14 -0000 1.2 *************** *** 46,50 **** */ public Classification() { ! setName("World"); setId(new Integer(0)); } --- 46,50 ---- */ public Classification() { ! setName("Classification"); setId(new Integer(0)); } *************** *** 122,126 **** String fullId = id.toString(); Classification par = parent; ! while (!par.getName().equalsIgnoreCase("World")) { fullId = par.getId() + "." + fullId; par = par.getParent(); --- 122,126 ---- String fullId = id.toString(); Classification par = parent; ! while (!par.getName().equalsIgnoreCase("Classification")) { fullId = par.getId() + "." + fullId; par = par.getParent(); Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Project.java 24 Oct 2006 20:40:48 -0000 1.86 --- Project.java 27 Oct 2006 10:25:14 -0000 1.87 *************** *** 753,762 **** ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName())); ! res.add(new Attribute("Energyloss", new Double(EnergyCalc.energyLoss()), false)); res.add(new Attribute("Heated area", new Double(EnergyCalc.heatedArea()), false)); ! if (EnergyCalc.heatedArea() != 0) { res.add(new Attribute("loss per m2", new Double(EnergyCalc.energyLoss() / EnergyCalc.heatedArea()), false)); ! } res.add(new Attribute("Script", script)); return res; --- 753,762 ---- ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName())); ! //res.add(new Attribute("Energyloss", new Double(EnergyCalc.energyLoss()), false)); res.add(new Attribute("Heated area", new Double(EnergyCalc.heatedArea()), false)); ! /*if (EnergyCalc.heatedArea() != 0) { res.add(new Attribute("loss per m2", new Double(EnergyCalc.energyLoss() / EnergyCalc.heatedArea()), false)); ! }*/ res.add(new Attribute("Script", script)); return res; |
From: Michael L. <he...@us...> - 2006-10-27 06:58:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26234/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Added builtin function "sqrt" Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** SpaceTool.java 22 Oct 2006 14:32:55 -0000 1.59 --- SpaceTool.java 27 Oct 2006 06:58:29 -0000 1.60 *************** *** 642,645 **** --- 642,651 ---- } }); + globals.put("sqrt", new Builtin() { + public void evaluate(Environment env, Stack stack) { + Double argument = (Double) env.get(0); + stack.push(new Double(Math.sqrt(argument.doubleValue()))); + } + }); globals.put("length", new Builtin() { public void evaluate(Environment env, Stack stack) { |
From: Nikolaj B. <nbr...@us...> - 2006-10-25 07:17:01
|
Update of /cvsroot/bprocessor/bprocessor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24038 Added Files: classification.csv Log Message: The classification --- NEW FILE: classification.csv --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9449/src/net/sourceforge/bprocessor/model Modified Files: EnergyCalc.java Space.java Project.java Attribute.java Persistence.java Added Files: Classification.java Log Message: Changed the classification,to use the new classification model --- NEW FILE: Classification.java --- //--------------------------------------------------------------------------------- // $Id: Classification.java,v 1.1 2006/10/24 20:40:48 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.Vector; import org.apache.log4j.Logger; /** * This class persist the model from/to an XML document */ public class Classification { /** The logger */ private static Logger log = Logger.getLogger(Classification.class); /** The name of the classification */ private String name; /** The id of the classification */ private Integer id; /** The children of this classification */ private Vector children = new Vector(); /** The parent of this classification */ private Classification parent; /** * The constructor for a new classification * @param id the id * @param name the name * @param parent the parent */ public Classification(Integer id, String name, Classification parent) { setName(name); setId(id); setParent(parent); } /** * Constructor for base element */ public Classification() { setName("World"); setId(new Integer(0)); } /** * Get the vector containing this classifications children * @return the children */ public Vector getChildren() { return children; } /** * Get the name of this classification * @return the name */ public String getName() { return name; } /** * Sets the name of the classification * @param name the new name for the classification */ public void setName (String name) { this.name = name; } /** * Get the id of this classification * @return the id */ public Integer getId () { return id; } /** * Set the id of this classification * @param id the id to be set */ public void setId (Integer id) { this.id = id; } /** * Adds a child to the classification * @param child the child to be added */ public void addChild(Classification child) { children.add(child); } /** * Returns the parent of this classification * @return the parent */ public Classification getParent() { return parent; } /** * Set the parent of this classification * @param parent the new parent */ public void setParent(Classification parent) { this.parent = parent; } /** * Generates the full id for this classification * @return the full id */ public String getFullId() { String fullId = id.toString(); Classification par = parent; while (!par.getName().equalsIgnoreCase("World")) { fullId = par.getId() + "." + fullId; par = par.getParent(); } return fullId; } /** * returns the name of the classification if toString is called * @return returns the name as a string */ public String toString() { return name; } } Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Persistence.java 16 Oct 2006 12:19:32 -0000 1.15 --- Persistence.java 24 Oct 2006 20:40:48 -0000 1.16 *************** *** 164,168 **** space.setId(new Long(xml.getProgid())); space.setDescription(xml.getDescription()); ! space.setClassification(xml.getClassification()); mapper.put(new Long(xml.getId()), space); --- 164,168 ---- space.setId(new Long(xml.getProgid())); space.setDescription(xml.getDescription()); ! //space.setClassification(xml.getClassification()); mapper.put(new Long(xml.getId()), space); *************** *** 689,693 **** xml.setTransparent(space.isTransparent()); xml.setDescription(space.getDescription().toString()); ! xml.setClassification(space.getClassification().toString()); map.put(space, xml); if (!space.isInstance()) { --- 689,693 ---- xml.setTransparent(space.isTransparent()); xml.setDescription(space.getDescription().toString()); ! //xml.setClassification(space.getClassification().toString()); map.put(space, xml); if (!space.isInstance()) { Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** Project.java 17 Oct 2006 09:11:07 -0000 1.85 --- Project.java 24 Oct 2006 20:40:48 -0000 1.86 *************** *** 8,12 **** --- 8,14 ---- package net.sourceforge.bprocessor.model; + import java.io.BufferedReader; import java.io.File; + import java.io.FileReader; import java.util.ArrayList; import java.util.Collection; *************** *** 17,20 **** --- 19,23 ---- import java.util.List; import java.util.Stack; + import java.util.StringTokenizer; import net.sourceforge.bprocessor.model.modellor.LayerModellor; *************** *** 43,46 **** --- 46,52 ---- private Space world; + /** The classification */ + private Classification clas = new Classification(); + /** The cameras */ private HashMap cameras = new HashMap(); *************** *** 123,126 **** --- 129,138 ---- globals.put("pi", Math.PI); Modellor.registerModellor(new LayerModellor()); + try { + loadClassification(); + } catch (Exception e) { + System.out.println("loading classification"); + e.printStackTrace(); + } makeClean(); } *************** *** 791,793 **** --- 803,865 ---- log.info(object); } + + /** + * This method loads the classification document from a file + * @exception Exception Thrown if an exception occurs + */ + public void loadClassification() throws Exception { + String current = ""; + String token = ""; + String curname = ""; + Integer curid; + Classification parent = new Classification(); + Classification last = new Classification(); + int depth = 0; + int lastdepth = 0; + BufferedReader bf = new BufferedReader(new FileReader("classification.csv")); + current = bf.readLine(); + while (!current.equalsIgnoreCase("--stop--")) { + StringTokenizer st = new StringTokenizer(current, ";", true); + while (st.hasMoreTokens()) { + token = st.nextToken(); + if (depth == 0 && !token.equalsIgnoreCase(";")) { + curid = new Integer(token); + st.nextToken(); + curname = st.nextToken(); + Classification curclas = new Classification(curid, curname, clas); + parent = curclas; + clas.addChild(curclas); + lastdepth = 0; + last = curclas; + } else if (token.equalsIgnoreCase(";")) { + depth++; + } else if (depth != 0 && !token.equalsIgnoreCase(";")) { + curid = new Integer(token); + st.nextToken(); + curname = st.nextToken(); + if (depth > lastdepth) { + parent = last; + } + if (depth < lastdepth) { + parent = parent.getParent(); + } + Classification curclas = new Classification(curid, curname, parent); + parent.addChild(curclas); + last = curclas; + lastdepth = depth; + } + } + depth = 0; + current = bf.readLine(); + } + } + + /** + * this method returns the classification + * @return Classification the classification + * */ + public Classification getClassification () { + return clas; + } + } Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Attribute.java 17 Jul 2006 08:37:00 -0000 1.12 --- Attribute.java 24 Oct 2006 20:40:48 -0000 1.13 *************** *** 28,32 **** /** The classification */ ! private String classification; /** The precision of the object */ --- 28,32 ---- /** The classification */ ! private Classification classification; /** The precision of the object */ *************** *** 93,97 **** * @param classification The classification */ ! public Attribute(String name, Object value, String classification) { setName(name); setValue(value); --- 93,97 ---- * @param classification The classification */ ! public Attribute(String name, Object value, Classification classification) { setName(name); setValue(value); *************** *** 131,135 **** * @return Returns the classification. */ ! public String getClassification() { return classification; } --- 131,135 ---- * @return Returns the classification. */ ! public Classification getClassification() { return classification; } *************** *** 138,142 **** * @param classification The classification to set. */ ! public void setClassification(String classification) { this.classification = classification; } --- 138,142 ---- * @param classification The classification to set. */ ! public void setClassification(Classification classification) { this.classification = classification; } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Space.java 23 Oct 2006 06:48:46 -0000 1.86 --- Space.java 24 Oct 2006 20:40:48 -0000 1.87 *************** *** 120,124 **** /** The classification */ ! private String classification; /** If the constructionspace is transparent */ --- 120,124 ---- /** The classification */ ! private Classification classification; /** If the constructionspace is transparent */ *************** *** 198,202 **** this.level = level; setTransparent(false); - setClassification("None"); this.container = container; description = new Description(""); --- 198,201 ---- *************** *** 1015,1019 **** * @return The classification */ ! public String getClassification() { return classification; } --- 1014,1018 ---- * @return The classification */ ! public Classification getClassification() { return classification; } *************** *** 1022,1026 **** * @param classification The classification */ ! public void setClassification(String classification) { this.classification = classification; } --- 1021,1025 ---- * @param classification The classification */ ! public void setClassification(Classification classification) { this.classification = classification; } *************** *** 1318,1322 **** setName((String)a.getValue()); } else if (a.getName().equals("Classification")) { ! setClassification(((String)a.getValue().toString())); } else if (a.getName().equals("Transparent")) { setTransparent((((Boolean)a.getValue()).booleanValue())); --- 1317,1332 ---- setName((String)a.getValue()); } else if (a.getName().equals("Classification")) { ! if (getOwner() == Project.getInstance().world()) { ! setClassification(((Classification)a.getValue())); ! } ! if (getLevel() == Space.ELEMENT_LEVEL) { ! setClassification(((Classification)a.getValue())); ! getOwner().setClassification(classification.getParent()); ! } ! if (getLevel() == Space.PART_LEVEL) { ! setClassification(((Classification)a.getValue())); ! getOwner().setClassification(classification.getParent()); ! getOwner().getOwner().setClassification(classification.getParent().getParent()); ! } } else if (a.getName().equals("Transparent")) { setTransparent((((Boolean)a.getValue()).booleanValue())); *************** *** 1337,1344 **** res.add(new Attribute("Owner", getOwner(), false)); if (getOwner() == Project.getInstance().world()) { ! if (isConstructionSpace()) { ! res.add(new Attribute("Classification", constructionOptions, getClassification())); } else { ! res.add(new Attribute("Classification", functionalOptions, getClassification())); } } else { --- 1347,1356 ---- res.add(new Attribute("Owner", getOwner(), false)); if (getOwner() == Project.getInstance().world()) { ! if (isConstructionSpace()) { ! ! res.add(new Attribute("Classification", ! Project.getInstance().getClassification(), getClassification())); } else { ! //res.add(new Attribute("Classification", functionalOptions, getClassification())); } } else { *************** *** 1346,1358 **** if (getLevel() == Space.ELEMENT_LEVEL) { if (isConstructionSpace()) { ! res.add(new Attribute("Classification", elementConstructionOptions, getClassification())); } else { ! res.add(new Attribute("Classification", elementFunctionalOptions, getClassification())); } } else if (getLevel() == Space.PART_LEVEL) { if (isConstructionSpace()) { ! res.add(new Attribute("Classification", partConstructionOptions, getClassification())); } else { ! res.add(new Attribute("Classification", partFunctionalOptions, getClassification())); } } --- 1358,1382 ---- if (getLevel() == Space.ELEMENT_LEVEL) { if (isConstructionSpace()) { ! if (getOwner().getClassification() != null) { ! res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification())); ! } else { ! res.add(new Attribute("Classification", ! Project.getInstance().getClassification(), getClassification())); ! } } else { ! //res.add(new Attribute("Classification", elementFunctionalOptions, getClassification())); } } else if (getLevel() == Space.PART_LEVEL) { if (isConstructionSpace()) { ! if (getOwner().getClassification() != null) { ! res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification())); ! } else { ! res.add(new Attribute("Classification", ! Project.getInstance().getClassification(), getClassification())); ! } } else { ! //res.add(new Attribute("Classification", partFunctionalOptions, getClassification())); } } *************** *** 1384,1388 **** return res; } ! /** * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() --- 1408,1412 ---- return res; } ! /** * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() Index: EnergyCalc.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EnergyCalc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EnergyCalc.java 5 Oct 2006 11:27:04 -0000 1.2 --- EnergyCalc.java 24 Oct 2006 20:40:48 -0000 1.3 *************** *** 24,37 **** while (it.hasNext()) { Surface current = (Surface) it.next(); ! if (current.getFrontDomain().getClassification().equalsIgnoreCase("Exteriør")) { totalloss = totalloss + calcloss(current.getBackDomain(), current); } ! if (current.getFrontDomain().getClassification().equalsIgnoreCase("Uopvarmet rum")) { totalloss = totalloss + calcloss(current.getBackDomain(), current); } ! if (current.getBackDomain().getClassification().equalsIgnoreCase("Exteriør")) { totalloss = totalloss + calcloss(current.getFrontDomain(), current); } ! if (current.getBackDomain().getClassification().equalsIgnoreCase("Uopvarmet rum")) { totalloss = totalloss + calcloss(current.getFrontDomain(), current); } --- 24,38 ---- while (it.hasNext()) { Surface current = (Surface) it.next(); ! if (current.getFrontDomain().getClassification().getName().equalsIgnoreCase("Exteriør")) { totalloss = totalloss + calcloss(current.getBackDomain(), current); } ! if (current.getFrontDomain().getClassification().getName(). ! equalsIgnoreCase("Uopvarmet rum")) { totalloss = totalloss + calcloss(current.getBackDomain(), current); } ! if (current.getBackDomain().getClassification().getName().equalsIgnoreCase("Exteriør")) { totalloss = totalloss + calcloss(current.getFrontDomain(), current); } ! if (current.getBackDomain().getClassification().getName().equalsIgnoreCase("Uopvarmet rum")) { totalloss = totalloss + calcloss(current.getFrontDomain(), current); } *************** *** 58,92 **** if (elemcheck.getName().equalsIgnoreCase("Void") && first) { ! if (classification.getClassification().equalsIgnoreCase("Terrandæk")) { loss = 0.15 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("Tagkonstruktion")) { loss = 0.15 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("Loft")) { loss = 0.15 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("Ydervæg")) { loss = 0.25 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("Ældre termovindue")) { loss = 2.5 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("2-lags lavenergivindue")) { loss = 1.5 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("3-lags lavenergivindue")) { loss = 0.8 * current.getArea(); return loss; } ! if (classification.getClassification().equalsIgnoreCase("Dør")) { loss = 1.5 * current.getArea(); return loss; --- 59,95 ---- if (elemcheck.getName().equalsIgnoreCase("Void") && first) { ! if (classification.getClassification().getName().equalsIgnoreCase("Terrandæk")) { loss = 0.15 * current.getArea(); return loss; } ! if (classification.getClassification().getName().equalsIgnoreCase("Tagkonstruktion")) { loss = 0.15 * current.getArea(); return loss; } ! if (classification.getClassification().getName().equalsIgnoreCase("Loft")) { loss = 0.15 * current.getArea(); return loss; } ! if (classification.getClassification().getName().equalsIgnoreCase("Ydervæg")) { loss = 0.25 * current.getArea(); return loss; } ! if (classification.getClassification().getName().equalsIgnoreCase("Ældre termovindue")) { loss = 2.5 * current.getArea(); return loss; } ! if (classification.getClassification(). ! getName().equalsIgnoreCase("2-lags lavenergivindue")) { loss = 1.5 * current.getArea(); return loss; } ! if (classification.getClassification(). ! getName().equalsIgnoreCase("3-lags lavenergivindue")) { loss = 0.8 * current.getArea(); return loss; } ! if (classification.getClassification().getName().equalsIgnoreCase("Dør")) { loss = 1.5 * current.getArea(); return loss; *************** *** 146,152 **** if (spa != null && ! (spa.getClassification().equalsIgnoreCase("Stue") || ! spa.getClassification().equalsIgnoreCase("Badeværelse") || ! spa.getClassification().equalsIgnoreCase("Opvarmet rum"))) { relevant = true; --- 149,155 ---- if (spa != null && ! (spa.getClassification().getName().equalsIgnoreCase("Stue") || ! spa.getClassification().getName().equalsIgnoreCase("Badeværelse") || ! spa.getClassification().getName().equalsIgnoreCase("Opvarmet rum"))) { relevant = true; *************** *** 171,177 **** spa = current.getFrontDomain(); if (spa.getClassification() != null && ! (spa.getClassification().equalsIgnoreCase("Stue") || ! spa.getClassification().equalsIgnoreCase("Badeværelse") || ! spa.getClassification().equalsIgnoreCase("Opvarmet rum"))) { tha = tha + current.getArea(); } --- 174,180 ---- spa = current.getFrontDomain(); if (spa.getClassification() != null && ! (spa.getClassification().getName().equalsIgnoreCase("Stue") || ! spa.getClassification().getName().equalsIgnoreCase("Badeværelse") || ! spa.getClassification().getName().equalsIgnoreCase("Opvarmet rum"))) { tha = tha + current.getArea(); } *************** *** 180,186 **** spa = current.getBackDomain(); if (spa.getClassification() != null && ! (spa.getClassification().equalsIgnoreCase("Stue") || ! spa.getClassification().equalsIgnoreCase("Badeværelse") || ! spa.getClassification().equalsIgnoreCase("Opvarmet rum"))) { tha = tha + current.getArea(); } --- 183,189 ---- spa = current.getBackDomain(); if (spa.getClassification() != null && ! (spa.getClassification().getName().equalsIgnoreCase("Stue") || ! spa.getClassification().getName().equalsIgnoreCase("Badeværelse") || ! spa.getClassification().getName().equalsIgnoreCase("Opvarmet rum"))) { tha = tha + current.getArea(); } |
From: Nikolaj B. <nbr...@us...> - 2006-10-24 20:39:59
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8886/src/etc Added Files: classification.xsd Log Message: The classification in a csv file that gets loaded when a project is instanced --- NEW FILE: classification.xsd --- <?xml version="1.0" encoding="UTF-8"?> <!-- XML Schema used for classification $Id: bprocessor.xsd,v 1.19 2006/10/10 14:04:45 nbramsen Exp $ --> <xsd:schema xmlns:cls="http://bprocessor.sourceforge.net" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- Type definitions --> <xsd:complexType name="BaseType"> <xsd:attribute name="id" type="xsd:long" use="required"/> <xsd:attribute name="name" type="xsd:string" use="required"/> </xsd:complexType> <xsd:complexType name="FirstType"> <xsd:complexContent> <xsd:extension base="BaseType"> <xsd:sequence> <xsd:element ref="second" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="SecondType"> <xsd:complexContent> <xsd:extension base="BaseType"> <xsd:sequence> <xsd:element ref="third" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="ThirdType"> <xsd:complexContent> <xsd:extension base="BaseType"> </xsd:extension> </xsd:complexContent> </xsd:complexType> <!-- Element definitions --> <xsd:element name="first" type="FirstType"/> <xsd:element name="second" type="SecondType"/> <xsd:element name="third" type="ThirdType"/> <!-- Main element --> <xsd:element name="cla"> <xsd:complexType> <xsd:sequence> <xsd:element ref="first" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
From: Nikolaj B. <nbr...@us...> - 2006-10-24 20:38:36
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8344/src/net/sourceforge/bprocessor/gui/attrview Modified Files: ClassificationAttribute.java GenericPanel.java Log Message: Changed the classification,to use the new classification model Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** GenericPanel.java 11 Oct 2006 06:23:07 -0000 1.21 --- GenericPanel.java 24 Oct 2006 20:38:28 -0000 1.22 *************** *** 27,30 **** --- 27,31 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Classification; import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; *************** *** 182,186 **** }); where.add(new AttributeRow(ba)); ! } else if (a.getValue() instanceof String[]) { // Handles the classification ClassificationAttribute ca = new ClassificationAttribute(a); --- 183,187 ---- }); where.add(new AttributeRow(ba)); ! } else if (a.getValue() instanceof Classification) { // Handles the classification ClassificationAttribute ca = new ClassificationAttribute(a); *************** *** 270,274 **** this.ga = ga; this.add(ga); ! if (ga.attribute().isEditable() || ga instanceof LinkAttribute) { ga.addMouseListener(this); } --- 271,276 ---- this.ga = ga; this.add(ga); ! if (ga.attribute().isEditable() || ga instanceof LinkAttribute ! || ga instanceof ClassificationAttribute) { ga.addMouseListener(this); } *************** *** 317,327 **** */ public void update() { ! if (simpleUpdate) { simpleUpdate(); simpleUpdate = false; } else { complexUpdate(); ! } } /** * --- 319,331 ---- */ public void update() { ! complexUpdate(); ! /*if (simpleUpdate) { simpleUpdate(); simpleUpdate = false; } else { complexUpdate(); ! }*/ } + /** * Index: ClassificationAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/ClassificationAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassificationAttribute.java 26 Jun 2006 11:37:52 -0000 1.1 --- ClassificationAttribute.java 24 Oct 2006 20:38:28 -0000 1.2 *************** *** 9,25 **** import java.awt.Dimension; ! import java.awt.event.FocusEvent; ! import java.awt.event.FocusListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; - import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import net.sourceforge.bprocessor.model.Attribute; /** --- 9,35 ---- import java.awt.Dimension; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.awt.event.KeyEvent; ! import java.awt.event.KeyListener; ! import java.awt.event.MouseEvent; ! import java.awt.event.MouseListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; + import java.util.StringTokenizer; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JLabel; + import javax.swing.JMenu; + import javax.swing.JMenuBar; + import javax.swing.JMenuItem; + import javax.swing.JTextField; import net.sourceforge.bprocessor.model.Attribute; + import net.sourceforge.bprocessor.model.Classification; + import net.sourceforge.bprocessor.model.Project; /** *************** *** 27,31 **** */ public class ClassificationAttribute extends GenericAttribute ! implements FocusListener { /** The listeners */ --- 37,41 ---- */ public class ClassificationAttribute extends GenericAttribute ! implements KeyListener, MouseListener, ActionListener { /** The listeners */ *************** *** 36,45 **** /** The component */ ! private JComponent component; /** The Label */ private JLabel label; ! --- 46,60 ---- /** The component */ ! private JComponent component1; ! ! /** The component */ ! private JComponent component2; /** The Label */ private JLabel label; ! /** The editor, when this EditableAttribute is being edited */ ! private JTextField editor; ! *************** *** 53,73 **** this.attribute = attribute; this.listeners = new LinkedList(); - - label = createLabel(attribute.getName()); - - Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); header.add(Box.createHorizontalStrut(7)); header.add(label); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); ! column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); - component = Box.createHorizontalBox(); - component.add(createValueLabel(attribute.getValue())); - this.add(component); - this.add(Box.createHorizontalGlue()); } --- 68,92 ---- this.attribute = attribute; this.listeners = new LinkedList(); Box column = Box.createVerticalBox(); + label = createLabel("Classification"); + component1 = Box.createHorizontalBox(); + component2 = Box.createHorizontalBox(); + if (attribute.getClassification() != null) { + component2.add(createValueLabel(attribute.getClassification().getFullId())); + } else { + component2.add(createValueLabel("None")); + } + Box header = Box.createHorizontalBox(); header.add(Box.createHorizontalStrut(7)); header.add(label); + header.add(component2); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); ! ! component1.add(createMenu(attribute.getValue())); ! column.add(component1); this.add(column); } *************** *** 85,88 **** --- 104,125 ---- /** + * Add a mouselisterner to the active elements in the ClassificationAttribute + * @param mouseListener the mouselistener + */ + public void addMouseListener(MouseListener mouseListener) { + label.addMouseListener(mouseListener); + component2.addMouseListener(mouseListener); + } + + /** + * Remove a mouselisterner to the active elements in the ClassificationAttribute + * @param mouseListener the mouselistener + */ + public void removeMouseListener(MouseListener mouseListener) { + label.removeMouseListener(mouseListener); + component2.removeMouseListener(mouseListener); + } + + /** * Add a listener that are notified when the value is changed * @param listener The listener *************** *** 116,127 **** * @return The label */ ! private JComponent createValueLabel(Object value) { ! JComboBox valueLabel; ! valueLabel = new JComboBox((String[]) value); if (attribute.getClassification() != null) { ! valueLabel.setSelectedItem(attribute.getClassification()); } valueLabel.addFocusListener(this); return valueLabel; } --- 153,209 ---- * @return The label */ ! private JComponent createMenu(Object value) { ! JMenuBar valueLabel = new JMenuBar(); ! JMenu menu, subMenu; ! MyMenuItem mi, submi; ! boolean hasChildren = false; if (attribute.getClassification() != null) { ! menu = new JMenu(attribute.getClassification().getName()); ! } else { ! menu = new JMenu("Classification"); ! } ! Iterator it = ((Classification) value).getChildren().iterator(); ! while (it.hasNext()) { ! Classification current = (Classification) it.next(); ! if (current.getChildren() != null) { ! hasChildren = true; ! } ! if (hasChildren) { ! Iterator subit = current.getChildren().iterator(); ! subMenu = new JMenu(current.getName()); ! submi = new MyMenuItem(current); ! submi.addActionListener(this); ! subMenu.add(submi); ! while (subit.hasNext()) { ! Classification subcur = (Classification) subit.next(); ! submi = new MyMenuItem(subcur); ! submi.addActionListener(this); ! subMenu.add(submi); ! } ! menu.add(subMenu); ! } else { ! mi = new MyMenuItem(current); ! mi.addActionListener(this); ! menu.add(mi); ! } } + valueLabel.add(menu); + return valueLabel; + + /* + JComboBox valueLabel; + valueLabel = new JComboBox(((Classification) value).getChildren()); + JMenu childs = new JMenu("Children"); + JMenuItem child = new JMenuItem("hat"); + childs.add(child); + child = new JMenuItem("hus"); + childs.add(child); + valueLabel.add(childs); + if (attribute.getClassification() != null) { + valueLabel.setSelectedItem(attribute.getClassification()); + } valueLabel.addFocusListener(this); return valueLabel; + */ } *************** *** 136,182 **** } - /** ! * Not in use ! * @param event The FocusEvent */ ! public void focusGained(FocusEvent event) { ! // TODO Auto-generated method stub ! } ! /** ! * Stop editing on the combobox ! * @param event The event */ ! public void focusLost(FocusEvent event) { ! attribute.setValue(((JComboBox) event.getSource()).getSelectedItem()); ! valueChanged(); } ! /** ! * Not in use */ public void startEditing() { ! // TODO Auto-generated method stub } ! /** ! * Not in use */ public void stopEditing() { ! // TODO Auto-generated method stub ! } ! /** ! * Not in use */ public void cancelEditing() { ! // TODO Auto-generated method stub } } --- 218,420 ---- } /** ! * Create a value label ! * @param value The value ! * @return The label */ ! private JComponent createValueLabel(Object value) { ! String s = ""; ! JLabel valueLabel; ! if (value instanceof String) { ! s = (String)value; ! } ! valueLabel = new JLabel(s); ! if (attribute.isEditable()) { ! valueLabel.setFont(AttributeView.FONT_PLAIN); ! } else { ! valueLabel.setFont(AttributeView.FONT_ITALIC); ! } ! return valueLabel; } ! /** ! * Create a value editor ! * @param value The value ! * @return The editor */ ! private JComponent createValueEditor(Object value) { ! String s = ""; ! if (value instanceof String) { ! s = (String)value; ! } ! JTextField valueEditor = new JTextField(s); ! valueEditor.setFont(AttributeView.FONT_PLAIN); + return valueEditor; } ! ! /** ! * Start editing the value by replacing the label with an editor */ public void startEditing() { ! if (editor == null) { ! component2.remove(0); ! if (attribute.getClassification() != null) { ! editor = (JTextField) createValueEditor(attribute.getClassification().getFullId()); ! } else { ! editor = (JTextField) createValueEditor(""); ! } ! editor.addKeyListener(this); ! component2.add(editor); ! component2.revalidate(); ! } ! editor.requestFocus(); ! editor.selectAll(); } ! /** ! * Stop editing the value by replacing the editor with an label, ! * and sending valueChanged to all listeners. */ public void stopEditing() { ! if (editor != null) { ! Object val = attribute.getValue(); ! String id = editor.getText(); ! StringTokenizer st = new StringTokenizer(id, "."); ! Classification clas = Project.getInstance().getClassification(); ! String curid; ! while (st.hasMoreTokens()) { ! curid = st.nextToken(); ! Iterator it = clas.getChildren().iterator(); ! while (it.hasNext()) { ! Classification current = (Classification) it.next(); ! if (curid.equalsIgnoreCase(current.getId().toString())) { ! clas = current; ! } ! } ! } ! attribute.setValue(clas); ! ! component2.remove(editor); ! editor.removeKeyListener(this); ! editor = null; ! component2.add(createValueLabel(clas.getFullId())); ! component2.revalidate(); ! valueChanged(); ! } } ! /** ! * Cancels editing the value by replacing the editor with an label, ! * without sending any events to listeners. */ public void cancelEditing() { ! if (editor != null) { ! component2.remove(editor); ! editor.removeKeyListener(this); ! editor = null; ! component2.add(createValueLabel(attribute.getValue())); ! component2.revalidate(); ! } ! } ! ! /** ! * Respond to the enter key by stopping editing. ! * @param event The KeyEvent ! */ ! public void keyPressed(KeyEvent event) { ! if (event.getKeyCode() == KeyEvent.VK_ENTER) { ! stopEditing(); ! } else if (event.getKeyCode() == KeyEvent.VK_ESCAPE) { ! cancelEditing(); ! } ! } ! ! /** ! * Not in use ! * @param event The KeyEvent ! */ ! public void keyTyped(KeyEvent event) { } ! /** ! * Not in use ! * @param event The KeyEvent ! */ ! public void keyReleased(KeyEvent event) { } ! ! /** ! * Start editing on the view ! * @param event The event ! */ ! public void mouseClicked(MouseEvent event) { ! startEditing(); ! } ! ! /** ! * Not in use ! * @param event The MouseEvent ! */ ! public void mousePressed(MouseEvent event) { } ! /** ! * Not in use ! * @param event The MouseEvent ! */ ! public void mouseReleased(MouseEvent event) { } ! /** ! * Not in use ! * @param event The MouseEvent ! */ ! public void mouseEntered(MouseEvent event) { } ! /** ! * Not in use ! * @param event The MouseEvent ! */ ! public void mouseExited(MouseEvent event) { } ! ! /** ! * Handles the event from the classification menu ! * @param e is the action event ! */ ! public void actionPerformed(ActionEvent e) { ! MyMenuItem source = (MyMenuItem)(e.getSource()); ! attribute.setValue(source.getClassification()); ! valueChanged(); ! } ! ! /** ! * extended version of JMenuItem that also contains a classification ! */ ! class MyMenuItem extends JMenuItem { ! ! /** the classification */ ! private Classification cla; ! ! /** ! * Constructor for a new MyMenuItem ! * @param classification the classification ! */ ! MyMenuItem(Classification classification) { ! super(classification.getName()); ! setClassification(classification); ! } ! ! /** ! * return the classification for the current menu item ! * @return the classification ! */ ! public Classification getClassification() { ! return cla; ! } + /** + * Sets the classification for a menu item + * @param cla the classification + */ + public void setClassification(Classification cla) { + this.cla = cla; + } } + } |
From: Michael L. <he...@us...> - 2006-10-23 06:48:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2961/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: Moved removeProtected/addProtected to Space from new ExtrusionTool Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ExtrusionTool.java 22 Oct 2006 14:32:55 -0000 1.40 --- ExtrusionTool.java 23 Oct 2006 06:48:50 -0000 1.41 *************** *** 66,132 **** } - - /** - * Remove extrusion to active space - * @param space Space - * @param extrusion Collection of surface - */ - public void remove(Space space, Collection extrusion) { - Iterator surfaces = extrusion.iterator(); - while (surfaces.hasNext()) { - Surface surface = (Surface) surfaces.next(); - if (surface.getOwner() == space) { - space.remove(surface); - } - Iterator edges = surface.getEdges().iterator(); - while (edges.hasNext()) { - Edge edge = (Edge) edges.next(); - if (!extrudesurface.contains(edge)) { - if (edge.getOwner() == space) { - space.remove(edge); - } - Vertex from = edge.getFrom(); - if (from.getOwner() == space) { - space.remove(from); - } - Vertex to = edge.getTo(); - if (to.getOwner() == space) { - space.remove(to); - } - } - } - } - } - - /** - * Add extrusion from space - * @param space Space - * @param extrusion Collection of surfaces - */ - public void add(Space space, Collection extrusion) { - Iterator surfaces = extrusion.iterator(); - while (surfaces.hasNext()) { - Surface surface = (Surface) surfaces.next(); - Iterator edges = surface.getEdges().iterator(); - while (edges.hasNext()) { - Edge edge = (Edge) edges.next(); - Vertex from = edge.getFrom(); - if (from.getOwner() == null) { - space.add(from); - } - Vertex to = edge.getTo(); - if (to.getOwner() == null) { - space.add(to); - } - if (edge.getOwner() == null) { - space.add(edge); - } - } - if (surface.getOwner() == null) { - space.add(surface); - } - } - } - /** * Insert extrusion into space --- 66,69 ---- *************** *** 151,155 **** Space space = Project.getInstance().getActiveSpace(); if (extrusion != null) { ! remove(space, extrusion); extrusion = null; } --- 88,92 ---- Space space = Project.getInstance().getActiveSpace(); if (extrusion != null) { ! space.removeProtected(extrusion); extrusion = null; } *************** *** 169,173 **** insert(space, extrusion); } else { ! add(space, extrusion); } } --- 106,110 ---- insert(space, extrusion); } else { ! space.addProtected(extrusion); } } *************** *** 280,284 **** to = null; if (extrusion != null) { ! remove(Project.getInstance().getActiveSpace(), extrusion); extrusion = null; } --- 217,221 ---- to = null; if (extrusion != null) { ! Project.getInstance().getActiveSpace().removeProtected(extrusion); extrusion = null; } |
From: Michael L. <he...@us...> - 2006-10-23 06:48:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2949/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Moved removeProtected/addProtected to Space from new ExtrusionTool Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** Space.java 20 Oct 2006 17:04:45 -0000 1.85 --- Space.java 23 Oct 2006 06:48:46 -0000 1.86 *************** *** 2128,2131 **** --- 2128,2201 ---- return true; } + + /** + * Remove collection of surfaces from this space + * @param extrusion Collection of surfaces + */ + public void removeProtected(Collection extrusion) { + Iterator surfaces = extrusion.iterator(); + while (surfaces.hasNext()) { + Surface surface = (Surface) surfaces.next(); + if (surface.getOwner() == this) { + if (surface.protect()) { + this.remove(surface); + } + } + Iterator edges = surface.getEdges().iterator(); + while (edges.hasNext()) { + Edge edge = (Edge) edges.next(); + if (edge.getOwner() == this) { + if (edge.protect()) { + this.remove(edge); + } + } + Vertex from = edge.getFrom(); + if (from.getOwner() == this) { + if (from.protect()) { + this.remove(from); + } + } + Vertex to = edge.getTo(); + if (to.getOwner() == this) { + if (to.protect()) { + this.remove(to); + } + } + } + } + } + + /** + * Add extrusion to this space + * @param extrusion Collection of surfaces + */ + public void addProtected(Collection extrusion) { + Iterator surfaces = extrusion.iterator(); + while (surfaces.hasNext()) { + Surface surface = (Surface) surfaces.next(); + Iterator edges = surface.getEdges().iterator(); + while (edges.hasNext()) { + Edge edge = (Edge) edges.next(); + Vertex from = edge.getFrom(); + if (from.getOwner() == null) { + from.protect(true); + this.add(from); + } + Vertex to = edge.getTo(); + if (to.getOwner() == null) { + to.protect(true); + this.add(to); + } + if (edge.getOwner() == null) { + edge.protect(true); + this.add(edge); + } + } + if (surface.getOwner() == null) { + surface.protect(true); + this.add(surface); + } + } + } /** |
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8751/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java ExtrudeTool.java ToolFactory.java SpaceTool.java AbstractPencil.java Added Files: ExtrusionTool.java Log Message: New extrusion tool: - Uses the new Space.insert() operations that integrates new geometry with existing geometry. - Direction of extrusion can be changed during extrusion Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ExtrudeTool.java 10 Oct 2006 15:01:01 -0000 1.25 --- ExtrudeTool.java 22 Oct 2006 14:32:55 -0000 1.26 *************** *** 29,38 **** */ public class ExtrudeTool extends AbstractPencil { - - /** Limit offset */ - static final boolean LIMIT = false; /** If the mode has not been decided */ ! static final int UNDICIDED = 0; /** If the input mode is press - press */ --- 29,35 ---- */ public class ExtrudeTool extends AbstractPencil { /** If the mode has not been decided */ ! static final int UNDECIDED = 0; /** If the input mode is press - press */ *************** *** 40,44 **** /** Tool mode */ ! private int mode = UNDICIDED; /** The dragSurface */ --- 37,41 ---- /** Tool mode */ ! private int mode = UNDECIDED; /** The dragSurface */ *************** *** 98,102 **** prevX = e.getX(); prevY = e.getY(); ! if (mode == UNDICIDED) { cleanUp(); findTarget(e); --- 95,99 ---- prevX = e.getX(); prevY = e.getY(); ! if (mode == UNDECIDED) { cleanUp(); findTarget(e); *************** *** 186,190 **** sides = null; } ! mode = UNDICIDED; } --- 183,187 ---- sides = null; } ! mode = UNDECIDED; } *************** *** 239,243 **** removeExtrusion(); } ! mode = UNDICIDED; } --- 236,240 ---- removeExtrusion(); } ! mode = UNDECIDED; } *************** *** 259,263 **** sides = null; holeSides = null; ! mode = UNDICIDED; super.cleanUp(); } --- 256,260 ---- sides = null; holeSides = null; ! mode = UNDECIDED; super.cleanUp(); } *************** *** 288,292 **** */ protected void findLimits() { - if (direction > 0) { lowerLimit = 0.0; --- 285,288 ---- *************** *** 297,332 **** lowerLimit = Double.NEGATIVE_INFINITY; } - if (LIMIT) { - Collection surfaces = Project.getInstance().getActiveSpace().getSurfaces(); - Iterator iter = surfaces.iterator(); - Vertex normal = top.normal(); - Vertex origin = extrudeSurface.getFirstVertex(); - while (iter.hasNext()) { - Surface current = (Surface) iter.next(); - if (current != extrudeSurface && current != top) { - Vertex n = current.normal(); - Vertex cross = normal.cross(n); - if (cross.isZero()) { - Vertex o = current.getFirstVertex(); - Vertex vector = o.minus(origin); - double d = vector.dot(normal); - if (direction > 0) { - if (d > 0.0000001) { - if (d < upperLimit) { - upperLimit = d; - } - } - } - if (direction < 0) { - if (d < -0.0000001) { - if (d > lowerLimit) { - lowerLimit = d; - } - } - } - } - } - } - } } --- 293,296 ---- *************** *** 336,340 **** */ protected void moved(MouseEvent e) { ! if (mode == UNDICIDED) { findTarget(e); if (target != null) { --- 300,304 ---- */ protected void moved(MouseEvent e) { ! if (mode == UNDECIDED) { findTarget(e); if (target != null) { *************** *** 383,431 **** } } else { ! if (!LIMIT) { ! Set elements = new HashSet(); ! { ! Set edges = new HashSet(); ! elements.add(extrudeSurface); ! elements.addAll(sides); ! elements.add(top); ! if (holeSides != null) { ! elements.addAll(holeSides); ! } ! Iterator iter = elements.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! edges.addAll(current.getEdges()); ! } ! elements.addAll(edges); } ! findTarget(e, elements); ! if (target instanceof Surface) { ! Vertex origin = extrudeSurface.getFirstVertex(); ! Surface surface = (Surface) target; ! if (surface != extrudeSurface && surface != top && !elements.contains(surface)) { ! Vertex n = surface.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! Vertex o = surface.getFirstVertex(); ! Vertex vector = o.minus(origin); ! double d = vector.dot(normal); ! if (Math.abs(d) > 0.0000001) { ! moveTo(d); ! return; ! } } } } ! if (target instanceof Edge) { ! Vertex origin = extrudeSurface.getFirstVertex(); ! Edge edge = (Edge) target; ! Vertex o = edge.center(); ! Vertex vector = o.minus(origin); ! double d = vector.dot(normal); ! if (Math.abs(d) > 0.0000001) { ! moveTo(d); ! return; ! } } } --- 347,393 ---- } } else { ! Set elements = new HashSet(); ! { ! Set edges = new HashSet(); ! elements.add(extrudeSurface); ! elements.addAll(sides); ! elements.add(top); ! if (holeSides != null) { ! elements.addAll(holeSides); } ! Iterator iter = elements.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! edges.addAll(current.getEdges()); ! } ! elements.addAll(edges); ! } ! findTarget(e, elements); ! if (target instanceof Surface) { ! Vertex origin = extrudeSurface.getFirstVertex(); ! Surface surface = (Surface) target; ! if (surface != extrudeSurface && surface != top && !elements.contains(surface)) { ! Vertex n = surface.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! Vertex o = surface.getFirstVertex(); ! Vertex vector = o.minus(origin); ! double d = vector.dot(normal); ! if (Math.abs(d) > 0.0000001) { ! moveTo(d); ! return; } } } ! } ! if (target instanceof Edge) { ! Vertex origin = extrudeSurface.getFirstVertex(); ! Edge edge = (Edge) target; ! Vertex o = edge.center(); ! Vertex vector = o.minus(origin); ! double d = vector.dot(normal); ! if (Math.abs(d) > 0.0000001) { ! moveTo(d); ! return; } } Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** MoveTool.java 10 Oct 2006 15:02:07 -0000 1.71 --- MoveTool.java 22 Oct 2006 14:32:55 -0000 1.72 *************** *** 215,219 **** last = null; active = false; - dragging = false; excluded(new LinkedList()); super.cleanUp(); --- 215,218 ---- Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** ToolFactory.java 9 Oct 2006 14:02:05 -0000 1.61 --- ToolFactory.java 22 Oct 2006 14:32:55 -0000 1.62 *************** *** 62,67 **** private AbstractTool controlled; ! /** extrusion tool */ ! private ExtrudeTool extrusion; /** pencil tool */ --- 62,67 ---- private AbstractTool controlled; ! /** Extrusion tool */ ! private ExtrusionTool extrude; /** pencil tool */ *************** *** 175,179 **** alternate = new VectorMoveTool(glv, pencilcursor); controlled = new ControlledMoveTool(glv, pencilcursor); ! extrusion = new ExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); --- 175,179 ---- alternate = new VectorMoveTool(glv, pencilcursor); controlled = new ControlledMoveTool(glv, pencilcursor); ! extrude = new ExtrusionTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); *************** *** 199,204 **** arcb.setMnemonic(KeyEvent.VK_Z); tb.addSeparator(3); ! extrudeBut = this.registerTool(Tool.EXTRUSION_TOOL, extrusion, ! "Biconextrudetool.gif", "Extrude"); extrudeBut.setMnemonic(KeyEvent.VK_V); moveBut = this.registerTool(Tool.MOVE_TOOL, alternate, "Biconmovetool.gif", "Move"); --- 199,203 ---- arcb.setMnemonic(KeyEvent.VK_Z); tb.addSeparator(3); ! extrudeBut = registerTool(Tool.EXTRUSION_TOOL, extrude, "Biconextrudetool.gif", "Extrude"); extrudeBut.setMnemonic(KeyEvent.VK_V); moveBut = this.registerTool(Tool.MOVE_TOOL, alternate, "Biconmovetool.gif", "Move"); --- NEW FILE: ExtrusionTool.java --- //--------------------------------------------------------------------------------- // $Id: ExtrusionTool.java,v 1.40 2006/10/22 14:32:55 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Set; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * Extrusion Tool */ public class ExtrusionTool extends AbstractPencil { /** Surface to extrude */ private Surface extrudesurface; /** start x */ private int startx; /** start y */ private int starty; /** drag plane */ private Plane dragplane; /** from */ private Vertex from; /** to */ private Vertex to; /** extrude distance */ private double distance; /** extrue all */ private boolean all; /** Extrusion */ private Collection extrusion; /** * Constructor * @param glv GLVIew * @param cursor Cursor */ public ExtrusionTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Remove extrusion to active space * @param space Space * @param extrusion Collection of surface */ public void remove(Space space, Collection extrusion) { Iterator surfaces = extrusion.iterator(); while (surfaces.hasNext()) { Surface surface = (Surface) surfaces.next(); if (surface.getOwner() == space) { space.remove(surface); } Iterator edges = surface.getEdges().iterator(); while (edges.hasNext()) { Edge edge = (Edge) edges.next(); if (!extrudesurface.contains(edge)) { if (edge.getOwner() == space) { space.remove(edge); } Vertex from = edge.getFrom(); if (from.getOwner() == space) { space.remove(from); } Vertex to = edge.getTo(); if (to.getOwner() == space) { space.remove(to); } } } } } /** * Add extrusion from space * @param space Space * @param extrusion Collection of surfaces */ public void add(Space space, Collection extrusion) { Iterator surfaces = extrusion.iterator(); while (surfaces.hasNext()) { Surface surface = (Surface) surfaces.next(); Iterator edges = surface.getEdges().iterator(); while (edges.hasNext()) { Edge edge = (Edge) edges.next(); Vertex from = edge.getFrom(); if (from.getOwner() == null) { space.add(from); } Vertex to = edge.getTo(); if (to.getOwner() == null) { space.add(to); } if (edge.getOwner() == null) { space.add(edge); } } if (surface.getOwner() == null) { space.add(surface); } } } /** * Insert extrusion into space * @param space Space * @param extrusion Collection of surfaces */ public void insert(Space space, Collection extrusion) { Iterator surfaces = extrusion.iterator(); while (surfaces.hasNext()) { Surface surface = (Surface) surfaces.next(); space.insert(surface); } } /** * Extrude * @param distance double * @param all Extrude all * @param finish Finish extrusion */ public void extrude(double distance, boolean all, boolean finish) { Space space = Project.getInstance().getActiveSpace(); if (extrusion != null) { remove(space, extrusion); extrusion = null; } extrusion = new LinkedList(); Set sides = new HashSet(); Set tops = new HashSet(); if (all) { extrudesurface.extrusionall(distance, sides, tops); extrusion.addAll(sides); extrusion.addAll(tops); } else { Surface top = extrudesurface.extrusion(distance, sides); extrusion.add(top); extrusion.addAll(sides); } if (finish) { insert(space, extrusion); } else { add(space, extrusion); } } /** * Moved * @param e MouseEvent */ protected void moved(MouseEvent e) { if (extrudesurface == null) { findTarget(e); if (target instanceof Surface) { glv.getView().makeTarget(target); } else if (target == null) { glv.getView().makeTarget(null); } } else { active = true; to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); Vertex normal = extrudesurface.normal(); Set elements = new HashSet(); if (extrusion != null) { elements.addAll(extrusion); elements.addAll(Surface.edges(extrusion)); elements.add(extrudesurface); } findTarget(e, elements); if (target instanceof Surface) { Surface surface = (Surface) target; Vertex n = surface.normal(); Vertex cross = normal.cross(n); if (cross.isZero()) { Vertex v = surface.getFirstVertex(); if (!extrudesurface.plane().contains(v)) { to = v; } } } else if (target instanceof Edge) { Edge edge = (Edge) target; to = edge.center(); Vertex v = edge.center(); if (!extrudesurface.plane().contains(v)) { to = v; } } Vertex delta = to.minus(from); distance = normal.dot(delta); extrude(distance, all, false); } } /** * Pressed * @param e MouseEvent */ protected void pressed(MouseEvent e) { if (extrudesurface == null) { findTarget(e); if (target instanceof Surface) { extrudesurface = (Surface) target; startx = e.getX(); starty = e.getY(); View view = glv.getView(); Transformation trans = view.transformation(); double x = startx; double y = View.getHeight() - starty; Vertex near = new Vertex(x, y, 0.0); Vertex far = new Vertex(x, y, 1.0); Edge ray = new Edge(near, far); ray = trans.unProject(ray); Plane plane = extrudesurface.plane(); dragplane = plane.orthogonalPlane(ray); from = view.toPlaneCoords(new double[] {startx, starty}, dragplane); all = !e.isAltDown(); } } else { if (extrusion != null) { extrude(distance, all, true); extrusion = null; Project.getInstance().checkpoint(); } cleanUp(); moved(e); } } /** * Apply current tool with specified length value * @param length The lengthfield value */ public void apply(double length) { if (extrusion != null) { if (distance < 0) { length = -length; } extrude(length, all, true); extrusion = null; Project.getInstance().checkpoint(); cleanUp(); } } /** * */ public void cleanUp() { all = false; dragplane = null; from = null; to = null; if (extrusion != null) { remove(Project.getInstance().getActiveSpace(), extrusion); extrusion = null; } extrudesurface = null; super.cleanUp(); } } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** AbstractPencil.java 10 Oct 2006 14:59:33 -0000 1.70 --- AbstractPencil.java 22 Oct 2006 14:32:55 -0000 1.71 *************** *** 97,104 **** protected Timer timer; ! /** Wherther or not the tool is doing some work */ protected boolean active; ! /** Wherther or not the tool is dragging */ protected boolean dragging; --- 97,104 ---- protected Timer timer; ! /** Whether or not the tool is doing some work */ protected boolean active; ! /** Whether or not the tool is dragging */ protected boolean dragging; Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** SpaceTool.java 20 Oct 2006 17:04:40 -0000 1.58 --- SpaceTool.java 22 Oct 2006 14:32:55 -0000 1.59 *************** *** 769,772 **** --- 769,799 ---- }); + globals.put("extrudeall", new Builtin() { + public void evaluate(Environment env, Stack stack) { + Surface surface = (Surface) env.get(0); + Double distance = (Double) env.get(1); + HashSet sides = new HashSet(); + HashSet tops = new HashSet(); + surface.extrusionall(distance.doubleValue(), sides, tops); + stack.push(surface); + { + Iterator iter = sides.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + stack.push(current); + } + } + { + Iterator iter = tops.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + stack.push(current); + } + } + } + }); + + + String script = Project.getInstance().getScript(); try { *************** *** 811,814 **** --- 838,842 ---- } catch (Exception error) { System.out.println(error); + error.printStackTrace(); } } catch (Exception error) { |
From: Michael L. <he...@us...> - 2006-10-22 14:33:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8751/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: New extrusion tool: - Uses the new Space.insert() operations that integrates new geometry with existing geometry. - Direction of extrusion can be changed during extrusion Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** View.java 5 Oct 2006 13:50:28 -0000 1.157 --- View.java 22 Oct 2006 14:32:56 -0000 1.158 *************** *** 1747,1751 **** if (frontDomain != null) { ! frontName = frontDomain.getName(); } else { frontName = "None"; --- 1747,1751 ---- if (frontDomain != null) { ! frontName = frontDomain.getDisplayName(); } else { frontName = "None"; *************** *** 1753,1757 **** if (backDomain != null) { ! backName = backDomain.getName(); } else { backName = "None"; --- 1753,1757 ---- if (backDomain != null) { ! backName = backDomain.getDisplayName(); } else { backName = "None"; |
From: Michael L. <he...@us...> - 2006-10-22 14:32:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8737/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: New extrusion tool: - Uses the new Space.insert() operations that integrates new geometry with existing geometry. - Direction of extrusion can be changed during extrusion Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** Surface.java 19 Oct 2006 09:56:21 -0000 1.116 --- Surface.java 22 Oct 2006 14:32:47 -0000 1.117 *************** *** 457,460 **** --- 457,479 ---- /** + * Extrude with holes + * @param delta Distance to extrude + * @param sides Collection of extruded sides + * @param tops Collection of extruede tops + * @return Extruded top + */ + public Surface extrusionall(double delta, Set sides, Set tops) { + Surface top = extrusion(delta, sides); + tops.add(top); + Iterator iter = getHoles().iterator(); + while (iter.hasNext()) { + Surface hole = (Surface) iter.next(); + Surface holetop = hole.extrusionall(delta, sides, tops); + top.addHole(holetop); + } + return top; + } + + /** * Extrusion * @param delta Dinstance |
From: Michael L. <he...@us...> - 2006-10-22 14:32:51
|
Update of /cvsroot/bprocessor/facade In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8729 Modified Files: .classpath Log Message: New extrusion tool: - Uses the new Space.insert() operations that integrates new geometry with existing geometry. - Direction of extrusion can be changed during extrusion Index: .classpath =================================================================== RCS file: /cvsroot/bprocessor/facade/.classpath,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .classpath 21 Aug 2006 14:17:55 -0000 1.5 --- .classpath 22 Oct 2006 14:32:40 -0000 1.6 *************** *** 6,10 **** <classpathentry combineaccessrules="false" kind="src" path="/gl"/> <classpathentry combineaccessrules="false" kind="src" path="/gui"/> - <classpathentry combineaccessrules="false" kind="src" path="/kernel"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/model"/> <classpathentry kind="output" path="build"/> --- 6,9 ---- |
From: Michael L. <he...@us...> - 2006-10-20 17:04:58
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24224/src/net/sourceforge/bprocessor/gui/attrview Modified Files: LinkAttribute.java Log Message: The display name of a space again contains the ID Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** LinkAttribute.java 17 Sep 2006 22:02:20 -0000 1.13 --- LinkAttribute.java 20 Oct 2006 17:04:50 -0000 1.14 *************** *** 174,178 **** JLabel valueLabel; if (value instanceof Entity) { ! s = ((Entity)value).getName(); } else if (value instanceof Project) { s = ((Project)value).getName(); --- 174,182 ---- JLabel valueLabel; if (value instanceof Entity) { ! if (value instanceof Space) { ! s = ((Space)value).getDisplayName(); ! } else { ! s = ((Entity)value).getName(); ! } } else if (value instanceof Project) { s = ((Project)value).getName(); |