[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Space.java, 1.85, 1.86
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-10-23 06:48:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2949/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Moved removeProtected/addProtected to Space from new ExtrusionTool Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** Space.java 20 Oct 2006 17:04:45 -0000 1.85 --- Space.java 23 Oct 2006 06:48:46 -0000 1.86 *************** *** 2128,2131 **** --- 2128,2201 ---- return true; } + + /** + * Remove collection of surfaces from this space + * @param extrusion Collection of surfaces + */ + public void removeProtected(Collection extrusion) { + Iterator surfaces = extrusion.iterator(); + while (surfaces.hasNext()) { + Surface surface = (Surface) surfaces.next(); + if (surface.getOwner() == this) { + if (surface.protect()) { + this.remove(surface); + } + } + Iterator edges = surface.getEdges().iterator(); + while (edges.hasNext()) { + Edge edge = (Edge) edges.next(); + if (edge.getOwner() == this) { + if (edge.protect()) { + this.remove(edge); + } + } + Vertex from = edge.getFrom(); + if (from.getOwner() == this) { + if (from.protect()) { + this.remove(from); + } + } + Vertex to = edge.getTo(); + if (to.getOwner() == this) { + if (to.protect()) { + this.remove(to); + } + } + } + } + } + + /** + * Add extrusion to this space + * @param extrusion Collection of surfaces + */ + public void addProtected(Collection extrusion) { + Iterator surfaces = extrusion.iterator(); + while (surfaces.hasNext()) { + Surface surface = (Surface) surfaces.next(); + Iterator edges = surface.getEdges().iterator(); + while (edges.hasNext()) { + Edge edge = (Edge) edges.next(); + Vertex from = edge.getFrom(); + if (from.getOwner() == null) { + from.protect(true); + this.add(from); + } + Vertex to = edge.getTo(); + if (to.getOwner() == null) { + to.protect(true); + this.add(to); + } + if (edge.getOwner() == null) { + edge.protect(true); + this.add(edge); + } + } + if (surface.getOwner() == null) { + surface.protect(true); + this.add(surface); + } + } + } /** |