File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,23 @@ class BuildingShapeUtils extends ShapeUtils {
8181 * @return {[DOM.Element] } array of closed ways.
8282 */
8383 static combineWays ( ways ) {
84+ cnst validWays = [ ] ;
85+
86+ for ( const way of ways ) {
87+ if ( BuildingShapeUtils . isSelfIntersecting ( w ) ) {
88+ const id = w . getAttribute ( ) ;
89+ const msg = 'Way ' + id + ' is self-intersecting' ;
90+ window . printError ( msg )
91+ } else {
92+ validWays . push ( way ) ;
93+ }
94+ }
95+
8496 const closedWays = [ ] ;
8597 const wayBegins = { } ;
8698 const wayEnds = { } ;
8799
88- ways . forEach ( w => {
100+ validWays . forEach ( w => {
89101 const firstNodeID = w . querySelector ( 'nd' ) . getAttribute ( 'ref' ) ;
90102 if ( wayBegins [ firstNodeID ] ) {
91103 wayBegins [ firstNodeID ] . push ( w ) ;
@@ -142,7 +154,7 @@ class BuildingShapeUtils extends ShapeUtils {
142154 return [ ] ;
143155 }
144156
145- ways . forEach ( w => {
157+ valisWays . forEach ( w => {
146158 const wayID = w . getAttribute ( 'id' ) ;
147159 if ( usedWays . has ( wayID ) ) {
148160 return ;
You can’t perform that action at this time.
0 commit comments