bprocessor-commit Mailing List for B-processor (Page 154)
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-10-30 15:55:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19988/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java PencilTool.java Log Message: Improved hit detection of vertices Uses different colors for back and front of surfaces in LIGHTING_MODE Added snap-functionality in PencilTool when drawing holes on surfaces Length is now millimeter (because the . is not accepted in length field) Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PencilTool.java 28 Oct 2005 12:15:55 -0000 1.28 --- PencilTool.java 30 Oct 2005 15:55:40 -0000 1.29 *************** *** 17,20 **** --- 17,21 ---- import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; *************** *** 53,56 **** --- 54,58 ---- protected Surface exterior = null; + /** The candidates are the Set of surfaces that could be the exterior * for a hole being defined. *************** *** 245,248 **** --- 247,273 ---- /** + * Snaps within a coordinate system + * @param system The coordinate system + * @param vertex The vertex to snap + */ + 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()); + } + } + + /** * Set current vertex to an appropriate vertex * @param event The MouseEvent *************** *** 260,263 **** --- 285,289 ---- Edge ray = new Edge("ray", near, far); ray = transformation.unProject(ray); + CoordinateSystem system = null; if (target != null) { *************** *** 269,272 **** --- 295,299 ---- Plane plane = surface.plane(); Vertex vertex = plane.intersection(ray); + system = surface.coordinateSystem(); vertex.setName("current"); current = vertex; *************** *** 279,282 **** --- 306,312 ---- } } + if (exterior != null) { + system = exterior.coordinateSystem(); + } } if (target instanceof Edge) { *************** *** 299,302 **** --- 329,338 ---- if (snap) { snap(current); + } else { + if (legal) { + if (system != null) { + snapInSystem(system, current); + } + } } Set vertices = Project.getInstance().findByLocation *************** *** 420,424 **** if (current != null) { Vertex temp = new Vertex("temp", to.getX(), to.getY(), to.getZ()); ! active.setLength(d); current.setX(to.getX()); current.setY(to.getY()); --- 456,460 ---- 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()); *************** *** 449,453 **** if (active != null) { double d = Double.parseDouble(number); ! glv.setLength(d); } } catch (NumberFormatException exp) { --- 485,489 ---- if (active != null) { double d = Double.parseDouble(number); ! glv.setLength(d / 1000); } } catch (NumberFormatException exp) { Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** AbstractTool.java 21 Oct 2005 11:57:10 -0000 1.23 --- AbstractTool.java 30 Oct 2005 15:55:40 -0000 1.24 *************** *** 164,167 **** --- 164,172 ---- */ public void mouseMoved(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + + AbstractTool.dx = x - pressPos[0]; + AbstractTool.dy = y - pressPos[1]; moved(e); glv.repaint(true); *************** *** 197,206 **** pressPos[0] = e.getX(); pressPos[1] = e.getY(); ! int rotamask = InputEvent.ALT_DOWN_MASK; ! if (currentButton == MouseEvent.BUTTON3 || (e.getModifiersEx() & rotamask) == rotamask) { timer.addActionListener(moveAction); ! } ! ! pressed(e); glv.repaint(true); } --- 202,211 ---- 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); } |
From: Michael L. <he...@us...> - 2005-10-30 15:55:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19988/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Improved hit detection of vertices Uses different colors for back and front of surfaces in LIGHTING_MODE Added snap-functionality in PencilTool when drawing holes on surfaces Length is now millimeter (because the . is not accepted in length field) Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** GLView.java 24 Oct 2005 10:27:28 -0000 1.19 --- GLView.java 30 Oct 2005 15:55:40 -0000 1.20 *************** *** 212,216 **** */ public void setText(double d) { ! super.setText(Double.toString(d)); } --- 212,217 ---- */ public void setText(double d) { ! int mm = (int) (d * 1000.0); ! super.setText(Integer.toString(mm)); } *************** *** 222,226 **** try { double d = Double.parseDouble(super.getText()); ! return d; } catch (NumberFormatException e) { log.warn(e); --- 223,227 ---- try { double d = Double.parseDouble(super.getText()); ! return (d / 1000); } catch (NumberFormatException e) { log.warn(e); |
From: Michael L. <he...@us...> - 2005-10-30 15:55:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19988/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java Log Message: Improved hit detection of vertices Uses different colors for back and front of surfaces in LIGHTING_MODE Added snap-functionality in PencilTool when drawing holes on surfaces Length is now millimeter (because the . is not accepted in length field) Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** AbstractView.java 28 Oct 2005 12:18:38 -0000 1.47 --- AbstractView.java 30 Oct 2005 15:55:40 -0000 1.48 *************** *** 21,24 **** --- 21,25 ---- import java.util.ArrayList; + import java.util.HashSet; import java.util.Iterator; import java.util.List; *************** *** 149,153 **** /** The drawing mode. Either wireframe, solid og lighting */ ! protected int drawMode = View.WIREFRAME_MODE; /** The transparency of surfaces */ --- 150,158 ---- /** The drawing mode. Either wireframe, solid og lighting */ ! protected int drawMode = View.LIGHTING_MODE; ! ! /** Specify edge drawing **/ ! protected boolean doDrawEdges = true; ! /** The transparency of surfaces */ *************** *** 192,200 **** gl = gld.getGL(); glu = gld.getGLU(); ! GLUtesselator tess = glu.gluNewTess(); ! glu.gluBeginPolygon(tess); ! glu.gluEndPolygon(tess); ! glu.gluDeleteTess(tess); ! // TODO Initialize tesselation... AbstractView.width = gld.getSize().getWidth(); AbstractView.height = gld.getSize().getHeight(); --- 197,201 ---- gl = gld.getGL(); glu = gld.getGLU(); ! AbstractView.width = gld.getSize().getWidth(); AbstractView.height = gld.getSize().getHeight(); *************** *** 238,241 **** --- 239,243 ---- if (picking > 0) { //notice 512 is just some magic number for the size of the selectbuffer + // TODO Catch overflow in select buffer selectBuffer = BufferUtils.newIntBuffer(512); gl.glSelectBuffer(512, selectBuffer); *************** *** 339,345 **** int x, int y, int width, int height) { ! this.width = width; ! this.height = height; ! this.aspect = this.width / this.height; } --- 341,347 ---- int x, int y, int width, int height) { ! AbstractView.width = width; ! AbstractView.height = height; ! AbstractView.aspect = AbstractView.width / AbstractView.height; } *************** *** 612,624 **** - if (drawMode == LIGHTING_MODE) { - gl.glEnable(GL.GL_LIGHTING); - } ! gl.glLineWidth(1.0f); ! // draw all the edges in the model ! if (drawMode != LIGHTING_MODE) { ! Iterator eit = edges.iterator(); gl.glColor3fv(STD_LINE_COLOR); while (eit.hasNext()) { Edge e = (Edge)eit.next(); --- 614,624 ---- ! ! if (doDrawEdges) { ! gl.glLineWidth(1.0f); gl.glColor3fv(STD_LINE_COLOR); + // draw all the edges in the model + Iterator eit = edges.iterator(); while (eit.hasNext()) { Edge e = (Edge)eit.next(); *************** *** 626,652 **** } } ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); ! // draw all the surfaces in the model ! if (drawMode != WIREFRAME_MODE) { ! Iterator it = surfaces.iterator(); gl.glColor3fv(SURFACE_COLOR); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! if (!selection.contains(s)) { ! if ((s.getBackDomain() instanceof FunctionalSpace) && ! (s.getFrontDomain() instanceof FunctionalSpace)) { ! gl.glEnable(GL.GL_POLYGON_STIPPLE); ! gl.glPolygonStipple(transparency); ! drawSurface(s); ! gl.glDisable(GL.GL_POLYGON_STIPPLE); ! } else { ! drawSurface(s); ! } ! } ! } } - gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } else { --- 626,663 ---- } } ! ! switch (drawMode) { ! case LIGHTING_MODE: { ! gl.glEnable(GL.GL_LIGHTING); ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glEnable(GL.GL_CULL_FACE); ! ! gl.glCullFace(GL.GL_BACK); ! gl.glColor3fv(FRONT_COLOR); ! drawSurfaces(gld); ! ! gl.glCullFace(GL.GL_FRONT); ! gl.glColor3fv(BACK_COLOR); ! drawSurfaces(gld); ! ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glDisable(GL.GL_LIGHTING); ! break; ! } ! case WIREFRAME_MODE: { ! // NOTHING TO DO ! break; ! } ! case SOLID_MODE: { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR); ! drawSurfaces(gld); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! break; ! } } } else { *************** *** 810,817 **** */ private void drawVertexHit(Vertex v) { ! gl.glPushMatrix(); ! gl.glTranslated(v.getX(), v.getY(), v.getZ()); ! glu.gluSphere(ball, 0.5, 8, 8); ! gl.glPopMatrix(); } --- 821,835 ---- */ private void drawVertexHit(Vertex v) { ! // TODO draw a point ! gl.glPointSize(7.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! ! //gl.glPushMatrix(); ! //gl.glTranslated(v.getX(), v.getY(), v.getZ()); ! //glu.gluSphere(ball, 0.5, 8, 8); ! //gl.glPopMatrix(); } *************** *** 839,852 **** private void drawSurfaces(GLDrawable gld) { Set surfaces = Project.getInstance().getSurfaces(); GL gl = gld.getGL(); ! GLU glu = gld.getGLU(); ! Iterator it = surfaces.iterator(); - gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Surface s = (Surface)it.next(); ! gl.glPushName(s.getId().intValue()); ! drawSurface(s); ! gl.glPopName(); } } --- 857,877 ---- private void drawSurfaces(GLDrawable gld) { Set surfaces = Project.getInstance().getSurfaces(); + Collection selection = glv.getTool().getSelection(); GL gl = gld.getGL(); ! Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); ! if (!selection.contains(s)) { ! if ((s.getBackDomain() instanceof FunctionalSpace) && ! (s.getFrontDomain() instanceof FunctionalSpace)) { ! //gl.glEnable(GL.GL_POLYGON_STIPPLE); ! //gl.glPolygonStipple(transparency); ! //drawSurface(s); ! //gl.glDisable(GL.GL_POLYGON_STIPPLE); ! } else { ! drawSurface(s); ! } ! } } } *************** *** 1011,1019 **** objectTable = null; } /** * Processes the select buffer ! * @return the ID of the closest hit and -1 of no hit. */ ! private int processSelect() { //Processing hits int bufferOffset = 0; --- 1036,1046 ---- objectTable = null; } + + /** * Processes the select buffer ! * @return the ID of the closest hit and -1 if no hit. */ ! private int processSelectSimple() { //Processing hits int bufferOffset = 0; *************** *** 1046,1049 **** --- 1073,1150 ---- /** + * Processes the select buffer + * @return the ID of the closest hit and -1 if no hit. + */ + private Object processSelect() { + //Processing hits + // TODO Find vertices + int bufferOffset = 0; + int names = 0; + long zMax = 0xFFFFFFFFL; + double nearest = 1.0; + int id = -1; + + Object closest = null; + Object current = null; + + Set vertices = new HashSet(); + + for (int i = 0; i < hits; i++) { + names = selectBuffer.get(bufferOffset); + if (names > 0) { + bufferOffset++; + long z1 = 0xFFFFFFFFL & selectBuffer.get(bufferOffset); + long z2 = 0xFFFFFFFFL & selectBuffer.get(bufferOffset + 1); + double near = (double) z1 / (double) zMax; + double far = (double) z2 / (double) zMax; + + bufferOffset += 2; + id = selectBuffer.get(bufferOffset); + current = getName(id); + if (current instanceof Vertex) { + vertices.add(current); + } + if (near < nearest) { + nearest = near; + closest = current; + } + bufferOffset += names; + } else { + bufferOffset += 3; + } + } + if (closest instanceof Surface) { + 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.00000000001) { + return v; + } + } + + } + if (closest instanceof Edge) { + Edge edge = (Edge) closest; + if (vertices.contains(edge.getFrom())) { + return edge.getFrom(); + } + if (vertices.contains(edge.getTo())) { + return edge.getTo(); + } + } + 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 *************** *** 1061,1073 **** //repainting to get selection buffer glv.repaint(true); ! id = processSelect(); ! if (id != -1) { ! Object o = getName(id); ! clearNames(); ! return o; ! } else { ! clearNames(); ! return null; ! } } --- 1162,1169 ---- //repainting to get selection buffer glv.repaint(true); ! ! Object o = processSelect(); ! clearNames(); ! return o; } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** View.java 28 Oct 2005 12:18:58 -0000 1.14 --- View.java 30 Oct 2005 15:55:40 -0000 1.15 *************** *** 50,53 **** --- 50,59 ---- /** Surface color for all not selected surfaces */ public static final float[] SURFACE_COLOR = new float[] {0.93f, 0.93f, 0.93f}; + + /** Front color for surfaces */ + public static final float[] FRONT_COLOR = new float[] {0.96f, 0.87f, 0.70f}; + + /** Back color for surfaces */ + public static final float[] BACK_COLOR = new float[] {0.94f, 0.97f, 1.00f}; /** Used for selected objects */ |
From: Michael L. <he...@us...> - 2005-10-30 15:50:46
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19185/src/net/sourceforge/bprocessor/model Modified Files: CoordinateSystem.java Log Message: Implemented CoordinateSystem.unTranslate, which translates from the coordinatesystem to global coordinates Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CoordinateSystem.java 24 Oct 2005 10:25:47 -0000 1.5 --- CoordinateSystem.java 30 Oct 2005 15:50:38 -0000 1.6 *************** *** 151,154 **** --- 151,170 ---- /** + * Return the vertex translated from the CoordinateSystem to + * the global coordinate system + * @param vertex The vertex to un-translate + * @return The un-translated vertex + */ + public Vertex unTranslate(Vertex vertex) { + Vertex ii = i.copy(); + ii.scale(vertex.getX()); + Vertex jj = j.copy(); + jj.scale(vertex.getY()); + Vertex nn = n.copy(); + nn.scale(vertex.getZ()); + return origin.add(ii).add(jj).add(nn); + } + + /** * Translate all vertices in the list * @param vertices The list of vertices |
From: Michael L. <he...@us...> - 2005-10-30 15:49:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18841/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: Fixed small error with saving functional space. There are still errors.. Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PersistenceManager.java 2 Oct 2005 14:36:30 -0000 1.10 --- PersistenceManager.java 30 Oct 2005 15:49:36 -0000 1.11 *************** *** 699,712 **** Set data = fs.getAttributes(); ! Iterator it = data.iterator(); ! while (it.hasNext()) { ! net.sourceforge.bprocessor.model.Attribute a = ! (net.sourceforge.bprocessor.model.Attribute)it.next(); ! Long aid = saveAttribute(bp, a); ! fsx.getAttributeref().add(aid); } - Map fsm = (Map)mapper.get(KEY_DOMAIN); fsm.put(fs.getId(), new Long(fsx.getId())); --- 699,713 ---- Set data = fs.getAttributes(); ! if (data != null) { ! Iterator it = data.iterator(); ! while (it.hasNext()) { ! net.sourceforge.bprocessor.model.Attribute a = ! (net.sourceforge.bprocessor.model.Attribute)it.next(); ! Long aid = saveAttribute(bp, a); ! fsx.getAttributeref().add(aid); ! } } Map fsm = (Map)mapper.get(KEY_DOMAIN); fsm.put(fs.getId(), new Long(fsx.getId())); |
From: Nordholt <nor...@us...> - 2005-10-28 13:30:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11557 Modified Files: Surface.java Log Message: fixed checks when moving hole so it works again Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Surface.java 24 Oct 2005 10:25:47 -0000 1.42 --- Surface.java 28 Oct 2005 13:30:11 -0000 1.43 *************** *** 422,426 **** if (this.isInner) { ! Set surfaces = SurfaceFacade.getInstance().findAll(); Iterator surfIt = surfaces.iterator(); while (surfIt.hasNext()) { --- 422,426 ---- if (this.isInner) { ! Set surfaces = Project.getInstance().getSurfaces(); Iterator surfIt = surfaces.iterator(); while (surfIt.hasNext()) { *************** *** 613,616 **** --- 613,617 ---- backDomain.removeSurface(this); } + backDomain = back; } |
From: Nordholt <nor...@us...> - 2005-10-28 12:19:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv961 Modified Files: View.java Log Message: added method to determine surface orientation compared to the camera Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** View.java 21 Oct 2005 11:57:09 -0000 1.13 --- View.java 28 Oct 2005 12:18:58 -0000 1.14 *************** *** 10,13 **** --- 10,14 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Surface; import net.java.games.jogl.GLEventListener; *************** *** 201,203 **** --- 202,213 ---- */ public double getFar(); + + + /** + * Returns a boolean idicating wherther or not the camera is facing + * the front of the surface. + * @param surface the surface + * @return the boolean + */ + public boolean facingFront(Surface surface); } |
From: Nordholt <nor...@us...> - 2005-10-28 12:18:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32739 Modified Files: AbstractView.java Log Message: added method to determine surface orientation compared to the camera Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** AbstractView.java 27 Oct 2005 15:05:10 -0000 1.46 --- AbstractView.java 28 Oct 2005 12:18:38 -0000 1.47 *************** *** 201,205 **** AbstractView.aspect = AbstractView.width / AbstractView.height; ! gl.glClearColor(0.7f, 0.7f, 0.7f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); --- 201,205 ---- AbstractView.aspect = AbstractView.width / AbstractView.height; ! gl.glClearColor(0.7f, 0.7f, 0.7f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); *************** *** 395,402 **** */ void labelSurface(Surface surface, boolean clickable) { - Vertex from = surface.center(); - Vertex n = surface.normal(); - n.scale(1 / n.length()); Transformation transformation = transformation(); Domain frontDomain = surface.getFrontDomain(); Domain backDomain = surface.getBackDomain(); --- 395,401 ---- */ void labelSurface(Surface surface, boolean clickable) { Transformation transformation = transformation(); + Vertex from = surface.center(); + Vertex front = transformation.project(from); Domain frontDomain = surface.getFrontDomain(); Domain backDomain = surface.getBackDomain(); *************** *** 419,433 **** int backWidth = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_18, backName); - Vertex front = transformation.project(from); Vertex frontTextAnchor; Vertex backTextAnchor; ! ! ! Vertex near = new Vertex("", front.getX(), front.getY(), 0.0); ! Vertex far = new Vertex("", front.getX(), front.getY(), 1.0); ! Edge ray = new Edge("", near, far); ! ray = transformation.unProject(ray); ! Vertex rayDir = ray.getTo().minus(ray.getFrom()); ! if (rayDir.dot(n) > 0) { frontTextAnchor = new Vertex("", front.getX() - (frontWidth / 2), front.getY() - 17, front.getZ()); --- 418,425 ---- int backWidth = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_18, backName); Vertex frontTextAnchor; Vertex backTextAnchor; ! ! if (!facingFront(surface)) { frontTextAnchor = new Vertex("", front.getX() - (frontWidth / 2), front.getY() - 17, front.getZ()); *************** *** 1213,1219 **** * @return The transformation */ ! public Transformation transformation() { ! return null; ! } /** --- 1205,1209 ---- * @return The transformation */ ! public abstract Transformation transformation(); /** *************** *** 1240,1242 **** --- 1230,1253 ---- return height; } + + /** + * Returns a boolean idicating wherther or not we are facing + * the front of the surface. + * @param surface the surface + * @return the boolean + */ + 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; + + ray = transformation.unProject(ray); + rayDir = ray.getTo().minus(ray.getFrom()); + normal.scale(1 / normal.length()); + return rayDir.dot(normal) < 0; + } } |
From: Nordholt <nor...@us...> - 2005-10-28 12:16:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29071 Modified Files: SelectTool.java Log Message: added copy and paste to the seperator menu Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** SelectTool.java 27 Oct 2005 15:02:09 -0000 1.33 --- SelectTool.java 28 Oct 2005 12:16:38 -0000 1.34 *************** *** 167,171 **** --- 167,180 ---- ActionListener shiftListener = new ShiftActionListener(surface); shift.addActionListener(shiftListener); + JMenuItem copy = new JMenuItem("Copy space assignment"); + ActionListener copyListener = new CopyActionListener(surface, glv.getView()); + copy.addActionListener(copyListener); + JMenuItem paste = new JMenuItem("Paste space assignment"); + ActionListener pasteListener = new PasteActionListener(surface, glv.getView()); + paste.addActionListener(pasteListener); + sepPop.add(shift); + sepPop.add(copy); + sepPop.add(paste); sepPop.pack(); return sepPop; |
From: Nordholt <nor...@us...> - 2005-10-28 12:16:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27066 Modified Files: PencilTool.java Log Message: small fixes when assigning spaces Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** PencilTool.java 21 Oct 2005 11:57:10 -0000 1.27 --- PencilTool.java 28 Oct 2005 12:15:55 -0000 1.28 *************** *** 22,27 **** import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.FunctionalSpace; - import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Geometry; --- 22,25 ---- *************** *** 181,189 **** if (sp != null) { sp.addSurface(surface); ! } ! if (sp instanceof ConstructionSpace) { ! Project.getInstance().update((ConstructionSpace)sp); ! } else if (sp instanceof FunctionalSpace) { ! Project.getInstance().update((FunctionalSpace)sp); } else { //log.warn("No space was found"); --- 179,186 ---- if (sp != null) { sp.addSurface(surface); ! surface.setFrontDomain(sp); ! surface.setBackDomain(sp); ! Project.getInstance().update(surface); ! Project.getInstance().update(sp); } else { //log.warn("No space was found"); |
From: Nordholt <nor...@us...> - 2005-10-28 12:14:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24281 Added Files: CopyActionListener.java Log Message: first commit --- NEW FILE: CopyActionListener.java --- //--------------------------------------------------------------------------------- // $Id: CopyActionListener.java,v 1.1 2005/10/28 12:14:05 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 java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Domain; import org.apache.log4j.Logger; /** * The copy action listener. Lets us copy an assignment of domains to a surface. */ public class CopyActionListener implements ActionListener { /** * The logger */ private static Logger log = Logger.getLogger(SelectTool.class); /** * The copied domain facing the camera */ private static Domain facing = null; /** * The copied domain not facing the camera */ private static Domain nonFacing = null; /** * The surface this listener shifts spaces on */ private Surface surface; /** * The view */ private View view; /** * Constructs a listener * @param surface the surface * @param view the view */ public CopyActionListener (Surface surface, View view) { this.surface = surface; this.view = view; } /** * Invoked when an action is performed * @param e The action event */ public void actionPerformed(ActionEvent e) { if (view.facingFront(surface)) { facing = surface.getFrontDomain(); nonFacing = surface.getBackDomain(); } else { facing = surface.getBackDomain(); nonFacing = surface.getFrontDomain(); } } /** * Gets the copied domain facing the camera * @return the domain */ public static Domain getFacing() { return facing; } /** * Gets the copied domain not facing the camera * @return the domain */ public static Domain getNonFacing() { return nonFacing; } } |
From: Nordholt <nor...@us...> - 2005-10-28 12:12:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21399 Added Files: PasteActionListener.java Log Message: first commit --- NEW FILE: PasteActionListener.java --- //--------------------------------------------------------------------------------- // $Id: PasteActionListener.java,v 1.1 2005/10/28 12:12:42 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 java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Project; import org.apache.log4j.Logger; /** * The copy action listener. Lets us copy an assignment of domains to a surface. */ public class PasteActionListener implements ActionListener { /** * The logger */ private static Logger log = Logger.getLogger(SelectTool.class); /** * The surface this listener pastes domains to */ private Surface surface; /** * The view */ private View view; /** * Constructs a listener * @param surface the surface * @param view the view */ public PasteActionListener (Surface surface, View view) { this.surface = surface; this.view = view; } /** * Invoked when an action is performed * @param e The action event */ public void actionPerformed(ActionEvent e) { Domain facing = CopyActionListener.getFacing(); Domain nonFacing = CopyActionListener.getNonFacing(); if (view.facingFront(surface)) { surface.setFrontDomain(facing); surface.setBackDomain(nonFacing); } else { surface.setBackDomain(facing); surface.setFrontDomain(nonFacing); } Project.getInstance().update(surface); if (facing != null) { facing.addSurface(surface); Project.getInstance().update(facing); } if (nonFacing != null) { nonFacing.addSurface(surface); Project.getInstance().update(nonFacing); } } } |
From: Nordholt <nor...@us...> - 2005-10-28 10:42:10
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29673 Modified Files: MemoryFacade.java Log Message: fixed the filter method Index: MemoryFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/MemoryFacade.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MemoryFacade.java 7 Oct 2005 05:52:48 -0000 1.2 --- MemoryFacade.java 28 Oct 2005 10:42:00 -0000 1.3 *************** *** 314,318 **** Object current = iter.next(); if (current.getClass() == clarse) { ! result.add(result); } } --- 314,318 ---- Object current = iter.next(); if (current.getClass() == clarse) { ! result.add(current); } } |
From: Nordholt <nor...@us...> - 2005-10-28 08:27:06
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4034 Modified Files: ExtrusionTool.java Log Message: null pointer fix Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ExtrusionTool.java 27 Oct 2005 15:02:56 -0000 1.22 --- ExtrusionTool.java 28 Oct 2005 08:26:57 -0000 1.23 *************** *** 218,223 **** surf.setBackDomain(back); Project.getInstance().update(surf); ! back.addSurface(surf); ! Project.getInstance().update(back); } } --- 218,225 ---- surf.setBackDomain(back); Project.getInstance().update(surf); ! if (back != null) { ! back.addSurface(surf); ! Project.getInstance().update(back); ! } } } *************** *** 233,238 **** surf.setFrontDomain(front); Project.getInstance().update(surf); ! front.addSurface(surf); ! Project.getInstance().update(front); } } --- 235,242 ---- surf.setFrontDomain(front); Project.getInstance().update(surf); ! if (front != null) { ! front.addSurface(surf); ! Project.getInstance().update(front); ! } } } |
From: Nordholt <nor...@us...> - 2005-10-27 15:05:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16295 Modified Files: AbstractView.java Log Message: Changed way of displaying the space labels Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** AbstractView.java 26 Oct 2005 10:15:05 -0000 1.45 --- AbstractView.java 27 Oct 2005 15:05:10 -0000 1.46 *************** *** 122,126 **** /** The ball is used for hit-detecting vertices */ - protected GLUquadric ball; --- 122,125 ---- *************** *** 269,277 **** drawAll(gld); - - if (glv.getTool() instanceof SelectTool) { - decorateSelection(); - } - gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 268,271 ---- *************** *** 371,376 **** CoordinateSystem system = surface.coordinateSystem(); Vertex n = system.getN(); ! ! Edge edge = new Edge("", from.minus(n), from.add(n)); gl.glColor3d(0.0, 0.0, 1.0); drawEdge(edge); --- 365,370 ---- CoordinateSystem system = surface.coordinateSystem(); Vertex n = system.getN(); ! ! Edge edge = new Edge("", from, from.add(n)); gl.glColor3d(0.0, 0.0, 1.0); drawEdge(edge); *************** *** 404,408 **** Vertex n = surface.normal(); n.scale(1 / n.length()); - Vertex spot = from.add(n); Transformation transformation = transformation(); Domain frontDomain = surface.getFrontDomain(); --- 398,401 ---- *************** *** 426,523 **** int backWidth = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_18, backName); ! Vertex front = transformation.project(from.add(n)); ! Vertex back = transformation.project(from.minus(n)); ! Vertex frontAnchor; ! Vertex backAnchor; Vertex frontTextAnchor; Vertex backTextAnchor; - int backSign; - int frontSign; - if (front.getX() > back.getX()) { - frontAnchor = new Vertex("", front.getX() + 40, front.getY() + 10, front.getZ()); - frontTextAnchor = frontAnchor; - backAnchor = new Vertex("", back.getX() - 40, back.getY() + 10, back.getZ()); - backTextAnchor = new Vertex("", backAnchor.getX() - backWidth, - backAnchor.getY(), backAnchor.getZ()); - frontSign = 1; - backSign = -1; - } else { - frontAnchor = new Vertex("", front.getX() - 40, front.getY() + 10, front.getZ()); - frontTextAnchor = new Vertex("", frontAnchor.getX() - frontWidth, - frontAnchor.getY(), frontAnchor.getZ()); - backAnchor = new Vertex("", back.getX() + 40, back.getY() + 10, back.getZ()); - backTextAnchor = backAnchor; - frontSign = -1; - backSign = 1; - } - ! gl.glLineWidth(1.0f); ! gl.glColor3d(0.4, 0.4, 0.4); ! gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(front.getX(), front.getY(), front.getZ()); ! gl.glVertex3d(frontAnchor.getX(), frontAnchor.getY(), frontAnchor.getZ()); ! gl.glEnd(); ! 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); } if (clickable) { ! pushName(gl, "front"); ! gl.glBegin(GL.GL_POLYGON); ! gl.glVertex3d(frontAnchor.getX(), frontAnchor.getY(), frontAnchor.getZ()); ! gl.glVertex3d(frontAnchor.getX() + (frontSign * frontWidth), ! frontAnchor.getY(), ! frontAnchor.getZ()); ! gl.glVertex3d(frontAnchor.getX() + (frontSign * frontWidth), ! frontAnchor.getY() + 18, ! frontAnchor.getZ()); ! gl.glVertex3d(frontAnchor.getX(), ! frontAnchor.getY() + 18, ! frontAnchor.getZ()); ! gl.glEnd(); popName(gl); } else { drawString(frontTextAnchor.getX(), frontTextAnchor.getY(), frontName); } ! gl.glColor3d(0.4, 0.4, 0.4); gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(back.getX(), back.getY(), back.getZ()); ! gl.glVertex3d(backAnchor.getX(), backAnchor.getY(), backAnchor.getZ()); gl.glEnd(); - 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); - } - if (clickable) { - pushName(gl, "back"); - gl.glBegin(GL.GL_POLYGON); - gl.glVertex3d(backAnchor.getX(), - backAnchor.getY(), - backAnchor.getZ()); - gl.glVertex3d(backAnchor.getX() + (backSign * backWidth), - backAnchor.getY(), - backAnchor.getZ()); - gl.glVertex3d(backAnchor.getX() + (backSign * backWidth), - backAnchor.getY() + 18, - backAnchor.getZ()); - gl.glVertex3d(backAnchor.getX(), - backAnchor.getY(), - backAnchor.getZ()); - gl.glEnd(); - popName(gl); - } else { - drawString(backTextAnchor.getX(), backTextAnchor.getY(), backName); - } } /** * Put labels on the selection * @param clickable if true clicking the labels brings up dialog. --- 419,518 ---- int backWidth = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_18, backName); ! Vertex front = transformation.project(from); Vertex frontTextAnchor; Vertex backTextAnchor; ! Vertex near = new Vertex("", front.getX(), front.getY(), 0.0); ! Vertex far = new Vertex("", front.getX(), front.getY(), 1.0); ! Edge ray = new Edge("", near, far); ! ray = transformation.unProject(ray); ! Vertex rayDir = ray.getTo().minus(ray.getFrom()); ! if (rayDir.dot(n) > 0) { ! frontTextAnchor = new Vertex("", front.getX() - (frontWidth / 2), ! front.getY() - 17, front.getZ()); ! backTextAnchor = new Vertex("", front.getX() - (backWidth / 2), ! front.getY() + 7, front.getZ()); } else { ! frontTextAnchor = new Vertex("", front.getX() - (frontWidth / 2), ! front.getY() + 7, front.getZ()); ! backTextAnchor = new Vertex("", front.getX() - (backWidth / 2), ! front.getY() - 17, front.getZ()); } + if (clickable) { ! //Name must be "front" ! drawClickBox(frontTextAnchor.getX(), frontTextAnchor.getY(), ! frontTextAnchor.getZ(), frontWidth, 10, ! "front"); ! //Name must be "back" ! drawClickBox(backTextAnchor.getX(), backTextAnchor.getY(), ! backTextAnchor.getZ(), backWidth, 10, ! "back"); ! //Name must be "bar" ! pushName(gl, "bar"); ! drawSeperator(front, Math.max(frontWidth, backWidth)); 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); + + drawSeperator(front, Math.max(frontWidth, backWidth)); } ! } ! /** ! * Draws the seperator between spacenames ! * @param center the center of the seperating bar ! * @param width the width of the bar ! */ ! private void drawSeperator(Vertex center, int width) { ! gl.glLineWidth(3.0f); ! gl.glColor3d(0.0, 0.0, 0.0); gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(center.getX() + (width / 2), center.getY(), center.getZ()); ! gl.glVertex3d(center.getX() - (width / 2), center.getY(), center.getZ()); gl.glEnd(); } /** + * Draws a box from the coordinates that gets a given name in selection + * @param x x-coordinate of lower left corner + * @param y y-coordinate of lower left corner + * @param z z-coordinate of lower left corner + * @param width box width + * @param height box height + * @param name the name for the box + */ + 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); + gl.glVertex3d(x * width, y, z); + gl.glVertex3d(x + width, y + height, z); + gl.glVertex3d(x, y + height, z); + gl.glEnd(); + popName(gl); + } + + + /** * Put labels on the selection * @param clickable if true clicking the labels brings up dialog. |
From: Nordholt <nor...@us...> - 2005-10-27 15:03:37
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15941 Modified Files: MoveTool.java Log Message: made so move and rotate can not happen at same time Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MoveTool.java 21 Sep 2005 09:35:29 -0000 1.14 --- MoveTool.java 27 Oct 2005 15:03:27 -0000 1.15 *************** *** 133,136 **** --- 133,142 ---- */ protected void dragged(MouseEvent e) { + //have to use getModifiersEx() getButton() gives wrong results + if ((e.getModifiersEx() & + MouseEvent.BUTTON3_DOWN_MASK) + == MouseEvent.BUTTON3_DOWN_MASK) { + return; + } if (dragPlane != null) { int x = e.getX(); |
From: Nordholt <nor...@us...> - 2005-10-27 15:03:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15834 Modified Files: ExtrusionTool.java Log Message: small bug fixes Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ExtrusionTool.java 26 Oct 2005 12:56:26 -0000 1.21 --- ExtrusionTool.java 27 Oct 2005 15:02:56 -0000 1.22 *************** *** 218,221 **** --- 218,223 ---- surf.setBackDomain(back); Project.getInstance().update(surf); + back.addSurface(surf); + Project.getInstance().update(back); } } *************** *** 230,234 **** Surface surf = (Surface)surfIt.next(); surf.setFrontDomain(front); ! Project.getInstance().update(surf); } } --- 232,238 ---- Surface surf = (Surface)surfIt.next(); surf.setFrontDomain(front); ! Project.getInstance().update(surf); ! front.addSurface(surf); ! Project.getInstance().update(front); } } |
From: Nordholt <nor...@us...> - 2005-10-27 15:02:24
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15714 Modified Files: SelectTool.java Log Message: now makes seperator pop up appear Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** SelectTool.java 21 Oct 2005 11:57:10 -0000 1.32 --- SelectTool.java 27 Oct 2005 15:02:09 -0000 1.33 *************** *** 22,29 **** import net.sourceforge.bprocessor.model.Space; ! import net.sourceforge.bprocessor.gui.GUI; import java.awt.event.ActionListener; - import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; --- 22,28 ---- import net.sourceforge.bprocessor.model.Space; ! import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; *************** *** 33,37 **** import javax.swing.JMenuItem; import javax.swing.JMenu; - import javax.swing.JOptionPane; import java.util.Iterator; --- 32,35 ---- *************** *** 111,170 **** if (target instanceof String) { String side = (String)target; ! JPopupMenu pp = new JPopupMenu(side); ! Set domains = Project.getInstance().getDomains(); ! Iterator domIt = domains.iterator(); ! Iterator selIt = new HashSet(selection).iterator(); ! Surface surface = null; ! if (selIt.hasNext()) { ! Object o = selIt.next(); ! if (o instanceof Surface) { ! surface = (Surface)o; ! } ! JMenuItem noneItem = new JMenuItem("NONE"); ! ActionListener noneListener = new DomainPopupListener(null, ! surface, ! side.equals("front")); ! noneItem.addActionListener(noneListener); ! pp.add(noneItem); ! pp.addSeparator(); ! JMenu createSub = new JMenu("Create"); ! JMenuItem createFuncItem = new JMenuItem("New Functional Space"); ! ActionListener funcListener = new CreateSpaceActionListener(surface, ! side.equals("front"), ! true); ! createFuncItem.addActionListener(funcListener); ! createSub.add(createFuncItem); ! ! JMenuItem createConstItem = new JMenuItem("New Construction Space"); ! ActionListener constListener = new CreateSpaceActionListener(surface, ! side.equals("front"), ! false); ! createConstItem.addActionListener(constListener); ! createSub.add(createConstItem); ! ! pp.add(createSub); ! pp.addSeparator(); ! JMenu funcMenu = new JMenu("Functional Spaces"); ! JMenu constMenu = new JMenu("Construction Spaces"); ! while (domIt.hasNext()) { ! Domain domain = (Domain)domIt.next(); ! if (domain instanceof Space) { ! JMenuItem domainItem = new JMenuItem(domain.getName()); ! ActionListener ml = new DomainPopupListener(domain, ! surface, ! side.equals("front")); ! domainItem.addActionListener(ml); ! if (domain instanceof FunctionalSpace) { ! funcMenu.add(domainItem); ! } else { ! constMenu.add(domainItem); ! } ! } ! } ! pp.add(funcMenu); ! pp.add(constMenu); ! pp.pack(); ! glv.popup(pp, e.getX(), e.getY()); ! } } else if (target == null) { Iterator it = new HashSet(selection).iterator(); --- 109,113 ---- if (target instanceof String) { String side = (String)target; ! glv.popup(makePopup(side), e.getX(), e.getY()); } else if (target == null) { Iterator it = new HashSet(selection).iterator(); *************** *** 194,197 **** --- 137,254 ---- } + /** + * Creates the correct type popup menu. + * @param type the type of popup should be created + * @return the popup menu. + */ + private JPopupMenu makePopup(String type) { + if (type.equals("bar")) { + return seperatorPopup(); + } else if (type.equals("front") || type.equals("back")) { + return spacePopup(type); + } else { + log.warn("\"" + type + "\" is not a recognized type of popup"); + return null; + } + } + + /** + * Creates the popup that appears when pressing a space seperator + * @return the seperatorpopup menu. + */ + private JPopupMenu seperatorPopup() { + JPopupMenu sepPop = new JPopupMenu(); + Iterator selIt = new HashSet(selection).iterator(); + if (selIt.hasNext()) { + Object o = selIt.next(); + if (o instanceof Surface) { + Surface surface = (Surface)o; + JMenuItem shift = new JMenuItem("Shift spaces"); + ActionListener shiftListener = new ShiftActionListener(surface); + shift.addActionListener(shiftListener); + sepPop.add(shift); + sepPop.pack(); + return sepPop; + } + } + log.warn("Space popup menu has no surface"); + return sepPop; + } + + /** + * Creates the popup that appears when pressing a space label + * @param side string indicating the wich space is choosen (front or back). + * @return the spacepopup menu. + */ + private JPopupMenu spacePopup(String side) { + JPopupMenu pp = new JPopupMenu(side); + Set domains = Project.getInstance().getDomains(); + Iterator domIt = domains.iterator(); + Iterator selIt = new HashSet(selection).iterator(); + Surface surface = null; + if (selIt.hasNext()) { + Object o = selIt.next(); + if (o instanceof Surface) { + surface = (Surface)o; + } + JMenuItem noneItem = new JMenuItem("NONE"); + ActionListener noneListener = new DomainPopupListener(null, + surface, + side.equals("front")); + noneItem.addActionListener(noneListener); + + JMenu createSub = new JMenu("Create"); + JMenuItem createFuncItem = new JMenuItem("New Functional Space"); + ActionListener funcListener = new CreateSpaceActionListener(surface, + side.equals("front"), + true); + createFuncItem.addActionListener(funcListener); + createSub.add(createFuncItem); + + JMenuItem createConstItem = new JMenuItem("New Construction Space"); + ActionListener constListener = new CreateSpaceActionListener(surface, + side.equals("front"), + false); + createConstItem.addActionListener(constListener); + createSub.add(createConstItem); + + JMenu funcMenu = new JMenu("Functional Spaces"); + JMenu constMenu = new JMenu("Construction Spaces"); + boolean funcEnabled = false; + boolean constEnabled = false; + while (domIt.hasNext()) { + Domain domain = (Domain)domIt.next(); + if (domain instanceof Space) { + JMenuItem domainItem = new JMenuItem(domain.getName()); + ActionListener ml = new DomainPopupListener(domain, + surface, + side.equals("front")); + domainItem.addActionListener(ml); + if (domain instanceof FunctionalSpace) { + funcEnabled = true; + funcMenu.add(domainItem); + } else { + constEnabled = true; + constMenu.add(domainItem); + } + } + } + + funcMenu.setEnabled(funcEnabled); + constMenu.setEnabled(constEnabled); + pp.add(funcMenu); + pp.add(constMenu); + pp.addSeparator(); + pp.add(createSub); + pp.addSeparator(); + pp.add(noneItem); + pp.pack(); + return pp; + } else { + log.warn("Space popup menu has no surface"); + return null; + } + } + /** * Sends the notification for select *************** *** 368,506 **** } return false; ! } ! ! /** ! * The listener for the domain popup menu. ! */ ! private class DomainPopupListener implements ActionListener { ! ! /** The domain */ ! private Domain domain; ! ! /** The Surface */ ! private Surface surface; ! ! /** Boolean telling if this is for the front or back of the surface*/ ! private boolean front; ! ! /** ! * Constructs a listener for an item in the domain popup that assigns the given domain to ! * the given side of a surface. ! * @param domain the domain ! * @param surface the surface ! * @param front werther or not this popup for the front of the back of the surface ! */ ! public DomainPopupListener(Domain domain, Surface surface, boolean front) { ! this.domain = domain; ! this.surface = surface; ! this.front = front; ! } ! ! /** ! * Invoked when an action is performed ! * @param arg0 an action event ! */ ! public void actionPerformed(ActionEvent arg0) { ! if (front) { ! Domain oldFront = surface.getFrontDomain(); ! surface.setFrontDomain(domain); ! if (domain != null) { ! domain.addSurface(surface); ! } ! if (oldFront != null) { ! Project.getInstance().update(oldFront); ! } ! } else { ! Domain oldBack = surface.getBackDomain(); ! surface.setBackDomain(domain); ! if (domain != null) { ! domain.addSurface(surface); ! } ! if (oldBack != null) { ! Project.getInstance().update(oldBack); ! } ! } ! if (domain != null) { ! Project.getInstance().update(domain); ! } ! ! Project.getInstance().update(surface); ! } ! } ! ! /** ! * The create functional space action listener for the domain popupmenu. ! */ ! public class CreateSpaceActionListener implements ActionListener { ! ! /** The Surface */ ! private Surface surface; ! ! /** Boolean telling if this is for the front or back of the surface*/ ! private boolean front; ! ! /** Boolean telling if this is for creating functional or construction spaces*/ ! private boolean functional; ! ! /** ! * CreateSpaceActionListener ! * @param surface the surface this listener is associated with ! * @param front should be true if this listener is associated with the front-side of the surface ! * @param functional should be true this listener is for creating functional spaces. Otherwise ! * it will be for construction spaces. ! */ ! public CreateSpaceActionListener(Surface surface, boolean front, boolean functional) { ! this.surface = surface; ! this.front = front; ! this.functional = functional; ! } ! ! /** ! * Action performed ! * @param e The action event ! */ ! public void actionPerformed(ActionEvent e) { ! String result; ! if (functional) { ! result = JOptionPane.showInputDialog(GUI.getInstance(), ! "Name", ! "Create Functional Space", ! JOptionPane.QUESTION_MESSAGE); ! } else { ! result = JOptionPane.showInputDialog(GUI.getInstance(), ! "Name", ! "Create Construction Space", ! JOptionPane.QUESTION_MESSAGE); ! } ! if (log.isDebugEnabled()) { ! log.debug("Input: " + result); ! } ! ! if (result != null && !result.trim().equals("")) { ! Space space; ! if (functional) { ! space = new FunctionalSpace(result.trim()); ! Project.getInstance().intern((FunctionalSpace)space); ! } else { ! space = new ConstructionSpace(result.trim()); ! Project.getInstance().intern((ConstructionSpace)space); ! } ! ! Domain old; ! if (front) { ! old = surface.getFrontDomain(); ! surface.setFrontDomain(space); ! } else { ! old = surface.getBackDomain(); ! surface.setBackDomain(space); ! } ! space.addSurface(surface); ! Project.getInstance().update(space); ! if (old != null) { ! Project.getInstance().update(old); ! } ! } ! } ! } } - --- 425,428 ---- } return false; ! } } |
From: Nordholt <nor...@us...> - 2005-10-27 14:59:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15104 Added Files: CreateSpaceActionListener.java Log Message: Moved this to no longer be inner class of selecttool --- NEW FILE: CreateSpaceActionListener.java --- //--------------------------------------------------------------------------------- // $Id: CreateSpaceActionListener.java,v 1.1 2005/10/27 14:59:46 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.gui.GUI; import javax.swing.JOptionPane; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Space; import org.apache.log4j.Logger; /** * The create functional space action listener for the domain popupmenu. */ public class CreateSpaceActionListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(SelectTool.class); /** The Surface */ private Surface surface; /** Boolean telling if this is for the front or back of the surface*/ private boolean front; /** Boolean telling if this is for creating functional or construction spaces*/ private boolean functional; /** * CreateSpaceActionListener * @param surface the surface this listener is associated with * @param front should be true if this listener is associated with the front-side of the surface * @param functional should be true this listener is for creating functional spaces. Otherwise * it will be for construction spaces. */ public CreateSpaceActionListener(Surface surface, boolean front, boolean functional) { this.surface = surface; this.front = front; this.functional = functional; } /** * Action performed * @param e The action event */ public void actionPerformed(ActionEvent e) { String result; if (functional) { result = JOptionPane.showInputDialog(GUI.getInstance(), "Name", "Create Functional Space", JOptionPane.QUESTION_MESSAGE); } else { result = JOptionPane.showInputDialog(GUI.getInstance(), "Name", "Create Construction Space", JOptionPane.QUESTION_MESSAGE); } if (log.isDebugEnabled()) { log.debug("Input: " + result); } if (result != null && !result.trim().equals("")) { Space space; if (functional) { space = new FunctionalSpace(result.trim()); Project.getInstance().intern((FunctionalSpace)space); } else { space = new ConstructionSpace(result.trim()); Project.getInstance().intern((ConstructionSpace)space); } Domain old; if (front) { old = surface.getFrontDomain(); surface.setFrontDomain(space); } else { old = surface.getBackDomain(); surface.setBackDomain(space); } space.addSurface(surface); Project.getInstance().update(space); if (old != null) { Project.getInstance().update(old); } } } } |
From: Nordholt <nor...@us...> - 2005-10-27 14:59:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14955 Added Files: DomainPopupListener.java Log Message: Moved this to no longer be inner class of selecttool --- NEW FILE: DomainPopupListener.java --- //--------------------------------------------------------------------------------- // $Id: DomainPopupListener.java,v 1.1 2005/10/27 14:59:16 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 java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import org.apache.log4j.Logger; /** * The listener for the domain popup menu. */ public class DomainPopupListener implements ActionListener { /** The logger */ private static Logger log = Logger.getLogger(SelectTool.class); /** The domain */ private Domain domain; /** The Surface */ private Surface surface; /** Boolean telling if this is for the front or back of the surface*/ private boolean front; /** * Constructs a listener for an item in the domain popup that assigns the given domain to * the given side of a surface. * @param domain the domain * @param surface the surface * @param front werther or not this popup for the front of the back of the surface */ public DomainPopupListener(Domain domain, Surface surface, boolean front) { this.domain = domain; this.surface = surface; this.front = front; } /** * Invoked when an action is performed * @param arg0 an action event */ public void actionPerformed(ActionEvent arg0) { if (front) { Domain oldFront = surface.getFrontDomain(); surface.setFrontDomain(domain); if (domain != null) { domain.addSurface(surface); } if (oldFront != null) { Project.getInstance().update(oldFront); } } else { Domain oldBack = surface.getBackDomain(); surface.setBackDomain(domain); if (domain != null) { domain.addSurface(surface); } if (oldBack != null) { Project.getInstance().update(oldBack); } } if (domain != null) { Project.getInstance().update(domain); } Project.getInstance().update(surface); } } |
From: Nordholt <nor...@us...> - 2005-10-27 14:58:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14678 Added Files: ShiftActionListener.java Log Message: Listener for the space shift menu item --- NEW FILE: ShiftActionListener.java --- //--------------------------------------------------------------------------------- // $Id: ShiftActionListener.java,v 1.1 2005/10/27 14:58:06 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 java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Project; import org.apache.log4j.Logger; /** * The shift action listener. */ public class ShiftActionListener implements ActionListener { /** * The logger */ private static Logger log = Logger.getLogger(SelectTool.class); /** * The surface this listener shifts spaces on */ private Surface surface; /** * Constructs a listener * @param surface the surface */ public ShiftActionListener (Surface surface) { this.surface = surface; } /** * Invoked when an action is performed * @param e The action event */ public void actionPerformed(ActionEvent e) { Domain back = surface.getBackDomain(); Domain front = surface.getFrontDomain(); surface.setFrontDomain(back); surface.setBackDomain(front); Project.getInstance().update(surface); if (back != null) { back.addSurface(surface); Project.getInstance().update(back); } if (front != null) { front.addSurface(surface); Project.getInstance().update(front); } } } |
From: Nordholt <nor...@us...> - 2005-10-26 12:56:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12275 Modified Files: ExtrusionTool.java Log Message: extrusion now assigns the right spaces. Bug when rotating and extruding at the same time fixed Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ExtrusionTool.java 3 Oct 2005 18:41:34 -0000 1.20 --- ExtrusionTool.java 26 Oct 2005 12:56:26 -0000 1.21 *************** *** 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,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; *************** *** 30,33 **** --- 30,35 ---- import java.util.Iterator; import java.util.Set; + import java.util.HashSet; + import java.util.LinkedList; import org.apache.log4j.Logger; *************** *** 39,57 **** private static Logger log = Logger.getLogger(ExtrusionTool.class); ! /** the new surface to drag */ private static Surface dragSurface = null; ! /** the dragplane */ private Plane dragplane; ! /*** the previous x-coordinate */ private double prevX; ! /** the previous y-coordinate */ private double prevY; /** The extrusion edge */ private Edge extrusion; ! /** * The Constructor --- 41,68 ---- private static Logger log = Logger.getLogger(ExtrusionTool.class); ! /** The new surface to drag */ private static Surface dragSurface = null; ! /** The dragplane */ private Plane dragplane; ! /** The previous x-coordinate */ private double prevX; ! /** The previous y-coordinate */ private double prevY; /** The extrusion edge */ private Edge extrusion; ! ! /** The extruded surface */ ! private Surface extrudeSurface; ! ! /** The list of surfaces created by the current extrusion */ ! private LinkedList extrudedSurfaces; ! ! /** The set of surfaces created from the inner surfaces */ ! private Set innerExSurfs; ! /** * The Constructor *************** *** 67,78 **** */ protected void dragged(MouseEvent e) { if (target instanceof Surface) { Surface selectedSurface = (Surface)target; if (dragSurface == null) { ! if (isExtrudeable(selectedSurface)) { ! dragSurface = selectedSurface; ! } else { ! dragSurface = createExtension(selectedSurface); ! } } else { Vertex normal = dragSurface.normal(); --- 78,91 ---- */ protected void dragged(MouseEvent e) { + //have to use getModifiersEx() getButton() gives wrong results + if ((e.getModifiersEx() & + MouseEvent.BUTTON3_DOWN_MASK) + == MouseEvent.BUTTON3_DOWN_MASK) { + return; + } if (target instanceof Surface) { Surface selectedSurface = (Surface)target; if (dragSurface == null) { ! dragSurface = createExtension(selectedSurface); } else { Vertex normal = dragSurface.normal(); *************** *** 84,88 **** double normDotDelta = normal.dot(delta); normal.scale(normDotDelta / (normal.length() * normal.length())); - //normal.scale(delta); List l = dragSurface.getVertices(); //moving the dragged surface along its normal vector --- 97,100 ---- *************** *** 118,159 **** /** - * Checks if a surface is extrudeable - * @param s Surface - * @return true if the surface is extrudeable otherwise false - */ - private boolean isExtrudeable(Surface s) { - if (s == null || s.getIsInner()) { - return false; - } - Vertex normal = s.normal(); - List l = s.getVertices(); - if (l != null) { - for (int i = 0; i < l.size(); i++) { - Vertex v = (Vertex)l.get(i); - Set edges = v.getEdges(); - if (edges.size() >= 3) { - Iterator it = edges.iterator(); - while (it.hasNext()) { - Edge e = (Edge)it.next(); - if (!s.contains(e)) { - extrusion = e; - Vertex v1 = e.otherVertex(v); - Vertex v2 = v1.minus(v); - Vertex cross = v2.cross(normal); - if (Math.abs(cross.length()) > 0.0001) { - return false; - } - } - } - } else { - return false; - } - } - return true; - } - return false; - } - - /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object --- 130,133 ---- *************** *** 184,204 **** protected void released(MouseEvent e) { super.released(e); dragSurface = null; extrusion = null; } ! /** * Extends a single surface to a corresponding 3D figure. * @param extendSurf the surface to extend. ! * @return the top surface of the extended surface. */ ! private Surface extendSurface(Surface extendSurf) { // HAVE TO BE CHANGED IN FUTURE RELEASE ! Domain newSpace = extendSurf.getBackDomain(); ! if (newSpace == null) { ! newSpace = new ConstructionSpace("innerSpace"); ! Project.getInstance().intern((ConstructionSpace) newSpace); ! } ! Domain outer = extendSurf.getFrontDomain(); Edge previousEdge = null; Vertex previousVertex = null; --- 158,246 ---- protected void released(MouseEvent e) { super.released(e); + + //this is when no surfaces is selected + if (extrudeSurface == null) { + return; + } + 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); + } + } dragSurface = null; extrusion = null; + extrudeSurface = null; + extrudedSurfaces = null; } ! ! /** ! * Assigns spaces for a list of extruded surfaces. ! * @param surfaces the list of surfaces ! */ ! private void assignSpaces(LinkedList surfaces) { ! if (surfaces != null) { ! Surface top = (Surface)surfaces.getFirst(); ! Surface bottom = (Surface)surfaces.getLast(); ! Domain front = bottom.getFrontDomain(); ! Domain back = bottom.getBackDomain(); ! surfaces.removeLast(); ! Vertex norm = bottom.normal(); ! Vertex dir = top.center().minus(bottom.center()); ! if (norm.dot(dir) > 0) { ! assignBacks(front, surfaces); ! } else { ! assignFronts(back, surfaces); ! } ! } ! } ! /** ! * Assigns the given domain to the back of a set of surfaces ! * @param back the domain ! * @param surfaces the set of surfaces ! */ ! private void assignBacks(Domain back, LinkedList surfaces) { ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surf = (Surface)surfIt.next(); ! surf.setBackDomain(back); ! Project.getInstance().update(surf); ! } ! } ! /** ! * Assigns the given domain to the front of a set of surfaces ! * @param front the domain ! * @param surfaces the set of surfaces ! */ ! private void assignFronts(Domain front, LinkedList surfaces) { ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surf = (Surface)surfIt.next(); ! surf.setFrontDomain(front); ! Project.getInstance().update(surf); ! } ! } ! /** * Extends a single surface to a corresponding 3D figure. * @param extendSurf the surface to extend. ! * @return the list of new surfaces created by the extrusion ! * with the top surface as the head of the list. */ ! private LinkedList extendSurface(Surface extendSurf) { // HAVE TO BE CHANGED IN FUTURE RELEASE ! LinkedList newSurfaces = new LinkedList(); Edge previousEdge = null; Vertex previousVertex = null; *************** *** 207,212 **** List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); - newSpace.addSurface(extendSurf); - extendSurf.setBackDomain(newSpace); Iterator i = edges.iterator(); Edge current = null; --- 249,252 ---- *************** *** 263,268 **** } Surface sur = createSurface(newEdges); ! newSpace.addSurface(sur); ! sur.setFrontDomain(newSpace); newEdges = new ArrayList(); --- 303,307 ---- } Surface sur = createSurface(newEdges); ! newSurfaces.add(sur); newEdges = new ArrayList(); *************** *** 281,304 **** } //moving this line to the top - Project.getInstance().update(newSpace); Surface topSurf = createSurface(top); - newSpace.addSurface(topSurf); - topSurf.setFrontDomain(newSpace); Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); ! if (outer instanceof FunctionalSpace) { ! n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, outer.getId()); ! } else if (outer instanceof ConstructionSpace) { ! n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, outer.getId()); ! } ! Notifier.getInstance().sendNotification(n); ! if (newSpace instanceof ConstructionSpace) { ! n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, newSpace.getId()); ! } else if (newSpace instanceof FunctionalSpace) { ! n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, newSpace.getId()); ! } ! Notifier.getInstance().sendNotification(n); ! ! return topSurf; } --- 320,329 ---- } //moving this line to the top Surface topSurf = createSurface(top); Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); ! ! newSurfaces.addFirst(topSurf); ! return newSurfaces; } *************** *** 309,320 **** */ private Surface createExtension(Surface selectedSurface) { ! ! Surface top = extendSurface(selectedSurface); Set innerSurfaces = selectedSurface.getInnerSurfaces(); if (innerSurfaces != null) { Iterator innerIt = innerSurfaces.iterator(); while (innerIt.hasNext()) { Surface innerSurf = (Surface)innerIt.next(); ! Surface newInnerSurf = extendSurface(innerSurf); top.addHole(newInnerSurf); newInnerSurf.setIsInner(true); --- 334,364 ---- */ private Surface createExtension(Surface selectedSurface) { ! extrudeSurface = selectedSurface; ! ! LinkedList extensions = extendSurface(selectedSurface); ! Surface top = (Surface)extensions.getFirst(); ! extensions.addLast(extrudeSurface); ! /* ! 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. ! */ ! extrudedSurfaces = extensions; ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); + innerExSurfs = new HashSet(); if (innerSurfaces != null) { Iterator innerIt = innerSurfaces.iterator(); while (innerIt.hasNext()) { Surface innerSurf = (Surface)innerIt.next(); ! extensions = extendSurface(innerSurf); ! Surface newInnerSurf = (Surface)extensions.getFirst(); ! extensions.addLast(innerSurf); ! /* ! 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. ! */ ! innerExSurfs.add(extensions); top.addHole(newInnerSurf); newInnerSurf.setIsInner(true); |
From: Michael L. <he...@us...> - 2005-10-26 10:15:16
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8455/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Uses glPolygonOffset to solve som z-fighting issues: - The edge-lines are visible - The green highligt does not mix with the original surface Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** AbstractView.java 24 Oct 2005 10:27:28 -0000 1.44 --- AbstractView.java 26 Oct 2005 10:15:05 -0000 1.45 *************** *** 254,257 **** --- 254,258 ---- gl.glLineWidth(3.0f); gl.glEnable(GL.GL_DEPTH_TEST); + gl.glDepthFunc(GL.GL_LESS); coords(); *************** *** 265,269 **** gl.glColor3fv(STD_LINE_COLOR); ! gl.glLineWidth(2.0f); drawAll(gld); --- 266,270 ---- gl.glColor3fv(STD_LINE_COLOR); ! gl.glLineWidth(3.0f); drawAll(gld); *************** *** 623,626 **** --- 624,633 ---- } + + if (drawMode == LIGHTING_MODE) { + gl.glEnable(GL.GL_LIGHTING); + } + + gl.glLineWidth(1.0f); // draw all the edges in the model if (drawMode != LIGHTING_MODE) { *************** *** 631,638 **** drawEdge(e); } - } else { - gl.glEnable(GL.GL_LIGHTING); } ! // draw all the surfaces in the model if (drawMode != WIREFRAME_MODE) { --- 638,645 ---- drawEdge(e); } } ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); // draw all the surfaces in the model if (drawMode != WIREFRAME_MODE) { *************** *** 654,657 **** --- 661,665 ---- } } + gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } else { |
From: Michael L. <he...@us...> - 2005-10-26 09:13:10
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29182 Modified Files: build.sh Log Message: Added quotes around path variables, since they may contain spaces Index: build.sh =================================================================== RCS file: /cvsroot/bprocessor/build/build.sh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** build.sh 27 Jun 2005 09:32:45 -0000 1.1.1.1 --- build.sh 26 Oct 2005 09:13:01 -0000 1.2 *************** *** 6,14 **** fi ! if [ -z $JAVA_HOME ]; then echo "Please set the JAVA_HOME variable." exit 1 fi ! export PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$PATH ant $* --- 6,16 ---- fi ! if [ -z "$JAVA_HOME" ]; then echo "Please set the JAVA_HOME variable." exit 1 fi ! echo $JAVA_HOME ! ! export PATH="$ANT_HOME"/bin:"$JAVA_HOME"/bin:$PATH ant $* |
From: Michael L. <he...@us...> - 2005-10-26 09:13:10
|
Update of /cvsroot/bprocessor/build/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29182/bin Modified Files: bprocessor.sh Log Message: Added quotes around path variables, since they may contain spaces Index: bprocessor.sh =================================================================== RCS file: /cvsroot/bprocessor/build/bin/bprocessor.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bprocessor.sh 21 Oct 2005 08:45:41 -0000 1.3 --- bprocessor.sh 26 Oct 2005 09:13:02 -0000 1.4 *************** *** 1,5 **** #!/bin/sh ! if [ -z $JAVA_HOME ]; then echo "You'll need to set the JAVA_HOME variable to point to your Java installation" echo "F.ex: export JAVA_HOME=/usr/local/j2sdk1.4.2_08" --- 1,5 ---- #!/bin/sh ! if [ -z "$JAVA_HOME" ]; then echo "You'll need to set the JAVA_HOME variable to point to your Java installation" echo "F.ex: export JAVA_HOME=/usr/local/j2sdk1.4.2_08" *************** *** 7,17 **** fi OS=$OSTYPE LIBDIR=library/linux PLATFORM_DEFS= if [ $OS != "linux" ]; then ! LIBDIR=library/macosx ! PLATFORM_DEFS='-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=B-Processor' fi ! $JAVA_HOME/bin/java -Djava.library.path=$LIBDIR $PLATFORM_DEFS -jar kernel.jar --- 7,23 ---- fi + echo $OSTYPE + OS=$OSTYPE LIBDIR=library/linux PLATFORM_DEFS= if [ $OS != "linux" ]; then ! if [ $OS == "cygwin" ]; then ! LIBDIR=library/win32 ! else ! LIBDIR=library/macosx ! PLATFORM_DEFS='-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=B-Processor' ! fi fi ! "$JAVA_HOME/bin/java" -Djava.library.path=$LIBDIR $PLATFORM_DEFS -jar kernel.jar |