bprocessor-commit Mailing List for B-processor (Page 128)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael L. <he...@us...> - 2006-03-27 15:03:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29931/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Fixed a bug in pencil that assigned new ID's to vertices Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AbstractPencil.java 27 Mar 2006 07:08:26 -0000 1.12 --- AbstractPencil.java 27 Mar 2006 15:03:25 -0000 1.13 *************** *** 89,93 **** */ public Vertex insertVertex(Vertex vertex) { ! Vertex actual = vertex; { Set vertices = mesh().findByLocation --- 89,93 ---- */ public Vertex insertVertex(Vertex vertex) { ! Vertex actual = null; { Set vertices = mesh().findByLocation *************** *** 97,112 **** } } ! if (actual == vertex) { ! mesh().add(actual); ! Set es = mesh().findEdge(actual); ! if (es.size() > 0) { ! Iterator iter = es.iterator(); ! while (iter.hasNext()) { ! Edge e = (Edge) iter.next(); ! if (!e.getConstructor()) { ! e.split(actual); } } ! } } return actual; --- 97,116 ---- } } ! ! if (actual == null) { ! actual = vertex; ! if (actual.getOwner() == null) { ! mesh().add(actual); ! Set es = mesh().findEdge(actual); ! if (es.size() > 0) { ! Iterator iter = es.iterator(); ! while (iter.hasNext()) { ! Edge e = (Edge) iter.next(); ! if (!e.getConstructor()) { ! e.split(actual); ! } } } ! } } return actual; |
From: Nordholt <nor...@us...> - 2006-03-27 14:43:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19017 Modified Files: TapeMeasureTool.java Log Message: now makes target Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TapeMeasureTool.java 21 Mar 2006 22:33:36 -0000 1.12 --- TapeMeasureTool.java 27 Mar 2006 14:43:48 -0000 1.13 *************** *** 117,122 **** --- 117,126 ---- } } else if (angling) { + findTarget(e); + glv.getView().makeTarget(target); moveAngel(e); } else if (measuring) { + findTarget(e); + glv.getView().makeTarget(target); move(e); } |
From: Nordholt <nor...@us...> - 2006-03-27 14:41:11
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17627 Modified Files: ToolFactory.java Log Message: add new movestrategies Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** ToolFactory.java 22 Mar 2006 11:42:44 -0000 1.39 --- ToolFactory.java 27 Mar 2006 14:41:03 -0000 1.40 *************** *** 61,64 **** --- 61,70 ---- private MoveTool move; + /** The vector movetool strategy */ + private MoveTool vectorStrategy; + + /** The normal movetool strategy */ + private MoveTool controlledStrategy; + /** rotation tool */ private RotationTool rotation; *************** *** 170,174 **** --- 176,183 ---- arc = new ArcTool(glv, pencilcursor); rect = new RectTool(glv, pencilcursor); + controlledStrategy = new ControlledMoveStrategy(glv, pencilcursor); + vectorStrategy = new VectorMoveStrategy(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); + move.setStrategy(vectorStrategy); rotation = new RotationTool(glv, pencilcursor); extrusion = new MultiExtrudeTool(glv, pencilcursor); *************** *** 351,357 **** } } /** ! listener for the move popup. */ class MovePopupActionListener implements ActionListener { --- 360,367 ---- } } + /** ! * listener for the move popup. */ class MovePopupActionListener implements ActionListener { *************** *** 362,375 **** public void actionPerformed(ActionEvent actionEvent) { if (actionEvent.getActionCommand().equals("Vector")) { ! move.setMoveMode(MoveTool.THREE_CLICK); ! } else if (actionEvent.getActionCommand().equals("Axis restricted")) { ! move.setMoveMode(MoveTool.AXIS_RESTRICTED); ! } else if (actionEvent.getActionCommand().equals("Free plane")) { ! move.setMoveMode(MoveTool.FREE_SNAP); } else if (actionEvent.getActionCommand().equals("Controlled")) { ! move.setMoveMode(MoveTool.CONTROLLED); } } } ! } } --- 372,383 ---- public void actionPerformed(ActionEvent actionEvent) { if (actionEvent.getActionCommand().equals("Vector")) { ! log.info("vector bruges nu"); ! move.setStrategy(vectorStrategy); } else if (actionEvent.getActionCommand().equals("Controlled")) { ! log.info("controlled bruges nu"); ! move.setStrategy(controlledStrategy); } } } ! } } |
From: Nordholt <nor...@us...> - 2006-03-27 14:40:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17068 Modified Files: MoveTool.java Log Message: refactoring movetool to use strategies Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** MoveTool.java 21 Mar 2006 22:33:36 -0000 1.48 --- MoveTool.java 27 Mar 2006 14:40:04 -0000 1.49 *************** *** 16,20 **** import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.gl.view.Transformation; --- 16,19 ---- *************** *** 26,37 **** import java.util.Collection; - import java.util.HashMap; - import java.util.HashSet; import java.util.Iterator; import java.util.Set; ! import java.util.List; ! import java.util.LinkedList; ! import java.util.Timer; ! import java.util.TimerTask; import org.apache.log4j.Logger; --- 25,33 ---- import java.util.Collection; import java.util.Iterator; import java.util.Set; ! import java.util.HashSet; ! ! import org.apache.log4j.Logger; *************** *** 44,113 **** private static Logger log = Logger.getLogger(MoveTool.class); - /** The axis restricted movement mode */ - public static final int AXIS_RESTRICTED = 0; - - /** The free snap movement mode */ - public static final int FREE_SNAP = 1; - - /** The 3 clicks movement mode */ - public static final int THREE_CLICK = 2; - - /** The controlled movement mode */ - public static final int CONTROLLED = 3; - - /** The goemetry based movement mode */ - public static final int GEOMETRY = 4; - /** The initial movepoint */ ! private Vertex initial; /** The location to move from */ ! private Vertex from; - /** The plane to drag according to */ - private Plane dragPlane; - /** The set of vertices to move */ ! private Set vertices; ! ! /** constructors for aligning the movement */ ! private Set moveConstructors; ! ! /** Vector to restrict movement in one direction */ ! private Vertex restrictionVector; ! /** The last restriction vector used */ ! private Vertex lastRestriction; /** Number typed when using the length field */ ! private String number; ! ! /** The mode of moving */ ! private int moveMode; ! ! /** Number of clicks when in 3 click mode */ ! private int numberOfClicks; ! ! /** The Three click constructors edge */ ! private Edge threeClickConst; ! ! /** The entity that is being snapped to */ ! private Entity snapEntity; /** The Collection of entities being moved*/ ! private Collection moveEntities; ! ! /** ! * Mapping from each vertex being moved, ! * to a vertex defining the direction of the ! * edge the moving vertex slides on ! */ ! private HashMap slideMap; ! ! /** The entity being moved in a controlled way */ ! private Entity controlled; ! /** The aligning edge */ ! private Edge alignEdge; /** --- 40,63 ---- private static Logger log = Logger.getLogger(MoveTool.class); /** The initial movepoint */ ! protected Vertex initial; /** The location to move from */ ! protected Vertex from; /** The set of vertices to move */ ! protected Set vertices; ! /** The direction of the last move */ ! protected Vertex lastMoveDirection; /** Number typed when using the length field */ ! protected String number; /** The Collection of entities being moved*/ ! protected Collection moveEntities; ! /** The move strategy */ ! private MoveTool strategy; /** *************** *** 118,128 **** public MoveTool(GLView glv, Cursor cursor) { super(glv, cursor); ! moveConstructors = null; ! restrictionVector = null; ! snapEntity = null; ! alignEdge = null; ! slideMap = new HashMap(); ! numberOfClicks = 1; ! moveMode = AXIS_RESTRICTED; } --- 68,73 ---- public MoveTool(GLView glv, Cursor cursor) { super(glv, cursor); ! strategy = null; ! lastMoveDirection = null; } *************** *** 152,234 **** */ protected void pressed(MouseEvent e) { ! findTarget(e); ! { ! clearConstructors(moveConstructors); ! if (target != null) { ! moveEntities = new HashSet(); ! if (moveMode != THREE_CLICK) { ! initial = findInitial(target, e); ! from = initial.copy(); ! slideMap = new HashMap(); ! ! setupConstructors(); ! displayConstructors(moveConstructors); ! ! vertices = new HashSet(); ! ! if (selection.isEmpty()) { ! moveEntities.add(target); ! } else { ! moveEntities.addAll(selection); ! } ! ! if (moveMode == CONTROLLED) { ! if (!moveEntities.isEmpty()) { ! Iterator it = moveEntities.iterator(); ! controlled = (Entity)it.next(); ! } ! moveEntities.clear(); ! moveEntities.add(controlled); ! } ! collect(moveEntities, vertices); ! } else { ! threeClickMove(e); ! } } ! } ! } ! ! /** Taking care of the three-click mode ! * @param e the MouseEvent object ! */ ! private void threeClickMove(MouseEvent e) { ! vertices = new HashSet(); ! moveEntities.addAll(selection); ! collect(moveEntities, vertices); ! if (numberOfClicks == 1) { ! from = findInitial(target, e); ! threeClickConst = new Edge(from, from); ! threeClickConst.setConstructor(true); ! glv.getView().addTempEdge(threeClickConst); ! numberOfClicks = 2; ! } else if (numberOfClicks == 2) { ! Vertex movement = findInitial(target, e).minus(from); ! move(moveEntities, movement); ! glv.getView().removeTempEdge(threeClickConst); ! threeClickConst = null; ! if (alignEdge != null) { ! glv.getView().removeTempEdge(alignEdge); ! alignEdge = null; ! } ! update(); ! numberOfClicks = 1; ! } } /** - * Sets the move constructors appropriate for the - * movement mode. - */ - private void setupConstructors() { - if (moveMode == AXIS_RESTRICTED) { - moveConstructors = makeXYZConstructors(initial); - } else if (moveMode == FREE_SNAP) { - moveConstructors = makeXYZConerConstructors(initial); - } else if (moveMode == THREE_CLICK) { - moveConstructors = new HashSet(); - } - } - - /** * Finds the point clicked. * @param entity the entity clicked --- 97,114 ---- */ protected void pressed(MouseEvent e) { ! if (strategy != null) { ! strategy.pressed(e); ! } else { ! moveEntities = new HashSet(); ! findTarget(e); ! if (selection.isEmpty()) { ! moveEntities.add(target); ! } else { ! moveEntities.addAll(selection); } ! } } /** * Finds the point clicked. * @param entity the entity clicked *************** *** 271,281 **** */ protected void released(MouseEvent e) { ! findTarget(e); ! clearConstructors(moveConstructors); ! moveConstructors = null; ! restrictionVector = null; ! dragPlane = null; ! number = ""; ! Project.getInstance().checkpoint(); } --- 151,161 ---- */ protected void released(MouseEvent e) { ! if (strategy != null) { ! strategy.released(e); ! } else { ! findTarget(e); ! number = ""; ! Project.getInstance().checkpoint(); ! } } *************** *** 285,330 **** */ protected void moved(MouseEvent e) { ! boolean showAlign = false; ! if (moveMode == THREE_CLICK && threeClickConst != null) { ! moveConstructors = makeXYZConerConstructors(new Vertex(0, 0, 0)); ! displayConstructors(moveConstructors); ! glv.getView().removeTempEdge(threeClickConst); ! if (alignEdge != null) { ! glv.getView().addTempEdge(alignEdge); ! } ! ! findTarget(e); ! glv.getView().makeTarget(target); ! if (target != null) { ! Vertex to = findInitial(target, e); ! if (target instanceof Edge) { ! Edge targetEdge = (Edge)target; ! if (!targetEdge.equals(alignEdge)) { ! Timer alignTimer = new Timer(); ! TimerTask alignTask = new AlignTask(targetEdge); ! alignTimer.schedule(alignTask, 300); ! } ! if (alignEdge != null) { ! Vertex alignDir = alignEdge.getDirection(); ! Vertex targetDir = targetEdge.getDirection(); ! Vertex dirCross = alignDir.cross(targetDir); ! showAlign = dirCross.length() < 0.000001; ! } ! } ! ! if (to != null) { ! threeClickConst.setTo(to); ! } ! } else { ! threeClickConst.setTo(from); ! } ! ! if (threeClickConst != null) { ! glv.getView().addTempEdge(threeClickConst); ! } ! if (!showAlign) { ! glv.getView().removeTempEdge(alignEdge); ! } ! clearConstructors(moveConstructors); } else { findTarget(e); --- 165,170 ---- */ protected void moved(MouseEvent e) { ! if (strategy != null) { ! strategy.moved(e); } else { findTarget(e); *************** *** 333,336 **** --- 173,177 ---- } + /** * Invoked when the mouse is held pressed and moved *************** *** 338,373 **** */ protected void dragged(MouseEvent e) { ! findRestrictions(e); ! if (dragPlane != null && restrictionVector != null) { ! int x = e.getX(); ! int y = e.getY(); ! Vertex parentPos = glv.getView().toPlaneCoords(new double[] {x, y}, dragPlane); ! if (parentPos != null) { ! Vertex delta = parentPos.minus(from); ! ! //Restricting movement to fit movement mode. ! delta = restrict(delta, e); ! ! if (log.isDebugEnabled()) { ! log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); ! log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); ! } ! ! //delta = snapToInitial(delta); ! ! if (moveMode != CONTROLLED) { ! move(vertices, delta); ! } else { ! slideMove(vertices, delta); ! } ! from.move(delta.getX(), delta.getY(), delta.getZ()); ! glv.setLength(from.minus(initial).length()); ! update(); ! } else { ! log.warn("could not hit the dragplane"); ! } ! } } ! /** * Corrects a movement vector to make the --- 179,187 ---- */ protected void dragged(MouseEvent e) { ! if (strategy != null) { ! strategy.dragged(e); ! } } ! /** * Corrects a movement vector to make the *************** *** 377,381 **** * @return the corrected movement vector. */ ! private Vertex snapToInitial(Vertex delta) { Vertex parentPos = from.add(delta); Vertex v = initial.minus(parentPos); --- 191,195 ---- * @return the corrected movement vector. */ ! protected Vertex snapToInitial(Vertex delta) { Vertex parentPos = from.add(delta); Vertex v = initial.minus(parentPos); *************** *** 392,675 **** return delta; } - - /** - * Restricts the movement to fit the movement mode, - * given a desired movement vector. - * @param delta the movement vector. - * @param e the mouseEvent for this restriction - * @return the restricted movement vector. - */ - private Vertex restrict(Vertex delta, MouseEvent e) { - if (moveMode == AXIS_RESTRICTED) { - Vertex restrictCopy = restrictionVector.copy(); - restrictCopy.scale(1 / restrictCopy.length()); - restrictCopy.scale(delta.dot(restrictCopy)); - delta = restrictCopy; - } else if (moveMode == FREE_SNAP) { - Object o = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, - false, new Plane(0, 0, 1, 0)); - if (o != null) { - snapEntity = (Entity)o; - delta = findInitial(snapEntity, e).minus(from); - } - } else if (moveMode == CONTROLLED) { - Vertex restrictCopy = restrictionVector.copy(); - restrictCopy.scale(1 / restrictCopy.length()); - restrictCopy.scale(delta.dot(restrictCopy)); - delta = restrictCopy; - } - return delta; - } - - /** - * Set up the restriction depending on the - * movement mode. - * @param e a mouse event. - */ - private void findRestrictions(MouseEvent e) { - if (moveMode == AXIS_RESTRICTED) { - if (restrictionVector == null && moveConstructors != null) { - boolean found = findRestrictionVector(e); - if (found) { - findRestrictionPlane(); - } - } - } else if (moveMode == FREE_SNAP) { - if (dragPlane == null && moveConstructors != null) { - - Iterator iter = moveConstructors.iterator(); - Edge firstConst = (Edge)iter.next(); - Edge secondConst = (Edge)iter.next(); - Edge thirdConst = (Edge)iter.next(); - - Surface hitSurface1 = spannedSurface(firstConst, secondConst); - Surface hitSurface2 = spannedSurface(firstConst, thirdConst); - Surface hitSurface3 = spannedSurface(secondConst, thirdConst); - - glv.getView().addTempSurface(hitSurface1); - glv.getView().addTempSurface(hitSurface2); - glv.getView().addTempSurface(hitSurface3); - Object ob = glv.getView().getObjectAtPoint(e.getX(), e.getY()); - if (ob instanceof Surface) { - Surface surface = (Surface)ob; - if (surface.equals(hitSurface1) || - surface.equals(hitSurface2) || - surface.equals(hitSurface3)) { - dragPlane = surface.plane(); - restrictionVector = new Vertex(0, 0, 0); - } - } - glv.getView().removeTempSurface(hitSurface1); - glv.getView().removeTempSurface(hitSurface2); - glv.getView().removeTempSurface(hitSurface3); - clearConstructors(moveConstructors); - } - } else if (moveMode == CONTROLLED && controlled != null) { - if (slideMap.isEmpty()) { - findTarget(e); - if (controlled instanceof Edge) { - Edge controlledEdge = (Edge)controlled; - if (target instanceof Surface) { - Surface targetSurface = (Surface)target; - if (controlledEdge.getSurfaces().contains(targetSurface)) { - glv.getView().makeTarget(target); - dragPlane = targetSurface.plane(); - Vertex controlledDir = controlledEdge.getDirection(); - Vertex surfaceNormal = targetSurface.normal(); - restrictionVector = controlledDir.cross(surfaceNormal); - restrictionVector.scale(1 / restrictionVector.length()); - - List edges = targetSurface.getEdges(); - int index = edges.indexOf(controlledEdge); - 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; - if (controlledDir.cross(leftEdge.getDirection()).length() > 0.00001 && - controlledDir.cross(rightEdge.getDirection()).length() > 0.00001) { - Vertex to = controlledEdge.getTo(); - Vertex from = controlledEdge.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; - } - slideMap = new HashMap(); - slideMap.put(controlledEdge.getTo(), toSlideEdge.getDirection()); - slideMap.put(controlledEdge.getFrom(), fromSlideEdge.getDirection()); - } else { - dragPlane = null; - restrictionVector = null; - log.warn("This edge is bound"); - } - } - } - } else if (controlled instanceof Vertex) { - Vertex controlledVertex = (Vertex)controlled; - if (target instanceof Edge && - controlledVertex.getEdges().contains((Edge)target)) { - Edge targetEdge = (Edge)target; - slideMap = new HashMap(); - slideMap.put(controlledVertex, targetEdge.getDirection()); - restrictionVector = targetEdge.getDirection(); - findRestrictionPlane(); - } - } else if (controlled instanceof Surface) { - Surface controlledSurface = (Surface)controlled; - restrictionVector = controlledSurface.normal(); - findRestrictionPlane(); - slideMap = new HashMap(); - Collection vertices = controlledSurface.getVertices(); - Iterator it = vertices.iterator(); - boolean bound = false; - while (it.hasNext() && !bound) { - Vertex vertex = (Vertex)it.next(); - slideMap.put(vertex, restrictionVector); - Collection edges = vertex.getEdges(); - Iterator edgeIt = edges.iterator(); - int otherEdges = 0; - while (edgeIt.hasNext() && !bound) { - Edge edge = (Edge)edgeIt.next(); - if (!controlledSurface.getEdges().contains(edge)) { - otherEdges++; - slideMap.put(vertex, edge.getDirection()); - } - bound = otherEdges > 1; - } - } - if (bound) { - slideMap = new HashMap(); - restrictionVector = null; - dragPlane = null; - log.warn("this surface is bound!"); - } - } - } - } - } - - /** - * Creates the surface spanned by two edges connected - * at one point.Used in finding restrictions for the FREE_SNAP mode. - * @param edge1 the first edge. - * @param edge2 the second edge. - * @return the surface. - */ - private Surface spannedSurface(Edge edge1, Edge edge2) { - List edges = new LinkedList(); - - Vertex to1 = edge1.getTo().copy(); - Vertex to2 = edge2.getTo().copy(); - Vertex notConnected1; - Vertex notConnected2; - Vertex connected; - if (Math.abs(to1.getX() - to2.getX()) < 0.0001 && - Math.abs(to1.getY() - to2.getY()) < 0.0001 && - Math.abs(to1.getZ() - to2.getZ()) < 0.0001) { - connected = to1; - notConnected1 = edge1.getFrom().copy(); - notConnected2 = edge2.getFrom().copy(); - } else { - Vertex from2 = edge2.getFrom().copy(); - if (Math.abs(to1.getX() - from2.getX()) < 0.0001 && - Math.abs(to1.getY() - from2.getY()) < 0.0001 && - Math.abs(to1.getZ() - from2.getZ()) < 0.0001) { - connected = to1; - notConnected1 = edge1.getFrom().copy(); - notConnected2 = to2; - } else { - notConnected1 = to1; - connected = edge1.getFrom().copy(); - if (Math.abs(connected.getX() - from2.getX()) < 0.0001 && - Math.abs(connected.getY() - from2.getY()) < 0.0001 && - Math.abs(connected.getZ() - from2.getZ()) < 0.0001) { - notConnected2 = to2; - } else { - notConnected2 = from2; - } - } - } - - edges.add(new Edge(notConnected1, notConnected2)); - edges.add(new Edge(notConnected2, connected)); - edges.add(new Edge(connected, notConnected1)); - return new Surface(edges); - } - - /** - * Finds the current restriction vector. - * There must be some number of moveconstructors find a - * restriction vector. - * @param e the mouse event - * @return wherther or not a vector was found. - */ - private boolean findRestrictionVector(MouseEvent e) { - if (moveConstructors != null) { - List hitEdges = glv.getView().getEdgeAtPoint(e.getX(), e.getY()); - Iterator it = moveConstructors.iterator(); - int numberOfAxis = 0; - Edge axis = null; - while (it.hasNext()) { - Edge tempAxis = (Edge)it.next(); - if (hitEdges.contains(tempAxis)) { - numberOfAxis++; - axis = tempAxis; - } - } - //Only assign a restriction vector when exactly one - //moveconstructor is selected. - if (numberOfAxis == 1) { - restrictionVector = axis.getFrom().minus(axis.getTo()); - lastRestriction = restrictionVector.copy(); - //when a moveconstructor is selected it is the - //only one shown. - clearConstructors(moveConstructors); - moveConstructors = new HashSet(); - moveConstructors.add(axis); - displayConstructors(moveConstructors); - return true; - } - } - return false; - } - - /** - * Sets an appropriate dragPlane that aligned with the - * restrictionvector and containing a specified point to - * make reasonable movements. - */ - protected void findRestrictionPlane() { - Camera camera = Project.getInstance().getCurrentCamera(); - double[] centerPoint = camera.getCenter(); - double[] cameraPoint = camera.getCamera(); - - Vertex eyeVector = new Vertex(cameraPoint[0] - centerPoint[0], - cameraPoint[1] - centerPoint[1], - cameraPoint[2] - centerPoint[2]); - Vertex cross = restrictionVector.cross(eyeVector); - Vertex planeNormal; - if (cross.isZero()) { - double[] rollVector = camera.getRoll(); - planeNormal = new Vertex(rollVector[0], rollVector[1], rollVector[2]); - } else { - planeNormal = (restrictionVector.cross(eyeVector)).cross(restrictionVector); - } - dragPlane = new Plane(planeNormal.getX(), planeNormal.getY(), planeNormal.getZ(), - -planeNormal.dot(initial)); - } /** --- 206,209 ---- *************** *** 678,682 **** * @param delta The movement */ ! private void move(Collection sel, Vertex delta) { Iterator it = sel.iterator(); while (it.hasNext()) { --- 212,216 ---- * @param delta The movement */ ! protected void move(Collection sel, Vertex delta) { Iterator it = sel.iterator(); while (it.hasNext()) { *************** *** 693,731 **** /** - * Moves a set of vertices in a controlled way, so that they slide along - * vectors specified in the slideMap. - * @param vertices The vertices that should be moved. - * @param delta the movement. - */ - private void slideMove(Collection vertices, Vertex delta) { - 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); - double slideScale; - if (delta == null) { - log.info("delta null"); - } - if (slideDir == null) { - log.info("slideDir null"); - } - if (deltaUnit == null) { - log.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()); - } - } - - /** * Invoked when a key has been pressed. Lets user control the mode of movement. * After movement in one direction a length can be typed in to adjust the movement --- 227,230 ---- *************** *** 737,850 **** */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { ! if (dragPlane != null) { ! dragPlane = null; move(vertices, initial.minus(from)); ! } ! } else if (lastRestriction != null && ! initial != null && ! from != null && ! vertices != null && ! number != null) { ! if (e.getKeyCode() == KeyEvent.VK_1) { ! number += "1"; ! } else if (e.getKeyCode() == KeyEvent.VK_2) { ! number += "2"; ! } else if (e.getKeyCode() == KeyEvent.VK_3) { ! number += "3"; ! } else if (e.getKeyCode() == KeyEvent.VK_4) { ! number += "4"; ! } else if (e.getKeyCode() == KeyEvent.VK_5) { ! number += "5"; ! } else if (e.getKeyCode() == KeyEvent.VK_6) { ! number += "6"; ! } else if (e.getKeyCode() == KeyEvent.VK_7) { ! number += "7"; ! } else if (e.getKeyCode() == KeyEvent.VK_8) { ! number += "8"; ! } else if (e.getKeyCode() == KeyEvent.VK_9) { ! number += "9"; ! } else if (e.getKeyCode() == KeyEvent.VK_0) { ! number += "0"; ! } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { ! if (!number.equals("")) { ! double length = glv.getLength(); ! Vertex delta = initial.minus(from); ! if (delta.length() > 0) { ! delta.scale((delta.length() - length) / delta.length()); ! } else { ! delta = lastRestriction.copy(); ! delta.scale(length / delta.length()); } - move(vertices, delta); - update(); - glv.repaint(); } ! } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! int length = number.length(); ! if (length > 0) { ! number = number.substring(0, length - 1); } - } - if (number.equals("") || number.equals("-")) { - glv.setLength(0); } else { ! try { ! double d = Double.parseDouble(number); ! glv.setLength(d / 1000); ! } catch (NumberFormatException exp) { ! System.out.println(exp); ! } } ! } else { ! super.keyPressed(e); } - glv.repaint(true); } ! ! /** ! * sets movemode ! * @param mode the mode ! */ ! public void setMoveMode(int mode) { ! moveMode = mode; ! } ! /** ! * Class for handeling the task of assigning an alignedge. */ ! private class AlignTask extends TimerTask { ! /** The edge candidate to become the alignedge */ ! private Edge candidateEdge; ! ! /** ! * Constructor ! * @param candidate the candidate to become alignedge ! */ ! public AlignTask(Edge candidate) { ! super(); ! candidateEdge = candidate; ! } ! ! /** ! * checks if the target is still the same edge, ! * thus making it the alignedge ! */ ! public void run() { ! if (target instanceof Edge) { ! candidateEdge.equals((Edge)target); ! ! Vertex direction = candidateEdge.getDirection(); ! Vertex alignTo = direction.copy(); ! Vertex alignFrom = direction.copy(); ! alignFrom.scale(-1000); ! alignTo.scale(1000); ! glv.getView().removeTempEdge(alignEdge); ! alignEdge = new Edge(alignFrom.add(from), alignTo.add(from)); ! alignEdge.setConstructor(true); ! glv.getView().addTempEdge(alignEdge); ! glv.repaint(true); ! } ! } } } --- 236,312 ---- */ public void keyPressed(KeyEvent e) { ! if (strategy != null) { ! strategy.keyPressed(e); ! } else { ! if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { move(vertices, initial.minus(from)); ! } else if (lastMoveDirection != null && ! initial != null && ! from != null && ! vertices != null && ! number != null) { ! if (e.getKeyCode() == KeyEvent.VK_1) { ! number += "1"; ! } else if (e.getKeyCode() == KeyEvent.VK_2) { ! number += "2"; ! } else if (e.getKeyCode() == KeyEvent.VK_3) { ! number += "3"; ! } else if (e.getKeyCode() == KeyEvent.VK_4) { ! number += "4"; ! } else if (e.getKeyCode() == KeyEvent.VK_5) { ! number += "5"; ! } else if (e.getKeyCode() == KeyEvent.VK_6) { ! number += "6"; ! } else if (e.getKeyCode() == KeyEvent.VK_7) { ! number += "7"; ! } else if (e.getKeyCode() == KeyEvent.VK_8) { ! number += "8"; ! } else if (e.getKeyCode() == KeyEvent.VK_9) { ! number += "9"; ! } else if (e.getKeyCode() == KeyEvent.VK_0) { ! number += "0"; ! } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { ! if (!number.equals("")) { ! double length = glv.getLength(); ! Vertex delta = initial.minus(from); ! if (delta.length() > 0) { ! delta.scale((delta.length() - length) / delta.length()); ! } else { ! delta = lastMoveDirection.copy(); ! delta.scale(length / delta.length()); ! } ! move(vertices, delta); ! update(); ! glv.repaint(); ! } ! } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! int length = number.length(); ! if (length > 0) { ! number = number.substring(0, length - 1); } } ! if (number.equals("") || number.equals("-")) { ! glv.setLength(0); ! } else { ! try { ! double d = Double.parseDouble(number); ! glv.setLength(d / 1000); ! } catch (NumberFormatException exp) { ! System.out.println(exp); ! } } } else { ! super.keyPressed(e); } ! glv.repaint(true); } } ! /** ! * Sets the strategy for the movetool ! * @param strategy the strategy */ ! public void setStrategy(MoveTool strategy) { ! this.strategy = strategy; } } |
From: Nordholt <nor...@us...> - 2006-03-27 14:39:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16355 Added Files: ControlledMoveStrategy.java VectorMoveStrategy.java Log Message: first versions of the vector and controlled strategies for the movetool --- NEW FILE: VectorMoveStrategy.java --- //--------------------------------------------------------------------------------- // $Id: VectorMoveStrategy.java,v 1.1 2006/03/27 14:38:48 nordholt Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Vertex; import java.util.HashSet; import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.awt.event.MouseEvent; import java.awt.Cursor; import java.awt.event.KeyEvent; import org.apache.log4j.Logger; /** * The vector strategy for the move tool */ public class VectorMoveStrategy extends MoveTool { /** Number of clicks when in 3 click mode */ private int numberOfClicks; /** The Three click constructors edge */ private Edge threeClickConst; /** The aligning edge */ private Edge alignEdge; /** The logger */ private static Logger log = Logger.getLogger(VectorMoveStrategy.class); /** * The Constructor * @param glv The 3D canvas * @param cursor The cursor */ public VectorMoveStrategy(GLView glv, Cursor cursor) { super(glv, cursor); alignEdge = null; numberOfClicks = 1; } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { if (numberOfClicks == 1) { super.pressed(e); vertices = new HashSet(); collect(moveEntities, vertices); from = findInitial(target, e); initial = from.copy(); threeClickConst = new Edge(initial, initial); threeClickConst.setConstructor(true); glv.getView().addTempEdge(threeClickConst); numberOfClicks = 2; number = ""; } else if (numberOfClicks == 2) { Vertex movement = findInitial(target, e).minus(initial); move(moveEntities, movement); glv.getView().removeTempEdge(threeClickConst); threeClickConst = null; if (alignEdge != null) { glv.getView().removeTempEdge(alignEdge); alignEdge = null; } update(); numberOfClicks = 1; } } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { boolean showAlign = false; if (threeClickConst != null) { Set moveConstructors = makeXYZConerConstructors(new Vertex(0, 0, 0)); displayConstructors(moveConstructors); glv.getView().removeTempEdge(threeClickConst); if (alignEdge != null) { glv.getView().addTempEdge(alignEdge); } findTarget(e); glv.getView().makeTarget(target); if (target != null) { Vertex to = findInitial(target, e); if (target instanceof Edge) { Edge targetEdge = (Edge)target; if (!targetEdge.equals(alignEdge)) { Timer alignTimer = new Timer(); TimerTask alignTask = new AlignTask(targetEdge); alignTimer.schedule(alignTask, 300); } if (alignEdge != null) { Vertex alignDir = alignEdge.getDirection(); Vertex targetDir = targetEdge.getDirection(); Vertex dirCross = alignDir.cross(targetDir); showAlign = dirCross.length() < 0.000001; } } if (to != null) { threeClickConst.setTo(to); lastMoveDirection = to.minus(initial).copy(); glv.setLength(lastMoveDirection.length()); //Do we really want this to move also? //Vertex movement = to.minus(from); //move(moveEntities, movement); //from = to; } } else { threeClickConst.setTo(from); } if (threeClickConst != null) { glv.getView().addTempEdge(threeClickConst); } if (!showAlign) { glv.getView().removeTempEdge(alignEdge); } clearConstructors(moveConstructors); } else { findTarget(e); glv.getView().makeTarget(target); } } /** * Class for handeling the task of assigning an alignedge. */ private class AlignTask extends TimerTask { /** The edge candidate to become the alignedge */ private Edge candidateEdge; /** * Constructor * @param candidate the candidate to become alignedge */ public AlignTask(Edge candidate) { super(); candidateEdge = candidate; } /** * checks if the target is still the same edge, * thus making it the alignedge */ public void run() { if (target instanceof Edge) { candidateEdge.equals((Edge)target); Vertex direction = candidateEdge.getDirection(); Vertex alignTo = direction.copy(); Vertex alignFrom = direction.copy(); alignFrom.scale(-1000); alignTo.scale(1000); glv.getView().removeTempEdge(alignEdge); alignEdge = new Edge(alignFrom.add(initial), alignTo.add(initial)); alignEdge.setConstructor(true); glv.getView().addTempEdge(alignEdge); glv.repaint(true); } } } /** * Invoked when a key has been pressed. Lets user control the mode of movement. * After movement in one direction a length can be typed in to adjust the movement * to a specific length. * ESCAPE - cancel movement. * 0-9 - type length in length field. * ENTER - perform move of the specified length. * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { super.keyPressed(e); } } --- NEW FILE: ControlledMoveStrategy.java --- //--------------------------------------------------------------------------------- // $Id: ControlledMoveStrategy.java,v 1.1 2006/03/27 14:38:48 nordholt Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Camera; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Iterator; import java.util.Collection; import java.awt.event.MouseEvent; import java.awt.Cursor; import java.awt.event.KeyEvent; import org.apache.log4j.Logger; /** * The controlled strategy for the move tool */ public class ControlledMoveStrategy extends MoveTool { /** The logger */ private static Logger log = Logger.getLogger(ControlledMoveStrategy.class); /** The slidemap */ private HashMap slideMap; /** The entity to be moved controlled */ private Entity controlled; /** The plane to drag according to */ private Plane dragPlane; /** Vector to restrict movement in one direction */ private Vertex restrictionVector; /** The initial movepoint */ private Vertex initial; /** * The Constructor * @param glv The 3D canvas * @param cursor The cursor */ public ControlledMoveStrategy(GLView glv, Cursor cursor) { super(glv, cursor); slideMap = new HashMap(); restrictionVector = null; } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { super.pressed(e); if (target != null) { initial = findInitial(target, e); from = initial.copy(); slideMap = new HashMap(); vertices = new HashSet(); if (!moveEntities.isEmpty()) { Iterator it = moveEntities.iterator(); controlled = (Entity)it.next(); } moveEntities.clear(); moveEntities.add(controlled); number = ""; } collect(moveEntities, vertices); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { findRestrictions(e); if (dragPlane != null && restrictionVector != null) { int x = e.getX(); int y = e.getY(); Vertex parentPos = glv.getView().toPlaneCoords(new double[] {x, y}, dragPlane); if (parentPos != null) { Vertex delta = parentPos.minus(from); //Restricting movement. Vertex restrictCopy = restrictionVector.copy(); restrictCopy.scale(1 / restrictCopy.length()); restrictCopy.scale(delta.dot(restrictCopy)); delta = restrictCopy; if (log.isDebugEnabled()) { log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } move(vertices, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); glv.setLength(from.minus(initial).length()); lastMoveDirection = delta.copy(); update(); } else { log.warn("could not hit the dragplane"); } } } /** * Set up the restriction to make the movement controlled * @param e a mouse event. */ private void findRestrictions(MouseEvent e) { if (controlled != null) { if (slideMap.isEmpty()) { findTarget(e); if (controlled instanceof Edge) { Edge controlledEdge = (Edge)controlled; if (target instanceof Surface) { Surface targetSurface = (Surface)target; if (controlledEdge.getSurfaces().contains(targetSurface)) { glv.getView().makeTarget(target); dragPlane = targetSurface.plane(); Vertex controlledDir = controlledEdge.getDirection(); Vertex surfaceNormal = targetSurface.normal(); restrictionVector = controlledDir.cross(surfaceNormal); restrictionVector.scale(1 / restrictionVector.length()); List edges = targetSurface.getEdges(); int index = edges.indexOf(controlledEdge); 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; if (controlledDir.cross(leftEdge.getDirection()).length() > 0.00001 && controlledDir.cross(rightEdge.getDirection()).length() > 0.00001) { Vertex to = controlledEdge.getTo(); Vertex from = controlledEdge.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; } slideMap = new HashMap(); slideMap.put(controlledEdge.getTo(), toSlideEdge.getDirection()); slideMap.put(controlledEdge.getFrom(), fromSlideEdge.getDirection()); } else { dragPlane = null; restrictionVector = null; log.warn("This edge is bound"); } } } } else if (controlled instanceof Vertex) { Vertex controlledVertex = (Vertex)controlled; if (target instanceof Edge && controlledVertex.getEdges().contains((Edge)target)) { Edge targetEdge = (Edge)target; slideMap = new HashMap(); slideMap.put(controlledVertex, targetEdge.getDirection()); restrictionVector = targetEdge.getDirection(); findRestrictionPlane(); } } else if (controlled instanceof Surface) { Surface controlledSurface = (Surface)controlled; restrictionVector = controlledSurface.normal(); findRestrictionPlane(); slideMap = new HashMap(); Collection vertices = controlledSurface.getVertices(); Iterator it = vertices.iterator(); boolean bound = false; while (it.hasNext() && !bound) { Vertex vertex = (Vertex)it.next(); slideMap.put(vertex, restrictionVector); Collection edges = vertex.getEdges(); Iterator edgeIt = edges.iterator(); int otherEdges = 0; while (edgeIt.hasNext() && !bound) { Edge edge = (Edge)edgeIt.next(); if (!controlledSurface.getEdges().contains(edge)) { otherEdges++; slideMap.put(vertex, edge.getDirection()); } bound = otherEdges > 1; } } if (bound) { slideMap = new HashMap(); restrictionVector = null; dragPlane = null; log.warn("this surface is bound!"); } } } } } /** * Sets an appropriate dragPlane that aligned with the * restrictionvector and containing a specified point to * make reasonable movements. */ protected void findRestrictionPlane() { Camera camera = Project.getInstance().getCurrentCamera(); double[] centerPoint = camera.getCenter(); double[] cameraPoint = camera.getCamera(); Vertex eyeVector = new Vertex(cameraPoint[0] - centerPoint[0], cameraPoint[1] - centerPoint[1], cameraPoint[2] - centerPoint[2]); Vertex cross = restrictionVector.cross(eyeVector); Vertex planeNormal; if (cross.isZero()) { double[] rollVector = camera.getRoll(); planeNormal = new Vertex(rollVector[0], rollVector[1], rollVector[2]); } else { planeNormal = (restrictionVector.cross(eyeVector)).cross(restrictionVector); } dragPlane = new Plane(planeNormal.getX(), planeNormal.getY(), planeNormal.getZ(), -planeNormal.dot(initial)); } /** * Moves a set of vertices in a controlled way, so that they slide along * vectors specified in the slideMap. * @param vertices The vertices that should be moved. * @param delta the movement. */ protected void move(Collection vertices, Vertex delta) { 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); double slideScale; if (delta == null) { log.info("delta null"); } if (slideDir == null) { log.info("slideDir null"); } if (deltaUnit == null) { log.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()); } } /** * Invoked when a key has been pressed. Lets user control the mode of movement. * After movement in one direction a length can be typed in to adjust the movement * to a specific length. * ESCAPE - cancel movement. * 0-9 - type length in length field. * ENTER - perform move of the specified length. * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { super.keyPressed(e); } } |
From: Michael L. <he...@us...> - 2006-03-27 07:08:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16133/src/net/sourceforge/bprocessor/gl/tool Modified Files: Pencil.java AbstractPencil.java Log Message: Fixes to pencil Index: Pencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Pencil.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Pencil.java 26 Mar 2006 21:40:32 -0000 1.3 --- Pencil.java 27 Mar 2006 07:08:26 -0000 1.4 *************** *** 14,17 **** --- 14,18 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; *************** *** 41,44 **** --- 42,46 ---- edges.add(edge); feedback(edges); + glv.setLength(edge.getLength()); } else { constructors(new LinkedList()); *************** *** 77,85 **** edges.add(edge); insertEdges(edges); ! start = null; ! incident = null; } updateConstructors(); updateFeedback(); } --- 79,95 ---- edges.add(edge); insertEdges(edges); ! ! if (current.type() == Intersection.VERTEX ! || current.type() == Intersection.EDGE_MIDPOINT) { ! start = null; ! incident = null; ! } else { ! start = current; ! incident = null; ! } } updateConstructors(); updateFeedback(); + glv.repaint(); } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AbstractPencil.java 26 Mar 2006 21:40:32 -0000 1.11 --- AbstractPencil.java 27 Mar 2006 07:08:26 -0000 1.12 *************** *** 248,251 **** --- 248,252 ---- } else { List constructors = new LinkedList(); + if (incident != null && current != null) { Edge e1 = new Edge(incident.vertex(), current.vertex()); *************** *** 270,274 **** --- 271,277 ---- constructors(constructors); } + constructors.addAll(xyz(incident.vertex())); } + constructors.addAll(xyz(start.vertex())); constructors(constructors); *************** *** 367,371 **** number = ""; } ! if (e.getKeyCode() == KeyEvent.VK_1) { number += "1"; changed = true; --- 370,376 ---- number = ""; } ! if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { ! cleanUp(); ! } else if (e.getKeyCode() == KeyEvent.VK_1) { number += "1"; changed = true; *************** *** 450,453 **** --- 455,459 ---- feedback(new LinkedList()); number = ""; + glv.repaint(); } } |
From: Michael L. <he...@us...> - 2006-03-26 21:40:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16352/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Changes to pencil Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Project.java 25 Mar 2006 18:08:32 -0000 1.51 --- Project.java 26 Mar 2006 21:40:37 -0000 1.52 *************** *** 774,778 **** * @param info String */ ! public static void info(String info) { log.info(info); } --- 774,778 ---- * @param info String */ ! public static void info(Object info) { log.info(info); } |
From: Michael L. <he...@us...> - 2006-03-26 21:40:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16287/src/net/sourceforge/bprocessor/gl/tool Modified Files: Protractor.java ArcTool.java RectTool.java Pencil.java AbstractPencil.java Log Message: Changes to pencil Index: Protractor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Protractor.java 22 Mar 2006 11:42:44 -0000 1.1 --- Protractor.java 26 Mar 2006 21:40:32 -0000 1.2 *************** *** 14,18 **** import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; --- 14,17 ---- *************** *** 23,33 **** */ public class Protractor extends AbstractPencil { - - /** Current intersection */ - private Intersection current; - - /** Start */ - private Intersection start; - /** angling */ private boolean angling; --- 22,25 ---- Index: Pencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Pencil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Pencil.java 16 Mar 2006 20:01:47 -0000 1.2 --- Pencil.java 26 Mar 2006 21:40:32 -0000 1.3 *************** *** 14,18 **** import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; --- 14,17 ---- *************** *** 22,32 **** */ public class Pencil extends AbstractPencil { - - - /** Start point */ - private Intersection start; - - /** Current point */ - private Intersection current; /** --- 21,24 ---- *************** *** 50,53 **** --- 42,46 ---- feedback(edges); } else { + constructors(new LinkedList()); feedback(new LinkedList()); } *************** *** 62,65 **** --- 55,59 ---- if (current != null) { updateFeedback(); + updateConstructors(); } } *************** *** 69,72 **** --- 63,73 ---- */ protected void pressed(MouseEvent e) { + onVertex(); + } + + /** + * Current vertex is pressed + */ + public void onVertex() { if (start == null) { start = current; *************** *** 77,81 **** --- 78,85 ---- insertEdges(edges); start = null; + incident = null; } + updateConstructors(); + updateFeedback(); } Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RectTool.java 16 Mar 2006 20:01:47 -0000 1.3 --- RectTool.java 26 Mar 2006 21:40:32 -0000 1.4 *************** *** 14,18 **** 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; --- 14,17 ---- *************** *** 22,31 **** */ public class RectTool extends AbstractPencil { - - /** Current intersection */ - private Intersection current; - - /** Start */ - private Intersection start; /** --- 21,24 ---- *************** *** 119,122 **** --- 112,116 ---- insertEdges(createRect(start.vertex(), current.vertex())); start = null; + incident = null; } updateFeedback(); Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AbstractPencil.java 25 Mar 2006 18:10:04 -0000 1.10 --- AbstractPencil.java 26 Mar 2006 21:40:32 -0000 1.11 *************** *** 8,11 **** --- 8,12 ---- import java.awt.Cursor; + import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Collection; *************** *** 18,21 **** --- 19,23 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; *************** *** 33,37 **** /** Feedback elements */ protected Collection elements = new HashSet(); ! /** * Constructor --- 35,55 ---- /** Feedback elements */ protected Collection elements = new HashSet(); ! ! /** Constructor elements */ ! protected Collection constructors = new HashSet(); ! ! /** Current intersection */ ! protected Intersection current; ! ! /** Start */ ! protected Intersection start; ! ! /** Incident */ ! protected Intersection incident; ! ! /** Number */ ! protected String number; ! ! /** * Constructor *************** *** 184,187 **** --- 202,279 ---- showFeedback(); } + + /** + * Show constructors + */ + protected void showConstructors() { + Iterator iter = constructors.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().addTempEdge(current); + } + } + + /** + * Hide constructors + */ + protected void hideConstructors() { + Iterator iter = constructors.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().removeTempEdge(current); + } + } + + /** + * Supply constructors + * @param feed Collection of edges + */ + protected void constructors(Collection feed) { + hideConstructors(); + constructors.clear(); + constructors.addAll(feed); + showConstructors(); + } + + /** + * Update constructors based on origin. + */ + protected void updateConstructors() { + if (start == null) { + if (incident != null) { + constructors(xyz(incident.vertex())); + } else { + constructors(new LinkedList()); + } + } else { + List constructors = new LinkedList(); + if (incident != null && current != null) { + Edge e1 = new Edge(incident.vertex(), current.vertex()); + Edge e2 = new Edge(current.vertex(), start.vertex()); + CoordinateSystem system = CoordinateSystem.create(e1, e2); + if (system != null) { + + Vertex a = system.translate(start.vertex()); + Vertex b = system.translate(current.vertex()); + Vertex p = system.translate(incident.vertex()); + + Vertex u = b.minus(a); + u.scale(1 / u.length()); + Vertex ap = p.minus(a); + double t = u.dot(ap); + u.scale(t); + Vertex q = a.add(u); + q = system.unTranslate(q); + Edge edge = new Edge(incident.vertex(), q); + edge.setConstructor(true); + constructors.add(edge); + constructors(constructors); + } + } + constructors.addAll(xyz(start.vertex())); + constructors(constructors); + number = ""; + } + } /** *************** *** 196,199 **** --- 288,298 ---- case Intersection.VERTEX: target = current; + if (start != null) { + if (intersection.vertex() != start.vertex()) { + incident = intersection; + } + } else { + incident = intersection; + } break; case Intersection.EDGE: *************** *** 205,208 **** --- 304,314 ---- case Intersection.EDGE_MIDPOINT: target = current; + if (start != null) { + if (intersection.vertex() != start.vertex()) { + incident = intersection; + } + } else { + incident = intersection; + } break; case Intersection.EDGE_INTERSECTION: *************** *** 219,222 **** --- 325,453 ---- } } + + /** + * onVertex - current vertex is pressed + */ + public void onVertex() { + + } + /** + * 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); + constructors.add(e1); + constructors.add(e2); + constructors.add(e3); + return constructors; + } + + /** + * Invoked when a key has been pressed. Lets user delete what is selected. + * @param e The KeyEvent + */ + public void keyPressed(KeyEvent e) { + boolean changed = false; + if (number == null) { + number = ""; + } + if (e.getKeyCode() == KeyEvent.VK_1) { + number += "1"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_2) { + number += "2"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_3) { + number += "3"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_4) { + number += "4"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_5) { + number += "5"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_6) { + number += "6"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_7) { + number += "7"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_8) { + number += "8"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_9) { + number += "9"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_0) { + number += "0"; + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { + int length = number.length(); + if (length > 1) { + number = number.substring(0, length - 1); + } else { + number = String.valueOf(0); + } + changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + try { + double d = Double.parseDouble(number); + if (current != null) { + Vertex before = null; + if (start != null) { + before = start.vertex(); + } else if (incident != null) { + before = incident.vertex(); + } + if (before != null) { + Vertex v = current.vertex().minus(before); + if (v.length() > 0.000000001) { + v.scale((d / 1000) / v.length()); + Vertex to = before.add(v); + current = new Intersection(to, Intersection.VERTEX, null); + onVertex(); + number = ""; + } + } + } + } catch (NumberFormatException exp) { + Project.info(exp); + } + } + if (changed) { + try { + double d = Double.parseDouble(number); + glv.setLength(d / 1000); + } catch (NumberFormatException exp) { + Project.info(exp); + } + } + } + + /** + * Clean up + */ + public void cleanUp() { + start = null; + current = null; + incident = null; + constructors(new LinkedList()); + feedback(new LinkedList()); + number = ""; + } } Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ArcTool.java 22 Mar 2006 10:53:23 -0000 1.7 --- ArcTool.java 26 Mar 2006 21:40:32 -0000 1.8 *************** *** 25,35 **** */ public class ArcTool extends AbstractPencil { - - /** Current intersection */ - private Intersection current; - - /** Start */ - private Intersection start; - /** End */ private Intersection end; --- 25,28 ---- |
From: Michael L. <he...@us...> - 2006-03-25 18:10:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9416/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Remove the Mesh Ð has been replaced by Space. The world is a Space with type = Functional and name "Void" Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** View.java 13 Mar 2006 12:06:51 -0000 1.72 --- View.java 25 Mar 2006 18:10:04 -0000 1.73 *************** *** 15,19 **** import net.sourceforge.bprocessor.model.CoordinateSystem; - import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Camera; --- 15,18 ---- *************** *** 894,902 **** } drawConstructionEdges(gld, edges); ! Mesh interior = active.getInterior(); ! if (interior != null) { ! drawGeneralEdges(gld, interior.getEdges()); ! ! } } else { Collection edges = Project.getInstance().getEdges(); --- 893,897 ---- } drawConstructionEdges(gld, edges); ! drawGeneralEdges(gld, active.getEdges()); } else { Collection edges = Project.getInstance().getEdges(); *************** *** 948,955 **** */ public void drawSpaceSurfaces(GLDrawable gld, Space space, int side) { ! Mesh interior = space.getInterior(); ! if (interior != null) { ! drawSurfaces(gld, interior.getSurfaces(), side); ! } } --- 943,947 ---- */ public void drawSpaceSurfaces(GLDrawable gld, Space space, int side) { ! drawSurfaces(gld, space.getSurfaces(), side); } *************** *** 964,971 **** while (iter.hasNext()) { Space current = (Space) iter.next(); ! Mesh interior = current.getInterior(); ! if (interior != null) { ! drawSurfaces(gld, interior.getSurfaces(), side); ! } } } --- 956,960 ---- while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSurfaces(gld, current.getSurfaces(), side); } } *************** *** 1373,1383 **** } } ! if (space.getInterior() != null) { ! Collection surfs = space.getInterior().getSurfaces(); ! Iterator surfsIt = surfs.iterator(); ! while (surfsIt.hasNext()) { ! Surface current = (Surface) surfsIt.next(); ! es.addAll(current.getEdges()); ! } } Iterator it = es.iterator(); --- 1362,1370 ---- } } ! Collection surfs = space.getSurfaces(); ! Iterator surfsIt = surfs.iterator(); ! while (surfsIt.hasNext()) { ! Surface current = (Surface) surfsIt.next(); ! es.addAll(current.getEdges()); } Iterator it = es.iterator(); *************** *** 1415,1422 **** if (space != null) { Set ss = new HashSet(); ! if (space.getInterior() != null) { ! Collection surfs = space.getInterior().getSurfaces(); ! ss.addAll(surfs); ! } Iterator it = ss.iterator(); while (it.hasNext()) { --- 1402,1407 ---- if (space != null) { Set ss = new HashSet(); ! Collection surfs = space.getSurfaces(); ! ss.addAll(surfs); Iterator it = ss.iterator(); while (it.hasNext()) { *************** *** 1618,1622 **** return false; } ! if (front.getInterior() != null || back.getInterior() != null) { return false; } --- 1603,1607 ---- return false; } ! if (!front.getSurfaces().isEmpty() || !back.getSurfaces().isEmpty()) { return false; } *************** *** 1673,1695 **** } - /** - * Draw the spaces by running the modellor - * @param gld The GLDrawable - */ - private void drawSpaces(GLDrawable gld) { - Collection spaces = Project.getInstance().getSpaces(); - - Iterator spaceIter = spaces.iterator(); - while (spaceIter.hasNext()) { - Space space = (Space) spaceIter.next(); - Mesh interior = space.getInterior(); - if (interior != null) { - gl.glColor3fv(CONSTRUCTOR_COLOR); - drawSurfaces(gld, interior.getSurfaces(), BOTH); - drawEdges(gld, interior.getEdges()); - } - } - } - /** * Getter for activeEdge --- 1658,1661 ---- |
From: Michael L. <he...@us...> - 2006-03-25 18:10:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9416/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Remove the Mesh Ð has been replaced by Space. The world is a Space with type = Functional and name "Void" Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AbstractPencil.java 21 Mar 2006 12:24:49 -0000 1.9 --- AbstractPencil.java 25 Mar 2006 18:10:04 -0000 1.10 *************** *** 20,26 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; - import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; --- 20,26 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 47,55 **** * @return The mesh */ ! public Mesh mesh() { if (Project.getInstance().getActiveSpace() != null) { ! return Project.getInstance().getActiveSpace().getInterior(); } else { ! return Project.getInstance().mesh(); } } --- 47,55 ---- * @return The mesh */ ! public Space mesh() { if (Project.getInstance().getActiveSpace() != null) { ! return Project.getInstance().getActiveSpace(); } else { ! return Project.getInstance().world(); } } |
From: Michael L. <he...@us...> - 2006-03-25 18:10:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8351/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Geometry.java Space.java LayerModellor.java Geometric.java Project.java Removed Files: Mesh.java Log Message: Remove the Mesh Ð has been replaced by Space. The world is a Space with type = Functional and name "Void" Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Vertex.java 17 Mar 2006 18:59:24 -0000 1.30 --- Vertex.java 25 Mar 2006 18:08:32 -0000 1.31 *************** *** 131,138 **** public Set getEdges() { Set result = new HashSet(); ! if (getMesh() == null) { return result; } ! Collection edges = getMesh().getEdges(); Iterator iter = edges.iterator(); while (iter.hasNext()) { --- 131,138 ---- public Set getEdges() { Set result = new HashSet(); ! if (getOwner() == null) { return result; } ! Collection edges = getOwner().getEdges(); Iterator iter = edges.iterator(); while (iter.hasNext()) { Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Surface.java 20 Mar 2006 13:48:58 -0000 1.84 --- Surface.java 25 Mar 2006 18:08:32 -0000 1.85 *************** *** 177,182 **** */ public void delete() { ! if (getMesh() != null) { ! getMesh().delete(this); } } --- 177,182 ---- */ public void delete() { ! if (getOwner() != null) { ! getOwner().delete(this); } } *************** *** 316,320 **** * @return The copy */ ! public Surface copy(Mesh mesh) { Surface surface = new Surface(); --- 316,320 ---- * @return The copy */ ! public Surface copy(Space mesh) { Surface surface = new Surface(); *************** *** 415,419 **** vmap[i] = v[i].copy(); v2dir.put(v[i], new Direction(vmap[i], normal)); ! getMesh().add(vmap[i]); } } --- 415,419 ---- vmap[i] = v[i].copy(); v2dir.put(v[i], new Direction(vmap[i], normal)); ! getOwner().add(vmap[i]); } } *************** *** 425,429 **** topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); e2e.put(e[i], topmap[i]); ! getMesh().add(topmap[i]); } } --- 425,429 ---- topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); e2e.put(e[i], topmap[i]); ! getOwner().add(topmap[i]); } } *************** *** 435,439 **** sidemap[i] = new Edge(v[i], vmap[i]); v2e.put(v[i], sidemap[i]); ! getMesh().add(sidemap[i]); } } --- 435,439 ---- sidemap[i] = new Edge(v[i], vmap[i]); v2e.put(v[i], sidemap[i]); ! getOwner().add(sidemap[i]); } } *************** *** 454,458 **** facemap[i] = new Surface(newEdges); e2s.put(b, facemap[i]); ! getMesh().add(facemap[i]); } sides.add(facemap[i]); --- 454,458 ---- facemap[i] = new Surface(newEdges); e2s.put(b, facemap[i]); ! getOwner().add(facemap[i]); } sides.add(facemap[i]); *************** *** 465,469 **** } top = new Surface(newEdges); ! getMesh().add(top); } --- 465,469 ---- } top = new Surface(newEdges); ! getOwner().add(top); } *************** *** 943,947 **** // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getMesh() == Project.getInstance().mesh()) { res.add(new Attribute("Front Material", getId())); } --- 943,947 ---- // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getOwner() == Project.getInstance().world()) { res.add(new Attribute("Front Material", getId())); } *************** *** 954,958 **** // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getMesh() == Project.getInstance().mesh()) { res.add(new Attribute("Back Material", getId())); } --- 954,958 ---- // FIXME The material attribute should be ... a material! // The id does not work if this is not a toplevel surface. ! if (getOwner() == Project.getInstance().world()) { res.add(new Attribute("Back Material", getId())); } --- Mesh.java DELETED --- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Project.java 23 Mar 2006 10:43:49 -0000 1.50 --- Project.java 25 Mar 2006 18:08:32 -0000 1.51 *************** *** 40,44 **** /** The Mesh */ ! private Mesh mesh; /** The spaces */ --- 40,44 ---- /** The Mesh */ ! private Space world; /** The spaces */ *************** *** 101,105 **** addCams(); observers = new LinkedList(); ! mesh = new Mesh(); constraints = new LinkedList(); } --- 101,105 ---- addCams(); observers = new LinkedList(); ! world = new Space("Void", Space.FUNCTIONAL); constraints = new LinkedList(); } *************** *** 109,114 **** * @return The mesh */ ! public Mesh mesh() { ! return mesh; } --- 109,114 ---- * @return The mesh */ ! public Space world() { ! return world; } *************** *** 147,151 **** public void clear() { spaces.clear(); ! mesh.clear(); this.setActiveSpace(null); changed(this); --- 147,151 ---- public void clear() { spaces.clear(); ! world.clear(); this.setActiveSpace(null); changed(this); *************** *** 181,189 **** Object next = iter.next(); if (next instanceof Edge) { ! mesh.delete((Edge)next); } else if (next instanceof Surface) { ! mesh.delete((Surface)next); } else if (next instanceof Vertex) { ! mesh.delete((Vertex)next); } } --- 181,189 ---- Object next = iter.next(); if (next instanceof Edge) { ! world.delete((Edge)next); } else if (next instanceof Surface) { ! world.delete((Surface)next); } else if (next instanceof Vertex) { ! world.delete((Vertex)next); } } *************** *** 335,339 **** */ public void add(Edge edge) { ! mesh.add(edge); changed(this); } --- 335,339 ---- */ public void add(Edge edge) { ! world.add(edge); changed(this); } *************** *** 344,348 **** */ public void delete(Edge edge) { ! mesh.delete(edge); changed(this); } --- 344,348 ---- */ public void delete(Edge edge) { ! world.delete(edge); changed(this); } *************** *** 354,358 **** */ public void remove(Edge edge) { ! mesh.delete(edge); changed(this); } --- 354,358 ---- */ public void remove(Edge edge) { ! world.delete(edge); changed(this); } *************** *** 363,367 **** */ public Collection getEdges() { ! return mesh.getEdges(); } --- 363,367 ---- */ public Collection getEdges() { ! return world.getEdges(); } *************** *** 421,425 **** */ public void add(Surface surface) { ! mesh.add(surface); changed(this); } --- 421,425 ---- */ public void add(Surface surface) { ! world.add(surface); changed(this); } *************** *** 430,434 **** */ public void remove(Surface surface) { ! mesh.remove(surface); changed(this); } --- 430,434 ---- */ public void remove(Surface surface) { ! world.remove(surface); changed(this); } *************** *** 439,443 **** */ public void delete(Surface surface) { ! mesh.delete(surface); changed(this); } --- 439,443 ---- */ public void delete(Surface surface) { ! world.delete(surface); changed(this); } *************** *** 448,452 **** */ public Collection getSurfaces() { ! return mesh.getSurfaces(); } --- 448,452 ---- */ public Collection getSurfaces() { ! return world.getSurfaces(); } *************** *** 457,461 **** */ public Surface findSurfaceById(long id) { ! return (Surface)mesh.getSurface(id); } --- 457,461 ---- */ public Surface findSurfaceById(long id) { ! return (Surface)world.getSurface(id); } *************** *** 466,470 **** */ public void add(Vertex vertex) { ! mesh.add(vertex); changed(this); } --- 466,470 ---- */ public void add(Vertex vertex) { ! world.add(vertex); changed(this); } *************** *** 475,479 **** */ public void remove(Vertex vertex) { ! mesh.remove(vertex); changed(this); } --- 475,479 ---- */ public void remove(Vertex vertex) { ! world.remove(vertex); changed(this); } *************** *** 484,488 **** */ public void delete(Vertex vertex) { ! mesh.delete(vertex); changed(this); } --- 484,488 ---- */ public void delete(Vertex vertex) { ! world.delete(vertex); changed(this); } *************** *** 493,497 **** */ public Collection getVertices() { ! return mesh.getVertices(); } --- 493,497 ---- */ public Collection getVertices() { ! return world.getVertices(); } *************** *** 542,546 **** */ public Set findByLocation(double x, double y, double z, double delta) { ! return mesh.findByLocation(x, y, z, delta); } --- 542,546 ---- */ public Set findByLocation(double x, double y, double z, double delta) { ! return world.findByLocation(x, y, z, delta); } *************** *** 551,573 **** */ public Set findEdge(Vertex vertex) { ! return mesh.findEdge(vertex); ! } ! ! /** ! * Make a set of objects in values of the specified clarse ! * @param values The values to filter ! * @param clarse The class ! * @return The set ! */ ! private Set filter(Collection values, Class clarse) { ! HashSet result = new HashSet(); ! Iterator iter = values.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (current.getClass() == clarse) { ! result.add(current); ! } ! } ! return result; } --- 551,555 ---- */ public Set findEdge(Vertex vertex) { ! return world.findEdge(vertex); } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Space.java 23 Mar 2006 10:43:49 -0000 1.22 --- Space.java 25 Mar 2006 18:08:32 -0000 1.23 *************** *** 8,11 **** --- 8,14 ---- import java.util.ArrayList; + import java.util.Collection; + import java.util.Collections; + import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; *************** *** 41,52 **** /** The Discription */ private Description description; - /** The attributes - private Set attributes; */ /** The envelope (a set of surfaces) */ private Set envelope; /** The elements (a list of spaces) */ private List elements; ! /** The interior mesh */ ! private Mesh interior; /** The modellor */ private Modellor modellor; --- 44,68 ---- /** The Discription */ private Description description; /** The envelope (a set of surfaces) */ private Set envelope; /** The elements (a list of spaces) */ private List elements; ! /** The vertices */ ! private HashMap vertices; ! ! /** The next vertex id */ ! private long nextVertexId; ! ! /** The edges */ ! private HashMap edges; ! ! /** The next edge id */ ! private long nextEdgeId; ! ! /** The surfaces */ ! private HashMap surfaces; ! ! /** The next surface id */ ! private long nextSurfaceId; /** The modellor */ private Modellor modellor; *************** *** 71,74 **** --- 87,93 ---- setType(type); description = new Description(""); + vertices = new HashMap(); + edges = new HashMap(); + surfaces = new HashMap(); } *************** *** 142,159 **** } /** ! * Get the interior mesh ! * @return The interior mesh */ ! public Mesh getInterior() { ! return interior; } /** ! * Set the interior mesh ! * @param mesh The mesh */ ! public void setInterior(Mesh mesh) { ! interior = mesh; } --- 161,532 ---- } + /** ! * Clear this space */ ! public void clear() { ! vertices.clear(); ! nextVertexId = 0; ! edges.clear(); ! nextEdgeId = 0; ! surfaces.clear(); ! nextSurfaceId = 0; } /** ! * Add a vertex ! * @param vertex The vertex */ ! public void add(Vertex vertex) { ! Long id = new Long(nextVertexId++); ! vertex.setId(id); ! vertices.put(id, vertex); ! vertex.setOwner(this); ! } ! ! /** ! * Remove a vertex ! * @param vertex The vertex ! */ ! public void remove(Vertex vertex) { ! vertices.remove(vertex.getId()); ! vertex.setId(null); ! vertex.setOwner(null); ! } ! ! /** ! * Insert a vertex ! * @param vertex The vertex ! * @return The vertex ! */ ! public Vertex insert(Vertex vertex) { ! add(vertex); ! return vertex; ! } ! ! /** ! * Delete a vertex ! * @param vertex The vertex ! */ ! public void delete(Vertex vertex) { ! if (vertex.getId() != null) { ! Set edges = vertex.getEdges(); ! remove(vertex); ! Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! delete(current); ! } ! } ! } ! ! /** ! * Return the vertices ! * @return The vertices ! */ ! public Collection getVertices() { ! return vertices.values(); ! } ! ! /** ! * Return the vertex ! * @param id The id ! * @return The vertex ! */ ! public Vertex getVertex(long id) { ! return (Vertex) vertices.get(new Long(id)); ! } ! ! /** ! * Add a edge ! * @param edge The edge ! */ ! public void add(Edge edge) { ! Long id = new Long(nextEdgeId++); ! edge.setId(id); ! edges.put(id, edge); ! edge.setOwner(this); ! } ! ! /** ! * Remove a edge ! * @param edge The edge ! */ ! public void remove(Edge edge) { ! edges.remove(edge.getId()); ! edge.setId(null); ! edge.setOwner(null); ! } ! ! /** ! * Insert a edge ! * @param edge The edge ! * @return The edge ! */ ! public Edge insert(Edge edge) { ! add(edge); ! return edge; ! } ! ! /** ! * Delete a edge ! * @param edge The edge ! */ ! public void delete(Edge edge) { ! if (edge.getId() != null) { ! Set surfaces = edge.getSurfaces(); ! ! Vertex to = edge.getTo(); ! Vertex from = edge.getFrom(); ! ! remove(edge); ! ! { ! // Find adjacent surfaces that must be combined to one surface. ! // ! // First the adjacent surfaces are partioned into groups of ! // coplanar surfaces. ! // If there is only one group consisting of two coplanar surfaces ! // these two surfaces are combined. ! ! List partions = new LinkedList(); ! List work = new LinkedList(surfaces); ! while (!work.isEmpty()) { ! Iterator iter = work.iterator(); ! Surface first = (Surface) iter.next(); ! iter.remove(); ! Plane plane = first.plane(); ! List partion = new LinkedList(); ! partion.add(first); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! if (plane.contains(current)) { ! partion.add(current); ! iter.remove(); ! } ! } ! partions.add(partion); ! } ! int count = 0; ! List partion = null; ! { ! Iterator iter = partions.iterator(); ! while (iter.hasNext()) { ! List current = (List) iter.next(); ! if (current.size() == 2) { ! count++; ! partion = current; ! } ! } ! } ! if (count == 1) { ! Surface s1 = (Surface) partion.get(0); ! Surface s2 = (Surface) partion.get(1); ! List edges1 = new LinkedList(); ! List edges2 = new LinkedList(); ! { ! boolean gab = false; ! List prefix = new LinkedList(); ! Iterator iter = s1.getEdges().iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (!s2.contains(current)) { ! if (!gab) { ! prefix.add(current); ! } else { ! edges1.add(current); ! } ! } else { ! gab = true; ! } ! } ! edges1.addAll(prefix); ! } ! { ! boolean gab = false; ! List prefix = new LinkedList(); ! Iterator iter = s2.getEdges().iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (!s1.contains(current)) { ! if (!gab) { ! prefix.add(current); ! } else { ! edges2.add(current); ! } ! } else { ! gab = true; ! } ! } ! edges2.addAll(prefix); ! } ! if (Edge.first(edges1) == Edge.first(edges2)) { ! Collections.reverse(edges2); ! } ! edges1.addAll(edges2); ! Surface surface = new Surface(edges1); ! add(surface); ! if (s1.getExterior() != null) { ! s1.getExterior().addHole(surface); ! // FIXME: Assign spaces ! } ! } ! } ! ! ! Iterator it = surfaces.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! remove(surface); ! } ! if (to.getOwner() != null) { ! if (to.getEdges().size() == 0) { ! remove(to); ! } ! } ! if (from.getOwner() != null) { ! if (from.getEdges().size() == 0) { ! remove(from); ! } ! } ! } ! } ! ! /** ! * Return the edges ! * @return The edges ! */ ! public Collection getEdges() { ! return edges.values(); ! } ! ! /** ! * Return the edge ! * @param id The id ! * @return The edge ! */ ! public Edge getEdge(long id) { ! return (Edge) edges.get(new Long(id)); ! } ! ! /** ! * Add a surface ! * @param surface The surface ! */ ! public void add(Surface surface) { ! Long id = new Long(nextSurfaceId++); ! surface.setId(id); ! surfaces.put(id, surface); ! surface.setOwner(this); ! } ! ! /** ! * Remove a surface ! * @param surface The surface ! */ ! public void remove(Surface surface) { ! if (surface.getExterior() != null) { ! Surface exterior = surface.getExterior(); ! exterior.removeHole(surface); ! } ! Space back = surface.getBackDomain(); ! if (back != null) { ! back.removeSurface(surface); ! surface.setBackDomain(null); ! } ! Space front = surface.getFrontDomain(); ! if (front != null) { ! front.removeSurface(surface); ! surface.setFrontDomain(null); ! } ! surfaces.remove(surface.getId()); ! surface.setId(null); ! surface.setOwner(null); ! } ! ! /** ! * Insert a surface ! * @param surface The surface ! * @return The surface ! */ ! public Surface insert(Surface surface) { ! add(surface); ! return surface; ! } ! ! /** ! * Delete a surface ! * @param surface The surface ! */ ! public void delete(Surface surface) { ! remove(surface); ! List edges = surface.getEdges(); ! Iterator it = edges.iterator(); ! while (it.hasNext()) { ! Edge edge = (Edge)it.next(); ! if (edge.getSurfaces().size() < 1) { ! delete(edge); ! } ! } ! ! } ! ! /** ! * Return the surfaces ! * @return The surfaces ! */ ! public Collection getSurfaces() { ! return surfaces.values(); ! } ! ! /** ! * Return the surface ! * @param id The id ! * @return The surface ! */ ! public Surface getSurface(long id) { ! return (Surface) surfaces.get(new Long(id)); ! } ! ! /** ! * Find vertex based upon location and delta ! * @param x The x coordinate ! * @param y The y coordinate ! * @param z The z coordinate ! * @param delta The delta value ! * @return The vertexs ! */ ! public Set findByLocation(double x, double y, double z, double delta) { ! Set result = new HashSet(); ! Collection vertices = getVertices(); ! Iterator iter = vertices.iterator(); ! double limit = delta; ! Vertex tester = new Vertex(x, y, z); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! double distance = current.distance(tester); ! if (distance <= limit) { ! result.add(current); ! } ! } ! return result; ! } ! ! /** ! * Find set of edges that coincides with the vertex ! * @param vertex The vertex ! * @return The set of edges ! */ ! public Set findEdge(Vertex vertex) { ! Set result = new HashSet(); ! Collection edges = getEdges(); ! Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (current.coincides(vertex)) { ! result.add(current); ! } ! } ! return result; } Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Geometry.java 23 Mar 2006 11:49:55 -0000 1.16 --- Geometry.java 25 Mar 2006 18:08:32 -0000 1.17 *************** *** 257,261 **** System.out.println("find-surfaces"); List surfaces = new LinkedList(); ! Mesh mesh = ((Edge) edges.iterator().next()).getMesh(); { --- 257,261 ---- System.out.println("find-surfaces"); List surfaces = new LinkedList(); ! Space mesh = ((Edge) edges.iterator().next()).getOwner(); { *************** *** 618,622 **** */ public static void holeAnalysis(Surface surface) { ! Collection surfaces = surface.getMesh().getSurfaces(); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { --- 618,622 ---- */ public static void holeAnalysis(Surface surface) { ! Collection surfaces = surface.getOwner().getSurfaces(); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Geometric.java 17 Mar 2006 18:59:24 -0000 1.3 --- Geometric.java 25 Mar 2006 18:08:32 -0000 1.4 *************** *** 14,18 **** public abstract class Geometric extends Entity { /** The mesh containing this geometric entity */ ! private Mesh mesh; /** --- 14,18 ---- public abstract class Geometric extends Entity { /** The mesh containing this geometric entity */ ! private Space owner; /** *************** *** 20,25 **** * @return The mesh */ ! public Mesh getMesh() { ! return mesh; } --- 20,25 ---- * @return The mesh */ ! public Space getOwner() { ! return owner; } *************** *** 28,33 **** * @param mesh The mesh */ ! public void setMesh(Mesh mesh) { ! this.mesh = mesh; } --- 28,33 ---- * @param mesh The mesh */ ! public void setOwner(Space mesh) { ! this.owner = mesh; } *************** *** 38,42 **** public String getName() { String name; ! if (getMesh() == Project.getInstance().mesh()) { name = ""; } else { --- 38,42 ---- public String getName() { String name; ! if (getOwner() == Project.getInstance().world()) { name = ""; } else { Index: LayerModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/LayerModellor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LayerModellor.java 17 Mar 2006 09:30:34 -0000 1.6 --- LayerModellor.java 25 Mar 2006 18:08:32 -0000 1.7 *************** *** 45,51 **** */ public void update(Object entity) { - Mesh interior = new Mesh(); ! Surface bottom = surface.copy(interior); if (surface.getBackDomain() == space) { bottom.flip(); --- 45,50 ---- */ public void update(Object entity) { ! Surface bottom = surface.copy(space); if (surface.getBackDomain() == space) { bottom.flip(); *************** *** 57,62 **** bottom.flip(); } - - space.setInterior(interior); } --- 56,59 ---- Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Edge.java 21 Mar 2006 22:33:28 -0000 1.41 --- Edge.java 25 Mar 2006 18:08:32 -0000 1.42 *************** *** 142,146 **** */ public void delete() { ! getMesh().delete(this); } --- 142,146 ---- */ public void delete() { ! getOwner().delete(this); } *************** *** 281,287 **** Vertex to = getTo(); Edge e1 = new Edge(from, vertex); ! getMesh().add(e1); Edge e2 = new Edge(vertex, to); ! getMesh().add(e2); --- 281,287 ---- Vertex to = getTo(); Edge e1 = new Edge(from, vertex); ! getOwner().add(e1); Edge e2 = new Edge(vertex, to); ! getOwner().add(e2); *************** *** 292,296 **** current.replace(this, e1, e2); } ! getMesh().remove(this); } } --- 292,296 ---- current.replace(this, e1, e2); } ! getOwner().remove(this); } } *************** *** 310,314 **** public Set getSurfaces() { Set result = new HashSet(); ! Collection surfaces = getMesh().getSurfaces(); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { --- 310,314 ---- public Set getSurfaces() { Set result = new HashSet(); ! Collection surfaces = getOwner().getSurfaces(); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { |
From: Michael L. <he...@us...> - 2006-03-25 18:09:50
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9090/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Remove the Mesh Ð has been replaced by Space. The world is a Space with type = Functional and name "Void" Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** GenericTreeView.java 17 Mar 2006 09:55:24 -0000 1.19 --- GenericTreeView.java 25 Mar 2006 18:09:33 -0000 1.20 *************** *** 34,38 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; - import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Modellor; import net.sourceforge.bprocessor.model.Observer; --- 34,37 ---- *************** *** 544,550 **** offsetItem.addActionListener(new MenuAction() { public void actionPerformed(ActionEvent event) { - if (space.getInterior() == null) { - space.setInterior(new Mesh()); - } Project.getInstance().setActiveSpace(space); } --- 543,546 ---- |
From: Michael L. <he...@us...> - 2006-03-25 16:55:38
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31954/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: Minor changes to persistensemanager Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PersistenceManager.java 23 Mar 2006 10:43:49 -0000 1.28 --- PersistenceManager.java 25 Mar 2006 16:55:15 -0000 1.29 *************** *** 90,95 **** // Create all references ! loadRefConstructionSpace(bp.getConstructionspace()); ! loadRefFunctionalSpace(bp.getFunctionalspace()); loadRefSurface(bp.getSurface()); loadRefEdge(bp.getEdge()); --- 90,95 ---- // Create all references ! loadRefSpace(bp.getConstructionspace()); ! loadRefSpace(bp.getFunctionalspace()); loadRefSurface(bp.getSurface()); loadRefEdge(bp.getEdge()); *************** *** 116,123 **** Iterator it = l.iterator(); while (it.hasNext()) { ! Constructionspace cs = (Constructionspace)it.next(); Space csm = Space.createConstructionSpace(cs.getName()); ! csm.setDescription(cs.getDescription()); Project.getInstance().add(csm); --- 116,123 ---- Iterator it = l.iterator(); while (it.hasNext()) { ! DomainType cs = (DomainType)it.next(); Space csm = Space.createConstructionSpace(cs.getName()); ! Project.getInstance().add(csm); *************** *** 134,144 **** Iterator it = l.iterator(); while (it.hasNext()) { ! Functionalspace fs = (Functionalspace)it.next(); ! Space fsm = Space.createFunctionalSpace(fs.getName()); - fsm.setDescription(fs.getDescription()); - Project.getInstance().add(fsm); - mapper.put(new Long(fs.getId()), fsm); } --- 134,140 ---- Iterator it = l.iterator(); while (it.hasNext()) { ! DomainType fs = (DomainType)it.next(); Space fsm = Space.createFunctionalSpace(fs.getName()); Project.getInstance().add(fsm); mapper.put(new Long(fs.getId()), fsm); } *************** *** 152,167 **** Iterator it = l.iterator(); while (it.hasNext()) { ! net.sourceforge.bprocessor.model.xml.Surface s = ! (net.sourceforge.bprocessor.model.xml.Surface)it.next(); ! net.sourceforge.bprocessor.model.Surface sm = new net.sourceforge.bprocessor.model.Surface(); - sm.setConstructor(s.isConstructor()); - - //sm.setIsInner(s.isIsinner()); - Project.getInstance().add(sm); - mapper.put(new Long(s.getId()), sm); } --- 148,156 ---- Iterator it = l.iterator(); while (it.hasNext()) { ! SurfaceType s = (SurfaceType)it.next(); net.sourceforge.bprocessor.model.Surface sm = new net.sourceforge.bprocessor.model.Surface(); sm.setConstructor(s.isConstructor()); Project.getInstance().add(sm); mapper.put(new Long(s.getId()), sm); } *************** *** 212,265 **** } /** ! * Create the references ! * @param l The list */ ! private static void loadRefConstructionSpace(List l) { ! Iterator it = l.iterator(); ! while (it.hasNext()) { ! Constructionspace cs = (Constructionspace)it.next(); ! ! Space csm = (Space) mapper.get(new Long(cs.getId())); ! ! List ss = cs.getSurfaceref(); ! if (ss != null && ss.size() > 0) { ! Set sr = new HashSet(); ! Iterator iss = ss.iterator(); ! while (iss.hasNext()) { ! net.sourceforge.bprocessor.model.Surface s = ! (net.sourceforge.bprocessor.model.Surface) mapper.get((Long)iss.next()); ! sr.add(s); ! } ! csm.setEnvelope(sr); } } } ! /** * Create the references * @param l The list */ ! private static void loadRefFunctionalSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { ! Functionalspace fs = (Functionalspace)it.next(); ! ! Space fsm = (Space) mapper.get(new Long(fs.getId())); ! ! List ss = fs.getSurfaceref(); ! if (ss != null && ss.size() > 0) { ! Set sr = new HashSet(); ! Iterator iss = ss.iterator(); ! while (iss.hasNext()) { ! net.sourceforge.bprocessor.model.Surface s = ! (net.sourceforge.bprocessor.model.Surface) mapper.get((Long)iss.next()); ! sr.add(s); ! } ! fsm.setEnvelope(sr); ! } } } ! /** * Create the references --- 201,246 ---- } + /** ! * Convert xml surface-list into a surface set ! * @param ss Surface-list ! * @return Surface-set */ ! private static Set loadSurfaceSet(List ss) { ! Set sr = new HashSet(); ! if (ss != null && ss.size() > 0) { ! Iterator iss = ss.iterator(); ! while (iss.hasNext()) { ! net.sourceforge.bprocessor.model.Surface s = ! (net.sourceforge.bprocessor.model.Surface) mapper.get((Long)iss.next()); ! sr.add(s); } } + return sr; } ! ! /** ! * Load content ! * @param domain The data ! * @param space The result ! */ ! private static void loadDomainContent(DomainType domain, Space space) { ! space.setDescription(domain.getDescription()); ! space.setEnvelope(loadSurfaceSet(domain.getSurfaceref())); ! } ! /** * Create the references * @param l The list */ ! private static void loadRefSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { ! DomainType domain = (DomainType)it.next(); ! Space space = (Space) mapper.get(new Long(domain.getId())); ! loadDomainContent(domain, space); } } ! /** * Create the references *************** *** 397,401 **** saveRefSurface(bp, project.getSurfaces()); saveRefVertex(bp, project.getVertices()); - return bp; } --- 378,381 ---- |
From: Michael L. <he...@us...> - 2006-03-23 12:24:19
|
Update of /cvsroot/bprocessor/model/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26705/src Modified Files: build.xml Log Message: Simplified building Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/src/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 18 Oct 2005 08:17:07 -0000 1.4 --- build.xml 23 Mar 2006 12:24:03 -0000 1.5 *************** *** 6,18 **** </fileset> <pathelement location="."/> ! <pathelement location="${build.code.dir}"/> </path> <target name="init"> ! <mkdir dir="${build.code.dir}"/> </target> <target name="compile" depends="dep"> ! <javac srcdir="${src.dir}" destdir="${build.code.dir}" deprecation="yes" debug="yes" includes="net/**"> --- 6,18 ---- </fileset> <pathelement location="."/> ! <pathelement location="${build.dir}"/> </path> <target name="init"> ! <mkdir dir="${build.dir}"/> </target> <target name="compile" depends="dep"> ! <javac srcdir="${src.dir}" destdir="${build.dir}" deprecation="yes" debug="yes" includes="net/**"> *************** *** 23,27 **** <target name="dep" depends="init"> <depend srcdir="${src.dir}" ! destdir="${build.code.dir}" cache="${build.dir}/depcache" closure="yes" --- 23,27 ---- <target name="dep" depends="init"> <depend srcdir="${src.dir}" ! destdir="${build.dir}" cache="${build.dir}/depcache" closure="yes" |
From: Michael L. <he...@us...> - 2006-03-23 12:24:18
|
Update of /cvsroot/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26705 Modified Files: .classpath build.xml Log Message: Simplified building Index: .classpath =================================================================== RCS file: /cvsroot/bprocessor/model/.classpath,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** .classpath 24 Jan 2006 13:57:35 -0000 1.6 --- .classpath 23 Mar 2006 12:24:02 -0000 1.7 *************** *** 3,9 **** <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="lib" path="build/code"/> <classpathentry exported="true" kind="lib" path="/tools/log4j/log4j.jar"/> <classpathentry exported="true" kind="lib" path="/tools/jaxb/jaxb.jar"/> <classpathentry kind="output" path="bin"/> </classpath> --- 3,9 ---- <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry exported="true" kind="lib" path="/tools/log4j/log4j.jar"/> <classpathentry exported="true" kind="lib" path="/tools/jaxb/jaxb.jar"/> + <classpathentry kind="lib" path="build"/> <classpathentry kind="output" path="bin"/> </classpath> Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/build.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** build.xml 5 Dec 2005 20:59:44 -0000 1.10 --- build.xml 23 Mar 2006 12:24:02 -0000 1.11 *************** *** 8,13 **** <property name="build.dir" value="${basedir}/build"/> - <property name="build.test.dir" value="${basedir}/build/test"/> - <property name="build.code.dir" value="${basedir}/build/code"/> <property name="src.dir" value="${basedir}/src"/> <property name="conf.dir" value="${src.dir}/etc"/> --- 8,11 ---- *************** *** 16,20 **** <property name="lib.dir" value="${basedir}/lib"/> <property name="dist.dir" value="${basedir}/dist"/> - <property name="test.dir" value="${basedir}/test"/> <property name="test.doc.api.dir" value="${doc.dir}/testapi"/> --- 14,17 ---- *************** *** 48,52 **** <echo message=""/> <mkdir dir="${build.dir}"/> ! <mkdir dir="${build.code.dir}"/> </target> --- 45,49 ---- <echo message=""/> <mkdir dir="${build.dir}"/> ! <mkdir dir="${build.dir}"/> </target> *************** *** 78,86 **** </taskdef> <xjc schema="${conf.dir}/bprocessor.xsd" ! target="${build.code.dir}" package="net.sourceforge.bprocessor.model.xml"> <arg value="-nv"/> </xjc> ! <javac srcdir="${build.code.dir}" destdir="${build.code.dir}" deprecation="yes" debug="yes" includes="net/**"> --- 75,83 ---- </taskdef> <xjc schema="${conf.dir}/bprocessor.xsd" ! target="${build.dir}" package="net.sourceforge.bprocessor.model.xml"> <arg value="-nv"/> </xjc> ! <javac srcdir="${build.dir}" destdir="${build.dir}" deprecation="yes" debug="yes" includes="net/**"> *************** *** 90,94 **** </javac> <delete> ! <fileset dir="${build.code.dir}"> <include name="**/*.java"/> </fileset> --- 87,91 ---- </javac> <delete> ! <fileset dir="${build.dir}"> <include name="**/*.java"/> </fileset> *************** *** 107,112 **** <fileset dir="${src.dir}" includes="**/*.java"/> - <fileset dir="${test.dir}" - includes="**/*.java"/> </checkstyle> </target> --- 104,107 ---- *************** *** 130,134 **** <target name="jar" depends="init"> <mkdir dir="${dist.dir}"/> ! <copy todir="${build.code.dir}"> <fileset dir="${conf.dir}"> <include name="**/*.properties"/> --- 125,129 ---- <target name="jar" depends="init"> <mkdir dir="${dist.dir}"/> ! <copy todir="${build.dir}"> <fileset dir="${conf.dir}"> <include name="**/*.properties"/> *************** *** 136,140 **** </copy> <jar jarfile="${dist.dir}/${name}.jar" ! basedir="${build.code.dir}" compress="true" includes="**/*" --- 131,135 ---- </copy> <jar jarfile="${dist.dir}/${name}.jar" ! basedir="${build.dir}" compress="true" includes="**/*" *************** *** 182,209 **** <ant dir="test" target="doc"/> </target> - - <target name="test" depends="dist"> - <ant dir="test" target="compile"/> - - <junit> - <classpath> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="${dist.dir}"> - <include name="**/*.jar"/> - </fileset> - <pathelement location="${build.test.dir}"/> - </classpath> - - <formatter type="plain"/> - <batchtest fork="yes" todir="${basedir}"> - <fileset dir="${test.dir}"> - <include name="**/*Test*.java"/> - <exclude name="**/AllTests.java"/> - </fileset> - </batchtest> - - </junit> - </target> </project> --- 177,179 ---- |
From: Michael L. <he...@us...> - 2006-03-23 11:49:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10403/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: HoleAnalysis in Pencil Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Geometry.java 17 Mar 2006 09:30:34 -0000 1.15 --- Geometry.java 23 Mar 2006 11:49:55 -0000 1.16 *************** *** 10,13 **** --- 10,14 ---- import java.util.ArrayList; import java.util.Arrays; + import java.util.Collection; import java.util.HashSet; import java.util.Iterator; *************** *** 254,264 **** --- 255,269 ---- private static void findSurfaces(VertexNode vertex, EdgeNode last, List edges, Surface exterior) { int count = 0; + System.out.println("find-surfaces"); List surfaces = new LinkedList(); Mesh mesh = ((Edge) edges.iterator().next()).getMesh(); { + Surface clockwise = clockwiseSurface(vertex, last, edges); if (clockwise != null) { + if (clockwise.angle(vertex.system()) < 0) { mesh.add(clockwise); + holeAnalysis(clockwise); surfaces.add(clockwise); count++; *************** *** 266,274 **** } } ! { Surface counterclockwise = counterclockwiseSurface(vertex, last, edges); if (counterclockwise != null) { if (counterclockwise.angle(vertex.system()) > 0) { mesh.add(counterclockwise); surfaces.add(counterclockwise); count++; --- 271,280 ---- } } ! { Surface counterclockwise = counterclockwiseSurface(vertex, last, edges); if (counterclockwise != null) { if (counterclockwise.angle(vertex.system()) > 0) { mesh.add(counterclockwise); + holeAnalysis(counterclockwise); surfaces.add(counterclockwise); count++; *************** *** 606,608 **** --- 612,633 ---- } + /** + * See if surface has become a hole in a surface in + * the project. + * @param surface The surface + */ + public static void holeAnalysis(Surface surface) { + Collection surfaces = surface.getMesh().getSurfaces(); + Iterator iter = surfaces.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + if (current != surface) { + if (current.surrounds(surface)) { + current.addHole(surface); + } else if (surface.surrounds(current)) { + surface.addHole(current); + } + } + } + } } |
From: Michael L. <he...@us...> - 2006-03-23 11:49:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10374/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: HoleAnalysis in Pencil Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** AbstractTool.java 21 Mar 2006 22:33:36 -0000 1.64 --- AbstractTool.java 23 Mar 2006 11:49:50 -0000 1.65 *************** *** 10,13 **** --- 10,14 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; *************** *** 155,170 **** */ protected void holeAnalysis(Surface surface) { ! Collection surfaces = surface.getMesh().getSurfaces(); ! Iterator iter = surfaces.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! if (current != surface) { ! if (current.surrounds(surface)) { ! current.addHole(surface); ! } else if (surface.surrounds(current)) { ! surface.addHole(current); ! } ! } ! } } --- 156,160 ---- */ protected void holeAnalysis(Surface surface) { ! Geometry.holeAnalysis(surface); } |
From: Michael L. <he...@us...> - 2006-03-23 10:43:58
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11444/src/net/sourceforge/bprocessor/gui/actions Removed Files: CreateElementActionListener.java CreatePartActionListener.java Log Message: Removed ConstructionSpace and FunctionalSpace --- CreatePartActionListener.java DELETED --- --- CreateElementActionListener.java DELETED --- |
From: Michael L. <he...@us...> - 2006-03-23 10:43:57
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11444/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Removed ConstructionSpace and FunctionalSpace Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** GUI.java 21 Mar 2006 21:59:52 -0000 1.31 --- GUI.java 23 Mar 2006 10:43:54 -0000 1.32 *************** *** 9,15 **** import net.sourceforge.bprocessor.gui.actions.CreateConstructionSpaceActionListener; import net.sourceforge.bprocessor.gui.actions.CreateConstructorActionListener; - import net.sourceforge.bprocessor.gui.actions.CreateElementActionListener; import net.sourceforge.bprocessor.gui.actions.CreateFunctionalSpaceActionListener; - import net.sourceforge.bprocessor.gui.actions.CreatePartActionListener; import net.sourceforge.bprocessor.gui.actions.CreateSurfaceActionListener; import net.sourceforge.bprocessor.gui.actions.FileCloseActionListener; --- 9,13 ---- *************** *** 263,267 **** JMenuItem createElement = new JMenuItem("Element"); createElement.setMnemonic(KeyEvent.VK_E); - createElement.addActionListener(new CreateElementActionListener()); createElement.setEnabled(false); create.add(createElement); --- 261,264 ---- *************** *** 269,273 **** JMenuItem createPart = new JMenuItem("Part"); createPart.setMnemonic(KeyEvent.VK_P); - createPart.addActionListener(new CreatePartActionListener()); createPart.setEnabled(false); create.add(createPart); --- 266,269 ---- |
From: Michael L. <he...@us...> - 2006-03-23 10:43:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11413/src/net/sourceforge/bprocessor/model Modified Files: Space.java Project.java Removed Files: ConstructionSpace.java FunctionalSpace.java Log Message: Removed ConstructionSpace and FunctionalSpace Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Space.java 17 Mar 2006 09:30:34 -0000 1.21 --- Space.java 23 Mar 2006 10:43:49 -0000 1.22 *************** *** 28,33 **** /** Default */ private static final long serialVersionUID = 1L; /** The logger */ ! private static Logger log = Logger.getLogger(FunctionalSpace.class); /** The name */ private String name; --- 28,40 ---- /** Default */ private static final long serialVersionUID = 1L; + + /** Construction Type */ + public static final int CONSTRUCTION = 0; + + /** Functional Type */ + public static final int FUNCTIONAL = 1; + /** The logger */ ! private static Logger log = Logger.getLogger(Space.class); /** The name */ private String name; *************** *** 44,47 **** --- 51,56 ---- /** The modellor */ private Modellor modellor; + /** type */ + private int type; *************** *** 55,62 **** * Constructor for space * @param name The name */ ! public Space(String name) { super(); setName(name); description = new Description(""); } --- 64,73 ---- * Constructor for space * @param name The name + * @param type The type */ ! public Space(String name, int type) { super(); setName(name); + setType(type); description = new Description(""); } *************** *** 68,72 **** */ public static Space createConstructionSpace(String name) { ! return new ConstructionSpace(name); } --- 79,83 ---- */ public static Space createConstructionSpace(String name) { ! return new Space(name, Space.CONSTRUCTION); } *************** *** 77,81 **** */ public static Space createFunctionalSpace(String name) { ! return new FunctionalSpace(name); } --- 88,108 ---- */ public static Space createFunctionalSpace(String name) { ! return new Space(name, Space.FUNCTIONAL); ! } ! ! /** ! * Get type ! * @return type ! */ ! public int getType() { ! return type; ! } ! ! /** ! * Set type ! * @param value New type ! */ ! public void setType(int value) { ! type = value; } *************** *** 114,143 **** return description; } - /** - * Get the attributes - * @return The attributes - * @hibernate.set - * cascade="delete" - * lazy="false" - * @hibernate.key - * column="DOMAIN_ID" - * @hibernate.one-to-many - * class="net.sourceforge.bprocessor.model.Attribute" - - public Set getAttributes() { - return attributes; - } */ - - /** - * Set the attributes - * @param attributes The attributes - - public void setAttributes(Set attributes) { - this.attributes = attributes; - } */ - - /** * Get the interior mesh * @return The interior mesh --- 141,146 ---- *************** *** 255,259 **** */ public boolean isConstructionSpace() { ! return false; } --- 258,262 ---- */ public boolean isConstructionSpace() { ! return (type == Space.CONSTRUCTION); } *************** *** 263,267 **** */ public boolean isFunctionalSpace() { ! return false; } --- 266,270 ---- */ public boolean isFunctionalSpace() { ! return (type == Space.FUNCTIONAL); } *************** *** 326,331 **** */ public String getGeneralName() { ! // TODO Auto-generated method stub ! return null; } } --- 329,339 ---- */ public String getGeneralName() { ! if (isConstructionSpace()) { ! return "Construction Space"; ! } ! if (isFunctionalSpace()) { ! return "Functional Space"; ! } ! return "Space"; } } --- FunctionalSpace.java DELETED --- --- ConstructionSpace.java DELETED --- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** Project.java 21 Mar 2006 21:59:59 -0000 1.49 --- Project.java 23 Mar 2006 10:43:49 -0000 1.50 *************** *** 311,315 **** */ public Collection getConstructionSpaces() { ! return filter(spaces.values(), ConstructionSpace.class); } --- 311,323 ---- */ public Collection getConstructionSpaces() { ! Collection result = new HashSet(); ! Iterator iter = spaces.values().iterator(); ! while (iter.hasNext()) { ! Space current = (Space) iter.next(); ! if (current.getType() == Space.CONSTRUCTION) { ! result.add(current); ! } ! } ! return result; } *************** *** 397,401 **** */ public Collection getFunctionalSpaces() { ! return filter(spaces.values(), FunctionalSpace.class); } --- 405,417 ---- */ public Collection getFunctionalSpaces() { ! Collection result = new HashSet(); ! Iterator iter = spaces.values().iterator(); ! while (iter.hasNext()) { ! Space current = (Space) iter.next(); ! if (current.getType() == Space.FUNCTIONAL) { ! result.add(current); ! } ! } ! return result; } |
From: Michael L. <he...@us...> - 2006-03-23 10:43:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11413/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: Removed ConstructionSpace and FunctionalSpace Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** PersistenceManager.java 20 Mar 2006 09:09:31 -0000 1.27 --- PersistenceManager.java 23 Mar 2006 10:43:49 -0000 1.28 *************** *** 7,12 **** package net.sourceforge.bprocessor.model.xml; - import net.sourceforge.bprocessor.model.ConstructionSpace; - import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; --- 7,10 ---- *************** *** 120,124 **** Constructionspace cs = (Constructionspace)it.next(); ! ConstructionSpace csm = new ConstructionSpace(cs.getName()); csm.setDescription(cs.getDescription()); --- 118,122 ---- Constructionspace cs = (Constructionspace)it.next(); ! Space csm = Space.createConstructionSpace(cs.getName()); csm.setDescription(cs.getDescription()); *************** *** 138,142 **** Functionalspace fs = (Functionalspace)it.next(); ! FunctionalSpace fsm = new FunctionalSpace(fs.getName()); fsm.setDescription(fs.getDescription()); --- 136,140 ---- Functionalspace fs = (Functionalspace)it.next(); ! Space fsm = Space.createFunctionalSpace(fs.getName()); fsm.setDescription(fs.getDescription()); *************** *** 426,430 **** Iterator i = css.iterator(); while (i.hasNext()) { ! ConstructionSpace cs = (ConstructionSpace)i.next(); Constructionspace csx = new ConstructionspaceImpl(); --- 424,428 ---- Iterator i = css.iterator(); while (i.hasNext()) { ! Space cs = (Space)i.next(); Constructionspace csx = new ConstructionspaceImpl(); *************** *** 448,452 **** Iterator i = fss.iterator(); while (i.hasNext()) { ! FunctionalSpace fs = (FunctionalSpace)i.next(); Functionalspace fsx = new FunctionalspaceImpl(); --- 446,450 ---- Iterator i = fss.iterator(); while (i.hasNext()) { ! Space fs = (Space)i.next(); Functionalspace fsx = new FunctionalspaceImpl(); *************** *** 541,545 **** Iterator i = css.iterator(); while (i.hasNext()) { ! ConstructionSpace cs = (ConstructionSpace)i.next(); Constructionspace csx = findConstructionSpace(bp, cs); --- 539,543 ---- Iterator i = css.iterator(); while (i.hasNext()) { ! Space cs = (Space)i.next(); Constructionspace csx = findConstructionSpace(bp, cs); *************** *** 563,567 **** * @return The construction space */ ! private static Constructionspace findConstructionSpace(Bprocessor bp, ConstructionSpace cs) { Map m = (Map)mapper.get(KEY_DOMAIN); Long id = (Long)m.get(cs.getId()); --- 561,565 ---- * @return The construction space */ ! private static Constructionspace findConstructionSpace(Bprocessor bp, Space cs) { Map m = (Map)mapper.get(KEY_DOMAIN); Long id = (Long)m.get(cs.getId()); *************** *** 585,589 **** Iterator i = fss.iterator(); while (i.hasNext()) { ! FunctionalSpace fs = (FunctionalSpace)i.next(); Functionalspace fsx = findFunctionalSpace(bp, fs); --- 583,587 ---- Iterator i = fss.iterator(); while (i.hasNext()) { ! Space fs = (Space)i.next(); Functionalspace fsx = findFunctionalSpace(bp, fs); *************** *** 607,611 **** * @return The functional space */ ! private static Functionalspace findFunctionalSpace(Bprocessor bp, FunctionalSpace fs) { Map m = (Map)mapper.get(KEY_DOMAIN); Long id = (Long)m.get(fs.getId()); --- 605,609 ---- * @return The functional space */ ! private static Functionalspace findFunctionalSpace(Bprocessor bp, Space fs) { Map m = (Map)mapper.get(KEY_DOMAIN); Long id = (Long)m.get(fs.getId()); |
From: Michael L. <he...@us...> - 2006-03-23 10:43:48
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11391/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Removed ConstructionSpace and FunctionalSpace Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** GLView.java 11 Feb 2006 18:00:01 -0000 1.35 --- GLView.java 23 Mar 2006 10:43:44 -0000 1.36 *************** *** 26,30 **** import java.awt.Dimension; import java.awt.BorderLayout; - import java.awt.KeyboardFocusManager; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; --- 26,29 ---- *************** *** 71,75 **** glCap.setHardwareAccelerated(true); glc = GLDrawableFactory.getFactory().createGLCanvas(glCap); - KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); JPanel jp = new JPanel(); --- 70,73 ---- |
From: Michael L. <he...@us...> - 2006-03-22 11:42:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2749/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java Added Files: Protractor.java Log Message: Protractor implemented Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ToolFactory.java 16 Mar 2006 20:01:47 -0000 1.38 --- ToolFactory.java 22 Mar 2006 11:42:44 -0000 1.39 *************** *** 94,97 **** --- 94,100 ---- private TapeMeasureTool tapeMeasure; + /** Protractor tool */ + private Protractor protractor; + /** The previous tool */ private Tool previousTool; *************** *** 172,175 **** --- 175,179 ---- clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); + protractor = new Protractor(glv, pencilcursor); camera = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); *************** *** 193,196 **** --- 197,201 ---- tmBut = this.registerTool(Tool.TAPE_MEASURE_TOOL, tapeMeasure, "Bicontapemes.gif", "Tape Measure"); + this.registerTool(Tool.PROTRACTOR_TOOL, protractor, "Biconprotractor.gif", "Protractor"); tb.addSeparator(); --- NEW FILE: Protractor.java --- //--------------------------------------------------------------------------------- // $Id: Protractor.java,v 1.1 2006/03/22 11:42:44 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.LinkedList; import java.util.List; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; /** * Protractor */ public class Protractor extends AbstractPencil { /** Current intersection */ private Intersection current; /** Start */ private Intersection start; /** angling */ private boolean angling; /** * Constructor * @param glv GLView * @param cursor Cursor */ public Protractor(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Create a constructor * @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; } /** * Update feedback * */ protected void updateFeedback() { 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 { feedback(new LinkedList()); } makeTarget(current); } /** * @param e MouseEven */ protected void moved(MouseEvent e) { current = findIntersection(e); if (current != null) { updateFeedback(); } } /** * @param e MouseEven */ protected void pressed(MouseEvent e) { if (start == null) { 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(); } /** * @param e MouseEven */ protected void dragged(MouseEvent e) { } /** * @param e MouseEven */ protected void released(MouseEvent e) { } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Tool.java 15 Mar 2006 10:36:28 -0000 1.20 --- Tool.java 22 Mar 2006 11:42:44 -0000 1.21 *************** *** 46,49 **** --- 46,51 ---- /** The Rect tool */ public static final int RECT_TOOL = 12; + /** The Protractor tool */ + public static final int PROTRACTOR_TOOL = 13; /** |
From: Michael L. <he...@us...> - 2006-03-22 11:42:46
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2749/src/gfx Added Files: Biconprotractor.gif Log Message: Protractor implemented --- NEW FILE: Biconprotractor.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2006-03-22 10:53:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9058/src/net/sourceforge/bprocessor/gl/tool Modified Files: ArcTool.java SelectTool.java Log Message: - Finished ArcTool - Chekpoint after delete Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ArcTool.java 16 Mar 2006 20:01:47 -0000 1.6 --- ArcTool.java 22 Mar 2006 10:53:23 -0000 1.7 *************** *** 49,53 **** edges.add(e2); ! feedback(createArc(start.vertex(), current.vertex(), end.vertex(), true)); } else { Edge edge = new Edge(start.vertex(), current.vertex()); --- 49,53 ---- edges.add(e2); ! feedback(createArc(start.vertex(), current.vertex(), end.vertex(), false)); } else { Edge edge = new Edge(start.vertex(), current.vertex()); *************** *** 92,96 **** v1.setY(x); v1.scale(10 / v1.length()); ! Edge l1 = new Edge(system.unTranslate(m1.minus(v1)), system.unTranslate(m1.add(v1))); Vertex v2 = m.minus(q); --- 92,96 ---- v1.setY(x); v1.scale(10 / v1.length()); ! Edge l1 = new Edge(m1.minus(v1), m1.add(v1)); Vertex v2 = m.minus(q); *************** *** 103,107 **** v2.setY(x); v2.scale(10 / v2.length()); ! Edge l2 = new Edge(system.unTranslate(m2.minus(v2)), system.unTranslate(m2.add(v2))); l1.setConstructor(true); l2.setConstructor(true); --- 103,107 ---- v2.setY(x); v2.scale(10 / v2.length()); ! Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); l1.setConstructor(true); l2.setConstructor(true); *************** *** 110,120 **** if (inter != null) { Vertex center = inter.getFrom(); ! Edge side1 = new Edge(center, start); ! Edge side2 = new Edge(center, end); ! Edge side3 = new Edge(center, mid); ! side1.setConstructor(true); ! side2.setConstructor(true); ! side3.setConstructor(true); if (debug) { edges.add(side1); edges.add(side2); --- 110,153 ---- if (inter != null) { Vertex center = inter.getFrom(); ! double radius = 0; ! double tetra1 = 0; ! double tetra2 = 0; ! ! Vertex u1 = p.minus(center); ! radius = u1.length(); ! u1.scale(1 / radius); ! tetra1 = Math.acos(u1.getX()); ! if (u1.getY() < 0) { ! tetra1 = -tetra1; ! } ! Vertex u2 = q.minus(center); ! u2.scale(1 / radius); ! tetra2 = Math.acos(u2.getX()); ! if (u2.getY() < 0) { ! tetra2 = -tetra2; ! } ! ! { ! int n = 6; ! double angle = tetra1; ! double step = (tetra2 - tetra1) / n; ! Vertex current = p; ! for (int i = 0; i < n; i++) { ! angle += step; ! double xx = radius * Math.cos(angle); ! double yy = radius * Math.sin(angle); ! Vertex next = new Vertex(center.getX() + xx, center.getY() + yy, 0); ! Edge edge = new Edge(system.unTranslate(current), system.unTranslate(next)); ! edges.add(edge); ! current = next; ! } ! } if (debug) { + Edge side1 = new Edge(system.unTranslate(center), start); + 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); *************** *** 123,132 **** } - - edges.add(e1); - edges.add(e2); if (debug) { ! edges.add(l1); ! edges.add(l2); } } --- 156,162 ---- } if (debug) { ! edges.add(system.unTranslate(l1)); ! edges.add(system.unTranslate(l2)); } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** SelectTool.java 12 Mar 2006 12:33:01 -0000 1.56 --- SelectTool.java 22 Mar 2006 10:53:23 -0000 1.57 *************** *** 208,211 **** --- 208,212 ---- Project.getInstance().delete(edges); Project.getInstance().delete(vertices); + Project.getInstance().checkpoint(); } else { super.keyPressed(e); |