[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Surface.java, 1.145, 1.146 Space.jav
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-03-26 10:48:34
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29196/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Space.java Log Message: added a mergeSpaceAssignment to surface as a static method taking three surfaces merging the space assignments from the first two into the last one... used it when deleting edges resulting i merging of surfaces... Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -d -r1.145 -r1.146 *** Surface.java 22 Mar 2007 11:44:29 -0000 1.145 --- Surface.java 26 Mar 2007 10:48:22 -0000 1.146 *************** *** 1980,1982 **** --- 1980,2037 ---- return result; } + + /** + * Make space assignments merge + * @param sur1 a surface + * @param sur2 another surface + * @param onto the surface to give the resulting assigment + */ + public static void mergeSpaceAssign(Surface sur1, Surface sur2, Surface onto) { + Space front = null; + Space back = null; + if (sur1.direction(Project.getInstance().getActiveCoordinateSystem()) == + sur2.direction(Project.getInstance().getActiveCoordinateSystem())) { + //the surfaces have the same turning so front is front + if (sur1.getFrontDomain() == sur2.getFrontDomain()) { + front = sur1.getFrontDomain(); + } else if (sur1.getFrontDomain() == sur1.getOwner().empty) { + front = sur2.getFrontDomain(); + } else if (sur2.getFrontDomain() == sur2.getOwner().empty) { + front = sur1.getFrontDomain(); + } + + if (sur1.getBackDomain() == sur2.getBackDomain()) { + back = sur1.getBackDomain(); + } else if (sur1.getBackDomain() == sur1.getOwner().empty) { + back = sur2.getBackDomain(); + } else if (sur2.getBackDomain() == sur2.getOwner().empty) { + back = sur1.getBackDomain(); + } + } else { + if (sur1.getFrontDomain() == sur2.getBackDomain()) { + front = sur1.getFrontDomain(); + } else if (sur1.getFrontDomain() == sur1.getOwner().empty) { + front = sur2.getBackDomain(); + } else if (sur2.getBackDomain() == sur2.getOwner().empty) { + front = sur1.getFrontDomain(); + } + + if (sur1.getBackDomain() == sur2.getFrontDomain()) { + back = sur1.getBackDomain(); + } else if (sur1.getBackDomain() == sur1.getOwner().empty) { + back = sur2.getFrontDomain(); + } else if (sur2.getFrontDomain() == sur2.getOwner().empty) { + back = sur1.getBackDomain(); + } + } + + if (onto.direction(Project.getInstance().getActiveCoordinateSystem()) == + sur1.direction(Project.getInstance().getActiveCoordinateSystem())) { + onto.setFrontDomain(front); + onto.setBackDomain(back); + } else { + onto.setFrontDomain(back); + onto.setBackDomain(front); + } + } } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** Space.java 22 Mar 2007 14:37:26 -0000 1.125 --- Space.java 26 Mar 2007 10:48:23 -0000 1.126 *************** *** 844,849 **** if (s1.getExterior() != null) { s1.getExterior().addHole(surface); - // FIXME: Assign spaces } } } --- 844,849 ---- if (s1.getExterior() != null) { s1.getExterior().addHole(surface); } + Surface.mergeSpaceAssign(s1, s2, surface); } } |