bprocessor-commit Mailing List for B-processor (Page 152)
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-11-17 16:59:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22507 Modified Files: AbstractView.java View3D.java View.java Log Message: changed the entire camera initializisation and rotation mechanism Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** AbstractView.java 15 Nov 2005 19:04:09 -0000 1.56 --- AbstractView.java 17 Nov 2005 16:59:45 -0000 1.57 *************** *** 48,56 **** private static Logger log = Logger.getLogger(AbstractView.class); - /** 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}; /** Select mode for selecting edges */ private static final int EDGES = 0; --- 48,51 ---- *************** *** 296,301 **** picking = 0; - - // grid and coords are always completely lit gl.glDisable(GL.GL_DEPTH_TEST); --- 291,294 ---- *************** *** 307,312 **** coords(); ! // draw the clipping planes ! Iterator clipit = clippingPlanes.iterator(); gl.glEnable(GL.GL_POLYGON_STIPPLE); --- 300,304 ---- coords(); ! // draw the clipping planes Iterator clipit = clippingPlanes.iterator(); gl.glEnable(GL.GL_POLYGON_STIPPLE); *************** *** 393,396 **** --- 385,389 ---- drawString(x, y, string); } + /** * Resets the working attributes of the view *************** *** 632,636 **** */ protected void drawAll(GLDrawable gld) { - Set surfaces = Project.getInstance().getSurfaces(); Set edges = Project.getInstance().getEdges(); --- 625,628 ---- *************** *** 1380,1384 **** gl.glGetIntegerv(GL.GL_MAX_CLIP_PLANES, maxclip); if (clippingPlanes.size() < maxclip[0] || maxclip[0] == 0) { - log.info("Added clipplane"); cp.setNumber(clippingPlanes.size()); clippingPlanes.add(cp); --- 1372,1375 ---- *************** *** 1427,1430 **** --- 1418,1427 ---- /** + * Add the change to the focal width; + * @param change the change to the focalwidth + */ + public abstract void changeFocalWidth(double change); + + /** * representation of a 3D point. */ *************** *** 1520,1523 **** --- 1517,1526 ---- /** + * Roll the camera + * @param angle The amount of roll negative left positive right + */ + public abstract void rollCamera(double angle); + + /** * Return the near plane * @return The near plane Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** View3D.java 1 Nov 2005 07:27:15 -0000 1.18 --- View3D.java 17 Nov 2005 16:59:45 -0000 1.19 *************** *** 23,36 **** /** The logger */ private static Logger log = Logger.getLogger(View3D.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 = -30; ! /** The rotation about the Y axis */ ! private static double rotationZ = 130; ! /** * The constructor --- 23,36 ---- /** The logger */ private static Logger log = Logger.getLogger(View3D.class); + + /** double arrays for modelView setup */ + protected double[] center, roll, camera; ! /** The focal width */ ! private double focalwidth; ! /** Do a camera reset on repaint */ ! private boolean reset = true; ! /** * The constructor *************** *** 39,42 **** --- 39,45 ---- public View3D(GLView glv) { super(glv); + center = new double[]{.0, .0, .0}; + camera = new double[]{25.0, 0.0, 0.0}; + roll = new double[]{.0, .0, 1.0}; } *************** *** 51,91 **** gl = gld.getGL(); glu = gld.getGLU(); ! int[] viewport = new int[] {0, 0, (int)width, (int)height}; ! gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! //Set the PickMatrix if we are trying to pick something if (picking > 0) { glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport); } double aspect = width / height; ! near = 4 * getZoomFactor(); ! far = 200.0 * getZoomFactor(); if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * 60.0, 1.0, near, far); } else { ! glu.gluPerspective(60.0, aspect, near, far); } gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); - gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] {0.0f, 0.0f, 0.0f, 1.0f}); - glu.gluLookAt(0.0, 25.0 * getZoomFactor(), 0.0, - 0.0, 0.0, 0.0, - 0.0, 0.0, 1.0); - gl.glRotated(rotationX, 1.0, 0.0, 0.0); - gl.glRotated(rotationZ, 0.0, 0.0, 1.0); - gl.glMultMatrixd(viewTrans); - if (picking == 0) { - gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix); - gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix); gl.glGetIntegerv(GL.GL_VIEWPORT, screenport); } } /** * Move the center left/right, up/down, forward/backward * @param mv the move vector --- 54,120 ---- gl = gld.getGL(); glu = gld.getGLU(); ! gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); ! if (picking > 0) { + int[] viewport = new int[] {0, 0, (int)width, (int)height}; glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport); } + double aspect = width / height; ! double near = 1 * getZoomFactor(); ! double far = 200.0 * getZoomFactor(); ! focalwidth = 60.0; if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * focalwidth, 1.0, near, far); } else { ! glu.gluPerspective(focalwidth, aspect, near, far); } gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); + glu.gluLookAt(camera[0] * getZoomFactor(), + camera[1] * getZoomFactor(), + camera[2] * getZoomFactor(), + center[0], center[1], center[2], + roll[0], roll[1], roll[2]); + //gl.glMultMatrixd(modelMatrix); + + if (reset) { + reset = false; + resetCamera(gld); + } if (picking == 0) { gl.glGetIntegerv(GL.GL_VIEWPORT, screenport); + gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix); + gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix); } } /** + * reset the modelView and projectionMatrix on next repaint + */ + private void resetCamera() { + reset = true; + } + + /** + * Reset til view to "original" view + * @param gld The GL drawable + */ + private void resetCamera(GLDrawable gld) { + gl = gld.getGL(); + glu = gld.getGLU(); + + gl.glPushMatrix(); + gl.glLoadIdentity(); + gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] {0.0f, 0.0f, 0.0f, 1.0f}); + gl.glPopMatrix(); + } + + /** * Move the center left/right, up/down, forward/backward * @param mv the move vector *************** *** 93,102 **** public void translateCenter(double [] mv) { if (mv.length == 3) { ! this.viewTrans[12] -= modelMatrix[0] * mv[0] + modelMatrix[1] * mv[1] + ! modelMatrix[2] * mv[2]; ! this.viewTrans[13] -= modelMatrix[4] * mv[0] + modelMatrix[5] * mv[1] + ! modelMatrix[6] * mv[2]; ! this.viewTrans[14] -= modelMatrix[8] * mv[0] + modelMatrix[9] * mv[1] + ! modelMatrix[10] * mv[2]; } else { log.error("[translateViewMatrix] Wrong parameter size"); --- 122,134 ---- public void translateCenter(double [] mv) { if (mv.length == 3) { ! double dx = modelMatrix[0] * mv[0] + modelMatrix[1] * -mv[1] + modelMatrix[2] * mv[2]; ! double dy = modelMatrix[4] * mv[0] + modelMatrix[5] * -mv[1] + modelMatrix[6] * mv[2]; ! double dz = modelMatrix[8] * mv[0] + modelMatrix[9] * -mv[1] + modelMatrix[10] * mv[2]; ! center[0] += dx; ! center[1] += dy; ! center[2] += dz; ! camera[0] += dx; ! camera[1] += dy; ! camera[2] += dz; } else { log.error("[translateViewMatrix] Wrong parameter size"); *************** *** 105,113 **** /** * 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; } --- 137,283 ---- /** + * Add the change to the focal width; + * @param change the change to the focalwidth + */ + public void changeFocalWidth(double change) { + focalwidth += change; + if (focalwidth > 180.0) { + focalwidth = 180; + } else if (focalwidth < 0.0) { + focalwidth = 0; + } + } + + /** * Change the rotation about the x axis * @param change The change in R+ (is divided with the window height) */ ! public void translateRotationX(double change) { ! translateRotationX(change, center); ! } ! ! /** ! * Change the rotation about the x axis ! * @param change The change in R+ (is divided with the window height) ! * @param c The point to rotate about ! */ ! public void translateRotationX(double change, double[] c) { ! double angle = change / width; ! rotate(-angle, c, modelMatrix[0], modelMatrix[4], modelMatrix[8]); ! } ! ! /** ! * Rotate the camera ! * @param angle The angle I would like to rotate ! * @param c The center of rotation ! * @param x The amount about the x axis ! * @param y The amount about the y axis ! * @param z The amount about the z axis ! */ ! public void rotate(double angle, double[] c, double x, double y, double z) { ! double rx, ry, rz; ! double dx = camera[0] - c[0]; ! double dy = camera[1] - c[1]; ! double dz = camera[2] - c[2]; ! double sinx, cosx, siny, sinz, cosy, cosz; ! double pro = x * y * z; ! ! sinx = Math.sin(x * angle); ! cosx = Math.cos(x * angle); ! siny = Math.sin(y * angle); ! cosy = Math.cos(y * angle); ! sinz = Math.sin(z * angle); ! cosz = Math.cos(z * angle); ! ! ! double[] rotx = new double[] {1, 0, 0, ! 0, cosx, sinx, ! 0, -sinx, cosx}; ! double[] roty = new double[] {cosy, 0, -siny, ! 0, 1, 0, ! siny, 0, cosy}; ! double[] rotz = new double[] {cosz, sinz, 0, ! -sinz, cosz, 0, ! 0, 0, 1}; ! ! double[] rot = multMatrix3(rotx, roty); ! rot = multMatrix3(rot, rotz); ! ! rx = dx * rot[0] + dy * rot[1] + dz * rot[2]; ! ry = dx * rot[3] + dy * rot[4] + dz * rot[5]; ! rz = dx * rot[6] + dy * rot[7] + dz * rot[8]; ! ! camera[0] = rx + c[0]; ! camera[1] = ry + c[1]; ! camera[2] = rz + c[2]; ! ! roll[0] = roll[0] * rot[0] + roll[1] * rot[1] + roll[2] * rot[2]; ! roll[1] = roll[0] * rot[3] + roll[1] * rot[4] + roll[2] * rot[5]; ! roll[2] = roll[0] * rot[6] + roll[1] * rot[7] + roll[2] * rot[8]; ! } ! ! /** ! * Roll the camera ! * @param angle The amount of roll negative left positive right ! */ ! public void rollCamera(double angle) { ! angle /= width; ! double dx = camera[0] - center[0]; ! double dy = camera[1] - center[1]; ! double dz = camera[2] - center[2]; ! double length = Math.sqrt(dx * dx + dy * dy + dz * dz); ! ! double sinx = Math.sin(dx / length * angle); ! double cosx = Math.cos(dx / length * angle); ! double siny = Math.sin(dy / length * angle); ! double cosy = Math.cos(dy / length * angle); ! double sinz = Math.sin(dz / length * angle); ! double cosz = Math.cos(dz / length * angle); ! ! double[] rotx = new double[] {1, 0, 0, ! 0, cosx, sinx, ! 0, -sinx, cosx}; ! double[] roty = new double[] {cosy, 0, -siny, ! 0, 1, 0, ! siny, 0, cosy}; ! double[] rotz = new double[] {cosz, sinz, 0, ! -sinz, cosz, 0, ! 0, 0, 1}; ! ! double[] rot = multMatrix3(rotx, roty); ! rot = multMatrix3(rot, rotz); ! ! double rx = roll[0] * rot[0] + roll[1] * rot[1] + roll[2] * rot[2]; ! double ry = roll[0] * rot[3] + roll[1] * rot[4] + roll[2] * rot[5]; ! double rz = roll[0] * rot[6] + roll[1] * rot[7] + roll[2] * rot[8]; ! ! roll[0] = rx; ! roll[1] = ry; ! roll[2] = rz; ! } ! ! /** ! * Matrix multiplication ! * @param matrix1 The first matrix ! * @param matrix2 The second matrix ! * @return The multiplication of matrix1 and matrix2 ! */ ! public double[] multMatrix3(double[] matrix1, double[] matrix2) { ! double[] result = null; ! if (matrix1.length == 9 && matrix2.length == 9) { ! result = new double[9]; ! result[0] = matrix1[0] * matrix2[0] + matrix1[1] * matrix2[3] + matrix1[2] * matrix2[6]; ! result[1] = matrix1[0] * matrix2[1] + matrix1[1] * matrix2[4] + matrix1[2] * matrix2[7]; ! result[2] = matrix1[0] * matrix2[2] + matrix1[1] * matrix2[5] + matrix1[2] * matrix2[8]; ! ! result[3] = matrix1[3] * matrix2[0] + matrix1[4] * matrix2[3] + matrix1[5] * matrix2[6]; ! result[4] = matrix1[3] * matrix2[1] + matrix1[4] * matrix2[4] + matrix1[5] * matrix2[7]; ! result[5] = matrix1[3] * matrix2[2] + matrix1[4] * matrix2[5] + matrix1[5] * matrix2[8]; ! ! result[6] = matrix1[6] * matrix2[0] + matrix1[7] * matrix2[3] + matrix1[8] * matrix2[6]; ! result[7] = matrix1[6] * matrix2[1] + matrix1[7] * matrix2[4] + matrix1[8] * matrix2[7]; ! result[8] = matrix1[6] * matrix2[2] + matrix1[7] * matrix2[5] + matrix1[8] * matrix2[8]; ! } ! return result; } *************** *** 115,121 **** * Change the rotation about the y axis * @param change The change in R+ (is divided with the window height) */ public void translateRotationY(double change) { ! rotationZ -= change / width; } --- 285,305 ---- * Change the rotation about the y axis * @param change The change in R+ (is divided with the window height) + * @param c The point to rotate about + */ + public void translateRotationY(double change, double[] c) { + double angle = change / height; + if (roll[2] < 0) { + rotate(-angle, c, 0, 0, -1); + } else { + rotate(-angle, c, 0, 0, 1); + } + } + + /** + * Change the rotation about the z axis + * @param change The change in R+ (is divided with the window height) */ public void translateRotationY(double change) { ! translateRotationY(change, center); } *************** *** 126,145 **** public void changeView(int value) { if (value == View.VIEW_XY) { ! rotationZ = 180; ! rotationX = -90; } if (value == View.VIEW_XZ) { ! rotationZ = 180; ! rotationX = 0; } if (value == View.VIEW_YZ) { ! rotationZ = 90; ! rotationX = 0; } if (value == View.VIEW_3D) { ! rotationZ = 130; ! rotationX = -30; } - } --- 310,364 ---- public void changeView(int value) { if (value == View.VIEW_XY) { ! //rotationZ = 180; ! //rotationX = -90; ! center[0] = .0; ! center[1] = .0; ! center[2] = .0; ! camera[0] = .0; ! camera[1] = .0; ! camera[2] = 25.0; ! roll[0] = .0; ! roll[1] = .1; ! roll[2] = .0; } if (value == View.VIEW_XZ) { ! //rotationZ = 180; ! //rotationX = 0; ! center[0] = .0; ! center[1] = .0; ! center[2] = .0; ! camera[0] = .0; ! camera[1] = 25.0; ! camera[2] = .0; ! roll[0] = .0; ! roll[1] = .0; ! roll[2] = .1; } if (value == View.VIEW_YZ) { ! //rotationZ = 90; ! //rotationX = 0; ! center[0] = .0; ! center[1] = .0; ! center[2] = .0; ! camera[0] = 25.0; ! camera[1] = .0; ! camera[2] = .0; ! roll[0] = .0; ! roll[1] = .0; ! roll[2] = .1; } if (value == View.VIEW_3D) { ! //rotationZ = 130; ! //rotationX = -30; ! center[0] = .0; ! center[1] = .0; ! center[2] = .0; ! camera[0] = 25.0; ! camera[1] = 5.0; ! camera[2] = 5.0; ! roll[0] = .0; ! roll[1] = .0; ! roll[2] = .1; } } *************** *** 150,153 **** --- 369,373 ---- super.reset(); } + /** * Draw a grid Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** View.java 6 Nov 2005 16:33:44 -0000 1.19 --- View.java 17 Nov 2005 16:59:45 -0000 1.20 *************** *** 135,138 **** --- 135,164 ---- /** + * Change the rotation about the y axis + * @param change The change in R+ (is divided with the window height) + * @param center The point to rotate about + */ + public void translateRotationY(double change, double[] center); + + /** + * Change the rotation about the x axis + * @param change The change in R+ (is divided with the window height) + * @param center The point to rotate about + */ + public void translateRotationX(double change, double[] center); + + /** + * Roll the camera + * @param angle The amount of roll negative left positive right + */ + public void rollCamera(double angle); + + /** + * Add the change to the focal width; + * @param change the change to the focalwidth + */ + public void changeFocalWidth(double change); + + /** * Change view to 3d, XY, XZ, or YZ * @param value One of 3d_VIEW, XY_VIEW, XZ_VIEW, YZ_VIEW *************** *** 153,156 **** --- 179,188 ---- /** + * getter for zoomFactor + * @return The parent zoomFactor + */ + public double getZoomFactor(); + + /** * Setter for snapVertex * @param v The new snapVertex |
From: rimestad <rim...@us...> - 2005-11-17 16:58:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22059 Modified Files: AbstractTool.java CameraMoveTimer.java ToolFactory.java Tool.java Added Files: RotationTool.java Log Message: added rotation tool Index: CameraMoveTimer.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraMoveTimer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CameraMoveTimer.java 31 Aug 2005 14:56:33 -0000 1.2 --- CameraMoveTimer.java 17 Nov 2005 16:58:16 -0000 1.3 *************** *** 7,22 **** package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Carama move timer class */ class CameraMoveTimer implements ActionListener { /** The calling mouselistener */ ! private AbstractTool at; /** The current GLView */ --- 7,33 ---- package net.sourceforge.bprocessor.gl.tool; + import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; + import java.util.Iterator; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import org.apache.log4j.Logger; + /** * Carama move timer class */ class CameraMoveTimer implements ActionListener { + /** The logger */ + private static Logger log = Logger.getLogger(CameraMoveTimer.class); + /** The calling mouselistener */ ! private RotationTool at; /** The current GLView */ *************** *** 28,32 **** * @param glv the GLView */ ! public CameraMoveTimer(AbstractTool at, GLView glv) { this.at = at; this.glv = glv; --- 39,43 ---- * @param glv the GLView */ ! public CameraMoveTimer(RotationTool at, GLView glv) { this.at = at; this.glv = glv; *************** *** 38,44 **** */ public void actionPerformed(ActionEvent e) { ! View v = glv.getView(); ! v.translateRotationX(10 * at.getdy()); ! v.translateRotationY(10 * at.getdx()); glv.repaint(true); } --- 49,85 ---- */ public void actionPerformed(ActionEvent e) { ! View view = glv.getView(); ! if (at.mode == RotationTool.ROTATION) { ! if (at.selection.size() == 0) { ! // just rotate about the camera view point ! view.translateRotationX(at.getdy() / 5); ! view.translateRotationY(at.getdx() / 5); ! } else { ! // find the point on the object to rotate about ! Iterator it = at.selection.iterator(); ! if (it.hasNext()) { ! Object o = it.next(); ! double[] center; ! if (o instanceof Surface) { ! Vertex v = ((Surface)o).center(); ! center = new double[] {v.getX(), v.getY(), v.getZ()}; ! } else if (o instanceof Edge) { ! center = ((Edge)o).center(); ! } else if (o instanceof Vertex) { ! Vertex v = (Vertex)o; ! center = new double[] {v.getX(), v.getY(), v.getZ()}; ! } else { ! center = null; ! log.error("unsupportet type " + o); ! } ! if (center != null) { ! view.translateRotationX(at.getdy() / 5, center); ! view.translateRotationY(at.getdx() / 5, center); ! } ! } ! } ! } else if (at.mode == RotationTool.ROLL) { ! view.rollCamera(at.getdx() / 5); ! } glv.repaint(true); } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ToolFactory.java 15 Nov 2005 19:04:10 -0000 1.12 --- ToolFactory.java 17 Nov 2005 16:58:16 -0000 1.13 *************** *** 49,52 **** --- 49,55 ---- private ClipplaneTool clipplane; + /** rotation tool */ + private RotationTool rotation; + /** * Constructor *************** *** 54,58 **** */ private ToolFactory(GLView glv) { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL url = cl.getResource("Bcursorpen1.gif"); --- 57,60 ---- *************** *** 60,64 **** Cursor pencilcursor = Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil"); - Toolbar tb = Toolbar.getInstance(); --- 62,65 ---- *************** *** 73,82 **** but = tb.registerAction(new ClipAction(glv)); but.setToolTipText("Clipping"); select = new SpaceTool(glv, null); pencil = new PencilTool(glv, pencilcursor); ! move = new MoveTool(glv, null); ! extrusion = new ExtrusionTool(glv, null); ! clipplane = new ClipplaneTool(glv, null); Notifier.getInstance().addListener(select); --- 74,86 ---- but = tb.registerAction(new ClipAction(glv)); but.setToolTipText("Clipping"); + but = tb.registerAction(new RotationAction(glv)); + but.setToolTipText("Rotation"); select = new SpaceTool(glv, null); pencil = new PencilTool(glv, pencilcursor); ! move = new MoveTool(glv, pencilcursor); ! extrusion = new ExtrusionTool(glv, pencilcursor); ! clipplane = new ClipplaneTool(glv, pencilcursor); ! rotation = new RotationTool(glv, pencilcursor); Notifier.getInstance().addListener(select); *************** *** 119,122 **** --- 123,128 ---- } else if (i == Tool.CLIP_TOOL) { return clipplane; + } else if (i == Tool.ROTATION_TOOL) { + return rotation; } else { log.error("[get] No such tool " + i); *************** *** 156,159 **** --- 162,193 ---- /** + * The rotation action inner class + */ + class RotationAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + RotationAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Biconrotcam.gif"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.ROTATION_TOOL); + } + } + + /** * The move action inner class */ Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AbstractTool.java 7 Nov 2005 07:21:21 -0000 1.26 --- AbstractTool.java 17 Nov 2005 16:58:16 -0000 1.27 *************** *** 15,22 **** import java.awt.Cursor; - import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; - import java.awt.event.InputEvent; import java.util.List; --- 15,20 ---- *************** *** 26,31 **** import java.util.HashSet; - import javax.swing.Timer; - import org.apache.log4j.Logger; /** --- 24,27 ---- *************** *** 39,42 **** --- 35,41 ---- private static int[] pressPos = new int[2]; + /** The mouse position last time there was a mouse event */ + private static int[] lastPos = new int[2]; + /** The mouse movement in x axis since press */ private static int dx = 0; *************** *** 57,69 **** protected static final double EPSILON = 0.4; - /** The move action listener */ - private static ActionListener moveAction; - /** The selected objects */ protected static Collection selection; - /** The carmera move timer */ - private static Timer timer; - /** The 3DView */ protected GLView glv = null; --- 56,62 ---- *************** *** 78,82 **** static { - timer = new Timer(40, null); selection = new HashSet(); } --- 71,74 ---- *************** *** 90,95 **** this.glv = glv; this.cursor = cursor; - timer.start(); - moveAction = new CameraMoveTimer(this, glv); } --- 82,85 ---- *************** *** 109,122 **** View v = glv.getView(); if (e.getKeyCode() == KeyEvent.VK_UP) { - v.translateCenter(new double[] {0.0, 1.0, 0.0}); - } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { v.translateCenter(new double[] {0.0, -1.0, 0.0}); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { v.translateCenter(new double[] {-1.0, 0.0, 0.0}); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { v.translateCenter(new double[] {1.0, 0.0, 0.0}); ! } else if (e.getKeyChar() == KeyEvent.VK_COMMA) { v.zoom(1.1); ! } else if (e.getKeyChar() == KeyEvent.VK_PERIOD) { v.zoom(0.9); } else if (e.getKeyCode() == KeyEvent.VK_Q) { --- 99,112 ---- View v = glv.getView(); if (e.getKeyCode() == KeyEvent.VK_UP) { v.translateCenter(new double[] {0.0, -1.0, 0.0}); + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + v.translateCenter(new double[] {0.0, 1.0, 0.0}); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { v.translateCenter(new double[] {-1.0, 0.0, 0.0}); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { v.translateCenter(new double[] {1.0, 0.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_Z) { v.zoom(1.1); ! } else if (e.getKeyCode() == KeyEvent.VK_X) { v.zoom(0.9); } else if (e.getKeyCode() == KeyEvent.VK_Q) { *************** *** 124,130 **** } else if (e.getKeyCode() == KeyEvent.VK_W) { glv.changeTool(Tool.PENCIL_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.MOVE_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_R) { glv.changeTool(Tool.EXTRUSION_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_F1) { --- 114,122 ---- } else if (e.getKeyCode() == KeyEvent.VK_W) { glv.changeTool(Tool.PENCIL_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_M) { glv.changeTool(Tool.MOVE_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_R) { + glv.changeTool(Tool.ROTATION_TOOL); + } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.EXTRUSION_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_F1) { *************** *** 171,174 **** --- 163,175 ---- AbstractTool.dy = y - pressPos[1]; + View v = glv.getView(); + if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK) { + v.translateCenter(new double[] {(x - lastPos[0]) / (30 * (glv.getView()).getZoomFactor()), + (y - lastPos[1]) / (30 * (glv.getView()).getZoomFactor()), + 0.0}); + } + + lastPos[0] = x; + lastPos[1] = y; dragged(e); glv.repaint(true); *************** *** 183,188 **** int y = e.getY(); ! AbstractTool.dx = x - pressPos[0]; ! AbstractTool.dy = y - pressPos[1]; moved(e); glv.repaint(true); --- 184,192 ---- int y = e.getY(); ! dx = x - pressPos[0]; ! dy = y - pressPos[1]; ! ! lastPos[0] = x; ! lastPos[1] = y; moved(e); glv.repaint(true); *************** *** 215,227 **** */ public void mousePressed(MouseEvent e) { - int currentButton = e.getButton(); pressPos[0] = e.getX(); pressPos[1] = e.getY(); ! int rotamask = InputEvent.CTRL_DOWN_MASK; ! if (currentButton == MouseEvent.BUTTON3 || e.isControlDown()) { ! timer.addActionListener(moveAction); ! } else { ! pressed(e); ! } glv.repaint(true); } --- 219,229 ---- */ public void mousePressed(MouseEvent e) { pressPos[0] = e.getX(); pressPos[1] = e.getY(); ! dx = 0; ! dy = 0; ! lastPos[0] = pressPos[0]; ! lastPos[1] = pressPos[1]; ! pressed(e); glv.repaint(true); } *************** *** 234,241 **** int currentButton = e.getButton(); - timer.removeActionListener(moveAction); - AbstractTool.dx = 0; - AbstractTool.dy = 0; - released(e); glv.repaint(true); --- 236,239 ---- --- NEW FILE: RotationTool.java --- //--------------------------------------------------------------------------------- // $Id: RotationTool.java,v 1.1 2005/11/17 16:58:16 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.InputEvent; import java.awt.Cursor; import javax.swing.Timer; import org.apache.log4j.Logger; /** * The rotationtool */ public class RotationTool extends AbstractTool { /** Rotation mode */ public static final int ROTATION = 0; /** Roll mode */ public static final int ROLL = 1; /** The logger */ private static Logger log = Logger.getLogger(RotationTool.class); /** The carmera move timer */ private static Timer timer; /** The mouse position last time the mouse was pressed initializes to (0,0) */ private static int[] pressPos = new int[2]; /** The move action listener */ private static ActionListener rotateAction; /** The current rotation mode */ protected int mode = ROTATION; static { timer = new Timer(40, null); } /** * KeyListener for the GL Canvas * @param glv The 3D canvas * @param cursor The Mouse cursor */ public RotationTool(GLView glv, Cursor cursor) { super(glv, cursor); timer.start(); rotateAction = new CameraMoveTimer(this, glv); } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { mode = ROLL; } else { mode = ROTATION; } } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { mode = ROLL; } else { mode = ROTATION; } } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK) { mode = ROLL; } else { mode = ROTATION; } if (e.getButton() == MouseEvent.BUTTON1) { timer.addActionListener(rotateAction); } } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { timer.removeActionListener(rotateAction); } } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Tool.java 7 Nov 2005 07:21:21 -0000 1.10 --- Tool.java 17 Nov 2005 16:58:16 -0000 1.11 *************** *** 27,30 **** --- 27,32 ---- /** The Clipping tool */ public static final int CLIP_TOOL = 4; + /** The Rotation tool */ + public static final int ROTATION_TOOL = 5; /** |
From: rimestad <rim...@us...> - 2005-11-17 11:19:40
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2824 Modified Files: GUI.java Log Message: changed the splash Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GUI.java 15 Nov 2005 19:01:02 -0000 1.10 --- GUI.java 17 Nov 2005 11:19:32 -0000 1.11 *************** *** 329,333 **** */ public void start() { ! plash = new SplashWindow("sagradafamilia.png", null); Settings settings = Settings.getInstance(); --- 329,333 ---- */ public void start() { ! plash = new SplashWindow("splash.png", null); Settings settings = Settings.getInstance(); |
From: rimestad <rim...@us...> - 2005-11-17 11:14:06
|
Update of /cvsroot/bprocessor/gui/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1764 Added Files: splash.png splash.xcf Log Message: new splash screen for release --- NEW FILE: splash.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: splash.xcf --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2005-11-15 19:04:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5826/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java ToolFactory.java Added Files: SpaceTool.java Log Message: - Added SpaceTool to make the spacenames appear only when using the regular selection tool - Splitting of edges in Pencil --- NEW FILE: SpaceTool.java --- //--------------------------------------------------------------------------------- // $Id: SpaceTool.java,v 1.1 2005/11/15 19:04:10 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; import net.sourceforge.bprocessor.gl.GLView; /** * The SpaceTool */ public class SpaceTool extends SelectTool { /** * Construct the SpaceTool * @param glv The GLView * @param cursor The cursor */ public SpaceTool(GLView glv, Cursor cursor) { super(glv, cursor); } } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ToolFactory.java 14 Nov 2005 08:57:47 -0000 1.11 --- ToolFactory.java 15 Nov 2005 19:04:10 -0000 1.12 *************** *** 35,39 **** /** select tool */ ! private SelectTool select; /** move tool */ --- 35,39 ---- /** select tool */ ! private SpaceTool select; /** move tool */ *************** *** 74,78 **** but.setToolTipText("Clipping"); ! select = new SelectTool(glv, null); pencil = new PencilTool(glv, pencilcursor); move = new MoveTool(glv, null); --- 74,78 ---- but.setToolTipText("Clipping"); ! select = new SpaceTool(glv, null); pencil = new PencilTool(glv, pencilcursor); move = new MoveTool(glv, null); Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** PencilTool.java 7 Nov 2005 07:21:21 -0000 1.32 --- PencilTool.java 15 Nov 2005 19:04:10 -0000 1.33 *************** *** 148,151 **** --- 148,157 ---- edges = new ArrayList(); intern(vertex); + if (target != null) { + if (target instanceof Edge) { + Edge edge = (Edge) target; + edge.split(vertex); + } + } from = vertex; to = new Vertex("Mouse", vertex.getX(), vertex.getY(), vertex.getZ()); *************** *** 158,161 **** --- 164,169 ---- if (target instanceof Edge) { intern(vertex); + Edge edge = (Edge) target; + edge.split(vertex); } } |
From: Michael L. <he...@us...> - 2005-11-15 19:04:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5826/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: - Added SpaceTool to make the spacenames appear only when using the regular selection tool - Splitting of edges in Pencil Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** AbstractView.java 13 Nov 2005 13:16:15 -0000 1.55 --- AbstractView.java 15 Nov 2005 19:04:09 -0000 1.56 *************** *** 8,12 **** import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.tool.SelectTool; import net.sourceforge.bprocessor.gl.model.ClippingPlane; --- 8,12 ---- import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.tool.SpaceTool; import net.sourceforge.bprocessor.gl.model.ClippingPlane; *************** *** 302,306 **** gl.glLineWidth(1.0f); grid(); ! gl.glLineWidth(3.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LESS); --- 302,306 ---- gl.glLineWidth(1.0f); grid(); ! gl.glLineWidth(2.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LESS); *************** *** 337,341 **** gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); ! if (glv.getTool() instanceof SelectTool) { gl.glMatrixMode(GL.GL_PROJECTION); gl.glPushMatrix(); --- 337,341 ---- gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); ! if (glv.getTool() instanceof SpaceTool) { gl.glMatrixMode(GL.GL_PROJECTION); gl.glPushMatrix(); *************** *** 1035,1039 **** Collection selection = glv.getTool().getSelection(); GL gl = gld.getGL(); - Iterator it = surfaces.iterator(); while (it.hasNext()) { --- 1035,1038 ---- |
From: Michael L. <he...@us...> - 2005-11-15 19:01:10
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5148/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: - Removed items from the menus - Implemented File -> New to clear the model - Changed layout of main window Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GUI.java 21 Oct 2005 08:42:47 -0000 1.9 --- GUI.java 15 Nov 2005 19:01:02 -0000 1.10 *************** *** 16,19 **** --- 16,20 ---- import net.sourceforge.bprocessor.gui.actions.FileExportActionListener; import net.sourceforge.bprocessor.gui.actions.FileImportActionListener; + import net.sourceforge.bprocessor.gui.actions.FileNewActionListener; import net.sourceforge.bprocessor.gui.actions.FilePropertiesActionListener; import net.sourceforge.bprocessor.gui.actions.ToolsDetachActionListener; *************** *** 56,60 **** /** The middle/right split pane */ ! private JSplitPane splitPaneMiddleRight; /** The splash */ --- 57,61 ---- /** The middle/right split pane */ ! private JSplitPane splitPaneTopDown; /** The splash */ *************** *** 106,111 **** JMenuItem fileNew = new JMenuItem("New"); fileNew.setMnemonic(KeyEvent.VK_N); ! fileNew.setEnabled(false); file.add(fileNew); --- 107,113 ---- JMenuItem fileNew = new JMenuItem("New"); + fileNew.addActionListener(new FileNewActionListener()); fileNew.setMnemonic(KeyEvent.VK_N); ! fileNew.setEnabled(true); file.add(fileNew); *************** *** 208,211 **** --- 210,214 ---- createElement.setMnemonic(KeyEvent.VK_E); createElement.addActionListener(new CreateElementActionListener()); + createElement.setEnabled(false); create.add(createElement); *************** *** 213,216 **** --- 216,220 ---- createPart.setMnemonic(KeyEvent.VK_P); createPart.addActionListener(new CreatePartActionListener()); + createPart.setEnabled(false); create.add(createPart); *************** *** 218,221 **** --- 222,226 ---- createSurface.setMnemonic(KeyEvent.VK_S); createSurface.addActionListener(new CreateSurfaceActionListener()); + createSurface.setEnabled(false); create.add(createSurface); *************** *** 229,238 **** toolsJoin.setMnemonic(KeyEvent.VK_J); toolsJoin.addActionListener(new ToolsJoinActionListener()); ! tools.add(toolsJoin); JMenuItem toolsDetach = new JMenuItem("Detach"); toolsDetach.setMnemonic(KeyEvent.VK_D); toolsDetach.addActionListener(new ToolsDetachActionListener()); ! tools.add(toolsDetach); menu.registerMenu(tools); --- 234,243 ---- toolsJoin.setMnemonic(KeyEvent.VK_J); toolsJoin.addActionListener(new ToolsJoinActionListener()); ! //tools.add(toolsJoin); JMenuItem toolsDetach = new JMenuItem("Detach"); toolsDetach.setMnemonic(KeyEvent.VK_D); toolsDetach.addActionListener(new ToolsDetachActionListener()); ! //tools.add(toolsDetach); menu.registerMenu(tools); *************** *** 279,289 **** */ public void createMainView() { ! splitPaneMiddleRight = new JSplitPane(); ! splitPaneMiddleRight.setLeftComponent(new JPanel()); ! splitPaneMiddleRight.setRightComponent(new JPanel()); splitPaneLeftRight = new JSplitPane(); ! splitPaneLeftRight.setLeftComponent(new JPanel()); ! splitPaneLeftRight.setRightComponent(splitPaneMiddleRight); getContentPane().setLayout(new BorderLayout()); --- 284,295 ---- */ public void createMainView() { ! splitPaneTopDown = new JSplitPane(JSplitPane.VERTICAL_SPLIT); ! splitPaneTopDown.setTopComponent(new JPanel()); ! splitPaneTopDown.setBottomComponent(new JPanel()); ! splitPaneTopDown.setDividerLocation(460); splitPaneLeftRight = new JSplitPane(); ! splitPaneLeftRight.setRightComponent(new JPanel()); ! splitPaneLeftRight.setLeftComponent(splitPaneTopDown); getContentPane().setLayout(new BorderLayout()); *************** *** 308,319 **** public void registerPanel(Component panel, Integer placement) { if (placement.equals(SPLIT_LEFT)) { ! splitPaneLeftRight.remove(1); ! splitPaneLeftRight.setLeftComponent(new JScrollPane(panel)); } else if (placement.equals(SPLIT_MIDDLE)) { ! splitPaneMiddleRight.remove(1); ! splitPaneMiddleRight.setLeftComponent(panel); } else { ! splitPaneMiddleRight.remove(2); ! splitPaneMiddleRight.setRightComponent(new JScrollPane(panel)); } } --- 314,325 ---- public void registerPanel(Component panel, Integer placement) { if (placement.equals(SPLIT_LEFT)) { ! //splitPaneTopDown.remove(1); ! splitPaneTopDown.setTopComponent(new JScrollPane(panel)); } else if (placement.equals(SPLIT_MIDDLE)) { ! //splitPaneLeftRight.remove(1); ! splitPaneLeftRight.setRightComponent(panel); } else { ! //splitPaneTopDown.remove(2); ! splitPaneTopDown.setBottomComponent(new JScrollPane(panel)); } } *************** *** 328,332 **** settings.load(); ! setSize(800, 600); } --- 334,338 ---- settings.load(); ! setSize(1024, 768); } |
From: Michael L. <he...@us...> - 2005-11-15 19:01:10
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5148/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: - Removed items from the menus - Implemented File -> New to clear the model - Changed layout of main window Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AttributeView.java 2 Oct 2005 14:37:10 -0000 1.6 --- AttributeView.java 15 Nov 2005 19:01:02 -0000 1.7 *************** *** 17,20 **** --- 17,21 ---- import net.sourceforge.bprocessor.model.Surface; + import java.awt.Dimension; import java.awt.GridLayout; import java.lang.reflect.Method; *************** *** 47,51 **** addTab("Attributes", ap); ! Notifier.getInstance().addListener(this); } --- 48,52 ---- addTab("Attributes", ap); ! setPreferredSize(new Dimension(200, 324)); Notifier.getInstance().addListener(this); } |
From: Michael L. <he...@us...> - 2005-11-15 19:01:10
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5148/src/net/sourceforge/bprocessor/gui/actions Added Files: FileNewActionListener.java Log Message: - Removed items from the menus - Implemented File -> New to clear the model - Changed layout of main window --- NEW FILE: FileNewActionListener.java --- //--------------------------------------------------------------------------------- // $Id: FileNewActionListener.java,v 1.1 2005/11/15 19:01:02 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.actions; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sourceforge.bprocessor.model.Project; /** * The FileNewActionListener */ public class FileNewActionListener implements ActionListener { /** * Constructs the FileNewActionListner */ public FileNewActionListener() { super(); } /** * Clears the project * @param event The event */ public void actionPerformed(ActionEvent event) { Project.getInstance().clear(); } } |
From: Michael L. <he...@us...> - 2005-11-15 18:58:38
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4391/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Geometry.java MemoryFacade.java SQLFacade.java Project.java DatabaseFacade.java Log Message: - Improved calculation of surface-normals - Splitting edges and surfaces - Improved finding of new surfaces Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Surface.java 13 Nov 2005 11:43:07 -0000 1.44 --- Surface.java 15 Nov 2005 18:58:30 -0000 1.45 *************** *** 268,271 **** --- 268,316 ---- } + /** + * Replace the edge with the edges + * @param edge The original edge + * @param e1 The first new edge to insert + * @param e2 The second new edge to insert + */ + public void replace(Edge edge, Edge e1, Edge e2) { + List lst = new ArrayList(); + Edge[] edges = new Edge[getEdges().size()]; + getEdges().toArray(edges); + + for (int i = 0; i < edges.length; i++) { + Edge current = edges[i]; + if (current == edge) { + if (i == 0) { + if (edges.length == 1) { + lst.add(e1); + lst.add(e2); + } else { + Edge next = edges[i + 1]; + if (next.contains(current.getFrom())) { + lst.add(e2); + lst.add(e1); + } else { + lst.add(e1); + lst.add(e2); + } + } + } else { + Edge previous = edges[i - 1]; + if (previous.contains(current.getTo())) { + lst.add(e2); + lst.add(e1); + } else { + lst.add(e1); + lst.add(e2); + } + } + } else { + lst.add(current); + } + } + setEdges(lst); + } + /** * Calculate the turn direction of the vertices of this *************** *** 292,317 **** */ public double angle(CoordinateSystem coordinateSystem) { ! List vertexlist = getVertices(); ! ! vertexlist = coordinateSystem.translate(vertexlist); ! ! vertexlist.remove(vertexlist.size() - 1); ! Vertex first = (Vertex) vertexlist.get(0); ! Vertex last = (Vertex) vertexlist.get(vertexlist.size() - 1); ! vertexlist.add(first); ! vertexlist.add(0, last); ! Vertex[] vertices = new Vertex[vertexlist.size()]; ! vertexlist.toArray(vertices); ! ! double tetra = 0.0; ! for (int i = 1; i <= (vertices.length - 2); i++) { ! double dxi = vertices[i + 1].getX() - vertices[i].getX(); ! double dxi1 = vertices[i].getX() - vertices[i - 1].getX(); ! double dyi = vertices[i + 1].getY() - vertices[i].getY(); ! double dyi1 = vertices[i].getY() - vertices[i - 1].getY(); ! double tetrai = Math.atan2((dxi * dyi1 - dxi1 * dyi), (dxi * dxi1 + dyi * dyi1)); ! tetra += tetrai; ! } ! return tetra; } --- 337,343 ---- */ public double angle(CoordinateSystem coordinateSystem) { ! List vertices = getVertices(); ! vertices = coordinateSystem.translate(vertices); ! return Geometry.angle(vertices); } *************** *** 663,667 **** * @return A vector normal for this surface, null if the surface consists of only one edge */ ! public Vertex normal() { if (edges.size() > 1) { Edge e1 = (Edge)edges.get(0); --- 689,693 ---- * @return A vector normal for this surface, null if the surface consists of only one edge */ ! public Vertex normal1() { if (edges.size() > 1) { Edge e1 = (Edge)edges.get(0); *************** *** 688,691 **** --- 714,726 ---- return null; } + + /** + * Returns the outward pointing normal to this Surface + * @return A vector normal for this surface, null if the surface consists of only one edge + */ + + public Vertex normal() { + return Geometry.normal(getVertices()); + } /** Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Edge.java 21 Oct 2005 11:56:27 -0000 1.16 --- Edge.java 15 Nov 2005 18:58:30 -0000 1.17 *************** *** 11,15 **** import org.apache.log4j.Logger; - import java.util.HashSet; import java.util.Iterator; --- 11,14 ---- *************** *** 284,287 **** --- 283,302 ---- * TODO to split this edge by the vertex */ + + Vertex from = getFrom(); + Vertex to = getTo(); + Edge e1 = new Edge("", from, vertex); + Project.getInstance().intern(e1); + Edge e2 = new Edge("", vertex, to); + Project.getInstance().intern(e2); + + + Set surfaces = getSurfaces(); + Iterator iter = surfaces.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + current.replace(this, e1, e2); + } + Project.getInstance().remove(this); } Index: MemoryFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/MemoryFacade.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MemoryFacade.java 28 Oct 2005 10:42:00 -0000 1.3 --- MemoryFacade.java 15 Nov 2005 18:58:30 -0000 1.4 *************** *** 319,321 **** --- 319,331 ---- return result; } + + /** + * Clear the DataBase + */ + public void clear() { + domains.clear(); + edges.clear(); + surfaces.clear(); + vertices.clear(); + } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Project.java 5 Oct 2005 08:05:36 -0000 1.4 --- Project.java 15 Nov 2005 18:58:30 -0000 1.5 *************** *** 40,44 **** return instance; } ! /** * Intern an attribute --- 40,49 ---- return instance; } ! /** ! * Clear all objects ! */ ! public void clear() { ! DatabaseFacade.getInstance().clear(); ! } /** * Intern an attribute Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Geometry.java 24 Oct 2005 10:25:47 -0000 1.3 --- Geometry.java 15 Nov 2005 18:58:30 -0000 1.4 *************** *** 22,25 **** --- 22,121 ---- /** + * Calculate the normal that points outwards + * @param vertices The vertices describing a planar polygon + * @return The outwards pointing normal + */ + public static Vertex normal(List vertices) { + Vertex normal = normal0(vertices); + Vertex origin = (Vertex) vertices.get(0); + Vertex a = (Vertex) vertices.get(1); + Vertex i = a.minus(origin); + Vertex j = normal.cross(i); + CoordinateSystem system = new CoordinateSystem(i, j, normal, origin); + List projection = system.translate(vertices); + double tetra = angle(projection); + if (tetra > 0) { + normal.scale(-1); + } + return normal; + } + + /** + * Calculate some normal vector + * @param vertices The vertices describing a planar polygon + * @return A normal vector + */ + public static Vertex normal0(List vertices) { + if (vertices.size() < 2) { + return null; + } else { + Vertex a = (Vertex) vertices.get(0); + Vertex b = (Vertex) vertices.get(1); + Vertex v1 = b.minus(a); + for (int i = 2; i < vertices.size(); i++) { + Vertex c = (Vertex) vertices.get(i); + Vertex v2 = c.minus(b); + Vertex normal = v1.cross(v2); + if (!normal.isZero()) { + return normal; + } + } + } + return null; + } + + /** + * Calculate the projection of the vertices into the + * specified plane. + * @param vertices The vertices to project + * @param origin The origin of the plane + * @param normal The normal to the plane + * @return The projection + */ + public static List projection(List vertices, Vertex origin, Vertex normal) { + List projection = new ArrayList(); + + // TODO The following projection calculation should + // be done using a plane. + + for (int i = 0; i < vertices.size(); i++) { + Vertex current = (Vertex) vertices.get(i); + Vertex v = current.minus(origin); + double t = v.dot(normal); + Vertex up = normal.copy(); + up.scale(t); + projection.add(v.minus(up)); + } + return projection; + } + + /** + * Calculate the turn angle of the vertices, which + * are assumed to be 2d (z is ignored). + * @param vertices The vertices to calculate the turn angle for + * @return The turn angle + */ + public static double angle(List vertices) { + vertices.remove(vertices.size() - 1); + Vertex first = (Vertex) vertices.get(0); + Vertex last = (Vertex) vertices.get(vertices.size() - 1); + vertices.add(first); + vertices.add(0, last); + Vertex[] vertexarray = new Vertex[vertices.size()]; + vertices.toArray(vertexarray); + + double tetra = 0.0; + for (int i = 1; i <= (vertexarray.length - 2); i++) { + double dxi = vertexarray[i + 1].getX() - vertexarray[i].getX(); + double dxi1 = vertexarray[i].getX() - vertexarray[i - 1].getX(); + double dyi = vertexarray[i + 1].getY() - vertexarray[i].getY(); + double dyi1 = vertexarray[i].getY() - vertexarray[i - 1].getY(); + double tetrai = Math.atan2((dxi * dyi1 - dxi1 * dyi), (dxi * dxi1 + dyi * dyi1)); + tetra += tetrai; + } + return tetra; + } + + /** * Insert the list of edges in the model by splitting * surfaces etc. *************** *** 29,34 **** --- 125,145 ---- Edge first = (Edge) edges.get(0); + Vertex from = first.getFrom(); Edge last = (Edge) edges.get(edges.size() - 1); Vertex to = last.getTo(); + Surface exterior = null; + { + Set fromSurfaces = from.getSurfaces(); + Set toSurfaces = to.getSurfaces(); + Iterator it = fromSurfaces.iterator(); + while (it.hasNext()) { + Surface current = (Surface) it.next(); + if (toSurfaces.contains(current)) { + exterior = current; + } + } + } + + System.out.println("exterior = " + exterior); Set siblings = to.getEdges(); *************** *** 39,52 **** Edge current = (Edge) siblings.iterator().next(); CoordinateSystem system = CoordinateSystem.create(last, current); if (system != null) { VertexNode node = new VertexNode(to, system); EdgeNode lastEdgeNode = node.insert(last); ! siblings = node.insert(siblings); ! node.sort(); ! findSurfaces(node, lastEdgeNode, edges); ! } else { ! siblings.remove(current); } } } --- 150,166 ---- Edge current = (Edge) siblings.iterator().next(); CoordinateSystem system = CoordinateSystem.create(last, current); + siblings.remove(current); if (system != null) { VertexNode node = new VertexNode(to, system); EdgeNode lastEdgeNode = node.insert(last); ! if (lastEdgeNode != null) { ! node.insert(current); ! siblings = node.insert(siblings); ! node.sort(); ! findSurfaces(node, lastEdgeNode, edges, exterior); ! } } } + } *************** *** 57,62 **** * @param last The first EdgeNode * @param edges The edges */ ! private static void findSurfaces(VertexNode vertex, EdgeNode last, List edges) { { Surface clockwise = clockwiseSurface(vertex, last, edges); --- 171,178 ---- * @param last The first EdgeNode * @param edges The edges + * @param exterior The exterior */ ! private static void findSurfaces(VertexNode vertex, EdgeNode last, List edges, Surface exterior) { ! int count = 0; { Surface clockwise = clockwiseSurface(vertex, last, edges); *************** *** 64,67 **** --- 180,184 ---- if (clockwise.angle(vertex.system()) < 0) { Project.getInstance().intern(clockwise); + count++; } } *************** *** 72,78 **** --- 189,201 ---- if (counterclockwise.angle(vertex.system()) > 0) { Project.getInstance().intern(counterclockwise); + count++; } } } + if (exterior != null) { + if (count == 2) { + Project.getInstance().remove(exterior); + } + } } *************** *** 187,191 **** Vertex v = edge.otherVertex(vertex).minus(vertex); double dz = v.dot(system.getN()); ! if (dz == 0.0) { double dx = v.dot(system.getI()); double dy = v.dot(system.getJ()); --- 310,314 ---- Vertex v = edge.otherVertex(vertex).minus(vertex); double dz = v.dot(system.getN()); ! if (Math.abs(dz) < 0.00000001) { double dx = v.dot(system.getI()); double dy = v.dot(system.getJ()); Index: DatabaseFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DatabaseFacade.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DatabaseFacade.java 11 Oct 2005 12:04:51 -0000 1.3 --- DatabaseFacade.java 15 Nov 2005 18:58:30 -0000 1.4 *************** *** 160,162 **** --- 160,167 ---- */ public abstract Vertex findVertexById(Long id); + + /** + * Clear the database + */ + public abstract void clear(); } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Vertex.java 7 Oct 2005 05:52:48 -0000 1.14 --- Vertex.java 15 Nov 2005 18:58:30 -0000 1.15 *************** *** 201,204 **** --- 201,218 ---- /** + * Return the surfaces connected to this vertex + * @return The connected surfaces + */ + public Set getSurfaces() { + Set result = new HashSet(); + Set edges = getEdges(); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + result.addAll(current.getSurfaces()); + } + return result; + } + /** * Return a copy of this Vertex * @return The copy *************** *** 317,320 **** --- 331,342 ---- /** + * Is this a zero vector? + * @return True if this is a zero vector + */ + public boolean isZero() { + return (length() < 0.0000001); + } + + /** * Moves the Vertex a distance * @param dx The x distance Index: SQLFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SQLFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SQLFacade.java 6 Oct 2005 08:20:32 -0000 1.1 --- SQLFacade.java 15 Nov 2005 18:58:30 -0000 1.2 *************** *** 234,236 **** --- 234,242 ---- return VertexFacade.getInstance().findById(id); } + + /** + * Clear the DataBase + */ + public void clear() { + } } |
From: rimestad <rim...@us...> - 2005-11-14 11:20:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31842 Modified Files: SelectTool.java Log Message: running selection Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** SelectTool.java 14 Nov 2005 11:19:22 -0000 1.40 --- SelectTool.java 14 Nov 2005 11:20:15 -0000 1.41 *************** *** 65,69 **** findTarget(e); glv.getView().makeTarget(target); - target = null; } --- 65,68 ---- |
From: rimestad <rim...@us...> - 2005-11-14 11:19:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31610 Modified Files: SelectTool.java Log Message: running selection Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** SelectTool.java 7 Nov 2005 07:21:21 -0000 1.39 --- SelectTool.java 14 Nov 2005 11:19:22 -0000 1.40 *************** *** 63,67 **** */ protected void moved(MouseEvent e) { ! //findTarget(e); target = null; } --- 63,68 ---- */ protected void moved(MouseEvent e) { ! findTarget(e); ! glv.getView().makeTarget(target); target = null; } *************** *** 72,77 **** */ protected void dragged(MouseEvent e) { ! //findTarget(e); ! target = null; } --- 73,78 ---- */ protected void dragged(MouseEvent e) { ! findTarget(e); ! glv.getView().makeTarget(target); } |
From: Nikolaj B. <nbr...@us...> - 2005-11-14 11:17:35
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31260 Modified Files: build.sh Log Message: Added quotes around var in build.sh Index: build.sh =================================================================== RCS file: /cvsroot/bprocessor/build/build.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build.sh 26 Oct 2005 09:13:01 -0000 1.2 --- build.sh 14 Nov 2005 11:17:24 -0000 1.3 *************** *** 1,5 **** #!/bin/sh ! if [ -z $ANT_HOME ]; then echo "Please set the ANT_HOME variable." exit 1 --- 1,5 ---- #!/bin/sh ! if [ -z "$ANT_HOME" ]; then echo "Please set the ANT_HOME variable." exit 1 |
From: rimestad <rim...@us...> - 2005-11-14 09:01:07
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3422 Modified Files: Bcursorpen1.gif Bcursorpen2.gif Log Message: small transparency change Index: Bcursorpen1.gif =================================================================== RCS file: /cvsroot/bprocessor/gl/src/gfx/Bcursorpen1.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsocsYI3 and /tmp/cvsLhyaVQ differ Index: Bcursorpen2.gif =================================================================== RCS file: /cvsroot/bprocessor/gl/src/gfx/Bcursorpen2.gif,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvswx0jXl and /tmp/cvssNo7ha differ |
From: rimestad <rim...@us...> - 2005-11-14 08:57:58
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2690/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Log Message: change of icons Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ToolFactory.java 7 Nov 2005 07:21:21 -0000 1.10 --- ToolFactory.java 14 Nov 2005 08:57:47 -0000 1.11 *************** *** 56,63 **** ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("drawicon.png"); Image pencilimage = Toolkit.getDefaultToolkit().getImage(url); Cursor pencilcursor ! = Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(1, 15), "Pencil"); --- 56,63 ---- ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Bcursorpen1.gif"); Image pencilimage = Toolkit.getDefaultToolkit().getImage(url); Cursor pencilcursor ! = Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil"); *************** *** 139,143 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("selecticon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 139,143 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconselecttool.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); *************** *** 169,173 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("moveicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 169,173 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconmovetool.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); *************** *** 197,201 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("extrudeicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 197,201 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconextrudetool.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); *************** *** 229,233 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("drawicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 229,233 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconpentool.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); |
From: rimestad <rim...@us...> - 2005-11-14 08:57:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2690/src/net/sourceforge/bprocessor/gl/view Modified Files: ViewFactory.java Log Message: change of icons Index: ViewFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewFactory.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ViewFactory.java 16 Sep 2005 12:09:07 -0000 1.7 --- ViewFactory.java 14 Nov 2005 08:57:48 -0000 1.8 *************** *** 214,218 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("wireframeicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 214,218 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconwire.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); *************** *** 243,247 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("solidicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 243,247 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconsolid.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); *************** *** 272,276 **** this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("lightingicon.png"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); --- 272,276 ---- this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconlight.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); |
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2513 Added Files: Bcursorpen1.gif Bcursorpen2.gif Bicondrag.gif Biconextrudetool.gif Biconfly.gif Biconfow.gif Biconlight.gif Biconmovetool.gif Biconpentool.gif Biconrotaxe.gif Biconrotcam.gif Biconrotobj.gif Biconselecttool.gif Biconsolid.gif Biconwalk.gif Biconwire.gif Biconzomeall.gif Biconzomeinout.gif Biconzomeobj.gif Biconzomeselect.gif Log Message: initial import of icons --- NEW FILE: Biconmovetool.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconlight.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconfow.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconpentool.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconrotaxe.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconrotobj.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconzomeobj.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconextrudetool.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconsolid.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconzomeselect.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconfly.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Bcursorpen1.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconzomeinout.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Bcursorpen2.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconrotcam.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconwire.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconzomeall.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconselecttool.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Bicondrag.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Biconwalk.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2005-11-13 13:16:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10708/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Improved hitdetection of edges Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** AbstractView.java 6 Nov 2005 16:33:44 -0000 1.54 --- AbstractView.java 13 Nov 2005 13:16:15 -0000 1.55 *************** *** 882,885 **** --- 882,886 ---- gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Edge) { + gl.glDisable(GL.GL_DEPTH_TEST); Edge e = (Edge) o; Vertex to = e.getTo(); *************** *** 889,892 **** --- 890,894 ---- gl.glVertex3d(from.getX(), from.getY(), from.getZ()); gl.glEnd(); + gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); *************** *** 1247,1250 **** --- 1249,1253 ---- Set vertices = new HashSet(); + Set edges = new HashSet(); for (int i = 0; i < hits; i++) { *************** *** 1262,1265 **** --- 1265,1270 ---- if (current instanceof Vertex) { vertices.add(current); + } else if (current instanceof Edge) { + edges.add(current); } if (near < nearest) { *************** *** 1278,1297 **** Surface surface = (Surface) closest; CoordinateSystem system = surface.coordinateSystem(); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! // TODO Find the clost point measured as XY distance in ! // the closest surface ! Vertex v = (Vertex) iter.next(); ! // Test if v is in the same plane as the closest surface ! Vertex vv = system.translate(v); ! if (Math.abs(vv.getZ()) < 0.0000000001) { ! return v; ! } else { ! System.out.println("vv = " + vv); } } } if (closest instanceof Edge) { --- 1283,1328 ---- Surface surface = (Surface) closest; CoordinateSystem system = surface.coordinateSystem(); ! ! // Look for a Vertex ! { ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! // TODO Find the clost point measured as XY distance in ! // the closest surface ! Vertex v = (Vertex) iter.next(); ! // Test if v is in the same plane as the closest surface ! Vertex vLocal = system.translate(v); ! if (Math.abs(vLocal.getZ()) < 0.0000000001) { ! return v; ! } } } + // Look for an Edge + { + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + // TODO Find the two closest edges measured as XY distance in + // the closest surface + Edge e = (Edge) iter.next(); + Vertex from = e.getFrom(); + Vertex to = e.getTo(); + if (vertices.contains(from)) { + return from; + } + if (vertices.contains(to)) { + return to; + } + // Test if from and to are in the same plane as the closest surface + Vertex fromLocal = system.translate(from); + Vertex toLocal = system.translate(to); + if ((Math.abs(fromLocal.getZ()) < 0.0000000001) + && (Math.abs(toLocal.getZ()) < 0.0000000001)) { + return e; + } + } + } } if (closest instanceof Edge) { |
From: Michael L. <he...@us...> - 2005-11-13 11:44:22
|
Update of /cvsroot/bprocessor/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26809 Modified Files: .classpath Log Message: Index: .classpath =================================================================== RCS file: /cvsroot/bprocessor/kernel/.classpath,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .classpath 10 Aug 2005 12:37:34 -0000 1.1 --- .classpath 13 Nov 2005 11:44:15 -0000 1.2 *************** *** 6,9 **** <classpathentry kind="lib" path="/tools/jaxb/jaxb.jar"/> <classpathentry kind="lib" path="build"/> ! <classpathentry kind="output" path="build"/> </classpath> --- 6,9 ---- <classpathentry kind="lib" path="/tools/jaxb/jaxb.jar"/> <classpathentry kind="lib" path="build"/> ! <classpathentry kind="output" path="bin"/> </classpath> |
From: Michael L. <he...@us...> - 2005-11-13 11:43:17
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26677/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Center of gravity checks for duplicate first and last point Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Surface.java 28 Oct 2005 13:30:11 -0000 1.43 --- Surface.java 13 Nov 2005 11:43:07 -0000 1.44 *************** *** 242,259 **** List vertices = this.getVertices(); if (vertices.size() > 0) { ! double x = 0; ! double y = 0; ! double z = 0; ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! x += current.getX(); ! y += current.getY(); ! z += current.getZ(); } - x = x / (double) vertices.size(); - y = y / (double) vertices.size(); - z = z / (double) vertices.size(); - return new Vertex("center of " + getName(), x, y, z); } else { return null; --- 242,266 ---- List vertices = this.getVertices(); if (vertices.size() > 0) { ! if (vertices.get(0) == vertices.get(vertices.size() - 1)) { ! vertices.remove(vertices.size() - 1); ! } ! if (vertices.size() > 0) { ! double x = 0; ! double y = 0; ! double z = 0; ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! x += current.getX(); ! y += current.getY(); ! z += current.getZ(); ! } ! x = x / (double) vertices.size(); ! y = y / (double) vertices.size(); ! z = z / (double) vertices.size(); ! return new Vertex("center of " + getName(), x, y, z); ! } else { ! return null; } } else { return null; |
From: Nordholt <nor...@us...> - 2005-11-07 19:22:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14730 Modified Files: ExtrusionTool.java Log Message: Extrusion can be adjusted by typing in a length (weird bug when typing in 1011 though) Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ExtrusionTool.java 7 Nov 2005 07:21:21 -0000 1.25 --- ExtrusionTool.java 7 Nov 2005 19:22:19 -0000 1.26 *************** *** 24,27 **** --- 24,28 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.awt.event.KeyEvent; import java.util.ArrayList; *************** *** 63,66 **** --- 64,70 ---- /** The set of surfaces created from the inner surfaces */ private Set innerExSurfs; + + /** The length typed in for length of the extrusion*/ + private String number; /** *************** *** 72,76 **** super(glv, cursor); } - /** * Invoked when the mouse is held pressed and moved --- 76,79 ---- *************** *** 96,126 **** Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! normal.scale(normDotDelta / (normal.length() * normal.length())); ! List l = dragSurface.getVertices(); ! //moving the dragged surface along its normal vector ! for (int count = 0; l != null && count < l.size() - 1; count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! //also moving any inner surfaces ! Set innerSurfaces = dragSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! List verticies = innerSurf.getVertices(); ! for (int count = 0; verticies != null && count < verticies.size() - 1; count++) { ! Vertex v = (Vertex)verticies.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! } ! } ! if (extrusion != null) { ! glv.setLength(extrusion.getLength()); ! } } } --- 99,103 ---- Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! moveDelta(normDotDelta); } } *************** *** 128,132 **** prevY = e.getY(); } ! /** * Invoked when a mouse button has been pressed on a component. --- 105,145 ---- prevY = e.getY(); } ! /** ! * Moves the extrusion a given offset in the direction of the normal. ! * @param delta the offset. ! */ ! private void moveDelta(double delta) { ! if (dragSurface != null) { ! Vertex normal = dragSurface.normal(); ! normal.scale(1 / normal.length()); ! normal.scale(delta / (normal.length() * normal.length())); ! List l = dragSurface.getVertices(); ! //moving the dragged surface along its normal vector ! for (int count = 0; l != null && count < l.size() - 1; count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! //also moving any inner surfaces ! Set innerSurfaces = dragSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! List verticies = innerSurf.getVertices(); ! for (int count = 0; verticies != null && count < verticies.size() - 1; count++) { ! Vertex v = (Vertex)verticies.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! } ! } ! if (extrusion != null) { ! glv.setLength(extrusion.getLength()); ! } ! } ! } /** * Invoked when a mouse button has been pressed on a component. *************** *** 134,140 **** */ protected void pressed(MouseEvent e) { - super.pressed(e); prevX = e.getX(); prevY = e.getY(); if (target instanceof Surface) { --- 147,160 ---- */ protected void pressed(MouseEvent e) { prevX = e.getX(); prevY = e.getY(); + dragSurface = null; + extrusion = null; + extrudeSurface = null; + extrudedSurfaces = null; + dragplane = null; + number = ""; + glv.setLength(0); + super.pressed(e); if (target instanceof Surface) { *************** *** 158,163 **** protected void released(MouseEvent e) { super.released(e); ! ! //this is when no surfaces is selected if (extrudeSurface == null) { return; --- 178,190 ---- protected void released(MouseEvent e) { super.released(e); ! spaceAssignment(); ! } ! ! /** ! * Does appropriate space assignments for the current extrusion. Does ! * Nothing if nothing has been extruded. ! */ ! private void spaceAssignment() { ! //this is when nothing is extruded if (extrudeSurface == null) { return; *************** *** 191,198 **** } } - dragSurface = null; - extrusion = null; - extrudeSurface = null; - extrudedSurfaces = null; } --- 218,221 ---- *************** *** 385,387 **** --- 408,477 ---- return top; } + + /** + * Invoked when a key has been pressed. + * @param e The KeyEvent + */ + public void keyPressed(KeyEvent e) { + /*a length can only be typed in if some surface is selected + for extrusion, and if the "number"-variable has been initialised + */ + if (dragSurface != null && number != null) { + if (number.equals("") && e.getKeyCode() == KeyEvent.VK_MINUS) { + number = "-"; + } else { + if (e.getKeyCode() == KeyEvent.VK_1) { + number += "1"; + } else if (e.getKeyCode() == KeyEvent.VK_2) { + number += "2"; + } else if (e.getKeyCode() == KeyEvent.VK_3) { + number += "3"; + } else if (e.getKeyCode() == KeyEvent.VK_4) { + number += "4"; + } else if (e.getKeyCode() == KeyEvent.VK_5) { + number += "5"; + } else if (e.getKeyCode() == KeyEvent.VK_6) { + number += "6"; + } else if (e.getKeyCode() == KeyEvent.VK_7) { + number += "7"; + } else if (e.getKeyCode() == KeyEvent.VK_8) { + number += "8"; + } else if (e.getKeyCode() == KeyEvent.VK_9) { + number += "9"; + } else if (e.getKeyCode() == KeyEvent.VK_0) { + number += "0"; + } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (!number.equals("")) { + double length = glv.getLength(); + double delta = extrusion.getLength() - length; + Vertex extrusionDir = extrusion.getFrom().minus(extrusion.getTo()); + Vertex normal = dragSurface.normal(); + normal.scale(1 / normal.length()); + if (normal.dot(extrusionDir) > 0) { + delta = 0 - delta; + } + moveDelta(delta); + glv.repaint(); + } + } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { + int length = number.length(); + if (length > 0) { + number = number.substring(0, length - 1); + } + } + } + + if (number.equals("-") || number.equals("")) { + glv.setLength(0); + } else { + try { + double d = Double.parseDouble(number); + glv.setLength(d / 1000); + } catch (NumberFormatException exp) { + log.warn(exp); + } + } + } + log.info("Number: " + number); + } } |
From: Michael L. <he...@us...> - 2005-11-07 07:21:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13611/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java AbstractTool.java PencilTool.java MoveTool.java ToolFactory.java ExtrusionTool.java ClipplaneTool.java SelectTool.java Log Message: Cursor added (currently only pencil has a cursor) Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MoveTool.java 27 Oct 2005 15:03:27 -0000 1.15 --- MoveTool.java 7 Nov 2005 07:21:21 -0000 1.16 *************** *** 16,19 **** --- 16,20 ---- import net.sourceforge.bprocessor.model.Surface; + import java.awt.Cursor; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; *************** *** 61,67 **** * The Constructor * @param glv The 3D canvas */ ! public MoveTool(GLView glv) { ! super(glv); } --- 62,69 ---- * The Constructor * @param glv The 3D canvas + * @param cursor The cursor */ ! public MoveTool(GLView glv, Cursor cursor) { ! super(glv, cursor); } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Tool.java 1 Nov 2005 07:36:09 -0000 1.9 --- Tool.java 7 Nov 2005 07:21:21 -0000 1.10 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.bprocessor.gl.tool; + import java.awt.Cursor; import java.awt.event.KeyListener; import java.awt.event.MouseListener; *************** *** 32,34 **** --- 33,43 ---- */ public Collection getSelection(); + + /** + * Getter for cursor + * @return The cursor + */ + public Cursor getCursor(); + + } Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClipplaneTool.java 6 Nov 2005 16:33:44 -0000 1.4 --- ClipplaneTool.java 7 Nov 2005 07:21:21 -0000 1.5 *************** *** 13,16 **** --- 13,17 ---- import net.sourceforge.bprocessor.model.Vertex; + import java.awt.Cursor; import java.awt.event.MouseEvent; *************** *** 28,34 **** * The Constructor * @param glv The 3D canvas */ ! public ClipplaneTool(GLView glv) { ! super(glv); } --- 29,36 ---- * The Constructor * @param glv The 3D canvas + * @param cursor The cursor */ ! public ClipplaneTool(GLView glv, Cursor cursor) { ! super(glv, cursor); } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ToolFactory.java 1 Nov 2005 07:36:09 -0000 1.9 --- ToolFactory.java 7 Nov 2005 07:21:21 -0000 1.10 *************** *** 12,15 **** --- 12,19 ---- import java.net.URL; + import java.awt.Cursor; + import java.awt.Image; + import java.awt.Point; + import java.awt.Toolkit; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; *************** *** 50,58 **** */ private ToolFactory(GLView glv) { ! select = new SelectTool(glv); ! pencil = new PencilTool(glv); ! move = new MoveTool(glv); ! extrusion = new ExtrusionTool(glv); ! clipplane = new ClipplaneTool(glv); Toolbar tb = Toolbar.getInstance(); --- 54,64 ---- */ private ToolFactory(GLView glv) { ! ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("drawicon.png"); ! Image pencilimage = Toolkit.getDefaultToolkit().getImage(url); ! Cursor pencilcursor ! = Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(1, 15), "Pencil"); ! Toolbar tb = Toolbar.getInstance(); *************** *** 68,71 **** --- 74,83 ---- but.setToolTipText("Clipping"); + select = new SelectTool(glv, null); + pencil = new PencilTool(glv, pencilcursor); + move = new MoveTool(glv, null); + extrusion = new ExtrusionTool(glv, null); + clipplane = new ClipplaneTool(glv, null); + Notifier.getInstance().addListener(select); } *************** *** 205,208 **** --- 217,224 ---- /** The GLView */ private GLView glv = null; + + /** The Cursor */ + + private Cursor cursor = null; /** *************** *** 216,219 **** --- 232,238 ---- ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); + Image image = Toolkit.getDefaultToolkit().getImage(url); + cursor = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0, 0), "Pencil"); + } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** SelectTool.java 4 Nov 2005 09:38:55 -0000 1.38 --- SelectTool.java 7 Nov 2005 07:21:21 -0000 1.39 *************** *** 23,26 **** --- 23,27 ---- import net.sourceforge.bprocessor.model.Space; + import java.awt.Cursor; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; *************** *** 51,57 **** * The constructor * @param glv The 3D canvas */ ! public SelectTool(GLView glv) { ! super(glv); } --- 52,59 ---- * The constructor * @param glv The 3D canvas + * @param cursor The cursor */ ! public SelectTool(GLView glv, Cursor cursor) { ! super(glv, cursor); } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ExtrusionTool.java 1 Nov 2005 16:22:26 -0000 1.24 --- ExtrusionTool.java 7 Nov 2005 07:21:21 -0000 1.25 *************** *** 22,25 **** --- 22,26 ---- import net.sourceforge.bprocessor.model.Plane; + import java.awt.Cursor; import java.awt.event.MouseEvent; *************** *** 66,72 **** * The Constructor * @param glv The 3D canvas */ ! public ExtrusionTool(GLView glv) { ! super(glv); } --- 67,74 ---- * The Constructor * @param glv The 3D canvas + * @param cursor The cursor */ ! public ExtrusionTool(GLView glv, Cursor cursor) { ! super(glv, cursor); } Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** PencilTool.java 4 Nov 2005 09:38:55 -0000 1.31 --- PencilTool.java 7 Nov 2005 07:21:21 -0000 1.32 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.bprocessor.gl.tool; + import java.awt.Cursor; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; *************** *** 73,79 **** * Constructor * @param glv The GLView */ ! public PencilTool(GLView glv) { ! super(glv); } --- 74,81 ---- * Constructor * @param glv The GLView + * @param cursor The cursor */ ! public PencilTool(GLView glv, Cursor cursor) { ! super(glv, cursor); } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** AbstractTool.java 1 Nov 2005 16:23:49 -0000 1.25 --- AbstractTool.java 7 Nov 2005 07:21:21 -0000 1.26 *************** *** 14,17 **** --- 14,18 ---- import net.sourceforge.bprocessor.gl.GLView; + import java.awt.Cursor; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; *************** *** 70,73 **** --- 71,79 ---- /** the object corresponding to the mouse */ protected Object target; + + /** The cursor associated with this tool */ + + protected Cursor cursor; + static { *************** *** 79,88 **** * KeyListener for the GL Canvas * @param glv The 3D canvas */ ! public AbstractTool(GLView glv) { this.glv = glv; timer.start(); moveAction = new CameraMoveTimer(this, glv); } /** --- 85,104 ---- * KeyListener for the GL Canvas * @param glv The 3D canvas + * @param cursor The cursor */ ! public AbstractTool(GLView glv, Cursor cursor) { this.glv = glv; + this.cursor = cursor; timer.start(); moveAction = new CameraMoveTimer(this, glv); } + + /** + * Getter for cursor + * @return The cursor + */ + public Cursor getCursor() { + return cursor; + } /** |
From: Michael L. <he...@us...> - 2005-11-07 07:21:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13611/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Cursor added (currently only pencil has a cursor) Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** GLView.java 4 Nov 2005 09:38:55 -0000 1.21 --- GLView.java 7 Nov 2005 07:21:21 -0000 1.22 *************** *** 25,28 **** --- 25,29 ---- import java.awt.Component; + import java.awt.Cursor; import java.awt.Dimension; import java.awt.BorderLayout; *************** *** 101,104 **** --- 102,112 ---- /** + * Set cursor + * @param cursor The cursor + */ + public void setCursor(Cursor cursor) { + glc.setCursor(cursor); + } + /** * Change the tool * @param mode The new tool *************** *** 113,116 **** --- 121,125 ---- glc.addMouseMotionListener(tool); glc.addKeyListener(tool); + setCursor(tool.getCursor()); } else { log.error("[changeMode] tool was null"); |
From: Michael L. <he...@us...> - 2005-11-06 16:33:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/src/net/sourceforge/bprocessor/gl/tool Modified Files: ClipplaneTool.java Log Message: Fixed some issues with clipping planes: - The ClipPlane are defined by a CoordinateSystem (which can return a plane) to make some calculations easier - The ClipPlane now always points away from camera when being defined. - The corners of the ClipPlane are calculated in local coordinates of the plane with a margin of 1 (meter) to better distinguish the plane from existing geometry. Then translated to global coordinates. - The ClipPlane are moved 0.001 (a millimeter) in the positive direction. - The edges of the ClipPlane are shown. - Clipping is turned off when drawing the 2d overlay (space names) - The modelview matrix is pushed after camera setup, which fixes a weird OpenGL lighting problem (involving clipplanes and the 2d overlay). Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClipplaneTool.java 4 Nov 2005 09:38:55 -0000 1.3 --- ClipplaneTool.java 6 Nov 2005 16:33:44 -0000 1.4 *************** *** 9,13 **** --- 9,15 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.ClippingPlane; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Vertex; import java.awt.event.MouseEvent; *************** *** 39,43 **** if (e.getButton() == MouseEvent.BUTTON1) { if (target instanceof Surface) { ! ClippingPlane cp = new ClippingPlane(((Surface)target).plane()); (glv.getView()).addClippingPlane(cp); } --- 41,60 ---- if (e.getButton() == MouseEvent.BUTTON1) { if (target instanceof Surface) { ! Surface surface = (Surface) target; ! CoordinateSystem system = surface.coordinateSystem(); ! Vertex n = system.getN(); ! Vertex i = system.getI(); ! Vertex j = system.getJ(); ! Vertex o = system.origin(); ! boolean front = glv.getView().facingFront(system); ! if (front) { ! n.scale(-1); ! } ! Vertex v = n.copy(); ! v.scale(0.001); ! o = o.add(v); ! system = new CoordinateSystem(i, j, n, o); ! ! ClippingPlane cp = new ClippingPlane(system); (glv.getView()).addClippingPlane(cp); } |
From: Michael L. <he...@us...> - 2005-11-06 16:33:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/src/net/sourceforge/bprocessor/gl/model Modified Files: ClippingPlane.java Log Message: Fixed some issues with clipping planes: - The ClipPlane are defined by a CoordinateSystem (which can return a plane) to make some calculations easier - The ClipPlane now always points away from camera when being defined. - The corners of the ClipPlane are calculated in local coordinates of the plane with a margin of 1 (meter) to better distinguish the plane from existing geometry. Then translated to global coordinates. - The ClipPlane are moved 0.001 (a millimeter) in the positive direction. - The edges of the ClipPlane are shown. - Clipping is turned off when drawing the 2d overlay (space names) - The modelview matrix is pushed after camera setup, which fixes a weird OpenGL lighting problem (involving clipplanes and the 2d overlay). Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/ClippingPlane.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClippingPlane.java 1 Nov 2005 07:31:19 -0000 1.1 --- ClippingPlane.java 6 Nov 2005 16:33:44 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- import java.util.ArrayList; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; *************** *** 29,32 **** --- 30,37 ---- /** The placement of the clippingplane */ private Plane plane; + + /** The coordinate sytem of the clipping plane */ + + private CoordinateSystem system; /** The corners */ *************** *** 35,42 **** /** * The constructor ! * @param plane The plane the clippingplane is represented by */ ! public ClippingPlane(Plane plane) { ! this.plane = plane; findCorners(); } --- 40,48 ---- /** * The constructor ! * @param system The coordinatesystem the clippingplane is represented by */ ! public ClippingPlane(CoordinateSystem system) { ! this.system = system; ! this.plane = system.plane(); findCorners(); } *************** *** 87,92 **** /** * Find the 4 corners among intersections ! */ public void findCorners() { log.info(plane); Collection c = findIntersections(); --- 93,140 ---- /** * Find the 4 corners among intersections ! */ ! public void findCorners() { + Collection c = findIntersections(); + Iterator it = c.iterator(); + double minX = Integer.MAX_VALUE; + double minY = Integer.MAX_VALUE; + double maxX = Integer.MIN_VALUE; + double maxY = Integer.MIN_VALUE; + while (it.hasNext()) { + Vertex v = (Vertex)it.next(); + v = system.translate(v); + if (v.getX() < minX) { + minX = v.getX(); + } + if (v.getX() > maxX) { + maxX = v.getX(); + } + if (v.getY() < minY) { + minY = v.getY(); + } + if (v.getY() > maxY) { + maxY = v.getY(); + } + } + Vertex v1 = new Vertex("", minX - 1, minY - 1, 0.0); + Vertex v2 = new Vertex("", minX - 1, maxY + 1, 0.0); + Vertex v3 = new Vertex("", maxX + 1, maxY + 1, 0.0); + Vertex v4 = new Vertex("", maxX + 1, minY - 1, 0.0); + v1 = system.unTranslate(v1); + v2 = system.unTranslate(v2); + v3 = system.unTranslate(v3); + v4 = system.unTranslate(v4); + corners = new ArrayList(); + corners.add(v1); + corners.add(v2); + corners.add(v3); + corners.add(v4); + } + + /** + * Find a lot of corners among intersections + */ + public void findManyCorners() { log.info(plane); Collection c = findIntersections(); |