bprocessor-commit Mailing List for B-processor (Page 113)
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: Nordholt <nor...@us...> - 2006-08-08 15:13:00
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15788/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: exception handling in spacechecker Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GUI.java 4 Aug 2006 11:48:07 -0000 1.37 --- GUI.java 8 Aug 2006 15:12:57 -0000 1.38 *************** *** 454,470 **** public void run() { while (true) { - Iterator it = Project.getInstance().getSpaces().iterator(); - while (it.hasNext()) { - Space sp = (Space)it.next(); - if (sp.isClosed()) { - closedSpaces.add(sp); - } else { - closedSpaces.remove(sp); - } - } try { sleep(1000); } catch (Exception e) { ! log.info("Space checker thread threw a: " + e); } } --- 454,471 ---- public void run() { while (true) { try { + + Iterator it = Project.getInstance().getSpaces().iterator(); + while (it.hasNext()) { + Space sp = (Space)it.next(); + if (sp.isClosed()) { + closedSpaces.add(sp); + } else { + closedSpaces.remove(sp); + } + } sleep(1000); } catch (Exception e) { ! e.printStackTrace(); } } |
From: Nordholt <nor...@us...> - 2006-08-08 15:11:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15335/src/net/sourceforge/bprocessor/gl/tool Modified Files: OffsetTool.java Log Message: removed constructors Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OffsetTool.java 10 Jul 2006 12:19:28 -0000 1.2 --- OffsetTool.java 8 Aug 2006 15:11:32 -0000 1.3 *************** *** 124,128 **** updateFeedback(); } - updateConstructors(); } --- 124,127 ---- |
From: Michael L. <he...@us...> - 2006-08-08 13:01:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25684/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Cannot select a constructor by clicking the line Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** View.java 8 Aug 2006 12:05:05 -0000 1.128 --- View.java 8 Aug 2006 13:01:10 -0000 1.129 *************** *** 1002,1006 **** dist = (c.getOrigin().minus(v)).length() * scale; } ! drawGeneralConstructor(c, dist, false); } } --- 1002,1006 ---- dist = (c.getOrigin().minus(v)).length() * scale; } ! drawGeneralConstructor(c, dist, false, true); } } *************** *** 1059,1063 **** } if (target != c && !highligts.contains(c)) { ! drawGeneralConstructor(c, dist, true); } } --- 1059,1063 ---- } if (target != c && !highligts.contains(c)) { ! drawGeneralConstructor(c, dist, true, true); } } *************** *** 1074,1078 **** dist = (c.getOrigin().distance(v)) * scale; } ! drawGeneralConstructor(c, dist, true); } } --- 1074,1078 ---- dist = (c.getOrigin().distance(v)) * scale; } ! drawGeneralConstructor(c, dist, true, true); } } *************** *** 1083,1088 **** * @param dist The dist parameter * @param colorize Apply color */ ! private void drawGeneralConstructor(Constructor constructor, double dist, boolean colorize) { if (constructor instanceof Point) { if (colorize) { --- 1083,1090 ---- * @param dist The dist parameter * @param colorize Apply color + * @param active Draw the constructor active if active */ ! private void drawGeneralConstructor(Constructor constructor, double dist, ! boolean colorize, boolean active) { if (constructor instanceof Point) { if (colorize) { *************** *** 1098,1107 **** drawConstructorVector(l.getOrigin(), l.getDirection(), dist); } ! if (l.isActive()) { drawConstructorLine(l.getOrigin(), l.getDirection(), dist); } } else if (constructor instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem)constructor; ! drawCoordinateSystem(system, dist, colorize); } } --- 1100,1109 ---- drawConstructorVector(l.getOrigin(), l.getDirection(), dist); } ! if (l.isActive() && active) { drawConstructorLine(l.getOrigin(), l.getDirection(), dist); } } else if (constructor instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem)constructor; ! drawCoordinateSystem(system, dist, colorize, active); } } *************** *** 1112,1117 **** * @param dist The distance to the center of the system * @param colorize Apply color */ ! private void drawCoordinateSystem(CoordinateSystem cs, double dist, boolean colorize) { Vertex i = cs.getI(); Vertex j = cs.getJ(); --- 1114,1121 ---- * @param dist The distance to the center of the system * @param colorize Apply color + * @param active Draw the constructor active if active */ ! private void drawCoordinateSystem(CoordinateSystem cs, double dist, ! boolean colorize, boolean active) { Vertex i = cs.getI(); Vertex j = cs.getJ(); *************** *** 1122,1126 **** drawConstructorVector(cs.getOrigin(), i, dist); } ! if (cs.isActive()) { drawConstructorLine(cs.getOrigin(), i, dist); } --- 1126,1130 ---- drawConstructorVector(cs.getOrigin(), i, dist); } ! if (cs.isActive() && active) { drawConstructorLine(cs.getOrigin(), i, dist); } *************** *** 1131,1135 **** drawConstructorVector(cs.getOrigin(), j, dist); } ! if (cs.isActive()) { drawConstructorLine(cs.getOrigin(), j, dist); } --- 1135,1139 ---- drawConstructorVector(cs.getOrigin(), j, dist); } ! if (cs.isActive() && active) { drawConstructorLine(cs.getOrigin(), j, dist); } *************** *** 1142,1150 **** drawConstructorVector(cs.getOrigin(), n, dist); } ! if (cs.isActive()) { drawConstructorLine(cs.getOrigin(), n, dist); } } else { ! if (cs.isActive()) { Vertex origin = cs.getOrigin(); Vertex v = i.copy(); --- 1146,1154 ---- drawConstructorVector(cs.getOrigin(), n, dist); } ! if (cs.isActive() && active) { drawConstructorLine(cs.getOrigin(), n, dist); } } else { ! if (cs.isActive() && active) { Vertex origin = cs.getOrigin(); Vertex v = i.copy(); *************** *** 1851,1855 **** } else { pushName(gl, current); ! drawGeneralConstructor(current, dist, false); popName(gl); } --- 1855,1859 ---- } else { pushName(gl, current); ! drawGeneralConstructor(current, dist, false, false); popName(gl); } |
From: Michael L. <he...@us...> - 2006-08-08 12:05:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1300/src/net/sourceforge/bprocessor/model Modified Files: Line.java CoordinateSystem.java Log Message: Improved drawing of highlighted objects Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** CoordinateSystem.java 3 Aug 2006 14:33:00 -0000 1.21 --- CoordinateSystem.java 8 Aug 2006 12:05:10 -0000 1.22 *************** *** 453,457 **** from = o.minus(n); to = o.add(n); ! list.add(new Guide(from, to)); } return list; --- 453,458 ---- from = o.minus(n); to = o.add(n); ! Edge current = new Guide(from, to); ! list.add(current); } return list; *************** *** 461,464 **** --- 462,468 ---- */ private class Guide extends Edge { + /** */ + private static final long serialVersionUID = 1L; + /** * Constructor *************** *** 468,471 **** --- 472,476 ---- public Guide(Vertex from, Vertex to) { super(from, to); + setStrippled(true); } Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Line.java 31 Jul 2006 11:25:51 -0000 1.17 --- Line.java 8 Aug 2006 12:05:10 -0000 1.18 *************** *** 222,225 **** --- 222,226 ---- Vertex to = origin.add(direction); Edge constructor = new Guide(from, to); + constructor.setStrippled(true); return constructor; } |
From: Michael L. <he...@us...> - 2006-08-08 12:05:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1042/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Improved drawing of highlighted objects Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** View.java 4 Aug 2006 11:48:11 -0000 1.127 --- View.java 8 Aug 2006 12:05:05 -0000 1.128 *************** *** 68,71 **** --- 68,74 ---- private static Logger log = Logger.getLogger(View.class); + /** IGNORE */ + public static final boolean IGNORE = true; + /** the color of the x axis */ public static final float[] X_AXIS_COLOR = new float[] {0.1f, 0.8f, 0.1f}; *************** *** 544,558 **** gl.glPushMatrix(); picking = 0; - - // grid and coords are always completely lit - /*gl.glLineWidth(1.0f); - CoordinateSystem cs = Project.getInstance().getActiveCoordinateSystem(); - grid(cs); - Camera camera = Project.getInstance().getCurrentCamera(); - double scale = (camera.getFocalwidth() / 65) * (500 / height); - drawCoordinateSystem(cs, - ((new Vertex(camera.getCamera())).minus(cs.center())).length() * scale, true); - */ Iterator clipit = Project.getInstance().getCurrentCamera().getClipplanes().iterator(); while (clipit.hasNext()) { --- 547,551 ---- *************** *** 976,980 **** private void drawObject(Object o) { if (o instanceof Vertex) { ! //gl.glDisable(GL.GL_DEPTH_TEST); Vertex v = (Vertex) o; gl.glPointSize(9.0f); --- 969,973 ---- private void drawObject(Object o) { if (o instanceof Vertex) { ! gl.glDisable(GL.GL_DEPTH_TEST); Vertex v = (Vertex) o; gl.glPointSize(9.0f); *************** *** 983,994 **** gl.glEnd(); gl.glPointSize(1.0f); ! //gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Edge) { - //gl.glDisable(GL.GL_DEPTH_TEST); Edge e = (Edge) o; ! gl.glLineWidth(1.5f); drawEdge(e); gl.glLineWidth(1.0f); - //gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); --- 976,985 ---- gl.glEnd(); gl.glPointSize(1.0f); ! gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Edge) { Edge e = (Edge) o; ! gl.glLineWidth(2.0f); drawEdge(e); gl.glLineWidth(1.0f); } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); *************** *** 1265,1284 **** while (iter.hasNext()) { Edge current = (Edge)iter.next(); ! float[] color = (float[])colorMap.get(current); ! if (color != null) { ! gl.glColor3fv(color); ! if (current.getStrippled()) { drawConstructor(current); } else { drawEdge(current); } ! gl.glColor3fv(lineColor); ! } else if (current.getStrippled()) { ! gl.glColor3fv(constructorColor); ! drawConstructor(current); ! gl.glColor3fv(lineColor); ! } else { ! drawEdge(current); ! } } } --- 1256,1277 ---- while (iter.hasNext()) { Edge current = (Edge)iter.next(); ! if (IGNORE || !(highligts.contains(current) || current == target)) { ! float[] color = (float[])colorMap.get(current); ! if (color != null) { ! gl.glColor3fv(color); ! if (current.getStrippled()) { ! drawConstructor(current); ! } else { ! drawEdge(current); ! } ! gl.glColor3fv(lineColor); ! } else if (current.getStrippled()) { ! gl.glColor3fv(constructorColor); drawConstructor(current); + gl.glColor3fv(lineColor); } else { drawEdge(current); } ! } } } |
From: Michael L. <he...@us...> - 2006-08-04 11:48:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6715/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java ControlledMoveStrategy.java AbstractPencil.java Added Files: VectorMoveTool.java ControlledMoveTool.java AlternateMoveTool.java Log Message: Refactoring of Move Tool Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Tool.java 10 Jul 2006 15:26:38 -0000 1.25 --- Tool.java 4 Aug 2006 11:48:11 -0000 1.26 *************** *** 56,59 **** --- 56,61 ---- /** The Alternative Rect tool */ public static final int ALT_RECT_TOOL = 17; + /** The controlled move tool */ + public static final int CONTROLLED_MOVE_TOOL = 18; /** --- NEW FILE: ControlledMoveTool.java --- //--------------------------------------------------------------------------------- // $Id: ControlledMoveTool.java,v 1.1 2006/08/04 11:48:11 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * ControlledMoveTool */ public class ControlledMoveTool extends AlternateMoveTool { /** Slidemap */ private Map slideMap; /** Direction */ private Vertex direction; /** * ControlledMoveTool * @param glv GLView * @param cursor Cursor */ public ControlledMoveTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Trys to create the slideMap, returns true if it is succesfull, * false otherwise. * @return werther the creation of the map is succesfull. */ private Map createSlideMap() { Map slideMap = new HashMap(); Iterator it = entities.iterator(); while (it.hasNext()) { Geometric geo = (Geometric)it.next(); Map map = null; if (geo instanceof Edge) { map = createSlideMap((Edge)geo); } else if (geo instanceof Surface) { map = createSlideMap((Surface)geo); } else if (geo instanceof Vertex) { map = createSlideMap((Vertex)geo); } if (map != null) { slideMap.putAll(map); } else { return null; } } return slideMap; } /** * Finds the slidemap for an edge. * @param edge the edge * @return a map for edge, null if none can be found */ private Map createSlideMap(Edge edge) { if (current.object() instanceof Surface) { Surface surface = (Surface)current.object(); if (edge.getSurfaces().contains(surface)) { List edges = surface.getEdges(); int index = edges.indexOf(edge); Edge leftEdge; Edge rightEdge; if (index == 0) { leftEdge = (Edge)edges.get(edges.size() - 1); rightEdge = (Edge)edges.get(index + 1); } else if (index == (edges.size() - 1)) { leftEdge = (Edge)edges.get(index - 1); rightEdge = (Edge)edges.get(0); } else { leftEdge = (Edge)edges.get(index - 1); rightEdge = (Edge)edges.get(index + 1); } Edge toSlideEdge = null; Edge fromSlideEdge = null; Vertex to = edge.getTo(); Vertex from = edge.getFrom(); if (to.getEdges().contains(leftEdge) && from.getEdges().contains(rightEdge)) { toSlideEdge = leftEdge; fromSlideEdge = rightEdge; } else if (from.getEdges().contains(leftEdge) && to.getEdges().contains(rightEdge)) { fromSlideEdge = leftEdge; toSlideEdge = rightEdge; } Map map = new HashMap(); map.put(edge.getTo(), toSlideEdge.getDirection()); map.put(edge.getFrom(), fromSlideEdge.getDirection()); return map; } } return null; } /** * Finds the slide map for a vertex. * @param vertex the vertex * @return a map for the vertex, or null if none could be found. */ private Map createSlideMap(Vertex vertex) { if (current.object() instanceof Edge) { Edge edge = (Edge)current.object(); if (vertex.getEdges().contains(edge)) { Map map = new HashMap(); map.put(vertex, edge.getDirection()); return map; } } return null; } /** * Finds the slide map for a surface. * @param surface the surface * @return the map, or null if none could be found. */ private Map createSlideMap(Surface surface) { Collection verts = surface.getVertices(); Iterator it = verts.iterator(); boolean bound = false; Map map = new HashMap(); while (it.hasNext() && !bound) { Vertex vertex = (Vertex)it.next(); map.put(vertex, surface.normal()); Collection edges = vertex.getEdges(); Iterator edgeIt = edges.iterator(); int otherEdges = 0; while (edgeIt.hasNext() && !bound) { Edge edge = (Edge)edgeIt.next(); if (!surface.getEdges().contains(edge)) { otherEdges++; map.put(vertex, edge.getDirection()); } bound = otherEdges > 1; } bound = otherEdges > 1; } Collection holes = surface.getHoles(); it = holes.iterator(); while (it.hasNext() && !bound) { Map holeMap = createSlideMap((Surface)it.next()); if (holeMap != null) { map.putAll(holeMap); } else { bound = true; } } if (!bound) { return map; } else { return null; } } /** * @param e MouseEvent * @return Success */ protected boolean prepare(MouseEvent e) { current = findIntersection(e); if (current != null) { slideMap = createSlideMap(); if (slideMap != null) { Iterator it = entities.iterator(); boolean found = false; while (it.hasNext() && !found) { direction = direction((Geometric)it.next()); found = direction != null; } } } return slideMap != null; } /** * Finds the direction of the controlled movement. * @param geo a geometric object. * @return the direction. */ private Vertex direction(Geometric geo) { if (geo instanceof Surface) { Surface surface = (Surface)geo; return surface.normal(); } else if (geo instanceof Edge) { Edge edge = (Edge)geo; if (current.object() instanceof Surface) { Surface surface = (Surface)current.object(); if (edge.getSurfaces().contains(surface)) { Vertex edgeDir = edge.getDirection(); Vertex normal = surface.normal(); Vertex dir = edgeDir.cross(normal); dir.scale(1 / dir.length()); return dir; } } } else if (geo instanceof Vertex) { return (Vertex)slideMap.get(geo); } return null; } /** * Move the vertices * @param objects Collection of geometric objects * @param delta Vertex (vector) */ public void move(Collection objects, Vertex delta) { if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); directionCopy.scale(1 / directionCopy.length()); directionCopy.scale(delta.dot(directionCopy)); delta = directionCopy; if (delta.length() != 0) { Vertex deltaUnit = delta.copy(); deltaUnit.scale(1 / delta.length()); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex vertex = (Vertex)it.next(); Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); slideDir.scale(1 / slideDir.length()); double slideScale; if (delta == null) { Project.info("delta null"); } if (slideDir == null) { Project.info("slideDir null"); } if (deltaUnit == null) { Project.info("deltaUnit null"); } if (delta.getX() != 0) { slideScale = delta.getX() / (slideDir.dot(deltaUnit) * deltaUnit.getX()); } else if (delta.getY() != 0) { slideScale = delta.getY() / (slideDir.dot(deltaUnit) * deltaUnit.getY()); } else { slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); } slideDir.scale(slideScale); vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); } } } } /** * @see net.sourceforge.bprocessor.gl.tool.AbstractPencil#cleanUp() */ public void cleanUp() { slideMap = null; direction = null; super.cleanUp(); } } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** ToolFactory.java 31 Jul 2006 14:06:56 -0000 1.56 --- ToolFactory.java 4 Aug 2006 11:48:11 -0000 1.57 *************** *** 60,64 **** /** select tool */ private SpaceTool select; ! /** move tool */ private MoveTool move; --- 60,70 ---- /** select tool */ private SpaceTool select; ! ! /** Alternate Move Tool */ ! private AbstractTool alternate; ! ! /** Alternate Move Tool */ ! private AbstractTool controlled; ! /** move tool */ private MoveTool move; *************** *** 196,199 **** --- 202,207 ---- eraser = new EraserTool(glv, pencilcursor); arc = new ArcTool(glv, pencilcursor); + alternate = new VectorMoveTool(glv, pencilcursor); + controlled = new ControlledMoveTool(glv, pencilcursor); controlledStrategy = new ControlledMoveStrategy(glv, pencilcursor); vectorStrategy = new VectorMoveStrategy(glv, pencilcursor); *************** *** 233,239 **** "Biconextrudetool2.gif", "Controlled Extrude"); mulextrudeBut.setMnemonic(KeyEvent.VK_B); ! moveBut = this.registerTool(Tool.MOVE_TOOL, move, "Biconmovetool.gif", "Move"); moveBut.setMnemonic(KeyEvent.VK_M); ! moveBut.addMouseListener(new MoveButtonMouseListener(moveBut)); rotBut = this.registerTool(Tool.ROTATION_TOOL, rotation, "Biconrotobj.gif", "Rotation"); rotBut.setMnemonic(KeyEvent.VK_R); --- 241,248 ---- "Biconextrudetool2.gif", "Controlled Extrude"); mulextrudeBut.setMnemonic(KeyEvent.VK_B); ! moveBut = this.registerTool(Tool.MOVE_TOOL, alternate, "Biconmovetool.gif", "Move"); moveBut.setMnemonic(KeyEvent.VK_M); ! registerTool(Tool.CONTROLLED_MOVE_TOOL, controlled, "Biconmovetool.gif", "Controlled Move"); ! //moveBut.addMouseListener(new MoveButtonMouseListener(moveBut)); rotBut = this.registerTool(Tool.ROTATION_TOOL, rotation, "Biconrotobj.gif", "Rotation"); rotBut.setMnemonic(KeyEvent.VK_R); Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** AbstractPencil.java 3 Aug 2006 14:29:33 -0000 1.52 --- AbstractPencil.java 4 Aug 2006 11:48:11 -0000 1.53 *************** *** 484,488 **** } if (incident != null) { ! constructors.add(new CoordinateSystem(incident.vertex())); } --- 484,490 ---- } if (incident != null) { ! if (start == null || (!start.equalEps(incident))) { ! constructors.add(new CoordinateSystem(incident.vertex())); ! } } *************** *** 672,676 **** timer.restart(); if (intersection != null) { ! Object target = null; float[] targetColor = View.TARGET_COLOR; --- 674,678 ---- timer.restart(); if (intersection != null) { ! target = null; float[] targetColor = View.TARGET_COLOR; *************** *** 881,895 **** protected Set getAffected(Collection moveElements) { HashSet affected = new HashSet(); ! HashSet affectedEdges = new HashSet(); ! HashSet affectedSurfaces = new HashSet(); ! affected.addAll(collect(moveElements)); ! Iterator it = affected.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! affectedEdges.addAll(v.getEdges()); ! affectedSurfaces.addAll(v.getSurfaces()); ! } ! affected.addAll(affectedEdges); ! affected.addAll(affectedSurfaces); { Iterator iter = moveElements.iterator(); --- 883,895 ---- protected Set getAffected(Collection moveElements) { HashSet affected = new HashSet(); ! ! Set vertices = collect(moveElements); ! Set edges = Vertex.edges(vertices); ! Set surfaces = Edge.surfaces(edges); ! ! affected.addAll(vertices); ! affected.addAll(edges); ! affected.addAll(surfaces); ! { Iterator iter = moveElements.iterator(); --- NEW FILE: VectorMoveTool.java --- //--------------------------------------------------------------------------------- // $Id: VectorMoveTool.java,v 1.1 2006/08/04 11:48:11 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; import java.util.Collection; import java.util.Iterator; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * VectorMoveTool */ public class VectorMoveTool extends AlternateMoveTool { /** * Constructor for VectorMoveTool * @param glv GLView * @param cursor Cursor */ public VectorMoveTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Move the vertices * @param objects Collection of geometric objects * @param delta Vertex (vector) */ public void move(Collection objects, Vertex delta) { Iterator it = objects.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Vertex) { ((Vertex)elm).move(delta.getX(), delta.getY(), delta.getZ()); } else if (elm instanceof Edge) { ((Edge)elm).move(delta.getX(), delta.getY(), delta.getZ()); } else if (elm instanceof Surface) { ((Surface) elm).move(delta.getX(), delta.getY(), delta.getZ()); } } } } Index: ControlledMoveStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveStrategy.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ControlledMoveStrategy.java 21 Jul 2006 10:42:06 -0000 1.6 --- ControlledMoveStrategy.java 4 Aug 2006 11:48:11 -0000 1.7 *************** *** 12,16 **** import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Geometric; --- 12,15 ---- *************** *** 38,47 **** private HashMap slideMap; - /** The geometric to be moved controlled */ - private Geometric controlled; - - /** The plane to drag according to */ - private Plane dragPlane; - /** Direction of the controlled movement */ private Vertex direction; --- 37,40 ---- *************** *** 171,176 **** Surface surface = (Surface)current.object(); if (edge.getSurfaces().contains(surface)) { - dragPlane = surface.plane(); - List edges = surface.getEdges(); int index = edges.indexOf(edge); --- 164,167 ---- --- NEW FILE: AlternateMoveTool.java --- //--------------------------------------------------------------------------------- // $Id: AlternateMoveTool.java,v 1.1 2006/08/04 11:48:11 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Set; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * Move Tool */ public class AlternateMoveTool extends AbstractPencil { /** Entities */ protected Set entities; /** Vertices */ protected Collection vertices; /** Affected */ private Set affected; /** From */ private Vertex from; /** Last */ private Vertex last; /** To */ private Vertex to; /** active */ private boolean active; /** * Constructor for MoveTool * @param glv The GLView * @param cursor The Cursor */ public AlternateMoveTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Move the vertices * @param objects Collection of geometric objects * @param delta Vertex (vector) */ public void move(Collection objects, Vertex delta) { } /** * Update feedback */ protected void updateFeedback() { if (start == null) { if (!selection.isEmpty()) { if (current != null) { makeTarget(current); updateConstructors(); } } } else { if (current != null) { Edge edge = new Edge(from, to); edge.setStrippled(true); Collection feedback = new LinkedList(); feedback.add(edge); feedback(feedback); makeTarget(current); updateConstructors(); } } } /** * @param e MouseEvent * @return Success */ protected boolean prepare(MouseEvent e) { return true; } /** * @see net.sourceforge.bprocessor.gl.tool.AbstractTool#moved() */ protected void moved(MouseEvent e) { if (start == null) { if (selection.isEmpty()) { findTarget(e); glv.getView().makeTarget(target); } else { current = findIntersection(e); if (current != null) { current = current.copy(); updateFeedback(); } } } else { if (!active) { active = prepare(e); if (active) { excluded(affected); } } if (active) { current = findIntersection(e); if (current != null) { current = current.copy(); to = current.vertex(); move(vertices, to.minus(last)); last = to; updateFeedback(); } } } } /** * @see net.sourceforge.bprocessor.gl.tool.AbstractTool#pressed() */ protected void pressed(MouseEvent e) { if (start == null) { if (selection.isEmpty()) { if (target != null) { entities = new HashSet(); entities.add(target); } } else { entities = new HashSet(); entities.addAll(selection); } if (!entities.isEmpty()) { affected = getAffected(entities); vertices = collect(entities); current = findIntersection(e).copy(); if (current != null) { from = current.vertex(); to = from; last = from; start = current; updateFeedback(); } } } else { Collection surfaces = Edge.surfaces(Vertex.edges(vertices)); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { Surface current = (Surface) iter.next(); holeAnalysis(current); } Project.getInstance().checkpoint(); cleanUp(); moved(e); } } /** * @see net.sourceforge.bprocessor.gl.tool.AbstractTool#dragged() */ protected void dragged(MouseEvent e) { } /** * @see net.sourceforge.bprocessor.gl.tool.AbstractTool#released() */ protected void released(MouseEvent e) { } /** * @see net.sourceforge.bprocessor.gl.tool.AbstractPencil#cleanUp() */ public void cleanUp() { entities = null; affected = null; from = null; to = null; last = null; active = false; excluded(new LinkedList()); super.cleanUp(); } } |
From: Michael L. <he...@us...> - 2006-08-04 11:48:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6715/src/net/sourceforge/bprocessor/gl/model Modified Files: Intersection.java Log Message: Refactoring of Move Tool Index: Intersection.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/Intersection.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Intersection.java 3 Aug 2006 14:35:29 -0000 1.4 --- Intersection.java 4 Aug 2006 11:48:11 -0000 1.5 *************** *** 140,142 **** --- 140,159 ---- return buffer.toString(); } + + /** + * Return a copy + * @return Copy + */ + public Intersection copy() { + return new Intersection(vertex.copy(), type, object); + } + + /** + * Test if the vertices are close + * @param other The other intersection + * @return True if close + */ + public boolean equalEps(Intersection other) { + return vertex.equalEps(other.vertex()); + } } |
From: Michael L. <he...@us...> - 2006-08-04 11:48:15
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6715/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Refactoring of Move Tool Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** View.java 3 Aug 2006 14:36:57 -0000 1.126 --- View.java 4 Aug 2006 11:48:11 -0000 1.127 *************** *** 2212,2215 **** --- 2212,2218 ---- } + + + // Set the last surface pointed at: // If pointing at something different than a surface then dont *************** *** 2305,2318 **** { if (lastSurface != null) { ! Plane plane = lastSurface.plane(); ! Vertex intersection = plane.intersection(edge); ! if (intersection != null) { ! Vertex projected = transformation.project(intersection); ! double dx = x - projected.getX(); ! double dy = (height - y) - projected.getY(); ! double distance = Math.sqrt(dx * dx + dy * dy); ! if (distance < 5) { ! return new Intersection(intersection, ! Intersection.SURFACE_INTERSECTION, lastSurface); } } --- 2308,2323 ---- { if (lastSurface != null) { ! if (!unWantedEntities.contains(lastSurface)) { ! Plane plane = lastSurface.plane(); ! Vertex intersection = plane.intersection(edge); ! if (intersection != null) { ! Vertex projected = transformation.project(intersection); ! double dx = x - projected.getX(); ! double dy = (height - y) - projected.getY(); ! double distance = Math.sqrt(dx * dx + dy * dy); ! if (distance < 5) { ! return new Intersection(intersection, ! Intersection.SURFACE_INTERSECTION, lastSurface); ! } } } |
From: Michael L. <he...@us...> - 2006-08-04 11:48:09
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6619/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Refactoring of Move Tool Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** GUI.java 31 Jul 2006 17:09:19 -0000 1.36 --- GUI.java 4 Aug 2006 11:48:07 -0000 1.37 *************** *** 454,458 **** public void run() { while (true) { - log.info(" -- Start -- "); Iterator it = Project.getInstance().getSpaces().iterator(); while (it.hasNext()) { --- 454,457 ---- |
From: Michael L. <he...@us...> - 2006-08-04 11:48:08
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6388/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Log Message: Refactoring of Move Tool Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** Edge.java 3 Aug 2006 14:35:21 -0000 1.48 --- Edge.java 4 Aug 2006 11:48:04 -0000 1.49 *************** *** 497,499 **** --- 497,514 ---- return "Edge"; } + + /** + * Collect all surfaces from a collection of edges + * @param edges Collection of edges + * @return Surfaces + */ + public static Set surfaces(Collection edges) { + Set surfaces = new HashSet(); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + surfaces.addAll(current.getSurfaces()); + } + return surfaces; + } } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Vertex.java 3 Aug 2006 14:33:42 -0000 1.40 --- Vertex.java 4 Aug 2006 11:48:04 -0000 1.41 *************** *** 436,440 **** } } ! /** * Project this vertex onto the vertex given as argument --- 436,455 ---- } } ! ! /** ! * Collect all edges from a collection of vertices ! * @param vertices Collection of vertices ! * @return Edges ! */ ! public static Set edges(Collection vertices) { ! Set edges = new HashSet(); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! edges.addAll(current.getEdges()); ! } ! return edges; ! } ! /** * Project this vertex onto the vertex given as argument |
From: rimestad <rim...@us...> - 2006-08-03 15:41:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14172/src/net/sourceforge/bprocessor/gl/model Modified Files: Intersection.java Log Message: Renamed the constructor boolean in Edge to Strippled and the same with the get and set methods for it Index: Intersection.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/Intersection.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Intersection.java 30 Mar 2006 08:03:41 -0000 1.3 --- Intersection.java 3 Aug 2006 14:35:29 -0000 1.4 *************** *** 95,99 **** if (type == EDGE) { Edge edge = (Edge) object; ! return !edge.getConstructor(); } return false; --- 95,99 ---- if (type == EDGE) { Edge edge = (Edge) object; ! return !edge.getStrippled(); } return false; |
From: rimestad <rim...@us...> - 2006-08-03 15:41:29
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13366/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Log Message: made a project onto method the project the object calld on onto the one given as argument Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Vertex.java 20 Jul 2006 11:08:44 -0000 1.39 --- Vertex.java 3 Aug 2006 14:33:42 -0000 1.40 *************** *** 436,438 **** --- 436,450 ---- } } + + /** + * Project this vertex onto the vertex given as argument + * @param onto The vertex to project onto + * @return The projected vertex + */ + public Vertex projectOnto(Vertex onto) { + double scale = this.dot(onto) / onto.dot(onto); + Vertex res = onto.copy(); + res.scale(scale); + return res; + } } |
From: rimestad <rim...@us...> - 2006-08-03 15:41:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11739/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java AbstractPencil.java Log Message: removed unused methods from AbstractTool that were the same as those in AbstractPencil. And chenged all use of edges as constructors to constructor instead. Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** AbstractPencil.java 31 Jul 2006 13:03:43 -0000 1.51 --- AbstractPencil.java 3 Aug 2006 14:29:33 -0000 1.52 *************** *** 30,33 **** --- 30,34 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Line; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; *************** *** 174,178 **** (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), unwanted, true, work); - if (constrain) { if (lockingEdge != null) { --- 175,178 ---- *************** *** 191,195 **** return intersection; } ! /** * Insert a vertex into model --- 191,206 ---- return intersection; } ! ! /** ! * Insert a Constructor into model ! * @param c the constructor ! * @return The model Constructor ! */ ! public Constructor insertConstructor(Constructor c) { ! Space space = mesh(); ! ! return space.insert(c); ! } ! /** * Insert a vertex into model *************** *** 225,229 **** while (iter.hasNext()) { Edge e = (Edge) iter.next(); ! if (!e.getConstructor()) { e.split(actual); } --- 236,240 ---- while (iter.hasNext()) { Edge e = (Edge) iter.next(); ! if (!e.getStrippled()) { e.split(actual); } *************** *** 314,319 **** Iterator iter = elements.iterator(); while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! glv.getView().addTempEdge(current); } } --- 325,334 ---- Iterator iter = elements.iterator(); while (iter.hasNext()) { ! Object o = iter.next(); ! if (o instanceof Edge) { ! glv.getView().addTempEdge((Edge) o); ! } else if (o instanceof Constructor) { ! glv.getView().addTempConstructor((Constructor) o); ! } } } *************** *** 325,330 **** Iterator iter = elements.iterator(); while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! glv.getView().removeTempEdge(current); } } --- 340,349 ---- Iterator iter = elements.iterator(); while (iter.hasNext()) { ! Object o = iter.next(); ! if (o instanceof Edge) { ! glv.getView().removeTempEdge((Edge) o); ! } else if (o instanceof Constructor) { ! glv.getView().removeTempConstructor((Constructor) o); ! } } } *************** *** 347,352 **** Iterator iter = constructors.iterator(); while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! glv.getView().addTempEdge(current); } } --- 366,375 ---- Iterator iter = constructors.iterator(); while (iter.hasNext()) { ! Object o = iter.next(); ! if (o instanceof Edge) { ! glv.getView().addTempEdge((Edge) o); ! } else if (o instanceof Constructor) { ! glv.getView().addTempConstructor((Constructor) o); ! } } } *************** *** 358,363 **** Iterator iter = constructors.iterator(); while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! glv.getView().removeTempEdge(current); } } --- 381,390 ---- Iterator iter = constructors.iterator(); while (iter.hasNext()) { ! Object o = iter.next(); ! if (o instanceof Edge) { ! glv.getView().removeTempEdge((Edge) o); ! } else if (o instanceof Constructor) { ! glv.getView().removeTempConstructor((Constructor) o); ! } } } *************** *** 409,418 **** /** ! * Test if an edge is parrallel with an axiz (x, y or z) ! * @param edge The edge to test ! * @return True if edge is parrallel to an axis */ ! protected boolean isAxisAligned(Edge edge) { ! Vertex vector = edge.getDirection(); { Vertex cross = vector.cross(new Vertex(1, 0 , 0)); --- 436,445 ---- /** ! * Test if an line is parrallel with an axiz (x, y or z) ! * @param line The line to test ! * @return True if line is parrallel to an axis */ ! protected boolean isAxisAligned(Line line) { ! Vertex vector = line.getDirection(); { Vertex cross = vector.cross(new Vertex(1, 0 , 0)); *************** *** 454,461 **** List constructors = new LinkedList(); if (start != null) { ! constructors.addAll(xyz(start.vertex())); } if (incident != null) { ! constructors.addAll(xyz(incident.vertex())); } --- 481,488 ---- List constructors = new LinkedList(); if (start != null) { ! constructors.add(new CoordinateSystem(start.vertex())); } if (incident != null) { ! constructors.add(new CoordinateSystem(incident.vertex())); } *************** *** 463,483 **** Edge edge = hooverEdge; Vertex v = edge.getDirection(); ! v.scale(50 / v.length()); ! Edge parrallel = null; if (start != null) { ! parrallel = new Edge(start.vertex().minus(v), start.vertex().add(v)); } else { if (incident != null) { ! parrallel = new Edge(incident.vertex().minus(v), incident.vertex().add(v)); } } ! if (parrallel != null) { ! if (!isAxisAligned(parrallel)) { ! parrallel.setConstructor(true); ! glv.getView().changeColor(parrallel, new float[] {255f / 255f, 153f / 255f, 0}); ! constructors.add(parrallel); ! } ! ! Plane plane; --- 490,504 ---- Edge edge = hooverEdge; Vertex v = edge.getDirection(); ! v.normalize(); ! Line parrallel = null; if (start != null) { ! parrallel = new Line(start.vertex(), v, true, false); } else { if (incident != null) { ! parrallel = new Line(incident.vertex(), v, true, false); } } ! if (parrallel != null && !isAxisAligned(parrallel)) { ! constructors.add(parrallel); Plane plane; *************** *** 506,528 **** direction.setY(x); direction = system.unTranslate(direction); ! direction.scale(50 / direction.length()); ! Edge orthogonal = null; if (Math.abs(direction.getZ()) < 0.0000001) { if (start != null) { ! orthogonal = new Edge(start.vertex().minus(direction), start.vertex().add(direction)); } else { if (incident != null) { ! orthogonal = new Edge(incident.vertex().minus(direction), ! incident.vertex().add(direction)); } } } ! if (orthogonal != null) { ! if (!isAxisAligned(orthogonal)) { ! orthogonal.setConstructor(true); ! glv.getView().changeColor(orthogonal, new float[] {255f / 255f, 153f / 255f, 0}); ! constructors.add(orthogonal); ! } } } --- 527,544 ---- direction.setY(x); direction = system.unTranslate(direction); ! direction.normalize(); ! Line orthogonal = null; if (Math.abs(direction.getZ()) < 0.0000001) { if (start != null) { ! orthogonal = new Line(start.vertex(), direction, true, false); } else { if (incident != null) { ! orthogonal = new Line(incident.vertex(), direction, true, false); } } } ! if (orthogonal != null) { ! constructors.add(orthogonal); } } *************** *** 666,670 **** case Intersection.EDGE: Edge edge = (Edge) intersection.object(); ! if (edge.getConstructor()) { target = current; targetColor = View.CONSTRUCTOR_COLOR; --- 682,686 ---- case Intersection.EDGE: Edge edge = (Edge) intersection.object(); ! if (edge.getStrippled()) { target = current; targetColor = View.CONSTRUCTOR_COLOR; *************** *** 731,762 **** } } - - /** - * Make xyz in point origin - * @param origin Origin - * @return List of constructors - */ - protected List xyz(Vertex origin) { - List constructors = new LinkedList(); - Vertex i = new Vertex(1, 0, 0); - Vertex j = new Vertex(0, 1, 0); - Vertex n = new Vertex(0, 0, 1); - i.scale(50); - j.scale(50); - n.scale(50); - Edge e1 = new Edge(origin.minus(i), origin.add(i)); - Edge e2 = new Edge(origin.minus(j), origin.add(j)); - Edge e3 = new Edge(origin.minus(n), origin.add(n)); - e1.setConstructor(true); - e2.setConstructor(true); - e3.setConstructor(true); - glv.getView().changeColor(e1, new float[] {0, 1, 0}); - glv.getView().changeColor(e2, new float[] {1, 0, 0}); - glv.getView().changeColor(e3, new float[] {0, 0, 1}); - constructors.add(e1); - constructors.add(e2); - constructors.add(e3); - return constructors; - } /** --- 747,750 ---- Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** AbstractTool.java 26 Jul 2006 14:41:12 -0000 1.89 --- AbstractTool.java 3 Aug 2006 14:29:33 -0000 1.90 *************** *** 440,561 **** /** - * Makes constructors parralel to the x y and z-axis, originating - * from a vertex. - * @param v the vertex - * @return a set of XYZ constructors. - */ - protected Set makeXYZConstructors(Vertex v) { - if (v != null) { - Edge x = new Edge(xAxis.getFrom().add(v), - xAxis.getTo().add(v)); - x.setConstructor(true); - Edge y = new Edge(yAxis.getFrom().add(v), - yAxis.getTo().add(v)); - y.setConstructor(true); - Edge z = new Edge(zAxis.getFrom().add(v), - zAxis.getTo().add(v)); - z.setConstructor(true); - Set constructors = new HashSet(); - constructors.add(x); - constructors.add(y); - constructors.add(z); - if (showConstructors) { - displayConstructors(constructors); - } - return constructors; - } - return null; - } - - /** - * Makes constructors parralel to the x y and z-axis, originating - * from a vertex. - * @param v the vertex - * @return a set of XYZ constructors. - */ - protected Set makeXYZConerConstructors(Vertex v) { - if (v != null) { - Vertex xDir = new Vertex(1, 0, 0); - Vertex yDir = new Vertex(0, 1, 0); - Vertex zDir = new Vertex(0, 0, 1); - Camera camera = Project.getInstance().getCurrentCamera(); - double[] center = camera.getCenter(); - double[] eye = camera.getCamera(); - Vertex cameraDir = new Vertex(center[0] - eye[0], - center[1] - eye[1], - center[2] - eye[2]); - - Edge x = new Edge(xAxis.getFrom().add(v), - xAxis.getTo().add(v)); - if (cameraDir.dot(xDir) > 0) { - x.getFrom().move(-50, 0, 0); - x.getTo().move(-50, 0, 0); - } else { - x.getFrom().move(50, 0, 0); - x.getTo().move(50, 0, 0); - } - x.setConstructor(true); - Edge y = new Edge(yAxis.getFrom().add(v), - yAxis.getTo().add(v)); - if (cameraDir.dot(yDir) > 0) { - y.getFrom().move(0, -50, 0); - y.getTo().move(0, -50, 0); - } else { - y.getFrom().move(0, 50, 0); - y.getTo().move(0, 50, 0); - } - y.setConstructor(true); - Edge z = new Edge(zAxis.getFrom().add(v), - zAxis.getTo().add(v)); - if (cameraDir.dot(zDir) > 0) { - z.getFrom().move(0, 0, -50); - z.getTo().move(0, 0, -50); - } else { - z.getFrom().move(0, 0, 50); - z.getTo().move(0, 0, 50); - } - z.setConstructor(true); - Set constructors = new HashSet(); - constructors.add(x); - constructors.add(y); - constructors.add(z); - if (showConstructors) { - displayConstructors(constructors); - } - return constructors; - } - return null; - } - - /** - * Makes constructors parrallel to the edges connected to a vertex. - * @param v the vertex - * @return a set of constructors. - */ - protected Set makeEdgeConstructors(Vertex v) { - Set constructors = new HashSet(); - Set edges = v.getEdges(); - Iterator it = edges.iterator(); - while (it.hasNext()) { - Edge e = (Edge)it.next(); - Vertex direction = e.getFrom().minus(e.getTo()); - direction.scale(50 / direction.length()); - Vertex to = direction.copy(); - direction.scale(-1); - Vertex from = direction.copy(); - to = to.add(v); - from = from.add(v); - Edge constructor = new Edge(from, to); - - constructor.setConstructor(true); - constructors.add(constructor); - } - if (showConstructors) { - displayConstructors(constructors); - } - return constructors; - } - - /** * Makes a set of constructors be displayed. * @param constructors a set of constructors. --- 440,443 ---- |
From: rimestad <rim...@us...> - 2006-08-03 15:41:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10934/src/net/sourceforge/bprocessor/gl/tool Modified Files: Protractor.java TapeMeasureTool.java Log Message: changed the tools to create constructors instead of edges Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TapeMeasureTool.java 14 Jun 2006 14:36:56 -0000 1.16 --- TapeMeasureTool.java 3 Aug 2006 14:27:52 -0000 1.17 *************** *** 14,20 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.gl.GLView; --- 14,21 ---- import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Line; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.gl.GLView; *************** *** 33,40 **** /** The current construction edge */ ! private Edge currentConstruction; /** The construction edge point */ private Vertex constructionPoint; /** --- 34,44 ---- /** The current construction edge */ ! private Line currentConstruction; /** The construction edge point */ private Vertex constructionPoint; + + /** The chosen movement direction of the construction line */ + private Vertex lockDirection; /** *************** *** 65,81 **** private void move() { if (start != null) { ! Vertex direction = currentEdge.getDirection(); ! Vertex origin = start.vertex(); ! Plane plane = new Plane (direction.getX(), direction.getY(), direction.getZ(), ! -(direction.getX() * origin.getX() + ! direction.getY() * origin.getY() + ! direction.getZ() * origin.getZ())); ! Vertex currentPos = plane.project(current.vertex()); ! direction.scale(origin.dot(direction) / (direction.length() * direction.length())); ! currentPos = currentPos.add(direction); ! Vertex move = currentPos.minus(constructionPoint); ! ! currentConstruction.move(move.getX(), move.getY(), move.getZ()); ! constructionPoint.move(move.getX(), move.getY(), move.getZ()); } } --- 69,87 ---- private void move() { if (start != null) { ! if (lockDirection != null) { ! Vertex tmp = current.vertex().minus(start.vertex()); ! Vertex move = tmp.projectOnto(lockDirection); ! Vertex where = start.vertex().add(move); ! move = where.minus(constructionPoint); ! constructionPoint.move(move.getX(), move.getY(), move.getZ()); ! } else { ! if (current.object() instanceof Surface && ! currentEdge.getSurfaces().contains(current.object())) { ! Surface surface = (Surface)current.object(); ! plane = surface.plane(); ! lockDirection = surface.normal().cross(currentEdge.getDirection()); ! lockDirection.normalize(); ! } ! } } } *************** *** 96,117 **** if (current != null && current.object() instanceof Edge) { start = current; ! currentEdge = (Edge)current.object(); ! Vertex minus = currentEdge.getDirection(); ! minus.scale(1 / minus.length()); ! Vertex constructionFrom = new Vertex ((currentEdge.getFrom().getX() + ! minus.getX() * -50), ! (currentEdge.getFrom().getY() + ! minus.getY() * -50), ! (currentEdge.getFrom().getZ() + ! minus.getZ() * -50)); ! Vertex constructionTo = new Vertex((currentEdge.getTo().getX() + ! minus.getX() * 50), ! (currentEdge.getTo().getY() + ! minus.getY() * 50), ! (currentEdge.getTo().getZ() + ! minus.getZ() * 50)); ! currentConstruction = new Edge(constructionFrom, constructionTo); ! currentConstruction.setConstructor(true); constructionPoint = start.vertex().copy(); } } else { --- 102,110 ---- if (current != null && current.object() instanceof Edge) { start = current; ! currentEdge = (Edge)current.object(); constructionPoint = start.vertex().copy(); + currentConstruction = + new Line(constructionPoint, currentEdge.getDirection(), true, false); + } } else { *************** *** 129,134 **** consts.add(currentConstruction); Edge edge = new Edge(start.vertex(), constructionPoint); ! edge.setConstructor(true); ! glv.setLength(edge.getFrom().minus(edge.getTo()).length()); consts.add(edge); constructors(consts); --- 122,127 ---- consts.add(currentConstruction); Edge edge = new Edge(start.vertex(), constructionPoint); ! edge.setStrippled(true); ! glv.setLength(edge.getLength()); consts.add(edge); constructors(consts); *************** *** 152,161 **** private void endTapeMeasure() { if (currentConstruction != null) { ! insertEdge(currentConstruction, false); ! currentEdge = null; constructors(new LinkedList()); excluded(new LinkedList()); Project.getInstance().checkpoint(); start = null; glv.repaint(); } --- 145,155 ---- private void endTapeMeasure() { if (currentConstruction != null) { ! currentConstruction.setEditable(true); ! insertConstructor(currentConstruction); constructors(new LinkedList()); excluded(new LinkedList()); Project.getInstance().checkpoint(); start = null; + lockDirection = null; glv.repaint(); } *************** *** 169,194 **** number = ""; ! if (constructionPoint != null) { if (start != null) { ! Vertex direction = constructionPoint.minus(start.vertex()); ! direction.scale(length / direction.length()); ! constructionPoint = start.vertex().add(direction); ! Vertex minus = currentEdge.getDirection(); ! minus.scale(1 / minus.length()); ! Vertex constructionFrom = new Vertex ((currentEdge.getFrom().getX() + ! minus.getX() * -50), ! (currentEdge.getFrom().getY() + ! minus.getY() * -50), ! (currentEdge.getFrom().getZ() + ! minus.getZ() * -50)); ! Vertex constructionTo = new Vertex((currentEdge.getTo().getX() + ! minus.getX() * 50), ! (currentEdge.getTo().getY() + ! minus.getY() * 50), ! (currentEdge.getTo().getZ() + ! minus.getZ() * 50)); ! currentConstruction = new Edge(constructionFrom, constructionTo); ! currentConstruction.setConstructor(true); ! currentConstruction.move(direction.getX(), direction.getY(), direction.getZ()); endTapeMeasure(); } --- 163,170 ---- number = ""; ! if (currentConstruction != null) { if (start != null) { ! Edge e = new Edge(start.vertex(), constructionPoint); ! e.setLength(length); endTapeMeasure(); } Index: Protractor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Protractor.java 29 Mar 2006 13:18:29 -0000 1.3 --- Protractor.java 3 Aug 2006 14:27:52 -0000 1.4 *************** *** 14,19 **** import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.model.Edge; ! import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; --- 14,18 ---- import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.model.Line; import net.sourceforge.bprocessor.model.Vertex; *************** *** 22,27 **** */ public class Protractor extends AbstractPencil { - /** angling */ - private boolean angling; /** --- 21,24 ---- *************** *** 38,51 **** * @param start From * @param end To ! * @return Edge */ ! protected Edge createConstructor(Vertex start, Vertex end) { ! Vertex vector = current.vertex().minus(start); ! vector.scale(50 / vector.length()); ! Vertex from = start.minus(vector); ! Vertex to = start.add(vector); ! Edge edge = new Edge(from, to); ! edge.setConstructor(true); ! return edge; } /** --- 35,42 ---- * @param start From * @param end To ! * @return Line */ ! protected Line createConstructor(Vertex start, Vertex end) { ! return new Line(start, end.minus(start), true, true); } /** *************** *** 56,69 **** if (start != null) { List edges = new LinkedList(); ! Edge edge; ! if (angling) { ! edge = createConstructor(start.vertex(), current.vertex()); ! } else { ! edge = new Edge(start.vertex(), current.vertex()); ! edge.setConstructor(true); ! } ! edges.add(edge); feedback(edges); } else { --- 47,55 ---- if (start != null) { List edges = new LinkedList(); ! Line l; ! l = createConstructor(start.vertex(), current.vertex()); ! edges.add(l); feedback(edges); } else { *************** *** 91,105 **** start = current; } else { ! if (angling) { ! Edge edge = createConstructor(start.vertex(), current.vertex()); ! Project.getInstance().add(edge.getFrom()); ! Project.getInstance().add(edge.getTo()); ! Project.getInstance().add(edge); ! Project.getInstance().checkpoint(); ! start = null; ! angling = false; ! } else { ! angling = true; ! } } updateFeedback(); --- 77,83 ---- start = current; } else { ! Line l = createConstructor(start.vertex(), current.vertex()); ! insertConstructor(l); ! start = null; } updateFeedback(); *************** *** 118,121 **** protected void released(MouseEvent e) { } - } --- 96,98 ---- |
From: rimestad <rim...@us...> - 2006-08-03 15:41:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12986/src/net/sourceforge/bprocessor/model Modified Files: CoordinateSystem.java Log Message: Added constructor method that make a default coordinatesystem around a given origin (usefull for default feedback constructors) and added a method the gives the to or three edges of the coordinatesystem (i,j when only plane and i,j,n otherwise) as Guide objects just as in Line, used when drawing selection Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CoordinateSystem.java 31 Jul 2006 11:25:51 -0000 1.20 --- CoordinateSystem.java 3 Aug 2006 14:33:00 -0000 1.21 *************** *** 46,49 **** --- 46,62 ---- /** + * Create a coordinatesystem with x, y and z axis, with origin as origin + * that is not editable but active + * @param origin The origin vertex + */ + public CoordinateSystem(Vertex origin) { + super(origin, true, false); + i = new Vertex(1, 0, 0); + j = new Vertex(0, 1, 0); + n = new Vertex(0, 0, 1); + onlyPlane = false; + } + + /** * Constructor secure that they all are orthogonal to each other and normalized * @param i The i vector *************** *** 416,418 **** --- 429,480 ---- this.n.normalize(); } + + /** + * Return a list of edges in this coordinatesystem + * @return Either 2 og 3 edges whos parent() method return this + * @param size The length of the edges; + */ + public List edges(double size) { + List list = new ArrayList(); + Vertex o = getOrigin(); + Vertex i = getI().copy(); + i.scale(size); + Vertex from = o.minus(i); + Vertex to = o.add(i); + list.add(new Guide(from, to)); + Vertex j = getJ().copy(); + j.scale(size); + from = o.minus(j); + to = o.add(j); + list.add(new Guide(from, to)); + if (!onlyPlane()) { + Vertex n = getN().copy(); + n.scale(size); + from = o.minus(n); + to = o.add(n); + list.add(new Guide(from, to)); + } + return list; + } + /** + * Guide + */ + private class Guide extends Edge { + /** + * Constructor + * @param from Vertex + * @param to Vertex + */ + public Guide(Vertex from, Vertex to) { + super(from, to); + } + + /** + * Parent + * @return This line + */ + public Geometric parent() { + return CoordinateSystem.this; + } + } } |
From: rimestad <rim...@us...> - 2006-08-03 15:41:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14151/src/net/sourceforge/bprocessor/model Modified Files: Edge.java ClippingPlane.java Persistence.java Log Message: Renamed the constructor boolean in Edge to Strippled and the same with the get and set methods for it Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Persistence.java 31 Jul 2006 11:25:51 -0000 1.4 --- Persistence.java 3 Aug 2006 14:35:21 -0000 1.5 *************** *** 261,265 **** mapper.put(new Long(xml.getId()), edge); xmls.add(xml); ! edge.setConstructor(xml.isConstructor()); return edge; } --- 261,265 ---- mapper.put(new Long(xml.getId()), edge); xmls.add(xml); ! edge.setStrippled(xml.isConstructor()); return edge; } *************** *** 604,608 **** xml.setProgid(edge.getId().longValue()); map.put(edge, xml); ! xml.setConstructor(edge.getConstructor()); return xml; } --- 604,608 ---- xml.setProgid(edge.getId().longValue()); map.put(edge, xml); ! xml.setConstructor(edge.getStrippled()); return xml; } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Edge.java 21 Jul 2006 08:07:02 -0000 1.47 --- Edge.java 3 Aug 2006 14:35:21 -0000 1.48 *************** *** 38,42 **** /** Constructor */ ! private boolean constructor; /** --- 38,42 ---- /** Constructor */ ! private boolean strippled; /** *************** *** 122,139 **** /** ! * Is the edge a constructor ! * @return True if constructor; otherwise false * @hibernate.property */ ! public boolean getConstructor() { ! return constructor; } /** ! * Set if the edge is a constructor ! * @param c True if constructor; otherwise false */ ! public void setConstructor(boolean c) { ! constructor = c; } --- 122,139 ---- /** ! * Is the edge a strippled ! * @return True if strippled; otherwise false * @hibernate.property */ ! public boolean getStrippled() { ! return strippled; } /** ! * Set if the edge is a strippled ! * @param c True if strippled; otherwise false */ ! public void setStrippled(boolean c) { ! strippled = c; } *************** *** 299,304 **** public Collection split(Vertex vertex) { List added = new ArrayList(); ! // FIXME Why not split a constructor? ! if (!constructor) { Vertex from = getFrom(); Vertex to = getTo(); --- 299,304 ---- public Collection split(Vertex vertex) { List added = new ArrayList(); ! // FIXME Why not split a strippled? ! if (!strippled) { Vertex from = getFrom(); Vertex to = getTo(); Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClippingPlane.java 20 Jul 2006 12:58:08 -0000 1.4 --- ClippingPlane.java 3 Aug 2006 14:35:21 -0000 1.5 *************** *** 184,188 **** } else { Edge newE = new Edge(first, v); ! newE.setConstructor(true); first = null; silluet.add(newE); --- 184,188 ---- } else { Edge newE = new Edge(first, v); ! newE.setStrippled(true); first = null; silluet.add(newE); |
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14172/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java SelectStrategy.java ConstructorTool.java RotationTool.java ArcTool.java MultiExtrudeTool.java Log Message: Renamed the constructor boolean in Edge to Strippled and the same with the get and set methods for it Index: ConstructorTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ConstructorTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConstructorTool.java 31 Jul 2006 11:25:57 -0000 1.8 --- ConstructorTool.java 3 Aug 2006 14:35:28 -0000 1.9 *************** *** 99,103 **** if (p2 != null) { Edge edge = new Edge(p1.vertex(), p2.vertex()); ! edge.setConstructor(true); constructors.add(edge); points.add(p2.vertex()); --- 99,103 ---- if (p2 != null) { Edge edge = new Edge(p1.vertex(), p2.vertex()); ! edge.setStrippled(true); constructors.add(edge); points.add(p2.vertex()); *************** *** 105,109 **** if (current != null) { Edge edge = new Edge(p1.vertex(), current.vertex()); ! edge.setConstructor(true); constructors.add(edge); } --- 105,109 ---- if (current != null) { Edge edge = new Edge(p1.vertex(), current.vertex()); ! edge.setStrippled(true); constructors.add(edge); } Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ArcTool.java 31 Jul 2006 11:29:56 -0000 1.10 --- ArcTool.java 3 Aug 2006 14:35:29 -0000 1.11 *************** *** 103,108 **** v2.scale(10 / v2.length()); Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); ! l1.setConstructor(true); ! l2.setConstructor(true); Edge inter = l1.intersection(l2); --- 103,108 ---- v2.scale(10 / v2.length()); Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); ! l1.setStrippled(true); ! l2.setStrippled(true); Edge inter = l1.intersection(l2); *************** *** 146,152 **** Edge side2 = new Edge(system.unTranslate(center), end); Edge side3 = new Edge(system.unTranslate(center), mid); ! side1.setConstructor(true); ! side2.setConstructor(true); ! side3.setConstructor(true); edges.add(side1); edges.add(side2); --- 146,152 ---- Edge side2 = new Edge(system.unTranslate(center), end); Edge side3 = new Edge(system.unTranslate(center), mid); ! side1.setStrippled(true); ! side2.setStrippled(true); ! side3.setStrippled(true); edges.add(side1); edges.add(side2); Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SelectStrategy.java 21 Jun 2006 13:26:18 -0000 1.1 --- SelectStrategy.java 3 Aug 2006 14:35:28 -0000 1.2 *************** *** 63,73 **** this.glv = glv; e1 = new Edge(); ! e1.setConstructor(true); e2 = new Edge(); ! e2.setConstructor(true); e3 = new Edge(); ! e3.setConstructor(true); e4 = new Edge(); ! e4.setConstructor(true); box = new HashSet(); --- 63,73 ---- this.glv = glv; e1 = new Edge(); ! e1.setStrippled(true); e2 = new Edge(); ! e2.setStrippled(true); e3 = new Edge(); ! e3.setStrippled(true); e4 = new Edge(); ! e4.setStrippled(true); box = new HashSet(); Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** MoveTool.java 21 Jul 2006 19:23:33 -0000 1.62 --- MoveTool.java 3 Aug 2006 14:35:28 -0000 1.63 *************** *** 239,243 **** super.updateConstructors(); moveConstructor = new Edge(start.vertex(), current.vertex()); ! moveConstructor.setConstructor(true); Set constcopy = new HashSet(); constcopy.addAll(constructors); --- 239,243 ---- super.updateConstructors(); moveConstructor = new Edge(start.vertex(), current.vertex()); ! moveConstructor.setStrippled(true); Set constcopy = new HashSet(); constcopy.addAll(constructors); Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RotationTool.java 6 Jun 2006 09:22:25 -0000 1.14 --- RotationTool.java 3 Aug 2006 14:35:28 -0000 1.15 *************** *** 113,117 **** prev = initial; Edge edge = new Edge(center, initial); ! edge.setConstructor(true); guide.clear(); guide.add(edge); --- 113,117 ---- prev = initial; Edge edge = new Edge(center, initial); ! edge.setStrippled(true); guide.clear(); guide.add(edge); *************** *** 143,147 **** // make selection if (target != null && target instanceof Entity) { ! if (target instanceof Edge && ((Edge)target).getConstructor()) { // If it is a constructor it should not be rotateable return; --- 143,147 ---- // make selection if (target != null && target instanceof Entity) { ! if (target instanceof Edge && ((Edge)target).getStrippled()) { // If it is a constructor it should not be rotateable return; *************** *** 274,282 **** parent = new Vertex(xr + center.getX(), yr + center.getY(), center.getZ()); Edge e = new Edge(prev, parent); ! e.setConstructor(true); zCircle.add(e); } Edge e = new Edge(parent, first); ! e.setConstructor(true); zCircle.add(e); displayConstructors(zCircle); --- 274,282 ---- parent = new Vertex(xr + center.getX(), yr + center.getY(), center.getZ()); Edge e = new Edge(prev, parent); ! e.setStrippled(true); zCircle.add(e); } Edge e = new Edge(parent, first); ! e.setStrippled(true); zCircle.add(e); displayConstructors(zCircle); *************** *** 294,302 **** parent = new Vertex(center.getX(), yr + center.getY(), zr + center.getZ()); e = new Edge(prev, parent); ! e.setConstructor(true); xCircle.add(e); } e = new Edge(parent, first); ! e.setConstructor(true); xCircle.add(e); displayConstructors(xCircle); --- 294,302 ---- parent = new Vertex(center.getX(), yr + center.getY(), zr + center.getZ()); e = new Edge(prev, parent); ! e.setStrippled(true); xCircle.add(e); } e = new Edge(parent, first); ! e.setStrippled(true); xCircle.add(e); displayConstructors(xCircle); *************** *** 314,322 **** parent = new Vertex(xr + center.getX(), center.getY(), zr + center.getZ()); e = new Edge(prev, parent); ! e.setConstructor(true); yCircle.add(e); } e = new Edge(parent, first); ! e.setConstructor(true); yCircle.add(e); displayConstructors(yCircle); --- 314,322 ---- parent = new Vertex(xr + center.getX(), center.getY(), zr + center.getZ()); e = new Edge(prev, parent); ! e.setStrippled(true); yCircle.add(e); } e = new Edge(parent, first); ! e.setStrippled(true); yCircle.add(e); displayConstructors(yCircle); Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MultiExtrudeTool.java 20 Jul 2006 13:46:42 -0000 1.20 --- MultiExtrudeTool.java 3 Aug 2006 14:35:29 -0000 1.21 *************** *** 122,126 **** normalCopy.scale(20); dir = new Edge(start.vertex().add(normalCopy), start.vertex().minus(normalCopy)); ! dir.setConstructor(true); glv.getView().changeColor(dir, new float[] {255f, 0, 0}); planeinfo.add(dir); --- 122,126 ---- normalCopy.scale(20); dir = new Edge(start.vertex().add(normalCopy), start.vertex().minus(normalCopy)); ! dir.setStrippled(true); glv.getView().changeColor(dir, new float[] {255f, 0, 0}); planeinfo.add(dir); *************** *** 327,331 **** //super.updateConstructors(); moveConstructor = new Edge(start.vertex(), current.vertex()); ! moveConstructor.setConstructor(true); LinkedList constCopy = new LinkedList(); constCopy.add(moveConstructor); --- 327,331 ---- //super.updateConstructors(); moveConstructor = new Edge(start.vertex(), current.vertex()); ! moveConstructor.setStrippled(true); LinkedList constCopy = new LinkedList(); constCopy.add(moveConstructor); |
From: rimestad <rim...@us...> - 2006-08-03 15:41:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14642/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Added tempoary constructors to the view and implemented selection drawing of coordinatesystems. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** View.java 2 Aug 2006 12:25:34 -0000 1.125 --- View.java 3 Aug 2006 14:36:57 -0000 1.126 *************** *** 295,298 **** --- 295,301 ---- private boolean backLabelSelect = false; + /** Temporary constructors. Will be drawn but not put in database */ + private Set tempConstructors; + /** Temporary edges. Will be drawn but not put in database */ private Set tempEdges; *************** *** 427,430 **** --- 430,434 ---- backColor = BACK_COLOR; noneColor = NONE_COLOR; + tempConstructors = new HashSet(); tempEdges = new HashSet(); tempSurfaces = new HashSet(); *************** *** 729,733 **** gl.glVertex3d(v1.getX(), v1.getY(), v1.getZ()); gl.glVertex3d(v2.getX(), v2.getY(), v2.getZ()); - } gl.glEnd(); --- 733,736 ---- *************** *** 1027,1031 **** while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (current.getConstructor()) { edges.add(current); } --- 1030,1034 ---- while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (current.getStrippled()) { edges.add(current); } *************** *** 1049,1062 **** private void drawConstructors() { Space active = Project.getInstance().getActiveSpace(); while (true) { if (active != null) { Collection cons = active.getConstructors(); Iterator iter = cons.iterator(); - - - Camera camera = Project.getInstance().getCurrentCamera(); - Vertex v = new Vertex(camera.getCamera()); - double scale = (camera.getFocalwidth() / 65) * (500 / height); - double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; CoordinateSystem cs = Project.getInstance().getActiveCoordinateSystem(); while (iter.hasNext()) { --- 1052,1063 ---- private void drawConstructors() { Space active = Project.getInstance().getActiveSpace(); + Camera camera = Project.getInstance().getCurrentCamera(); + Vertex v = new Vertex(camera.getCamera()); + double scale = (camera.getFocalwidth() / 65) * (500 / height); + double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; while (true) { if (active != null) { Collection cons = active.getConstructors(); Iterator iter = cons.iterator(); CoordinateSystem cs = Project.getInstance().getActiveCoordinateSystem(); while (iter.hasNext()) { *************** *** 1064,1068 **** Constructor c = (Constructor)o; if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().minus(v)).length() * scale; } if (target != c && !highligts.contains(c)) { --- 1065,1069 ---- Constructor c = (Constructor)o; if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().distance(v)) * scale; } if (target != c && !highligts.contains(c)) { *************** *** 1076,1079 **** --- 1077,1088 ---- active = active.getOwner(); } + Iterator iter = tempConstructors.iterator(); + while (iter.hasNext()) { + Constructor c = (Constructor)iter.next(); + if (camera.getType() == Camera.PERSPECTIVE) { + dist = (c.getOrigin().distance(v)) * scale; + } + drawGeneralConstructor(c, dist, true); + } } *************** *** 1259,1263 **** if (color != null) { gl.glColor3fv(color); ! if (current.getConstructor()) { drawConstructor(current); } else { --- 1268,1272 ---- if (color != null) { gl.glColor3fv(color); ! if (current.getStrippled()) { drawConstructor(current); } else { *************** *** 1265,1269 **** } gl.glColor3fv(lineColor); ! } else if (current.getConstructor()) { gl.glColor3fv(constructorColor); drawConstructor(current); --- 1274,1278 ---- } gl.glColor3fv(lineColor); ! } else if (current.getStrippled()) { gl.glColor3fv(constructorColor); drawConstructor(current); *************** *** 1797,1802 **** double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! ! Iterator iter = space.getConstructors().iterator(); while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); --- 1806,1813 ---- double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! Collection all = new LinkedList(); ! all.addAll(space.getConstructors()); ! all.addAll(tempConstructors); ! Iterator iter = all.iterator(); while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); *************** *** 1815,1819 **** Edge guide = line.edge(View.gridSize() * 2); if (current.isEditable()) { ! Vertex tip = line.tip(dist / 16 + dist / 20); pushName(gl, tip); drawVertexHit(tip); --- 1826,1830 ---- Edge guide = line.edge(View.gridSize() * 2); if (current.isEditable()) { ! Vertex tip = line.tip(dist / 10); pushName(gl, tip); drawVertexHit(tip); *************** *** 1827,1835 **** } else if (current instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) current; ! Surface surface = system.surface(5); ! if (system.isActive() && system.onlyPlane()) { ! pushName(gl, surface); ! drawSurface(surface); ! popName(gl); } } --- 1838,1857 ---- } else if (current instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) current; ! if (system.isActive()) { ! if (system.onlyPlane()) { ! Surface surface = system.surface(5); ! pushName(gl, surface); ! drawSurface(surface); ! popName(gl); ! } else { ! List tmp = system.edges(View.gridSize() * 2); ! Iterator tmpiter = tmp.iterator(); ! while (tmpiter.hasNext()) { ! Edge e = (Edge)tmpiter.next(); ! pushName(gl, e); ! drawEdge(e); ! popName(gl); ! } ! } } } *************** *** 2216,2225 **** if (edge != null) { edges.remove(edge); ! if (edge.getConstructor()) { Iterator iter = edges.iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (!current.getConstructor()) { if (edge.intersects(current.getFrom()) && edge.intersects(current.getTo())) { edge = current; --- 2238,2247 ---- if (edge != null) { edges.remove(edge); ! if (edge.getStrippled()) { Iterator iter = edges.iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (!current.getStrippled()) { if (edge.intersects(current.getFrom()) && edge.intersects(current.getTo())) { edge = current; *************** *** 2241,2245 **** } else { if (edge != null) { - { Vertex m = edge.getFrom().add(edge.getTo()); --- 2263,2266 ---- *************** *** 2304,2308 **** return new Intersection(intersection, Intersection.EDGE, edge); } - } else { if (surface != null) { --- 2325,2328 ---- *************** *** 2952,2954 **** --- 2972,2990 ---- return constructorColor; } + + /** + * Add a constructor to the tempoary constructors + * @param constructor the constructor + */ + public void addTempConstructor(Constructor constructor) { + tempConstructors.add(constructor); + } + + /** + * Remove a constructor from the set of tempoary constructors + * @param c the constructor to remove + */ + public void removeTempConstructor(Constructor c) { + tempConstructors.remove(c); + } } |
From: rimestad <rim...@us...> - 2006-08-02 12:25:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4023/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Added mothods for changing colors and commented out som lines in drawObject to see if it is better regarding drawing selected edges hidden by other geometry Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** View.java 27 Jul 2006 11:20:20 -0000 1.124 --- View.java 2 Aug 2006 12:25:34 -0000 1.125 *************** *** 110,125 **** public static final float[] EDGE_INTERSECTION_COLOR = new float[] {0.8f, 0.1f, 0.8f}; - /** Used for constructor objects */ public static final float [] CONSTRUCTOR_COLOR = new float[] {0.8f, 0.7f, 0.6f, 0.50f}; /** Front color for surfaces */ ! protected static float[] frontColor = new float[] {0.90f, 0.90f, 0.90f}; /** NONE color for surfaces */ ! protected static float[] noneColor = new float[] {0.40f, 0.58f, 0.93f}; /** Back color for surfaces */ ! protected static float[] backColor = new float[] {0.96f, 0.87f, 0.70f}; /** Select mode for selecting edges */ --- 110,133 ---- public static final float[] EDGE_INTERSECTION_COLOR = new float[] {0.8f, 0.1f, 0.8f}; /** Used for constructor objects */ public static final float [] CONSTRUCTOR_COLOR = new float[] {0.8f, 0.7f, 0.6f, 0.50f}; /** Front color for surfaces */ ! public static final float[] FRONT_COLOR = new float[] {0.90f, 0.90f, 0.90f}; ! ! /** Back color for surfaces */ ! public static final float[] BACK_COLOR = new float[] {0.96f, 0.87f, 0.70f}; /** NONE color for surfaces */ ! public static final float[] NONE_COLOR = new float[] {0.40f, 0.58f, 0.93f}; ! ! /** Front color for surfaces */ ! protected static float[] frontColor; ! ! /** NONE color for surfaces */ ! protected static float[] noneColor; /** Back color for surfaces */ ! protected static float[] backColor; /** Select mode for selecting edges */ *************** *** 416,419 **** --- 424,430 ---- gridColor = GRID_COLOR; constructorColor = CONSTRUCTOR_COLOR; + frontColor = FRONT_COLOR; + backColor = BACK_COLOR; + noneColor = NONE_COLOR; tempEdges = new HashSet(); tempSurfaces = new HashSet(); *************** *** 962,966 **** private void drawObject(Object o) { if (o instanceof Vertex) { ! gl.glDisable(GL.GL_DEPTH_TEST); Vertex v = (Vertex) o; gl.glPointSize(9.0f); --- 973,977 ---- private void drawObject(Object o) { if (o instanceof Vertex) { ! //gl.glDisable(GL.GL_DEPTH_TEST); Vertex v = (Vertex) o; gl.glPointSize(9.0f); *************** *** 969,978 **** gl.glEnd(); gl.glPointSize(1.0f); ! gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Edge) { ! gl.glDisable(GL.GL_DEPTH_TEST); Edge e = (Edge) o; drawEdge(e); ! gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); --- 980,991 ---- gl.glEnd(); gl.glPointSize(1.0f); ! //gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Edge) { ! //gl.glDisable(GL.GL_DEPTH_TEST); Edge e = (Edge) o; + gl.glLineWidth(1.5f); drawEdge(e); ! gl.glLineWidth(1.0f); ! //gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Surface) { gl.glEnable(GL.GL_POLYGON_STIPPLE); *************** *** 2601,2605 **** * @param color the color. */ ! public void setBGColor(float[] color) { bgColor = color; } --- 2614,2618 ---- * @param color the color. */ ! public static void setBGColor(float[] color) { bgColor = color; } *************** *** 2608,2612 **** * @param color the color. */ ! public void setLineColor(float[] color) { lineColor = color; } --- 2621,2625 ---- * @param color the color. */ ! public static void setLineColor(float[] color) { lineColor = color; } *************** *** 2616,2620 **** * @param color the color. */ ! public void setGridColor(float[] color) { gridColor = color; } --- 2629,2633 ---- * @param color the color. */ ! public static void setGridColor(float[] color) { gridColor = color; } *************** *** 2625,2629 **** */ ! public void setNoneColor(float[] color) { noneColor = color; } --- 2638,2642 ---- */ ! public static void setNoneColor(float[] color) { noneColor = color; } *************** *** 2633,2637 **** * @param color the color */ ! public void setConstructorColor(float[] color) { constructorColor = color; } --- 2646,2650 ---- * @param color the color */ ! public static void setConstructorColor(float[] color) { constructorColor = color; } *************** *** 2869,2871 **** --- 2882,2954 ---- } } + + /** + * @return Returns the backColor. + */ + public static float[] getBackColor() { + return backColor; + } + + /** + * @param backColor The backColor to set. + */ + public static void setBackColor(float[] backColor) { + View.backColor = backColor; + } + + /** + * @return Returns the bgColor. + */ + public static float[] getBgColor() { + return bgColor; + } + + /** + * @param bgColor The bgColor to set. + */ + public static void setBgColor(float[] bgColor) { + View.bgColor = bgColor; + } + + /** + * @return Returns the frontColor. + */ + public static float[] getFrontColor() { + return frontColor; + } + + /** + * @param frontColor The frontColor to set. + */ + public static void setFrontColor(float[] frontColor) { + View.frontColor = frontColor; + } + + /** + * @return Returns the gridColor. + */ + public static float[] getGridColor() { + return gridColor; + } + + /** + * @return Returns the lineColor. + */ + public static float[] getLineColor() { + return lineColor; + } + + /** + * @return Returns the noneColor. + */ + public static float[] getNoneColor() { + return noneColor; + } + + /** + * @return Returns the constructorColor. + */ + public static float[] getConstructorColor() { + return constructorColor; + } } |
From: rimestad <rim...@us...> - 2006-08-01 08:30:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27078/src/net/sourceforge/bprocessor/gl Modified Files: GLColorMenuActionListener.java Log Message: Made it more functional, no exceptions when pressing cancel and the current color are shown in stead of white Index: GLColorMenuActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLColorMenuActionListener.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GLColorMenuActionListener.java 6 Dec 2005 16:55:25 -0000 1.4 --- GLColorMenuActionListener.java 1 Aug 2006 08:30:17 -0000 1.5 *************** *** 55,84 **** Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Grid Color", ! Color.white); ! view.setGridColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Line Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Line Color", ! Color.white); ! view.setLineColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Constructor Line Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Constructor Line Color", ! Color.white); ! view.setConstructorColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Background Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Background Color", ! Color.white); ! view.setBGColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("None Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "None Color", ! Color.white); ! view.setNoneColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Default")) { ! view.setBGColor(View.BACKGROUND_COLOR); ! view.setGridColor(View.GRID_COLOR); ! view.setLineColor(View.STD_LINE_COLOR); } --- 55,106 ---- Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Grid Color", ! new Color(View.getGridColor()[0], ! View.getGridColor()[1], ! View.getGridColor()[2])); ! if (newColor != null) { ! View.setGridColor(newColor.getRGBComponents(null)); ! } } else if (e.getActionCommand().equals("Line Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Line Color", ! new Color(View.getLineColor()[0], ! View.getLineColor()[1], ! View.getLineColor()[2])); ! if (newColor != null) { ! View.setLineColor(newColor.getRGBComponents(null)); ! } } else if (e.getActionCommand().equals("Constructor Line Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Constructor Line Color", ! new Color(View.getConstructorColor()[0], ! View.getConstructorColor()[1], ! View.getConstructorColor()[2])); ! if (newColor != null) { ! View.setConstructorColor(newColor.getRGBComponents(null)); ! } } else if (e.getActionCommand().equals("Background Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Background Color", ! new Color(View.getBgColor()[0], ! View.getBgColor()[1], ! View.getBgColor()[2])); ! if (newColor != null) { ! View.setBGColor(newColor.getRGBComponents(null)); ! } } else if (e.getActionCommand().equals("None Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "None Color", ! new Color(View.getNoneColor()[0], ! View.getNoneColor()[1], ! View.getNoneColor()[2])); ! if (newColor != null) { ! View.setNoneColor(newColor.getRGBComponents(null)); ! } } else if (e.getActionCommand().equals("Default")) { ! View.setBGColor(View.BACKGROUND_COLOR); ! View.setGridColor(View.GRID_COLOR); ! View.setLineColor(View.STD_LINE_COLOR); ! View.setNoneColor(View.NONE_COLOR); ! View.setConstructorColor(View.CONSTRUCTOR_COLOR); } |
From: Nordholt <nor...@us...> - 2006-07-31 17:16:18
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22036/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: solving some problems relating to holes Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Space.java 31 Jul 2006 11:29:40 -0000 1.43 --- Space.java 31 Jul 2006 17:16:13 -0000 1.44 *************** *** 1401,1412 **** Iterator surfaces = envelope.iterator(); Surface startSurface = null; ! if (surfaces.hasNext()) { ! startSurface = (Surface)surfaces.next(); ! Set coloured = new HashSet(); ! if (colour(startSurface, coloured)) { ! return coloured.containsAll(envelope); ! } ! } ! return false; } --- 1401,1417 ---- Iterator surfaces = envelope.iterator(); Surface startSurface = null; ! Set coloured = new HashSet(); ! boolean done = false; ! while (surfaces.hasNext() && !done) { ! startSurface = (Surface)surfaces.next(); ! if (!coloured.contains(startSurface)) { ! if (colour(startSurface, coloured)) { ! done = coloured.containsAll(envelope); ! } else { ! return false; ! } ! } ! } ! return true; } *************** *** 1468,1477 **** } } ! return colourable; ! } /** ! * Finds the next surface on an edge * @param startSurface the surface to find neighbours for. * @param sharedEdge the shared edge --- 1473,1481 ---- } } ! return colourable; } /** ! * Finds the next colourable surface on an edge * @param startSurface the surface to find neighbours for. * @param sharedEdge the shared edge *************** *** 1514,1522 **** Vertex notShared = findNextVertex(sharedEdge, sharedVertex, l); angle = findAngle(sharedVertex, notShared, cs); - Vertex normal = s.normal(); if (angle < minAngle && colourable(s, angle, i, j)) { minAngle = angle; neighbour = s; ! } } } --- 1518,1533 ---- Vertex notShared = findNextVertex(sharedEdge, sharedVertex, l); angle = findAngle(sharedVertex, notShared, cs); if (angle < minAngle && colourable(s, angle, i, j)) { minAngle = angle; neighbour = s; ! } ! if (s.getExterior() != null) { ! angle = (angle + Math.PI) % (2 * Math.PI); ! if (angle < minAngle && colourable(s.getExterior(), ! angle, i, j)) { ! minAngle = angle; ! neighbour = s.getExterior(); ! } ! } } } |
From: Nordholt <nor...@us...> - 2006-07-31 17:10:38
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19604/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Spaces that were closed at last check is marked with (C) and spaces that were open marked with (O) Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** GenericTreeView.java 21 Jul 2006 14:58:58 -0000 1.31 --- GenericTreeView.java 31 Jul 2006 17:10:33 -0000 1.32 *************** *** 53,56 **** --- 53,57 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.gui.GUI; /** *************** *** 334,338 **** return genericgroupicon; } - } --- 335,338 ---- *************** *** 438,441 **** --- 438,446 ---- Entity entity = (Entity) object; String nid = entity.getName() + "-" + entity.getId().toString(); + if (GUI.getInstance().isClosed((Space)object)) { + nid += " (C)"; + } else { + nid += " (O)"; + } return nid; } *************** *** 996,1001 **** */ public void valueChanged(TreeSelectionEvent event) { - TreePath path = event.getPath(); if (event.isAddedPath()) { Object object = path.getLastPathComponent(); if (object instanceof DefaultMutableTreeNode) { --- 1001,1006 ---- */ public void valueChanged(TreeSelectionEvent event) { if (event.isAddedPath()) { + TreePath path = event.getPath(); Object object = path.getLastPathComponent(); if (object instanceof DefaultMutableTreeNode) { |
From: Nordholt <nor...@us...> - 2006-07-31 17:09:29
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19180/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: keeps a list of the spaces that were closed at the last check Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** GUI.java 24 Jul 2006 11:17:43 -0000 1.35 --- GUI.java 31 Jul 2006 17:09:19 -0000 1.36 *************** *** 31,34 **** --- 31,36 ---- import java.util.Iterator; + import java.util.Set; + import java.util.HashSet; import java.awt.BorderLayout; *************** *** 82,85 **** --- 84,90 ---- /** SPLIT_RIGHT */ public static final Integer SPLIT_RIGHT = new Integer(2); + + /** closed spaces */ + private Set closedSpaces = new HashSet(); /** *************** *** 425,428 **** --- 430,442 ---- /** + * Tells if a space is closed. + * @param sp the space + * @return wherther or not the space is closed. + */ + public boolean isClosed(Space sp) { + return closedSpaces.contains(sp); + } + + /** * Checks if spaces are closed. */ *************** *** 440,458 **** public void run() { while (true) { ! log.info("============check starting==========="); Iterator it = Project.getInstance().getSpaces().iterator(); while (it.hasNext()) { Space sp = (Space)it.next(); if (sp.isClosed()) { ! log.info("Space " + sp + " is closed"); } else { ! log.info("Space " + sp + " is open"); ! } } try { ! sleep(10000); } catch (Exception e) { log.info("Space checker thread threw a: " + e); ! } } } --- 454,472 ---- public void run() { while (true) { ! log.info(" -- Start -- "); Iterator it = Project.getInstance().getSpaces().iterator(); while (it.hasNext()) { Space sp = (Space)it.next(); if (sp.isClosed()) { ! closedSpaces.add(sp); } else { ! closedSpaces.remove(sp); ! } } try { ! sleep(1000); } catch (Exception e) { log.info("Space checker thread threw a: " + e); ! } } } |
From: Michael L. <he...@us...> - 2006-07-31 14:07:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10343/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java RectTool.java Removed Files: AltRectTool.java Log Message: Deleted RectTool and renamed AltRectTool to RectTool --- AltRectTool.java DELETED --- Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** ToolFactory.java 21 Jul 2006 15:14:57 -0000 1.55 --- ToolFactory.java 31 Jul 2006 14:06:56 -0000 1.56 *************** *** 87,93 **** /** arc tool */ private ArcTool arc; - - /** rect tool */ - private RectTool rect; /** pencil tool */ --- 87,90 ---- *************** *** 122,126 **** /** The Alternative Rect tool */ ! private AltRectTool altRect; /** The selection button */ --- 119,123 ---- /** The Alternative Rect tool */ ! private RectTool altRect; /** The selection button */ *************** *** 199,203 **** eraser = new EraserTool(glv, pencilcursor); arc = new ArcTool(glv, pencilcursor); - rect = new RectTool(glv, pencilcursor); controlledStrategy = new ControlledMoveStrategy(glv, pencilcursor); vectorStrategy = new VectorMoveStrategy(glv, pencilcursor); --- 196,199 ---- *************** *** 215,219 **** constructor = new ConstructorTool(glv, pencilcursor); offset = new OffsetTool(glv, pencilcursor); ! altRect = new AltRectTool(glv, pencilcursor); Toolbar tb = Toolbar.getInstance(); --- 211,215 ---- constructor = new ConstructorTool(glv, pencilcursor); offset = new OffsetTool(glv, pencilcursor); ! altRect = new RectTool(glv, pencilcursor); Toolbar tb = Toolbar.getInstance(); Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RectTool.java 21 Jun 2006 13:26:18 -0000 1.10 --- RectTool.java 31 Jul 2006 14:06:56 -0000 1.11 *************** *** 10,26 **** import java.awt.Cursor; import java.awt.event.MouseEvent; ! import java.util.HashSet; ! import java.util.LinkedList; import java.util.List; import org.apache.log4j.Logger; import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; /** ! * RectTool */ public class RectTool extends AbstractPencil { --- 10,25 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; ! import java.util.List; + import java.util.LinkedList; import org.apache.log4j.Logger; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; /** ! * An alternative Rectangle Tool */ public class RectTool extends AbstractPencil { *************** *** 28,47 **** private static Logger log = Logger.getLogger(RectTool.class); ! /** Tempoary edges for multiple selection */ ! protected Edge e1; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e2; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e3; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e4; ! ! /** The drag box */ ! protected HashSet box; /** --- 27,45 ---- private static Logger log = Logger.getLogger(RectTool.class); + /** The edges of the rectangle */ + private List rectangle; ! /** The edge that will be moving while making the rectangle */ ! private Edge movingEdge; + /** The base edge of the rectangle */ + private Edge baseEdge; + + /** The last value of currents vertex + where the rectangle was moved */ + private Vertex lastCurrent; + + /** Dragging flag */ + private boolean dragging; /** *************** *** 52,135 **** public RectTool(GLView glv, Cursor cursor) { super(glv, cursor); } - /** ! * Create a rectangle ! * @param start Start point ! * @param end End point ! * @return List of edges forming a rectangle, null if the edges only form a line */ ! List createRect(Vertex start, Vertex end) { ! List edges = new LinkedList(); ! ! Vertex d = start.minus(end); ! /* So no edges are created with null vertices */ ! if (Math.abs(d.getX()) < 0.00001 && ! Math.abs(d.getY()) < 0.00001 && ! Math.abs(d.getZ()) < 0.00001) { ! return edges; ! } ! Vertex v1 = null; ! Vertex v3 = null; ! Vertex v2 = null; ! Vertex v4 = null; ! ! if (Math.abs(d.getZ()) < 0.00001) { ! v1 = start; ! v3 = end; ! v2 = new Vertex(v3.getX(), v1.getY(), v1.getZ()); ! v4 = new Vertex(v1.getX(), v3.getY(), v3.getZ()); ! } else if (Math.abs(d.getX()) < 0.00001) { ! v1 = start; ! v3 = end; ! v2 = new Vertex(v3.getX(), v1.getY(), v3.getZ()); ! v4 = new Vertex(v1.getX(), v3.getY(), v1.getZ()); ! } else if (Math.abs(d.getY()) < 0.00001) { ! v1 = start; ! v3 = end; ! v2 = new Vertex(v1.getX(), v1.getY(), v3.getZ()); ! v4 = new Vertex(v3.getX(), v3.getY(), v1.getZ()); ! } ! if ((Math.abs(d.getX()) < 0.00001 && Math.abs(d.getY()) < 0.00001) || ! (Math.abs(d.getX()) < 0.00001 && Math.abs(d.getZ()) < 0.00001) || ! (Math.abs(d.getZ()) < 0.00001 && Math.abs(d.getY()) < 0.00001)) { ! // The box is only in one direction and therefor just an edge ! return null; ! } ! if (v1 != null) { ! e1 = new Edge(v1, v2); ! e2 = new Edge(v2, v3); ! e3 = new Edge(v3, v4); ! e4 = new Edge(v4, v1); ! edges.add(e1); ! edges.add(e2); ! edges.add(e3); ! edges.add(e4); } ! return edges; } /** ! * Update feedback ! * */ ! protected void updateFeedback() { if (start != null) { ! List edges = new LinkedList(); ! Edge edge = new Edge(start.vertex(), current.vertex()); ! edge.setConstructor(true); ! edges.add(edge); ! List l = createRect(start.vertex(), current.vertex()); ! if (l != null) { ! edges.addAll(l); } else { ! edge.setConstructor(false); } ! feedback(edges); } else { ! feedback(new LinkedList()); } ! makeTarget(current); } --- 50,121 ---- public RectTool(GLView glv, Cursor cursor) { super(glv, cursor); + rectangle = new LinkedList(); + movingEdge = null; + baseEdge = null; + lastCurrent = null; + dragging = false; } /** ! * Update feedback */ ! public void updateFeedback() { ! if (start != null) { ! if (baseEdge == null) { ! Edge edge = new Edge(start.vertex(), current.vertex()); ! List edges = new LinkedList(); ! edges.add(edge); ! feedback(edges); ! } else { ! Vertex delta = lastCurrent.minus(current.vertex()); ! Vertex baseProjection = baseEdge.getDirection(); ! baseProjection.scale(1 / baseProjection.length()); ! baseProjection.scale(delta.dot(baseProjection)); ! Vertex movement = baseProjection.minus(delta); ! movingEdge.move(movement.getX(), movement.getY(), movement.getZ()); ! lastCurrent = current.vertex(); ! } } ! makeTarget(current); ! updateConstructors(); } /** ! * On vertex - to make "apply" work */ ! public void onVertex() { if (start != null) { ! if (baseEdge == null) { ! setUpRectangle(); } else { ! double length = start.vertex().minus(current.vertex()).length(); ! Vertex direction = movingEdge.getFrom().minus(baseEdge.getTo()); ! direction.scale((length - direction.length()) / direction.length()); ! movingEdge.move(direction.getX(), direction.getY(), direction.getZ()); ! insertEdges(rectangle); ! cleanUp(); ! feedback(rectangle); } ! updateFeedback(); } else { ! start = current; ! lastCurrent = start.vertex(); ! updateFeedback(); } ! } ! ! /** ! * Creates the base edge of the rectangle and sets up the ! * rectangle. ! */ ! private void setUpRectangle() { ! rectangle = new LinkedList(); ! baseEdge = new Edge(start.vertex(), current.vertex()); ! movingEdge = new Edge(current.vertex().copy(), start.vertex().copy()); ! rectangle.add(baseEdge); ! rectangle.add(new Edge(current.vertex(), movingEdge.getFrom())); ! rectangle.add(movingEdge); ! rectangle.add(new Edge(movingEdge.getTo(), start.vertex())); ! feedback(rectangle); } *************** *** 138,148 **** */ protected void updateLength() { ! if (e1 != null && e2 != null) { ! glv.setLength(e1.getLength(), e2.getLength()); } else { ! glv.setLength(0.0, 0.0); } } ! /** * @param e MouseEvent --- 124,134 ---- */ protected void updateLength() { ! if (baseEdge == null) { ! super.updateLength(); } else { ! glv.setLength(baseEdge.getFrom().minus(movingEdge.getTo()).length()); } } ! /** * @param e MouseEvent *************** *** 152,156 **** if (current != null) { updateFeedback(); - updateConstructors(); } } --- 138,141 ---- *************** *** 162,182 **** if (start == null) { start = current; ! e1 = null; ! e2 = null; ! e3 = null; ! e4 = null; } else { ! List edges = createRect(start.vertex(), current.vertex()); ! if (edges != null) { ! insertEdges(edges); ! } else { ! boolean split = (start.type() == Intersection.EDGE_INTERSECTION || ! current.type() == Intersection.EDGE_INTERSECTION); ! insertEdge(new Edge(start.vertex(), current.vertex()), split); ! } cleanUp(); } updateFeedback(); - updateConstructors(); } --- 147,159 ---- if (start == null) { start = current; ! lastCurrent = start.vertex(); ! } else if (baseEdge == null) { ! setUpRectangle(); } else { ! insertEdges(rectangle); cleanUp(); + feedback(rectangle); } updateFeedback(); } *************** *** 185,189 **** */ protected void dragged(MouseEvent e) { ! } --- 162,169 ---- */ protected void dragged(MouseEvent e) { ! moved(e); ! if (!dragging) { ! dragging = true; ! } } *************** *** 192,205 **** */ protected void released(MouseEvent e) { } ! /** ! * Clean up */ public void cleanUp() { ! e1 = null; ! e2 = null; ! e3 = null; ! e4 = null; super.cleanUp(); } --- 172,190 ---- */ protected void released(MouseEvent e) { + if (dragging) { + pressed(e); + dragging = false; + } } ! /** ! * do clean up */ public void cleanUp() { ! baseEdge = null; ! movingEdge = null; ! start = null; ! rectangle = new LinkedList(); ! dragging = false; super.cleanUp(); } |
From: Michael L. <he...@us...> - 2006-07-31 13:03:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17991/src/net/sourceforge/bprocessor/gl/tool Modified Files: Pencil.java AbstractPencil.java AltRectTool.java Log Message: Fixed a few bugs related to length field Index: Pencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Pencil.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Pencil.java 31 Jul 2006 11:29:08 -0000 1.10 --- Pencil.java 31 Jul 2006 13:03:43 -0000 1.11 *************** *** 53,56 **** --- 53,57 ---- } makeTarget(current); + updateConstructors(); } *************** *** 61,65 **** current = findIntersection(e); if (current != null) { - updateConstructors(); updateFeedback(); } --- 62,65 ---- Index: AltRectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltRectTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AltRectTool.java 21 Jul 2006 08:54:44 -0000 1.2 --- AltRectTool.java 31 Jul 2006 13:03:43 -0000 1.3 *************** *** 78,81 **** --- 78,82 ---- } makeTarget(current); + updateConstructors(); } *************** *** 97,101 **** } updateFeedback(); ! updateConstructors(); } } --- 98,105 ---- } updateFeedback(); ! } else { ! start = current; ! lastCurrent = start.vertex(); ! updateFeedback(); } } *************** *** 134,138 **** if (current != null) { updateFeedback(); - updateConstructors(); } } --- 138,141 ---- *************** *** 153,157 **** } updateFeedback(); - updateConstructors(); } --- 156,159 ---- Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** AbstractPencil.java 23 Jul 2006 09:17:44 -0000 1.50 --- AbstractPencil.java 31 Jul 2006 13:03:43 -0000 1.51 *************** *** 768,771 **** --- 768,789 ---- /** + * Delete + */ + public void delete() { + int length = number.length(); + if (length > 1) { + number = number.substring(0, length - 1); + } else { + number = String.valueOf(0); + } + try { + double d = Double.parseDouble(number); + glv.setLength(d / 1000); + } catch (NumberFormatException exp) { + Project.info(exp); + } + } + + /** * Invoked when a key has been pressed. * @param e The KeyEvent |