bprocessor-commit Mailing List for B-processor (Page 162)
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: Michael L. <he...@us...> - 2005-09-09 12:32:40
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6299/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java AbstractTool.java ToolFactory.java Log Message: Removed two of the three pencils from the toolbar Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ToolFactory.java 30 Aug 2005 12:54:55 -0000 1.5 --- ToolFactory.java 9 Sep 2005 12:32:26 -0000 1.6 *************** *** 30,35 **** private static ToolFactory factory; ! /** draw tool */ ! private DrawTool draw; /** select tool */ --- 30,34 ---- private static ToolFactory factory; ! /** select tool */ *************** *** 42,50 **** private ExtrusionTool extrusion; ! /** debug tool */ ! private PencilTool debug; ! /** hole tool */ ! private HoleTool hole; /** --- 41,48 ---- private ExtrusionTool extrusion; ! /** pencil tool */ ! private PencilTool pencil; ! /** *************** *** 53,76 **** */ private ToolFactory(GLView glv) { - draw = new DrawTool(glv); select = new SelectTool(glv); move = new MoveTool(glv); extrusion = new ExtrusionTool(glv); - debug = new PencilTool(glv); - hole = new HoleTool(glv); Toolbar tb = Toolbar.getInstance(); JButton but = tb.registerAction(new SelectAction(glv)); but.setToolTipText("Select"); ! but = tb.registerAction(new DrawAction(glv)); ! but.setToolTipText("Draw"); but = tb.registerAction(new MoveAction(glv)); but.setToolTipText("Move"); but = tb.registerAction(new ExtrudeAction(glv)); but.setToolTipText("Extrude"); ! but = tb.registerAction(new DebugAction(glv)); ! but.setToolTipText("Debug"); ! but = tb.registerAction(new HoleAction(glv)); ! but.setToolTipText("Hole"); Notifier.getInstance().addListener(select); } --- 51,69 ---- */ private ToolFactory(GLView glv) { select = new SelectTool(glv); + pencil = new PencilTool(glv); move = new MoveTool(glv); extrusion = new ExtrusionTool(glv); Toolbar tb = Toolbar.getInstance(); JButton but = tb.registerAction(new SelectAction(glv)); but.setToolTipText("Select"); ! but = tb.registerAction(new PencilAction(glv)); ! but.setToolTipText("Pencil"); but = tb.registerAction(new MoveAction(glv)); but.setToolTipText("Move"); but = tb.registerAction(new ExtrudeAction(glv)); but.setToolTipText("Extrude"); ! Notifier.getInstance().addListener(select); } *************** *** 104,117 **** if (i == Tool.SELECT_TOOL) { return select; - } else if (i == Tool.DRAW_TOOL) { - return draw; } else if (i == Tool.MOVE_TOOL) { return move; } else if (i == Tool.EXTRUSION_TOOL) { return extrusion; ! } else if (i == Tool.DEBUG_TOOL) { ! return debug; ! } else if (i == Tool.HOLE_TOOL) { ! return hole; } else { log.error("[get] No such tool " + i); --- 97,106 ---- if (i == Tool.SELECT_TOOL) { return select; } else if (i == Tool.MOVE_TOOL) { return move; } else if (i == Tool.EXTRUSION_TOOL) { return extrusion; ! } else if (i == Tool.PENCIL_TOOL) { ! return pencil; } else { log.error("[get] No such tool " + i); *************** *** 148,178 **** } ! /** ! * The draw action inner class ! */ ! class DrawAction extends AbstractAction { ! /** The GLView */ ! private GLView glv = null; ! ! /** ! * Constructor ! * @param glv TheGLView ! */ ! DrawAction(GLView glv) { ! this.glv = glv; ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("drawicon.png"); ! ImageIcon im = new ImageIcon(url); ! putValue(Action.SMALL_ICON, im); ! } ! ! /** ! * Called when the button is pressed ! * @param e The ActionEvent ! */ ! public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.DRAW_TOOL); ! } ! } /** --- 137,141 ---- } ! /** *************** *** 232,267 **** } ! /** ! * The hole action inner class ! */ ! class HoleAction extends AbstractAction { ! /** The GLView */ ! private GLView glv = null; ! ! /** ! * Constructor ! * @param glv TheGLView ! */ ! HoleAction(GLView glv) { ! this.glv = glv; ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("drawicon.png"); ! ImageIcon im = new ImageIcon(url); ! putValue(Action.SMALL_ICON, im); ! } ! ! /** ! * Called when the button is pressed ! * @param e The ActionEvent ! */ ! public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.HOLE_TOOL); ! } ! } } /** * The debug action inner class */ ! class DebugAction extends AbstractAction { /** The GLView */ private GLView glv = null; --- 195,204 ---- } ! } /** * The debug action inner class */ ! class PencilAction extends AbstractAction { /** The GLView */ private GLView glv = null; *************** *** 271,275 **** * @param glv TheGLView */ ! DebugAction(GLView glv) { this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); --- 208,212 ---- * @param glv TheGLView */ ! PencilAction(GLView glv) { this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); *************** *** 284,288 **** */ public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.DEBUG_TOOL); } } --- 221,225 ---- */ public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.PENCIL_TOOL); } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Tool.java 7 Sep 2005 11:30:34 -0000 1.5 --- Tool.java 9 Sep 2005 12:32:26 -0000 1.6 *************** *** 18,31 **** /** The select tool */ public static final int SELECT_TOOL = 0; - /** The draw tool */ - public static final int DRAW_TOOL = 1; /** The move tool */ public static final int MOVE_TOOL = 2; /** The extrude tool */ public static final int EXTRUSION_TOOL = 3; ! /** The debug tool */ ! public static final int DEBUG_TOOL = 4; ! /** The hole tool */ ! public static final int HOLE_TOOL = 5; /** --- 18,27 ---- /** The select tool */ public static final int SELECT_TOOL = 0; /** The move tool */ public static final int MOVE_TOOL = 2; /** The extrude tool */ public static final int EXTRUSION_TOOL = 3; ! /** The pencil tool */ ! public static final int PENCIL_TOOL = 4; /** Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AbstractTool.java 7 Sep 2005 11:30:34 -0000 1.14 --- AbstractTool.java 9 Sep 2005 12:32:26 -0000 1.15 *************** *** 109,113 **** glv.changeTool(Tool.SELECT_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_W) { ! glv.changeTool(Tool.DRAW_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.MOVE_TOOL); --- 109,113 ---- glv.changeTool(Tool.SELECT_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_W) { ! glv.changeTool(Tool.PENCIL_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.MOVE_TOOL); |
From: Michael L. <he...@us...> - 2005-09-08 11:35:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27794/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Change drawContour to ignore surfaces that are not closed Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** AbstractView.java 7 Sep 2005 14:11:34 -0000 1.24 --- AbstractView.java 8 Sep 2005 11:35:06 -0000 1.25 *************** *** 468,566 **** */ private void drawSurface(Surface s) { ! List l = s.getEdges(); ! if (l != null) { ! //Setting up tessellation ! GLUtesselator tess = glu.gluNewTess(); ! GLUtesselatorCallback cb = new Callback(); ! //Setting callbacks ! glu.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, cb); ! glu.gluTessCallback(tess, GLU.GLU_TESS_END, cb); ! glu.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, cb); ! //Contours contained in an even number of contours are filled ! glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); ! //begining the polygon, we are not using userdata for now (hence the null) ! glu.gluTessBeginPolygon(tess, null); ! //light stuff ! 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 ! drawContour(l, tess); ! //drawing the inner conturs ! Set innerSurfaces = s.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface surface = (Surface)innerIt.next(); ! List innerEdges = surface.getEdges(); ! if (innerEdges != null) { ! drawContour(innerEdges, tess); ! } ! } } - - glu.gluTessEndPolygon(tess); - glu.gluDeleteTess(tess); } } /** ! * Draws contours of a surface using the tessellator. ! * @param edges a non-null list of edges describing the contour ! * @param tess the tessellator object */ ! private void drawContour(List edges, GLUtesselator tess) { ! //beginning the contour. ! glu.gluTessBeginContour(tess); ! ! Vertex previous = null; ! Edge previousEdge = null; ! double[] coords; ! for (int i = 0; i < edges.size(); i++) { ! Edge e = (Edge)edges.get(i); ! if (previous == null) { ! previous = e.getTo(); ! // will be drawn with the second vertex as to find out if it is to or from that counts ! } else { ! Vertex temp = e.otherVertex(previous); ! if (temp != null) { ! coords = new double[] {previous.getX(), previous.getY(), previous.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! previous = temp; ! if (i == edges.size() - 1) { ! coords = new double[] {previous.getX(), previous.getY(), previous.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! } ! } else { ! temp = previousEdge.otherVertex(previous); ! coords = new double[] {temp.getX(), temp.getY(), temp.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(temp.getX(), temp.getY(), temp.getZ()); ! previous = e.otherVertex(temp); ! if (i == edges.size() - 1) { ! if (previous == null) { ! log.warn("[drawSurface] could not find vertex " + temp + " on " + e); ! } else { ! coords = new double[] {previous.getX(), previous.getY(), previous.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! //gl.glVertex3d(previous.getX(), previous.getY(), previous.getZ()); ! } ! } ! } } ! previousEdge = e; } - //Ending contour - glu.gluTessEndContour(tess); } /** * Draw an Edge --- 468,529 ---- */ private void drawSurface(Surface s) { ! GLUtesselator tess = glu.gluNewTess(); ! GLUtesselatorCallback cb = new Callback(); ! //Setting callbacks ! glu.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, cb); ! glu.gluTessCallback(tess, GLU.GLU_TESS_END, cb); ! glu.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, cb); ! //Contours contained in an even number of contours are filled ! glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); ! //begining the polygon, we are not using userdata for now (hence the null) ! glu.gluTessBeginPolygon(tess, null); ! //light stuff ! 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 ! drawContour(s, tess); ! //drawing the inner conturs ! Set innerSurfaces = s.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface surface = (Surface)innerIt.next(); ! drawContour(surface, tess); } } + + glu.gluTessEndPolygon(tess); + glu.gluDeleteTess(tess); } /** ! * Draw contour of a Surface. ! * @param surface The surface ! * @param tess The Tesselator */ ! private void drawContour(Surface surface, GLUtesselator tess) { ! List vertices = surface.getVertices(); ! Vertex first = (Vertex) vertices.get(0); ! Vertex last = (Vertex) vertices.get(vertices.size() - 1); ! if (first == last) { ! Iterator iter = vertices.iterator(); ! glu.gluTessBeginContour(tess); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); } ! glu.gluTessEndContour(tess); } } + /** * Draw an Edge |
From: Michael L. <he...@us...> - 2005-09-08 10:50:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16881/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java Log Message: Changed MoveTool to use Surface.move etc. Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MoveTool.java 7 Sep 2005 11:30:34 -0000 1.9 --- MoveTool.java 8 Sep 2005 10:50:09 -0000 1.10 *************** *** 20,24 **** import java.util.List; - import java.util.Set; import java.util.Iterator; --- 20,23 ---- *************** *** 149,183 **** Object elm = it.next(); if (elm instanceof Vertex) { ! move((Vertex)elm, delta); } else if (elm instanceof Edge) { ! move((Edge)elm, delta); } else if (elm instanceof Surface) { ! move((Surface)elm, delta); ! } ! } ! } ! ! /** ! * Move the give surface and its inner surfaces ! * @param surface The surface to move ! * @param delta The movement ! */ ! private void move(Surface surface, double[] delta) { ! log.info("moved surface"); ! List l = Util.traverse(surface); ! double[] coords; ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coords = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coords); ! } ! ! Set innerSurfaces = surface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! move((Surface)innerIt.next(), delta); } } --- 148,156 ---- Object elm = it.next(); if (elm instanceof Vertex) { ! ((Vertex)elm).move(delta[0], delta[1], delta[2]); } else if (elm instanceof Edge) { ! ((Edge)elm).move(delta[0], delta[1], delta[2]); } else if (elm instanceof Surface) { ! ((Surface) elm).move(delta[0], delta[1], delta[2]); } } *************** *** 185,219 **** /** - * Move the give edge - * @param edge The surface to move - * @param delta The movement - */ - private void move(Edge edge, double[] delta) { - Vertex to = edge.getTo(); - Vertex from = edge.getFrom(); - - double[] coords = new double[] {to.getX() + delta[0], - to.getY() + delta[1], - to.getZ() + delta[2]}; - updateVertex(to, coords); - coords = new double[] {from.getX() + delta[0], - from.getY() + delta[1], - from.getZ() + delta[2]}; - updateVertex(from, coords); - } - - /** - * Move the give vertex - * @param vertex The surface to move - * @param delta The movement - */ - private void move(Vertex vertex, double[] delta) { - double[] coords = new double[] {vertex.getX() + delta[0], - vertex.getY() + delta[1], - vertex.getZ() + delta[2]}; - updateVertex(vertex, coords); - } - - /** * Invoked when a key has been pressed. Lets user control the speed * and mode of movement. --- 158,161 ---- |
From: Michael L. <he...@us...> - 2005-09-08 10:42:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15441/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Log Message: Implemented Surface.move, Edge.move, and Vertex.move Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Surface.java 8 Sep 2005 08:25:59 -0000 1.20 --- Surface.java 8 Sep 2005 10:42:14 -0000 1.21 *************** *** 8,16 **** import java.io.Serializable; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.HashSet; - import org.apache.log4j.Logger; --- 8,16 ---- import java.io.Serializable; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.HashSet; import org.apache.log4j.Logger; *************** *** 152,155 **** --- 152,193 ---- /** + * Return an ordered list of vertices around this Surface. + * The first and last point is the same point if the Surface + * is closed + * @return An ordered list of vertices around this Surface + */ + public List getVertices() { + ArrayList vertices = new ArrayList(); + List edges = getEdges(); + if (edges.size() == 1) { + Edge e0 = (Edge) edges.get(0); + vertices.add(e0.getFrom()); + vertices.add(e0.getTo()); + } else if (edges.size() > 1) { + // The first vertex must + // be the one that is NOT shared + // between e0 and e1 + Edge e0 = (Edge) edges.get(0); + Edge e1 = (Edge) edges.get(1); + Vertex current = null; + if (!e1.contains(e0.getFrom())) { + current = e0.getFrom(); + } + if (!e1.contains(e0.getTo())) { + current = e0.getTo(); + } + if (current != null) { + vertices.add(current); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge edge = (Edge) iter.next(); + current = edge.otherVertex(current); + vertices.add(current); + } + } + } + return vertices; + } + /** * Get the inner surfaces * @return The inner surfaces *************** *** 197,200 **** --- 235,269 ---- /** + * Move this Surface and all inner surfaces a distance (dx, dy, dz) + * @param dx The x distance + * @param dy The y distance + * @param dz The z distance + */ + public void move(double dx, double dy, double dz) { + { + List vertices = getVertices(); + Vertex v0 = (Vertex) vertices.get(0); + v0.move(dx, dy, dz); + Iterator iter = vertices.iterator(); + while (iter.hasNext()) { + Vertex vertex = (Vertex) iter.next(); + if (vertex != v0) { + vertex.move(dx, dy, dz); + } + } + } + { + if (getInnerSurfaces() != null) { + Iterator iter = getInnerSurfaces().iterator(); + while (iter.hasNext()) { + Surface surface = (Surface) iter.next(); + surface.move(dx, dy, dz); + } + } + } + } + + + /** * Get the front Space * @return The space in front of the surfacespace *************** *** 318,321 **** --- 387,392 ---- return null; } + + /** Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Edge.java 31 Aug 2005 10:30:15 -0000 1.8 --- Edge.java 8 Sep 2005 10:42:14 -0000 1.9 *************** *** 155,158 **** --- 155,178 ---- /** + * Test if a vertex is either from or to in this Edge + * @param v The vertex to test + * @return If the vertex is in this Edge + */ + public boolean contains(Vertex v) { + return (v == getFrom() || v == getTo()); + } + + /** + * Move the Edge a distance (dx, dy, dz) + * @param dx The x distance + * @param dy The y distance + * @param dz The z distance + */ + public void move(double dx, double dy, double dz) { + getFrom().move(dx, dy, dz); + getTo().move(dx, dy, dz); + } + + /** * Return the hash code of the object * @return The hash Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Vertex.java 31 Aug 2005 08:33:17 -0000 1.7 --- Vertex.java 8 Sep 2005 10:42:14 -0000 1.8 *************** *** 266,269 **** --- 266,281 ---- return result; } + + /** + * Moves the Vertex a distance + * @param dx The x distance + * @param dy The y distance + * @param dz The z distance + */ + public void move(double dx, double dy, double dz) { + this.setX(getX() + dx); + this.setY(getY() + dy); + this.setZ(getZ() + dz); + } /** |
From: Michael L. <he...@us...> - 2005-09-08 08:26:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20535/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Surface.addHole sets isInner Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Surface.java 2 Sep 2005 13:38:47 -0000 1.19 --- Surface.java 8 Sep 2005 08:25:59 -0000 1.20 *************** *** 185,188 **** --- 185,189 ---- innerSurfaces.add(inner); } + inner.setIsInner(true); } |
From: Michael L. <he...@us...> - 2005-09-08 08:21:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19606/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Added some checks for clicking twice at same vertex and creating empty surfaces. Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PencilTool.java 6 Sep 2005 09:23:02 -0000 1.16 --- PencilTool.java 8 Sep 2005 08:21:06 -0000 1.17 *************** *** 147,158 **** glv.getView().setActiveEdge(active); } else { ! active.setTo(vertex); ! intern(active); ! Surface surface = new Surface("S" + surfaceNum++, edges); ! intern(surface); ! if (exterior != null) { ! exterior.addHole(surface); ! SurfaceFacade.getInstance().update(exterior); ! SurfaceFacade.getInstance().update(surface); } edges = null; --- 147,164 ---- glv.getView().setActiveEdge(active); } else { ! ! if (vertex != active.getFrom()) { ! active.setTo(vertex); ! intern(active); ! } ! ! if (!edges.isEmpty()) { ! Surface surface = new Surface("S" + surfaceNum++, edges); ! intern(surface); ! if (exterior != null) { ! exterior.addHole(surface); ! SurfaceFacade.getInstance().update(exterior); ! SurfaceFacade.getInstance().update(surface); ! } } edges = null; |
From: Michael L. <he...@us...> - 2005-09-07 14:12:11
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16693/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Improved hit detection of vertices Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** AbstractView.java 7 Sep 2005 11:30:34 -0000 1.23 --- AbstractView.java 7 Sep 2005 14:11:34 -0000 1.24 *************** *** 27,30 **** --- 27,31 ---- import net.java.games.jogl.GLDrawable; import net.java.games.jogl.GLU; + import net.java.games.jogl.GLUquadric; import net.java.games.jogl.util.BufferUtils; import net.java.games.jogl.GLUtesselatorCallbackAdapter; *************** *** 107,110 **** --- 108,115 ---- protected ArrayList objectTable; + /** The ball is used for hit-detecting vertices */ + + protected GLUquadric ball; + /** The last used near value */ protected double near; *************** *** 183,186 **** --- 188,193 ---- gl.glClearColor(0.7f, 0.7f, 0.7f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); + ball = glu.gluNewQuadric(); + } *************** *** 326,332 **** gl.glColor3fv(SELECTED_COLOR); if (o instanceof Vertex) { gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); - Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); gl.glEnd(); --- 333,339 ---- gl.glColor3fv(SELECTED_COLOR); if (o instanceof Vertex) { + Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); gl.glEnd(); *************** *** 429,433 **** Vertex v = (Vertex)it.next(); pushName(gl, v); ! drawVertex(v); popName(gl); } --- 436,440 ---- Vertex v = (Vertex)it.next(); pushName(gl, v); ! drawVertexHit(v); popName(gl); } *************** *** 581,584 **** --- 588,602 ---- gl.glEnd(); } + + /** + * Draw a Vertex for hit-detection + * @param v The Vertex to draw + */ + private void drawVertexHit(Vertex v) { + gl.glPushMatrix(); + gl.glTranslated(v.getX(), v.getY(), v.getZ()); + glu.gluSphere(ball, 0.2, 8, 8); + gl.glPopMatrix(); + } /** |
From: rimestad <rim...@us...> - 2005-09-07 11:30:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12390/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java ExtrusionTool.java MoveTool.java SelectTool.java Tool.java Log Message: All made to resemble a selection list instead of one edge vertex and surface Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SelectTool.java 2 Sep 2005 13:42:36 -0000 1.16 --- SelectTool.java 7 Sep 2005 11:30:34 -0000 1.17 *************** *** 15,23 **** import net.sourceforge.bprocessor.model.Edge; ! //import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; ! //import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.MouseEvent; --- 15,27 ---- import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; ! import net.sourceforge.bprocessor.model.SurfaceFacade; ! import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; ! import net.sourceforge.bprocessor.model.FunctionalSpace; ! import net.sourceforge.bprocessor.model.ConstructionSpace; ! import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import java.awt.event.MouseEvent; *************** *** 26,30 **** import java.util.Iterator; ! import java.util.List; import java.util.ArrayList; import java.util.Set; --- 30,34 ---- import java.util.Iterator; ! //import java.util.List; import java.util.ArrayList; import java.util.Set; *************** *** 39,54 **** private static Logger log = Logger.getLogger(SelectTool.class); - /** The selected objects */ - protected static List selection; - - /** The selected vertex */ - //protected static Vertex selectedVertex = null; - - /** The selected edge */ - //protected static Edge selectedEdge = null; - - /** The selected surface */ - //protected static Surface selectedSurface = null; - /** the Viewtype */ protected int viewType; --- 43,46 ---- *************** *** 57,63 **** protected Object target; - static { - selection = new ArrayList(); - } /** * The constructor --- 49,52 ---- *************** *** 104,125 **** if (target == null) { log.info("target was null"); - Iterator it = selection.iterator(); - while (it.hasNext()) { - deselect(it.next()); - } selection = new ArrayList(); } else if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { - select(target); if (!selection.contains(target)) { ! selection.add(target); } } else { - Iterator it = selection.iterator(); - while (it.hasNext()) { - deselect(it.next()); - } selection = new ArrayList(); select(target); ! selection.add(target); } } --- 93,108 ---- 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); } } *************** *** 235,249 **** public void handleNotification(Notification n) { if (n.getType().equals(Notification.VERTEX_SELECTED)) { ! //selection.add(VertexFacade.getInstance().findById(n.getObject())); } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { ! //selectedVertex = null; } else if (n.getType().equals(Notification.EDGE_SELECTED)) { ! // selection.add(EdgeFacade.getInstance().findById(n.getObject())); } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { ! //selectedEdge = null; } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { ! //selection.add(SurfaceFacade.getInstance().findById(n.getObject())); } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { ! //selectedSurface = null; } } --- 218,294 ---- public void handleNotification(Notification n) { if (n.getType().equals(Notification.VERTEX_SELECTED)) { ! Object o = VertexFacade.getInstance().findById(n.getObject()); ! if (!selection.contains(o)) { ! selection.add(o); ! } } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { ! Object o = VertexFacade.getInstance().findById(n.getObject()); ! if (selection.contains(o)) { ! selection.remove(o); ! } } else if (n.getType().equals(Notification.EDGE_SELECTED)) { ! Object o = EdgeFacade.getInstance().findById(n.getObject()); ! if (!selection.contains(o)) { ! selection.add(o); ! } } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { ! Object o = EdgeFacade.getInstance().findById(n.getObject()); ! if (selection.contains(o)) { ! selection.remove(o); ! } } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { ! Object o = SurfaceFacade.getInstance().findById(n.getObject()); ! if (!selection.contains(o)) { ! selection.add(o); ! } } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { ! Object o = SurfaceFacade.getInstance().findById(n.getObject()); ! if (selection.contains(o)) { ! selection.remove(o); ! } ! } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_SELECTED)) { ! FunctionalSpace fs = ! (FunctionalSpace)FunctionalSpaceFacade.getInstance().findById(n.getObject()); ! Set s = fs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (!selection.contains(surface)) { ! selection.add(surface); ! } ! } ! } else if (n.getType().equals(Notification.FUNCTIONAL_SPACE_DESELECTED)) { ! FunctionalSpace fs = ! (FunctionalSpace)FunctionalSpaceFacade.getInstance().findById(n.getObject()); ! Set s = fs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (selection.contains(surface)) { ! selection.remove(surface); ! } ! } ! } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ! ConstructionSpace cs = ! (ConstructionSpace)ConstructionSpaceFacade.getInstance().findById(n.getObject()); ! Set s = cs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (!selection.contains(surface)) { ! selection.add(surface); ! } ! } ! } else if (n.getType().equals(Notification.CONSTRUCTION_SPACE_DESELECTED)) { ! ConstructionSpace cs = ! (ConstructionSpace)ConstructionSpaceFacade.getInstance().findById(n.getObject()); ! Set s = cs.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (selection.contains(surface)) { ! selection.remove(surface); ! } ! } } } *************** *** 260,264 **** type.equals(Notification.EDGE_DESELECTED) || type.equals(Notification.SURFACE_SELECTED) || ! type.equals(Notification.SURFACE_DESELECTED)) { return true; } --- 305,313 ---- type.equals(Notification.EDGE_DESELECTED) || type.equals(Notification.SURFACE_SELECTED) || ! type.equals(Notification.SURFACE_DESELECTED) || ! type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || ! type.equals(Notification.FUNCTIONAL_SPACE_DESELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_DESELECTED)) { return true; } Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MoveTool.java 6 Sep 2005 13:40:10 -0000 1.8 --- MoveTool.java 7 Sep 2005 11:30:34 -0000 1.9 *************** *** 38,52 **** private static final int XZ = 1; - /** The speed of moving in 3D view */ - private int moveSpeed = 60; - /** The the moving mode in 3D view */ private int moveMode = XY; /** The previous X coordinate */ ! private int lastX = 0; /** The previous Y cordinate */ ! private int lastY = 0; /** The plane to drag according to */ --- 38,49 ---- private static final int XZ = 1; /** The the moving mode in 3D view */ private int moveMode = XY; /** The previous X coordinate */ ! private int previousX = 0; /** The previous Y cordinate */ ! private int previousY = 0; /** The plane to drag according to */ *************** *** 67,94 **** protected void pressed(MouseEvent e) { super.pressed(e); ! lastX = e.getX(); ! lastY = e.getY(); if (target instanceof Vertex) { ! dragPlane = new Plane(0, 0, 1, 0); } else if (target instanceof Edge) { ! dragPlane = new Plane(0, 0, 1, 0); } else if (target instanceof Surface) { Surface sel = (Surface)target; ! dragPlane = sel.plane(); ! log.info("" + dragPlane); } // make a orthogonal plane to the current one if (moveMode == XZ) { ! log.info("orthogonal"); Transformation trans = glv.getView().transformation(); ! int x = lastX; ! int y = lastY; 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 = dragPlane.orthogonalPlane(ray); ! } } --- 64,103 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! previousX = e.getX(); ! previousY = e.getY(); + if (target != null) { + dragPlane = findMovePlane(); + } + log.info("plane: " + dragPlane); + } + + /** + * Finds the plan to move the element on + * @return The movement plane + */ + protected Plane findMovePlane() { + Plane temp = null; if (target instanceof Vertex) { ! temp = new Plane(0, 0, 1, 0); } else if (target instanceof Edge) { ! temp = new Plane(0, 0, 1, 0); } else if (target instanceof Surface) { Surface sel = (Surface)target; ! temp = sel.plane(); } // make a orthogonal plane to the current one if (moveMode == XZ) { ! log.info("ortho"); Transformation trans = glv.getView().transformation(); ! int x = previousX; ! int y = previousY; 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); ! return temp.orthogonalPlane(ray); ! } ! return temp; } *************** *** 113,122 **** View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {lastX, lastY}, dragPlane); ! log.info("from " + from[0] + ", " + from[1] + ", " + from[2]); double[] to = view.toPlaneCoords(new double[] {x, y}, dragPlane); - log.info("to " + to[0] + ", " + to[1] + ", " + to[2]); double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! log.info("delta " + delta[0] + ", " + delta[1] + ", " + delta[2]); move(selection, delta); } else { --- 122,133 ---- View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); double[] to = view.toPlaneCoords(new double[] {x, y}, dragPlane); double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! if (log.isDebugEnabled()) { ! log.debug("from " + from[0] + ", " + from[1] + ", " + from[2]); ! log.debug("to " + to[0] + ", " + to[1] + ", " + to[2]); ! log.debug("delta " + delta[0] + ", " + delta[1] + ", " + delta[2]); ! } move(selection, delta); } else { *************** *** 124,244 **** } ! lastX = e.getX(); ! lastY = e.getY(); } ! /* int x = e.getX(); ! int y = e.getY(); ! if (viewType == View.VIEW_3D) { ! double deltaX = ((double)(x - lastX)) / moveSpeed; ! double deltaY = ((double)(y - lastY)) / moveSpeed; ! double[] coords; ! if (selectedSurface != null) { ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX, ! v.getY() - deltaY, ! v.getZ() + 0}; ! updateVertex(v, coords); ! } else { ! coords = new double[] {v.getX() + deltaX, ! v.getY() + 0, ! v.getZ() - deltaY}; ! updateVertex(v, coords); ! } ! } ! ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurface = (Surface)innerIt.next(); ! List innerEdges = Util.traverse(innerSurface); ! for (int i = 0; i < innerEdges.size(); i++) { ! Vertex v = (Vertex)innerEdges.get(i); ! if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX, ! v.getY() - deltaY, ! v.getZ() + 0}; ! updateVertex(v, coords); ! } else { ! coords = new double[] {v.getX() + deltaX, ! v.getY() + 0, ! v.getZ() - deltaY}; ! updateVertex(v, coords); ! } ! } ! } ! } ! } else if (selectedEdge != null) { ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! if (moveMode == XY) { ! coords = new double[] {to.getX() + deltaX, ! to.getY() - deltaY, ! to.getZ() + 0}; ! updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX, ! from.getY() - deltaY, ! from.getZ() + 0}; ! updateVertex(from, coords); ! } else { ! coords = new double[] {to.getX() + deltaX, ! to.getY() + 0, ! to.getZ() - deltaY}; ! updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX, ! from.getY() + 0, ! from.getZ() - deltaY}; ! updateVertex(from, coords); ! } ! } ! } else { ! if (selectedVertex != null) { ! View view = glv.getView(); ! double[] coords = view.toCanvasCoords(new double[]{x, y}); ! coords = snapToGrid(coords); ! updateVertex(selectedVertex, coords); ! } else if (selectedSurface != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coordsa = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coordsa); ! } ! } else if (selectedEdge != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! ! coordsa = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; ! updateVertex(to, coordsa); ! coordsa = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; ! updateVertex(from, coordsa); ! } ! } ! lastX = x; ! lastY = y; ! }*/ ! /** * Move the entire selection --- 135,142 ---- } ! previousX = e.getX(); ! previousY = e.getY(); } ! /** * Move the entire selection *************** *** 296,305 **** double[] coords = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; updateVertex(to, coords); coords = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; updateVertex(from, coords); } --- 194,203 ---- double[] coords = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; updateVertex(to, coords); coords = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; updateVertex(from, coords); } *************** *** 312,318 **** private void move(Vertex vertex, double[] delta) { double[] coords = new double[] {vertex.getX() + delta[0], ! vertex.getY() + delta[1], ! vertex.getZ() + delta[2]}; ! coords = snapToGrid(coords); updateVertex(vertex, coords); } --- 210,215 ---- private void move(Vertex vertex, double[] delta) { double[] coords = new double[] {vertex.getX() + delta[0], ! vertex.getY() + delta[1], ! vertex.getZ() + delta[2]}; updateVertex(vertex, coords); } *************** *** 324,337 **** */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_X) { ! if (moveSpeed > 13) { ! moveSpeed -= 3; ! } ! } else if (e.getKeyCode() == KeyEvent.VK_Z) { ! moveSpeed += 3; ! } else if (e.getKeyCode() == KeyEvent.VK_A) { moveMode = XY; } else if (e.getKeyCode() == KeyEvent.VK_S) { moveMode = XZ; } else { super.keyPressed(e); --- 221,234 ---- */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_A) { moveMode = XY; + if (target != null) { + dragPlane = findMovePlane(); + } } else if (e.getKeyCode() == KeyEvent.VK_S) { moveMode = XZ; + if (target != null) { + dragPlane = findMovePlane(); + } } else { super.keyPressed(e); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tool.java 30 Aug 2005 12:53:21 -0000 1.4 --- Tool.java 7 Sep 2005 11:30:34 -0000 1.5 *************** *** 10,13 **** --- 10,15 ---- import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; + + import java.util.List; /** * The tool interface *************** *** 26,28 **** --- 28,36 ---- /** The hole tool */ public static final int HOLE_TOOL = 5; + + /** + * Return the current selection + * @return The list of selected objects + */ + public List getSelection(); } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AbstractTool.java 31 Aug 2005 14:56:32 -0000 1.13 --- AbstractTool.java 7 Sep 2005 11:30:34 -0000 1.14 *************** *** 19,24 **** --- 19,26 ---- import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; + import java.awt.event.InputEvent; import java.util.List; + import java.util.ArrayList; import java.util.Iterator; import java.util.Set; *************** *** 38,45 **** /** The mouse movement in x axis since press */ ! protected static int dx = 0; /** The mouse movement in y axis since press */ ! protected static int dy = 0; /** An vertex counter */ --- 40,47 ---- /** The mouse movement in x axis since press */ ! private static int dx = 0; /** The mouse movement in y axis since press */ ! private static int dy = 0; /** An vertex counter */ *************** *** 61,64 **** --- 63,69 ---- private static ActionListener moveAction; + /** The selected objects */ + protected static List selection; + /** The carmera move timer */ private static Timer timer; *************** *** 69,72 **** --- 74,78 ---- static { timer = new Timer(40, null); + selection = new ArrayList(); } *************** *** 193,200 **** pressPos[0] = e.getX(); pressPos[1] = e.getY(); ! if (currentButton == MouseEvent.BUTTON2) { timer.addActionListener(zoomAction); ! } else if (currentButton == MouseEvent.BUTTON3) { timer.addActionListener(moveAction); } --- 199,208 ---- pressPos[0] = e.getX(); pressPos[1] = e.getY(); + int zoommask = InputEvent.ALT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; + int rotamask = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; ! if (currentButton == MouseEvent.BUTTON2 || (e.getModifiersEx() & zoommask) == zoommask) { timer.addActionListener(zoomAction); ! } else if (currentButton == MouseEvent.BUTTON3 || (e.getModifiersEx() & rotamask) == rotamask) { timer.addActionListener(moveAction); } *************** *** 210,218 **** public void mouseReleased(MouseEvent e) { int currentButton = e.getButton(); ! if (currentButton == MouseEvent.BUTTON3) { timer.removeActionListener(moveAction); this.dx = 0; this.dy = 0; ! } else if (currentButton == MouseEvent.BUTTON2) { timer.removeActionListener(zoomAction); this.dx = 0; --- 218,230 ---- public void mouseReleased(MouseEvent e) { int currentButton = e.getButton(); ! int zoommask = InputEvent.ALT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; ! int rotamask = InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; ! ! if (currentButton == MouseEvent.BUTTON3 || (e.getModifiersEx() & rotamask) == rotamask) { timer.removeActionListener(moveAction); this.dx = 0; this.dy = 0; ! } else if (currentButton == MouseEvent.BUTTON2 || ! (e.getModifiersEx() & zoommask) == zoommask) { timer.removeActionListener(zoomAction); this.dx = 0; *************** *** 420,423 **** --- 432,443 ---- } } + + /** + * Return the current selection + * @return The list of selected objects + */ + public List getSelection() { + return selection; + } /** Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExtrusionTool.java 6 Sep 2005 13:32:11 -0000 1.6 --- ExtrusionTool.java 7 Sep 2005 11:30:34 -0000 1.7 *************** *** 42,46 **** /** the selected surface */ ! private static Surface selectedSurface = null; /** the dragplane */ --- 42,46 ---- /** the selected surface */ ! // private static Surface selectedSurface = null; /** the dragplane */ *************** *** 60,64 **** */ protected void dragged(MouseEvent e) { ! if (selectedSurface != null) { if (!selectedSurface.equals(dragSurface)) { if (isExtrudeable(selectedSurface)) { --- 60,65 ---- */ protected void dragged(MouseEvent e) { ! if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; if (!selectedSurface.equals(dragSurface)) { if (isExtrudeable(selectedSurface)) { *************** *** 66,70 **** } else { dragSurface = null; ! createExtension(); } } --- 67,71 ---- } else { dragSurface = null; ! createExtension(selectedSurface); } } *************** *** 86,95 **** } } else { - /* - old style code. - double dX = pressPos[0] - e.getX(); - double dY = pressPos[1] - e.getY(); - double delta = (dX - dY) / 60; - */ Vertex normal = dragSurface.normal(); normal.scale(1 / normal.length()); --- 87,90 ---- *************** *** 177,181 **** pressPos[1] = e.getY(); if (target instanceof Surface) { ! selectedSurface = (Surface)target; View view = glv.getView(); Transformation trans = view.transformation(); --- 172,176 ---- pressPos[1] = e.getY(); if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; View view = glv.getView(); Transformation trans = view.transformation(); *************** *** 194,199 **** norm[1] * clickPoint[1] + norm[2] * clickPoint[2]))); - } else { - selectedSurface = null; } } --- 189,192 ---- *************** *** 214,218 **** private Surface extendSurface(Surface extendSurf) { ConstructionSpace newCSpace = new ConstructionSpace("innerSpace"); ! Space outer = selectedSurface.getFrontSpace(); Edge previousEdge = null; Vertex previousVertex = null; --- 207,211 ---- private Surface extendSurface(Surface extendSurf) { ConstructionSpace newCSpace = new ConstructionSpace("innerSpace"); ! Space outer = extendSurf.getFrontSpace(); Edge previousEdge = null; Vertex previousVertex = null; *************** *** 221,225 **** List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); ! newCSpace.addSurface(selectedSurface); Iterator i = edges.iterator(); Edge current = null; --- 214,218 ---- List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); ! newCSpace.addSurface(extendSurf); Iterator i = edges.iterator(); Edge current = null; *************** *** 314,319 **** /** * Do all the initial extrusion stuff */ ! private void createExtension() { Surface top = extendSurface(selectedSurface); Set innerSurfaces = selectedSurface.getInnerSurfaces(); --- 307,313 ---- /** * 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(); |
From: rimestad <rim...@us...> - 2005-09-07 11:30:42
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12390/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java ViewFactory.java Log Message: All made to resemble a selection list instead of one edge vertex and surface Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AbstractView.java 6 Sep 2005 13:51:21 -0000 1.22 --- AbstractView.java 7 Sep 2005 11:30:34 -0000 1.23 *************** *** 7,12 **** package net.sourceforge.bprocessor.gl.view; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.gl.GLView; --- 7,10 ---- *************** *** 85,97 **** protected static Vertex alignVertex = null; - /** The selected vertex */ - protected static Vertex selectedVertex = null; - - /** The selected edge */ - protected static Edge selectedEdge = null; - - /** The selected surface */ - protected static Surface selectedSurface = null; - /** The GL */ protected GL gl = null; --- 83,86 ---- *************** *** 224,228 **** gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! gl.glDepthMask(true); // grid and coords are always completely lit --- 213,217 ---- gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! //gl.glDepthMask(true); // grid and coords are always completely lit *************** *** 314,318 **** Set edges = EdgeFacade.getInstance().findAll(); Set vertices = VertexFacade.getInstance().findAll(); ! int[] mode = new int[1]; gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 303,308 ---- Set edges = EdgeFacade.getInstance().findAll(); Set vertices = VertexFacade.getInstance().findAll(); ! List selection = glv.getTool().getSelection(); ! int[] mode = new int[1]; gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 324,346 **** if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); ! // draw selected surface ! if (selectedSurface != null) { ! gl.glColor3fv(SELECTED_COLOR); ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); ! selectedSurface = SurfaceFacade.getInstance().findById(selectedSurface.getId()); ! drawSurface(selectedSurface); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); } ! ! // draw all the surfaces in the model ! if (drawMode != WIREFRAME_MODE) { ! Iterator it = surfaces.iterator(); ! gl.glColor3fv(SURFACE_COLOR); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! if (!s.equals(selectedSurface)) { ! drawSurface(s); ! } } } --- 314,349 ---- if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); ! ! if (drawMode == LIGHTING_MODE) { ! gl.glEnable(GL.GL_LIGHTING); ! } else { ! gl.glDisable(GL.GL_LIGHTING); } ! // draw selection ! Iterator selit = selection.iterator(); ! while (selit.hasNext()) { ! Object o = selit.next(); ! gl.glColor3fv(SELECTED_COLOR); ! if (o instanceof Vertex) { ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! Vertex v = VertexFacade.getInstance().findById(((Vertex)o).getId()); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! } else if (o instanceof Edge) { ! Edge e = EdgeFacade.getInstance().findById(((Edge)o).getId()); ! Vertex to = e.getTo(); ! Vertex from = e.getFrom(); ! gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glVertex3d(from.getX(), from.getY(), from.getZ()); ! gl.glEnd(); ! } else if (o instanceof Surface) { ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); ! Surface s = SurfaceFacade.getInstance().findById(((Surface)o).getId()); ! drawSurface(s); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); } } *************** *** 393,431 **** gl.glPointSize(1.0f); } - - // draw selected vertex - if (selectedVertex != null) { - gl.glColor3fv(SELECTED_COLOR); - gl.glPointSize(5.0f); - gl.glBegin(GL.GL_POINTS); - selectedVertex = VertexFacade.getInstance().findById(selectedVertex.getId()); - gl.glVertex3d(selectedVertex.getX(), selectedVertex.getY(), selectedVertex.getZ()); - gl.glEnd(); - gl.glPointSize(1.0f); - } - - // draw selected edge - if (selectedEdge != null) { - gl.glColor3fv(SELECTED_COLOR); - selectedEdge = EdgeFacade.getInstance().findById(selectedEdge.getId()); - Vertex to = selectedEdge.getTo(); - Vertex from = selectedEdge.getFrom(); - gl.glBegin(GL.GL_LINES); - gl.glVertex3d(to.getX(), to.getY(), to.getZ()); - gl.glVertex3d(from.getX(), from.getY(), from.getZ()); - gl.glEnd(); - } // draw all the edges in the model ! Iterator eit = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); ! while (eit.hasNext()) { ! Edge e = (Edge)eit.next(); ! if (!e.equals(selectedEdge)) { drawEdge(e); } } - gl.glEnable(GL.GL_LIGHTING); } else { // HERE STARTS SELECTION MODE DRAWING if (selectMode == VERTICES || selectMode == ALL) { --- 396,425 ---- gl.glPointSize(1.0f); } // draw all the edges in the model ! if (drawMode != LIGHTING_MODE) { ! Iterator eit = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); ! while (eit.hasNext()) { ! Edge e = (Edge)eit.next(); drawEdge(e); } + } else { + gl.glEnable(GL.GL_LIGHTING); + } + + // draw all the surfaces in the model + if (drawMode != WIREFRAME_MODE) { + Iterator it = surfaces.iterator(); + gl.glColor3fv(SURFACE_COLOR); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + if (!selection.contains(s)) { + drawSurface(s); + } + } } } else { + // HERE STARTS SELECTION MODE DRAWING if (selectMode == VERTICES || selectMode == ALL) { *************** *** 746,787 **** /** - * Handle a notification - * @param n The notification - */ - public void handleNotification(Notification n) { - if (n.getType().equals(Notification.VERTEX_SELECTED)) { - selectedVertex = VertexFacade.getInstance().findById(n.getObject()); - } else if (n.getType().equals(Notification.VERTEX_DESELECTED)) { - selectedVertex = null; - } else if (n.getType().equals(Notification.EDGE_SELECTED)) { - selectedEdge = EdgeFacade.getInstance().findById(n.getObject()); - } else if (n.getType().equals(Notification.EDGE_DESELECTED)) { - selectedEdge = null; - } else if (n.getType().equals(Notification.SURFACE_SELECTED)) { - selectedSurface = SurfaceFacade.getInstance().findById(n.getObject()); - } else if (n.getType().equals(Notification.SURFACE_DESELECTED)) { - selectedSurface = null; - } - glv.repaint(true); - } - - /** - * 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.VERTEX_SELECTED) || - type.equals(Notification.VERTEX_DESELECTED) || - type.equals(Notification.EDGE_SELECTED) || - type.equals(Notification.EDGE_DESELECTED) || - type.equals(Notification.SURFACE_SELECTED) || - type.equals(Notification.SURFACE_DESELECTED)) { - return true; - } - return false; - } - - /** * Initialize the objectTable and the name-stack * @param gl The GL --- 740,743 ---- Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** View.java 6 Sep 2005 08:36:22 -0000 1.10 --- View.java 7 Sep 2005 11:30:34 -0000 1.11 *************** *** 7,12 **** package net.sourceforge.bprocessor.gl.view; - import net.sourceforge.bprocessor.kernel.notification.NotificationListener; - import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; --- 7,10 ---- *************** *** 18,22 **** * The View Interface */ ! public interface View extends GLEventListener, NotificationListener { /** The 3D view view */ public static final int VIEW_3D = 0; --- 16,20 ---- * The View Interface */ ! public interface View extends GLEventListener { /** The 3D view view */ public static final int VIEW_3D = 0; Index: ViewFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ViewFactory.java 31 Aug 2005 14:56:31 -0000 1.5 --- ViewFactory.java 7 Sep 2005 11:30:34 -0000 1.6 *************** *** 7,11 **** package net.sourceforge.bprocessor.gl.view; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.Toolbar; import net.sourceforge.bprocessor.gl.GLView; --- 7,10 ---- *************** *** 51,60 **** viewYZ = new ViewYZ(glv); - Notifier n = Notifier.getInstance(); - n.addListener(view3D); - n.addListener(viewXY); - n.addListener(viewXZ); - n.addListener(viewYZ); - Toolbar tb = Toolbar.getInstance(); JButton but = tb.registerAction(new View3DAction(glv)); --- 50,53 ---- |
From: Michael L. <he...@us...> - 2005-09-06 13:51:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25935/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Changed selection to not allow clicking through surfaces Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AbstractView.java 6 Sep 2005 12:00:09 -0000 1.21 --- AbstractView.java 6 Sep 2005 13:51:21 -0000 1.22 *************** *** 19,22 **** --- 19,23 ---- import net.sourceforge.bprocessor.model.SurfaceFacade; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; *************** *** 56,59 **** --- 57,64 ---- private static final int VERTICES = 2; + /** Select mode for selecting ALL **/ + + private static final int ALL = 3; + /** The width of the window */ protected static double width; *************** *** 110,113 **** --- 115,121 ---- protected IntBuffer selectBuffer; + /** The objectTable used for assigning unique ID's during selection */ + protected ArrayList objectTable; + /** The last used near value */ protected double near; *************** *** 313,317 **** glu = gld.getGLU(); ! gl.glInitNames(); if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); --- 321,325 ---- glu = gld.getGLU(); ! initNames(gl); if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); *************** *** 421,457 **** } else { // HERE STARTS SELECTION MODE DRAWING ! if (selectMode == SURFACES) { ! Iterator it = surfaces.iterator(); ! gl.glColor3fv(SURFACE_COLOR); while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! int name = s.getId().intValue(); ! gl.glPushName(name); ! drawSurface(s); ! gl.glPopName(); } } ! ! if (selectMode == EDGES) { Iterator it = edges.iterator(); gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Edge e = (Edge)it.next(); ! int name = e.getId().intValue(); ! gl.glPushName(name); drawEdge(e); ! gl.glPopName(); } } ! ! if (selectMode == VERTICES) { ! Iterator it = vertices.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! int name = v.getId().intValue(); ! gl.glPushName(name); ! drawVertex(v); ! gl.glPopName(); } } --- 429,460 ---- } else { // HERE STARTS SELECTION MODE DRAWING ! if (selectMode == VERTICES || selectMode == ALL) { ! Iterator it = vertices.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! pushName(gl, v); ! drawVertex(v); ! popName(gl); } } ! if (selectMode == EDGES || selectMode == ALL) { Iterator it = edges.iterator(); gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Edge e = (Edge)it.next(); ! pushName(gl, e); drawEdge(e); ! popName(gl); } } ! if (selectMode == SURFACES || selectMode == ALL) { ! Iterator it = surfaces.iterator(); ! gl.glColor3fv(SURFACE_COLOR); while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! pushName(gl, s); ! drawSurface(s); ! popName(gl); } } *************** *** 781,784 **** --- 784,826 ---- /** + * Initialize the objectTable and the name-stack + * @param gl The GL + */ + private void initNames(GL gl) { + objectTable = new ArrayList(); + gl.glInitNames(); + } + /** + * Insert object into objectTable and push its index on the name-stack + * @param gl The GL + * @param object The object to insert + */ + private void pushName(GL gl, Object object) { + objectTable.add(object); + gl.glPushName(objectTable.size()); + } + /** + * Pop a name from the name-stack + * @param gl The GL + */ + private void popName(GL gl) { + gl.glPopName(); + } + /** + * Return the object with the specifed index in objectTable + * @param index The index of the object + * @return The object + */ + private Object getName(int index) { + return objectTable.get(index - 1); + } + /** + * Remove the objectTable + * + */ + private void clearNames() { + objectTable = null; + } + /** * Processes the select buffer * @return the ID of the closest hit *************** *** 833,865 **** // indicating that I am trying to pick(used in camera) picking = 10; ! selectMode = VERTICES; ! //repainting to get selection buffer ! glv.repaint(true); ! id = processSelect(); ! if (id != null) { ! Vertex v = VertexFacade.getInstance().findById(id); ! return v; ! } ! //indicating that I am trying to pick(used in camera) ! picking = 10; ! selectMode = EDGES; ! //repainting to get selection buffer ! glv.repaint(true); ! id = processSelect(); ! if (id != null) { ! Edge e = EdgeFacade.getInstance().findById(id); ! return e; ! } ! //indicating that I am trying to pick(used in camera) ! picking = 10; ! selectMode = SURFACES; //repainting to get selection buffer glv.repaint(true); id = processSelect(); if (id != null) { ! Surface s = SurfaceFacade.getInstance().findById(id); ! return s; ! } ! return null; } --- 875,892 ---- // indicating that I am trying to pick(used in camera) picking = 10; ! selectMode = ALL; //repainting to get selection buffer glv.repaint(true); id = processSelect(); if (id != null) { ! Object o = getName(id.intValue()); ! clearNames(); ! return o; ! } else { ! clearNames(); ! return null; ! } ! ! } |
From: Nordholt <nor...@us...> - 2005-09-06 13:40:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23262 Modified Files: MoveTool.java Log Message: small change Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MoveTool.java 2 Sep 2005 13:30:23 -0000 1.7 --- MoveTool.java 6 Sep 2005 13:40:10 -0000 1.8 *************** *** 130,135 **** int y = e.getY(); if (viewType == View.VIEW_3D) { ! double deltaX = x - lastX; ! double deltaY = y - lastY; double[] coords; if (selectedSurface != null) { --- 130,135 ---- int y = e.getY(); if (viewType == View.VIEW_3D) { ! double deltaX = ((double)(x - lastX)) / moveSpeed; ! double deltaY = ((double)(y - lastY)) / moveSpeed; double[] coords; if (selectedSurface != null) { *************** *** 138,152 **** Vertex v = (Vertex)l.get(i); if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX / moveSpeed, ! v.getY() - deltaY / moveSpeed, v.getZ() + 0}; updateVertex(v, coords); } else { ! coords = new double[] {v.getX() + deltaX / moveSpeed, v.getY() + 0, ! v.getZ() - deltaY / moveSpeed}; updateVertex(v, coords); } } Set innerSurfaces = selectedSurface.getInnerSurfaces(); if (innerSurfaces != null) { --- 138,153 ---- Vertex v = (Vertex)l.get(i); if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX, ! v.getY() - deltaY, v.getZ() + 0}; updateVertex(v, coords); } else { ! coords = new double[] {v.getX() + deltaX, v.getY() + 0, ! v.getZ() - deltaY}; updateVertex(v, coords); } } + Set innerSurfaces = selectedSurface.getInnerSurfaces(); if (innerSurfaces != null) { *************** *** 158,169 **** Vertex v = (Vertex)innerEdges.get(i); if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX / moveSpeed, ! v.getY() - deltaY / moveSpeed, v.getZ() + 0}; updateVertex(v, coords); } else { ! coords = new double[] {v.getX() + deltaX / moveSpeed, v.getY() + 0, ! v.getZ() - deltaY / moveSpeed}; updateVertex(v, coords); } --- 159,170 ---- Vertex v = (Vertex)innerEdges.get(i); if (moveMode == XY) { ! coords = new double[] {v.getX() + deltaX, ! v.getY() - deltaY, v.getZ() + 0}; updateVertex(v, coords); } else { ! coords = new double[] {v.getX() + deltaX, v.getY() + 0, ! v.getZ() - deltaY}; updateVertex(v, coords); } *************** *** 175,237 **** Vertex from = selectedEdge.getFrom(); if (moveMode == XY) { ! coords = new double[] {to.getX() + deltaX / moveSpeed, ! to.getY() - deltaY / moveSpeed, to.getZ() + 0}; updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX / moveSpeed, ! from.getY() - deltaY / moveSpeed, from.getZ() + 0}; updateVertex(from, coords); } else { ! coords = new double[] {to.getX() + deltaX / moveSpeed, to.getY() + 0, ! to.getZ() - deltaY / moveSpeed}; updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX / moveSpeed, from.getY() + 0, ! from.getZ() - deltaY / moveSpeed}; updateVertex(from, coords); } } ! } ! if (selectedVertex != null) { ! View view = glv.getView(); ! double[] coords = view.toCanvasCoords(new double[]{x, y}); ! coords = snapToGrid(coords); ! updateVertex(selectedVertex, coords); ! } else if (selectedSurface != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coordsa = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coordsa); } - } else if (selectedEdge != null) { - View view = glv.getView(); - double[] coordsa = view.toCanvasCoords(new double[]{x, y}); - double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); - double[] delta = new double[] {coordsa[0] - coordsb[0], - coordsa[1] - coordsb[1], - coordsa[2] - coordsb[2]}; - Vertex to = selectedEdge.getTo(); - Vertex from = selectedEdge.getFrom(); - - coordsa = new double[] {to.getX() + delta[0], - to.getY() + delta[1], - to.getZ() + delta[2]}; - updateVertex(to, coordsa); - coordsa = new double[] {from.getX() + delta[0], - from.getY() + delta[1], - from.getZ() + delta[2]}; - updateVertex(from, coordsa); } lastX = x; --- 176,239 ---- Vertex from = selectedEdge.getFrom(); if (moveMode == XY) { ! coords = new double[] {to.getX() + deltaX, ! to.getY() - deltaY, to.getZ() + 0}; updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX, ! from.getY() - deltaY, from.getZ() + 0}; updateVertex(from, coords); } else { ! coords = new double[] {to.getX() + deltaX, to.getY() + 0, ! to.getZ() - deltaY}; updateVertex(to, coords); ! coords = new double[] {from.getX() + deltaX, from.getY() + 0, ! from.getZ() - deltaY}; updateVertex(from, coords); } } ! } else { ! if (selectedVertex != null) { ! View view = glv.getView(); ! double[] coords = view.toCanvasCoords(new double[]{x, y}); ! coords = snapToGrid(coords); ! updateVertex(selectedVertex, coords); ! } else if (selectedSurface != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coordsa = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coordsa); ! } ! } else if (selectedEdge != null) { ! View view = glv.getView(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{lastX, lastY}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! coordsa = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; ! updateVertex(to, coordsa); ! coordsa = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; ! updateVertex(from, coordsa); } } lastX = x; |
From: Nordholt <nor...@us...> - 2005-09-06 13:32:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21885 Modified Files: ExtrusionTool.java Log Message: better extrution in 3D Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExtrusionTool.java 2 Sep 2005 13:35:32 -0000 1.5 --- ExtrusionTool.java 6 Sep 2005 13:32:11 -0000 1.6 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.kernel.notification.Notification; *************** *** 20,23 **** --- 21,25 ---- import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Space; + import net.sourceforge.bprocessor.model.Plane; import java.awt.event.MouseEvent; *************** *** 32,36 **** * The extrusion tool */ ! public class ExtrusionTool extends MoveTool { /** The logger */ private static Logger log = Logger.getLogger(ExtrusionTool.class); --- 34,38 ---- * The extrusion tool */ ! public class ExtrusionTool extends SelectTool { /** The logger */ private static Logger log = Logger.getLogger(ExtrusionTool.class); *************** *** 42,45 **** --- 44,50 ---- private static Surface selectedSurface = null; + /** the dragplane */ + private Plane dragplane; + /** * The Constructor *************** *** 81,90 **** } } else { double dX = pressPos[0] - e.getX(); double dY = pressPos[1] - e.getY(); double delta = (dX - dY) / 60; Vertex normal = dragSurface.normal(); normal.scale(1 / normal.length()); ! normal.scale(delta); List l = Util.traverse(dragSurface); //moving the dragged surface along its normal vector --- 86,106 ---- } } else { + /* + old style code. double dX = pressPos[0] - e.getX(); double dY = pressPos[1] - e.getY(); double delta = (dX - dY) / 60; + */ 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 *************** *** 158,163 **** protected void pressed(MouseEvent e) { super.pressed(e); if (target instanceof Surface) { ! selectedSurface = (Surface)target; } else { selectedSurface = null; --- 174,197 ---- protected void pressed(MouseEvent e) { super.pressed(e); + pressPos[0] = e.getX(); + pressPos[1] = e.getY(); if (target instanceof 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", 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]))); } else { selectedSurface = null; |
From: Michael L. <he...@us...> - 2005-09-06 12:00:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3606/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Small change to ProcessSelect (z1 and z2 mapped to double) Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** AbstractView.java 6 Sep 2005 08:36:22 -0000 1.20 --- AbstractView.java 6 Sep 2005 12:00:09 -0000 1.21 *************** *** 788,794 **** int bufferOffset = 0; int names = 0; ! long minZ = Integer.MAX_VALUE; ! long z1; ! long z2; Long id = null; Integer intId; --- 788,793 ---- int bufferOffset = 0; int names = 0; ! long zMax = 0xFFFFFFFFL; ! double nearest = 1.0; Long id = null; Integer intId; *************** *** 797,809 **** if (names > 0) { bufferOffset++; ! z1 = selectBuffer.get(bufferOffset); ! z2 = selectBuffer.get(bufferOffset + 1); bufferOffset += 2; ! if (z1 < minZ) { ! minZ = z1; id = new Long((new Integer(selectBuffer.get(bufferOffset))).longValue()); ! double far = z1 / 0xFFFFFFFF; ! double near = z2 / 0xFFFFFFFF; } bufferOffset += names; --- 796,809 ---- if (names > 0) { bufferOffset++; ! long z1 = 0xFFFFFFFFL & selectBuffer.get(bufferOffset); ! long z2 = 0xFFFFFFFFL & selectBuffer.get(bufferOffset + 1); ! double near = (double) z1 / (double) zMax; ! double far = (double) z2 / (double) zMax; bufferOffset += 2; ! if (near < nearest) { ! nearest = near; id = new Long((new Integer(selectBuffer.get(bufferOffset))).longValue()); ! } bufferOffset += names; |
From: Michael L. <he...@us...> - 2005-09-06 09:23:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7728/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Minor change to PencilTool Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PencilTool.java 6 Sep 2005 07:39:24 -0000 1.15 --- PencilTool.java 6 Sep 2005 09:23:02 -0000 1.16 *************** *** 153,156 **** --- 153,158 ---- if (exterior != null) { exterior.addHole(surface); + SurfaceFacade.getInstance().update(exterior); + SurfaceFacade.getInstance().update(surface); } edges = null; |
From: Michael L. <he...@us...> - 2005-09-06 08:36:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30564/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: The d2 view buttons now just change the rotation of the 3d view Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GLView.java 2 Sep 2005 13:36:44 -0000 1.12 --- GLView.java 6 Sep 2005 08:36:22 -0000 1.13 *************** *** 85,98 **** */ public void changeView(int v) { ! glc.removeGLEventListener(view); ! view = ViewFactory.getFactory(this).get(v); ! if (view != null) { ! glc.addGLEventListener(view); ! } else { ! log.error("[changeView] View was null shifts to default"); ! view = ViewFactory.getFactory(this).getDefault(); ! glc.addGLEventListener(view); ! } ! getView().reset(); this.repaint(true); } --- 85,89 ---- */ public void changeView(int v) { ! view.changeView(v); this.repaint(true); } |
From: Michael L. <he...@us...> - 2005-09-06 08:36:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30564/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java View3D.java Log Message: The d2 view buttons now just change the rotation of the 3d view Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** AbstractView.java 2 Sep 2005 13:21:19 -0000 1.19 --- AbstractView.java 6 Sep 2005 08:36:22 -0000 1.20 *************** *** 646,649 **** --- 646,655 ---- } } + + /** + * Change view to 3d, XY, XZ, or YZ + * @param value One of 3d_VIEW, XY_VIEW, XZ_VIEW, YZ_VIEW + */ + public void changeView(int value) { } /** *************** *** 829,834 **** selectMode = VERTICES; //repainting to get selection buffer - //display(glv.getGLDrawable()); - glv.repaint(true); id = processSelect(); --- 835,838 ---- Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** View3D.java 2 Sep 2005 13:21:19 -0000 1.14 --- View3D.java 6 Sep 2005 08:36:22 -0000 1.15 *************** *** 119,122 **** --- 119,152 ---- /** + * Change view to 3d, XY, XZ, or YZ + * @param value One of 3d_VIEW, XY_VIEW, XZ_VIEW, YZ_VIEW + */ + public void changeView(int value) { + if (value == View.VIEW_XY) { + rotationZ = 180; + rotationX = -90; + } + if (value == View.VIEW_XZ) { + rotationZ = 180; + rotationX = 0; + } + if (value == View.VIEW_YZ) { + rotationZ = 90; + rotationX = 0; + } + if (value == View.VIEW_3D) { + rotationZ = 130; + rotationX = -30; + } + + } + + /** + * Resets the working attributes of the view + */ + public void reset() { + super.reset(); + } + /** * Draw a grid */ Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** View.java 2 Sep 2005 13:21:19 -0000 1.9 --- View.java 6 Sep 2005 08:36:22 -0000 1.10 *************** *** 117,120 **** --- 117,126 ---- /** + * Change view to 3d, XY, XZ, or YZ + * @param value One of 3d_VIEW, XY_VIEW, XZ_VIEW, YZ_VIEW + */ + public void changeView(int value); + + /** * Set activeEdge * @param e The activeEdge |
From: Michael L. <he...@us...> - 2005-09-06 07:39:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17766/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Fixed bug in snap in PencilTool Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PencilTool.java 5 Sep 2005 14:42:05 -0000 1.14 --- PencilTool.java 6 Sep 2005 07:39:24 -0000 1.15 *************** *** 171,176 **** */ protected double round(double value) { ! int i = (int) value; ! if (Math.abs(i - value) < 0.3) { return Math.round(value); } else { --- 171,175 ---- */ protected double round(double value) { ! if (Math.abs(value - Math.round(value)) < 0.3) { return Math.round(value); } else { *************** *** 257,261 **** if (current.getId() == null) { snap(current); ! } return legal; --- 256,264 ---- if (current.getId() == null) { snap(current); ! Set vertices = VertexFacade.getInstance().findByLocation ! (current.getX(), current.getY(), current.getZ(), 0.0); ! if (!vertices.isEmpty()) { ! current = (Vertex) vertices.iterator().next(); ! } } return legal; |
From: Michael L. <he...@us...> - 2005-09-05 14:42:13
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31724/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: More hole functionality Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PencilTool.java 5 Sep 2005 14:29:16 -0000 1.13 --- PencilTool.java 5 Sep 2005 14:42:05 -0000 1.14 *************** *** 151,154 **** --- 151,157 ---- Surface surface = new Surface("S" + surfaceNum++, edges); intern(surface); + if (exterior != null) { + exterior.addHole(surface); + } edges = null; active = null; |
From: Michael L. <he...@us...> - 2005-09-05 14:29:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29197/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Adding hole functionality to pencil Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PencilTool.java 5 Sep 2005 11:43:56 -0000 1.12 --- PencilTool.java 5 Sep 2005 14:29:16 -0000 1.13 *************** *** 11,14 **** --- 11,15 ---- import java.util.ArrayList; import java.util.List; + import java.util.Set; import net.sourceforge.bprocessor.gl.GLView; *************** *** 45,48 **** --- 46,58 ---- protected Vertex alignVertex = null; + /** The exterior Surface is a Surface, where a hole is being defined */ + + protected Surface exterior = null; + + /** The candidates are the Set of surfaces that could be the exterior + * for a hole being defined. + */ + protected Set candiates = null; + /** The edges */ *************** *** 109,113 **** void onVertex(Vertex vertex) { System.out.println(vertex); - setAlignVertex(vertex); if (active == null) { --- 119,122 ---- *************** *** 119,126 **** glv.getView().setActiveEdge(active); glv.getView().setSnapVertex(to); } else { // The following lines of code are there to make sure // that a Surface is finished when clicking an edge.. - if (target != null) { if (target instanceof Edge) { --- 128,135 ---- glv.getView().setActiveEdge(active); glv.getView().setSnapVertex(to); + } else { // The following lines of code are there to make sure // that a Surface is finished when clicking an edge.. if (target != null) { if (target instanceof Edge) { *************** *** 149,152 **** --- 158,162 ---- setAlignVertex(null); glv.getView().setSnapVertex(null); + exterior = null; } } *************** *** 197,202 **** * Set current vertex to an appropriate vertex * @param event Tne MouseEvent */ ! protected void findVertex(MouseEvent event) { double x = event.getX(); double y = AbstractView.getHeight() - event.getY(); --- 207,214 ---- * Set current vertex to an appropriate vertex * @param event Tne MouseEvent + * @return if the vertex is legal */ ! protected boolean findVertex(MouseEvent event) { ! boolean legal = true; double x = event.getX(); double y = AbstractView.getHeight() - event.getY(); *************** *** 218,221 **** --- 230,241 ---- vertex.setName("V" + vertexNum++); current = vertex; + if (active != null) { + if (exterior != null) { + legal = (target == exterior); + } else { + exterior = (Surface) target; + legal = true; + } + } } if (target instanceof Edge) { *************** *** 236,239 **** --- 256,260 ---- } + return legal; } *************** *** 244,249 **** protected void pressed(MouseEvent e) { super.pressed(e); ! findVertex(e); ! onVertex(current); } /** --- 265,272 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! boolean legal = findVertex(e); ! if (legal) { ! onVertex(current); ! } } /** |
From: Michael L. <he...@us...> - 2005-09-05 11:44:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22285/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: More snapping in pencil Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PencilTool.java 1 Sep 2005 08:33:58 -0000 1.11 --- PencilTool.java 5 Sep 2005 11:43:56 -0000 1.12 *************** *** 42,45 **** --- 42,48 ---- protected Vertex current = null; + /** The align vertex */ + protected Vertex alignVertex = null; + /** The edges */ *************** *** 76,79 **** --- 79,94 ---- /** + * Set the align vertex + * @param vertex The vertex + */ + protected void setAlignVertex(Vertex vertex) { + if (vertex != null) { + glv.getView().setAlignPoint(new double[]{vertex.getX(), vertex.getY(), vertex.getZ()}); + } else { + glv.getView().setAlignPoint(null); + } + alignVertex = vertex; + } + /** * Intern the surface * @param surface The surface *************** *** 94,97 **** --- 109,114 ---- void onVertex(Vertex vertex) { System.out.println(vertex); + + setAlignVertex(vertex); if (active == null) { edges = new ArrayList(); *************** *** 101,104 **** --- 118,122 ---- active = new Edge("E" + edgeNum++, from, to); glv.getView().setActiveEdge(active); + glv.getView().setSnapVertex(to); } else { // The following lines of code are there to make sure *************** *** 129,132 **** --- 147,152 ---- from = null; to = null; + setAlignVertex(null); + glv.getView().setSnapVertex(null); } } *************** *** 139,146 **** protected double round(double value) { int i = (int) value; ! if (Math.abs(i - value) < 0.2) { return Math.round(value); } else { ! return value; } } --- 159,195 ---- protected double round(double value) { int i = (int) value; ! if (Math.abs(i - value) < 0.3) { return Math.round(value); } else { ! return ((double) Math.round(value * 1000)) / 1000.0; ! } ! } ! ! ! /** ! * Snaps the vertex ! * @param vertex The vertex to snap ! */ ! protected void snap(Vertex vertex) { ! if (alignVertex != null) { ! if (Math.abs(alignVertex.getX() - vertex.getX()) < 0.3) { ! vertex.setX(alignVertex.getX()); ! } else { ! vertex.setX(round(current.getX())); ! } ! if (Math.abs(alignVertex.getY() - vertex.getY()) < 0.3) { ! vertex.setY(alignVertex.getY()); ! } else { ! vertex.setY(round(current.getY())); ! } ! if (Math.abs(alignVertex.getZ() - vertex.getZ()) < 0.3) { ! vertex.setZ(alignVertex.getZ()); ! } else { ! vertex.setZ(round(current.getZ())); ! } ! } else { ! vertex.setX(round(current.getX())); ! vertex.setY(round(current.getY())); ! vertex.setZ(round(current.getZ())); } } *************** *** 184,190 **** } if (current.getId() == null) { ! current.setX(round(current.getX())); ! current.setY(round(current.getY())); ! current.setZ(round(current.getZ())); } } --- 233,238 ---- } if (current.getId() == null) { ! snap(current); ! } } *************** *** 196,199 **** --- 244,248 ---- protected void pressed(MouseEvent e) { super.pressed(e); + findVertex(e); onVertex(current); } *************** *** 205,208 **** --- 254,258 ---- super.moved(e); findVertex(e); + if (to != null) { to.setX(current.getX()); |
From: rimestad <rim...@us...> - 2005-09-02 13:44:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18243 Modified Files: DrawTool.java Log Message: adds spaces to the surfaces Index: DrawTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DrawTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DrawTool.java 30 Aug 2005 12:47:25 -0000 1.7 --- DrawTool.java 2 Sep 2005 13:44:19 -0000 1.8 *************** *** 11,14 **** --- 11,19 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.VertexFacade; + import net.sourceforge.bprocessor.model.Space; + import net.sourceforge.bprocessor.model.FunctionalSpace; + import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; + import net.sourceforge.bprocessor.model.ConstructionSpace; + import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.GLView; *************** *** 127,130 **** --- 132,147 ---- activeEdge.setTo(to); updateEdge(activeEdge); + Surface s = createSurface(edges); + Space sp = findSpace(s); + if (sp != null) { + sp.addSurface(s); + } + 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"); + } } else { to = activeEdge.getTo(); *************** *** 135,139 **** edges.add(activeEdge); } - Surface s = createSurface(edges); glv.getView().setAlignVertex(null); glv.getView().setActiveEdge(null); --- 152,155 ---- *************** *** 141,144 **** --- 157,178 ---- } + + /** + * 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; + } + /** * Add an edge to the parent edgelist |
From: rimestad <rim...@us...> - 2005-09-02 13:42:44
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17891 Modified Files: SelectTool.java Log Message: minor bug fix Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SelectTool.java 2 Sep 2005 13:29:44 -0000 1.15 --- SelectTool.java 2 Sep 2005 13:42:36 -0000 1.16 *************** *** 119,122 **** --- 119,123 ---- deselect(it.next()); } + selection = new ArrayList(); select(target); selection.add(target); |
From: rimestad <rim...@us...> - 2005-09-02 13:39:47
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17149 Modified Files: Domain.java FunctionalSpaceFacade.java Log Message: added new functions Index: Domain.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Domain.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Domain.java 22 Aug 2005 08:46:44 -0000 1.5 --- Domain.java 2 Sep 2005 13:39:37 -0000 1.6 *************** *** 9,12 **** --- 9,13 ---- import java.io.Serializable; import java.util.Set; + import java.util.HashSet; import org.apache.log4j.Logger; *************** *** 108,112 **** * @hibernate.key * column="DOMAIN_ID" ! * @hibernate.one-to-many * class="net.sourceforge.bprocessor.model.Surface" */ --- 109,113 ---- * @hibernate.key * column="DOMAIN_ID" ! * @hibernate.many-to-many * class="net.sourceforge.bprocessor.model.Surface" */ *************** *** 124,127 **** --- 125,143 ---- /** + * Add a surface to the list of surfaces + * @param surface The surface + */ + public void addSurface(Surface surface) { + Set s = getSurfaces(); + if (s == null) { + Set set = new HashSet(); + set.add(surface); + setSurfaces(set); + } else { + s.add(surface); + } + } + + /** * String representation of the object * @return The string Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FunctionalSpaceFacade.java 17 Aug 2005 11:22:54 -0000 1.4 --- FunctionalSpaceFacade.java 2 Sep 2005 13:39:37 -0000 1.5 *************** *** 203,205 **** --- 203,237 ---- return result; } + + /** + * Find the Functional spaces matched with a surface + * @param surface The id of 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 FunctionalSpace 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((FunctionalSpace)it.next()); + } + tx.commit(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } finally { + hu.closeSession(); + } + return result; + } } |
From: rimestad <rim...@us...> - 2005-09-02 13:38:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16933 Modified Files: Surface.java Log Message: added connected space lookup Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Surface.java 1 Sep 2005 13:16:12 -0000 1.18 --- Surface.java 2 Sep 2005 13:38:47 -0000 1.19 *************** *** 200,203 **** --- 200,212 ---- */ public Space getFrontSpace() { + Set set = FunctionalSpaceFacade.getInstance().findBySurface(this); + log.info("spaces found " + set.size()); + if (set != null) { + Iterator it = set.iterator(); + if (it.hasNext()) { + Space s = (Space)it.next(); + return s; + } + } return null; } |
From: rimestad <rim...@us...> - 2005-09-02 13:38:21
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16815 Modified Files: Plane.java Log Message: made orthogonal space method Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Plane.java 31 Aug 2005 07:52:28 -0000 1.4 --- Plane.java 2 Sep 2005 13:38:13 -0000 1.5 *************** *** 44,47 **** --- 44,64 ---- /** + * Find the orthogonal plane to this plane + * @param rayIn the ray into the view + * @return The orthogonal plane + */ + public Plane orthogonalPlane(Edge rayIn) { + Vertex to = rayIn.getTo(); + Vertex from = rayIn.getFrom(); + Vertex alfa = new Vertex("", to.getX() - from.getX(), + to.getY() - from.getY(), + to.getZ() - from.getZ()); + Vertex beta = new Vertex("", a, b, c); + Vertex temp = alfa.cross(beta); + Vertex norm = temp.cross(beta); + return new Plane(norm.getX(), norm.getY(), norm.getZ(), d); + } + + /** * Find the intersection with the ray (x y t), * if the ray is parallel to the Plane, otherwise NaN is *************** *** 98,101 **** return intersection(p0, p1); } ! } --- 115,125 ---- return intersection(p0, p1); } ! ! /** ! * To string ! * @return a string ! */ ! public String toString() { ! return "[Plane a: " + a + " b:" + b + " c:" + c + " d:" + d + "]"; ! } } |