Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23370
Modified Files:
Space.java
Log Message:
Fixed some of the blue-surface bugs, and made so we can delete Spaces from the treeview
Index: Space.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Space.java 13 Apr 2006 14:00:44 -0000 1.26
--- Space.java 21 Apr 2006 15:24:28 -0000 1.27
***************
*** 81,85 ****
private long nextSurfaceId;
-
/** The modellor */
private Modellor modellor;
--- 81,84 ----
***************
*** 522,531 ****
if (back != null) {
back.removeSurface(surface);
! surface.setBackDomain(null);
}
Space front = surface.getFrontDomain();
if (front != null) {
front.removeSurface(surface);
! surface.setFrontDomain(null);
}
surfaces.remove(surface.getId());
--- 521,530 ----
if (back != null) {
back.removeSurface(surface);
! surface.setBackDomain(empty);
}
Space front = surface.getFrontDomain();
if (front != null) {
front.removeSurface(surface);
! surface.setFrontDomain(empty);
}
surfaces.remove(surface.getId());
***************
*** 705,730 ****
*/
public void remove(Space element) {
! Set surfaces = element.getEnvelope();
! if (surfaces != null) {
! Iterator iter = surfaces.iterator();
while (iter.hasNext()) {
Surface current = (Surface)iter.next();
Space back = current.getBackDomain();
if (back == element) {
! current.setBackDomain(null);
! } else {
! Space front = current.getFrontDomain();
! if (front == element) {
! current.setFrontDomain(null);
! }
}
}
}
!
! elements.remove(element.getId());
element.setId(null);
}
/**
* Get elements
* @return Elements
--- 704,752 ----
*/
public void remove(Space element) {
! Set surfs = element.getEnvelope();
! element.setEnvelope(new HashSet());
! if (surfs != null) {
! Iterator iter = surfs.iterator();
while (iter.hasNext()) {
Surface current = (Surface)iter.next();
Space back = current.getBackDomain();
+ Space front = current.getFrontDomain();
if (back == element) {
! current.setBackDomain(empty);
! }
! if (front == element) {
! current.setFrontDomain(empty);
}
}
}
! Space superSpace = findElement(element);
! superSpace.elements.remove(element.getId());
element.setId(null);
}
/**
+ * Finds an element contained in this space or some subspace of this space.
+ * @param element the element to be found.
+ * @return the space that directly contains the element in its elements set
+ * that space maybe a subspace of this space. If the element is not found null
+ * is returned.
+ */
+ private Space findElement(Space element) {
+ if (elements.get(element.getId()) == element) {
+ return this;
+ } else {
+ Iterator it = elements.values().iterator();
+ while (it.hasNext()) {
+ Space space = (Space)it.next();
+ Space result = space.findElement(element);
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
* Get elements
* @return Elements
***************
*** 841,845 ****
/**
! * Collects the set of vertices in this space
* @return the set of vertices
*/
--- 863,867 ----
/**
! * collects the set of vertices in this space
* @return the set of vertices
*/
|