bprocessor-commit Mailing List for B-processor (Page 64)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
| 2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
| 2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
| 2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
| 2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
| 2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
| 2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: rimestad <rim...@us...> - 2007-05-18 09:13:25
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26112/src/net/sourceforge/bprocessor/gl/tool Modified Files: OffsetTool.java AbstractPencil.java Log Message: Fixed offsettool, could not offset after pressing esc. we have to remember to call super when overriting methods always... Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** OffsetTool.java 15 Nov 2006 09:53:17 -0000 1.13 --- OffsetTool.java 18 May 2007 09:13:17 -0000 1.14 *************** *** 156,159 **** --- 156,160 ---- * @param e The MouseEvent object */ + @Override protected void moved(MouseEvent e) { current = findIntersection(e); *************** *** 207,213 **** private void endOffset() { Geometry.insertEdges(contour); directionMap = new HashMap(); ! contour = new LinkedList(); ! start = null; lastOffsetPoint = null; surfaceFound = false; --- 208,221 ---- private void endOffset() { Geometry.insertEdges(contour); + cleanUp(); + } + + /** + * {@inheritDoc} + */ + @Override + public void cleanUp() { directionMap = new HashMap(); ! contour.clear(); lastOffsetPoint = null; surfaceFound = false; *************** *** 216,219 **** --- 224,228 ---- edge = null; feedback(contour); + super.cleanUp(); } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** AbstractPencil.java 16 May 2007 07:45:17 -0000 1.79 --- AbstractPencil.java 18 May 2007 09:13:17 -0000 1.80 *************** *** 733,736 **** --- 733,737 ---- /** * Clean up + * REMEMBER TO CALL super.cleanUp() WHEN OVERWRITEING */ public void cleanUp() { |
|
From: Michael L. <he...@us...> - 2007-05-17 08:51:54
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28536/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: Small error Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** NetFacadeModellor.java 16 May 2007 09:01:30 -0000 1.30 --- NetFacadeModellor.java 17 May 2007 08:51:41 -0000 1.31 *************** *** 795,799 **** Edge oldEdge = cut.getEdges().get(k); for (Surface s : oldEdge.getSurfaces()) { ! s.replaceSingle(oldEdge, cutEdges.get(k)); } } --- 795,799 ---- Edge oldEdge = cut.getEdges().get(k); for (Surface s : oldEdge.getSurfaces()) { ! s.replace(oldEdge, cutEdges.get(k)); } } |
|
From: Nordholt <nor...@us...> - 2007-05-16 09:01:38
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14052/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: classification fix Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** NetFacadeModellor.java 16 Apr 2007 15:54:36 -0000 1.29 --- NetFacadeModellor.java 16 May 2007 09:01:30 -0000 1.30 *************** *** 52,55 **** --- 52,58 ---- private static final double FRAME_DEPTH = 0.05; + /** The classification id for exterior */ + public static final String EXTERIOR = "-1.-80"; + /** serial id */ private static final long serialVersionUID = 1L; *************** *** 68,72 **** /** The depth of the facade */ ! private double depth = 0.4; /** The front surface of the facade */ --- 71,75 ---- /** The depth of the facade */ ! private double depth = 0.12; /** The front surface of the facade */ *************** *** 79,82 **** --- 82,88 ---- private static Logger log = Logger.getLogger(NetFacadeModellor.class); + /** Times a facade has been generated */ + private int facades = 0; + /** * Empty constructor for the net facade *************** *** 136,152 **** */ private Surface findFront(Space s) { - Iterator it = s.getEnvelope().iterator(); Surface frontCandidate = null; ! if (it.hasNext()) { ! frontCandidate = (Surface)it.next(); ! } ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! Classification frontClass = surface.getFrontDomain().getClassification(); ! Classification backClass = surface.getBackDomain().getClassification(); ! ! if ((frontClass != null && frontClass.getFullId(null).equalsIgnoreCase("-80")) || ! (backClass != null && backClass.getFullId(null).equalsIgnoreCase("-80"))) { ! frontCandidate = surface; } } --- 142,157 ---- */ private Surface findFront(Space s) { Surface frontCandidate = null; ! if (!s.getEnvelope().isEmpty()) { ! frontCandidate = s.getEnvelope().iterator().next(); ! for (Surface surface : s.getEnvelope()) { ! Classification frontClass = surface.getFrontDomain().getClassification(); ! Classification backClass = surface.getBackDomain().getClassification(); ! if ((frontClass != null && ! frontClass.getFullId(null).equalsIgnoreCase(EXTERIOR)) || ! (backClass != null && ! backClass.getFullId(null).equalsIgnoreCase(EXTERIOR))) { ! frontCandidate = surface; ! } } } *************** *** 172,176 **** update = true; } - if (!space.getEnvelope().contains(front)) { update = false; --- 177,180 ---- *************** *** 194,201 **** space.setModellor(null); } - //space = null; - //net = null; - //frame = null; - //front = null; } --- 198,201 ---- *************** *** 237,244 **** a = attributes.get("Front"); if (a != null) { - Iterator sit = space.getOwner().getSurfaces().iterator(); boolean legalSurface = false; ! while (sit.hasNext()) { ! Surface s = (Surface)sit.next(); if (s.getName().equals(a.getValue()) && front != s) { legalSurface = true; --- 237,242 ---- a = attributes.get("Front"); if (a != null) { boolean legalSurface = false; ! for (Surface s : space.getOwner().getSurfaces()) { if (s.getName().equals(a.getValue()) && front != s) { legalSurface = true; *************** *** 309,315 **** public void setFrameWidth(double frameWidth) { this.frameWidth = frameWidth; ! Iterator it = net.getEdges().iterator(); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); e.setParameters(new ParameterBlock()); } --- 307,311 ---- public void setFrameWidth(double frameWidth) { this.frameWidth = frameWidth; ! for (Edge e : net.getEdges()) { e.setParameters(new ParameterBlock()); } *************** *** 323,335 **** frame.clear(); frame = null; ! } space.clear(); space.add(getNet()); prepareNet(getNet()); if (single) { createSingleFacade(getNet()); } else { createDoubleFacade(getNet()); } } --- 319,342 ---- frame.clear(); frame = null; ! } ! double time = System.nanoTime(); space.clear(); space.add(getNet()); prepareNet(getNet()); if (single) { + log.info("calling create1"); createSingleFacade(getNet()); } else { + log.info("calling create2"); createDoubleFacade(getNet()); } + time = (System.nanoTime() - time) / 1000000; + facades++; + int fields = 0; + if (net != null) { + fields = net.getSurfaces().size(); + } + log.info("Facade no.: " + facades + " with: " + fields + " fields " + + " were generated in: " + time); } *************** *** 339,346 **** */ private void prepareNet(Net n) { ! Collection edges = n.getEdges(); ! Iterator itE = edges.iterator(); ! while (itE.hasNext()) { ! Edge e = (Edge)itE.next(); Map env = e.getParameters().environment(); if (env.get("width") == null) { --- 346,351 ---- */ private void prepareNet(Net n) { ! Collection<Edge> edges = n.getEdges(); ! for (Edge e : edges) { Map env = e.getParameters().environment(); if (env.get("width") == null) { *************** *** 348,354 **** } } ! Iterator itS = n.getSurfaces().iterator(); ! while (itS.hasNext()) { ! Surface s = (Surface)itS.next(); Map env = s.getParameters().environment(); if (env.get("type") == null) { --- 353,357 ---- } } ! for (Surface s : n.getSurfaces()) { Map env = s.getParameters().environment(); if (env.get("type") == null) { *************** *** 384,391 **** space.add(frame); } if (net != null) { ! Iterator fields = net.getSurfaces().iterator(); ! while (fields.hasNext()) { ! Surface field = (Surface)fields.next(); if (field.getEdges().size() > 3) { Map envF = field.getParameters().environment(); --- 387,393 ---- space.add(frame); } + log.info("create"); if (net != null) { ! for (Surface field : net.getSurfaces()) { if (field.getEdges().size() > 3) { Map envF = field.getParameters().environment(); *************** *** 397,416 **** } } ! Surface cut2 = cutType2(); ! cut1.setBackDomain(frame); cut1.setFrontDomain(frame); - cut2.setBackDomain(frame); cut2.setFrontDomain(frame); Vertex out = front.normal(); if (front.getBackDomain() == space) { out.scale(-1); ! } Set<Surface> frame1 = generateFrame(cut1, field.getEdges(), out); ! Set<Surface> frame2 = generateFrame(cut2, field.getEdges(), out); ! ! frame.removeSurface(cut1); ! frame.removeSurface(cut2); frame1.addAll(frame2); ! space.addAll(frame1); Geometry.simplifyGeometry(frame1); } --- 399,422 ---- } } ! Surface cut2 = cutType2(); ! Set<Surface> cuts = new HashSet<Surface>(); ! cut1.setFrontDomain(frame); cut2.setFrontDomain(frame); + cut1.setBackDomain(frame); + cut2.setBackDomain(frame); + + cuts.add(cut1); + cuts.add(cut2); + space.addAll(cuts); Vertex out = front.normal(); if (front.getBackDomain() == space) { out.scale(-1); ! } ! log.info("create"); Set<Surface> frame1 = generateFrame(cut1, field.getEdges(), out); ! Set<Surface> frame2 = generateFrame(cut2, field.getEdges(), out); frame1.addAll(frame2); ! space.addAll(frame1); Geometry.simplifyGeometry(frame1); } *************** *** 432,441 **** } if (net != null) { ! List outline = netOutline(net); ! Iterator it = outline.iterator(); ! List outlineCopies = new LinkedList(); ! while (it.hasNext()) { ! outlineCopies.add(((Edge)it.next()).copy()); ! } if (!outlineCopies.isEmpty()) { /* make the shell of the facade */ --- 438,446 ---- } if (net != null) { ! List<Edge> outline = netOutline(net); ! List<Edge> outlineCopies = new LinkedList<Edge>(); ! for (Edge e : outline) { ! outlineCopies.add(e.copy()); ! } if (!outlineCopies.isEmpty()) { /* make the shell of the facade */ *************** *** 447,457 **** Geometry.holeAnalysis(frameSurfEx); /* Put holes into the shell */ ! Iterator fields = net.getSurfaces().iterator(); ! while (fields.hasNext()) { ! Surface field = (Surface)fields.next(); Map offsetMap = new HashMap(); Iterator fieldEdges = field.getEdges().iterator(); ! Map envF = field.getParameters().environment(); ! while (fieldEdges.hasNext()) { Edge e = (Edge)fieldEdges.next(); --- 452,459 ---- Geometry.holeAnalysis(frameSurfEx); /* Put holes into the shell */ ! for (Surface field : net.getSurfaces()) { Map offsetMap = new HashMap(); Iterator fieldEdges = field.getEdges().iterator(); ! Map envF = field.getParameters().environment(); while (fieldEdges.hasNext()) { Edge e = (Edge)fieldEdges.next(); *************** *** 545,585 **** Geometry.holeAnalysis(hole); ! } /*else if (frameSize == 0) { ! Map offmap1 = new HashMap<Edge, Double>(); ! for (Object o : hole.getEdges()) { ! Edge e = (Edge)o; ! offmap1.put(e, FRAME_IDENTATION); ! } ! Surface in = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap1)); ! Space f = new Space(type + " Frame", ! Space.CONSTRUCTION, ! Space.ELEMENT_LEVEL, ! true); ! Space g = new Space("Glass", ! Space.CONSTRUCTION, ! Space.ELEMENT_LEVEL, ! true); ! g.setTransparent(true); ! space.add(g); ! space.add(f); ! assignSame(front, in, space, f); ! assignSame(front, hole, space, g); ! in = space.insert(in); ! Geometry.holeAnalysis(in); ! ! Set sides = new HashSet(); ! Surface inEx = extrudeIntoSpace(in, FRAME_DEPTH, sides); ! space.add(inEx); ! assignSame(front, inEx, space, frame); ! Geometry.holeAnalysis(inEx); ! ! //assignOpposite(front, hole, space, f); ! Geometry.holeAnalysis(hole); ! }*/ } /** * Finds the outline of a net, if it makes sence. ! * The outline most be a sequence of connected outer edges, so that * the last edge is connected to the first. Also all outer edges most be * in the outline. --- 547,556 ---- Geometry.holeAnalysis(hole); ! } } /** * Finds the outline of a net, if it makes sence. ! * The outline must be a sequence of connected outer edges, so that * the last edge is connected to the first. Also all outer edges most be * in the outline. *************** *** 587,596 **** * @return a list of connected edges making up the net outline */ ! private List netOutline(Net net) { /*Find outer edges*/ - Iterator edges = net.getEdges().iterator(); Set<Edge> outer = new HashSet<Edge>(); ! while (edges.hasNext()) { ! Edge current = (Edge)edges.next(); if (current.getSurfaces().size() == 1) { outer.add(current); --- 558,565 ---- * @return a list of connected edges making up the net outline */ ! private List<Edge> netOutline(Net net) { /*Find outer edges*/ Set<Edge> outer = new HashSet<Edge>(); ! for (Edge current : net.getEdges()) { if (current.getSurfaces().size() == 1) { outer.add(current); *************** *** 607,614 **** while (!doneAll) { Edge next = null; ! boolean done = false; ! Iterator nextEdges = nextVertex.getEdges().iterator(); ! while (nextEdges.hasNext()) { ! Object e = nextEdges.next(); if (outer.contains(e)) { next = (Edge)e; --- 576,580 ---- while (!doneAll) { Edge next = null; ! for (Edge e : nextVertex.getEdges()) { if (outer.contains(e)) { next = (Edge)e; *************** *** 636,640 **** } } ! return new LinkedList(); } --- 602,606 ---- } } ! return new LinkedList<Edge>(); } *************** *** 781,784 **** --- 747,858 ---- return Space.SPACE_LEVEL; } + + private Set<Surface> generateFrame2(Surface cut, + Surface contourSurf, + Space frameSpace, + Vertex out) { + Set<Surface> generatedSurfaces = new HashSet<Surface>(); + if (contourSurf.getEdges().size() < 3) { + return generatedSurfaces; + } + if (!rightHand(contourSurf, out)) { + contourSurf.flip(); + } + List<Edge> contour = contourSurf.getEdges(); + + Edge first = contour.get(0); + Edge second = contour.get(1); + Vertex common = Edge.commonVertex(first, second); + Vertex unCommon = first.otherVertex(common); + Vertex firstDir = common.minus(unCommon); + if (cut.normal().dot(firstDir) > 0) { + cut.setFrontDomain(frameSpace); + } else { + cut.setBackDomain(frameSpace); + } + Vertex i = out.cross(firstDir); + firstDir.normalize(); + out.normalize(); + i.normalize(); + CoordinateSystem cs = new CoordinateSystem(i, out, firstDir, unCommon); + List<Edge> cutEdges = cut.getEdges(); + Geometry.unTranslateGeometry(Geometry.collect(cutEdges), cs); + + Edge current = first; + for (Edge next : contour) { + if (next == first) { + continue; + } + Collection<Surface> extrusion = makeExtrusion(current, next, cutEdges); + cutEdges = findNewCutEdges(cutEdges, extrusion); + generatedSurfaces.addAll(extrusion); + current = next; + } + Collection<Surface> extrusion = makeExtrusion(contour.get(contour.size() - 1), + first, cutEdges); + cutEdges = findNewCutEdges(cutEdges, extrusion); + for (int k = 0; k < cutEdges.size(); k++) { + Edge oldEdge = cut.getEdges().get(k); + for (Surface s : oldEdge.getSurfaces()) { + s.replaceSingle(oldEdge, cutEdges.get(k)); + } + } + generatedSurfaces.addAll(extrusion); + return generatedSurfaces; + } + + private static Collection<Surface> makeExtrusion(Edge e1, Edge e2, + List<Edge> cutEdges) { + double angle = angle(e1, e2); + Vertex shared = Edge.commonVertex(e1, e2); + Vertex i = e2.otherVertex(shared).minus(shared); + Vertex j = e1.otherVertex(shared).minus(shared); + Vertex n = i.cross(j); + j = n.cross(i); + n.normalize(); + j.normalize(); + i.normalize(); + CoordinateSystem local = new CoordinateSystem(i, j, n, new Vertex(0, 0, 0)); + Vertex angleV = new Vertex(Math.sin(angle / 2), -Math.cos(angle / 2), 0); + angleV = local.unTranslate(angleV); + Plane plane = new Plane(angleV.getX(), angleV.getY(), angleV.getZ(), shared); + j.scale(-1); + Collection<Surface> extrusion = Edge.extrude(cutEdges, j, plane); + return extrusion; + } + + private static List<Edge> findNewCutEdges(List<Edge> contour, Collection<Surface> extrusion) { + Map<Edge, Edge> old2new = new HashMap<Edge, Edge>(); + for (Surface s : extrusion) { + List<Edge> edges = s.getEdges(); + Edge contourEdge = null; + for (Edge e : edges) { + if (contour.contains(e)) { + contourEdge = e; + } + } + if (contourEdge == null) { + log.error("Surface: " + s + " was not extruded from contour: " + contour); + continue; + } + for (Edge e : edges) { + if (Edge.commonVertex(e, contourEdge) == null) { + old2new.put(contourEdge, e); + } + } + } + List<Edge> newContour = new LinkedList<Edge>(); + for (Edge old : contour) { + Edge edge = old2new.get(old); + if (edge != null) { + newContour.add(edge); + } else { + log.error("Contour edge: " + old + + " does not have an adjacent edge in: " + extrusion); + } + } + return newContour; + } + /** *************** *** 791,796 **** private static Set<Surface> generateFrame(Surface cut, List<Edge> contour, Vertex out) { Surface test = new Surface(contour); ! boolean rightHand = rightHand(test, out); ! if (!rightHand) { test.flip(); contour = test.getEdges(); --- 865,869 ---- private static Set<Surface> generateFrame(Surface cut, List<Edge> contour, Vertex out) { Surface test = new Surface(contour); ! if (!rightHand(test, out)) { test.flip(); contour = test.getEdges(); *************** *** 816,820 **** CoordinateSystem cs = new CoordinateSystem(i, j, n, origin); Set post = genFramePost(cut, current.getLength(), bottomAngle, topAngle); ! unTranslateGeometry(post, cs); surfs.addAll(post); prev = current; --- 889,893 ---- CoordinateSystem cs = new CoordinateSystem(i, j, n, origin); Set post = genFramePost(cut, current.getLength(), bottomAngle, topAngle); ! Geometry.unTranslateGeometry(post, cs); surfs.addAll(post); prev = current; *************** *** 831,835 **** CoordinateSystem cs = new CoordinateSystem(i, j, n, origin); Set post = genFramePost(cut, current.getLength(), bottomAngle, topAngle); ! unTranslateGeometry(post, cs); surfs.addAll(post); Iterator surfIt = surfs.iterator(); --- 904,908 ---- CoordinateSystem cs = new CoordinateSystem(i, j, n, origin); Set post = genFramePost(cut, current.getLength(), bottomAngle, topAngle); ! Geometry.unTranslateGeometry(post, cs); surfs.addAll(post); Iterator surfIt = surfs.iterator(); *************** *** 843,865 **** - /** - * untranslates a set of geometry. - * @param geometry the geometry - * @param system the coordinate system to untranslate according to - */ - private static void unTranslateGeometry(Set geometry, CoordinateSystem system) { - List<Vertex> vertices = new LinkedList<Vertex>(Geometry.collect(geometry)); - List<Vertex> unTranslatedVertices = system.unTranslate(vertices); - Iterator it = vertices.iterator(); - Iterator unTranslatedIt = unTranslatedVertices.iterator(); - while (it.hasNext() && unTranslatedIt.hasNext()) { - Vertex v = (Vertex)it.next(); - Vertex vUnTranslated = (Vertex)unTranslatedIt.next(); - v.setX(vUnTranslated.getX()); - v.setY(vUnTranslated.getY()); - v.setZ(vUnTranslated.getZ()); - } - } - private static Surface cutType1() { List<Vertex> vl = new LinkedList<Vertex>(); --- 916,919 ---- |
|
From: Michael L. <he...@us...> - 2007-05-16 07:45:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20106/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: scripts can be used in length field for pencil and friends Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** AbstractPencil.java 16 May 2007 07:37:56 -0000 1.78 --- AbstractPencil.java 16 May 2007 07:45:17 -0000 1.79 *************** *** 18,21 **** --- 18,22 ---- import java.util.List; import java.util.Set; + import java.util.Stack; import javax.swing.Timer; *************** *** 708,715 **** */ public Object evaluate(String value) { ! System.out.println("pencil evaluate \"" + value + "\""); ! ! double d = Double.parseDouble(value); ! apply(d / 1000); return null; } --- 709,720 ---- */ public Object evaluate(String value) { ! Stack stack = evaluateString("echo (" + value + ")"); ! if (stack != null) { ! Object result = stack.pop(); ! if (result instanceof Double) { ! Double d = (Double) result; ! apply(d.doubleValue() / 1000); ! } ! } return null; } |
|
From: Michael L. <he...@us...> - 2007-05-16 07:38:00
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16899/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java SpaceTool.java AbstractPencil.java Log Message: Refactoring of evaluate function Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** SpaceTool.java 15 May 2007 16:27:29 -0000 1.78 --- SpaceTool.java 16 May 2007 07:37:56 -0000 1.79 *************** *** 12,20 **** import java.awt.event.ActionListener; import java.awt.event.MouseEvent; - import java.io.Reader; - import java.io.StringReader; import java.util.ArrayList; import java.util.Collection; - import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; --- 12,17 ---- *************** *** 30,34 **** import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.model.AxisRotate; import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; --- 27,30 ---- *************** *** 38,61 **** import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; - import net.sourceforge.bprocessor.model.IDTransform; import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Project; - import net.sourceforge.bprocessor.model.Scale; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.Transform; - import net.sourceforge.bprocessor.model.TransformStack; - import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Geometry; - import net.sourceforge.bprocessor.model.evaluator.Environment; - import net.sourceforge.bprocessor.model.evaluator.Function; - import net.sourceforge.bprocessor.model.evaluator.Invokable; import net.sourceforge.bprocessor.model.modellor.Cylinder; import net.sourceforge.bprocessor.model.modellor.LayerModellor; import net.sourceforge.bprocessor.model.modellor.Modellor; - import net.sourceforge.bprocessor.parser.ScriptLexer; - import net.sourceforge.bprocessor.parser.ScriptParser; /** --- 34,47 ---- *************** *** 66,74 **** private static Logger log = Logger.getLogger(SpaceTool.class); ! /** TransformStack */ ! private TransformStack transform; ! ! /** ID */ ! private Transform id; /** --- 52,56 ---- private static Logger log = Logger.getLogger(SpaceTool.class); ! /** *************** *** 412,677 **** - /** - * Builtin function - */ - public abstract class Builtin implements Invokable { - - } /** ! * Evaluate the string ! * @param value String ! * @return Result */ public Object evaluate(String value) { ! ! transform = new TransformStack(); ! id = new IDTransform(); ! HashMap<String, Object> globals = Project.getInstance().getGlobals().environment(); ! ! ! globals.put("echo", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! stack.push(env.get(0)); ! } ! }); ! globals.put("cos", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double argument = (Double) env.get(0); ! stack.push(new Double(Math.cos(argument.doubleValue()))); ! } ! }); ! globals.put("sin", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double argument = (Double) env.get(0); ! stack.push(new Double(Math.sin(argument.doubleValue()))); ! } ! }); ! globals.put("sqrt", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double argument = (Double) env.get(0); ! stack.push(new Double(Math.sqrt(argument.doubleValue()))); ! } ! }); ! globals.put("length", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! List argument = (List) env.get(0); ! stack.push(new Double(argument.size())); ! } ! }); ! globals.put("push", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! transform.push(id); ! } ! }); ! globals.put("pop", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! while (transform.pop() != id) { ! // NOTHING ! } ! } ! }); ! ! ! globals.put("vertex", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double x = (Double) env.get(0); ! Double y = (Double) env.get(1); ! Double z = (Double) env.get(2); ! Vertex result = new Vertex(x.doubleValue() / 1000, ! y.doubleValue() / 1000, ! z.doubleValue() / 1000); ! result = transform.transform(result); ! stack.push(result); ! } ! }); ! globals.put("edge", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Vertex from = (Vertex) env.get(0); ! Vertex to = (Vertex) env.get(1); ! Edge result = new Edge(from, to); ! stack.push(result); ! } ! }); ! globals.put("surface", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! List<Edge> edges = new LinkedList<Edge>(); ! for (int i = 0; i < env.length(); i++) { ! Edge current = (Edge) env.get(i); ! edges.add(current); ! } ! Surface result = new Surface(edges); ! stack.push(result); ! } ! }); ! globals.put("front", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Surface surface = (Surface) env.get(0); ! Space space = (Space) env.get(1); ! surface.setFrontDomain(space); ! } ! }); ! globals.put("back", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Surface surface = (Surface) env.get(0); ! Space space = (Space) env.get(1); ! surface.setBackDomain(space); ! } ! }); ! globals.put("space", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! String name = (String) env.get(0); ! Space result = new Space(name, Space.CONSTRUCTION, Space.SPACE_LEVEL, true); ! stack.push(result); ! } ! }); ! globals.put("contour", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Vertex previous = (Vertex) env.get(env.length() - 1); ! for (int i = 0; i < env.length(); i++) { ! Vertex current = (Vertex) env.get(i); ! stack.push(new Edge(previous, current)); ! previous = current; ! } ! } ! }); ! globals.put("translate", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double x = (Double) env.get(0); ! Double y = (Double) env.get(1); ! Double z = (Double) env.get(2); ! transform.push( ! new Translate(x.doubleValue(), y.doubleValue(), z.doubleValue()) ! ); ! } ! }); ! globals.put("scale", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double x = (Double) env.get(0); ! Double y = (Double) env.get(1); ! Double z = (Double) env.get(2); ! transform.push( ! new Scale(x.doubleValue(), y.doubleValue(), z.doubleValue()) ! ); ! } ! }); ! globals.put("rotate", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Double a = (Double) env.get(0); ! Double x = (Double) env.get(1); ! Double y = (Double) env.get(2); ! Double z = (Double) env.get(3); ! transform.push( ! new AxisRotate(a.doubleValue(), x.doubleValue(), y.doubleValue(), z.doubleValue()) ! ); ! } ! }); ! globals.put("extrude", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Surface surface = (Surface) env.get(0); ! Double distance = (Double) env.get(1); ! HashSet sides = new HashSet(); ! Surface top = surface.extrusion(distance.doubleValue() / 1000, sides); ! stack.push(surface); ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! stack.push(current); ! } ! stack.push(top); ! } ! }); ! ! globals.put("extrudeall", new Builtin() { ! public void evaluate(Environment env, Stack<Object> stack) { ! Surface surface = (Surface) env.get(0); ! Double distance = (Double) env.get(1); ! HashSet sides = new HashSet(); ! HashSet tops = new HashSet(); ! surface.extrusionall(distance.doubleValue() / 1000, sides, tops); ! stack.push(surface); ! { ! Iterator iter = sides.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! stack.push(current); ! } ! } ! { ! Iterator iter = tops.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! stack.push(current); ! } ! } ! } ! }); ! ! ! ! String script = Project.getInstance().getScript(); ! try { ! Reader input = new StringReader(script); ! ScriptLexer lexer = new ScriptLexer(input); ! ScriptParser parser = new ScriptParser(lexer); ! parser.script(globals); ! try { ! Environment global = new Environment(globals, null); ! Environment env = new Environment(global, new HashMap(), new LinkedList()); ! input = new StringReader(value); ! lexer = new ScriptLexer(input); ! parser = new ScriptParser(lexer); ! Function function = new Function(); ! parser.statement(function); ! Stack stack = new Stack(); ! function.evaluate(env, stack); ! Project.getInstance().getGlobals().define(globals); ! Project.getInstance().changed(Project.getInstance().getGlobals()); ! ! Space space = Project.getInstance().getActiveSpace(); ! Collection<Vertex> vertices = new LinkedList<Vertex>(); ! Collection<Edge> edges = new LinkedList<Edge>(); ! Collection<Surface> surfaces = new LinkedList<Surface>(); ! Collection<Space> spaces = new LinkedList<Space>(); ! ! ! while (!stack.empty()) { ! Object result = stack.pop(); ! if (result instanceof Vertex) { ! vertices.add((Vertex)result); ! } else if (result instanceof Edge) { ! edges.add((Edge)result); ! } else if (result instanceof Surface) { ! surfaces.add((Surface)result); ! } else if (result instanceof Space) { ! Space s = (Space) result; ! spaces.add(s); ! space.add(s); ! Selection.primary().add(s); ! } else { ! glv.setLengthValue(result.toString()); ! } } - edges.addAll(Surface.edges(surfaces)); - vertices.addAll(Edge.vertices(edges)); - Mesh mesh = new Mesh(surfaces, edges, vertices); - // mesh.identify(); - Mesh result = space.insert(mesh); - Selection.primary().addAll(result.vertices()); - Selection.primary().addAll(result.edges()); - Selection.primary().addAll(result.surfaces()); - Project.getInstance().checkpoint(); - typing = false; - } catch (Exception error) { - System.out.println(error); - error.printStackTrace(); } ! } catch (Exception error) { ! System.out.println(error); } ! return null; } /** * Delete --- 394,444 ---- /** ! * {@inheritDoc} */ public Object evaluate(String value) { ! Stack stack = evaluateString(value); ! if (stack != null) { ! Space space = Project.getInstance().getActiveSpace(); ! Collection<Vertex> vertices = new LinkedList<Vertex>(); ! Collection<Edge> edges = new LinkedList<Edge>(); ! Collection<Surface> surfaces = new LinkedList<Surface>(); ! Collection<Space> spaces = new LinkedList<Space>(); ! ! while (!stack.empty()) { ! Object result = stack.pop(); ! if (result instanceof Vertex) { ! vertices.add((Vertex)result); ! } else if (result instanceof Edge) { ! edges.add((Edge)result); ! } else if (result instanceof Surface) { ! surfaces.add((Surface)result); ! } else if (result instanceof Space) { ! Space s = (Space) result; ! spaces.add(s); ! space.add(s); ! Selection.primary().add(s); ! } else { ! glv.setLengthValue(result.toString()); } } ! ! edges.addAll(Surface.edges(surfaces)); ! vertices.addAll(Edge.vertices(edges)); ! Mesh mesh = new Mesh(surfaces, edges, vertices); ! // mesh.identify(); ! Mesh result = space.insert(mesh); ! Selection.primary().addAll(result.vertices()); ! Selection.primary().addAll(result.edges()); ! Selection.primary().addAll(result.surfaces()); ! Project.getInstance().checkpoint(); } ! typing = false; return null; } + + /** * Delete Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** AbstractPencil.java 8 May 2007 06:08:15 -0000 1.77 --- AbstractPencil.java 16 May 2007 07:37:56 -0000 1.78 *************** *** 708,711 **** --- 708,713 ---- */ public Object evaluate(String value) { + System.out.println("pencil evaluate \"" + value + "\""); + double d = Double.parseDouble(value); apply(d / 1000); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** AbstractTool.java 8 May 2007 12:32:06 -0000 1.120 --- AbstractTool.java 16 May 2007 07:37:56 -0000 1.121 *************** *** 7,19 **** --- 7,31 ---- package net.sourceforge.bprocessor.gl.tool; + import net.sourceforge.bprocessor.model.AxisRotate; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.IDTransform; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Scale; import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Transform; + import net.sourceforge.bprocessor.model.TransformStack; + import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.evaluator.Environment; + import net.sourceforge.bprocessor.model.evaluator.Function; + import net.sourceforge.bprocessor.model.evaluator.Invokable; + import net.sourceforge.bprocessor.parser.ScriptLexer; + import net.sourceforge.bprocessor.parser.ScriptParser; import net.sourceforge.bprocessor.gl.model.GlCamera; import net.sourceforge.bprocessor.gl.model.Widget; *************** *** 30,38 **** --- 42,56 ---- import java.awt.event.MouseWheelEvent; + import java.io.Reader; + import java.io.StringReader; import java.net.URL; + import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; + import java.util.List; import java.util.Set; import java.util.Collection; + import java.util.Stack; import org.apache.log4j.Logger; *************** *** 58,61 **** --- 76,85 ---- private static Logger log = Logger.getLogger(AbstractTool.class); + /** TransformStack */ + private TransformStack transform; + + /** ID */ + private Transform id; + /** The minimum drag time */ private static final int MIN_DRAG_TIME_MS = 200; *************** *** 622,624 **** --- 646,877 ---- typing = false; } + + /** + * Builtin function + */ + public abstract class Builtin implements Invokable { + + } + + + /** + * Evaluate the string + * @param value String + * @return stack of results + */ + public Stack evaluateString(String value) { + + transform = new TransformStack(); + id = new IDTransform(); + HashMap<String, Object> globals = Project.getInstance().getGlobals().environment(); + + + globals.put("echo", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + stack.push(env.get(0)); + } + }); + globals.put("cos", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double argument = (Double) env.get(0); + stack.push(new Double(Math.cos(argument.doubleValue()))); + } + }); + globals.put("sin", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double argument = (Double) env.get(0); + stack.push(new Double(Math.sin(argument.doubleValue()))); + } + }); + globals.put("sqrt", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double argument = (Double) env.get(0); + stack.push(new Double(Math.sqrt(argument.doubleValue()))); + } + }); + globals.put("length", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + List argument = (List) env.get(0); + stack.push(new Double(argument.size())); + } + }); + globals.put("push", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + transform.push(id); + } + }); + globals.put("pop", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + while (transform.pop() != id) { + // NOTHING + } + } + }); + + + globals.put("vertex", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double x = (Double) env.get(0); + Double y = (Double) env.get(1); + Double z = (Double) env.get(2); + Vertex result = new Vertex(x.doubleValue() / 1000, + y.doubleValue() / 1000, + z.doubleValue() / 1000); + result = transform.transform(result); + stack.push(result); + } + }); + globals.put("edge", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Vertex from = (Vertex) env.get(0); + Vertex to = (Vertex) env.get(1); + Edge result = new Edge(from, to); + stack.push(result); + } + }); + globals.put("surface", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + List<Edge> edges = new LinkedList<Edge>(); + for (int i = 0; i < env.length(); i++) { + Edge current = (Edge) env.get(i); + edges.add(current); + } + Surface result = new Surface(edges); + stack.push(result); + } + }); + globals.put("front", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Surface surface = (Surface) env.get(0); + Space space = (Space) env.get(1); + surface.setFrontDomain(space); + } + }); + globals.put("back", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Surface surface = (Surface) env.get(0); + Space space = (Space) env.get(1); + surface.setBackDomain(space); + } + }); + globals.put("space", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + String name = (String) env.get(0); + Space result = new Space(name, Space.CONSTRUCTION, Space.SPACE_LEVEL, true); + stack.push(result); + } + }); + globals.put("contour", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Vertex previous = (Vertex) env.get(env.length() - 1); + for (int i = 0; i < env.length(); i++) { + Vertex current = (Vertex) env.get(i); + stack.push(new Edge(previous, current)); + previous = current; + } + } + }); + globals.put("translate", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double x = (Double) env.get(0); + Double y = (Double) env.get(1); + Double z = (Double) env.get(2); + transform.push( + new Translate(x.doubleValue(), y.doubleValue(), z.doubleValue()) + ); + } + }); + globals.put("scale", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double x = (Double) env.get(0); + Double y = (Double) env.get(1); + Double z = (Double) env.get(2); + transform.push( + new Scale(x.doubleValue(), y.doubleValue(), z.doubleValue()) + ); + } + }); + globals.put("rotate", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Double a = (Double) env.get(0); + Double x = (Double) env.get(1); + Double y = (Double) env.get(2); + Double z = (Double) env.get(3); + transform.push( + new AxisRotate(a.doubleValue(), x.doubleValue(), y.doubleValue(), z.doubleValue()) + ); + } + }); + globals.put("extrude", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Surface surface = (Surface) env.get(0); + Double distance = (Double) env.get(1); + HashSet sides = new HashSet(); + Surface top = surface.extrusion(distance.doubleValue() / 1000, sides); + stack.push(surface); + Iterator iter = sides.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + stack.push(current); + } + stack.push(top); + } + }); + + globals.put("extrudeall", new Builtin() { + public void evaluate(Environment env, Stack<Object> stack) { + Surface surface = (Surface) env.get(0); + Double distance = (Double) env.get(1); + HashSet sides = new HashSet(); + HashSet tops = new HashSet(); + surface.extrusionall(distance.doubleValue() / 1000, sides, tops); + stack.push(surface); + { + Iterator iter = sides.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + stack.push(current); + } + } + { + Iterator iter = tops.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + stack.push(current); + } + } + } + }); + + String script = Project.getInstance().getScript(); + try { + Reader input = new StringReader(script); + ScriptLexer lexer = new ScriptLexer(input); + ScriptParser parser = new ScriptParser(lexer); + parser.script(globals); + try { + Environment global = new Environment(globals, null); + Environment env = new Environment(global, new HashMap(), new LinkedList()); + input = new StringReader(value); + lexer = new ScriptLexer(input); + parser = new ScriptParser(lexer); + Function function = new Function(); + parser.statement(function); + Stack stack = new Stack(); + function.evaluate(env, stack); + + Project.getInstance().getGlobals().define(globals); + Project.getInstance().changed(Project.getInstance().getGlobals()); + + return stack; + } catch (Exception error) { + System.out.println(error); + error.printStackTrace(); + } + } catch (Exception error) { + System.out.println(error); + } + + return null; + } } |
|
From: Michael L. <he...@us...> - 2007-05-16 06:58:07
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1099/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Removed test print-out Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FinalMoveTool.java 15 May 2007 12:26:38 -0000 1.5 --- FinalMoveTool.java 16 May 2007 06:58:04 -0000 1.6 *************** *** 128,132 **** } else { Geometric geometric = affected.iterator().next(); - System.out.println("simplify " + ++count); geometric.getOwner().simplify(); Project.getInstance().checkpoint(); --- 128,131 ---- |
|
From: rimestad <rim...@us...> - 2007-05-15 16:28:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5055/src/net/sourceforge/bprocessor/model/modellor Added Files: ModelBathModellor2.java Log Message: started on new bath modellor --- NEW FILE: ModelBathModellor2.java --- //--------------------------------------------------------------------------------- // $Id: ModelBathModellor2.java,v 1.1 2007/05/15 16:28:09 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model.modellor; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Net; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selector; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import org.apache.log4j.Logger; /** A modellor to make windows */ public class ModelBathModellor2 extends Modellor { /** Id */ private static final long serialVersionUID = 1L; /** The logger */ private static Logger log = Logger.getLogger(ModelBathModellor2.class); private Space space; private Surface bottom; private Surface top; private double shaftOffset; private double length; private double width; private double height; private double floorThickness = 0.080; private double wallThickness = 0.055; private double ceilingThickness = 0.055; private HashSet<Surface> vertical; private CoordinateSystem coord; private Net net; /** * the constructor */ public ModelBathModellor2() { super(); shaftOffset = 100; } /** * the constructor * @param s the Space to realize the modellor in */ public ModelBathModellor2(Space s) { this(); space = s; space.setUnion(true); coord = Project.getInstance().getActiveCoordinateSystem(); width = 2.800; length = 3.200; height = 2.800; generateNet(); space.add(net); net.edit(); Project.getInstance().addObserver(this); } /** * Generates the initial net */ private void generateNet() { Vertex v1 = new Vertex(0, 0, 0); Vertex v2 = new Vertex(width, 0, 0); Vertex v3 = new Vertex(width, length, 0); Vertex v4 = new Vertex(0, length, 0); Edge e1 = new Edge(v1, v2); Edge e2 = new Edge(v2, v3); Edge e3 = new Edge(v3, v4); Edge e4 = new Edge(v4, v1); List<Edge> edges = new ArrayList<Edge>(4); edges.add(e1); edges.add(e2); edges.add(e3); edges.add(e4); Surface s = new Surface(edges); net = new Net("Boundary"); net.add(v1); net.add(v2); net.add(v3); net.add(v4); net.add(e1); net.add(e2); net.add(e3); net.add(e4); net.add(s); } /** {@inheritDoc} */ public void update(Object entity) { if (entity.equals(net) || entity.equals(this) || entity.equals(space)) { cleanUp(); space.add(net); checkNetProperties(); generateBath(); } } /** * Create the floor, wall, ceiling and bath elements */ private void generateBath() { makeFloor(); makeWalls(); } /** * Generate wall element */ private void makeWalls() { Collection<Geometric> border = Geometry.copy(net.getEdges()); } /** * Generate floor element */ private void makeFloor() { Surface s = net.getSurfaces().iterator().next(); Space floor = new Space("Floor", Space.CONSTRUCTION, Space.SPACE_LEVEL, true); space.add(floor); s = s.copy(space); if (s.normal().getZ() < 0) { s.flip(); } s.setFrontDomain(floor); Collection<Surface> geom = new LinkedList<Surface>(); Surface floorTop = s.extrusion(floorThickness, geom); geom.add(floorTop); space.addAll(geom); } /** * check if edges have correct properties */ private void checkNetProperties() { for (Edge e : net.getEdges()) { Map<String, Object> env = e.getParameters().environment(); if (!env.containsKey("Type")) { List options = new LinkedList(); options.add("Wall"); options.add("Door"); options.add("Window"); Selector sel = new Selector(options); sel.setCurrentValue("Wall"); e.getParameters().put(new Attribute("Type", sel)); } } for (Vertex v : net.getVertices()) { Map<String, Object> env = v.getParameters().environment(); if (!env.containsKey("Corner")) { switch (v.getEdges().size()) { case 3 : v.getParameters().put(new Attribute("Corner", "Straight")); break; case 2 : List options = new LinkedList(); options.add("Left"); options.add("Right"); Selector sel = new Selector(options); sel.setCurrentValue("Left"); v.getParameters().put(new Attribute("Corner", sel)); break; default: break; } } } } /** {@inheritDoc} */ public Modellor newInstance(Space s) { if (s.getLevel() == Space.SPACE_LEVEL) { return new ModelBathModellor2(s); } else { return null; } } /** {@inheritDoc} */ public void delete() { space.setModellor(null); } /** * Clean up the constructed geometry */ private void cleanUp() { space.clear(); } /** {@inheritDoc} */ public void setAttributes(Map<String, Attribute> attributes) { Attribute a = attributes.get("Length"); if (a != null) { length = (Double)a.getValue(); } a = attributes.get("Width"); if (a != null) { width = (Double)a.getValue(); } a = attributes.get("Height"); if (a != null) { height = (Double)a.getValue(); } a = attributes.get("Shaft-offset"); if (a != null) { shaftOffset = (Double)a.getValue(); } update(space); } /** {@inheritDoc} */ public void getAttributes(List<Attribute> l) { l.add(new Attribute("Length", length, true)); l.add(new Attribute("Width", width, true)); l.add(new Attribute("Height", height, true)); l.add(new Attribute("Shaft-offset", shaftOffset, true)); } /** {@inheritDoc} */ public String getName() { return "New Bath-module"; } /** {@inheritDoc} */ public String getGeneralName() { return "New Bath-module modellor"; } /** {@inheritDoc} */ public void setSubContent(Map<String, Object> m) { space = (Space)m.get("Space"); } /** {@inheritDoc} */ public void getSubContent(Map<String, Object> m) { m.put("Space", space); } /** {@inheritDoc} */ @Override public int getUseableLevel() { return Space.SPACE_LEVEL; } } |
|
From: rimestad <rim...@us...> - 2007-05-15 16:28:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5055/src/net/sourceforge/bprocessor/model Modified Files: Project.java Geometry.java Log Message: started on new bath modellor Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Geometry.java 7 May 2007 15:42:42 -0000 1.55 --- Geometry.java 15 May 2007 16:28:09 -0000 1.56 *************** *** 986,989 **** --- 986,998 ---- v.setZ(vUnTranslated.getZ()); } + } + + /** + * @param geometry the geometry to copy + * @return A copy of the geometry + */ + public static Collection<Geometric> copy(Collection<? extends Geometric> geometry) { + //TODO implement the method + return null; } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** Project.java 8 May 2007 12:35:38 -0000 1.123 --- Project.java 15 May 2007 16:28:09 -0000 1.124 *************** *** 26,29 **** --- 26,30 ---- import net.sourceforge.bprocessor.model.modellor.LayerModellor; import net.sourceforge.bprocessor.model.modellor.ModelBathModellor; + import net.sourceforge.bprocessor.model.modellor.ModelBathModellor2; import net.sourceforge.bprocessor.model.modellor.Modellor; import net.sourceforge.bprocessor.model.modellor.TileModellor; *************** *** 162,165 **** --- 163,167 ---- Modellor.registerModellor(new WindowModellor()); Modellor.registerModellor(new ModelBathModellor()); + Modellor.registerModellor(new ModelBathModellor2()); try { *************** *** 168,172 **** loadTypes(); } catch (Exception e) { ! System.out.println("loading classification"); e.printStackTrace(); } --- 170,174 ---- loadTypes(); } catch (Exception e) { ! log.error("Error loading classification"); e.printStackTrace(); } |
|
From: rimestad <rim...@us...> - 2007-05-15 16:27:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4693/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: on delete change is called on active space, where the selection should be possible, maybe it should be the deepest common space of the deleted items instead Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** SpaceTool.java 8 May 2007 10:26:39 -0000 1.77 --- SpaceTool.java 15 May 2007 16:27:29 -0000 1.78 *************** *** 702,706 **** Project.getInstance().delete(edges); Project.getInstance().delete(vertices); ! Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } --- 702,706 ---- Project.getInstance().delete(edges); Project.getInstance().delete(vertices); ! Project.getInstance().changed(Project.getInstance().getActiveSpace()); Project.getInstance().checkpoint(); } |
|
From: Michael L. <he...@us...> - 2007-05-15 12:26:44
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4035/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Space.simplify() evolved Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FinalMoveTool.java 11 May 2007 10:44:35 -0000 1.4 --- FinalMoveTool.java 15 May 2007 12:26:38 -0000 1.5 *************** *** 34,37 **** --- 34,39 ---- private Vertex to; + private int count = 0; + /** * @param glv GLView *************** *** 125,131 **** updateFeedback(); } else { - Project.getInstance().checkpoint(); Geometric geometric = affected.iterator().next(); geometric.getOwner().simplify(); cleanUp(); } --- 127,134 ---- updateFeedback(); } else { Geometric geometric = affected.iterator().next(); + System.out.println("simplify " + ++count); geometric.getOwner().simplify(); + Project.getInstance().checkpoint(); cleanUp(); } |
|
From: Michael L. <he...@us...> - 2007-05-15 12:26:41
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4020/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Space.java Log Message: Space.simplify() evolved Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** Surface.java 8 May 2007 12:35:38 -0000 1.159 --- Surface.java 15 May 2007 12:26:35 -0000 1.160 *************** *** 236,239 **** --- 236,251 ---- /** + * Returns true if this surface is legal. + * A legal surface has at least 3 edges and a non-empty area. + * @return True if this surface is legal + */ + public boolean legal() { + if (edges.size() < 3) { + return false; + } + return true; + } + + /** * Return an ordered list of vertices around this Surface. * @return An ordered list of vertices around this Surface *************** *** 362,369 **** * @param newEdge the new edge. */ ! public void replaceSingle(Edge replaceEdge, Edge newEdge) { ! List<Edge> wrap = new LinkedList<Edge>(); ! wrap.add(replaceEdge); ! replace(wrap, newEdge); } --- 374,391 ---- * @param newEdge the new edge. */ ! public void replace(Edge replaceEdge, Edge newEdge) { ! // List<Edge> wrap = new LinkedList<Edge>(); ! // wrap.add(replaceEdge); ! // replace(wrap, newEdge); ! ! List<Edge> newEdges = new LinkedList(); ! for (Edge current : edges) { ! if (current == replaceEdge) { ! newEdges.add(newEdge); ! } else { ! newEdges.add(current); ! } ! } ! setEdges(newEdges); } *************** *** 385,446 **** /** - * Replace one edge e1 and its vertices with e2's - * @param e1 The edge to replace - * @param e2 The replacing edge - */ - public void replace(Edge e1, Edge e2) { - //FIXME not tested enough to be trusted 100% - List lst = new ArrayList(); - Edge[] edges = new Edge[getEdges().size()]; - getEdges().toArray(edges); - for (int i = 0; i < edges.length; i++) { - if (edges[i] == e1) { - log.info("Found the edge " + edges[i]); - Edge prev; - Edge next; - if (i == 0) { - if (edges[edges.length - 1].contains(e1.getFrom())) { - prev = edges[edges.length - 1]; - next = edges[i + 1]; - } else { - next = edges[edges.length - 1]; - prev = edges[i + 1]; - } - } else { - if (edges[(i + 1) % edges.length].contains(e1.getTo())) { - next = edges[(i + 1) % edges.length]; - prev = edges[i - 1]; - } else { - next = edges[i - 1]; - prev = edges[(i + 1) % edges.length]; - } - } - if (prev.getFrom() == e1.getFrom()) { - prev.setFrom(e2.getTo()); - } else if (prev.getTo() == e1.getFrom()) { - prev.setTo(e2.getTo()); - } else { - log.info("AHHH1 prev:" + prev + ", e1:" + e1 + ", e2:" + e2); - } - if (next.getTo() == e1.getTo()) { - next.setTo(e2.getFrom()); - } else if (next.getFrom() == e1.getTo()) { - next.setFrom(e2.getFrom()); - } else { - log.info("AHHH2 next:" + next + ", e1:" + e1 + ", e2:" + e2); - } - log.info("Next were " + next); - log.info("Prev were " + prev); - log.info("Replaced with " + e2); - lst.add(e2); - } else { - log.info("Just reinserted edge " + edges[i]); - lst.add(edges[i]); - } - } - setEdges(lst); - } - - /** * Replace the edge with the edges * @param edge The original edge --- 407,410 ---- Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** Space.java 15 May 2007 11:34:18 -0000 1.142 --- Space.java 15 May 2007 12:26:35 -0000 1.143 *************** *** 2743,2746 **** --- 2743,2750 ---- } + private static boolean eq(double a, double b) { + return Math.abs(a - b) < 0.00001; + } + /** * Simplify this space *************** *** 2750,2777 **** Comparator<Vertex> comparator = new Comparator<Vertex>() { public int compare(Vertex v1, Vertex v2) { ! if (v1.x < v2.x) { ! return -1; ! } else { ! if (v1.x > v2.x) { ! return 1; } else { if (v1.y < v2.y) { return -1; } else { ! if (v1.y > v2.y) { ! return 1; ! } else { ! if (v1.z < v2.z) { ! return -1; ! } else { ! if (v1.z > v2.z) { ! return 1; ! } else { ! return 0; ! } ! } ! } } } } } --- 2754,2781 ---- Comparator<Vertex> comparator = new Comparator<Vertex>() { public int compare(Vertex v1, Vertex v2) { ! if (eq(v1.x, v2.x)) { ! if (eq(v1.y, v2.y)) { ! if (eq(v1.z, v2.z)) { ! return 0; ! } else { ! if (v1.z < v2.z) { ! return -1; ! } else { ! return 1; ! } ! } } else { if (v1.y < v2.y) { return -1; } else { ! return 1; } } + } else { + if (v1.x < v2.x) { + return -1; + } else { + return 1; + } } } *************** *** 2779,2783 **** List<Vertex> sorted = new LinkedList(getVertices()); Collections.sort(sorted, comparator); - Collection<Collection<Vertex>> equivalences = new LinkedList(); { --- 2783,2786 ---- *************** *** 2802,2811 **** } } - if (!equivalences.isEmpty()) { - System.out.println("-- equivalances --"); - for (Collection current : equivalences) { - System.out.println(current); - } - } Map<Vertex, List<Edge>> edgemap = new HashMap(); for (Vertex current : getVertices()) { --- 2805,2808 ---- *************** *** 2851,2854 **** --- 2848,2852 ---- } Collection<Edge> deletion = new LinkedList(); + Set<Surface> empties = new HashSet(); for (Edge current : getEdges()) { if (current.from == current.to) { *************** *** 2860,2869 **** for (Surface surface : adjacent) { surface.getEdges().remove(current); } remove(current); } } ! { ! Map<Vertex, List<Edge>> edgemap = new HashMap(); for (Vertex current : getVertices()) { --- 2858,2872 ---- for (Surface surface : adjacent) { surface.getEdges().remove(current); + if (!surface.legal()) { + empties.add(surface); + } } remove(current); } + for (Surface current : empties) { + remove(current); + } } ! { Map<Vertex, List<Edge>> edgemap = new HashMap(); for (Vertex current : getVertices()) { *************** *** 2874,2880 **** edgemap.get(current.to).add(current); } ! Collection<Collection<Edge>> equivalence = new LinkedList(); ! for (Vertex vertex : getVertices()) { ! List<Edge> flst = edgemap.get(vertex); } } --- 2877,2926 ---- edgemap.get(current.to).add(current); } ! ! Map<Edge, Collection<Surface>> surfacemap = new HashMap(); ! for (Edge edge : getEdges()) { ! surfacemap.put(edge, new LinkedList()); ! } ! for (Surface surface : getSurfaces()) { ! for (Edge current : surface.getEdges()) { ! surfacemap.get(current).add(surface); ! } ! } ! ! ! Set<Edge> mark = new HashSet(); ! Collection<Collection<Edge>> equivalences = new LinkedList(); ! ! for (Edge leader : getEdges()) { ! if (!mark.contains(leader)) { ! List<Edge> equivalence = null; ! mark.add(leader); ! List<Edge> flst = edgemap.get(leader.from); ! for (Edge current : flst) { ! if (leader != current) { ! if (leader.equivalent(current)) { ! mark.add(current); ! if (equivalence == null) { ! equivalence = new LinkedList(); ! equivalence.add(leader); ! equivalences.add(equivalence); ! } ! equivalence.add(current); ! } ! } ! } ! } ! } ! for (Collection<Edge> equivalence : equivalences) { ! Edge leader = equivalence.iterator().next(); ! for (Edge current : equivalence) { ! if (leader != current) { ! Collection<Surface> surfaces = surfacemap.get(current); ! for (Surface surface : surfaces) { ! surface.replace(current, leader); ! } ! remove(current); ! } ! } } } |
|
From: rimestad <rim...@us...> - 2007-05-15 11:36:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15902/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: made a total refacture of extrusiontool to make it extrude selected surfaces and selected edges as well as non selected ones. A doubleclick now repeat the extrusion, could be handy Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** ExtrusionTool.java 9 May 2007 09:32:38 -0000 1.57 --- ExtrusionTool.java 15 May 2007 11:36:27 -0000 1.58 *************** *** 19,22 **** --- 19,23 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; *************** *** 95,131 **** space.changed(); } - - /** - * Extrude - * @param distance double - * @param all Extrude all - * @param finish Finish extrusion - */ - private void extrude(double distance, boolean all, boolean finish) { - Space space = Project.getInstance().getActiveSpace(); - if (extrusion != null) { - space.removeProtected(extrusion); - space.computeNextId(); - extrusion = null; - } - extrusion = new LinkedList<Surface>(); - Collection<Surface> sides = new LinkedList<Surface>(); - Set<Surface> tops = new HashSet<Surface>(); - if (all) { - extrudesurface.extrusionall(distance, sides, tops); - extrusion.addAll(sides); - extrusion.addAll(tops); - } else { - Surface top = extrudesurface.extrusion(distance, sides); - extrusion.add(top); - extrusion.addAll(sides); - } - if (finish) { - insert(space, extrusion); - - } else { - space.addProtected(extrusion); - } - } /** --- 96,99 ---- *************** *** 145,161 **** Collection<Surface> sides = new LinkedList<Surface>(); Set<Surface> tops = new HashSet<Surface>(); if (p == null) { ! log.info("Found null plane"); ! return; ! } ! if (all) { ! extrudesurface.extrusionAllOnto(p, sides, tops); ! extrusion.addAll(sides); ! extrusion.addAll(tops); } else { ! Surface top = extrudesurface.extrusionOnto(p, sides); ! extrusion.add(top); ! extrusion.addAll(sides); } if (finish) { insert(space, extrusion); --- 113,136 ---- Collection<Surface> sides = new LinkedList<Surface>(); Set<Surface> tops = new HashSet<Surface>(); + Surface top = null; if (p == null) { ! // just extrude the distance ! if (all) { ! extrudesurface.extrusionall(distance, sides, tops); ! } else { ! top = extrudesurface.extrusion(distance, sides); ! extrusion.add(top); ! } } else { ! // extrude to the plane ! if (all) { ! extrudesurface.extrusionAllOnto(p, sides, tops); ! } else { ! top = extrudesurface.extrusionOnto(p, sides); ! extrusion.add(top); ! } } + extrusion.addAll(sides); + extrusion.addAll(tops); if (finish) { insert(space, extrusion); *************** *** 196,321 **** */ protected void moved(MouseEvent e) { ! if (Selection.primary().isEmpty()) { ! // extrude surface ! if (extrudesurface == null) { ! //the extrusion isn't started yet ! findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } else if (target == null) { ! glv.getView().makeTarget(null); ! } ! active = true; ! ! } else { ! // a extrudesurface have been chosen ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); ! Vertex normal = extrudesurface.normal(); ! //a bit cleanup ! ontoPlane = null; ! // the list of all extruded geometric objects ! Set<Geometric> elements = new HashSet<Geometric>(); ! if (extrusion != null) { ! elements.addAll(extrusion); ! elements.addAll(Surface.edges(extrusion)); ! elements.add(extrudesurface); ! } ! //ignore the extruded surface and holes when extruding ! Set<Surface> ignore = new HashSet<Surface>(2); ! ignore.add(extrudesurface); ! if (extrudesurface.getExterior() != null) { ! ignore.add(extrudesurface.getExterior()); ! } ! findTarget(e, ignore); ! { ! if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { ! Surface surface = (Surface) target; ! if (!elements.contains(surface)) { ! Vertex n = surface.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! // the surfaces are coplanar ! Vertex v = surface.getFirstVertex(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; ! } calcDistCallExtrude(to, from, normal); } else { ! ontoPlane = surface.plane(); ! if (Math.abs(ontoPlane.normal().dot(normal)) <= 0.1) { ! // the two normals have a greater angle between 0 and 84 or 94 and 180 degrees ! calcDistCallExtrude(to, from, normal); ! } else { ! extrudeOnto(ontoPlane, all, false); ! } } } ! } else if (target instanceof Edge) { ! Edge edge = (Edge) target; ! if (!elements.contains(edge)) { ! to = edge.center(); ! Vertex v = edge.center(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; ! } } - calcDistCallExtrude(to, from, normal); - } else { - calcDistCallExtrude(to, from, normal); } } } ! } else { ! //The extrusion should be found in the selection (EDGE EXTRUSION) ! if (extrudeEdges != null) { ! // the extrusion should begin ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); ! ! //list of moving elements ! Set<Geometric> elements = new HashSet<Geometric>(extrudeEdges); ! if (extrusion != null) { ! elements.addAll(extrusion); ! elements.addAll(Surface.edges(extrusion)); ! } ! ! // ignore the extruded surface and holes when extruding ! List<Geometric> ignore = new LinkedList<Geometric>(extrudeEdges); ! if (extrusion != null) { ! ignore.addAll(extrusion); ! ignore.addAll(Surface.edges(extrusion)); ! ignore.addAll(Geometry.collect(extrusion)); ! } ! excluded(ignore); ! current = findIntersection(e); ! if (e.isShiftDown()) { to = current.vertex(); ! } ! findTarget(e, ignore); ! updateConstructors(); ! log.info("Target is " + target); ! if (target != null && !elements.contains(target)) { ! if (target instanceof Surface) { ! ontoPlane = ((Surface) target).plane(); ! makeTarget(current); ! } else if (target instanceof Plane && target != plane) { ! ontoPlane = (Plane)target; ! makeTarget(current); ! } else if (target instanceof Line || ! target instanceof Constructor || ! target instanceof Edge) { ! to = current.vertex(); ! makeTarget(current); ! ontoPlane = null; ! } else { ! ontoPlane = null; ! } } else { ontoPlane = null; } - distance = to.minus(from).length(); - extrudeEdgesOnto(ontoPlane, false); } else { ! current = findIntersection(e); ! makeTarget(current); } } --- 171,298 ---- */ protected void moved(MouseEvent e) { ! if (extrudesurface != null) { ! // a extrudesurface have been chosen ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); ! Vertex normal = extrudesurface.normal(); ! //a bit cleanup ! ontoPlane = null; ! // the list of all extruded geometric objects ! Set<Geometric> elements = new HashSet<Geometric>(); ! if (extrusion != null) { ! elements.addAll(extrusion); ! elements.addAll(Surface.edges(extrusion)); ! elements.add(extrudesurface); ! } ! //ignore the extruded surface and holes when extruding ! Set<Surface> ignore = new HashSet<Surface>(2); ! ignore.add(extrudesurface); ! if (extrudesurface.getExterior() != null) { ! ignore.add(extrudesurface.getExterior()); ! } ! findTarget(e, ignore); ! { ! if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { ! Surface surface = (Surface) target; ! if (!elements.contains(surface)) { ! Vertex n = surface.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! // the surfaces are coplanar ! Vertex v = surface.getFirstVertex(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; ! } ! calcDistCallExtrude(to, from, normal); ! } else { ! ontoPlane = surface.plane(); ! if (Math.abs(ontoPlane.normal().dot(normal)) <= 0.1) { ! // the two normals have a greater angle between 0 and 84 or 94 and 180 degrees calcDistCallExtrude(to, from, normal); } else { ! extrudeOnto(ontoPlane, all, false); } } ! } ! } else if (target instanceof Edge) { ! Edge edge = (Edge) target; ! if (!elements.contains(edge)) { ! Vertex v = edge.center(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; } } + calcDistCallExtrude(to, from, normal); + } else if (target instanceof Vertex) { + if (!elements.contains(target)) { + to = (Vertex)target; + } + calcDistCallExtrude(to, from, normal); + } else { + calcDistCallExtrude(to, from, normal); } } ! } else if (extrudeEdges != null) { ! // make the extrusion of edges ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); ! ! //list of moving elements ! Set<Geometric> elements = new HashSet<Geometric>(extrudeEdges); ! if (extrusion != null) { ! elements.addAll(extrusion); ! elements.addAll(Surface.edges(extrusion)); ! } ! ! // ignore the extruded surface and holes when extruding ! List<Geometric> ignore = new LinkedList<Geometric>(extrudeEdges); ! if (extrusion != null) { ! ignore.addAll(extrusion); ! ignore.addAll(Surface.edges(extrusion)); ! ignore.addAll(Geometry.collect(extrusion)); ! } ! excluded(ignore); ! current = findIntersection(e); ! if (e.isShiftDown()) { ! to = current.vertex(); ! } ! findTarget(e, ignore); ! updateConstructors(); ! if (target != null && !elements.contains(target)) { ! if (target instanceof Surface) { ! ontoPlane = ((Surface) target).plane(); ! makeTarget(current); ! } else if (target instanceof Plane && target != plane) { ! ontoPlane = (Plane)target; ! makeTarget(current); ! } else if (target instanceof Line || ! target instanceof Constructor || ! target instanceof Edge) { to = current.vertex(); ! makeTarget(current); ! ontoPlane = null; } else { ontoPlane = null; } } else { ! ontoPlane = null; ! } ! distance = to.minus(from).length(); ! extrudeEdgesOnto(ontoPlane, false); ! } else { ! // do highlighting ! if (Selection.primary().isEmpty()) { ! //the extrusion isn't started yet ! findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } else if (target == null) { ! glv.getView().makeTarget(null); ! } ! active = true; ! } else { ! Geometric g = Selection.primary().iterator().next(); ! if (Selection.primary().size() == 1 && ! g instanceof Surface) { ! target = g; ! } } } *************** *** 331,335 **** Vertex delta = to.minus(from); distance = normal.dot(delta); ! extrude(distance, all, false); } --- 308,312 ---- Vertex delta = to.minus(from); distance = normal.dot(delta); ! extrudeOnto(null, all, false); } *************** *** 339,420 **** */ protected void pressed(MouseEvent e) { ! if (!Selection.primary().isEmpty()) { ! if (extrudeEdges == null) { extrudeEdges = new ArrayList<Edge>(); for (Object o : Selection.primary()) { if (o instanceof Edge) { extrudeEdges.add((Edge) o); } else { extrudeEdges.clear(); } } ! if (extrudeEdges.size() != Selection.primary().size()) { extrudeEdges = null; ! GUI.getInstance().alert("Either no selection or a selection" + ! " only consisting of edges are possible"); } else { ! startx = e.getX(); ! starty = e.getY(); ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = startx; ! double y = View.getHeight() - starty; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! Plane plane = new Plane(0, 0, 1, extrudeEdges.get(0).getFrom()); ! dragplane = plane.orthogonalPlane(ray); ! active = true; ! start = findIntersection(e); ! from = start.vertex(); ! } ! } else { ! if (extrusion != null) { ! if (ontoPlane != null) { ! extrudeEdgesOnto(ontoPlane, true); ! } else { ! extrudeEdgesOnto(null, true); } } ! extrusion = null; ! Project.getInstance().checkpoint(); ! cleanUp(); ! } ! } else { ! if (extrudesurface == null) { findTarget(e); if (target instanceof Surface) { extrudesurface = (Surface) target; - startx = e.getX(); - starty = e.getY(); - View view = glv.getView(); - Transformation trans = view.transformation(); - double x = startx; - double y = View.getHeight() - starty; - Vertex near = new Vertex(x, y, 0.0); - Vertex far = new Vertex(x, y, 1.0); - Edge ray = new Edge(near, far); - ray = trans.unProject(ray); - Plane plane = extrudesurface.plane(); - dragplane = plane.orthogonalPlane(ray); - from = view.toPlaneCoords(startx, starty, dragplane); - all = !e.isAltDown(); } else { GUI.getInstance().alert(target + " ain't extrudeable only Surfaces are"); } ! } else { if (extrusion != null) { if (ontoPlane != null) { ! extrudeOnto(ontoPlane, all, true); } else { ! extrude(distance, all, true); } - extrusion = null; - Project.getInstance().checkpoint(); } ! cleanUp(); ! moved(e); } } } --- 316,428 ---- */ protected void pressed(MouseEvent e) { ! if (e.getClickCount() > 1 && extrusion == null) { ! // do a extrusion of the same length once more ! if (extrudesurface != null) { ! extrudeOnto(ontoPlane, true, true); ! } else if (extrudeEdges != null) { ! extrudeEdgesOnto(ontoPlane, true); ! } ! } ! ! if (start == null) { ! // initialize the extrusion ! if (!Selection.primary().isEmpty()) { ! //find the selected object to extrude extrudeEdges = new ArrayList<Edge>(); for (Object o : Selection.primary()) { if (o instanceof Edge) { extrudeEdges.add((Edge) o); + } else if (o instanceof Surface) { + findTarget(e); + if (target == o) { + extrudesurface = (Surface)o; + } } else { extrudeEdges.clear(); + extrudesurface = null; + break; } } ! if (extrudeEdges.isEmpty()) { extrudeEdges = null; ! if (extrudesurface == null) { ! GUI.getInstance().alert("Either select a conected set of edges or a single surface" + ! " to extrude or select nothing and extrude surfaces"); ! } } else { ! if (extrudesurface != null) { ! // there were both edges and surfaces in the selection ! extrudesurface = null; ! extrudeEdges = null; ! GUI.getInstance().alert("Different geometrics in a selection ain't extrudeable"); } } ! } else { ! //find the target to extrude findTarget(e); if (target instanceof Surface) { extrudesurface = (Surface) target; } else { GUI.getInstance().alert(target + " ain't extrudeable only Surfaces are"); } ! } ! // Do initialization ! if (extrudeEdges != null) { ! startx = e.getX(); ! starty = e.getY(); ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = startx; ! double y = View.getHeight() - starty; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! Plane plane = new Plane(0, 0, 1, extrudeEdges.get(0).getFrom()); ! dragplane = plane.orthogonalPlane(ray); ! active = true; ! start = findIntersection(e); ! from = start.vertex(); ! } else if (extrudesurface != null) { ! startx = e.getX(); ! starty = e.getY(); ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = startx; ! double y = View.getHeight() - starty; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! Plane plane = extrudesurface.plane(); ! dragplane = plane.orthogonalPlane(ray); ! from = view.toPlaneCoords(startx, starty, dragplane); ! start = new Intersection(from, Intersection.SURFACE, extrudesurface); ! all = !e.isAltDown(); ! active = true; ! } ! } else { ! // stop the extrusion ! if (extrudeEdges != null) { if (extrusion != null) { if (ontoPlane != null) { ! extrudeEdgesOnto(ontoPlane, true); } else { ! extrudeEdgesOnto(null, true); } } ! } else if (extrudesurface != null) { ! if (extrusion != null) { ! extrudeOnto(ontoPlane, all, true); ! } ! } else { ! //something weird happend ! log.error("Got into a finalize state without initialization of either edges or surface"); } + extrusion = null; + Selection.primary().clear(); + Project.getInstance().checkpoint(); + cleanUp(); + moved(e); } } *************** *** 425,429 **** @Override public void onVertex() { ! } --- 433,437 ---- @Override public void onVertex() { ! // Overrides apply so no need for any action in onVertex } *************** *** 438,442 **** length = -length; } ! extrude(length, all, true); } else if (extrudeEdges != null) { if (to != null) { --- 446,451 ---- length = -length; } ! distance = length; ! extrudeOnto(null, all, true); } else if (extrudeEdges != null) { if (to != null) { *************** *** 479,483 **** all = false; dragplane = null; ! ontoPlane = null; from = null; to = null; --- 488,493 ---- all = false; dragplane = null; ! //keep for repeat ! //ontoPlane = null; from = null; to = null; *************** *** 485,489 **** Project.getInstance().getActiveSpace().removeProtected(extrusion); Project.getInstance().getActiveSpace().computeNextId(); ! Project.getInstance().getActiveSpace().changed(); extrusion = null; } --- 495,499 ---- Project.getInstance().getActiveSpace().removeProtected(extrusion); Project.getInstance().getActiveSpace().computeNextId(); ! //Project.getInstance().getActiveSpace().changed(); extrusion = null; } |
|
From: rimestad <rim...@us...> - 2007-05-15 11:34:47
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14860/src/net/sourceforge/bprocessor/model Modified Files: Classification.java Log Message: static final values should be used not magic numbers Index: Classification.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Classification.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Classification.java 8 May 2007 11:08:11 -0000 1.14 --- Classification.java 15 May 2007 11:34:47 -0000 1.15 *************** *** 182,186 **** Classification par = parent; if (par != null) { ! if (cur != null && cur.getOwner().getLevel() != 2) { current = cur.getOwner(); if (current.getClassification() == par) { --- 182,186 ---- Classification par = parent; if (par != null) { ! if (cur != null && cur.getOwner().getLevel() != Space.PROJECT_LEVEL) { current = cur.getOwner(); if (current.getClassification() == par) { |
|
From: rimestad <rim...@us...> - 2007-05-15 11:34:24
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14775/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: removed change event that I added in ignorance Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** Space.java 11 May 2007 11:35:08 -0000 1.141 --- Space.java 15 May 2007 11:34:18 -0000 1.142 *************** *** 2452,2456 **** } } - Project.getInstance().changed(this); } --- 2452,2455 ---- |
|
From: Michael L. <he...@us...> - 2007-05-11 11:35:08
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10271/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Improved simplification after move Ð empty edges now removed as well as duplicate vertices Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** Space.java 11 May 2007 10:44:30 -0000 1.140 --- Space.java 11 May 2007 11:35:08 -0000 1.141 *************** *** 2841,2844 **** --- 2841,2884 ---- } } + { + Map<Edge, Collection<Surface>> surfacemap = new HashMap(); + for (Edge edge : getEdges()) { + surfacemap.put(edge, new LinkedList()); + } + for (Surface surface : getSurfaces()) { + for (Edge current : surface.getEdges()) { + surfacemap.get(current).add(surface); + } + } + Collection<Edge> deletion = new LinkedList(); + for (Edge current : getEdges()) { + if (current.from == current.to) { + deletion.add(current); + } + } + for (Edge current : deletion) { + Collection<Surface> adjacent = surfacemap.get(current); + for (Surface surface : adjacent) { + surface.getEdges().remove(current); + } + remove(current); + } + } + { + + Map<Vertex, List<Edge>> edgemap = new HashMap(); + for (Vertex current : getVertices()) { + edgemap.put(current, new LinkedList()); + } + for (Edge current : getEdges()) { + edgemap.get(current.from).add(current); + edgemap.get(current.to).add(current); + } + Collection<Collection<Edge>> equivalence = new LinkedList(); + for (Vertex vertex : getVertices()) { + List<Edge> flst = edgemap.get(vertex); + } + } + Project.getInstance().changed(Project.getInstance()); } |
|
From: Michael L. <he...@us...> - 2007-05-11 10:44:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22361/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Progress on implemention of geometry simplification when moving Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FinalMoveTool.java 9 May 2007 09:21:43 -0000 1.3 --- FinalMoveTool.java 11 May 2007 10:44:35 -0000 1.4 *************** *** 18,21 **** --- 18,22 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Vertex; *************** *** 25,29 **** */ public class FinalMoveTool extends AbstractPencil { ! private Collection<Geometric> geometrics; private Collection<Vertex> vertices; --- 26,30 ---- */ public class FinalMoveTool extends AbstractPencil { ! private Collection<Geometric> geometrics; private Collection<Vertex> vertices; *************** *** 124,127 **** --- 125,131 ---- updateFeedback(); } else { + Project.getInstance().checkpoint(); + Geometric geometric = affected.iterator().next(); + geometric.getOwner().simplify(); cleanUp(); } |
|
From: Michael L. <he...@us...> - 2007-05-11 10:44:32
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22351/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Progress on implemention of geometry simplification when moving Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** Space.java 7 May 2007 15:43:26 -0000 1.139 --- Space.java 11 May 2007 10:44:30 -0000 1.140 *************** *** 10,13 **** --- 10,14 ---- import java.util.Collection; import java.util.Collections; + import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; *************** *** 2742,2745 **** --- 2743,2845 ---- return new Mesh(surfaces, edges, vertices); } + + /** + * Simplify this space + */ + public void simplify() { + { + Comparator<Vertex> comparator = new Comparator<Vertex>() { + public int compare(Vertex v1, Vertex v2) { + if (v1.x < v2.x) { + return -1; + } else { + if (v1.x > v2.x) { + return 1; + } else { + if (v1.y < v2.y) { + return -1; + } else { + if (v1.y > v2.y) { + return 1; + } else { + if (v1.z < v2.z) { + return -1; + } else { + if (v1.z > v2.z) { + return 1; + } else { + return 0; + } + } + } + } + } + } + } + }; + List<Vertex> sorted = new LinkedList(getVertices()); + Collections.sort(sorted, comparator); + + Collection<Collection<Vertex>> equivalences = new LinkedList(); + { + Vertex leader = null; + Collection<Vertex> equivalence = null; + for (Vertex current : sorted) { + if (leader == null) { + leader = current; + } else { + if (leader.equalEps(current)) { + if (equivalence == null) { + equivalence = new LinkedList(); + equivalence.add(leader); + equivalences.add(equivalence); + } + equivalence.add(current); + } else { + leader = current; + equivalence = null; + } + } + } + } + if (!equivalences.isEmpty()) { + System.out.println("-- equivalances --"); + for (Collection current : equivalences) { + System.out.println(current); + } + } + Map<Vertex, List<Edge>> edgemap = new HashMap(); + for (Vertex current : getVertices()) { + edgemap.put(current, new LinkedList()); + } + for (Edge current : getEdges()) { + edgemap.get(current.from).add(current); + edgemap.get(current.to).add(current); + } + Collection<Vertex> deletion = new LinkedList(); + for (Collection<Vertex> equivalence : equivalences) { + Vertex leader = null; + for (Vertex current : equivalence) { + if (leader == null) { + leader = current; + } else { + deletion.add(current); + List<Edge> edges = edgemap.get(current); + for (Edge edge : edges) { + if (edge.from == current) { + edge.setFrom(leader); + } + if (edge.to == current) { + edge.setTo(leader); + } + } + } + } + } + for (Vertex current : deletion) { + remove(current); + } + } + } /** |
|
From: Michael L. <he...@us...> - 2007-05-10 11:53:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8237/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: small tweaks to hit-detection Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.209 retrieving revision 1.210 diff -C2 -d -r1.209 -r1.210 *** View.java 9 May 2007 08:57:19 -0000 1.209 --- View.java 10 May 2007 11:53:11 -0000 1.210 *************** *** 2527,2531 **** ! if (surface != null) { // Test vertex and edge against surface --- 2527,2535 ---- ! if (surface != null) { ! if (unWantedEntities.contains(surface)) { ! surface = null; ! } ! } if (surface != null) { // Test vertex and edge against surface *************** *** 2547,2555 **** } ! if (surface != null) { ! if (unWantedEntities.contains(surface)) { ! surface = null; ! } ! } if (edge != null && vertex != null) { --- 2551,2555 ---- } ! if (edge != null && vertex != null) { |
|
From: Michael L. <he...@us...> - 2007-05-10 11:53:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8237/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: small tweaks to hit-detection Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SelectStrategy.java 9 May 2007 09:33:42 -0000 1.11 --- SelectStrategy.java 10 May 2007 11:53:11 -0000 1.12 *************** *** 113,118 **** target = view.getObjectAtPoint(x, y, View.OBJECTS); - - if (e.getClickCount() >= 2) { if (e.getClickCount() == 2) { --- 113,116 ---- |
|
From: Michael L. <he...@us...> - 2007-05-09 09:33:42
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1240/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: Extending selection Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SelectStrategy.java 15 Apr 2007 11:04:57 -0000 1.10 --- SelectStrategy.java 9 May 2007 09:33:42 -0000 1.11 *************** *** 11,14 **** --- 11,15 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; import java.util.List; *************** *** 23,26 **** --- 24,28 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 110,134 **** View view = glv.getView(); target = view.getObjectAtPoint(x, y, View.OBJECTS); if (e.getClickCount() >= 2) { ! if (target instanceof Space) { ! Space space = (Space) target; ! space.edit(); ! } else if (target instanceof Surface) { ! Surface surface = (Surface) target; ! if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getEnvelope()); } ! if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getEnvelope()); } - } else if (target instanceof Constructor) { - Constructor c = (Constructor)target; - c.setActive(!c.isActive()); - } else if (target instanceof ClippingPlane) { - ClippingPlane cp = (ClippingPlane)target; - cp.setActive(!cp.isActive()); - } else if (target instanceof GlCamera) { - GlCamera glcam = (GlCamera)target; - Project.getInstance().setCurrentCamera(glcam.getCamera()); } } else { --- 112,173 ---- View view = glv.getView(); target = view.getObjectAtPoint(x, y, View.OBJECTS); + + + if (e.getClickCount() >= 2) { ! if (e.getClickCount() == 2) { ! Collection<Geometric> extended = new HashSet(); ! extended.addAll(Selection.primary()); ! for (Geometric current : Selection.primary()) { ! if (current instanceof Edge) { ! Edge edge = (Edge) current; ! extended.addAll(edge.getSurfaces()); ! } ! if (current instanceof Surface) { ! Surface surface = (Surface) current; ! extended.addAll(surface.getEdges()); ! } } ! Selection.primary().clear(); ! Selection.primary().addAll(extended); ! } else { ! int size = 0; ! Collection<Vertex> vertices = Geometry.collect(Selection.primary()); ! Collection<Edge> edges = new LinkedList<Edge>(); ! while (vertices.size() > size) { ! size = vertices.size(); ! edges = Vertex.edges(vertices); ! vertices = Geometry.collect(edges); ! } ! Collection<Surface> surfaces = Edge.surfaces(edges); ! Collection<Geometric> geometrics = new HashSet<Geometric>(); ! geometrics.addAll(surfaces); ! geometrics.addAll(edges); ! geometrics.addAll(vertices); ! Selection.primary().set(geometrics); ! } ! ! if (1 < 0) { ! if (target instanceof Space) { ! Space space = (Space) target; ! space.edit(); ! } else if (target instanceof Surface) { ! Surface surface = (Surface) target; ! if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getEnvelope()); ! } ! if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getEnvelope()); ! } ! } else if (target instanceof Constructor) { ! Constructor c = (Constructor)target; ! c.setActive(!c.isActive()); ! } else if (target instanceof ClippingPlane) { ! ClippingPlane cp = (ClippingPlane)target; ! cp.setActive(!cp.isActive()); ! } else if (target instanceof GlCamera) { ! GlCamera glcam = (GlCamera)target; ! Project.getInstance().setCurrentCamera(glcam.getCamera()); } } } else { |
|
From: rimestad <rim...@us...> - 2007-05-09 09:33:03
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv856/src/net/sourceforge/bprocessor/model/modellor Modified Files: ModelBathModellor.java Log Message: commit before major change of modellor Index: ModelBathModellor.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/modellor/ModelBathModellor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ModelBathModellor.java 7 May 2007 13:40:18 -0000 1.3 --- ModelBathModellor.java 9 May 2007 09:33:03 -0000 1.4 *************** *** 50,53 **** --- 50,55 ---- private double ceilingThickness = 55; + + private HashSet<Surface> vertical; /** * the constructor *************** *** 66,79 **** space = s; bottom = null; ! Collection<Surface> vertical = new HashSet<Surface>(); Collection<Surface> horizontal = new HashSet<Surface>(); Collection<Surface> surs = s.getEnvelope(); Vertex up = new Vertex(0, 0, 1); for (Surface sur : surs) { ! double dot = (sur.normal()).dot(up); ! if (Math.abs(dot) - 1 < 0.001) { ! horizontal.add(sur); ! } else if (dot < 0.001 && dot > -0.001) { vertical.add(sur); } } --- 68,82 ---- space = s; bottom = null; ! vertical = new HashSet<Surface>(); Collection<Surface> horizontal = new HashSet<Surface>(); Collection<Surface> surs = s.getEnvelope(); Vertex up = new Vertex(0, 0, 1); for (Surface sur : surs) { ! Vertex normal = sur.normal(); ! double dot = (normal).dot(up); ! if (Math.abs(dot) < 0.001) { vertical.add(sur); + } else if (Math.abs(dot) - 1 < 0.001) { + horizontal.add(sur); } } *************** *** 82,85 **** --- 85,92 ---- return; } + if (horizontal.size() != 2) { + log.error("Ther have to be only 2 horizontal edges in the surrounding union"); + return; + } for (Surface sur : horizontal) { if (bottom == null) { *************** *** 95,99 **** } if (bottom == null || top == null) { ! log.error("Could not find at bottom surface"); return; } else { --- 102,106 ---- } if (bottom == null || top == null) { ! log.error("Could not find a bottom surface"); return; } else { *************** *** 131,136 **** space.add(badkabine); room.setBackDomain(badkabine); ! } ! { Set<Surface> sides = new HashSet<Surface>(); Set<Surface> tops = new HashSet<Surface>(); --- 138,142 ---- space.add(badkabine); room.setBackDomain(badkabine); ! Set<Surface> sides = new HashSet<Surface>(); Set<Surface> tops = new HashSet<Surface>(); *************** *** 148,153 **** space.addAll(sides); ! //find surfacesed parting wall and bath cabin ! } } --- 154,175 ---- space.addAll(sides); ! //find surfaces containing holes ! for (Surface s : vertical) { ! for (Surface sur : s.getHoles()) { ! if (sur.getFrontDomain() != space && sur.getBackDomain() != space) { ! Surface hole = sur.copy(space); ! Geometry.holeAnalysis(hole); ! sides.clear(); ! int sign = 1; ! if (hole.getExterior().getBackDomain() == wallSystem) { ! sign = -1; ! } ! Surface t = hole.extrusion(sign * wallThickness / 1000, sides); ! sides.add(t); ! space.addAll(sides); ! Geometry.holeAnalysis(t); ! } ! } ! } } } *************** *** 157,161 **** */ private Surface makeFloor() { ! Space floor = new Space("Floor", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, true); space.add(floor); bottom = bottom.copy(space); --- 179,183 ---- */ private Surface makeFloor() { ! Space floor = new Space("Floor", Space.CONSTRUCTION, Space.SPACE_LEVEL, true); space.add(floor); bottom = bottom.copy(space); |
|
From: rimestad <rim...@us...> - 2007-05-09 09:32:45
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv821/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: added gui notice to extrude tool Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** ExtrusionTool.java 7 May 2007 13:29:48 -0000 1.56 --- ExtrusionTool.java 9 May 2007 09:32:38 -0000 1.57 *************** *** 21,24 **** --- 21,25 ---- import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.Edge; *************** *** 350,353 **** --- 351,356 ---- if (extrudeEdges.size() != Selection.primary().size()) { extrudeEdges = null; + GUI.getInstance().alert("Either no selection or a selection" + + " only consisting of edges are possible"); } else { startx = e.getX(); *************** *** 398,402 **** from = view.toPlaneCoords(startx, starty, dragplane); all = !e.isAltDown(); ! } } else { if (extrusion != null) { --- 401,407 ---- from = view.toPlaneCoords(startx, starty, dragplane); all = !e.isAltDown(); ! } else { ! GUI.getInstance().alert(target + " ain't extrudeable only Surfaces are"); ! } } else { if (extrusion != null) { |
|
From: rimestad <rim...@us...> - 2007-05-09 09:31:06
|
Update of /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32589/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: fixed wrong update when making a exisiting space into a union Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor//gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** GenericTreeView.java 8 May 2007 12:34:06 -0000 1.99 --- GenericTreeView.java 9 May 2007 09:31:05 -0000 1.100 *************** *** 646,650 **** } } else if (s.isContainer()) { ! if (((Space)userObject).isContainer()) { //the old object were a container as well ((GenericNode)getChildAt(0)).update(s.getEnvelope()); --- 646,651 ---- } } else if (s.isContainer()) { ! Space space = (Space)userObject; ! if (space.isContainer()) { //the old object were a container as well ((GenericNode)getChildAt(0)).update(s.getEnvelope()); *************** *** 654,662 **** int placement = 4; if (s.isUnion()) { placement++; - ((GenericNode)getChildAt(4)).update(s.getTransformations().stack()); } if (s.getModellor() != null) { ! if (getChildCount() == placement + 1) { ((GenericNode)getChildAt(placement)).update(s.getModellor()); } else { --- 655,670 ---- int placement = 4; if (s.isUnion()) { + if (getChildCount() >= placement + 1) { + ((GenericNode)getChildAt(placement)).update(s.getTransformations().stack()); + } else { + ContainerNode tc = new TransformationContainer("Transformations", + space.getTransformations().stack()); + this.add(tc); + model.nodesWereInserted(this, new int[]{placement}); + } placement++; } if (s.getModellor() != null) { ! if (getChildCount() >= placement + 1) { ((GenericNode)getChildAt(placement)).update(s.getModellor()); } else { |
|
From: Michael L. <he...@us...> - 2007-05-09 09:21:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28786/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Progress on move Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FinalMoveTool.java 9 May 2007 08:33:27 -0000 1.2 --- FinalMoveTool.java 9 May 2007 09:21:43 -0000 1.3 *************** *** 17,20 **** --- 17,21 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Vertex; *************** *** 27,31 **** private Collection<Geometric> geometrics; private Collection<Vertex> vertices; ! /** --- 28,35 ---- private Collection<Geometric> geometrics; private Collection<Vertex> vertices; ! private Collection<Geometric> affected; ! private Vertex from; ! private Vertex last; ! private Vertex to; /** *************** *** 48,52 **** } else { if (current != null) { ! Edge edge = new Edge(start.vertex(), current.vertex()); edge.setStrippled(true); Collection feedback = new LinkedList(); --- 52,56 ---- } else { if (current != null) { ! Edge edge = new Edge(from, to); edge.setStrippled(true); Collection feedback = new LinkedList(); *************** *** 59,62 **** --- 63,81 ---- } + private void move() { + current = current.copy(); + to = current.vertex(); + move(vertices, to.minus(last)); + last = to; + updateFeedback(); + } + + + private void move(Collection<Vertex> vertices, Vertex delta) { + for (Vertex current : vertices) { + current.move(delta.getX(), delta.getY(), delta.getZ()); + } + } + /** {@inheritDoc} */ @Override *************** *** 81,86 **** } } else { current = findIntersection(e); ! updateFeedback(); } } --- 100,106 ---- } } else { + excluded(affected); current = findIntersection(e); ! move(); } } *************** *** 96,101 **** --- 116,125 ---- geometrics.addAll(Selection.primary()); } + vertices = Geometry.collect(geometrics); + affected = getAffected(geometrics); current = findIntersection(e); start = current.copy(); + from = current.vertex(); + last = from; updateFeedback(); } else { |
|
From: Nordholt <nor...@us...> - 2007-05-09 09:05:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22432/src/net/sourceforge/bprocessor/model/modellor Modified Files: InnerWallModellor.java Log Message: final before demo Index: InnerWallModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/InnerWallModellor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InnerWallModellor.java 7 May 2007 15:44:38 -0000 1.2 --- InnerWallModellor.java 9 May 2007 09:05:43 -0000 1.3 *************** *** 50,54 **** /** The classification id for a innerwall */ ! public static final String INNERWALL_CLASS = "-205"; /** The space of this modellor */ --- 50,57 ---- /** The classification id for a innerwall */ ! public static final String INNERWALL_CLASS = "-1.-205"; ! ! /** The classification id for a innerwall */ ! public static final String EXTERIOR = "-1.-80"; /** The space of this modellor */ *************** *** 346,349 **** --- 349,353 ---- Set<Surface> envelope = space.getEnvelope(); for (Surface s : envelope) { + //support for other innerwalls Space front = s.getFrontDomain(); Space back = s.getBackDomain(); *************** *** 384,388 **** support2.move(move); net.insert(support2); ! } } } --- 388,392 ---- support2.move(move); net.insert(support2); ! } } } *************** *** 398,403 **** Classification backClass = back.getClassification(); if ((frontClass != null && backClass != null) && ! ((frontClass.getFullId(front).equalsIgnoreCase("-80") && front != space) || ! (backClass.getFullId(back).equalsIgnoreCase("-80") && back != space))) { surface = s; break; --- 402,407 ---- Classification backClass = back.getClassification(); if ((frontClass != null && backClass != null) && ! ((frontClass.getFullId(front).equalsIgnoreCase(EXTERIOR) && front != space) || ! (backClass.getFullId(back).equalsIgnoreCase(EXTERIOR) && back != space))) { surface = s; break; |