bprocessor-commit Mailing List for B-processor (Page 161)
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...> - 2005-09-14 14:09:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27004/tool Modified Files: ToolFactory.java Log Message: nothing at all Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ToolFactory.java 9 Sep 2005 12:32:26 -0000 1.6 --- ToolFactory.java 14 Sep 2005 14:09:38 -0000 1.7 *************** *** 30,35 **** private static ToolFactory factory; - - /** select tool */ private SelectTool select; --- 30,33 ---- |
From: rimestad <rim...@us...> - 2005-09-14 14:09:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26878/tool Modified Files: SelectTool.java Log Message: added space selection Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SelectTool.java 13 Sep 2005 17:42:31 -0000 1.19 --- SelectTool.java 14 Sep 2005 14:09:06 -0000 1.20 *************** *** 30,34 **** import java.util.Iterator; - //import java.util.List; import java.util.ArrayList; import java.util.Set; --- 30,33 ---- *************** *** 90,108 **** protected void pressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { ! findTarget(e); ! if (target == null) { ! log.info("target was null"); ! selection = new ArrayList(); ! } else if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { ! if (!selection.contains(target)) { ! select(target); ! //selection.add(target); ! } else { ! deselect(target); } } else { ! selection = new ArrayList(); ! select(target); ! //selection.add(target); } } --- 89,120 ---- protected void pressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { ! if (e.getClickCount() >= 2 && target instanceof Surface) { ! ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ! ConstructionSpace cs = (ConstructionSpace)csf.findBySurface((Surface)target); ! Set s = cs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (!selection.contains(surface)) { ! selection.add(surface); ! } } } else { ! findTarget(e); ! if (target == null) { ! selection = new ArrayList(); ! } else if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) ! == InputEvent.SHIFT_DOWN_MASK) { ! if (!selection.contains(target)) { ! select(target); ! } else { ! deselect(target); ! } ! } else { ! if (!selection.contains(target)) { ! selection = new ArrayList(); ! select(target); ! } ! } } } *************** *** 289,293 **** } } ! } } --- 301,306 ---- } } ! } ! glv.repaint(); } |
From: rimestad <rim...@us...> - 2005-09-14 14:07:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26381/view Modified Files: AbstractView.java Log Message: removed a null pointer appotunity Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AbstractView.java 12 Sep 2005 18:13:02 -0000 1.26 --- AbstractView.java 14 Sep 2005 14:07:37 -0000 1.27 *************** *** 484,489 **** if (drawMode == LIGHTING_MODE) { Vertex norm = s.normal(); ! norm.scale(1 / norm.length()); ! gl.glNormal3d(norm.getX(), norm.getY(), norm.getZ()); } //drawing the outer contour --- 484,491 ---- if (drawMode == LIGHTING_MODE) { Vertex norm = s.normal(); ! if (norm != null) { ! norm.scale(1 / norm.length()); ! gl.glNormal3d(norm.getX(), norm.getY(), norm.getZ()); ! } } //drawing the outer contour |
From: rimestad <rim...@us...> - 2005-09-14 14:06:27
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26036 Modified Files: ConstructionSpaceFacade.java Log Message: corrected javadoc Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConstructionSpaceFacade.java 12 Sep 2005 18:17:58 -0000 1.5 --- ConstructionSpaceFacade.java 14 Sep 2005 14:06:19 -0000 1.6 *************** *** 203,210 **** return result; } ! /** * Find the Construction spaces matched with a surface ! * @param surface The the surface * @return The space the given surface is conected with */ --- 203,210 ---- return result; } ! /** * Find the Construction spaces matched with a surface ! * @param surface The surface * @return The space the given surface is conected with */ |
From: rimestad <rim...@us...> - 2005-09-14 14:06:01
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25892 Modified Files: Edge.java Log Message: added set and get length Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Edge.java 8 Sep 2005 10:42:14 -0000 1.9 --- Edge.java 14 Sep 2005 14:05:45 -0000 1.10 *************** *** 277,279 **** --- 277,307 ---- return SurfaceFacade.getInstance().findByEdge(this); } + + /** + * returns the length of the edge + * @return The length + */ + public double getLength() { + double dx = to.getX() - from.getX(); + double dy = to.getY() - from.getY(); + double dz = to.getZ() - from.getZ(); + return Math.sqrt(dx * dx + dy * dy + dz * dz); + } + + /** + * sets the length of the edge to the given double + * @param d The length + */ + public void setLength(double d) { + double dx = to.getX() - from.getX(); + double dy = to.getY() - from.getY(); + double dz = to.getZ() - from.getZ(); + double length = d * d; + + double res = Math.sqrt(length / (dx * dx + dy * dy + dz * dz)); + + to.setX(dx * res + from.getX()); + to.setY(dy * res + from.getY()); + to.setZ(dz * res + from.getZ()); + } } |
From: rimestad <rim...@us...> - 2005-09-14 14:02:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24941 Modified Files: GLView.java Log Message: added length field Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GLView.java 12 Sep 2005 18:04:33 -0000 1.14 --- GLView.java 14 Sep 2005 14:02:13 -0000 1.15 *************** *** 11,14 **** --- 11,19 ---- import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.view.ViewFactory; + import net.sourceforge.bprocessor.model.EdgeFacade; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.kernel.notification.NotificationListener; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.GUI; *************** *** 17,21 **** import net.java.games.jogl.GLDrawableFactory; import net.java.games.jogl.GLCanvas; ! //import java.awt.Dimension; import org.apache.log4j.Logger; --- 22,30 ---- import net.java.games.jogl.GLDrawableFactory; import net.java.games.jogl.GLCanvas; ! import java.awt.Dimension; ! import java.awt.BorderLayout; ! import javax.swing.JTextField; ! import javax.swing.JPanel; ! import javax.swing.JLabel; import org.apache.log4j.Logger; *************** *** 37,40 **** --- 46,52 ---- private Tool tool; + /** the length parameter */ + private LengthField lengthField; + /** * Constuctor *************** *** 47,51 **** glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); ! //glc.setPreferredSize(new Dimension(0, 0)); view = ViewFactory.getFactory(this).getDefault(); glc.addGLEventListener(view); --- 59,74 ---- glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); ! JPanel jp = new JPanel(); ! jp.setPreferredSize(new Dimension(450, 450)); ! jp.setLayout(new BorderLayout()); ! jp.add(glc, BorderLayout.CENTER); ! ! JPanel lengthPanel = new JPanel(); ! lengthPanel.setLayout(new BorderLayout()); ! lengthPanel.add(new JLabel("LENGTH: "), BorderLayout.WEST); ! lengthField = new LengthField(); ! lengthPanel.add(lengthField, BorderLayout.CENTER); ! jp.add(lengthPanel, BorderLayout.SOUTH); ! view = ViewFactory.getFactory(this).getDefault(); glc.addGLEventListener(view); *************** *** 56,60 **** glc.addKeyListener(tool); ! GUI.getInstance().registerPanel(glc, GUI.SPLIT_MIDDLE); log.info("Done Creating GlView"); glc.setAutoSwapBufferMode(false); --- 79,83 ---- glc.addKeyListener(tool); ! GUI.getInstance().registerPanel(jp, GUI.SPLIT_MIDDLE); log.info("Done Creating GlView"); glc.setAutoSwapBufferMode(false); *************** *** 107,112 **** } } ! ! /** --- 130,149 ---- } } ! ! /** ! * Set the length in the lengthField display ! * @param length The new length ! */ ! public void setLength(double length) { ! lengthField.setText(length); ! } ! ! /** ! * Get the length ! * @return The length ! */ ! public double getLength() { ! return lengthField.getDouble(); ! } /** *************** *** 133,135 **** --- 170,239 ---- return glc; } + + /** + * The length field class + */ + class LengthField extends JTextField implements NotificationListener { + /** The logger */ + private Logger log = Logger.getLogger(LengthField.class); + + /** + * The constructor + */ + public LengthField() { + super(15); + + Notifier.getInstance().addListener(this); + } + + /** + * set the text in the length field + * do only take integer + * @param d The integer + */ + public void setText(double d) { + super.setText(Double.toString(d)); + } + + /** + * Return the double in the textfield + * @return The double in the field + */ + public double getDouble() { + try { + double d = Double.parseDouble(super.getText()); + return d; + } catch (NumberFormatException e) { + log.warn(e); + } + return 0; + } + + /** + * Handle a notification + * @param n The notification + */ + public void handleNotification(Notification n) { + if (n.getType().equals(Notification.EDGE_SELECTED)) { + Edge e = (Edge)(EdgeFacade.getInstance().findById(n.getObject())); + setText(e.getLength()); + } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { + setText(0); + } + } + + + /** + * Should the listener handle this notification + * @param type The notification type + * @return Returns true on SELECTED events; otherwise false + */ + public boolean isNotificationEnabled(String type) { + if (type.equals(Notification.EDGE_SELECTED) || + type.equals(Notification.EDGE_DESELECTED)) { + return true; + } + return false; + } + } } |
From: rimestad <rim...@us...> - 2005-09-14 14:02:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24941/tool Modified Files: PencilTool.java Log Message: added length field Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PencilTool.java 14 Sep 2005 07:03:44 -0000 1.18 --- PencilTool.java 14 Sep 2005 14:02:13 -0000 1.19 *************** *** 8,11 **** --- 8,12 ---- import java.awt.event.MouseEvent; + import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; *************** *** 41,45 **** /** The active */ protected Edge active = null; ! /** The from */ protected Vertex from = null; --- 42,46 ---- /** The active */ protected Edge active = null; ! /** The from */ protected Vertex from = null; *************** *** 65,68 **** --- 66,72 ---- protected List edges = null; + /** The wanted length of the previous edge */ + private String number = ""; + /** * Constructor *************** *** 128,131 **** --- 132,137 ---- System.out.println(vertex); setAlignVertex(vertex); + number = ""; + if (active == null) { edges = new ArrayList(); *************** *** 149,153 **** active.setTo(vertex); intern(active); ! from = vertex; active = new Edge("E" + edgeNum++, from, to); --- 155,159 ---- active.setTo(vertex); intern(active); ! from = vertex; active = new Edge("E" + edgeNum++, from, to); *************** *** 316,319 **** --- 322,330 ---- findVertex(e); + /** Show the length of the active edge */ + if (active != null) { + glv.setLength(active.getLength()); + } + if (to != null) { to.setX(current.getX()); *************** *** 342,345 **** --- 353,453 ---- View v = glv.getView(); } + + /** + * Invoked when a key has been pressed. Lets user delete what is selected. + * @param e The KeyEvent + */ + public void keyPressed(KeyEvent e) { + boolean changed = false; + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + Iterator it = edges.iterator(); + while (it.hasNext()) { + Edge edge = (Edge)it.next(); + deleteEdge(edge); + } + edges = null; + active = null; + glv.getView().setActiveEdge(null); + from = null; + to = null; + setAlignVertex(null); + glv.getView().setSnapVertex(null); + exterior = null; + } else if (e.getKeyCode() == KeyEvent.VK_1) { + number += "1"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_2) { + number += "2"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_3) { + number += "3"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_4) { + number += "4"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_5) { + number += "5"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_6) { + number += "6"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_7) { + number += "7"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_8) { + number += "8"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_9) { + number += "9"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_0) { + number += "0"; + changed = true; + log.info(number); + } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + try { + if (active != null) { + double d = Double.parseDouble(number); + active.setLength(d); + current.setX(to.getX()); + current.setY(to.getY()); + current.setZ(to.getZ()); + onVertex(current); + glv.repaint(); + } + } catch (NumberFormatException exp) { + log.warn(exp); + } + } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { + int length = number.length(); + if (length > 0) { + number = number.substring(0, length - 1); + } else { + number = String.valueOf(0); + } + changed = true; + } else { + super.keyPressed(e); + } + if (changed) { + try { + if (active != null) { + double d = Double.parseDouble(number); + glv.setLength(d); + } + } catch (NumberFormatException exp) { + log.warn(exp); + } + } + } /** |
From: rimestad <rim...@us...> - 2005-09-14 12:15:10
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31008 Modified Files: DrawTool.java Log Message: minor fix Index: DrawTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DrawTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DrawTool.java 2 Sep 2005 13:44:19 -0000 1.8 --- DrawTool.java 14 Sep 2005 12:14:57 -0000 1.9 *************** *** 81,85 **** View v = glv.getView(); ! double[] coords = v.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); // snap to grid coords = snapToGrid(coords); --- 81,85 ---- View v = glv.getView(); ! double[] coords = v.toCanvasCoords(new double[]{e.getX(), e.getY()}); // snap to grid coords = snapToGrid(coords); |
From: rimestad <rim...@us...> - 2005-09-14 07:03:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26218 Modified Files: PencilTool.java Log Message: Added the space automation Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PencilTool.java 8 Sep 2005 08:21:06 -0000 1.17 --- PencilTool.java 14 Sep 2005 07:03:44 -0000 1.18 *************** *** 5,9 **** // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- - package net.sourceforge.bprocessor.gl.tool; --- 5,8 ---- *************** *** 24,32 **** --- 23,41 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; + import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; + import net.sourceforge.bprocessor.model.FunctionalSpace; + import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; + import net.sourceforge.bprocessor.model.ConstructionSpace; + import net.sourceforge.bprocessor.model.Space; + + import java.util.Iterator; + import org.apache.log4j.Logger; /** * The DebugTool */ public class PencilTool extends SelectTool { + /** The logger */ + private static Logger log = Logger.getLogger(PencilTool.class); /** The active */ *************** *** 40,44 **** /** The current */ - protected Vertex current = null; --- 49,52 ---- *************** *** 47,51 **** /** The exterior Surface is a Surface, where a hole is being defined */ - protected Surface exterior = null; --- 55,58 ---- *************** *** 54,60 **** */ protected Set candiates = null; ! ! /** The edges */ ! protected List edges = null; --- 61,66 ---- */ protected Set candiates = null; ! ! /** The edges */ protected List edges = null; *************** *** 100,103 **** --- 106,110 ---- alignVertex = vertex; } + /** * Intern the surface *************** *** 109,112 **** --- 116,120 ---- } } + /** * Called with the vertex that are clicked on - either: *************** *** 161,164 **** --- 169,185 ---- SurfaceFacade.getInstance().update(surface); } + + // Do automation with spaces + Space sp = findSpace(surface); + if (sp != null) { + sp.addSurface(surface); + } + if (sp instanceof ConstructionSpace) { + ConstructionSpaceFacade.getInstance().update((ConstructionSpace)sp); + } else if (sp instanceof FunctionalSpace) { + FunctionalSpaceFacade.getInstance().update((FunctionalSpace)sp); + } else { + log.warn("No space was found"); + } } edges = null; *************** *** 173,176 **** --- 194,198 ---- } } + /** * Round to grid *************** *** 259,264 **** Plane xy = new Plane(0, 0, 1, 0); Vertex vertex = xy.intersection(ray); ! vertex.setName("V" + vertexNum++); ! current = vertex; } if (current.getId() == null) { --- 281,288 ---- Plane xy = new Plane(0, 0, 1, 0); Vertex vertex = xy.intersection(ray); ! if (vertex != null) { ! vertex.setName("V" + vertexNum++); ! current = vertex; ! } } if (current.getId() == null) { *************** *** 319,321 **** --- 343,361 ---- } + /** + * Find the space we did draw in + * @param s The surface to check for the location of + * @return The Space + */ + private Space findSpace(Surface s) { + Set set = FunctionalSpaceFacade.getInstance().findAll(); + Iterator it = set.iterator(); + while (it.hasNext()) { + Space fs = (Space)it.next(); + if (fs.getName().equals("Ext")) { + return fs; + } + } + return null; + } } |
From: rimestad <rim...@us...> - 2005-09-14 07:03:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26074 Modified Files: AbstractTool.java ExtrusionTool.java Log Message: made pressPos private in Abstract tool and therefore made changes in Extrusiontool Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ExtrusionTool.java 12 Sep 2005 18:11:26 -0000 1.8 --- ExtrusionTool.java 14 Sep 2005 07:02:56 -0000 1.9 *************** *** 41,50 **** private static Surface dragSurface = null; - /** the selected surface */ - // private static Surface selectedSurface = null; - /** the dragplane */ private Plane dragplane; /** * The Constructor --- 41,53 ---- private static Surface dragSurface = null; /** the dragplane */ private Plane dragplane; + /** */ + private int prevX; + + /** */ + private int prevY; + /** * The Constructor *************** *** 73,77 **** normal.scale(1 / normal.length()); View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {pressPos[0], pressPos[1]}, dragplane); double[] to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; --- 76,80 ---- normal.scale(1 / normal.length()); View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {prevX, prevY}, dragplane); double[] to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; *************** *** 106,111 **** } } ! pressPos[0] = e.getX(); ! pressPos[1] = e.getY(); } --- 109,114 ---- } } ! prevX = e.getX(); ! prevY = e.getY(); } *************** *** 152,163 **** protected void pressed(MouseEvent e) { super.pressed(e); ! pressPos[0] = e.getX(); ! pressPos[1] = e.getY(); if (target instanceof Surface) { Surface selectedSurface = (Surface)target; View view = glv.getView(); Transformation trans = view.transformation(); ! int x = pressPos[0]; ! int y = pressPos[1]; Vertex near = new Vertex("near", x, y, 0.0); Vertex far = new Vertex("far", x, y, 1.0); --- 155,166 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! prevX = e.getX(); ! prevY = e.getY(); if (target instanceof Surface) { Surface selectedSurface = (Surface)target; View view = glv.getView(); Transformation trans = view.transformation(); ! int x = prevX; ! int y = prevY; Vertex near = new Vertex("near", x, y, 0.0); Vertex far = new Vertex("far", x, y, 1.0); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AbstractTool.java 12 Sep 2005 18:06:43 -0000 1.16 --- AbstractTool.java 14 Sep 2005 07:02:56 -0000 1.17 *************** *** 37,41 **** /** The mouse position last time the mouse was pressed initializes to (0,0) */ ! protected static int[] pressPos = new int[2]; /** The mouse movement in x axis since press */ --- 37,41 ---- /** The mouse position last time the mouse was pressed initializes to (0,0) */ ! private static int[] pressPos = new int[2]; /** The mouse movement in x axis since press */ |
From: rimestad <rim...@us...> - 2005-09-14 06:47:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23074 Modified Files: Surface.java Log Message: fixed so that the surface normal almost always is pointing towards the camera so that both sides are lit Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Surface.java 8 Sep 2005 10:42:14 -0000 1.21 --- Surface.java 14 Sep 2005 06:47:47 -0000 1.22 *************** *** 314,326 **** public Vertex normal() { if (edges.size() > 1) { ! Edge e0 = (Edge) edges.get(0); ! Edge e1 = (Edge) edges.get(1); ! Vertex v0 = e0.getTo().minus(e0.getFrom()); ! Vertex v1 = e1.getTo().minus(e1.getFrom()); ! return v0.cross(v1); ! } else { return null; } } /** * Returns the Plane that this Surface lies in --- 314,341 ---- public Vertex normal() { if (edges.size() > 1) { ! Edge e1 = (Edge)edges.get(0); ! Edge e2 = (Edge)edges.get(1); ! Vertex v1 = e1.getFrom(); ! Vertex v2 = e1.getTo(); ! Vertex v3 = null; ! ! if (e2.otherVertex(v1) == null) { ! v3 = e2.otherVertex(v2); ! // v2 is the center ! Vertex v2v1 = v2.minus(v1); ! Vertex v2v3 = v2.minus(v3); ! return v2v3.cross(v2v1); ! } else if (e2.otherVertex(v2) == null) { ! // v1 is the center ! v3 = e2.otherVertex(v1); ! Vertex v1v2 = v1.minus(v2); ! Vertex v1v3 = v1.minus(v3); ! return v1v3.cross(v1v2); ! } return null; } + return null; } + /** * Returns the Plane that this Surface lies in |
From: Nordholt <nor...@us...> - 2005-09-13 17:45:17
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20828 Modified Files: SpacesTreeView.java Log Message: added checks to see if space contained any elements of surfaces Index: SpacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpacesTreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SpacesTreeView.java 10 Aug 2005 09:48:54 -0000 1.4 --- SpacesTreeView.java 13 Sep 2005 17:45:05 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- import java.util.LinkedList; import java.util.List; + import java.util.Set; import java.util.Vector; *************** *** 99,140 **** ElementContainerNode ecn = sn.getElementContainer(); ecn.removeAll(); ! ! Iterator it = space.getSurfaces().iterator(); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! scn.add(new SurfaceNode(s.getId(), s.getName(), scn)); ! } ! ! it = space.getElements().iterator(); ! while (it.hasNext()) { ! Element e = (Element)it.next(); ! ElementNode en = new ElementNode(e.getId(), e.getName(), ecn); ! SurfaceContainerNode escn = en.getSurfaceContainer(); ! PartContainerNode pcn = en.getPartContainer(); ! ! Iterator eit = e.getSurfaces().iterator(); ! while (eit.hasNext()) { ! Surface s = (Surface)eit.next(); ! escn.add(new SurfaceNode(s.getId(), s.getName(), escn)); } ! ! eit = e.getParts().iterator(); ! while (eit.hasNext()) { ! Part p = (Part)eit.next(); ! PartNode pn = new PartNode(p.getId(), p.getName(), pcn); ! SurfaceContainerNode pscn = pn.getSurfaceContainer(); ! Iterator pit = p.getSurfaces().iterator(); ! while (pit.hasNext()) { ! Surface s = (Surface)pit.next(); ! pscn.add(new SurfaceNode(s.getId(), s.getName(), pscn)); } ! pcn.add(pn); } - - ecn.add(en); } - getModel().valueForPathChanged(sn.getTreePath(), sn); --- 100,147 ---- ElementContainerNode ecn = sn.getElementContainer(); ecn.removeAll(); ! ! Set surfs = space.getSurfaces(); ! if (surfs != null) { ! Iterator it = surfs.iterator(); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! scn.add(new SurfaceNode(s.getId(), s.getName(), scn)); } ! } ! ! Set elems = space.getElements(); ! if (elems != null) { ! Iterator it = space.getElements().iterator(); ! while (it.hasNext()) { ! Element e = (Element)it.next(); ! ElementNode en = new ElementNode(e.getId(), e.getName(), ecn); ! SurfaceContainerNode escn = en.getSurfaceContainer(); ! PartContainerNode pcn = en.getPartContainer(); ! ! Iterator eit = e.getSurfaces().iterator(); ! while (eit.hasNext()) { ! Surface s = (Surface)eit.next(); ! escn.add(new SurfaceNode(s.getId(), s.getName(), escn)); ! } ! ! eit = e.getParts().iterator(); ! while (eit.hasNext()) { ! Part p = (Part)eit.next(); ! PartNode pn = new PartNode(p.getId(), p.getName(), pcn); ! SurfaceContainerNode pscn = pn.getSurfaceContainer(); ! ! Iterator pit = p.getSurfaces().iterator(); ! while (pit.hasNext()) { ! Surface s = (Surface)pit.next(); ! pscn.add(new SurfaceNode(s.getId(), s.getName(), pscn)); ! } ! ! pcn.add(pn); } ! ecn.add(en); } } getModel().valueForPathChanged(sn.getTreePath(), sn); |
From: Nordholt <nor...@us...> - 2005-09-13 17:42:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20293 Modified Files: SelectTool.java Log Message: now BACKSPACE key can also delete Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SelectTool.java 12 Sep 2005 18:08:36 -0000 1.18 --- SelectTool.java 13 Sep 2005 17:42:31 -0000 1.19 *************** *** 191,195 **** */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_DELETE) { if (target instanceof Surface) { Surface selectedSurface = (Surface)target; --- 191,196 ---- */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_DELETE || ! e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { if (target instanceof Surface) { Surface selectedSurface = (Surface)target; |
From: Nordholt <nor...@us...> - 2005-09-13 17:28:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17058 Modified Files: SurfaceFacade.java Log Message: added a 50millis sleep after commiting a surface (very ugly I know) Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SurfaceFacade.java 12 Sep 2005 18:26:53 -0000 1.6 --- SurfaceFacade.java 13 Sep 2005 17:28:48 -0000 1.7 *************** *** 28,32 **** /** The instance */ private static SurfaceFacade instance; ! /** * Constructor --- 28,32 ---- /** The instance */ private static SurfaceFacade instance; ! /** * Constructor *************** *** 56,64 **** Session session = hu.currentSession(); Transaction tx = session.beginTransaction(); session.save(s); tx.commit(); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); --- 56,69 ---- Session session = hu.currentSession(); Transaction tx = session.beginTransaction(); + session.save(s); tx.commit(); ! ! //a sleep here seems to help making everything not crash(as badly) ! //not sure why though, someone should find out! ! Thread.sleep(50); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); |
From: Nordholt <nor...@us...> - 2005-09-13 17:24:30
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16262 Modified Files: SurfacesTreeView.java Log Message: added backin code to show surfaces in tree Index: SurfacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfacesTreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SurfacesTreeView.java 12 Sep 2005 18:15:13 -0000 1.4 --- SurfacesTreeView.java 13 Sep 2005 17:24:22 -0000 1.5 *************** *** 10,15 **** import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; ! //import net.sourceforge.bprocessor.model.Surface; ! //import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; --- 10,15 ---- import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; ! import net.sourceforge.bprocessor.model.Surface; ! import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; *************** *** 60,80 **** if (type.equals(Notification.SURFACE_CREATED)) { ! /* ! commenting this code out to prevent exceptions raised by the ! "findById" call. It works, but I honestly dont know why! ! My guess is the id of the surface created(the one in the notification) ! can be a surface that is not yet ! in the database, thus causing findById to fail. ! ! SurfaceFacade sf = SurfaceFacade.getInstance(); ! Surface s = sf.findById(n.getObject()); ! ! RootNode rn = (RootNode)getModel().getRoot(); ! SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); ! rn.add(sn); ! ! TreePath tp = new TreePath(new Object[] {rn}); ! getModel().valueForPathChanged(tp, sn); ! */ } else if (type.equals(Notification.SURFACE_DELETED)) { Long deletedId = n.getObject(); --- 60,69 ---- if (type.equals(Notification.SURFACE_CREATED)) { ! Surface s = SurfaceFacade.getInstance().findById(n.getObject()); ! RootNode rn = (RootNode)getModel().getRoot(); ! SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); ! rn.add(sn); ! TreePath tp = new TreePath(new Object[] {rn}); ! getModel().valueForPathChanged(tp, sn); } else if (type.equals(Notification.SURFACE_DELETED)) { Long deletedId = n.getObject(); |
From: Nordholt <nor...@us...> - 2005-09-12 18:27:01
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1220 Modified Files: SurfaceFacade.java Log Message: now makes shure no space is connected to the surface before removing it Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SurfaceFacade.java 17 Aug 2005 11:22:54 -0000 1.5 --- SurfaceFacade.java 12 Sep 2005 18:26:53 -0000 1.6 *************** *** 14,18 **** import java.util.Iterator; import java.util.Set; - import org.apache.log4j.Logger; import org.hibernate.Query; --- 14,17 ---- *************** *** 101,104 **** --- 100,123 ---- */ public synchronized void remove(Surface s) { + //to make it safe to remove a surface we need to remove it + //from any domain to which it belongs. + + //This breaks the decoupling and should be changed! + Set fsSet = FunctionalSpaceFacade.getInstance().findBySurface(s); + Iterator fsIt = fsSet.iterator(); + while (fsIt.hasNext()) { + FunctionalSpace fs = (FunctionalSpace)fsIt.next(); + fs.removeSurface(s); + FunctionalSpaceFacade.getInstance().update(fs); + } + + Set csSet = ConstructionSpaceFacade.getInstance().findBySurface(s); + Iterator csIt = csSet.iterator(); + while (csIt.hasNext()) { + ConstructionSpace cs = (ConstructionSpace)csIt.next(); + cs.removeSurface(s); + ConstructionSpaceFacade.getInstance().update(cs); + } + HibernateUtil hu = HibernateUtil.getInstance(); try { |
From: Nordholt <nor...@us...> - 2005-09-12 18:23:37
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv498 Modified Files: Domain.java Log Message: added method to remove a surface from a domain Index: Domain.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Domain.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Domain.java 2 Sep 2005 13:39:37 -0000 1.6 --- Domain.java 12 Sep 2005 18:23:30 -0000 1.7 *************** *** 138,141 **** --- 138,153 ---- } } + + /** + *Remove a surface from this domain + *@param surface The surface to remove + */ + public void removeSurface(Surface surface) { + Set s = getSurfaces(); + if (s != null) { + //Maybe this should be done by a setSurfaces call? + s.remove(surface); + } + } /** |
From: Nordholt <nor...@us...> - 2005-09-12 18:20:01
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32332 Modified Files: FunctionalSpaceFacade.java Log Message: corrected @param comment Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FunctionalSpaceFacade.java 2 Sep 2005 13:39:37 -0000 1.5 --- FunctionalSpaceFacade.java 12 Sep 2005 18:19:53 -0000 1.6 *************** *** 206,210 **** /** * Find the Functional spaces matched with a surface ! * @param surface The id of the surface * @return The space the given surface is conected with */ --- 206,210 ---- /** * Find the Functional spaces matched with a surface ! * @param surface The the surface * @return The space the given surface is conected with */ |
From: Nordholt <nor...@us...> - 2005-09-12 18:18:06
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31875 Modified Files: ConstructionSpaceFacade.java Log Message: added method to find the set of constructionspace's given a surface Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConstructionSpaceFacade.java 17 Aug 2005 11:22:54 -0000 1.4 --- ConstructionSpaceFacade.java 12 Sep 2005 18:17:58 -0000 1.5 *************** *** 203,205 **** --- 203,237 ---- return result; } + + /** + * Find the Construction spaces matched with a surface + * @param surface The the surface + * @return The space the given surface is conected with + */ + public Set findBySurface(Surface surface) { + Set result = new HashSet(); + + HibernateUtil hu = HibernateUtil.getInstance(); + try { + Session session = hu.currentSession(); + Transaction tx = session.beginTransaction(); + + Query q = session.createQuery("SELECT f FROM ConstructionSpace AS f," + + "Domain AS d " + + "JOIN d.surfaces AS surfaces " + + "WHERE surfaces.id = :id AND d.id = f.id"); + q.setLong("id", surface.getId().longValue()); + + Iterator it = q.iterate(); + while (it.hasNext()) { + result.add((ConstructionSpace)it.next()); + } + tx.commit(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + hu.closeSession(); + } + return result; + } } |
From: Nordholt <nor...@us...> - 2005-09-12 18:15:21
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31136 Modified Files: SurfacesTreeView.java Log Message: commented out some code to avoid bugs (read: ugly fix) Index: SurfacesTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfacesTreeView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SurfacesTreeView.java 30 Aug 2005 13:08:21 -0000 1.3 --- SurfacesTreeView.java 12 Sep 2005 18:15:13 -0000 1.4 *************** *** 10,15 **** import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; ! import net.sourceforge.bprocessor.model.Surface; ! import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; --- 10,15 ---- import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; ! //import net.sourceforge.bprocessor.model.Surface; ! //import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; *************** *** 60,72 **** if (type.equals(Notification.SURFACE_CREATED)) { ! SurfaceFacade sf = SurfaceFacade.getInstance(); ! Surface s = sf.findById(n.getObject()); ! ! RootNode rn = (RootNode)getModel().getRoot(); ! SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); ! rn.add(sn); ! ! TreePath tp = new TreePath(new Object[] {rn}); ! getModel().valueForPathChanged(tp, sn); } else if (type.equals(Notification.SURFACE_DELETED)) { Long deletedId = n.getObject(); --- 60,80 ---- if (type.equals(Notification.SURFACE_CREATED)) { ! /* ! commenting this code out to prevent exceptions raised by the ! "findById" call. It works, but I honestly dont know why! ! My guess is the id of the surface created(the one in the notification) ! can be a surface that is not yet ! in the database, thus causing findById to fail. ! ! SurfaceFacade sf = SurfaceFacade.getInstance(); ! Surface s = sf.findById(n.getObject()); ! ! RootNode rn = (RootNode)getModel().getRoot(); ! SurfaceNode sn = new SurfaceNode(n.getObject(), s.getName(), rn); ! rn.add(sn); ! ! TreePath tp = new TreePath(new Object[] {rn}); ! getModel().valueForPathChanged(tp, sn); ! */ } else if (type.equals(Notification.SURFACE_DELETED)) { Long deletedId = n.getObject(); |
From: Nordholt <nor...@us...> - 2005-09-12 18:13:11
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30617 Modified Files: AbstractView.java Log Message: Added a comment on the selection buffer size Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** AbstractView.java 8 Sep 2005 11:35:06 -0000 1.25 --- AbstractView.java 12 Sep 2005 18:13:02 -0000 1.26 *************** *** 207,210 **** --- 207,211 ---- AbstractView.width = width; if (picking > 0) { + //notice 512 is just some magic number for the size of the selectbuffer selectBuffer = BufferUtils.newIntBuffer(512); gl.glSelectBuffer(512, selectBuffer); *************** *** 255,259 **** gl.glFlush(); hits = gl.glRenderMode(GL.GL_RENDER); - //glv.repaint(); } else { gld.swapBuffers(); --- 256,259 ---- |
From: Nordholt <nor...@us...> - 2005-09-12 18:11:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30257 Modified Files: ExtrusionTool.java Log Message: Changed the way an extruded surface is moved to make more intuitive Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ExtrusionTool.java 7 Sep 2005 11:30:34 -0000 1.7 --- ExtrusionTool.java 12 Sep 2005 18:11:26 -0000 1.8 *************** *** 62,132 **** if (target instanceof Surface) { Surface selectedSurface = (Surface)target; ! if (!selectedSurface.equals(dragSurface)) { if (isExtrudeable(selectedSurface)) { dragSurface = selectedSurface; } else { ! dragSurface = null; ! createExtension(selectedSurface); } ! } ! if (dragSurface != null) { ! if (viewType != View.VIEW_3D) { ! Vertex normal = dragSurface.normal(); ! if (normal != null) { ! double[] second = glv.getView().toCanvasCoords(new double[] {e.getX(), e.getY()}); ! normal.scale(1 / normal.length()); ! Vertex proj = dragSurface.projection(second); ! ! List l = Util.traverse(dragSurface); ! for (int count = 0; l != null && count < l.size(); count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + proj.getX(), ! v.getY() + proj.getY(), ! v.getZ() + proj.getZ()}); ! } ! } ! } else { ! Vertex normal = dragSurface.normal(); ! normal.scale(1 / normal.length()); ! View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {pressPos[0], pressPos[1]}, dragplane); ! double[] to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); ! double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! double normDotDelta = ((normal.getX() * delta[0]) + ! (normal.getY() * delta[1]) + ! (normal.getZ() * delta[2])); ! normal.scale(normDotDelta / (normal.length() * normal.length())); ! //normal.scale(delta); ! List l = Util.traverse(dragSurface); ! //moving the dragged surface along its normal vector ! for (int count = 0; l != null && count < l.size(); count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! //also moving any inner surfaces ! Set innerSurfaces = dragSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! List verticies = Util.traverse(innerSurf); ! for (int count = 0; verticies != null && count < verticies.size(); count++) { ! Vertex v = (Vertex)verticies.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } } } } } - pressPos[0] = e.getX(); - pressPos[1] = e.getY(); } } /** * Checks if a surface is extrudeable --- 62,115 ---- if (target instanceof Surface) { Surface selectedSurface = (Surface)target; ! if (dragSurface == null) { if (isExtrudeable(selectedSurface)) { dragSurface = selectedSurface; } else { ! log.info("IS NOT EXTRUDABLE!!!"); ! dragSurface = createExtension(selectedSurface); } ! } else { ! Vertex normal = dragSurface.normal(); ! normal.scale(1 / normal.length()); ! View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {pressPos[0], pressPos[1]}, dragplane); ! double[] to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); ! double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! double normDotDelta = ((normal.getX() * delta[0]) + ! (normal.getY() * delta[1]) + ! (normal.getZ() * delta[2])); ! normal.scale(normDotDelta / (normal.length() * normal.length())); ! //normal.scale(delta); ! List l = Util.traverse(dragSurface); ! //moving the dragged surface along its normal vector ! for (int count = 0; l != null && count < l.size(); count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! //also moving any inner surfaces ! Set innerSurfaces = dragSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! List verticies = Util.traverse(innerSurf); ! for (int count = 0; verticies != null && count < verticies.size(); count++) { ! Vertex v = (Vertex)verticies.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); } } } } } + pressPos[0] = e.getX(); + pressPos[1] = e.getY(); } + /** * Checks if a surface is extrudeable *************** *** 177,192 **** int x = pressPos[0]; int y = pressPos[1]; ! Vertex near = new Vertex("near", 0.5, 0.5, 0.0); ! Vertex far = new Vertex("far", 0.5, 0.5, 1.0); Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); ! double[] norm = new double[] {(ray.getFrom().getX() - ray.getTo().getX()), ! (ray.getFrom().getY() - ray.getTo().getY()), ! (ray.getFrom().getZ() - ray.getTo().getZ())}; ! double[] clickPoint = view.toPlaneCoords(new double[] {x, y}, selectedSurface.plane()); ! dragplane = new Plane(norm[0], norm[1], norm[2], ! (-1 * (norm[0] * clickPoint[0] + ! norm[1] * clickPoint[1] + ! norm[2] * clickPoint[2]))); } } --- 160,168 ---- int x = pressPos[0]; int y = pressPos[1]; ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); ! dragplane = selectedSurface.plane().orthogonalPlane(ray); } } *************** *** 198,201 **** --- 174,178 ---- protected void released(MouseEvent e) { super.released(e); + dragSurface = null; } *************** *** 286,295 **** } ConstructionSpaceFacade.getInstance().create(newCSpace); ! dragSurface = createSurface(top); if (outer != null) { ! outer.addSurface(dragSurface); } ! newCSpace.addSurface(dragSurface); ! Notification n = new Notification(Notification.SURFACE_SELECTED, dragSurface.getId()); Notifier.getInstance().sendNotification(n); if (outer instanceof FunctionalSpace) { --- 263,272 ---- } ConstructionSpaceFacade.getInstance().create(newCSpace); ! Surface topSurf = createSurface(top); if (outer != null) { ! outer.addSurface(topSurf); } ! newCSpace.addSurface(topSurf); ! Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); if (outer instanceof FunctionalSpace) { *************** *** 302,313 **** Notifier.getInstance().sendNotification(n); ! return dragSurface; } /** ! * Do all the initial extrusion stuff * @param selectedSurface the surface to create extension to */ ! private void createExtension(Surface selectedSurface) { Surface top = extendSurface(selectedSurface); Set innerSurfaces = selectedSurface.getInnerSurfaces(); --- 279,291 ---- Notifier.getInstance().sendNotification(n); ! return topSurf; } /** ! * Do all the initial extrusion stuff returns the top of the extension * @param selectedSurface the surface to create extension to + * @return the top of the extension */ ! private Surface createExtension(Surface selectedSurface) { Surface top = extendSurface(selectedSurface); Set innerSurfaces = selectedSurface.getInnerSurfaces(); *************** *** 321,325 **** } } ! dragSurface = top; } } --- 299,303 ---- } } ! return top; } } |
From: Nordholt <nor...@us...> - 2005-09-12 18:08:44
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29603 Modified Files: SelectTool.java Log Message: made shure to remove deselected objects from the selection list Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SelectTool.java 7 Sep 2005 11:30:34 -0000 1.17 --- SelectTool.java 12 Sep 2005 18:08:36 -0000 1.18 *************** *** 194,207 **** if (target instanceof Surface) { Surface selectedSurface = (Surface)target; ! Notification n = new Notification(Notification.SURFACE_DESELECTED, ! selectedSurface.getId()); ! Notifier.getInstance().sendNotification(n); deleteSurface(selectedSurface); } else if (target instanceof Edge) { Edge selectedEdge = (Edge)target; if (selectedEdge.getSurfaces().size() < 1) { ! Notification n = new Notification(Notification.EDGE_DESELECTED, ! selectedEdge.getId()); ! Notifier.getInstance().sendNotification(n); deleteEdge(selectedEdge); } --- 194,204 ---- if (target instanceof Surface) { Surface selectedSurface = (Surface)target; ! selection.remove(selectedSurface); deleteSurface(selectedSurface); + } else if (target instanceof Edge) { Edge selectedEdge = (Edge)target; if (selectedEdge.getSurfaces().size() < 1) { ! selection.remove(selectedEdge); deleteEdge(selectedEdge); } |
From: Nordholt <nor...@us...> - 2005-09-12 18:06:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29208 Modified Files: AbstractTool.java Log Message: inserted repaint in delete methods to make delete visible instantly Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AbstractTool.java 9 Sep 2005 12:32:26 -0000 1.15 --- AbstractTool.java 12 Sep 2005 18:06:43 -0000 1.16 *************** *** 403,406 **** --- 403,407 ---- } removeSurface(surface); + glv.repaint(); while (it.hasNext()) { edge = (Edge)it.next(); *************** *** 417,420 **** --- 418,422 ---- if (surfaces.size() < 1) { removeEdge(edge); + glv.repaint(); deleteVertex(edge.getTo()); deleteVertex(edge.getFrom()); *************** *** 430,433 **** --- 432,436 ---- if (edges.size() < 1) { removeVertex(vertex); + glv.repaint(); } } |
From: Nordholt <nor...@us...> - 2005-09-12 18:04:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28756 Modified Files: GLView.java Log Message: small change Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GLView.java 6 Sep 2005 08:36:22 -0000 1.13 --- GLView.java 12 Sep 2005 18:04:33 -0000 1.14 *************** *** 17,21 **** import net.java.games.jogl.GLDrawableFactory; import net.java.games.jogl.GLCanvas; ! import java.awt.Dimension; import org.apache.log4j.Logger; --- 17,21 ---- import net.java.games.jogl.GLDrawableFactory; import net.java.games.jogl.GLCanvas; ! //import java.awt.Dimension; import org.apache.log4j.Logger; *************** *** 47,51 **** glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); ! glc.setPreferredSize(new Dimension(0, 0)); view = ViewFactory.getFactory(this).getDefault(); glc.addGLEventListener(view); --- 47,51 ---- glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); ! //glc.setPreferredSize(new Dimension(0, 0)); view = ViewFactory.getFactory(this).getDefault(); glc.addGLEventListener(view); |