bprocessor-commit Mailing List for B-processor (Page 172)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: rimestad <rim...@us...> - 2005-07-22 11:27:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18336 Modified Files: View3DListener.java ViewXYListener.java ViewXZListener.java ViewYZListener.java Log Message: moved as much common code as possible to AbstractViewListener so they now only take care of camera, draw grid, draw axis and convert app coords to view coords Index: View3DListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/View3DListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** View3DListener.java 18 Jul 2005 10:35:36 -0000 1.2 --- View3DListener.java 22 Jul 2005 11:12:37 -0000 1.3 *************** *** 29,49 **** private static double rotationY = -30; - /** The zoom factor for the camera */ - private static double zoomFactor = 1.0; - /** ! * The drawing function * @param gld The GLDrawable object */ ! public void display(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! GL gl = gld.getGL(); GLU glu = gld.getGLU(); - gl.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.glViewport(0, 0, (int)width, (int)height); - gl.glShadeModel(GL.GL_FLAT); --- 29,43 ---- private static double rotationY = -30; /** ! * The camera setup function * @param gld The GLDrawable object */ ! public void camera(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! gl = gld.getGL(); GLU glu = gld.getGLU(); gl.glShadeModel(GL.GL_FLAT); *************** *** 53,74 **** if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0 * zoomFactor, 1.0, 0.0, 50.0); } else { ! glu.gluPerspective(60.0 * zoomFactor, aspect, 0.0, 50.0); } gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); ! glu.gluLookAt(0.0, 15.0, 20.0, center[0], center[1], center[2], 0.0, 1.0, 0.0); gl.glRotated(rotationX, 1.0, 0.0, 0.0); gl.glRotated(rotationY, 0.0, 1.0, 0.0); - gl.glMultMatrixd(viewTrans); - grid(gl); - coords(gl); - gl.glColor3f(1.0f, 1.0f, 1.0f); - gl.glLineWidth(1.0f); - gl.glFlush(); } --- 47,63 ---- if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0, 1.0, 0.0, 50.0); } else { ! glu.gluPerspective(60.0, aspect, 0.0, 50.0); } gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); ! glu.gluLookAt(0.0, 15.0 * getZoomFactor(), 20.0 * getZoomFactor(), center[0], center[1], center[2], 0.0, 1.0, 0.0); + gl.glMultMatrixd(viewTrans); gl.glRotated(rotationX, 1.0, 0.0, 0.0); gl.glRotated(rotationY, 0.0, 1.0, 0.0); } *************** *** 92,96 **** */ public void translateRotationX(double change) { ! rotationX += change / height; } --- 81,85 ---- */ public void translateRotationX(double change) { ! rotationX -= change / height; } *************** *** 100,115 **** */ public void translateRotationY(double change) { ! rotationY += change / width; } /** * Draw a grid - * @param gl The Graphic Layer */ ! private void grid(GL gl) { gl.glLineWidth(1.0f); ! gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); ! double size = this.size / 2 * zoomFactor; if (aspect > 1) { size *= aspect; --- 89,103 ---- */ public void translateRotationY(double change) { ! rotationY -= change / width; } /** * Draw a grid */ ! protected void grid() { gl.glLineWidth(1.0f); ! gl.glColor3dv(GRID_COLOR); gl.glBegin(GL.GL_LINES); ! double size = this.size; if (aspect > 1) { size *= aspect; *************** *** 130,145 **** /** * Draw a coordinate system - * @param gl The Graphics Layer */ ! private void coords(GL gl) { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3d(0.0, 1.0, 0.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(10.0, 0.0, 0.0); ! gl.glColor3d(1.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 10.0, 0.0); ! gl.glColor3d(0.0, 0.0, 1.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 10.0); --- 118,132 ---- /** * Draw a coordinate system */ ! protected void coords() { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3dv(X_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(10.0, 0.0, 0.0); ! gl.glColor3dv(Y_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 10.0, 0.0); ! gl.glColor3dv(Z_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 10.0); *************** *** 148,159 **** /** ! * Change the zoom factor of the camera take only R+ ! * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom ! * @param zoom the zoom factor change */ ! public void zoom(double zoom) { ! if (zoomFactor > 0) { ! this.zoomFactor *= zoom; } ! } } --- 135,149 ---- /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @return The relative 3D coordinates ! * @param coords The window coordinates */ ! public double[] toCanvasCoords(double[] coords) { ! if (coords.length == 2) { ! return new double[] {0.0, 0.0, 0.0}; ! } else { ! log.warn("Too many arguments"); ! return new double[] {0.0, 0.0, 0.0}; } ! } } Index: ViewXYListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/ViewXYListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ViewXYListener.java 18 Jul 2005 10:34:42 -0000 1.2 --- ViewXYListener.java 22 Jul 2005 11:12:38 -0000 1.3 *************** *** 23,46 **** private static double[] center = new double[] {0.0, 0.0, 0.0}; - /** The zoom factor for the camera */ - private static double zoomFactor = 1.0; - /** ! * The drawing function * @param gld The GLDrawable object */ ! public void display(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! GL gl = gld.getGL(); GLU glu = gld.getGLU(); - gl.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! double size = this.size * this.zoomFactor; if (width <= height) { gl.glOrtho(-size, size, --- 23,41 ---- private static double[] center = new double[] {0.0, 0.0, 0.0}; /** ! * The camera setup function * @param gld The GLDrawable object */ ! public void camera(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! gl = gld.getGL(); GLU glu = gld.getGLU(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! double size = this.size * getZoomFactor(); if (width <= height) { gl.glOrtho(-size, size, *************** *** 55,64 **** gl.glLoadIdentity(); glu.gluLookAt(center[0], center[1], 10.0, center[0], center[1], center[2], 0.0, 1.0, 0.0); - - grid(gl); - coords(gl); - gl.glColor3d(1.0, 1.0, 1.0); - gl.glLineWidth(1.0f); - gl.glFlush(); } --- 50,53 ---- *************** *** 79,93 **** /** * Draw a grid - * @param gl The Graphic Layer */ ! private void grid(GL gl) { gl.glLineWidth(1.0f); ! gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); double size; if (aspect > 1) { ! size = this.size * zoomFactor * aspect; } else { ! size = this.size * zoomFactor / aspect; } for (int x = -(int)size; x <= (int)size; x++) { --- 68,81 ---- /** * Draw a grid */ ! protected void grid() { gl.glLineWidth(1.0f); ! gl.glColor3dv(GRID_COLOR); gl.glBegin(GL.GL_LINES); double size; if (aspect > 1) { ! size = this.size * getZoomFactor() * aspect; } else { ! size = this.size * getZoomFactor() / aspect; } for (int x = -(int)size; x <= (int)size; x++) { *************** *** 104,116 **** /** * Draw a coordinate system - * @param gl The Graphics Layer */ ! private void coords(GL gl) { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3d(0.0, 1.0, 0.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(10.0, 0.0, 0.0); ! gl.glColor3d(1.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 10.0, 0.0); --- 92,103 ---- /** * Draw a coordinate system */ ! protected void coords() { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3dv(X_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(10.0, 0.0, 0.0); ! gl.glColor3dv(Y_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 10.0, 0.0); *************** *** 119,130 **** /** ! * Change the zoom factor of the camera take only R+ ! * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom ! * @param zoom the zoom factor change */ ! public void zoom(double zoom) { ! if (zoomFactor > 0) { ! this.zoomFactor *= zoom; } ! } } --- 106,131 ---- /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @return The relative 3D coordinates ! * @param coords The window coordinates */ ! public double[] toCanvasCoords(double[] coords) { ! if (coords.length == 2) { ! double pixelwidth, pixelheight; ! if (aspect < 1) { ! pixelheight = height / (2 * size * getZoomFactor() * (1 / aspect)); ! pixelwidth = width / (2 * size * getZoomFactor()); ! } else { ! pixelheight = height / (2 * size * getZoomFactor()); ! pixelwidth = width / (2 * size * getZoomFactor() * aspect); ! } ! double returnx = coords[0] / pixelwidth + center[0] - width / (2 * pixelwidth); ! double returny = -coords[1] / pixelheight + center[1] + height / (2 * pixelheight); ! double returnz = 0; ! return new double[] {returnx, returny, returnz}; ! } else { ! log.warn("Too many arguments"); ! return new double[] {0.0, 0.0, 0.0}; } ! } } Index: ViewXZListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/ViewXZListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ViewXZListener.java 18 Jul 2005 10:34:42 -0000 1.2 --- ViewXZListener.java 22 Jul 2005 11:12:38 -0000 1.3 *************** *** 23,47 **** private static double[] center = new double[] {0.0, 0.0, 0.0}; - /** The zoom factor for the camera */ - private static double zoomFactor = 1.0; - /** ! * The drawing function * @param gld The GLDrawable object */ ! public void display(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! GL gl = gld.getGL(); GLU glu = gld.getGLU(); - - gl.glClear(GL.GL_COLOR_BUFFER_BIT); // Matrix mode have to be projection for perspecive gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! double size = this.size * this.zoomFactor; if (width <= height) { gl.glOrtho(-size, size, --- 23,42 ---- private static double[] center = new double[] {0.0, 0.0, 0.0}; /** ! * The camera setup function * @param gld The GLDrawable object */ ! public void camera(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! gl = gld.getGL(); GLU glu = gld.getGLU(); // Matrix mode have to be projection for perspecive gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! double size = this.size * getZoomFactor(); if (width <= height) { gl.glOrtho(-size, size, *************** *** 58,67 **** gl.glLoadIdentity(); glu.gluLookAt(center[0], -10.0, center[2], center[0], center[1], center[2], 0.0, 0.0, 1.0); - - grid(gl); - coords(gl); - gl.glColor3d(1.0, 1.0, 1.0); - gl.glLineWidth(1.0f); - gl.glFlush(); } --- 53,56 ---- *************** *** 82,96 **** /** * Draw a grid - * @param gl The Graphic Layer */ ! private void grid(GL gl) { gl.glLineWidth(1.0f); ! gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); double size; if (aspect > 1) { ! size = this.size * zoomFactor * aspect; } else { ! size = this.size * zoomFactor / aspect; } for (int x = -(int)size; x <= (int)size; x++) { --- 71,84 ---- /** * Draw a grid */ ! protected void grid() { gl.glLineWidth(1.0f); ! gl.glColor3dv(GRID_COLOR); gl.glBegin(GL.GL_LINES); double size; if (aspect > 1) { ! size = this.size * getZoomFactor() * aspect; } else { ! size = this.size * getZoomFactor() / aspect; } for (int x = -(int)size; x <= (int)size; x++) { *************** *** 107,119 **** /** * Draw a coordinate system - * @param gl The Graphics Layer */ ! private void coords(GL gl) { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3d(0.0, 1.0, 0.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(10.0, 0.0, 0.0); ! gl.glColor3d(0.0, 0.0, 1.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 10.0); --- 95,106 ---- /** * Draw a coordinate system */ ! protected void coords() { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3dv(X_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(10.0, 0.0, 0.0); ! gl.glColor3dv(Z_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 10.0); *************** *** 122,133 **** /** ! * Change the zoom factor of the camera take only R+ ! * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom ! * @param zoom the zoom factor change */ ! public void zoom(double zoom) { ! if (zoomFactor > 0) { ! this.zoomFactor *= zoom; } ! } } --- 109,134 ---- /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @return The relative 3D coordinates ! * @param coords The window coordinates */ ! public double[] toCanvasCoords(double[] coords) { ! if (coords.length == 2) { ! double pixelwidth, pixelheight; ! if (aspect < 1) { ! pixelheight = height / (2 * size * getZoomFactor() * (1 / aspect)); ! pixelwidth = width / (2 * size * getZoomFactor()); ! } else { ! pixelheight = height / (2 * size * getZoomFactor()); ! pixelwidth = width / (2 * size * getZoomFactor() * aspect); ! } ! double returnx = coords[0] / pixelwidth + center[0] - width / (2 * pixelwidth); ! double returny = 0; ! double returnz = height / (2 * pixelheight) - coords[1] / pixelheight + center[2]; ! return new double[] {returnx, returny, returnz}; ! } else { ! log.warn("Too many arguments"); ! return new double[] {0.0, 0.0, 0.0}; } ! } } Index: ViewYZListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/ViewYZListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ViewYZListener.java 18 Jul 2005 10:36:34 -0000 1.2 --- ViewYZListener.java 22 Jul 2005 11:12:38 -0000 1.3 *************** *** 23,46 **** private static double[] center = new double[] {0.0, 0.0, 0.0}; - /** The zoom factor for the camera */ - private static double zoomFactor = 1.0; - /** ! * The drawing function * @param gld The GLDrawable object */ ! public void display(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! GL gl = gld.getGL(); GLU glu = gld.getGLU(); - - gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! double size = this.size * this.zoomFactor; if (width <= height) { gl.glOrtho(-size, size, --- 23,41 ---- private static double[] center = new double[] {0.0, 0.0, 0.0}; /** ! * The camera setup function * @param gld The GLDrawable object */ ! public void camera(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } ! gl = gld.getGL(); GLU glu = gld.getGLU(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! double size = this.size * getZoomFactor(); if (width <= height) { gl.glOrtho(-size, size, *************** *** 56,65 **** gl.glLoadIdentity(); glu.gluLookAt(-10.0, center[1], center[2], center[0], center[1], center[2], 0.0, 1.0, 0.0); - - grid(gl); - coords(gl); - gl.glColor3d(1.0, 1.0, 1.0); - gl.glLineWidth(1.0f); - gl.glFlush(); } --- 51,54 ---- *************** *** 80,94 **** /** * Draw a grid - * @param gl The Graphic Layer */ ! private void grid(GL gl) { double size; if (aspect > 1) { ! size = this.size * zoomFactor * aspect; } else { ! size = this.size * zoomFactor / aspect; } gl.glLineWidth(1.0f); ! gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); for (int y = -(int)size; y <= size; y++) { --- 69,82 ---- /** * Draw a grid */ ! protected void grid() { double size; if (aspect > 1) { ! size = this.size * getZoomFactor() * aspect; } else { ! size = this.size * getZoomFactor() / aspect; } gl.glLineWidth(1.0f); ! gl.glColor3dv(GRID_COLOR); gl.glBegin(GL.GL_LINES); for (int y = -(int)size; y <= size; y++) { *************** *** 105,117 **** /** * Draw a coordinate system - * @param gl The Graphics Layer */ ! private void coords(GL gl) { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3d(1.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 10.0, 0.0); ! gl.glColor3d(0.0, 0.0, 1.0); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 10.0); --- 93,104 ---- /** * Draw a coordinate system */ ! protected void coords() { gl.glLineWidth(2.0f); gl.glBegin(GL.GL_LINES); ! gl.glColor3dv(Y_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 10.0, 0.0); ! gl.glColor3dv(Z_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, 0.0, 10.0); *************** *** 120,131 **** /** ! * Change the zoom factor of the camera take only R+ ! * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom ! * @param zoom the zoom factor change */ ! public void zoom(double zoom) { ! if (zoomFactor > 0) { ! this.zoomFactor *= zoom; } ! } } --- 107,132 ---- /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @return The relative 3D coordinates ! * @param coords The window coordinates */ ! public double[] toCanvasCoords(double[] coords) { ! if (coords.length == 2) { ! double pixelwidth, pixelheight; ! if (aspect < 1) { ! pixelheight = height / (2 * size * getZoomFactor() * (1 / aspect)); ! pixelwidth = width / (2 * size * getZoomFactor()); ! } else { ! pixelheight = height / (2 * size * getZoomFactor()); ! pixelwidth = width / (2 * size * getZoomFactor() * aspect); ! } ! double returnx = 0; ! double returny = height / (2 * pixelheight) - coords[1] / pixelheight + center[1]; ! double returnz = coords[0] / pixelwidth + center[2] - width / (2 * pixelwidth); ! return new double[] {returnx, returny, returnz}; ! } else { ! log.warn("Too many arguments"); ! return new double[] {0.0, 0.0, 0.0}; } ! } } |
From: rimestad <rim...@us...> - 2005-07-22 11:27:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20763 Modified Files: GLView.java Log Message: Added methods for checking snap for grid, axis and vertexes along with creation of edges and surfaces Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GLView.java 18 Jul 2005 10:47:56 -0000 1.2 --- GLView.java 22 Jul 2005 11:25:57 -0000 1.3 *************** *** 7,14 **** package net.sourceforge.bprocessor.gl; import net.sourceforge.bprocessor.gui.GUI; ! import javax.swing.event.MouseInputListener; ! import net.java.games.jogl.GLCanvas; import net.java.games.jogl.GLCapabilities; --- 7,27 ---- package net.sourceforge.bprocessor.gl; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.gui.GUI; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.EdgeFacade; + import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.SurfaceFacade; + import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.VertexFacade; ! import java.util.EventListener; ! import java.util.HashSet; ! import java.util.Iterator; ! import java.util.Set; ! import java.awt.event.MouseListener; ! import java.awt.event.MouseMotionListener; ! import java.awt.event.MouseWheelListener; import net.java.games.jogl.GLCanvas; import net.java.games.jogl.GLCapabilities; *************** *** 24,44 **** private static Logger log = Logger.getLogger(GLView.class); ! /** GL canvas */ ! private GLCanvas glc; ! /** current event listener */ ! private AbstractViewListener currentListener; /** The 3D view mode */ ! public static final int MODE_3D = 0; /** The x z plane view */ ! public static final int MODE_XZ = 1; /** The x y plane view */ ! public static final int MODE_XY = 2; /** The y z plane view */ ! public static final int MODE_YZ = 3; /** --- 37,84 ---- private static Logger log = Logger.getLogger(GLView.class); ! /** 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 */ ! public static final double EPSILON = 0.4; /** The 3D view mode */ ! protected static final int MODE_3D = 0; /** The x z plane view */ ! protected static final int MODE_XZ = 1; /** The x y plane view */ ! protected static final int MODE_XY = 2; /** The y z plane view */ ! protected static final int MODE_YZ = 3; ! ! /** The 3D listener*/ ! private static AbstractViewListener view3D; ! ! /**The XY listener */ ! private static AbstractViewListener viewXY; ! ! /** The XZ listener */ ! private static AbstractViewListener viewXZ; ! ! /** The */ ! private static AbstractViewListener viewYZ; ! ! /** GL canvas */ ! private GLCanvas glc; ! ! /** current event listener */ ! private AbstractViewListener currentListener; ! ! /** The current Edge list */ ! private Set edges; /** *************** *** 52,60 **** glc.addGLEventListener(currentListener); ! MouseInputListener mil = new GLMouseListener(this); ! glc.addMouseListener(mil); ! glc.addMouseMotionListener(mil); glc.addKeyListener(new GLKeyListener(this)); GUI.getInstance().registerPanel(glc, GUI.SPLIT_MIDDLE); } --- 92,108 ---- glc.addGLEventListener(currentListener); ! view3D = new View3DListener(); ! viewXY = new ViewXYListener(); ! viewXZ = new ViewXZListener(); ! viewYZ = new ViewYZListener(); ! ! EventListener mil = new GLMouseListener(this); ! glc.addMouseListener((MouseListener)mil); ! glc.addMouseMotionListener((MouseMotionListener)mil); ! glc.addMouseWheelListener((MouseWheelListener)mil); glc.addKeyListener(new GLKeyListener(this)); + edges = new HashSet(); + GUI.getInstance().registerPanel(glc, GUI.SPLIT_MIDDLE); } *************** *** 68,78 **** if (mode == MODE_3D) { ! currentListener = new View3DListener(); } else if (mode == MODE_XZ) { ! currentListener = new ViewXZListener(); } else if (mode == MODE_XY) { ! currentListener = new ViewXYListener(); } else if (mode == MODE_YZ) { ! currentListener = new ViewYZListener(); } else { log.error("[changeView] mode non-existing"); --- 116,126 ---- if (mode == MODE_3D) { ! currentListener = view3D; } else if (mode == MODE_XZ) { ! currentListener = viewXZ; } else if (mode == MODE_XY) { ! currentListener = viewXY; } else if (mode == MODE_YZ) { ! currentListener = viewYZ; } else { log.error("[changeView] mode non-existing"); *************** *** 91,94 **** --- 139,347 ---- /** + * Add the last edge to the edgelist => surface + * @param coord The end coordinate + */ + protected void endSurface(double[] coord) { + Edge activeEdge = currentListener.getActiveEdge(); + Vertex to = vertexCollide(coord); + if (to != null) { + // we have to change excisting surface + removeVertex(activeEdge.getTo()); + activeEdge.setTo(to); + } else { + activeEdge.getTo().setX(coord[0]); + activeEdge.getTo().setY(coord[1]); + activeEdge.getTo().setZ(coord[2]); + } + Surface s = surface(); + s.setEdges(edges); + currentListener.setAlignVertex(null); + edges = new HashSet(); + currentListener.setActiveEdge(null); + } + + /** + * Add an edge to the parent edgelist + * @param coord The to point + */ + protected void addEdge(double[] coord) { + if (edges.isEmpty()) { + Edge activeEdge = edge(); + currentListener.setActiveEdge(activeEdge); + Vertex from = vertex(); + from.setX(coord[0]); + from.setY(coord[1]); + from.setZ(coord[2]); + activeEdge.setFrom(from); + Vertex to = vertex(); + to.setX(coord[0]); + to.setY(coord[1]); + to.setZ(coord[2]); + activeEdge.setTo(to); + edges.add(activeEdge); + currentListener.setAlignVertex(null); + } else { + if (vertexCollide(coord) == null) { + // we did not end an edgelist + Edge activeEdge = currentListener.getActiveEdge(); + Vertex from = activeEdge.getTo(); + activeEdge = edge(); + currentListener.setActiveEdge(activeEdge); + activeEdge.setFrom(from); + Vertex to = vertex(); + to.setX(coord[0]); + to.setY(coord[1]); + to.setZ(coord[2]); + activeEdge.setTo(to); + edges.add(activeEdge); + currentListener.setAlignVertex(null); + } else { + // we did end a edgelist + endSurface(coord); + } + } + } + + /** + * Change the to vertex coordinates for the active edge + * @param coord The new coordinate + */ + protected void changeTo(double[] coord) { + Edge activeEdge = currentListener.getActiveEdge(); + if (activeEdge != null && !edges.isEmpty()) { + activeEdge.getTo().setX(coord[0]); + activeEdge.getTo().setY(coord[1]); + activeEdge.getTo().setZ(coord[2]); + } + } + + /** + * Check if the current point is a vertex if so, it registers the vertex as + * snapVertex and alignVertex in the AbstractListener. + * @param coord the cordinate to check for snap (x, y, z) + */ + protected void checkVertexSnap(double[] coord) { + Vertex v = vertexCollide(coord); + if (v != null) { + currentListener.setAlignVertex(v); + currentListener.setSnapVertex(v); + } else { + removeVertexSnap(); + } + } + + /** + * Set the snapVertex variable to null + */ + protected void removeVertexSnap() { + currentListener.setSnapVertex(null); + } + + /** + * Check if this cordinate collide with another vertex + * @param coord The cordinate to check for collision at + * @return The excisting vertex at coord, null if there ain't any + */ + private 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]) && + currentListener.getActiveEdge() != null && + currentListener.getActiveEdge().getTo() != v && + currentListener.getActiveEdge().getFrom() != v) { + return v; + } + } + return null; + } + + /** + * Check if a and b is as close as EPSILON + * @param a The target + * @param b The value + * @return true if |a - b| < EPSILON false otherwise + */ + private boolean collide(double a, double b) { + return Math.abs(a - b) < EPSILON; + } + + /** + * Take a coordinate and check if it should snap to grid + * @param coords The coordinates to check for snapping + * @return the snapped coordinates + */ + public double[] snapToGrid(double[] coords) { + if (Math.abs(coords[0] - Math.round(coords[0])) < EPSILON) { + coords[0] = Math.round(coords[0]); + } + if (Math.abs(coords[1] - Math.round(coords[1])) < EPSILON) { + coords[1] = Math.round(coords[1]); + } + if (Math.abs(coords[2] - Math.round(coords[2])) < EPSILON) { + coords[2] = Math.round(coords[2]); + } + return coords; + } + + /** + * Make and register a new vertex + * @return The new Vertex + */ + private Vertex vertex() { + Vertex v = new Vertex("V" + vertexNum); + vertexNum++; + VertexFacade.getInstance().add(v); + + Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); + Notifier.getInstance().sendNotification(n); + + return v; + } + + /** + * Remove a vertex for good + * @param v Vertex to remove + */ + private void removeVertex(Vertex v) { + VertexFacade.getInstance().remove(v); + + Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); + Notifier.getInstance().sendNotification(n); + } + + /** + * Make and register a new edge + * @return The new Edge + */ + private Edge edge() { + Edge e = new Edge("E" + edgeNum); + edgeNum++; + EdgeFacade.getInstance().add(e); + + Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); + Notifier.getInstance().sendNotification(n); + + return e; + } + + /** + * Make and register a new Surface + * @return The new Surface + */ + private Surface surface() { + Surface s = new Surface("S" + surfaceNum); + surfaceNum++; + SurfaceFacade.getInstance().add(s); + + Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); + Notifier.getInstance().sendNotification(n); + return s; + } + + /** * Return the current used GLEventListener * @return The current GLEventListener |
From: rimestad <rim...@us...> - 2005-07-22 11:22:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20045 Modified Files: GLMouseListener.java Log Message: Added doubleclick response and a timer to let the mouse control zoom with button 2 and prepared for mousewheel control Index: GLMouseListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLMouseListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GLMouseListener.java 18 Jul 2005 10:45:38 -0000 1.2 --- GLMouseListener.java 22 Jul 2005 11:22:42 -0000 1.3 *************** *** 10,15 **** import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import javax.swing.Timer; ! import javax.swing.event.MouseInputListener; import org.apache.log4j.Logger; --- 10,20 ---- import java.awt.event.ActionListener; import java.awt.event.MouseEvent; + import java.awt.event.MouseWheelEvent; + import java.awt.event.MouseWheelListener; + import java.awt.event.MouseMotionListener; + import java.awt.event.MouseListener; + import javax.swing.Timer; ! import org.apache.log4j.Logger; *************** *** 18,28 **** * The mouse listener */ ! public class GLMouseListener implements MouseInputListener { /** The logger */ private static Logger log = Logger.getLogger(GLMouseListener.class); - /** The previous pressed button */ - private int prevButton; - /** The mouse position last time the mouse was pressed initializes to (0,0) */ private int[] pressPos = new int[2]; --- 23,30 ---- * The mouse listener */ ! public class GLMouseListener implements MouseListener, MouseMotionListener, MouseWheelListener { /** The logger */ private static Logger log = Logger.getLogger(GLMouseListener.class); /** The mouse position last time the mouse was pressed initializes to (0,0) */ private int[] pressPos = new int[2]; *************** *** 37,40 **** --- 39,48 ---- private GLView glv = null; + /** The zoom action listener */ + private ActionListener zoomAction; + + /** The move action listener */ + private ActionListener moveAction; + /** The carmera move timer */ private Timer timer; *************** *** 46,50 **** public GLMouseListener(GLView glv) { this.glv = glv; ! timer = new Timer(10, new CameraMove(this, glv)); } --- 54,68 ---- public GLMouseListener(GLView glv) { this.glv = glv; ! timer = new Timer(10, null); ! timer.start(); ! moveAction = new CameraMoveTimer(this, glv); ! zoomAction = new CameraZoomTimer(this, glv); ! } ! ! /** ! * Called when the mouse wheel is moved ! * @param e The MouseWheelEvent object ! */ ! public void mouseWheelMoved(MouseWheelEvent e) { } *************** *** 54,62 **** */ public void mouseDragged(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON1) { ! // ! } else if (e.getButton() == MouseEvent.BUTTON3) { ! this.dx = pressPos[0] - e.getX(); ! this.dy = pressPos[1] - e.getY(); } glv.repaint(); --- 72,80 ---- */ public void mouseDragged(MouseEvent e) { ! int x = e.getX(); ! int y = e.getY(); ! if (e.getButton() == MouseEvent.BUTTON3) { ! this.dx = x - pressPos[0]; ! this.dy = y - pressPos[1]; } glv.repaint(); *************** *** 68,72 **** --- 86,103 ---- */ public void mouseMoved(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + AbstractViewListener avl = glv.getEventListener(); + double[] coord = avl.toCanvasCoords(new double[] {x, y}); + + coord = glv.snapToGrid(coord); + // snap to vertexes + coord = avl.aligned(coord); + //check for snap point change + glv.checkVertexSnap(coord); + //change the activeEdge according to mouse position + glv.changeTo(coord); + glv.repaint(); } *************** *** 100,115 **** pressPos[0] = e.getX(); pressPos[1] = e.getY(); if (log.isDebugEnabled()) { ! log.debug("[mousePressed] " + currentButton); } ! if (currentButton == MouseEvent.BUTTON3) { ! this.dx = pressPos[0]; ! this.dy = pressPos[1]; ! timer.start(); } ! prevButton = currentButton; glv.repaint(); } ! /** * Invoked when a mouse button has been released on a component. --- 131,166 ---- pressPos[0] = e.getX(); pressPos[1] = e.getY(); + + AbstractViewListener avl = glv.getEventListener(); + double[] coords = avl.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); + // snap to grid + coords = glv.snapToGrid(coords); + // snap to vertex + coords = avl.aligned(coords); + if (log.isDebugEnabled()) { ! log.debug("[mousePressed] " + currentButton + ! "coords(" + coords[0] + ", " + coords[1] + ", " + coords[2] + ")"); } ! ! if (e.getClickCount() >= 2) { ! if (currentButton == MouseEvent.BUTTON1) { ! // double click on Button1 => surface end ! glv.endSurface(coords); ! } ! } else { ! // we did not double click ! if (currentButton == MouseEvent.BUTTON1) { ! glv.addEdge(coords); ! } else if (currentButton == MouseEvent.BUTTON2) { ! timer.addActionListener(zoomAction); ! } else if (currentButton == MouseEvent.BUTTON3) { ! timer.addActionListener(moveAction); ! } } ! glv.removeVertexSnap(); glv.repaint(); } ! /** * Invoked when a mouse button has been released on a component. *************** *** 118,158 **** public void mouseReleased(MouseEvent e) { int currentButton = e.getButton(); ! if (prevButton == MouseEvent.BUTTON1) { ! if (currentButton == MouseEvent.BUTTON1) { ! if (log.isDebugEnabled()) { ! log.debug("[mouseReleased] Button1 -> Button1"); ! } ! } else { ! if (log.isDebugEnabled()) { ! log.debug("[mouseReleased] Button1 -> other button"); ! } ! } ! } else if (prevButton == MouseEvent.BUTTON2) { ! if (currentButton == MouseEvent.BUTTON2) { ! if (log.isDebugEnabled()) { ! log.debug("[mouseReleased] Button2 -> Button2"); ! } ! } else { ! if (log.isDebugEnabled()) { ! log.debug("[mouseReleased] Button2 -> other button"); ! } ! } ! } else if (prevButton == MouseEvent.BUTTON3) { ! if (currentButton == MouseEvent.BUTTON3) { ! timer.stop(); ! this.dx = 0; ! this.dy = 0; ! if (log.isDebugEnabled()) { ! log.debug("[mouseReleased] Button3 -> Button3"); ! } ! } else { ! if (log.isDebugEnabled()) { ! log.debug("[mouseReleased] Button3 -> other button"); ! } ! } ! } else { ! log.warn("Case not handled no such button: " + prevButton); } - prevButton = currentButton; glv.repaint(); } --- 169,181 ---- 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; ! this.dy = 0; } glv.repaint(); } *************** *** 175,180 **** * Carama move timer class */ ! protected class CameraMove implements ActionListener { ! /** The calling mouselistener */ private GLMouseListener glml; --- 198,203 ---- * Carama move timer class */ ! private class CameraMoveTimer implements ActionListener { ! /** The calling mouselistener */ private GLMouseListener glml; *************** *** 187,191 **** * @param glv the GLView */ ! protected CameraMove(GLMouseListener glml, GLView glv) { this.glml = glml; this.glv = glv; --- 210,214 ---- * @param glv the GLView */ ! public CameraMoveTimer(GLMouseListener glml, GLView glv) { this.glml = glml; this.glv = glv; *************** *** 203,205 **** --- 226,263 ---- } } + + /** + * Camara zoom timer + */ + private class CameraZoomTimer implements ActionListener { + /** The calling mouselistener */ + private GLMouseListener glml; + + /** The current GLView */ + private GLView glv; + + /** + * The Constructor + * @param glml the mouselistener caller + * @param glv the GLView + */ + public CameraZoomTimer(GLMouseListener glml, GLView glv) { + this.glml = glml; + this.glv = glv; + } + + /** + * executed every time camaraMove is sceduled + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + AbstractViewListener avl = glv.getEventListener(); + if (glml.getdy() > 0) { + avl.zoom(0.9); + } else { + avl.zoom(1.0); + } + glv.repaint(); + } + } } |
From: rimestad <rim...@us...> - 2005-07-22 11:20:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19282 Modified Files: AbstractViewListener.java Log Message: Added the common functionality from the views and added drawing of the generated edges and surfaces Index: AbstractViewListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/AbstractViewListener.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractViewListener.java 18 Jul 2005 10:44:33 -0000 1.2 --- AbstractViewListener.java 22 Jul 2005 11:18:32 -0000 1.3 *************** *** 7,10 **** --- 7,18 ---- package net.sourceforge.bprocessor.gl; + 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 net.java.games.jogl.GL; import net.java.games.jogl.GLDrawable; *************** *** 20,23 **** --- 28,55 ---- private static Logger log = Logger.getLogger(AbstractViewListener.class); + /** the color of the x axis */ + public static final double[] X_AXIS_COLOR = new double[] {0.0, 1.0, 0.0}; + + /** the color of the y axis */ + public static final double[] Y_AXIS_COLOR = new double[] {1.0, 0.0, 0.0}; + + /** the color of the z axis */ + public static final double[] Z_AXIS_COLOR = new double[] {0.0, 0.0, 1.0}; + + /** the std line color*/ + public static final double[] STD_LINE_COLOR = new double[] {0.0, 0.0, 0.0}; + + /** Used for the actual drawing line */ + public static final double[] DRAW_COLOR = new double[] {1.0, 1.0, 0.0}; + + /** Used for the actual drawing line */ + public static final double[] GRID_COLOR = new double[] {0.85, 0.85, 0.85}; + + /** 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, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0}; + /** The width of the window */ protected static double width; *************** *** 32,41 **** protected static double size = 25.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, ! 0.0, 1.0, 0.0, 0.0, ! 0.0, 0.0, 1.0, 0.0, ! 0.0, 0.0, 0.0, 1.0}; /** * The initialization part of the 3D view --- 64,85 ---- protected static double size = 25.0; ! /** The Active edge */ ! protected static Edge activeEdge = null; ! ! /** The Snap vertex */ ! protected static Vertex snapVertex = null; ! ! /** For clever snapping */ ! protected static double[] alignPoint = null; + /** The alignment vertex */ + protected static Vertex alignVertex = null; + + /** The GL */ + protected GL gl = null; + + /** The zoomFactor in the parent view */ + protected double zoomFactor = 1.0; + /** * The initialization part of the 3D view *************** *** 46,50 **** log.debug("[init]"); } ! GL gl = gld.getGL(); this.width = gld.getSize().getWidth(); --- 90,94 ---- log.debug("[init]"); } ! gl = gld.getGL(); this.width = gld.getSize().getWidth(); *************** *** 56,59 **** --- 100,123 ---- gl.glViewport(0, 0, (int)width, (int)height); } + + /** + * The function responsible for drawing at each update + * @param gld The GLDrawable object + */ + public void display(GLDrawable gld) { + gl = gld.getGL(); + + gl.glClear(GL.GL_COLOR_BUFFER_BIT); + gl.glViewport(0, 0, (int)width, (int)height); + + camera(gld); + + grid(); + coords(); + gl.glColor3dv(STD_LINE_COLOR); + gl.glLineWidth(1.0f); + drawAll(); + gl.glFlush(); + } /** *************** *** 85,88 **** --- 149,268 ---- } + /** + * Draw all the existing elements + */ + protected void drawAll() { + Set edges = EdgeFacade.getInstance().findAll(); + Iterator it = edges.iterator(); + gl.glColor3dv(STD_LINE_COLOR); + while (it.hasNext()) { + Edge e = (Edge)it.next(); + drawEdge(e); + } + + // draw activeEdge different if it is parallel with axis + if (activeEdge != null) { + Vertex to = activeEdge.getTo(); + Vertex from = activeEdge.getFrom(); + if (from.getY() == to.getY() && from.getZ() == to.getZ()) { + gl.glColor3dv(X_AXIS_COLOR); + } else if (from.getX() == to.getX() && from.getZ() == to.getZ()) { + gl.glColor3dv(Y_AXIS_COLOR); + } else if (from.getX() == to.getX() && from.getY() == to.getY()) { + gl.glColor3dv(Z_AXIS_COLOR); + } else { + gl.glColor3dv(STD_LINE_COLOR); + } + gl.glBegin(GL.GL_LINES); + gl.glVertex3d(from.getX(), from.getY(), from.getZ()); + gl.glVertex3d(to.getX(), to.getY(), to.getZ()); + gl.glEnd(); + } + + // draw alignment line + if (alignPoint != null && alignVertex != null) { + if (alignPoint[1] == alignVertex.getY() && alignPoint[2] == alignVertex.getZ()) { + gl.glColor3dv(X_AXIS_COLOR); + } else if (alignPoint[0] == alignVertex.getX() && alignPoint[2] == alignVertex.getZ()) { + gl.glColor3dv(Y_AXIS_COLOR); + } else if (alignPoint[0] == alignVertex.getX() && alignPoint[1] == alignVertex.getY()) { + gl.glColor3dv(Z_AXIS_COLOR); + } else { + gl.glColor3dv(DRAW_COLOR); + } + gl.glBegin(GL.GL_LINES); + gl.glVertex3d(alignPoint[0], alignPoint[1], alignPoint[2]); + gl.glVertex3d(alignVertex.getX(), alignVertex.getY(), alignVertex.getZ()); + gl.glEnd(); + } + + // draw snap point if any + if (snapVertex != null) { + gl.glColor3d(0.0, 1.0, 0.0); + gl.glPointSize(5.0f); + gl.glBegin(GL.GL_POINTS); + gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); + gl.glEnd(); + gl.glPointSize(1.0f); + } + } + + /** + * Draw a surface + * @param s The surface to draw + */ + private void drawSurface(Surface s) { + Set edges = s.getEdges(); + Iterator it = edges.iterator(); + while (it.hasNext()) { + Edge e = (Edge)it.next(); + drawEdge(e); + } + } + + /** + * Draw an Edge + * @param e The Edge to draw + */ + private void drawEdge(Edge e) { + Vertex to = e.getTo(); + Vertex from = e.getFrom(); + if (to != null && from != null) { + gl.glBegin(GL.GL_LINES); + gl.glVertex3d(to.getX(), to.getY(), to.getZ()); + gl.glVertex3d(from.getX(), from.getY(), from.getZ()); + gl.glEnd(); + } + } + + /** + * Check if v is aligned horizontally or vertically with alignVertex + * @param coord The coordinate to check for alignment with + * @return The alignmentpoint, if there ain't any the original point is returned + */ + protected double[] aligned(double[] coord) { + double[] res = new double[] {coord[0], coord[1], coord[2]}; + if (alignVertex != null) { + if (Math.abs(coord[0] - alignVertex.getX()) < GLView.EPSILON) { + res[0] = alignVertex.getX(); + } + if (Math.abs(coord[1] - alignVertex.getY()) < GLView.EPSILON) { + res[1] = alignVertex.getY(); + } + if (Math.abs(coord[2] - alignVertex.getZ()) < GLView.EPSILON) { + res[2] = alignVertex.getZ(); + } + if (res[0] != coord[0] && res[1] != coord[1] && res[2] != coord[2]) { + alignPoint = null; + return coord; + } else { + alignPoint = res; + return res; + } + } + alignPoint = null; + return coord; + } + /** * Overwrite the view matrix *************** *** 122,126 **** } - /** * Change the zoom factor of the camera take only R+ --- 302,305 ---- *************** *** 128,138 **** * @param zoom the zoom factor change */ ! public abstract void zoom(double zoom); /** ! * The drawing function * @param gld The GLDrawable object */ ! public abstract void display(GLDrawable gld); /** --- 307,396 ---- * @param zoom the zoom factor change */ ! public void zoom(double zoom) { ! if (zoom > 0) { ! zoom *= getZoomFactor(); ! setZoomFactor(zoom); ! } ! } /** ! * setter for zoomFactor ! * @param z The new zoomFactor ! */ ! public void setZoomFactor(double z) { ! zoomFactor = z; ! } ! ! /** ! * getter for zoomFactor ! * @return The parent zoomFactor ! */ ! public double getZoomFactor() { ! return zoomFactor; ! } ! ! /** ! * Getter for activeEdge ! * @return activeEdge ! */ ! public Edge getActiveEdge() { ! return activeEdge; ! } ! ! /** ! * Set activeEdge ! * @param e The activeEdge ! */ ! public void setActiveEdge(Edge e) { ! activeEdge = e; ! } ! ! /** ! * Getter for snapVertex ! * @return snapVertex ! */ ! public Vertex getSnapVertex() { ! return snapVertex; ! } ! ! /** ! * Setter for snapVertex ! * @param v The new snapVertex ! */ ! public void setSnapVertex(Vertex v) { ! snapVertex = v; ! } ! ! /** ! * Getter for alignVertex ! * @return alignVertex ! */ ! public Vertex getAlignVertex() { ! return alignVertex; ! } ! ! /** ! * Setter for alignVertex ! * @param v The new alignVertex ! */ ! public void setAlignVertex(Vertex v) { ! alignVertex = v; ! } ! ! /** ! * The camera init function * @param gld The GLDrawable object */ ! public abstract void camera(GLDrawable gld); ! ! /** ! * The drawing of cordinatesystem ! */ ! protected abstract void coords(); ! ! /** ! * The drawing of grid ! */ ! protected abstract void grid(); /** *************** *** 141,143 **** --- 399,408 ---- */ public abstract void translateCenter(double [] mv); + + /** + * Return the 3D coordinates for the canvas matching the given 2D coords + * @return The relative 3D coordinates + * @param coords The window coordinates + */ + public abstract double[] toCanvasCoords(double[] coords); } |
From: rimestad <rim...@us...> - 2005-07-18 10:48:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1389 Modified Files: GLView.java Log Message: added repaint method and mouse listeners Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GLView.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- GLView.java 18 Jul 2005 10:47:56 -0000 1.2 *************** *** 9,16 **** import net.sourceforge.bprocessor.gui.GUI; import net.java.games.jogl.GLCanvas; import net.java.games.jogl.GLCapabilities; import net.java.games.jogl.GLDrawableFactory; - import net.java.games.jogl.GLEventListener; import org.apache.log4j.Logger; --- 9,17 ---- import net.sourceforge.bprocessor.gui.GUI; + import javax.swing.event.MouseInputListener; + import net.java.games.jogl.GLCanvas; import net.java.games.jogl.GLCapabilities; import net.java.games.jogl.GLDrawableFactory; import org.apache.log4j.Logger; *************** *** 27,31 **** /** current event listener */ ! private GLEventListener currentListener; /** The 3D view mode */ --- 28,32 ---- /** current event listener */ ! private AbstractViewListener currentListener; /** The 3D view mode */ *************** *** 51,55 **** glc.addGLEventListener(currentListener); ! glc.addMouseListener(new GLMouseListener(glc)); glc.addKeyListener(new GLKeyListener(this)); --- 52,58 ---- glc.addGLEventListener(currentListener); ! MouseInputListener mil = new GLMouseListener(this); ! glc.addMouseListener(mil); ! glc.addMouseMotionListener(mil); glc.addKeyListener(new GLKeyListener(this)); *************** *** 76,81 **** --- 79,99 ---- } glc.addGLEventListener(currentListener); + this.repaint(); + } + + /** + * Repaint the canvas + */ + public void repaint() { glc.getGL().glFlush(); glc.repaint(); } + + /** + * Return the current used GLEventListener + * @return The current GLEventListener + */ + public AbstractViewListener getEventListener() { + return currentListener; + } } |
From: rimestad <rim...@us...> - 2005-07-18 10:46:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1161 Modified Files: GLKeyListener.java Log Message: Added reaction for movement and zoom buttons Index: GLKeyListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLKeyListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GLKeyListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- GLKeyListener.java 18 Jul 2005 10:46:38 -0000 1.2 *************** *** 35,38 **** --- 35,53 ---- */ public void keyPressed(KeyEvent e) { + AbstractViewListener avl = glv.getEventListener(); + if (e.getKeyCode() == KeyEvent.VK_UP) { + avl.translateCenter(new double[] {0.0, 1.0, 0.0}); + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + avl.translateCenter(new double[] {0.0, -1.0, 0.0}); + } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + avl.translateCenter(new double[] {-1.0, 0.0, 0.0}); + } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + avl.translateCenter(new double[] {1.0, 0.0, 0.0}); + } else if (e.getKeyChar() == KeyEvent.VK_COMMA) { + avl.zoom(1.1); + } else if (e.getKeyChar() == KeyEvent.VK_PERIOD) { + avl.zoom(0.9); + } + glv.repaint(); } *************** *** 42,52 **** */ public void keyReleased(KeyEvent e) { - } - - /** - * Invoked when a key has been typed. - * @param e The KeyEvent - */ - public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_1) { glv.changeView(GLView.MODE_3D); --- 57,60 ---- *************** *** 57,61 **** } else if (e.getKeyChar() == KeyEvent.VK_4) { glv.changeView(GLView.MODE_YZ); ! } } } --- 65,76 ---- } else if (e.getKeyChar() == KeyEvent.VK_4) { glv.changeView(GLView.MODE_YZ); ! } ! } ! ! /** ! * Invoked when a key has been typed. ! * @param e The KeyEvent ! */ ! public void keyTyped(KeyEvent e) { } } |
From: rimestad <rim...@us...> - 2005-07-18 10:45:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv982 Modified Files: GLMouseListener.java Log Message: added reaction on mouse drag and movement Index: GLMouseListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLMouseListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GLMouseListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- GLMouseListener.java 18 Jul 2005 10:45:38 -0000 1.2 *************** *** 7,14 **** package net.sourceforge.bprocessor.gl; import java.awt.event.MouseEvent; ! import java.awt.event.MouseListener; ! ! import net.java.games.jogl.GLCanvas; import org.apache.log4j.Logger; --- 7,15 ---- package net.sourceforge.bprocessor.gl; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; import java.awt.event.MouseEvent; ! import javax.swing.Timer; ! import javax.swing.event.MouseInputListener; import org.apache.log4j.Logger; *************** *** 17,21 **** * The mouse listener */ ! public class GLMouseListener implements MouseListener { /** The logger */ private static Logger log = Logger.getLogger(GLMouseListener.class); --- 18,22 ---- * The mouse listener */ ! public class GLMouseListener implements MouseInputListener { /** The logger */ private static Logger log = Logger.getLogger(GLMouseListener.class); *************** *** 24,36 **** private int prevButton; ! /** The 3D canvas*/ ! private GLCanvas glc = null; /** * Constructor ! * @param glc the GL canvas */ ! public GLMouseListener(GLCanvas glc) { ! this.glc = glc; } --- 25,72 ---- private int prevButton; ! /** The mouse position last time the mouse was pressed initializes to (0,0) */ ! private int[] pressPos = new int[2]; ! ! /** The mouse movement in x axis since press */ ! private int dx = 0; ! ! /** The mouse movement in y axis since press */ ! private int dy = 0; ! ! /** The GLView obejct*/ ! private GLView glv = null; ! ! /** The carmera move timer */ ! private Timer timer; /** * Constructor ! * @param glv the GL canvas */ ! public GLMouseListener(GLView glv) { ! this.glv = glv; ! timer = new Timer(10, new CameraMove(this, glv)); ! } ! ! /** ! * Invoked when a mouse button is held down while moving the mouse ! * @param e The MouseEvent object ! */ ! public void mouseDragged(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON1) { ! // ! } else if (e.getButton() == MouseEvent.BUTTON3) { ! this.dx = pressPos[0] - e.getX(); ! this.dy = pressPos[1] - e.getY(); ! } ! glv.repaint(); ! } ! ! /** ! * Invoked when the mouse cursor has been moved ! * @param e The MouseEvent object ! */ ! public void mouseMoved(MouseEvent e) { ! } *************** *** 62,70 **** public void mousePressed(MouseEvent e) { int currentButton = e.getButton(); if (log.isDebugEnabled()) { log.debug("[mousePressed] " + currentButton); } prevButton = currentButton; ! glc.repaint(); } --- 98,113 ---- public void mousePressed(MouseEvent e) { int currentButton = e.getButton(); + pressPos[0] = e.getX(); + pressPos[1] = e.getY(); if (log.isDebugEnabled()) { log.debug("[mousePressed] " + currentButton); } + if (currentButton == MouseEvent.BUTTON3) { + this.dx = pressPos[0]; + this.dy = pressPos[1]; + timer.start(); + } prevButton = currentButton; ! glv.repaint(); } *************** *** 97,100 **** --- 140,146 ---- } else if (prevButton == MouseEvent.BUTTON3) { if (currentButton == MouseEvent.BUTTON3) { + timer.stop(); + this.dx = 0; + this.dy = 0; if (log.isDebugEnabled()) { log.debug("[mouseReleased] Button3 -> Button3"); *************** *** 109,113 **** } prevButton = currentButton; ! glc.repaint(); } } --- 155,205 ---- } prevButton = currentButton; ! glv.repaint(); ! } ! ! /** ! * @return The x distance the mouse has moved since press ! */ ! protected int getdx() { ! return dx; ! } ! ! /** ! * @return The y distance the mouse has moved since press ! */ ! protected int getdy() { ! return dy; ! } ! ! /** ! * Carama move timer class ! */ ! protected class CameraMove implements ActionListener { ! /** The calling mouselistener */ ! private GLMouseListener glml; ! ! /** The current GLView */ ! private GLView glv; ! ! /** ! * The Constructor ! * @param glml the mouselistener caller ! * @param glv the GLView ! */ ! protected CameraMove(GLMouseListener glml, GLView glv) { ! this.glml = glml; ! this.glv = glv; ! } ! ! /** ! * executed every time camaraMove is sceduled ! * @param e The ActionEvent ! */ ! public void actionPerformed(ActionEvent e) { ! AbstractViewListener avl = glv.getEventListener(); ! avl.translateRotationX(glml.getdy()); ! avl.translateRotationY(glml.getdx()); ! glv.repaint(); ! } } } |
From: rimestad <rim...@us...> - 2005-07-18 10:44:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv671 Modified Files: AbstractViewListener.java Log Message: Added default methods for movement and rotation Index: AbstractViewListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/AbstractViewListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AbstractViewListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- AbstractViewListener.java 18 Jul 2005 10:44:33 -0000 1.2 *************** *** 32,35 **** --- 32,41 ---- protected static double size = 25.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, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0}; + /** * The initialization part of the 3D view *************** *** 80,86 **** --- 86,143 ---- /** + * Overwrite the view matrix + * @param m The new ViewMatrix + */ + public void setViewMatrix(double[] m) { + this.viewTrans = m; + } + + /** + * Thanslate the view matrix center not relatively + * mv[0] is along x, mv[1] along y and mv[2] is along z + * @param mv the move vector + */ + public void translateViewMatrix(double [] mv) { + if (mv.length == 3) { + this.viewTrans[12] += mv[0]; + this.viewTrans[13] += mv[1]; + this.viewTrans[14] += mv[2]; + } else { + log.error("[translateViewMatrix] Wrong parameter size"); + } + } + + /** + * Change the rotation about the x axis. Only usable in 3D + * @param change The change in R+ (is divided with the window height) + */ + public void translateRotationX(double change) { + } + + /** + * Change the rotation about the y axis. Only usable in 3D + * @param change The change in R+ (is divided with the window height) + */ + public void translateRotationY(double change) { + } + + + /** + * Change the zoom factor of the camera take only R+ + * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom + * @param zoom the zoom factor change + */ + public abstract void zoom(double zoom); + + /** * The drawing function * @param gld The GLDrawable object */ public abstract void display(GLDrawable gld); + + /** + * Move the center left/right, up/down, forward/backward + * @param mv the move vector + */ + public abstract void translateCenter(double [] mv); } |
From: rimestad <rim...@us...> - 2005-07-18 10:36:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31744 Modified Files: ViewYZListener.java Log Message: Added zoom and move Index: ViewYZListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/ViewYZListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ViewYZListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- ViewYZListener.java 18 Jul 2005 10:36:34 -0000 1.2 *************** *** 20,23 **** --- 20,29 ---- private static Logger log = Logger.getLogger(ViewYZListener.class); + /** The relative center of the view */ + private static double[] center = new double[] {0.0, 0.0, 0.0}; + + /** The zoom factor for the camera */ + private static double zoomFactor = 1.0; + /** * The drawing function *************** *** 34,43 **** gl.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glLoadIdentity(); - glu.gluLookAt(-10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); - gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); if (width <= height) { gl.glOrtho(-size, size, --- 40,46 ---- gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); + double size = this.size * this.zoomFactor; if (width <= height) { gl.glOrtho(-size, size, *************** *** 50,59 **** } grid(gl); coords(gl); ! gl.glColor3f(1.0f, 1.0f, 1.0f); gl.glLineWidth(1.0f); gl.glFlush(); } /** --- 53,80 ---- } + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glLoadIdentity(); + glu.gluLookAt(-10.0, center[1], center[2], center[0], center[1], center[2], 0.0, 1.0, 0.0); + grid(gl); coords(gl); ! gl.glColor3d(1.0, 1.0, 1.0); gl.glLineWidth(1.0f); gl.glFlush(); } + + /** + * Move the center left/right, up/down, left/right + * @param mv the move vector + */ + public void translateCenter(double [] mv) { + if (mv.length == 3) { + this.center[0] += mv[2]; + this.center[1] += mv[1]; + this.center[2] += mv[0]; + } else { + log.error("[translateViewMatrix] Wrong parameter size"); + } + } /** *************** *** 62,65 **** --- 83,92 ---- */ private void grid(GL gl) { + double size; + if (aspect > 1) { + size = this.size * zoomFactor * aspect; + } else { + size = this.size * zoomFactor / aspect; + } gl.glLineWidth(1.0f); gl.glColor3f(0.85f, 0.85f, 0.85f); *************** *** 91,93 **** --- 118,131 ---- gl.glEnd(); } + + /** + * Change the zoom factor of the camera take only R+ + * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom + * @param zoom the zoom factor change + */ + public void zoom(double zoom) { + if (zoomFactor > 0) { + this.zoomFactor *= zoom; + } + } } |
From: rimestad <rim...@us...> - 2005-07-18 10:35:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31649 Modified Files: View3DListener.java Log Message: Added zoom, move and rotation Index: View3DListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/View3DListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** View3DListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- View3DListener.java 18 Jul 2005 10:35:36 -0000 1.2 *************** *** 20,23 **** --- 20,35 ---- private static Logger log = Logger.getLogger(View3DListener.class); + /** The relative center of the view */ + private static double[] center = new double[] {0.0, 0.0, 0.0}; + + /** The rotaion about the X axis */ + private static double rotationX = 0; + + /** The rotation about the Y axis */ + private static double rotationY = -30; + + /** The zoom factor for the camera */ + private static double zoomFactor = 1.0; + /** * The drawing function *************** *** 35,55 **** gl.glShadeModel(GL.GL_FLAT); - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glLoadIdentity(); - glu.gluLookAt(14.0f, 11.0f, 25.0f, - 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); - double aspect = width / height; if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0, 1.0, 0.0, 50.0); } else { ! // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(60.0, aspect, 0.0, 50.0); } grid(gl); coords(gl); --- 47,69 ---- gl.glShadeModel(GL.GL_FLAT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); double aspect = width / height; if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0 * zoomFactor, 1.0, 0.0, 50.0); } else { ! glu.gluPerspective(60.0 * zoomFactor, aspect, 0.0, 50.0); } + + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glLoadIdentity(); + glu.gluLookAt(0.0, 15.0, 20.0, + center[0], center[1], center[2], + 0.0, 1.0, 0.0); + gl.glRotated(rotationX, 1.0, 0.0, 0.0); + gl.glRotated(rotationY, 0.0, 1.0, 0.0); + gl.glMultMatrixd(viewTrans); grid(gl); coords(gl); *************** *** 60,63 **** --- 74,107 ---- /** + * Move the center left/right, up/down, forward/backward + * @param mv the move vector + */ + public void translateCenter(double [] mv) { + if (mv.length == 3) { + this.viewTrans[12] -= mv[0]; + this.viewTrans[13] += mv[2]; + this.viewTrans[14] += mv[1]; + } else { + log.error("[translateViewMatrix] Wrong parameter size"); + } + } + + /** + * Change the rotation about the x axis + * @param change The change in R+ (is divided with the window height) + */ + public void translateRotationX(double change) { + rotationX += change / height; + } + + /** + * Change the rotation about the y axis + * @param change The change in R+ (is divided with the window height) + */ + public void translateRotationY(double change) { + rotationY += change / width; + } + + /** * Draw a grid * @param gl The Graphic Layer *************** *** 67,77 **** gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); ! for (int x = -25; x <= 25; x++) { ! gl.glVertex3d((double) x, 0.0, -15.0); ! gl.glVertex3d((double) x, 0.0, 15.0); } ! for (int z = -15; z <= 15; z++) { ! gl.glVertex3d(-25.0, 0.0, (double) z); ! gl.glVertex3d(25.0, 0.0, (double) z); } gl.glEnd(); --- 111,127 ---- gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); ! double size = this.size / 2 * zoomFactor; ! if (aspect > 1) { ! size *= aspect; ! } else { ! size /= aspect; } ! for (int x = -(int)size; x <= (int)size; x++) { ! gl.glVertex3d((double) x, 0.0, -size); ! gl.glVertex3d((double) x, 0.0, size); ! } ! for (int z = -(int)size; z <= (int)size; z++) { ! gl.glVertex3d(-size, 0.0, (double) z); ! gl.glVertex3d(size, 0.0, (double) z); } gl.glEnd(); *************** *** 96,98 **** --- 146,159 ---- gl.glEnd(); } + + /** + * Change the zoom factor of the camera take only R+ + * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom + * @param zoom the zoom factor change + */ + public void zoom(double zoom) { + if (zoomFactor > 0) { + this.zoomFactor *= zoom; + } + } } |
From: rimestad <rim...@us...> - 2005-07-18 10:34:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31474 Modified Files: ViewXYListener.java ViewXZListener.java Log Message: added zoom and move Index: ViewXZListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/ViewXZListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ViewXZListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- ViewXZListener.java 18 Jul 2005 10:34:42 -0000 1.2 *************** *** 20,23 **** --- 20,29 ---- private static Logger log = Logger.getLogger(ViewXZListener.class); + /** The relative center of the view */ + private static double[] center = new double[] {0.0, 0.0, 0.0}; + + /** The zoom factor for the camera */ + private static double zoomFactor = 1.0; + /** * The drawing function *************** *** 34,45 **** gl.glClear(GL.GL_COLOR_BUFFER_BIT); - // MatrixMode have to be MODELVIEW for positioning - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glLoadIdentity(); - glu.gluLookAt(0.0f, -10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); - // Matrix mode have to be projection for perspecive gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); if (width <= height) { gl.glOrtho(-size, size, --- 40,47 ---- gl.glClear(GL.GL_COLOR_BUFFER_BIT); // Matrix mode have to be projection for perspecive gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); + double size = this.size * this.zoomFactor; if (width <= height) { gl.glOrtho(-size, size, *************** *** 52,61 **** } grid(gl); coords(gl); ! gl.glColor3f(1.0f, 1.0f, 1.0f); gl.glLineWidth(1.0f); gl.glFlush(); } /** --- 54,82 ---- } + // MatrixMode have to be MODELVIEW for positioning + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glLoadIdentity(); + glu.gluLookAt(center[0], -10.0, center[2], center[0], center[1], center[2], 0.0, 0.0, 1.0); + grid(gl); coords(gl); ! gl.glColor3d(1.0, 1.0, 1.0); gl.glLineWidth(1.0f); gl.glFlush(); } + + /** + * Move the center left/right, up/down, left/right + * @param mv the move vector + */ + public void translateCenter(double [] mv) { + if (mv.length == 3) { + this.center[0] += mv[0]; + this.center[1] += mv[2]; + this.center[2] += mv[1]; + } else { + log.error("[translateViewMatrix] Wrong parameter size"); + } + } /** *************** *** 67,70 **** --- 88,97 ---- gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); + double size; + if (aspect > 1) { + size = this.size * zoomFactor * aspect; + } else { + size = this.size * zoomFactor / aspect; + } for (int x = -(int)size; x <= (int)size; x++) { gl.glVertex3d((double) x, 0.0, -size); *************** *** 93,95 **** --- 120,133 ---- gl.glEnd(); } + + /** + * Change the zoom factor of the camera take only R+ + * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom + * @param zoom the zoom factor change + */ + public void zoom(double zoom) { + if (zoomFactor > 0) { + this.zoomFactor *= zoom; + } + } } Index: ViewXYListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/ViewXYListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ViewXYListener.java 14 Jul 2005 09:49:59 -0000 1.1.1.1 --- ViewXYListener.java 18 Jul 2005 10:34:42 -0000 1.2 *************** *** 20,23 **** --- 20,29 ---- private static Logger log = Logger.getLogger(ViewXYListener.class); + /** The relative center of the view */ + private static double[] center = new double[] {0.0, 0.0, 0.0}; + + /** The zoom factor for the camera */ + private static double zoomFactor = 1.0; + /** * The drawing function *************** *** 34,43 **** gl.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glLoadIdentity(); - glu.gluLookAt(0.0f, 0.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); - gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); if (width <= height) { gl.glOrtho(-size, size, --- 40,46 ---- gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); + double size = this.size * this.zoomFactor; if (width <= height) { gl.glOrtho(-size, size, *************** *** 49,59 **** -25.0, 25.0); } grid(gl); coords(gl); ! gl.glColor3f(1.0f, 1.0f, 1.0f); gl.glLineWidth(1.0f); gl.glFlush(); } /** --- 52,79 ---- -25.0, 25.0); } + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glLoadIdentity(); + glu.gluLookAt(center[0], center[1], 10.0, center[0], center[1], center[2], 0.0, 1.0, 0.0); grid(gl); coords(gl); ! gl.glColor3d(1.0, 1.0, 1.0); gl.glLineWidth(1.0f); gl.glFlush(); } + + /** + * Move the center left/right, up/down, left/right + * @param mv the move vector + */ + public void translateCenter(double [] mv) { + if (mv.length == 3) { + this.center[0] += mv[0]; + this.center[1] += mv[1]; + this.center[2] += mv[2]; + } else { + log.error("[translateViewMatrix] Wrong parameter size"); + } + } /** *************** *** 65,68 **** --- 85,94 ---- gl.glColor3f(0.85f, 0.85f, 0.85f); gl.glBegin(GL.GL_LINES); + double size; + if (aspect > 1) { + size = this.size * zoomFactor * aspect; + } else { + size = this.size * zoomFactor / aspect; + } for (int x = -(int)size; x <= (int)size; x++) { gl.glVertex3d((double) x, -size, 0.0); *************** *** 91,93 **** --- 117,130 ---- gl.glEnd(); } + + /** + * Change the zoom factor of the camera take only R+ + * 1-oo is increase zoom and 0-1 decrease 1 keep the current zoom + * @param zoom the zoom factor change + */ + public void zoom(double zoom) { + if (zoomFactor > 0) { + this.zoomFactor *= zoom; + } + } } |
From: Jesper P. <je...@us...> - 2005-07-18 09:28:24
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18476 Modified Files: GUI.java Log Message: Added XML import/export Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GUI.java 11 Jul 2005 08:41:23 -0000 1.4 --- GUI.java 18 Jul 2005 09:28:13 -0000 1.5 *************** *** 14,17 **** --- 14,19 ---- import net.sourceforge.bprocessor.gui.actions.CreateSurfaceActionListener; import net.sourceforge.bprocessor.gui.actions.FileExitActionListener; + import net.sourceforge.bprocessor.gui.actions.FileExportActionListener; + import net.sourceforge.bprocessor.gui.actions.FileImportActionListener; import net.sourceforge.bprocessor.gui.actions.ToolsDetachActionListener; import net.sourceforge.bprocessor.gui.actions.ToolsJoinActionListener; *************** *** 97,114 **** file.addSeparator(); ! JMenuItem fileOpen = new JMenuItem("Open"); ! fileOpen.setMnemonic(KeyEvent.VK_O); ! fileOpen.setEnabled(false); ! file.add(fileOpen); ! ! JMenuItem fileSave = new JMenuItem("Save"); ! fileSave.setMnemonic(KeyEvent.VK_S); ! fileSave.setEnabled(false); ! file.add(fileSave); ! JMenuItem fileSaveAs = new JMenuItem("Save as..."); ! fileSaveAs.setMnemonic(KeyEvent.VK_A); ! fileSaveAs.setEnabled(false); ! file.add(fileSaveAs); file.addSeparator(); --- 99,111 ---- file.addSeparator(); ! JMenuItem fileImport = new JMenuItem("Import"); ! fileImport.addActionListener(new FileImportActionListener()); ! fileImport.setMnemonic(KeyEvent.VK_I); ! file.add(fileImport); ! JMenuItem fileExport = new JMenuItem("Export"); ! fileExport.addActionListener(new FileExportActionListener()); ! fileExport.setMnemonic(KeyEvent.VK_E); ! file.add(fileExport); file.addSeparator(); |
From: Jesper P. <je...@us...> - 2005-07-18 09:28:01
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18423 Modified Files: CreateConstructorActionListener.java Log Message: Change constructor with surface Index: CreateConstructorActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreateConstructorActionListener.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CreateConstructorActionListener.java 27 Jun 2005 09:32:23 -0000 1.1.1.1 --- CreateConstructorActionListener.java 18 Jul 2005 09:27:51 -0000 1.2 *************** *** 8,13 **** import net.sourceforge.bprocessor.gui.GUI; ! import net.sourceforge.bprocessor.model.Constructor; ! import net.sourceforge.bprocessor.model.ConstructorFacade; import java.awt.event.ActionEvent; --- 8,13 ---- import net.sourceforge.bprocessor.gui.GUI; ! import net.sourceforge.bprocessor.model.Surface; ! import net.sourceforge.bprocessor.model.SurfaceFacade; import java.awt.event.ActionEvent; *************** *** 44,51 **** if (result != null && !result.trim().equals("")) { ! ConstructorFacade cf = ConstructorFacade.getInstance(); ! Constructor c = new Constructor(result.trim()); ! cf.add(c); } } --- 44,52 ---- if (result != null && !result.trim().equals("")) { ! SurfaceFacade sf = SurfaceFacade.getInstance(); ! Surface s = new Surface(result.trim()); ! s.setConstructor(true); ! sf.add(s); } } |
From: Jesper P. <je...@us...> - 2005-07-18 09:27:30
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18317 Added Files: FileImportActionListener.java FileExportActionListener.java Log Message: Initial import --- NEW FILE: FileExportActionListener.java --- //--------------------------------------------------------------------------------- // $Id: FileExportActionListener.java,v 1.1 2005/07/18 09:27:22 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import net.sourceforge.bprocessor.model.xml.PersistenceManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JFileChooser; import org.apache.log4j.Logger; /** * The file->export action listener */ public class FileExportActionListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(FileExportActionListener.class); /** * FileExportActionListener */ public FileExportActionListener() { } /** * Action performed * @param e The action event */ public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); int state = chooser.showSaveDialog(null); File file = chooser.getSelectedFile(); if (file != null && state == JFileChooser.APPROVE_OPTION) { try { PersistenceManager.save(file); } catch (Exception ex) { log.error("Could not export to file: " + file, ex); } } } } --- NEW FILE: FileImportActionListener.java --- //--------------------------------------------------------------------------------- // $Id: FileImportActionListener.java,v 1.1 2005/07/18 09:27:22 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import net.sourceforge.bprocessor.model.xml.PersistenceManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JFileChooser; import org.apache.log4j.Logger; /** * The file->import action listener */ public class FileImportActionListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(FileImportActionListener.class); /** * FileImportActionListener */ public FileImportActionListener() { } /** * Action performed * @param e The action event */ public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); int state = chooser.showOpenDialog(null); File file = chooser.getSelectedFile(); if (file != null && state == JFileChooser.APPROVE_OPTION) { try { PersistenceManager.load(file); } catch (Exception ex) { log.error("Could not import file: " + file, ex); } } } } |
From: Jesper P. <je...@us...> - 2005-07-18 09:26:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18068 Added Files: PersistenceManager.java package.html Log Message: Initial import --- NEW FILE: package.html --- <body> This package contains classes that are able to load and save the BProcessor model as XML </body> --- NEW FILE: PersistenceManager.java --- //--------------------------------------------------------------------------------- // $Id: PersistenceManager.java,v 1.1 2005/07/18 09:25:56 jews Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model.xml; import net.sourceforge.bprocessor.kernel.notification.Notification; import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.EdgeFacade; import net.sourceforge.bprocessor.model.ElementFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.FunctionalSpaceFacade; import net.sourceforge.bprocessor.model.PartFacade; import net.sourceforge.bprocessor.model.SurfaceFacade; [...1176 lines suppressed...] return vx; } } return null; } /** * Save the document to an output stream * @param document The Bprocessor document * @param stream The output stream * @exception Exception Thrown if an error occurs */ private static void saveFile(Bprocessor document, OutputStream stream) throws Exception { JAXBContext jc = JAXBContext.newInstance("net.sourceforge.bprocessor.model.xml"); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(document, stream); } } |
From: Jesper P. <je...@us...> - 2005-07-18 09:25:32
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17975/xml Log Message: Directory /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml added to the repository |
From: Jesper P. <je...@us...> - 2005-07-18 09:25:25
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17940 Modified Files: Edge.java Log Message: Remove references to contour Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Edge.java 11 Jul 2005 09:31:23 -0000 1.1 --- Edge.java 18 Jul 2005 09:25:05 -0000 1.2 *************** *** 8,13 **** import java.io.Serializable; - import java.util.HashSet; - import java.util.Set; import org.apache.log4j.Logger; --- 8,11 ---- *************** *** 35,41 **** private Vertex to; - /** The contour relationship */ - private Set contours; - /** * Constructor for persistence layer --- 33,36 ---- *************** *** 53,57 **** setFrom(new Vertex()); setTo(new Vertex()); - setContours(new HashSet()); } --- 48,51 ---- *************** *** 121,140 **** /** - * Get the contours - * @return The contours - */ - public Set getContours() { - return contours; - } - - /** - * Set the contours - * @param contours The contours - */ - public void setContours(Set contours) { - this.contours = contours; - } - - /** * Return the hash code of the object * @return The hash --- 115,118 ---- |
From: Jesper P. <je...@us...> - 2005-07-18 09:24:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17836 Modified Files: Surface.java Log Message: A surface can be a constructor and has references to edges Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Surface.java 11 Jul 2005 09:32:23 -0000 1.2 --- Surface.java 18 Jul 2005 09:24:35 -0000 1.3 *************** *** 29,37 **** private String name; ! /** The domain relationship */ ! private Set domains; ! /** The contour relationship */ ! private Set contours; /** --- 29,37 ---- private String name; ! /** Constructor */ ! private boolean constructor; ! /** The edges relationship */ ! private Set edges; /** *************** *** 48,53 **** setId(new Long(l++)); setName(name); ! setDomains(new HashSet()); ! setContours(new HashSet()); } --- 48,53 ---- setId(new Long(l++)); setName(name); ! setConstructor(false); ! setEdges(new HashSet()); } *************** *** 85,117 **** /** ! * Get the domains ! * @return The domains */ ! public Set getDomains() { ! return domains; } /** ! * Set the domains ! * @param domains The domains */ ! public void setDomains(Set domains) { ! this.domains = domains; } ! /** ! * Get the contours ! * @return The contours */ ! public Set getContours() { ! return contours; } /** ! * Set the contours ! * @param contours The contours */ ! public void setContours(Set contours) { ! this.contours = contours; } --- 85,117 ---- /** ! * Is the surface a constructor ! * @return True if constructor; otherwise false */ ! public boolean getConstructor() { ! return constructor; } /** ! * Set if the surface is a constructor ! * @param c True if constructor; otherwise false */ ! public void setConstructor(boolean c) { ! constructor = c; } ! /** ! * Get the edges ! * @return The edges */ ! public Set getEdges() { ! return edges; } /** ! * Set the edges ! * @param edges The edges */ ! public void setEdges(Set edges) { ! this.edges = edges; } |
From: Jesper P. <je...@us...> - 2005-07-18 09:22:27
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17311 Removed Files: Constructor.java ConstructorFacade.java Contour.java ContourFacade.java Log Message: Not needed --- Contour.java DELETED --- --- Constructor.java DELETED --- --- ContourFacade.java DELETED --- --- ConstructorFacade.java DELETED --- |
From: Jesper P. <je...@us...> - 2005-07-18 09:21:25
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17058 Modified Files: Vertex.java Log Message: Set methods should be public Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Vertex.java 11 Jul 2005 09:31:24 -0000 1.1 --- Vertex.java 18 Jul 2005 09:21:16 -0000 1.2 *************** *** 108,112 **** * @param x The x coordinate */ ! private void setX(double x) { this.x = x; } --- 108,112 ---- * @param x The x coordinate */ ! public void setX(double x) { this.x = x; } *************** *** 124,128 **** * @param y The y coordinate */ ! private void setY(double y) { this.y = y; } --- 124,128 ---- * @param y The y coordinate */ ! public void setY(double y) { this.y = y; } *************** *** 140,144 **** * @param z The z coordinate */ ! private void setZ(double z) { this.z = z; } --- 140,144 ---- * @param z The z coordinate */ ! public void setZ(double z) { this.z = z; } *************** *** 156,160 **** * @param w The w coordinate */ ! private void setW(double w) { this.w = w; } --- 156,160 ---- * @param w The w coordinate */ ! public void setW(double w) { this.w = w; } |
From: Jesper P. <je...@us...> - 2005-07-18 09:20:16
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16654 Added Files: bprocessor.xsd Log Message: Initial import --- NEW FILE: bprocessor.xsd --- <?xml version="1.0" encoding="UTF-8"?> <!-- XML Schema used for persistence $Id: bprocessor.xsd,v 1.1 2005/07/18 09:20:06 jews Exp $ --> <xsd:schema xmlns:bpr="http://bprocessor.sourceforge.net" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- Type definitions --> <xsd:complexType name="AttributeType"> <xsd:sequence> <xsd:element name="id" type="xsd:long"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="type" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="DomainType"> <xsd:sequence> <xsd:element name="id" type="xsd:long"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="attributeref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> <xsd:element name="surfaceref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="SpaceType"> <xsd:complexContent> <xsd:extension base="DomainType"> <xsd:sequence> <xsd:element name="elementref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="ConstructionSpaceType"> <xsd:complexContent> <xsd:extension base="SpaceType"> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="FunctionalSpaceType"> <xsd:complexContent> <xsd:extension base="SpaceType"> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="ElementType"> <xsd:complexContent> <xsd:extension base="DomainType"> <xsd:sequence> <xsd:element name="partref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="PartType"> <xsd:complexContent> <xsd:extension base="DomainType"> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="SurfaceType"> <xsd:sequence> <xsd:element name="id" type="xsd:long"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="constructor" type="xsd:boolean"/> <xsd:element name="edgeref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="EdgeType"> <xsd:sequence> <xsd:element name="id" type="xsd:long"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="vertexfromref" type="xsd:long" maxOccurs="1" minOccurs="0"/> <xsd:element name="vertextoref" type="xsd:long" maxOccurs="1" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="VertexType"> <xsd:sequence> <xsd:element name="id" type="xsd:long"/> <xsd:element name="name" type="xsd:string"/> <xsd:element name="x" type="xsd:double"/> <xsd:element name="y" type="xsd:double"/> <xsd:element name="z" type="xsd:double"/> <xsd:element name="w" type="xsd:double"/> <xsd:element name="edgeref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <!-- Element definitions --> <xsd:element name="attribute" type="AttributeType"/> <xsd:element name="constructionspace" type="ConstructionSpaceType"/> <xsd:element name="functionalspace" type="FunctionalSpaceType"/> <xsd:element name="element" type="ElementType"/> <xsd:element name="part" type="PartType"/> <xsd:element name="surface" type="SurfaceType"/> <xsd:element name="edge" type="EdgeType"/> <xsd:element name="vertex" type="VertexType"/> <!-- Main element --> <xsd:element name="bprocessor"> <xsd:complexType> <xsd:sequence> <xsd:element ref="attribute" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="constructionspace" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="functionalspace" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="element" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="part" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="surface" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="edge" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="vertex" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
From: Jesper P. <je...@us...> - 2005-07-18 09:19:48
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16523/etc Log Message: Directory /cvsroot/bprocessor/model/src/etc added to the repository |
From: Jesper P. <je...@us...> - 2005-07-18 09:19:32
|
Update of /cvsroot/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16476 Modified Files: build.xml Log Message: Depend on kernel and JAXB Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/build.xml,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build.xml 27 Jun 2005 09:31:13 -0000 1.1.1.1 --- build.xml 18 Jul 2005 09:19:15 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- <property name="tools.dir" value="${basedir}/../tools"/> + <property name="kernel.dir" value="${basedir}/../kernel"/> <property name="build.dir" value="${basedir}/build"/> *************** *** 52,55 **** --- 53,93 ---- </fileset> </copy> + <copy todir="${lib.dir}"> + <fileset dir="${tools.dir}/jaxb"> + <include name="**/jaxb.jar"/> + </fileset> + </copy> + <copy todir="${lib.dir}"> + <fileset dir="${kernel.dir}/dist"> + <include name="**/kernel.jar"/> + </fileset> + </copy> + </target> + + <target name="compile-xml" depends="copylib"> + <taskdef name="xjc" + classname="com.sun.tools.xjc.XJCTask"> + <classpath> + <pathelement location="${tools.dir}/jaxb/jaxb-xjc.jar"/> + <pathelement location="${lib.dir}/jaxb.jar"/> + </classpath> + </taskdef> + <xjc schema="${conf.dir}/bprocessor.xsd" + target="${build.dir}" + package="net.sourceforge.bprocessor.model.xml"> + <arg value="-nv"/> + </xjc> + <javac srcdir="${build.dir}" destdir="${build.dir}" deprecation="yes" + debug="yes" + includes="net/**"> + <classpath> + <pathelement location="${lib.dir}/jaxb.jar"/> + </classpath> + </javac> + <delete> + <fileset dir="${build.dir}"> + <include name="**/*.java"/> + </fileset> + </delete> </target> *************** *** 66,70 **** </target> ! <target name="compile" depends="checkstyle,copylib"> <ant dir="src" target="compile"/> </target> --- 104,108 ---- </target> ! <target name="compile" depends="checkstyle,copylib,compile-xml"> <ant dir="src" target="compile"/> </target> |
From: Jesper P. <je...@us...> - 2005-07-18 09:17:06
|
Update of /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16019/src/net/sourceforge/bprocessor/kernel/notification Modified Files: Notification.java Log Message: Added keys for edge and vertex Index: Notification.java =================================================================== RCS file: /cvsroot/bprocessor/kernel/src/net/sourceforge/bprocessor/kernel/notification/Notification.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Notification.java 11 Jul 2005 11:20:06 -0000 1.3 --- Notification.java 18 Jul 2005 09:16:56 -0000 1.4 *************** *** 91,94 **** --- 91,124 ---- public static final String SURFACE_MODIFIED = "surface.modified"; + /** Edge created */ + public static final String EDGE_CREATED = "edge.created"; + + /** Edge deleted */ + public static final String EDGE_DELETED = "edge.deleted"; + + /** Edge renamed */ + public static final String EDGE_RENAMED = "edge.renamed"; + + /** Edge selected */ + public static final String EDGE_SELECTED = "edge.selected"; + + /** Edge modified */ + public static final String EDGE_MODIFIED = "edge.modified"; + + /** Vertex created */ + public static final String VERTEX_CREATED = "vertex.created"; + + /** Vertex deleted */ + public static final String VERTEX_DELETED = "vertex.deleted"; + + /** Vertex renamed */ + public static final String VERTEX_RENAMED = "vertex.renamed"; + + /** Vertex selected */ + public static final String VERTEX_SELECTED = "vertex.selected"; + + /** Vertex modified */ + public static final String VERTEX_MODIFIED = "vertex.modified"; + /** The type */ private String type; |
From: Jesper P. <je...@us...> - 2005-07-15 09:45:31
|
Update of /cvsroot/bprocessor/tools/jogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19576 Modified Files: jogl.jar Log Message: JOGL 1.1.1 Index: jogl.jar =================================================================== RCS file: /cvsroot/bprocessor/tools/jogl/jogl.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs1oqDG1 and /tmp/cvs4pzCmW differ |