@@ -150,15 +150,10 @@ export function validationCurbNodes(context) {
150
150
if ( hasCurbNode ( node , graph ) ) {
151
151
return ; // Exit if curb already exists
152
152
}
153
- // Determine if the node is the first or last in the way
154
- const isFirstNode = way . nodes [ 0 ] === node . id ;
155
- const isLastNode = way . nodes [ way . nodes . length - 1 ] === node . id ;
156
153
// Calculate the position for the new curb node
157
154
const nodeIndex = way . nodes . indexOf ( node . id ) ;
158
- const adjacentNode = isFirstNode
159
- ? graph . entity ( way . nodes [ nodeIndex + 1 ] )
160
- : graph . entity ( way . nodes [ nodeIndex - 1 ] ) ;
161
- const newNodePosition = calculateNewNodePosition ( node , adjacentNode , 1 , isLastNode ) ;
155
+ const adjacentNode = graph . entity ( way . nodes [ nodeIndex + 1 ] || way . nodes [ nodeIndex - 1 ] ) ;
156
+ const newNodePosition = calculateNewNodePosition ( node , adjacentNode , 1 ) ;
162
157
// Find connected ways and select the appropriate tags
163
158
const connectedWays = graph . parentWays ( node ) ;
164
159
let connectedWayTags = null ;
@@ -168,10 +163,6 @@ export function validationCurbNodes(context) {
168
163
break ;
169
164
}
170
165
}
171
- if ( ! connectedWayTags ) {
172
- console . warn ( 'No connected non-crossing way found' ) ;
173
- return ;
174
- }
175
166
// Create a new curb node with the specified curb tags
176
167
const newCurbNode = osmNode ( { loc : [ newNodePosition . lon , newNodePosition . lat ] , tags : curbTags , visible : true } ) ;
177
168
// Add the new node to the graph
@@ -313,4 +304,4 @@ export function validationCurbNodes(context) {
313
304
validation . type = type ;
314
305
315
306
return validation ;
316
- }
307
+ }
0 commit comments