bprocessor-commit Mailing List for B-processor (Page 168)
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: Jesper P. <je...@us...> - 2005-08-05 11:24:26
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4080 Modified Files: AbstractTool.java Log Message: Always update dx/dy - bug in JRE/Linux Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractTool.java 5 Aug 2005 10:59:18 -0000 1.6 --- AbstractTool.java 5 Aug 2005 11:24:15 -0000 1.7 *************** *** 144,151 **** int x = e.getX(); int y = e.getY(); ! if (e.getButton() == MouseEvent.BUTTON3) { ! this.dx = x - pressPos[0]; ! this.dy = y - pressPos[1]; ! } dragged(e); glv.repaint(); --- 144,151 ---- int x = e.getX(); int y = e.getY(); ! ! this.dx = x - pressPos[0]; ! this.dy = y - pressPos[1]; ! dragged(e); glv.repaint(); |
From: rimestad <rim...@us...> - 2005-08-05 11:06:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1390 Modified Files: AbstractView.java Log Message: added notification and drawing of selected surfaces Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractView.java 4 Aug 2005 10:49:55 -0000 1.2 --- AbstractView.java 5 Aug 2005 11:06:11 -0000 1.3 *************** *** 9,12 **** --- 9,15 ---- import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.gl.tool.Util; + import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.EdgeFacade; *************** *** 14,17 **** --- 17,21 ---- import net.sourceforge.bprocessor.model.VertexFacade; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.SurfaceFacade; import java.util.Iterator; *************** *** 22,27 **** import net.java.games.jogl.GLDrawable; import net.java.games.jogl.GLU; - import net.java.games.jogl.GLUquadric; - import net.java.games.jogl.util.GLUT; import org.apache.log4j.Logger; --- 26,29 ---- *************** *** 51,54 **** --- 53,59 ---- public static final double[] GRID_COLOR = new double[] {0.85, 0.85, 0.85}; + /** Used for selected objects */ + public static final double[] SELECTED_COLOR = new double[] {1.0, 0.4, 1.0}; + /** The view transformation matrix (it is shown transposed) see p. 187 [GL BIBLE]*/ protected static double[] viewTrans = new double[] {1.0, 0.0, 0.0, 0.0, *************** *** 84,87 **** --- 89,98 ---- 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; *************** *** 89,92 **** --- 100,114 ---- /** The zoomFactor in the parent view */ protected double zoomFactor = 1.0; + + /** The GLView */ + protected GLView glv = null; + + /** + * The constructor + * @param glv The glview + */ + public AbstractView(GLView glv) { + this.glv = glv; + } /** *************** *** 164,168 **** GL gl = gld.getGL(); GLU glu = gld.getGLU(); - GLUT glut = new GLUT(); Iterator it = edges.iterator(); --- 186,189 ---- *************** *** 219,232 **** } ! // draw selection if (selectedVertex != null) { ! gl.glColor3d(0.0, 1.0, 0.0); ! gl.glPushMatrix(); ! gl.glTranslated(selectedVertex.getX(), selectedVertex.getY(), selectedVertex.getZ()); ! GLUquadric quad = glu.gluNewQuadric(); ! glu.gluQuadricDrawStyle(quad, GLU.GLU_FILL); ! glu.gluSphere(quad, 0.3, 15, 15); ! glu.gluDeleteQuadric(quad); ! gl.glPopMatrix(); } } --- 240,271 ---- } ! // draw selected vertex if (selectedVertex != null) { ! gl.glColor3dv(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.glColor3dv(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 selected surface ! if (selectedSurface != null) { ! gl.glColor3dv(SELECTED_COLOR); ! selectedSurface = SurfaceFacade.getInstance().findById(selectedSurface.getId()); ! drawSurface(selectedSurface); } } *************** *** 237,245 **** */ private void drawSurface(Surface s) { ! List edges = s.getEdges(); ! Iterator it = edges.iterator(); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! drawEdge(e); } } --- 276,287 ---- */ private void drawSurface(Surface s) { ! List l = Util.traverse(s); ! if (l != null) { ! gl.glBegin(GL.GL_POLYGON); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! } ! gl.glEnd(); } } *************** *** 367,370 **** --- 409,421 ---- /** + * Return the distance on the canvas matching the given double + * @param dist The window coordinates + * @return The relative distance + */ + public double toCanvasDistance(double dist) { + return 2 * size * aspect * zoomFactor * (dist / height); + } + + /** * Handle a notification * @param n The notification *************** *** 373,377 **** --- 424,439 ---- 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(); } *************** *** 382,388 **** */ public boolean isNotificationEnabled(String type) { ! if (type.equals(Notification.VERTEX_SELECTED)) { return true; ! } return false; } --- 444,455 ---- */ 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; } |
From: rimestad <rim...@us...> - 2005-08-05 11:05:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1201 Modified Files: View.java Log Message: added toCanvasDistance Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** View.java 26 Jul 2005 12:40:30 -0000 1.1 --- View.java 5 Aug 2005 11:05:18 -0000 1.2 *************** *** 38,41 **** --- 38,48 ---- /** + * Return the distance on the canvas matching the given double + * @param dist The window coordinates + * @return The relative distance + */ + public double toCanvasDistance(double dist); + + /** * Move the center left/right, up/down, forward/backward * @param mv the move vector *************** *** 109,111 **** --- 116,119 ---- */ public double[] getAlignPoint(); + } |
From: rimestad <rim...@us...> - 2005-08-05 11:04:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv947 Modified Files: ViewFactory.java Log Message: added construction of change view buttons Index: ViewFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ViewFactory.java 26 Jul 2005 12:44:58 -0000 1.1 --- ViewFactory.java 5 Aug 2005 11:04:17 -0000 1.2 *************** *** 8,11 **** --- 8,20 ---- import net.sourceforge.bprocessor.kernel.notification.Notifier; + import net.sourceforge.bprocessor.gui.Toolbar; + import net.sourceforge.bprocessor.gl.GLView; + + import java.awt.event.ActionEvent; + import java.net.URL; + import javax.swing.AbstractAction; + import javax.swing.Action; + import javax.swing.ImageIcon; + import javax.swing.JButton; import org.apache.log4j.Logger; *************** *** 34,43 **** /** * Constructor */ ! private ViewFactory() { ! view3D = new View3D(); ! viewXY = new ViewXY(); ! viewXZ = new ViewXZ(); ! viewYZ = new ViewYZ(); Notifier n = Notifier.getInstance(); --- 43,53 ---- /** * Constructor + * @param glv The GLView */ ! private ViewFactory(GLView glv) { ! view3D = new View3D(glv); ! viewXY = new ViewXY(glv); ! viewXZ = new ViewXZ(glv); ! viewYZ = new ViewYZ(glv); Notifier n = Notifier.getInstance(); *************** *** 46,58 **** n.addListener(viewXZ); n.addListener(viewYZ); } /** * Get the factory * @return The factory */ ! public static synchronized ViewFactory getFactory() { if (factory == null) { ! factory = new ViewFactory(); } return factory; --- 56,79 ---- n.addListener(viewXZ); n.addListener(viewYZ); + + Toolbar tb = Toolbar.getInstance(); + JButton but = tb.registerAction(new View3DAction(glv)); + but.setToolTipText("3D view"); + but = tb.registerAction(new ViewxzAction(glv)); + but.setToolTipText("xz-plane"); + but = tb.registerAction(new ViewxyAction(glv)); + but.setToolTipText("xy-plane"); + but = tb.registerAction(new ViewyzAction(glv)); + but.setToolTipText("yz-plane"); } /** * Get the factory + * @param glv The GLView * @return The factory */ ! public static synchronized ViewFactory getFactory(GLView glv) { if (factory == null) { ! factory = new ViewFactory(glv); } return factory; *************** *** 86,88 **** --- 107,220 ---- } } + + /** + * The viewxy inner class + */ + class ViewxyAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + ViewxyAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("xyicon.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.changeView(View.VIEW_XY); + } + } + + /** + * The viewxz inner class + */ + class ViewxzAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + ViewxzAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("xzicon.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.changeView(View.VIEW_XZ); + } + } + /** + * The viewyz inner class + */ + class ViewyzAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + ViewyzAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("yzicon.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.changeView(View.VIEW_YZ); + } + } + + /** + * The view3D inner class + */ + class View3DAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + View3DAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("3dicon.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.changeView(View.VIEW_3D); + } + } } |
From: rimestad <rim...@us...> - 2005-08-05 11:02:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv593 Modified Files: ViewXY.java View3D.java ViewXZ.java ViewYZ.java Log Message: added constructor to get a GLView reference Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** View3D.java 26 Jul 2005 12:41:58 -0000 1.1 --- View3D.java 5 Aug 2005 11:02:31 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gl.view; + import net.sourceforge.bprocessor.gl.GLView; + import net.java.games.jogl.GL; import net.java.games.jogl.GLDrawable; *************** *** 29,32 **** --- 31,42 ---- private static double rotationY = -30; + /** + * The constructor + * @param glv The glview + */ + public View3D(GLView glv) { + super(glv); + } + /** * The camera setup function Index: ViewYZ.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewYZ.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ViewYZ.java 26 Jul 2005 12:43:21 -0000 1.1 --- ViewYZ.java 5 Aug 2005 11:02:31 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gl.view; + import net.sourceforge.bprocessor.gl.GLView; + import net.java.games.jogl.GL; import net.java.games.jogl.GLDrawable; *************** *** 24,27 **** --- 26,37 ---- /** + * The constructor + * @param glv The glview + */ + public ViewYZ(GLView glv) { + super(glv); + } + + /** * The camera setup function * @param gld The GLDrawable object *************** *** 41,49 **** gl.glOrtho(-size, size, -(size * (height / width)), (size * (height / width)), ! -25.0, 25.0); } else { gl.glOrtho(-(size * aspect), size * aspect, -size, size, ! -25.0, 25.0); } --- 51,59 ---- gl.glOrtho(-size, size, -(size * (height / width)), (size * (height / width)), ! -100.0, 100.0); } else { gl.glOrtho(-(size * aspect), size * aspect, -size, size, ! -100.0, 100.0); } Index: ViewXY.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewXY.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ViewXY.java 26 Jul 2005 12:43:21 -0000 1.1 --- ViewXY.java 5 Aug 2005 11:02:31 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gl.view; + import net.sourceforge.bprocessor.gl.GLView; + import net.java.games.jogl.GL; import net.java.games.jogl.GLDrawable; *************** *** 24,27 **** --- 26,37 ---- /** + * The constructor + * @param glv the glview + */ + public ViewXY(GLView glv) { + super(glv); + } + + /** * The camera setup function * @param gld The GLDrawable object *************** *** 41,49 **** gl.glOrtho(-size, size, -(size * (height / width)), (size * (height / width)), ! -25.0, 25.0); } else { gl.glOrtho(-(size * aspect), size * aspect, -size, size, ! -25.0, 25.0); } gl.glMatrixMode(GL.GL_MODELVIEW); --- 51,59 ---- gl.glOrtho(-size, size, -(size * (height / width)), (size * (height / width)), ! -100.0, 100.0); } else { gl.glOrtho(-(size * aspect), size * aspect, -size, size, ! -100.0, 100.0); } gl.glMatrixMode(GL.GL_MODELVIEW); Index: ViewXZ.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewXZ.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ViewXZ.java 26 Jul 2005 12:43:21 -0000 1.1 --- ViewXZ.java 5 Aug 2005 11:02:31 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gl.view; + import net.sourceforge.bprocessor.gl.GLView; + import net.java.games.jogl.GL; import net.java.games.jogl.GLDrawable; *************** *** 24,27 **** --- 26,37 ---- /** + * The constructor + * @param glv the glview + */ + public ViewXZ(GLView glv) { + super(glv); + } + + /** * The camera setup function * @param gld The GLDrawable object *************** *** 42,50 **** gl.glOrtho(-size, size, -(size * (height / width)), (size * (height / width)), ! -25.0, 25.0); } else { gl.glOrtho(-(size * aspect), size * aspect, -size, size, ! -25.0, 25.0); } --- 52,60 ---- gl.glOrtho(-size, size, -(size * (height / width)), (size * (height / width)), ! -100.0, 100.0); } else { gl.glOrtho(-(size * aspect), size * aspect, -size, size, ! -100.0, 100.0); } |
From: rimestad <rim...@us...> - 2005-08-05 11:00:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32404 Modified Files: GLView.java Log Message: adjusted to match view and tool factories Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GLView.java 5 Aug 2005 07:59:57 -0000 1.5 --- GLView.java 5 Aug 2005 11:00:45 -0000 1.6 *************** *** 44,48 **** glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); ! view = ViewFactory.getFactory().getDefault(); glc.addGLEventListener(view); --- 44,48 ---- glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); ! view = ViewFactory.getFactory(this).getDefault(); glc.addGLEventListener(view); *************** *** 79,88 **** public void changeView(int v) { glc.removeGLEventListener(view); ! view = ViewFactory.getFactory().get(v); if (view != null) { glc.addGLEventListener(view); } else { log.error("[changeView] View was null shifts to default"); ! view = ViewFactory.getFactory().getDefault(); glc.addGLEventListener(view); } --- 79,88 ---- 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); } |
From: rimestad <rim...@us...> - 2005-08-05 10:59:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31887 Modified Files: AbstractTool.java Log Message: added zoom on mouse button 2 and refactured listeners Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractTool.java 4 Aug 2005 10:49:56 -0000 1.5 --- AbstractTool.java 5 Aug 2005 10:59:18 -0000 1.6 *************** *** 16,20 **** import net.sourceforge.bprocessor.gl.GLView; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; --- 16,19 ---- *************** *** 43,53 **** /** An vertex counter */ ! private static long vertexNum = 0; /** An edge counter */ ! private static long edgeNum = 0; /** An surface counter */ ! private static long surfaceNum = 0; /** The snap variable */ --- 42,52 ---- /** An vertex counter */ ! private static long vertexNum = 1; /** An edge counter */ ! private static long edgeNum = 1; /** An surface counter */ ! private static long surfaceNum = 1; /** The snap variable */ *************** *** 73,77 **** this.glv = glv; ! timer = new Timer(10, null); timer.start(); moveAction = new CameraMoveTimer(this, glv); --- 72,76 ---- this.glv = glv; ! timer = new Timer(40, null); timer.start(); moveAction = new CameraMoveTimer(this, glv); *************** *** 103,106 **** --- 102,113 ---- } else if (e.getKeyCode() == KeyEvent.VK_W) { glv.changeTool(Tool.DRAW_TOOL); + } else if (e.getKeyCode() == KeyEvent.VK_E) { + glv.getView().setAlignVertex(null); + glv.getView().setSnapVertex(null); + glv.changeTool(Tool.MOVE_TOOL); + } else if (e.getKeyCode() == KeyEvent.VK_R) { + glv.getView().setAlignVertex(null); + glv.getView().setSnapVertex(null); + glv.changeTool(Tool.EXTRUSION_TOOL); } glv.repaint(); *************** *** 300,304 **** * @return The new Edge */ ! protected Edge createEdge(Vertex to, Vertex from) { Edge e = new Edge("E" + edgeNum); edgeNum++; --- 307,311 ---- * @return The new Edge */ ! protected Edge createEdge(Vertex from, Vertex to) { Edge e = new Edge("E" + edgeNum); edgeNum++; *************** *** 314,317 **** --- 321,332 ---- /** + * Remove a edge for good + * @param e Edge to remove + */ + protected void removeEdge(Edge e) { + EdgeFacade.getInstance().remove(e); + } + + /** * Updates the edge * @param e The edge to update *************** *** 361,430 **** */ protected abstract void released(MouseEvent e); - - /** - * Carama move timer class - */ - private class CameraMoveTimer implements ActionListener { - /** The calling mouselistener */ - private AbstractTool at; - - /** The current GLView */ - private GLView glv; - - /** - * The Constructor - * @param at the abstract tool - * @param glv the GLView - */ - public CameraMoveTimer(AbstractTool at, GLView glv) { - this.at = at; - this.glv = glv; - } - - /** - * executed every time camaraMove is sceduled - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - View v = glv.getView(); - v.translateRotationX(at.getdy()); - v.translateRotationY(at.getdx()); - glv.repaint(); - } - } - - /** - * Camara zoom timer - */ - private class CameraZoomTimer implements ActionListener { - /** The calling mouselistener */ - private AbstractTool at; - - /** The current GLView */ - private GLView glv; - - /** - * The Constructor - * @param at the abstract tool - * @param glv the GLView - */ - public CameraZoomTimer(AbstractTool at, GLView glv) { - this.at = at; - this.glv = glv; - } - - /** - * executed every time camaraMove is sceduled - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - View v = glv.getView(); - if (at.getdy() > 0) { - v.zoom(0.9); - } else { - v.zoom(1.0); - } - glv.repaint(); - } - } } --- 376,378 ---- |
From: rimestad <rim...@us...> - 2005-08-05 10:58:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31537 Modified Files: DrawTool.java Log Message: changed construction of surfaces and edges to fix a bug Index: DrawTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DrawTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DrawTool.java 4 Aug 2005 10:49:57 -0000 1.5 --- DrawTool.java 5 Aug 2005 10:57:47 -0000 1.6 *************** *** 19,22 **** --- 19,23 ---- import java.util.Iterator; import java.util.List; + import java.util.Set; *************** *** 88,92 **** if (e.getClickCount() >= 2) { if (currentButton == MouseEvent.BUTTON1) { ! // double click on Button1 => surface end endSurface(coords); } --- 89,93 ---- if (e.getClickCount() >= 2) { if (currentButton == MouseEvent.BUTTON1) { ! // THE ACTIONS HAVE BEEN pressed->released->pressed at the position endSurface(coords); } *************** *** 113,120 **** protected void endSurface(double[] coord) { Edge activeEdge = glv.getView().getActiveEdge(); ! if (activeEdge != null) { Vertex to = vertexCollide(coord); if (to != null) { // we have to change excisting surface Vertex old = activeEdge.getTo(); --- 114,122 ---- protected void endSurface(double[] coord) { Edge activeEdge = glv.getView().getActiveEdge(); ! if (!edges.isEmpty()) { Vertex to = vertexCollide(coord); if (to != null) { // we have to change excisting surface + edges.add(activeEdge); Vertex old = activeEdge.getTo(); *************** *** 127,137 **** } else { to = activeEdge.getTo(); ! updateVertex(to, coord); } ! Surface s = createSurface(edges); ! glv.getView().setAlignVertex(null); ! glv.getView().setActiveEdge(null); ! edges = new ArrayList(); } } --- 129,142 ---- } else { to = activeEdge.getTo(); ! removeEdge(activeEdge); ! removeVertex(to); } ! } else { ! edges.add(activeEdge); } + Surface s = createSurface(edges); + glv.getView().setAlignVertex(null); + glv.getView().setActiveEdge(null); + edges = new ArrayList(); } *************** *** 141,145 **** */ protected void addEdge(double[] coord) { ! if (edges.isEmpty()) { Vertex from = vertexCollide(coord); if (from == null) { --- 146,150 ---- */ protected void addEdge(double[] coord) { ! if (glv.getView().getActiveEdge() == null) { Vertex from = vertexCollide(coord); if (from == null) { *************** *** 147,153 **** } Vertex to = createVertex(coord); ! Edge activeEdge = createEdge(to, from); glv.getView().setActiveEdge(activeEdge); - edges.add(activeEdge); glv.getView().setAlignVertex(null); } else { --- 152,157 ---- } Vertex to = createVertex(coord); ! Edge activeEdge = createEdge(from, to); glv.getView().setActiveEdge(activeEdge); glv.getView().setAlignVertex(null); } else { *************** *** 155,163 **** // we did not end an edgelist Edge activeEdge = glv.getView().getActiveEdge(); Vertex from = activeEdge.getTo(); Vertex to = createVertex(coord); ! activeEdge = createEdge(to, from); glv.getView().setActiveEdge(activeEdge); - edges.add(activeEdge); glv.getView().setAlignVertex(null); } else { --- 159,167 ---- // we did not end an edgelist Edge activeEdge = glv.getView().getActiveEdge(); + edges.add(activeEdge); Vertex from = activeEdge.getTo(); Vertex to = createVertex(coord); ! activeEdge = createEdge(from, to); glv.getView().setActiveEdge(activeEdge); glv.getView().setAlignVertex(null); } else { *************** *** 174,178 **** protected void changeTo(double[] coord) { Edge activeEdge = glv.getView().getActiveEdge(); ! if (activeEdge != null && !edges.isEmpty()) { Vertex v = activeEdge.getTo(); updateVertex(v, coord); --- 178,182 ---- protected void changeTo(double[] coord) { Edge activeEdge = glv.getView().getActiveEdge(); ! if (activeEdge != null) { Vertex v = activeEdge.getTo(); updateVertex(v, coord); *************** *** 188,199 **** protected Vertex vertexCollide(double[] coord) { Edge e = glv.getView().getActiveEdge(); ! Set vertexes = VertexFacade.getInstance().findAll(); Iterator it = vertexes.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); ! if (collide(v.getX(), coord[0]) && ! collide(v.getY(), coord[1]) && ! collide(v.getZ(), coord[2]) && ! (e == null || (!v.equals(e.getTo()) && !v.equals(e.getFrom())))) { return v; } --- 192,203 ---- protected Vertex vertexCollide(double[] coord) { Edge e = glv.getView().getActiveEdge(); ! Set vertexes = VertexFacade.getInstance().findByLocation(coord[0], ! coord[1], ! coord[2], ! EPSILON); Iterator it = vertexes.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); ! if (e == null || (!v.equals(e.getTo()) && !v.equals(e.getFrom()))) { return v; } |
From: rimestad <rim...@us...> - 2005-08-05 10:55:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31013 Modified Files: SelectTool.java Log Message: added notifications and selction of surfaces Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectTool.java 27 Jul 2005 11:01:54 -0000 1.2 --- SelectTool.java 5 Aug 2005 10:55:31 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.NotificationListener; import net.sourceforge.bprocessor.kernel.notification.Notifier; *************** *** 17,20 **** --- 18,23 ---- 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; *************** *** 28,35 **** * The selecttool */ ! public class SelectTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(SelectTool.class); /** * The constructor --- 31,47 ---- * The selecttool */ ! public class SelectTool extends AbstractTool implements NotificationListener { /** The logger */ private static Logger log = Logger.getLogger(SelectTool.class); + /** 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 constructor *************** *** 59,75 **** */ protected void pressed(MouseEvent e) { - } - - /** - * Invoked when a mouse button has been released on a component. - * @param e The MouseEvent - */ - protected void released(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { int x = e.getX(); int y = e.getY(); View view = glv.getView(); double[] coords = view.toCanvasCoords(new double[]{x, y}); - Vertex v = vertexCollide(coords); if (v != null) { --- 71,95 ---- */ protected void pressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { + if (selectedVertex != null) { + Notification n = new Notification(Notification.VERTEX_DESELECTED, + selectedVertex.getId()); + Notifier.getInstance().sendNotification(n); + } + if (selectedEdge != null) { + Notification n = new Notification(Notification.EDGE_DESELECTED, + selectedEdge.getId()); + Notifier.getInstance().sendNotification(n); + } + if (selectedSurface != null) { + Notification n = new Notification(Notification.SURFACE_DESELECTED, + selectedSurface.getId()); + Notifier.getInstance().sendNotification(n); + } + int x = e.getX(); int y = e.getY(); View view = glv.getView(); double[] coords = view.toCanvasCoords(new double[]{x, y}); Vertex v = vertexCollide(coords); if (v != null) { *************** *** 79,82 **** --- 99,112 ---- Edge edge = edgeCollide(coords); if (edge != null) { + if (e.getClickCount() >= 2) { + Set s = SurfaceFacade.getInstance().findByEdge(edge); + Iterator i = s.iterator(); + Surface sur = null; + if (i.hasNext()) { + sur = (Surface)i.next(); + } + Notification n = new Notification(Notification.SURFACE_SELECTED, sur.getId()); + Notifier.getInstance().sendNotification(n); + } Notification n = new Notification(Notification.EDGE_SELECTED, edge.getId()); Notifier.getInstance().sendNotification(n); *************** *** 85,88 **** --- 115,125 ---- } } + + /** + * Invoked when a mouse button has been released on a component. + * @param e The MouseEvent + */ + protected void released(MouseEvent e) { + } /** *************** *** 125,137 **** */ protected Vertex vertexCollide(double[] coord) { ! Set vertexes = VertexFacade.getInstance().findAll(); Iterator it = vertexes.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); ! if (collide(v.getX(), coord[0]) && ! collide(v.getY(), coord[1]) && ! collide(v.getZ(), coord[2])) { ! return v; ! } } return null; --- 162,173 ---- */ protected Vertex vertexCollide(double[] coord) { ! Set vertexes = VertexFacade.getInstance().findByLocation(coord[0], ! coord[1], ! coord[2], ! EPSILON); Iterator it = vertexes.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); ! return v; } return null; *************** *** 147,149 **** --- 183,222 ---- return Math.abs(a - b) < EPSILON; } + + /** + * 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; + } + } + + /** + * 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; + } } |
From: rimestad <rim...@us...> - 2005-08-05 10:54:06
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30596 Modified Files: Tool.java Log Message: added constants for representing the new tools Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Tool.java 26 Jul 2005 12:36:11 -0000 1.1 --- Tool.java 5 Aug 2005 10:53:55 -0000 1.2 *************** *** 16,21 **** /** The select tool */ public static final int SELECT_TOOL = 0; - /** The draw tool */ public static final int DRAW_TOOL = 1; } --- 16,26 ---- /** 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; + + } |
From: rimestad <rim...@us...> - 2005-08-05 10:52:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30218 Modified Files: ToolFactory.java Log Message: Added adding of buttons for tools and initial construction of all tools Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ToolFactory.java 26 Jul 2005 12:37:23 -0000 1.1 --- ToolFactory.java 5 Aug 2005 10:52:31 -0000 1.2 *************** *** 8,11 **** --- 8,20 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gui.Toolbar; + import net.sourceforge.bprocessor.kernel.notification.Notifier; + + import java.net.URL; + import java.awt.event.ActionEvent; + import javax.swing.AbstractAction; + import javax.swing.Action; + import javax.swing.ImageIcon; + import javax.swing.JButton; import org.apache.log4j.Logger; *************** *** 22,29 **** /** draw tool */ ! private Tool draw; /** select tool */ ! private Tool select; /** --- 31,44 ---- /** draw tool */ ! private DrawTool draw; /** select tool */ ! private SelectTool select; ! ! /** move tool */ ! private MoveTool move; ! ! /** extrusion tool */ ! private ExtrusionTool extrusion; /** *************** *** 34,37 **** --- 49,66 ---- draw = new DrawTool(glv); select = new SelectTool(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 DrawAction(glv)); + but.setToolTipText("Draw"); + but = tb.registerAction(new MoveAction(glv)); + but.setToolTipText("Move"); + but = tb.registerAction(new ExtrudeAction(glv)); + but.setToolTipText("Extrude"); + + Notifier.getInstance().addListener(select); } *************** *** 66,69 **** --- 95,102 ---- } 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 { log.error("[get] No such tool " + i); *************** *** 71,73 **** --- 104,218 ---- } } + + /** + * The select action inner class + */ + class SelectAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + SelectAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("selecticon.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.SELECT_TOOL); + } + } + + /** + * 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); + } + } + + /** + * The move action inner class + */ + class MoveAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + MoveAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("moveicon.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.MOVE_TOOL); + } + } + + /** + * The extrude action inner class + */ + class ExtrudeAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + ExtrudeAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("extrudeicon.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.EXTRUSION_TOOL); + } + } } |
From: rimestad <rim...@us...> - 2005-08-05 10:50:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29623 Added Files: ExtrusionTool.java MoveTool.java Log Message: initial import --- NEW FILE: MoveTool.java --- //--------------------------------------------------------------------------------- // $Id: MoveTool.java,v 1.1 2005/08/05 10:50:16 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Vertex; import java.awt.event.MouseEvent; import java.util.List; import org.apache.log4j.Logger; /** * The move tool */ public class MoveTool extends SelectTool { /** The logger */ private static Logger log = Logger.getLogger(MoveTool.class); /** * The Constructor * @param glv The 3D canvas */ public MoveTool(GLView glv) { super(glv); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { if (selectedVertex != null) { int x = e.getX(); int y = e.getY(); 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(); int x = e.getX(); int y = e.getY(); double[] coordsa = view.toCanvasCoords(new double[]{x, y}); double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); 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(); int x = e.getX(); int y = e.getY(); double[] coordsa = view.toCanvasCoords(new double[]{x, y}); double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); 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); } pressPos[0] = e.getX(); pressPos[1] = e.getY(); } } } --- NEW FILE: ExtrusionTool.java --- //--------------------------------------------------------------------------------- // $Id: ExtrusionTool.java,v 1.1 2005/08/05 10:50:16 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.kernel.notification.Notification; import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; /** * The extrusion tool */ public class ExtrusionTool extends SelectTool { /** The logger */ private static Logger log = Logger.getLogger(ExtrusionTool.class); /** the new surface to drag */ private static Surface dragSurface = null; /** * The Constructor * @param glv The 3D canvas */ public ExtrusionTool(GLView glv) { super(glv); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { if (selectedSurface != null) { if (!selectedSurface.equals(dragSurface)) { if (isExtrudeable(selectedSurface)) { dragSurface = selectedSurface; } else { dragSurface = null; createExtension(); } } if (dragSurface != null) { Vertex normal = dragSurface.normal(); if (normal != null) { double[] second = glv.getView().toCanvasCoords(new double[] {e.getX(), e.getY()}); normal.scale(1 / normal.length()); Vertex proj = dragSurface.projection(second); List l = Util.traverse(dragSurface); for (int count = 0; l != null && count < l.size(); count++) { Vertex v = (Vertex)l.get(count); updateVertex(v, new double[] {v.getX() + proj.getX(), v.getY() + proj.getY(), v.getZ() + proj.getZ()}); } } } } } } /** * Checks if a surface is extrudeable * @param s Surface * @return true if the surface is extrudeable otherwise false */ private boolean isExtrudeable(Surface s) { if (s == null) { return false; } Vertex normal = s.normal(); List l = Util.traverse(s); for (int i = 0; i < l.size(); i++) { Vertex v = (Vertex)l.get(i); Set edges = v.getEdges(); if (edges.size() >= 3) { Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); if (!s.contains(e)) { Vertex v1 = e.otherVertex(v); Vertex v2 = v1.minus(v); Vertex cross = v2.cross(normal); if (Math.abs(cross.length()) > 0.0001) { return false; } } } } else { return false; } } return true; } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { super.pressed(e); } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { super.released(e); } /** * Do alle the initial extrusion stuff */ private void createExtension() { Edge previousEdge = null; Vertex previousVertex = null; Edge first = null; List newEdges = new ArrayList(); List edges = selectedSurface.getEdges(); List top = new ArrayList(edges.size()); Iterator i = edges.iterator(); Edge current = null; if (i.hasNext()) { current = (Edge)i.next(); Edge lastEdge = current; for (int times = 0; times < edges.size(); times++) { if (previousEdge == null) { Vertex newTo = createVertex(new double[] {current.getFrom().getX(), current.getFrom().getY(), current.getFrom().getZ()}); Vertex newFrom = createVertex(new double[] {current.getTo().getX(), current.getTo().getY(), current.getTo().getZ()}); Edge newE = createEdge(newFrom, newTo); Edge ntofrom = createEdge(newTo, current.getFrom()); Edge tonfrom = createEdge(current.getTo(), newFrom); newEdges.add(current); newEdges.add(tonfrom); newEdges.add(newE); newEdges.add(ntofrom); first = ntofrom; top.add(newE); previousEdge = tonfrom; previousVertex = newFrom; } else { if (times == edges.size() - 1 && ((first.getTo()).equals(current.getTo()) || (first.getTo()).equals(current.getFrom()))) { Edge newE = createEdge(first.getFrom(), previousEdge.getTo()); newEdges.add(current); newEdges.add(first); newEdges.add(newE); newEdges.add(previousEdge); top.add(newE); } else { Vertex c = current.otherVertex(previousEdge.otherVertex(previousVertex)); Vertex newFrom = createVertex(new double[] {c.getX(), c.getY(), c.getZ()}); Edge newE = createEdge(newFrom, previousVertex); Edge tonfrom = createEdge(c, newFrom); newEdges.add(current); newEdges.add(tonfrom); newEdges.add(newE); newEdges.add(previousEdge); top.add(newE); previousEdge = tonfrom; previousVertex = newFrom; } } createSurface(newEdges); newEdges = new ArrayList(); //get the next edge to work on Set nexts = (previousEdge.otherVertex(previousVertex)).getEdges(); i = nexts.iterator(); boolean found = false; while (i.hasNext() && !found) { Edge temp = (Edge)i.next(); if (selectedSurface.getEdges().contains(temp) && !temp.equals(current)) { current = temp; found = true; } } } } dragSurface = createSurface(top); Notification n = new Notification(Notification.SURFACE_SELECTED, dragSurface.getId()); Notifier.getInstance().sendNotification(n); } } |
From: rimestad <rim...@us...> - 2005-08-05 10:48:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29082 Added Files: CameraMoveTimer.java CameraZoomTimer.java Util.java Log Message: initial import --- NEW FILE: Util.java --- //--------------------------------------------------------------------------------- // $Id: Util.java,v 1.1 2005/08/05 10:48:30 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; import java.util.Iterator; import java.util.Set; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; /** A utility class */ public class Util { /** The logger */ private static Logger log = Logger.getLogger(Util.class); /** The constructor */ private Util () { } /** * returns a list of vertexes in the given surface ordered * @param s The surface * @return The list of vertexes null if the surface is not connected */ public static List traverse(Surface s) { List edges = s.getEdges(); List result = new ArrayList(edges.size()); Iterator it = edges.iterator(); if (it.hasNext()) { Edge previous = (Edge)it.next(); Vertex first = previous.getFrom(); result.add(first); Vertex current = previous.getTo(); for (int i = 1; i < edges.size(); i++) { result.add(current); Set temp = EdgeFacade.getInstance().findByVertex(current); Iterator ite = temp.iterator(); while (ite.hasNext()) { Edge e = (Edge)ite.next(); if (edges.contains(e) && !e.equals(previous)) { current = oppositeVertex(e, current); previous = e; break; } } if (first.equals(current)) { return result; } } } return null; } /** * checks if the given surface is connected * If it is it returns true otherwise false * @param s The surface * @return If the given surface is connected */ public static boolean connected(Surface s) { List edges = s.getEdges(); Iterator it = edges.iterator(); if (it.hasNext()) { Edge previous = (Edge)it.next(); Vertex first = previous.getFrom(); Vertex current = previous.getTo(); for (int i = 1; i < edges.size(); i++) { Set temp = EdgeFacade.getInstance().findByVertex(current); Iterator ite = temp.iterator(); while (ite.hasNext()) { Edge e = (Edge)ite.next(); if (edges.contains(e) && !e.equals(previous)) { current = oppositeVertex(e, current); previous = e; break; } } if (first.equals(current)) { return true; } } } return false; } /** * Return the opposite vertex in the edge give as the vertex given * @param e The edge * @param v The Vertex * @return the opposite vertex or null if v was not to or from */ public static Vertex oppositeVertex(Edge e, Vertex v) { if (e.getTo().equals(v)) { return e.getFrom(); } else if (e.getFrom().equals(v)) { return e.getTo(); } return null; } } --- NEW FILE: CameraZoomTimer.java --- //--------------------------------------------------------------------------------- // $Id: CameraZoomTimer.java,v 1.1 2005/08/05 10:48:30 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Camara zoom timer */ class CameraZoomTimer implements ActionListener { /** The calling mouselistener */ private AbstractTool at; /** The current GLView */ private GLView glv; /** * The Constructor * @param at the abstract tool * @param glv the GLView */ public CameraZoomTimer(AbstractTool at, GLView glv) { this.at = at; this.glv = glv; } /** * executed every time camaraMove is sceduled * @param e The ActionEvent */ public void actionPerformed(ActionEvent e) { View v = glv.getView(); if (at.getdy() > 0) { v.zoom(0.9); } else { v.zoom(1.0); } glv.repaint(); } } --- NEW FILE: CameraMoveTimer.java --- //--------------------------------------------------------------------------------- // $Id: CameraMoveTimer.java,v 1.1 2005/08/05 10:48:30 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Carama move timer class */ class CameraMoveTimer implements ActionListener { /** The calling mouselistener */ private AbstractTool at; /** The current GLView */ private GLView glv; /** * The Constructor * @param at the abstract tool * @param glv the GLView */ public CameraMoveTimer(AbstractTool at, GLView glv) { this.at = at; this.glv = glv; } /** * executed every time camaraMove is sceduled * @param e The ActionEvent */ public void actionPerformed(ActionEvent e) { View v = glv.getView(); v.translateRotationX(10 * at.getdy()); v.translateRotationY(10 * at.getdx()); glv.repaint(); } } |
From: rimestad <rim...@us...> - 2005-08-05 10:47:08
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687 Added Files: 3dicon.png extrudeicon.png moveicon.png xyicon.png xzicon.png yzicon.png Log Message: Initial import --- NEW FILE: xyicon.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: moveicon.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: extrudeicon.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: yzicon.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: xzicon.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 3dicon.png --- (This appears to be a binary file; contents omitted.) |
From: rimestad <rim...@us...> - 2005-08-05 10:45:50
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28158/src/net/sourceforge/bprocessor/gui Modified Files: Toolbar.java Log Message: now registerAction returns a JButton Index: Toolbar.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/Toolbar.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Toolbar.java 1 Jul 2005 06:40:47 -0000 1.1 --- Toolbar.java 5 Aug 2005 10:45:13 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- import javax.swing.Action; + import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JToolBar; *************** *** 48,54 **** * Register a toolbar action * @param action The action */ ! public void registerAction(Action action) { ! toolBar.add(action); } } --- 49,56 ---- * Register a toolbar action * @param action The action + * @return The JButton */ ! public JButton registerAction(Action action) { ! return toolBar.add(action); } } |
From: Jesper P. <je...@us...> - 2005-08-05 10:45:33
|
Update of /cvsroot/bprocessor/CVSROOT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28210 Modified Files: cvswrappers Log Message: Added image types Index: cvswrappers =================================================================== RCS file: /cvsroot/bprocessor/CVSROOT/cvswrappers,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cvswrappers 27 Jun 2005 07:14:58 -0000 1.2 --- cvswrappers 5 Aug 2005 10:45:23 -0000 1.3 *************** *** 23,24 **** --- 23,27 ---- *.dll -k 'b' *.jnilib -k 'b' + *.gif -k 'b' + *.jpg -k 'b' + *.png -k 'b' |
From: rimestad <rim...@us...> - 2005-08-05 10:43:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27656 Modified Files: Edge.java Log Message: added method for getting orher vertex Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Edge.java 28 Jul 2005 06:48:54 -0000 1.3 --- Edge.java 5 Aug 2005 10:43:08 -0000 1.4 *************** *** 123,126 **** --- 123,140 ---- this.from = from; } + + /** + * Return the other vertex than the given one, if the given one is one of them + * @param v The vertex + * @return the other vertex than v + */ + public Vertex otherVertex(Vertex v) { + if (v.equals(getFrom())) { + return getTo(); + } else if (v.equals(getTo())) { + return getFrom(); + } + return null; + } /** |
From: rimestad <rim...@us...> - 2005-08-05 10:42:18
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27439 Modified Files: Surface.java Log Message: Added methods for calculating normals Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Surface.java 4 Aug 2005 11:11:49 -0000 1.7 --- Surface.java 5 Aug 2005 10:42:09 -0000 1.8 *************** *** 8,11 **** --- 8,12 ---- import java.io.Serializable; + import java.util.Iterator; import java.util.List; *************** *** 130,133 **** --- 131,190 ---- /** + * returns the normal to this + * @return A vector normal for this surface, null if the surface consists of only one edge + */ + public Vertex normal() { + if (edges.size() > 1) { + Iterator it = edges.iterator(); + EdgeFacade ef = EdgeFacade.getInstance(); + Edge e1 = ef.findById(((Edge)it.next()).getId()); + Edge e2 = ef.findById(((Edge)it.next()).getId()); + Vertex v1 = e1.getFrom(); + Vertex v2 = e1.getTo(); + Vertex v3 = e2.getTo(); + + if (v3.equals(v2) || v3.equals(v1)) { + v3 = e2.getFrom(); + } + Vertex v2v1 = v1.minus(v2); + Vertex v2v3 = v3.minus(v2); + return v2v1.cross(v2v3); + } + return null; + } + + /** + * Retruns the projection on the surface normal + * @param p The point to project on the normal + * @return the projection + */ + public Vertex projection(double[] p) { + if (edges.size() > 0) { + Iterator it = edges.iterator(); + Vertex from = ((Edge)it.next()).getTo(); + Vertex point = new Vertex(); + point.setX(p[0] - from.getX()); + point.setY(p[1] - from.getY()); + point.setZ(p[2] - from.getZ()); + Vertex normal = normal(); + double dot = normal.dot(point); + double length = normal.length(); + double scale = dot / (length * length); + normal.scale(scale); + return normal; + } + return null; + } + + /** + * Checks if e is in the surface + * @param e The edge + * @return True if e is in this otherwise false + */ + public boolean contains(Edge e) { + return edges.contains(e); + } + + /** * Return the hash code of the object * @return The hash |
From: rimestad <rim...@us...> - 2005-08-05 10:41:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27231/model Modified Files: Vertex.java Log Message: Added methods for dot and corss products Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Vertex.java 28 Jul 2005 06:48:54 -0000 1.3 --- Vertex.java 5 Aug 2005 10:40:58 -0000 1.4 *************** *** 8,11 **** --- 8,12 ---- import java.io.Serializable; + import java.util.Set; import org.apache.log4j.Logger; *************** *** 163,166 **** --- 164,228 ---- /** + * returns the edges connected to this vertex + * @return The connected vertexes + */ + public Set getEdges() { + return EdgeFacade.getInstance().findByVertex(this); + } + + /** + * scales the vertex by the the given double + * @param scale The scale + */ + public void scale(double scale) { + setX(getX() * scale); + setY(getY() * scale); + setZ(getZ() * scale); + } + + /** + * Method that computes this - the give vertex + * @param v The Vertex to minus with + * @return the difference between this and v + */ + public Vertex minus(Vertex v) { + Vertex res = new Vertex("minus"); + res.setX(this.getX() - v.getX()); + res.setY(this.getY() - v.getY()); + res.setZ(this.getZ() - v.getZ()); + return res; + } + + /** + * Computates the cross product with this and the given vertex + * @param v The Vertex to cross with + * @return The Crossproduct + */ + public Vertex cross(Vertex v) { + Vertex cross = new Vertex("cross"); + cross.setX(this.getY() * v.getZ() - v.getY() * this.getZ()); + cross.setY(this.getZ() * v.getX() - v.getZ() * this.getX()); + cross.setZ(this.getX() * v.getY() - v.getX() * this.getY()); + return cross; + } + + /** + * Computates the dot product with this and the given vertex + * @param v The Vertex to dot product with + * @return The dot product + */ + public double dot(Vertex v) { + return this.getX() * v.getX() + this.getY() * v.getY() + this.getZ() * v.getZ(); + } + + /** + * compute the lengt of the vertex + * @return the length of the vertex + */ + public double length() { + return Math.sqrt(Math.abs(getX() * getX() + getY() * getY() + getZ() * getZ())); + } + + /** * Return the hash code of the object * @return The hash |
From: Jesper P. <je...@us...> - 2005-08-05 08:00:06
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1779 Modified Files: GLView.java Log Message: Enable doubled buffering and hardware acceleration Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GLView.java 26 Jul 2005 12:48:23 -0000 1.4 --- GLView.java 5 Aug 2005 07:59:57 -0000 1.5 *************** *** 40,43 **** --- 40,45 ---- public GLView() { GLCapabilities glCap = new GLCapabilities(); + glCap.setDoubleBuffered(true); + glCap.setHardwareAccelerated(true); glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); |
From: Jesper P. <je...@us...> - 2005-08-04 11:12:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7158/src/net/sourceforge/bprocessor/model Modified Files: Domain.java Element.java Space.java Surface.java Log Message: Fix NPE in toString() Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Surface.java 4 Aug 2005 10:47:57 -0000 1.6 --- Surface.java 4 Aug 2005 11:11:49 -0000 1.7 *************** *** 158,162 **** public String toString() { return "Surface[id=" + id + ",name=" + name + ",constructor=" + constructor + ! ",edges=" + edges.size() + "]"; } } --- 158,162 ---- public String toString() { return "Surface[id=" + id + ",name=" + name + ",constructor=" + constructor + ! ",edges=" + edges == null ? "0" : edges.size() + "]"; } } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Space.java 28 Jul 2005 06:48:54 -0000 1.2 --- Space.java 4 Aug 2005 11:11:49 -0000 1.3 *************** *** 82,86 **** */ public String toString() { ! return "Space[" + super.toString() + ",elements=" + elements.size() + "]"; } } --- 82,87 ---- */ public String toString() { ! return "Space[" + super.toString() + ",elements=" + ! elements == null ? "0" : elements.size() + "]"; } } Index: Element.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Element.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Element.java 28 Jul 2005 06:48:54 -0000 1.2 --- Element.java 4 Aug 2005 11:11:49 -0000 1.3 *************** *** 115,119 **** */ public String toString() { ! return "Element[" + super.toString() + ",parts=" + parts.size() + "]"; } } --- 115,120 ---- */ public String toString() { ! return "Element[" + super.toString() + ",parts=" + ! parts == null ? "0" : parts.size() + "]"; } } Index: Domain.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Domain.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Domain.java 28 Jul 2005 06:48:54 -0000 1.2 --- Domain.java 4 Aug 2005 11:11:48 -0000 1.3 *************** *** 128,132 **** public String toString() { return "Domain[id=" + id + ",name=" + name + ",attributes=" + attributes.size() + ! ",surfaces=" + surfaces.size() + "]"; } } --- 128,132 ---- public String toString() { return "Domain[id=" + id + ",name=" + name + ",attributes=" + attributes.size() + ! ",surfaces=" + surfaces == null ? "0" : surfaces.size() + "]"; } } |
From: Jesper P. <je...@us...> - 2005-08-04 10:50:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1517/tool Modified Files: AbstractTool.java DrawTool.java Log Message: Use list for getEdges() Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractTool.java 28 Jul 2005 10:17:52 -0000 1.4 --- AbstractTool.java 4 Aug 2005 10:49:56 -0000 1.5 *************** *** 21,25 **** import java.awt.event.MouseEvent; ! import java.util.Set; import javax.swing.Timer; --- 21,25 ---- import java.awt.event.MouseEvent; ! import java.util.List; import javax.swing.Timer; *************** *** 323,335 **** /** * Make and register a new Surface ! * @param set The set of edges in the surface * @return The new Surface */ ! protected Surface createSurface(Set set) { Surface s = new Surface("S" + surfaceNum); surfaceNum++; s = SurfaceFacade.getInstance().create(s); ! s.setEdges(set); SurfaceFacade.getInstance().update(s); --- 323,335 ---- /** * Make and register a new Surface ! * @param list The list of edges in the surface * @return The new Surface */ ! protected Surface createSurface(List list) { Surface s = new Surface("S" + surfaceNum); surfaceNum++; s = SurfaceFacade.getInstance().create(s); ! s.setEdges(list); SurfaceFacade.getInstance().update(s); Index: DrawTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DrawTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DrawTool.java 28 Jul 2005 06:55:56 -0000 1.4 --- DrawTool.java 4 Aug 2005 10:49:57 -0000 1.5 *************** *** 16,21 **** import java.awt.event.MouseEvent; ! import java.util.HashSet; import java.util.Iterator; import java.util.Set; --- 16,22 ---- import java.awt.event.MouseEvent; ! import java.util.ArrayList; import java.util.Iterator; + import java.util.List; import java.util.Set; *************** *** 29,33 **** /** The current Edge list */ ! private Set edges; /** --- 30,34 ---- /** The current Edge list */ ! private List edges; /** *************** *** 38,42 **** super(glv); ! edges = new HashSet(); } --- 39,43 ---- super(glv); ! edges = new ArrayList(); } *************** *** 131,135 **** glv.getView().setAlignVertex(null); glv.getView().setActiveEdge(null); ! edges = new HashSet(); } } --- 132,136 ---- glv.getView().setAlignVertex(null); glv.getView().setActiveEdge(null); ! edges = new ArrayList(); } } |
From: Jesper P. <je...@us...> - 2005-08-04 10:50:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1517/view Modified Files: AbstractView.java Log Message: Use list for getEdges() Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractView.java 26 Jul 2005 12:43:56 -0000 1.1 --- AbstractView.java 4 Aug 2005 10:49:55 -0000 1.2 *************** *** 16,19 **** --- 16,20 ---- import java.util.Iterator; + import java.util.List; import java.util.Set; *************** *** 236,240 **** */ private void drawSurface(Surface s) { ! Set edges = s.getEdges(); Iterator it = edges.iterator(); while (it.hasNext()) { --- 237,241 ---- */ private void drawSurface(Surface s) { ! List edges = s.getEdges(); Iterator it = edges.iterator(); while (it.hasNext()) { |
From: Jesper P. <je...@us...> - 2005-08-04 10:48:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1146 Modified Files: PersistenceManager.java Log Message: Use list for getEdges() Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PersistenceManager.java 28 Jul 2005 10:16:37 -0000 1.3 --- PersistenceManager.java 4 Aug 2005 10:48:30 -0000 1.4 *************** *** 32,35 **** --- 32,36 ---- import java.io.InputStream; import java.io.OutputStream; + import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; *************** *** 500,504 **** List es = s.getEdgeref(); if (es != null && es.size() > 0) { ! Set er = new HashSet(); Iterator ies = es.iterator(); while (ies.hasNext()) { --- 501,505 ---- List es = s.getEdgeref(); if (es != null && es.size() > 0) { ! List er = new ArrayList(); Iterator ies = es.iterator(); while (ies.hasNext()) { *************** *** 1069,1073 **** net.sourceforge.bprocessor.model.xml.Surface sx = findSurface(bp, s); ! Set data = s.getEdges(); Iterator it = data.iterator(); while (it.hasNext()) { --- 1070,1074 ---- net.sourceforge.bprocessor.model.xml.Surface sx = findSurface(bp, s); ! List data = s.getEdges(); Iterator it = data.iterator(); while (it.hasNext()) { |
From: Jesper P. <je...@us...> - 2005-08-04 10:48:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv970 Modified Files: Surface.java Log Message: References to edges are now a list Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Surface.java 1 Aug 2005 11:16:58 -0000 1.5 --- Surface.java 4 Aug 2005 10:47:57 -0000 1.6 *************** *** 8,12 **** import java.io.Serializable; ! import java.util.Set; import org.apache.log4j.Logger; --- 8,12 ---- import java.io.Serializable; ! import java.util.List; import org.apache.log4j.Logger; *************** *** 32,36 **** /** The edges relationship */ ! private Set edges; /** --- 32,36 ---- /** The edges relationship */ ! private List edges; /** *************** *** 107,119 **** * Get the edges * @return The edges ! * @hibernate.set * cascade="delete" * lazy="false" * @hibernate.key * column="SURFACE_ID" * @hibernate.many-to-many * class="net.sourceforge.bprocessor.model.Edge" */ ! public Set getEdges() { return edges; } --- 107,121 ---- * Get the edges * @return The edges ! * @hibernate.list * cascade="delete" * lazy="false" * @hibernate.key * column="SURFACE_ID" + * @hibernate.collection-index + * column="SORT_ORDER" * @hibernate.many-to-many * class="net.sourceforge.bprocessor.model.Edge" */ ! public List getEdges() { return edges; } *************** *** 123,127 **** * @param edges The edges */ ! public void setEdges(Set edges) { this.edges = edges; } --- 125,129 ---- * @param edges The edges */ ! public void setEdges(List edges) { this.edges = edges; } |