bprocessor-commit Mailing List for B-processor (Page 153)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael L. <he...@us...> - 2005-11-06 16:33:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.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: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** AbstractView.java 4 Nov 2005 09:38:55 -0000 1.53 --- AbstractView.java 6 Nov 2005 16:33:44 -0000 1.54 *************** *** 275,278 **** --- 275,279 ---- */ public void display(GLDrawable gld) { + Plane xy = new Plane(0, 0, 1, 0); gl = gld.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); *************** *** 292,303 **** camera(gld); picking = 0; ! Iterator clipit = clippingPlanes.iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); ! } ! // grid and coords are always completely lit gl.glDisable(GL.GL_DEPTH_TEST); --- 293,301 ---- camera(gld); + gl.glPushMatrix(); picking = 0; ! ! // grid and coords are always completely lit gl.glDisable(GL.GL_DEPTH_TEST); *************** *** 310,317 **** // draw the clipping planes ! clipit = clippingPlanes.iterator(); gl.glEnable(GL.GL_POLYGON_STIPPLE); ! setTransparency(50); ! gl.glPolygonStipple(transparency); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); --- 308,315 ---- // draw the clipping planes ! ! Iterator clipit = clippingPlanes.iterator(); gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(highlight); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); *************** *** 330,333 **** --- 328,337 ---- gl.glLineWidth(1.0f); drawAll(gld); + + clipit = clippingPlanes.iterator(); + while (clipit.hasNext()) { + ClippingPlane cp = (ClippingPlane)clipit.next(); + gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); + } gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 335,338 **** --- 339,343 ---- if (glv.getTool() instanceof SelectTool) { gl.glMatrixMode(GL.GL_PROJECTION); + gl.glPushMatrix(); gl.glLoadIdentity(); if (mode[0] == GL.GL_SELECT) { *************** *** 342,349 **** glu.gluOrtho2D(0, width, 0, height); gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glLoadIdentity(); labelSelection(mode[0] == GL.GL_SELECT); } ! if (mode[0] == GL.GL_SELECT) { gl.glFlush(); --- 347,360 ---- glu.gluOrtho2D(0, width, 0, height); gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glPushMatrix(); ! gl.glLoadIdentity(); labelSelection(mode[0] == GL.GL_SELECT); + gl.glMatrixMode(GL.GL_PROJECTION); + gl.glPopMatrix(); + gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glPopMatrix(); + } ! gl.glPopMatrix(); if (mode[0] == GL.GL_SELECT) { gl.glFlush(); *************** *** 363,366 **** --- 374,378 ---- gl.glPushMatrix(); gl.glTranslated(x, y, 0.1); + gl.glRasterPos2i(0, 0); glut.glutBitmapString(gl, GLUT.BITMAP_HELVETICA_18, string); *************** *** 512,515 **** --- 524,529 ---- } + + if (clickable) { //Name must be "front" *************** *** 531,534 **** --- 545,549 ---- } //draw the front domain name + if (frontDomain instanceof FunctionalSpace) { gl.glColor3d(0.2 + fcb, 0.2 + fcb, 0.5 + fcb); *************** *** 538,541 **** --- 553,557 ---- gl.glColor3d(0.2 + fcb, 0.2 + fcb, 0.2 + fcb); } + drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); *************** *** 552,555 **** --- 568,572 ---- gl.glColor3d(0.2 + bcb, 0.2 + bcb, 0.2 + bcb); } + drawString(backTextAnchor.getX(), backTextAnchor.getY(), backName); *************** *** 582,586 **** private void drawClickBox(double x, double y, double z, int width, int height, String name) { ! pushName(gl, name); gl.glBegin(GL.GL_POLYGON); gl.glVertex3d(x, y, z); --- 599,603 ---- private void drawClickBox(double x, double y, double z, int width, int height, String name) { ! pushName(gl, name); gl.glBegin(GL.GL_POLYGON); gl.glVertex3d(x, y, z); *************** *** 803,807 **** ClippingPlane cp = (ClippingPlane)it.next(); pushName(gl, cp); ! drawClipplane(cp); popName(gl); } --- 820,824 ---- ClippingPlane cp = (ClippingPlane)it.next(); pushName(gl, cp); ! //drawClipplane(cp); popName(gl); } *************** *** 815,831 **** */ private void drawClipplane(ClippingPlane clipplane) { ! gl.glColor3fv(CLIP_PLANE_COLOR); double[] d = clipplane.getPlane().getDoublev(); - gl.glBegin(GL.GL_QUADS); - gl.glNormal3d(d[0], d[1], d[2]); Collection corners = clipplane.getCorners(); ! Iterator it = corners.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); } - gl.glEnd(); } --- 832,868 ---- */ private void drawClipplane(ClippingPlane clipplane) { ! double[] d = clipplane.getPlane().getDoublev(); Collection corners = clipplane.getCorners(); ! { ! gl.glColor3fv(CLIP_PLANE_COLOR); ! gl.glBegin(GL.GL_QUADS); ! gl.glNormal3d(d[0], d[1], d[2]); ! Iterator it = corners.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! gl.glVertex3d(v.getX(), ! v.getY(), ! v.getZ()); ! } ! gl.glEnd(); ! } ! { ! gl.glColor3fv(CLIP_PLANE_COLOR); ! gl.glLineWidth(2.0f); ! gl.glBegin(GL.GL_LINE_STRIP); ! Iterator it = corners.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! gl.glVertex3d(v.getX(), ! v.getY(), ! v.getZ()); ! } ! Vertex v = (Vertex) corners.iterator().next(); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); + gl.glEnd(); } } *************** *** 1483,1491 **** */ public boolean facingFront(Surface surface) { ! Vertex normal = surface.normal(); Transformation transformation = transformation(); ! Vertex center = transformation.project(surface.center()); ! Vertex from = new Vertex("", center.getX(), center.getY(), 0.0); ! Vertex to = new Vertex("", center.getX(), center.getY(), 1.0); Edge ray = new Edge("", from, to); Vertex rayDir; --- 1520,1538 ---- */ public boolean facingFront(Surface surface) { ! return facingFront(surface.coordinateSystem()); ! } ! ! /** ! * Returns a boolean idicating wherther or not we are facing ! * the front of the CoordinateSystem. ! * @param system the coordinate system ! * @return the boolean ! */ ! public boolean facingFront(CoordinateSystem system) { ! Vertex normal = system.getN(); Transformation transformation = transformation(); ! Vertex origin = transformation.project(system.origin()); ! Vertex from = new Vertex("", origin.getX(), origin.getY(), 0.0); ! Vertex to = new Vertex("", origin.getX(), origin.getY(), 1.0); Edge ray = new Edge("", from, to); Vertex rayDir; Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** View.java 3 Nov 2005 11:08:08 -0000 1.18 --- View.java 6 Nov 2005 16:33:44 -0000 1.19 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.bprocessor.gl.view; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; *************** *** 224,227 **** --- 225,236 ---- /** + * Returns a boolean idicating wherther or not we are facing + * the front of the CoordinateSystem. + * @param system the coordinate system + * @return the boolean + */ + public boolean facingFront(CoordinateSystem system); + + /** * Called when a space-label corresponding to the front of a Surface is selected. */ |
From: Michael L. <he...@us...> - 2005-11-06 16:25:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29421/src/net/sourceforge/bprocessor/model Modified Files: Space.java Plane.java CoordinateSystem.java Log Message: Implemented - Plane.negate() - CoordinateSystem.origin() - CoordinteSystem.plane() Fixed: - Space.getElements() (now returns empty set if no elements) Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Space.java 22 Aug 2005 08:46:44 -0000 1.4 --- Space.java 6 Nov 2005 16:25:34 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- package net.sourceforge.bprocessor.model; + import java.util.HashSet; import java.util.Set; *************** *** 65,69 **** */ public Set getElements() { ! return elements; } --- 66,74 ---- */ public Set getElements() { ! if (elements == null) { ! return new HashSet(); ! } else { ! return elements; ! } } Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CoordinateSystem.java 30 Oct 2005 15:50:38 -0000 1.6 --- CoordinateSystem.java 6 Nov 2005 16:25:34 -0000 1.7 *************** *** 108,111 **** --- 108,131 ---- } + /** + * Return the origin + * @return The origin + */ + public Vertex origin() { + return origin; + } + + /** + * Return the xy plane of this CoordinateSystem + * @return The xy plane + */ + public Plane plane() { + double d = 0; + double a = n.getX(); + double b = n.getY(); + double c = n.getZ(); + d = -(a * origin.getX() + b * origin.getY() + c * origin.getZ()); + return new Plane(a, b, c, d); + } /** Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Plane.java 1 Nov 2005 07:43:06 -0000 1.8 --- Plane.java 6 Nov 2005 16:25:34 -0000 1.9 *************** *** 55,58 **** --- 55,66 ---- /** + * Negate the plane + * @return The negated plane + */ + public Plane negate() { + return new Plane(-a, -b, -c, -d); + } + + /** * Find the orthogonal plane to this plane * @param rayIn the ray into the view |
From: Michael L. <he...@us...> - 2005-11-04 09:39:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7589/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: - Removed rounding to mm to improve hitdection when working on extruded surfaces - Requests keyboard foucs on mousenter Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** GLView.java 30 Oct 2005 15:55:40 -0000 1.20 --- GLView.java 4 Nov 2005 09:38:55 -0000 1.21 *************** *** 18,21 **** --- 18,22 ---- import net.sourceforge.bprocessor.gui.GUI; + import net.java.games.jogl.GLCanvas; import net.java.games.jogl.GLCapabilities; import net.java.games.jogl.GLDrawable; *************** *** 26,29 **** --- 27,34 ---- import java.awt.Dimension; import java.awt.BorderLayout; + import java.awt.KeyboardFocusManager; + import java.awt.event.MouseEvent; + import java.awt.event.MouseListener; + import javax.swing.JTextField; import javax.swing.JPanel; *************** *** 36,45 **** * The 3D display */ ! public class GLView { /** The logger */ private static Logger log = Logger.getLogger(GLView.class); /** GL canvas */ ! private GLDrawable glc; /** current event listener */ --- 41,50 ---- * The 3D display */ ! public class GLView implements MouseListener { /** The logger */ private static Logger log = Logger.getLogger(GLView.class); /** GL canvas */ ! private GLCanvas glc; /** current event listener */ *************** *** 61,64 **** --- 66,71 ---- glCap.setHardwareAccelerated(true); glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); + KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + JPanel jp = new JPanel(); jp.setPreferredSize(new Dimension(450, 450)); *************** *** 80,84 **** glc.addMouseMotionListener(tool); glc.addKeyListener(tool); ! GUI.getInstance().registerPanel(jp, GUI.SPLIT_MIDDLE); glc.setAutoSwapBufferMode(false); --- 87,91 ---- glc.addMouseMotionListener(tool); glc.addKeyListener(tool); ! glc.addMouseListener(this); GUI.getInstance().registerPanel(jp, GUI.SPLIT_MIDDLE); glc.setAutoSwapBufferMode(false); *************** *** 257,259 **** --- 264,302 ---- } } + + /** + * @param arg0 Event + */ + public void mouseClicked(MouseEvent arg0) { + + } + + /** + * @param arg0 Event + */ + public void mousePressed(MouseEvent arg0) { + + } + + /** + * @param arg0 Event + */ + public void mouseReleased(MouseEvent arg0) { + + } + + /** + * @param arg0 Event + */ + public void mouseEntered(MouseEvent arg0) { + + glc.requestFocusInWindow(); + } + + /** + * @param arg0 Event + */ + public void mouseExited(MouseEvent arg0) { + + } } |
From: Michael L. <he...@us...> - 2005-11-04 09:39:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7589/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java ClipplaneTool.java SelectTool.java Log Message: - Removed rounding to mm to improve hitdection when working on extruded surfaces - Requests keyboard foucs on mousenter Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** SelectTool.java 3 Nov 2005 11:12:25 -0000 1.37 --- SelectTool.java 4 Nov 2005 09:38:55 -0000 1.38 *************** *** 323,331 **** Object selected = it.next(); if (selected instanceof Surface) { ! Surface selectedSurface = (Surface)target; selection.remove(selectedSurface); deleteSurface(selectedSurface); } else if (selected instanceof Edge) { ! Edge selectedEdge = (Edge)target; if (selectedEdge.getSurfaces().size() < 1) { selection.remove(selectedEdge); --- 323,331 ---- Object selected = it.next(); if (selected instanceof Surface) { ! Surface selectedSurface = (Surface)selected; selection.remove(selectedSurface); deleteSurface(selectedSurface); } else if (selected instanceof Edge) { ! Edge selectedEdge = (Edge)selected; if (selectedEdge.getSurfaces().size() < 1) { selection.remove(selectedEdge); Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClipplaneTool.java 3 Nov 2005 20:56:57 -0000 1.2 --- ClipplaneTool.java 4 Nov 2005 09:38:55 -0000 1.3 *************** *** 8,11 **** --- 8,14 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.ClippingPlane; + import net.sourceforge.bprocessor.model.Surface; + import java.awt.event.MouseEvent; Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** PencilTool.java 31 Oct 2005 07:52:45 -0000 1.30 --- PencilTool.java 4 Nov 2005 09:38:55 -0000 1.31 *************** *** 233,237 **** */ protected double roundMM(double value) { ! return ((double) Math.round(value * 1000)) / 1000.0; } --- 233,238 ---- */ protected double roundMM(double value) { ! return value; ! //return ((double) Math.round(value * 1000)) / 1000.0; } *************** *** 397,401 **** (current.getX(), current.getY(), current.getZ(), 0.0); if (!vertices.isEmpty()) { ! current = (Vertex) vertices.iterator().next(); } } --- 398,402 ---- (current.getX(), current.getY(), current.getZ(), 0.0); if (!vertices.isEmpty()) { ! //current = (Vertex) vertices.iterator().next(); } } |
From: Michael L. <he...@us...> - 2005-11-04 09:39:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7589/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: - Removed rounding to mm to improve hitdection when working on extruded surfaces - Requests keyboard foucs on mousenter Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** AbstractView.java 3 Nov 2005 11:08:50 -0000 1.52 --- AbstractView.java 4 Nov 2005 09:38:55 -0000 1.53 *************** *** 1250,1255 **** Vertex vv = system.translate(v); ! if (Math.abs(vv.getZ()) < 0.00000000001) { return v; } } --- 1250,1257 ---- Vertex vv = system.translate(v); ! if (Math.abs(vv.getZ()) < 0.0000000001) { return v; + } else { + System.out.println("vv = " + vv); } } |
From: rimestad <rim...@us...> - 2005-11-03 20:57:08
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19010 Modified Files: ClipplaneTool.java Log Message: The right file Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClipplaneTool.java 3 Nov 2005 12:25:13 -0000 1.1 --- ClipplaneTool.java 3 Nov 2005 20:56:57 -0000 1.2 *************** *** 31,37 **** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object ! */ protected void pressed(MouseEvent e) { super.pressed(e); } } --- 31,43 ---- * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object ! */ protected void pressed(MouseEvent e) { super.pressed(e); + if (e.getButton() == MouseEvent.BUTTON1) { + if (target instanceof Surface) { + ClippingPlane cp = new ClippingPlane(((Surface)target).plane()); + (glv.getView()).addClippingPlane(cp); + } + } } } |
From: rimestad <rim...@us...> - 2005-11-03 12:25:26
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1540/src/net/sourceforge/bprocessor/gl/tool Added Files: ClipplaneTool.java Log Message: initial import --- NEW FILE: ClipplaneTool.java --- //--------------------------------------------------------------------------------- // $Id: ClipplaneTool.java,v 1.1 2005/11/03 12:25:13 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.MouseEvent; import org.apache.log4j.Logger; /** * The Clipplane tool */ public class ClipplaneTool extends SelectTool { /** The logger */ private static Logger log = Logger.getLogger(ClipplaneTool.class); /** * The Constructor * @param glv The 3D canvas */ public ClipplaneTool(GLView glv) { super(glv); } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { super.pressed(e); } } |
From: Nordholt <nor...@us...> - 2005-11-03 11:12:48
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11287 Modified Files: SelectTool.java Log Message: added space popup listener to the space popup Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** SelectTool.java 1 Nov 2005 16:25:36 -0000 1.36 --- SelectTool.java 3 Nov 2005 11:12:25 -0000 1.37 *************** *** 192,195 **** --- 192,196 ---- private JPopupMenu spacePopup(String side) { JPopupMenu pp = new JPopupMenu(side); + SpacePopupListener spl = new SpacePopupListener(side.equals("front"), glv.getView()); Set domains = Project.getInstance().getDomains(); Iterator domIt = domains.iterator(); *************** *** 247,250 **** --- 248,252 ---- pp.addSeparator(); pp.add(noneItem); + pp.addPopupMenuListener(spl); pp.pack(); return pp; |
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11012 Modified Files: CopyActionListener.java CreateSpaceActionListener.java DomainPopupListener.java PasteActionListener.java ShiftActionListener.java Log Message: fixed the logger of some listener classes Index: CreateSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CreateSpaceActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CreateSpaceActionListener.java 27 Oct 2005 14:59:46 -0000 1.1 --- CreateSpaceActionListener.java 3 Nov 2005 11:11:23 -0000 1.2 *************** *** 28,32 **** public class CreateSpaceActionListener implements ActionListener { /** The logger */ ! private static Logger log = Logger.getLogger(SelectTool.class); /** The Surface */ --- 28,32 ---- public class CreateSpaceActionListener implements ActionListener { /** The logger */ ! private static Logger log = Logger.getLogger(CreateSpaceActionListener.class); /** The Surface */ Index: DomainPopupListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/DomainPopupListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DomainPopupListener.java 27 Oct 2005 14:59:16 -0000 1.1 --- DomainPopupListener.java 3 Nov 2005 11:11:23 -0000 1.2 *************** *** 21,25 **** public class DomainPopupListener implements ActionListener { /** The logger */ ! private static Logger log = Logger.getLogger(SelectTool.class); /** The domain */ --- 21,25 ---- public class DomainPopupListener implements ActionListener { /** The logger */ ! private static Logger log = Logger.getLogger(DomainPopupListener.class); /** The domain */ Index: PasteActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PasteActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PasteActionListener.java 28 Oct 2005 12:12:42 -0000 1.1 --- PasteActionListener.java 3 Nov 2005 11:11:23 -0000 1.2 *************** *** 24,28 **** * The logger */ ! private static Logger log = Logger.getLogger(SelectTool.class); /** --- 24,28 ---- * The logger */ ! private static Logger log = Logger.getLogger(PasteActionListener.class); /** Index: ShiftActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ShiftActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShiftActionListener.java 27 Oct 2005 14:58:06 -0000 1.1 --- ShiftActionListener.java 3 Nov 2005 11:11:23 -0000 1.2 *************** *** 23,27 **** * The logger */ ! private static Logger log = Logger.getLogger(SelectTool.class); /** --- 23,27 ---- * The logger */ ! private static Logger log = Logger.getLogger(ShiftActionListener.class); /** Index: CopyActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CopyActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CopyActionListener.java 28 Oct 2005 12:14:05 -0000 1.1 --- CopyActionListener.java 3 Nov 2005 11:11:23 -0000 1.2 *************** *** 23,27 **** * The logger */ ! private static Logger log = Logger.getLogger(SelectTool.class); /** * The copied domain facing the camera --- 23,27 ---- * The logger */ ! private static Logger log = Logger.getLogger(CopyActionListener.class); /** * The copied domain facing the camera |
From: Nordholt <nor...@us...> - 2005-11-03 11:10:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10696 Added Files: SpacePopupListener.java Log Message: Listener for the space popup --- NEW FILE: SpacePopupListener.java --- //--------------------------------------------------------------------------------- // $Id: SpacePopupListener.java,v 1.1 2005/11/03 11:10:19 nordholt 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.view.View; import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuEvent; import org.apache.log4j.Logger; /** The listener for a Space Popup Menu */ public class SpacePopupListener implements PopupMenuListener { /** the Logger */ private static Logger log = Logger.getLogger(SpacePopupListener.class); /** the view */ private View view; /** If the popup is for the front or back of a surface*/ private boolean front; /** * Creates a new popup menu listener. * @param front whether or not the listener is for the front of a surface * @param view the view */ public SpacePopupListener(boolean front, View view) { this.front = front; this.view = view; } /** * Empty * @param e a PopupMenuEvent */ public void popupMenuCanceled(PopupMenuEvent e) { } /** * Invoked when the popup menu will become invisible. makes sure to * deselect the label. * @param e a PopupMenuEvent */ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { view.deSelectLabel(); } /** * Invoked when the popup menu will become visible. makes sure to * select the label. * @param e a PopupMenuEvent */ public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (front) { view.selectFrontLabel(); } else { view.selectBackLabel(); } } } |
From: Nordholt <nor...@us...> - 2005-11-03 11:08:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10178 Modified Files: AbstractView.java Log Message: implemented selection of front or back space-label of a surface Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** AbstractView.java 1 Nov 2005 16:27:39 -0000 1.51 --- AbstractView.java 3 Nov 2005 11:08:50 -0000 1.52 *************** *** 163,167 **** /** The list of clipping planes */ private List clippingPlanes; ! static { setTransparency(100); --- 163,173 ---- /** The list of clipping planes */ private List clippingPlanes; ! ! /** Indicating if the front space-label is selected */ ! private boolean frontLabelSelect = false; ! ! /** Indicating if the back space-label is selected */ ! private boolean backLabelSelect = false; ! static { setTransparency(100); *************** *** 443,448 **** } } ! ! /** * Put labels on a Surface --- 449,471 ---- } } ! /** ! * Called when a space-label corresponding to the front of a Surface is selected. ! */ ! public void selectFrontLabel() { ! frontLabelSelect = true; ! } ! /** ! * Called when a space-label corresponding to the back of a Surface is selected. ! */ ! public void selectBackLabel() { ! backLabelSelect = true; ! } ! /** ! * De selects the currently selected label. ! */ ! public void deSelectLabel() { ! backLabelSelect = false; ! frontLabelSelect = false; ! } /** * Put labels on a Surface *************** *** 503,523 **** popName(gl); } else { //draw the front domain name if (frontDomain instanceof FunctionalSpace) { ! gl.glColor3d(0.2, 0.2, 0.5); } else if (frontDomain instanceof ConstructionSpace) { ! gl.glColor3d(0.8, 0.2, 0.4); } else { ! gl.glColor3d(0.2, 0.2, 0.2); } drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); //draw the back domain name if (backDomain instanceof FunctionalSpace) { ! gl.glColor3d(0.2, 0.2, 0.5); } else if (backDomain instanceof ConstructionSpace) { ! gl.glColor3d(0.8, 0.2, 0.4); } else { ! gl.glColor3d(0.2, 0.2, 0.2); } drawString(backTextAnchor.getX(), backTextAnchor.getY(), backName); --- 526,554 ---- popName(gl); } else { + double fcb = 0; + if (frontLabelSelect) { + fcb = 0.3; + } //draw the front domain name if (frontDomain instanceof FunctionalSpace) { ! gl.glColor3d(0.2 + fcb, 0.2 + fcb, 0.5 + fcb); } else if (frontDomain instanceof ConstructionSpace) { ! gl.glColor3d(0.8 + fcb, 0.2 + fcb, 0.4 + fcb); } else { ! gl.glColor3d(0.2 + fcb, 0.2 + fcb, 0.2 + fcb); } drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); + double bcb = 0; + if (backLabelSelect) { + bcb = 0.3; + } //draw the back domain name if (backDomain instanceof FunctionalSpace) { ! gl.glColor3d(0.2 + bcb, 0.2 + bcb, 0.5 + bcb); } else if (backDomain instanceof ConstructionSpace) { ! gl.glColor3d(0.8 + bcb, 0.2 + bcb, 0.4 + bcb); } else { ! gl.glColor3d(0.2 + bcb, 0.2 + bcb, 0.2 + bcb); } drawString(backTextAnchor.getX(), backTextAnchor.getY(), backName); |
From: Nordholt <nor...@us...> - 2005-11-03 11:08:16
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10003 Modified Files: View.java Log Message: added methods for selecting front or back space-label of a surface Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** View.java 1 Nov 2005 07:36:09 -0000 1.17 --- View.java 3 Nov 2005 11:08:08 -0000 1.18 *************** *** 222,224 **** --- 222,239 ---- */ public boolean facingFront(Surface surface); + + /** + * Called when a space-label corresponding to the front of a Surface is selected. + */ + public void selectFrontLabel(); + + /** + * Called when a space-label corresponding to the back of a Surface is selected. + */ + public void selectBackLabel(); + + /** + * De selects the currently selected label. + */ + public void deSelectLabel(); } |
From: Nordholt <nor...@us...> - 2005-11-01 16:27:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20131 Modified Files: AbstractView.java Log Message: Fixed the click-boxes on the space menu's Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** AbstractView.java 1 Nov 2005 07:36:09 -0000 1.50 --- AbstractView.java 1 Nov 2005 16:27:39 -0000 1.51 *************** *** 554,558 **** gl.glBegin(GL.GL_POLYGON); gl.glVertex3d(x, y, z); ! gl.glVertex3d(x * width, y, z); gl.glVertex3d(x + width, y + height, z); gl.glVertex3d(x, y + height, z); --- 554,558 ---- gl.glBegin(GL.GL_POLYGON); gl.glVertex3d(x, y, z); ! gl.glVertex3d(x + width, y, z); gl.glVertex3d(x + width, y + height, z); gl.glVertex3d(x, y + height, z); |
From: Nordholt <nor...@us...> - 2005-11-01 16:25:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19727 Modified Files: SelectTool.java Log Message: different layout of the space menu's Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** SelectTool.java 1 Nov 2005 07:36:09 -0000 1.35 --- SelectTool.java 1 Nov 2005 16:25:36 -0000 1.36 *************** *** 133,138 **** } } ! } } /** --- 133,139 ---- } } ! } } + /** *************** *** 180,184 **** } } ! log.warn("Space popup menu has no surface"); return sepPop; } --- 181,185 ---- } } ! log.warn("Seperator popup menu has no surface"); return sepPop; } *************** *** 206,210 **** noneItem.addActionListener(noneListener); - JMenu createSub = new JMenu("Create"); JMenuItem createFuncItem = new JMenuItem("New Functional Space"); ActionListener funcListener = new CreateSpaceActionListener(surface, --- 207,210 ---- *************** *** 212,216 **** true); createFuncItem.addActionListener(funcListener); - createSub.add(createFuncItem); JMenuItem createConstItem = new JMenuItem("New Construction Space"); --- 212,215 ---- *************** *** 219,223 **** false); createConstItem.addActionListener(constListener); - createSub.add(createConstItem); JMenu funcMenu = new JMenu("Functional Spaces"); --- 218,221 ---- *************** *** 234,241 **** domainItem.addActionListener(ml); if (domain instanceof FunctionalSpace) { - funcEnabled = true; funcMenu.add(domainItem); } else { - constEnabled = true; constMenu.add(domainItem); } --- 232,237 ---- *************** *** 243,253 **** } ! funcMenu.setEnabled(funcEnabled); ! constMenu.setEnabled(constEnabled); pp.add(funcMenu); pp.add(constMenu); pp.addSeparator(); - pp.add(createSub); - pp.addSeparator(); pp.add(noneItem); pp.pack(); --- 239,249 ---- } ! funcMenu.addSeparator(); ! funcMenu.add(createFuncItem); ! constMenu.addSeparator(); ! constMenu.add(createConstItem); pp.add(funcMenu); pp.add(constMenu); pp.addSeparator(); pp.add(noneItem); pp.pack(); |
From: Nordholt <nor...@us...> - 2005-11-01 16:23:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19421 Modified Files: AbstractTool.java Log Message: Fixed click-boxes on the space names Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** AbstractTool.java 30 Oct 2005 15:55:40 -0000 1.24 --- AbstractTool.java 1 Nov 2005 16:23:49 -0000 1.25 *************** *** 267,272 **** Vertex v = new Vertex("V" + vertexNum); vertexNum++; ! ! v.setX(coord[0]); v.setY(coord[1]); --- 267,271 ---- Vertex v = new Vertex("V" + vertexNum); vertexNum++; ! v.setX(coord[0]); v.setY(coord[1]); |
From: Nordholt <nor...@us...> - 2005-11-01 16:22:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19058 Modified Files: ExtrusionTool.java Log Message: Fixed space assignment when extruding holes Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ExtrusionTool.java 28 Oct 2005 08:26:57 -0000 1.23 --- ExtrusionTool.java 1 Nov 2005 16:22:26 -0000 1.24 *************** *** 19,24 **** import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; - //import net.sourceforge.bprocessor.model.ConstructionSpace; - //import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Plane; --- 19,22 ---- *************** *** 165,182 **** Surface top = (Surface)extrudedSurfaces.getFirst(); Surface bottom = (Surface)extrudedSurfaces.getLast(); - Vertex norm = bottom.normal(); Vertex dir = top.center().minus(bottom.center()); Domain front = bottom.getFrontDomain(); Domain back = bottom.getBackDomain(); assignSpaces(extrudedSurfaces); Iterator innerIt = innerExSurfs.iterator(); while (innerIt.hasNext()) { LinkedList innerSurfs = (LinkedList)innerIt.next(); assignSpaces(innerSurfs); innerSurfs.removeFirst(); ! if (norm.dot(dir) > 0) { ! assignFronts(front, innerSurfs); } else { ! assignBacks(back, innerSurfs); } } --- 163,190 ---- Surface top = (Surface)extrudedSurfaces.getFirst(); Surface bottom = (Surface)extrudedSurfaces.getLast(); Vertex dir = top.center().minus(bottom.center()); Domain front = bottom.getFrontDomain(); Domain back = bottom.getBackDomain(); assignSpaces(extrudedSurfaces); + + Vertex norm = bottom.normal(); Iterator innerIt = innerExSurfs.iterator(); while (innerIt.hasNext()) { LinkedList innerSurfs = (LinkedList)innerIt.next(); + Vertex innerNorm = ((Surface)innerSurfs.getLast()).normal(); assignSpaces(innerSurfs); innerSurfs.removeFirst(); ! if (innerNorm.dot(dir) > 0) { ! if (innerNorm.dot(norm) > 0) { ! assignFronts(front, innerSurfs); ! } else { ! assignFronts(back, innerSurfs); ! } } else { ! if (innerNorm.dot(norm) > 0) { ! assignBacks(back, innerSurfs); ! } else { ! assignBacks(front, innerSurfs); ! } } } *************** *** 221,225 **** back.addSurface(surf); Project.getInstance().update(back); ! } } } --- 229,233 ---- back.addSurface(surf); Project.getInstance().update(back); ! } } } *************** *** 365,369 **** /* Note the first surface of the extensions lists is the top of the ! hole extension and the last surface is the bottom. This is used when assigning spaces to the surfaces. */ --- 373,377 ---- /* Note the first surface of the extensions lists is the top of the ! hole-extension and the last surface is the bottom. This is used when assigning spaces to the surfaces. */ |
From: rimestad <rim...@us...> - 2005-11-01 07:43:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20774/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: oops Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Plane.java 1 Nov 2005 07:25:35 -0000 1.7 --- Plane.java 1 Nov 2005 07:43:06 -0000 1.8 *************** *** 111,115 **** double v0 = -(a * x0 + b * y0 + c * z0 + d); double t = v0 / vd; ! if (t < - 0.001 || t > 1.001) { return null; } --- 111,115 ---- double v0 = -(a * x0 + b * y0 + c * z0 + d); double t = v0 / vd; ! if (t < -0.001 || t > 1.001) { return null; } |
From: rimestad <rim...@us...> - 2005-11-01 07:36:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19538/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java Log Message: added ClippingPlane functionality, there are still several problems 1) selection does not work proberly yet 2) The size of the Clipping plane need to be larger 3) there need to be a arrow or something to select clipping planes every time 4) the transparency also need to be greater 5) need its own icon Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** AbstractView.java 31 Oct 2005 07:52:45 -0000 1.49 --- AbstractView.java 1 Nov 2005 07:36:09 -0000 1.50 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.tool.SelectTool; + import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.model.CoordinateSystem; *************** *** 58,68 **** private static final int SURFACES = 1; ! /** Select for for selecting vertices */ ! private static final int VERTICES = 2; ! /** Select mode for selecting ALL **/ ! ! private static final int ALL = 3; /** The width of the window */ --- 59,70 ---- private static final int SURFACES = 1; ! /** Select for for selecting vertices */ private static final int VERTICES = 2; ! ! /** Select for for selecting clipplanes */ ! private static final int CLIPPLANES = 3; ! /** Select mode for selecting ALL **/ ! private static final int ALL = 4; /** The width of the window */ *************** *** 159,162 **** --- 161,167 ---- protected static byte[] highlight = new byte[128]; + /** The list of clipping planes */ + private List clippingPlanes; + static { setTransparency(100); *************** *** 169,179 **** */ public static void setTransparency(int percent) { ! byte b1 = (byte)0xaa; ! byte b2 = (byte)0x55; ! for (int i = 0; i < transparency.length; i++) { ! if (((int)(i / 4)) % 2 == 0) { ! transparency[i] = b1; ! } else { ! transparency[i] = b2; } } --- 174,194 ---- */ public static void setTransparency(int percent) { ! if (percent == 50) { ! byte b1 = (byte)0xaa; ! byte b2 = (byte)0x55; ! for (int i = 0; i < transparency.length; i++) { ! if (((int)(i / 4)) % 2 == 0) { ! transparency[i] = b1; ! } else { ! transparency[i] = b2; ! } ! } ! } else if (percent < 50) { ! for (int i = 0; i < transparency.length; i++) { ! transparency[i] = 0; ! } ! } else if (percent > 50) { ! for (int i = 0; i < transparency.length; i++) { ! transparency[i] = 1; } } *************** *** 208,211 **** --- 223,227 ---- public AbstractView(GLView glv) { this.glv = glv; + clippingPlanes = new ArrayList(); } *************** *** 272,275 **** --- 288,297 ---- picking = 0; + Iterator clipit = clippingPlanes.iterator(); + while (clipit.hasNext()) { + ClippingPlane cp = (ClippingPlane)clipit.next(); + gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); + } + // grid and coords are always completely lit gl.glDisable(GL.GL_DEPTH_TEST); *************** *** 281,288 **** coords(); gl.glColor3fv(STD_LINE_COLOR); gl.glLineWidth(1.0f); drawAll(gld); ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 303,328 ---- coords(); + // draw the clipping planes + clipit = clippingPlanes.iterator(); + gl.glEnable(GL.GL_POLYGON_STIPPLE); + setTransparency(50); + gl.glPolygonStipple(transparency); + while (clipit.hasNext()) { + ClippingPlane cp = (ClippingPlane)clipit.next(); + drawClipplane(cp); + } + gl.glDisable(GL.GL_POLYGON_STIPPLE); + + clipit = clippingPlanes.iterator(); + while (clipit.hasNext()) { + ClippingPlane cp = (ClippingPlane)clipit.next(); + gl.glClipPlane(GL.GL_CLIP_PLANE0 + cp.getNumber(), cp.getPlane().getDoublev()); + gl.glEnable(GL.GL_CLIP_PLANE0 + cp.getNumber()); + } + gl.glColor3fv(STD_LINE_COLOR); gl.glLineWidth(1.0f); drawAll(gld); ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 549,553 **** Set vertices = Project.getInstance().getVertices(); Collection selection = glv.getTool().getSelection(); ! int[] mode = new int[1]; gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 589,593 ---- Set vertices = Project.getInstance().getVertices(); Collection selection = glv.getTool().getSelection(); ! int[] mode = new int[1]; gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 555,561 **** gl = gld.getGL(); glu = gld.getGLU(); ! initNames(gl); ! if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); // draw selection --- 595,601 ---- gl = gld.getGL(); glu = gld.getGLU(); ! initNames(gl); ! if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); // draw selection *************** *** 567,571 **** } - // Draw edges if (doDrawEdges) { --- 607,610 ---- *************** *** 630,638 **** break; } ! } ! ! ! ! // draw target --- 669,673 ---- break; } ! } // draw target *************** *** 701,705 **** } } else { - // HERE STARTS SELECTION MODE DRAWING if (selectMode == VERTICES || selectMode == ALL) { --- 736,739 ---- *************** *** 733,740 **** --- 767,803 ---- } } + if (selectMode == CLIPPLANES || selectMode == ALL) { + Iterator it = clippingPlanes.iterator(); + while (it.hasNext()) { + ClippingPlane cp = (ClippingPlane)it.next(); + pushName(gl, cp); + drawClipplane(cp); + popName(gl); + } + } } } /** + * Draw a clippingPlane + * @param clipplane The clipplane to draw + */ + private void drawClipplane(ClippingPlane clipplane) { + gl.glColor3fv(CLIP_PLANE_COLOR); + double[] d = clipplane.getPlane().getDoublev(); + gl.glBegin(GL.GL_QUADS); + gl.glNormal3d(d[0], d[1], d[2]); + Collection corners = clipplane.getCorners(); + Iterator it = corners.iterator(); + while (it.hasNext()) { + Vertex v = (Vertex)it.next(); + gl.glVertex3d(v.getX(), + v.getY(), + v.getZ()); + } + gl.glEnd(); + } + + /** * Draw an object * @param o The Object *************** *** 766,769 **** --- 829,833 ---- } } + /** * Draw a surface *************** *** 1133,1137 **** if (near < nearest) { nearest = near; ! closest = current; } bufferOffset += names; --- 1197,1204 ---- if (near < nearest) { nearest = near; ! if (!(current instanceof ClippingPlane && closest != null)) { ! // if the closest are set we don't care about clipplanes ! closest = current; ! } } bufferOffset += names; *************** *** 1167,1176 **** } } return closest; } ! ! ! /** * Gets id of the object under a point. For use in selection. * @param x the x coordinate of the point in mouse coordinates --- 1234,1244 ---- } } + if (closest instanceof ClippingPlane) { + ClippingPlane cp = (ClippingPlane) closest; + } return closest; } ! /** * Gets id of the object under a point. For use in selection. * @param x the x coordinate of the point in mouse coordinates *************** *** 1205,1208 **** --- 1273,1298 ---- /** + * Adds a clippingPlane to the view + * @param cp The clippingPlane + */ + public void addClippingPlane(ClippingPlane cp) { + int[] maxclip = new int[1]; + 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); + } + } + + /** + * Remove the given clippingplane + * @param cp The clippingplane to remove + */ + public void removeClippingPlane(ClippingPlane cp) { + clippingPlanes.remove(cp); + } + + /** * The camera init function * @param gld The GLDrawable object Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** View.java 31 Oct 2005 07:52:45 -0000 1.16 --- View.java 1 Nov 2005 07:36:09 -0000 1.17 *************** *** 10,13 **** --- 10,14 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.model.Surface; *************** *** 60,63 **** --- 61,67 ---- public static final float[] SELECTED_COLOR = new float[] {1.0f, 0.4f, 1.0f}; + /** Used for clipping planes */ + public static final float[] CLIP_PLANE_COLOR = new float[] {1.0f, 0.65f, 0.0f}; + /** Used for target objects */ public static final float[] TARGET_COLOR = new float[] {0.8f, 0.8f, 0.1f}; *************** *** 71,75 **** /** Can be used for setting lighting mode */ public static final int LIGHTING_MODE = 2; ! /** * Resets the working attributes of the view --- 75,91 ---- /** Can be used for setting lighting mode */ public static final int LIGHTING_MODE = 2; ! ! /** ! * Adds a clippingPlane to the view ! * @param cp The clippingPlane ! */ ! public void addClippingPlane(ClippingPlane cp); ! ! /** ! * Remove the given clippingplane ! * @param cp The clippingplane to remove ! */ ! public void removeClippingPlane(ClippingPlane cp); ! /** * Resets the working attributes of the view |
From: rimestad <rim...@us...> - 2005-11-01 07:36:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19538/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java Tool.java ToolFactory.java Log Message: added ClippingPlane functionality, there are still several problems 1) selection does not work proberly yet 2) The size of the Clipping plane need to be larger 3) there need to be a arrow or something to select clipping planes every time 4) the transparency also need to be greater 5) need its own icon Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ToolFactory.java 29 Sep 2005 21:02:34 -0000 1.8 --- ToolFactory.java 1 Nov 2005 07:36:09 -0000 1.9 *************** *** 41,46 **** /** pencil tool */ private PencilTool pencil; ! ! /** --- 41,47 ---- /** pencil tool */ private PencilTool pencil; ! ! /** pencil tool */ ! private ClipplaneTool clipplane; /** *************** *** 53,56 **** --- 54,58 ---- move = new MoveTool(glv); extrusion = new ExtrusionTool(glv); + clipplane = new ClipplaneTool(glv); Toolbar tb = Toolbar.getInstance(); *************** *** 63,66 **** --- 65,70 ---- but = tb.registerAction(new ExtrudeAction(glv)); but.setToolTipText("Extrude"); + but = tb.registerAction(new ClipAction(glv)); + but.setToolTipText("Clipping"); Notifier.getInstance().addListener(select); *************** *** 101,104 **** --- 105,110 ---- } else if (i == Tool.PENCIL_TOOL) { return pencil; + } else if (i == Tool.CLIP_TOOL) { + return clipplane; } else { log.error("[get] No such tool " + i); *************** *** 194,198 **** /** ! * The debug action inner class */ class PencilAction extends AbstractAction { --- 200,204 ---- /** ! * The pencil action inner class */ class PencilAction extends AbstractAction { *************** *** 220,222 **** --- 226,256 ---- } } + + /** + * The clipping action inner class + */ + class ClipAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + ClipAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("selecticon.png"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.CLIP_TOOL); + } + } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** SelectTool.java 28 Oct 2005 12:16:38 -0000 1.34 --- SelectTool.java 1 Nov 2005 07:36:09 -0000 1.35 *************** *** 8,11 **** --- 8,12 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.kernel.notification.Notification; *************** *** 22,27 **** import net.sourceforge.bprocessor.model.Space; - - import java.awt.event.ActionListener; import java.awt.event.MouseEvent; --- 23,26 ---- *************** *** 277,280 **** --- 276,281 ---- Notification n = new Notification(Notification.EDGE_SELECTED, edge.getId()); Notifier.getInstance().sendNotification(n); + } else if (obj instanceof ClippingPlane) { + selection.add(obj); } } *************** *** 297,300 **** --- 298,306 ---- Notification n = new Notification(Notification.EDGE_DESELECTED, edge.getId()); Notifier.getInstance().sendNotification(n); + } else if (obj instanceof ClippingPlane) { + log.info("Clip selected"); + if (selection.contains(obj)) { + selection.remove(obj); + } } } *************** *** 315,328 **** if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; ! selection.remove(selectedSurface); ! deleteSurface(selectedSurface); ! ! } else if (target instanceof Edge) { ! Edge selectedEdge = (Edge)target; ! if (selectedEdge.getSurfaces().size() < 1) { ! selection.remove(selectedEdge); ! deleteEdge(selectedEdge); } } --- 321,339 ---- if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! Iterator it = selection.iterator(); ! while (it.hasNext()) { ! Object selected = it.next(); ! if (selected instanceof Surface) { ! Surface selectedSurface = (Surface)target; ! selection.remove(selectedSurface); ! deleteSurface(selectedSurface); ! } else if (selected instanceof Edge) { ! Edge selectedEdge = (Edge)target; ! if (selectedEdge.getSurfaces().size() < 1) { ! selection.remove(selectedEdge); ! deleteEdge(selectedEdge); ! } ! } else if (selected instanceof ClippingPlane) { ! glv.getView().removeClippingPlane((ClippingPlane)selected); } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Tool.java 21 Sep 2005 09:35:29 -0000 1.8 --- Tool.java 1 Nov 2005 07:36:09 -0000 1.9 *************** *** 22,27 **** /** The extrude tool */ public static final int EXTRUSION_TOOL = 2; ! /** The debug tool */ public static final int PENCIL_TOOL = 3; /** --- 22,29 ---- /** The extrude tool */ public static final int EXTRUSION_TOOL = 2; ! /** The pencil tool */ public static final int PENCIL_TOOL = 3; + /** The Clipping tool */ + public static final int CLIP_TOOL = 4; /** |
From: rimestad <rim...@us...> - 2005-11-01 07:31:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18843/src/net/sourceforge/bprocessor/gl/model Added Files: ClippingPlane.java package.html Log Message: initial import --- NEW FILE: package.html --- <body> Defines the package that contains the GL model </body> --- NEW FILE: ClippingPlane.java --- //--------------------------------------------------------------------------------- // $Id: ClippingPlane.java,v 1.1 2005/11/01 07:31:19 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.model; import java.util.Collection; import java.util.Iterator; import java.util.ArrayList; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; import org.apache.log4j.Logger; /** * The Clippingplane */ public class ClippingPlane { /** The logger */ private static Logger log = Logger.getLogger(ClippingPlane.class); /** The number clipping plane in the GL this one represents*/ private int number; /** The placement of the clippingplane */ private Plane plane; /** The corners */ private ArrayList corners; /** * The constructor * @param plane The plane the clippingplane is represented by */ public ClippingPlane(Plane plane) { this.plane = plane; findCorners(); } /** * Getter for plan representing the clippingplane * @return The plane */ public Plane getPlane() { return plane; } /** * Set the number clipping plane this plane represents in the GL * @param number The clipping plane number */ public void setNumber(int number) { this.number = number; } /** * Getter for the number attribute that represents the number * of the corrosponding clippingplane in GL * @return The number */ public int getNumber() { return number; } /** * Find intersections with all edges and return the vertices * @return The set of all intersection vertices */ public Collection findIntersections() { Collection edges = Project.getInstance().getEdges(); Collection res = new ArrayList(); Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); Vertex v = plane.intersection(e); if (v != null) { res.add(v); } } return res; } /** * Find the 4 corners among intersections */ public void findCorners() { log.info(plane); Collection c = findIntersections(); Iterator it = c.iterator(); double minX = Integer.MAX_VALUE; double minY = Integer.MAX_VALUE; double minZ = Integer.MAX_VALUE; double maxX = Integer.MIN_VALUE; double maxY = Integer.MIN_VALUE; double maxZ = Integer.MIN_VALUE; while (it.hasNext()) { Vertex v = (Vertex)it.next(); log.info(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(); } if (v.getZ() < minZ) { minZ = v.getZ(); } if (v.getZ() > maxZ) { maxZ = v.getZ(); } } double[] abcd = plane.getDoublev(); corners = new ArrayList(); if (Math.abs(minX * abcd[0] + minY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v1", minX, minY, maxZ)); } if (Math.abs(minX * abcd[0] + maxY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v2", minX, maxY, maxZ)); } if (Math.abs(minX * abcd[0] + minY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v3", minX, minY, minZ)); } if (Math.abs(minX * abcd[0] + maxY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v4", minX, maxY, minZ)); } if (Math.abs(maxX * abcd[0] + minY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v7", maxX, minY, minZ)); } if (Math.abs(maxX * abcd[0] + maxY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v8", maxX, maxY, minZ)); } if (Math.abs(maxX * abcd[0] + minY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v5", maxX, minY, maxZ)); } if (Math.abs(maxX * abcd[0] + maxY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { corners.add(new Vertex("v6", maxX, maxY, maxZ)); } } /** * Getter for corners * @return The corners */ public Collection getCorners() { return corners; } /** * Makes a string representation of the clippingplane * @return The string representing til object */ public String toString() { double[] p = plane.getDoublev(); return "[" + p[0] + ", " + p[1] + ", " + p[2] + ", " + p[3] + "]"; } } |
From: rimestad <rim...@us...> - 2005-11-01 07:29:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18610/src/net/sourceforge/bprocessor/gl/model Log Message: Directory /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model added to the repository |
From: rimestad <rim...@us...> - 2005-11-01 07:27:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18256/src/net/sourceforge/bprocessor/gl/view Modified Files: View3D.java Log Message: fixed the early clipping of the front plane Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** View3D.java 30 Sep 2005 15:51:45 -0000 1.17 --- View3D.java 1 Nov 2005 07:27:15 -0000 1.18 *************** *** 60,65 **** } double aspect = width / height; ! near = 2.0 / getZoomFactor(); ! far = 100.0 * getZoomFactor(); if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) --- 60,65 ---- } double aspect = width / height; ! near = 4 * getZoomFactor(); ! far = 200.0 * getZoomFactor(); if (aspect < 1.0) { // fovy, aspect, near, far (relative to camera position) |
From: rimestad <rim...@us...> - 2005-11-01 07:25:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17953/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: minor change so that an edge only intersect if the intersection is in its extend (on the line) Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Plane.java 20 Sep 2005 17:19:42 -0000 1.6 --- Plane.java 1 Nov 2005 07:25:35 -0000 1.7 *************** *** 47,50 **** --- 47,58 ---- /** + * Return a doublearray {a,b,c,d} + * @return The array + */ + public double[] getDoublev() { + return new double[]{a, b, c, d}; + } + + /** * Find the orthogonal plane to this plane * @param rayIn the ray into the view *************** *** 103,106 **** --- 111,117 ---- double v0 = -(a * x0 + b * y0 + c * z0 + d); double t = v0 / vd; + if (t < - 0.001 || t > 1.001) { + return null; + } Vertex i = new Vertex("intersection"); i.setX(x0 + t * xd); |
From: Michael L. <he...@us...> - 2005-10-31 07:52:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6571/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: PencilTool - Can align the first point to existing geometry - Can use length field when setting first point - Improved display of feedback Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** PencilTool.java 30 Oct 2005 15:55:40 -0000 1.29 --- PencilTool.java 31 Oct 2005 07:52:45 -0000 1.30 *************** *** 51,54 **** --- 51,58 ---- protected Vertex alignVertex = null; + /** The snap vertex */ + + protected Vertex snapVertex = null; + /** The exterior Surface is a Surface, where a hole is being defined */ protected Surface exterior = null; *************** *** 97,111 **** /** ! * Set the align vertex * @param vertex The vertex */ protected void setAlignVertex(Vertex vertex) { - if (vertex != null) { - glv.getView().setAlignPoint(new double[]{vertex.getX(), vertex.getY(), vertex.getZ()}); - } else { - glv.getView().setAlignPoint(null); - } alignVertex = vertex; } /** --- 101,122 ---- /** ! * Set the align vertex (the last vertex added) * @param vertex The vertex */ protected void setAlignVertex(Vertex vertex) { alignVertex = vertex; } + + /** + * Set the snap vertex (a vertex pointed at) + * @param vertex The vertex + */ + protected void setSnapVertex(Vertex vertex) { + if (vertex != alignVertex) { + snapVertex = vertex; + glv.getView().setSnapVertex(vertex); + } + } + /** *************** *** 129,132 **** --- 140,144 ---- void onVertex(Vertex vertex) { setAlignVertex(vertex); + setSnapVertex(null); number = ""; *************** *** 138,143 **** active = new Edge("E" + edgeNum++, from, to); glv.getView().setActiveEdge(active); - glv.getView().setSnapVertex(to); - } else { // The following lines of code are there to make sure --- 150,153 ---- *************** *** 198,202 **** to = null; setAlignVertex(null); ! glv.getView().setSnapVertex(null); exterior = null; } --- 208,212 ---- to = null; setAlignVertex(null); ! setSnapVertex(null); exterior = null; } *************** *** 217,220 **** --- 227,239 ---- } + /** + * Round to mm + * @param value The value + * @return The rounded value + */ + protected double roundMM(double value) { + return ((double) Math.round(value * 1000)) / 1000.0; + } + /** *************** *** 252,270 **** */ protected void snapInSystem(CoordinateSystem system, Vertex vertex) { if (alignVertex != null) { ! Vertex v1 = system.translate(alignVertex); ! Vertex v2 = system.translate(vertex); ! // It should be the case that v1.z = v2.z = 0.0 ! if (Math.abs(v1.getX() - v2.getX()) < 0.3) { ! v2.setX(v1.getX()); } ! if (Math.abs(v1.getY() - v2.getY()) < 0.3) { ! v2.setY(v1.getY()); } - v2 = system.unTranslate(v2); - vertex.setX(v2.getX()); - vertex.setY(v2.getY()); - vertex.setZ(v2.getZ()); } } --- 271,323 ---- */ protected void snapInSystem(CoordinateSystem system, Vertex vertex) { + Vertex v = system.translate(vertex); + double x = v.getX(); + double y = v.getY(); + + Vertex a = null; + Vertex b = null; + if (alignVertex != null) { ! a = system.translate(alignVertex); ! } ! if (snapVertex != null) { ! b = system.translate(snapVertex); ! } ! ! double xl = 0.3; ! double yl = 0.3; ! double xd = 0.0; ! double yd = 0.0; ! if (a != null) { ! xd = Math.abs(a.getX() - v.getX()); ! if (xd < xl) { ! x = a.getX(); ! xl = xd; } ! yd = Math.abs(a.getY() - v.getY()); ! if (yd < yl) { ! y = a.getY(); ! yl = yd; ! } ! } ! if (b != null) { ! xd = Math.abs(b.getX() - v.getX()); ! if (xd < xl) { ! x = b.getX(); ! xl = xd; ! } ! yd = Math.abs(b.getY() - v.getY()); ! if (yd < yl) { ! y = b.getY(); ! yl = yd; } } + + v.setX(x); + v.setY(y); + v = system.unTranslate(v); + vertex.setX(roundMM(v.getX())); + vertex.setY(roundMM(v.getY())); + vertex.setZ(roundMM(v.getZ())); } *************** *** 328,332 **** if (current.getId() == null) { if (snap) { ! snap(current); } else { if (legal) { --- 381,390 ---- if (current.getId() == null) { if (snap) { ! Vertex origin = new Vertex("", 0, 0, 0); ! Vertex i = new Vertex("", 1, 0, 0); ! Vertex j = new Vertex("", 0, 1, 0); ! Vertex n = new Vertex("", 0, 0, 1); ! system = new CoordinateSystem(i, j, n, origin); ! snapInSystem(system, current); } else { if (legal) { *************** *** 364,372 **** findTarget(e); glv.getView().makeTarget(target); ! findVertex(e); ! /** Show the length of the active edge */ if (active != null) { glv.setLength(active.getLength()); } --- 422,449 ---- findTarget(e); glv.getView().makeTarget(target); ! if (target != null) { ! if (target instanceof Vertex) { ! setSnapVertex((Vertex) target); ! } ! } ! boolean clear = (exterior == null); ! boolean legal = findVertex(e); ! if (clear) { ! exterior = null; ! } ! if (legal) { ! glv.getView().setCurrentVertex(current); ! } else { ! glv.getView().setCurrentVertex(current); ! } /** Show the length of the active edge */ if (active != null) { glv.setLength(active.getLength()); + } else { + if (current != null && snapVertex != null) { + glv.setLength(current.minus(snapVertex).length()); + } else { + glv.setLength(0.0); + } } *************** *** 394,401 **** protected void released(MouseEvent e) { findTarget(e); ! glv.getView().makeTarget(null); ! int x = e.getX(); ! int y = e.getY(); ! View v = glv.getView(); } --- 471,475 ---- protected void released(MouseEvent e) { findTarget(e); ! glv.getView().makeTarget(target); } *************** *** 418,423 **** to = null; setAlignVertex(null); ! glv.getView().setSnapVertex(null); exterior = null; } else if (e.getKeyCode() == KeyEvent.VK_1) { number += "1"; --- 492,498 ---- to = null; setAlignVertex(null); ! setSnapVertex(null); exterior = null; + glv.repaint(); } else if (e.getKeyCode() == KeyEvent.VK_1) { number += "1"; *************** *** 452,470 **** } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { try { ! if (active != null) { ! double d = Double.parseDouble(number); ! if (current != null) { ! Vertex temp = new Vertex("temp", to.getX(), to.getY(), to.getZ()); ! active.setLength(d / 1000); ! current.setX(to.getX()); ! current.setY(to.getY()); ! current.setZ(to.getZ()); ! onVertex(current); ! active.setTo(temp); ! to = temp; ! current = temp; ! glv.repaint(); } ! } } catch (NumberFormatException exp) { log.warn(exp); --- 527,555 ---- } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { try { ! double d = Double.parseDouble(number); ! // TODO fix. ! if (current != null) { ! double x = current.getX(); ! double y = current.getY(); ! double z = current.getZ(); ! Vertex before = null; ! if (alignVertex != null) { ! before = alignVertex; ! } else if (snapVertex != null) { ! before = snapVertex; } ! if (before != null) { ! Vertex v = current.minus(before); ! if (v.length() > 0.000000001) { ! v.scale((d / 1000) / v.length()); ! current = before.add(v); ! current.setX(roundMM(current.getX())); ! current.setY(roundMM(current.getY())); ! current.setZ(roundMM(current.getZ())); ! onVertex(current); ! glv.repaint(); ! } ! } ! } } catch (NumberFormatException exp) { log.warn(exp); *************** *** 483,490 **** if (changed) { try { ! if (active != null) { ! double d = Double.parseDouble(number); ! glv.setLength(d / 1000); ! } } catch (NumberFormatException exp) { log.warn(exp); --- 568,573 ---- if (changed) { try { ! double d = Double.parseDouble(number); ! glv.setLength(d / 1000); } catch (NumberFormatException exp) { log.warn(exp); |
From: Michael L. <he...@us...> - 2005-10-31 07:52:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6571/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java Log Message: PencilTool - Can align the first point to existing geometry - Can use length field when setting first point - Improved display of feedback Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** AbstractView.java 30 Oct 2005 15:55:40 -0000 1.48 --- AbstractView.java 31 Oct 2005 07:52:45 -0000 1.49 *************** *** 82,92 **** /** The Snap vertex */ ! protected static Vertex snapVertex = null; ! ! /** For clever snapping */ ! protected static double[] alignPoint = null; ! /** The alignment vertex */ ! protected static Vertex alignVertex = null; /** The target */ --- 82,89 ---- /** The Snap vertex */ ! protected static Vertex snapVertex = null; ! /** The current vertex */ ! protected static Vertex currentVertex = null; /** The target */ *************** *** 158,164 **** --- 155,165 ---- /** The transparency of surfaces */ protected static byte[] transparency = new byte[128]; + + /** The transparency of highlight */ + protected static byte[] highlight = new byte[128]; static { setTransparency(100); + setHighlight(); }; *************** *** 178,181 **** --- 179,204 ---- } } + + /** + * Set the highlight pattern + */ + public static void setHighlight() { + byte b1 = (byte) 0x88; + byte b2 = (byte) 0x22; + byte b3 = (byte) 0x00; + for (int i = 0; i < highlight.length; i++) { + int d = ((int)(i / 4)) % 4; + + if (d == 0) { + highlight[i] = b1; + } else if (d == 1) { + highlight[i] = b3; + } else if (d == 2) { + highlight[i] = b2; + } else if (d == 3) { + highlight[i] = b3; + } + } + } /** *************** *** 205,208 **** --- 228,232 ---- gl.glClearColor(0.7f, 0.7f, 0.7f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); + gl.glLineStipple(4, (short)0xAAAA); ball = glu.gluNewQuadric(); *************** *** 250,254 **** // grid and coords are always completely lit gl.glDisable(GL.GL_DEPTH_TEST); - gl.glDisable(GL.GL_LIGHTING); gl.glLineWidth(1.0f); grid(); --- 274,277 ---- *************** *** 258,271 **** coords(); - // set up lighting for the model - if (drawMode == LIGHTING_MODE) { - //gl.glShadeModel(GL.GL_SMOOTH); - gl.glEnable(GL.GL_LIGHTING); - } else { - gl.glDisable(GL.GL_LIGHTING); - } - gl.glColor3fv(STD_LINE_COLOR); ! gl.glLineWidth(3.0f); drawAll(gld); --- 281,286 ---- coords(); gl.glColor3fv(STD_LINE_COLOR); ! gl.glLineWidth(1.0f); drawAll(gld); *************** *** 324,330 **** */ public void reset() { - setAlignVertex(null); setSnapVertex(null); ! setAlignPoint(null); makeTarget(null); } --- 339,344 ---- */ public void reset() { setSnapVertex(null); ! setCurrentVertex(null); makeTarget(null); } *************** *** 545,554 **** if (mode[0] != GL.GL_SELECT) { gl.glEnable(GL.GL_DEPTH_TEST); - - if (drawMode == LIGHTING_MODE) { - gl.glEnable(GL.GL_LIGHTING); - } else { - gl.glDisable(GL.GL_LIGHTING); - } // draw selection gl.glColor3fv(SELECTED_COLOR); --- 559,562 ---- *************** *** 559,619 **** } - // draw target - gl.glColor3fv(TARGET_COLOR); - if (target != null) { - drawObject(target); - } - - gl.glDisable(GL.GL_LIGHTING); - // draw activeEdge different if it is parallel with axis - if (activeEdge != null) { - Vertex to = activeEdge.getTo(); - Vertex from = activeEdge.getFrom(); - if (from.getY() == to.getY() && from.getZ() == to.getZ()) { - gl.glColor3fv(X_AXIS_COLOR); - } else if (from.getX() == to.getX() && from.getZ() == to.getZ()) { - gl.glColor3fv(Y_AXIS_COLOR); - } else if (from.getX() == to.getX() && from.getY() == to.getY()) { - gl.glColor3fv(Z_AXIS_COLOR); - } else { - gl.glColor3fv(STD_LINE_COLOR); - } - gl.glBegin(GL.GL_LINES); - gl.glLineWidth(1.0f); - gl.glVertex3d(from.getX(), from.getY(), from.getZ()); - gl.glVertex3d(to.getX(), to.getY(), to.getZ()); - gl.glEnd(); - } - - // draw alignment line - if (alignPoint != null && alignVertex != null) { - if (alignPoint[1] == alignVertex.getY() && alignPoint[2] == alignVertex.getZ()) { - gl.glColor3fv(X_AXIS_COLOR); - } else if (alignPoint[0] == alignVertex.getX() && alignPoint[2] == alignVertex.getZ()) { - gl.glColor3fv(Y_AXIS_COLOR); - } else if (alignPoint[0] == alignVertex.getX() && alignPoint[1] == alignVertex.getY()) { - gl.glColor3fv(Z_AXIS_COLOR); - } else { - gl.glColor3fv(DRAW_COLOR); - } - gl.glBegin(GL.GL_LINES); - gl.glVertex3d(alignPoint[0], alignPoint[1], alignPoint[2]); - gl.glVertex3d(alignVertex.getX(), alignVertex.getY(), alignVertex.getZ()); - gl.glEnd(); - } - - // draw snap point if any - if (snapVertex != null) { - gl.glColor3d(0.0, 1.0, 0.0); - gl.glPointSize(5.0f); - gl.glBegin(GL.GL_POINTS); - gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); - gl.glEnd(); - gl.glPointSize(1.0f); - } - - - if (doDrawEdges) { gl.glLineWidth(1.0f); --- 567,572 ---- } + // Draw edges if (doDrawEdges) { gl.glLineWidth(1.0f); *************** *** 627,630 **** --- 580,601 ---- } + // Draw any Vertex that are not part of an edge + { + gl.glColor3fv(STD_LINE_COLOR); + Iterator it = vertices.iterator(); + while (it.hasNext()) { + Vertex v = (Vertex)it.next(); + if (v.getEdges().isEmpty()) { + gl.glColor3fv(STD_LINE_COLOR); + gl.glPointSize(5.0f); + gl.glBegin(GL.GL_POINTS); + gl.glVertex3d(v.getX(), v.getY(), v.getZ()); + gl.glEnd(); + gl.glPointSize(1.0f); + } + } + } + + // Fill surfaces switch (drawMode) { case LIGHTING_MODE: { *************** *** 660,663 **** --- 631,703 ---- } } + + + + + + // draw target + gl.glColor3fv(TARGET_COLOR); + if (target != null) { + drawObject(target); + } + + gl.glDisable(GL.GL_DEPTH_TEST); + Vertex to = null; + if (activeEdge != null) { + to = activeEdge.getTo(); + Vertex from = activeEdge.getFrom(); + if (from.getY() == to.getY() && from.getZ() == to.getZ()) { + gl.glColor3fv(X_AXIS_COLOR); + } else if (from.getX() == to.getX() && from.getZ() == to.getZ()) { + gl.glColor3fv(Y_AXIS_COLOR); + } else if (from.getX() == to.getX() && from.getY() == to.getY()) { + gl.glColor3fv(Z_AXIS_COLOR); + } else { + gl.glColor3fv(STD_LINE_COLOR); + } + gl.glBegin(GL.GL_LINES); + gl.glLineWidth(1.0f); + gl.glVertex3d(from.getX(), from.getY(), from.getZ()); + gl.glVertex3d(to.getX(), to.getY(), to.getZ()); + gl.glEnd(); + + } + + if (to == null) { + to = currentVertex; + } + if (snapVertex != null && to != null) { + boolean doDraw = true; + if (snapVertex.getY() == to.getY() && snapVertex.getZ() == to.getZ()) { + gl.glColor3fv(X_AXIS_COLOR); + } else if (snapVertex.getX() == to.getX() && snapVertex.getZ() == to.getZ()) { + gl.glColor3fv(Y_AXIS_COLOR); + } else if (snapVertex.getX() == to.getX() && snapVertex.getY() == to.getY()) { + gl.glColor3fv(Z_AXIS_COLOR); + } else { + doDraw = false; + } + if (doDraw) { + gl.glEnable(GL.GL_LINE_STIPPLE); + gl.glBegin(GL.GL_LINES); + gl.glLineWidth(1.0f); + gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); + gl.glVertex3d(to.getX(), to.getY(), to.getZ()); + gl.glEnd(); + gl.glDisable(GL.GL_LINE_STIPPLE); + } + } + + + // draw snap point if any + if (snapVertex != null) { + gl.glDisable(GL.GL_DEPTH_TEST); + gl.glColor3fv(TARGET_COLOR); + gl.glPointSize(5.0f); + gl.glBegin(GL.GL_POINTS); + gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); + gl.glEnd(); + gl.glPointSize(1.0f); + } } else { *************** *** 702,711 **** private void drawObject(Object o) { if (o instanceof Vertex) { Vertex v = (Vertex) o; ! gl.glPointSize(7.0f); gl.glBegin(GL.GL_POINTS); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); gl.glEnd(); ! gl.glPointSize(1.0f); } else if (o instanceof Edge) { Edge e = (Edge) o; --- 742,753 ---- private void drawObject(Object o) { if (o instanceof Vertex) { + gl.glDisable(GL.GL_DEPTH_TEST); Vertex v = (Vertex) o; ! gl.glPointSize(9.0f); gl.glBegin(GL.GL_POINTS); gl.glVertex3d(v.getX(), v.getY(), v.getZ()); gl.glEnd(); ! gl.glPointSize(1.0f); ! gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Edge) { Edge e = (Edge) o; *************** *** 718,722 **** } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); Surface s = (Surface) o; drawSurface(s); --- 760,764 ---- } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(highlight); Surface s = (Surface) o; drawSurface(s); *************** *** 958,993 **** /** ! * Getter for alignVertex ! * @return alignVertex ! */ ! public Vertex getAlignVertex() { ! return alignVertex; ! } ! ! /** ! * Setter for alignVertex ! * @param v The new alignVertex */ ! public void setAlignVertex(Vertex v) { ! alignVertex = v; } /** ! * Setter for alignPoint ! * @param coord The new alignPoint */ ! public void setAlignPoint(double[] coord) { ! alignPoint = coord; } /** - * Getter for alignPoint - * @return alignPoint - */ - public double[] getAlignPoint() { - return alignPoint; - } - - /** * Setter for target * @param o The object to be target --- 1000,1019 ---- /** ! * Getter for currentVertex ! * @return currentVertex */ ! public Vertex getCurrentVertex() { ! return currentVertex; } /** ! * Setter for currentVertex ! * @param v The new currentVertex */ ! public void setCurrentVertex(Vertex v) { ! currentVertex = v; } /** * Setter for target * @param o The object to be target Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** View.java 30 Oct 2005 15:55:40 -0000 1.15 --- View.java 31 Oct 2005 07:52:45 -0000 1.16 *************** *** 31,41 **** /** the color of the x axis */ ! public static final float[] X_AXIS_COLOR = new float[] {0.0f, 1.0f, 0.0f}; /** the color of the y axis */ ! public static final float[] Y_AXIS_COLOR = new float[] {1.0f, 0.0f, 0.0f}; /** the color of the z axis */ ! public static final float[] Z_AXIS_COLOR = new float[] {0.0f, 0.0f, 1.0f}; /** the std line color*/ --- 31,41 ---- /** the color of the x axis */ ! public static final float[] X_AXIS_COLOR = new float[] {0.1f, 0.8f, 0.1f}; /** the color of the y axis */ ! public static final float[] Y_AXIS_COLOR = new float[] {0.8f, 0.1f, 0.1f}; /** the color of the z axis */ ! public static final float[] Z_AXIS_COLOR = new float[] {0.1f, 0.1f, 0.8f}; /** the std line color*/ *************** *** 61,65 **** /** Used for target objects */ ! public static final float[] TARGET_COLOR = new float[] {0.1f, 0.8f, 0.1f}; /** Can be used for setting wireframe mode */ --- 61,65 ---- /** Used for target objects */ ! public static final float[] TARGET_COLOR = new float[] {0.8f, 0.8f, 0.1f}; /** Can be used for setting wireframe mode */ *************** *** 148,161 **** /** ! * Setter for alignVertex ! * @param v The new alignVertex */ ! public void setAlignVertex(Vertex v); /** ! * Getter for alignVertex ! * @return alignVertex */ ! public Vertex getAlignVertex(); /** --- 148,162 ---- /** ! * Setter for currentVertex ! * @param v The new currentVertex */ ! public void setCurrentVertex(Vertex v); /** ! * Getter for currentVertex ! * @return currentVertex */ ! public Vertex getCurrentVertex(); ! /** *************** *** 166,181 **** /** - * Setter for alignPoint - * @param coord The new alignPoint - */ - public void setAlignPoint(double[] coord); - - /** - * Getter for alignPoint - * @return alignPoint - */ - public double[] getAlignPoint(); - - /** * Get transformation for model to screen coordinates * @return The transformation --- 167,170 ---- |