modules/validations/crossing_ways.js
// decide where to bound the structure along the way, splitting as necessary
decide where to bound the structure along the way, splitting as necessary
decide where to bound the structure along the way splitting as necessary
function determineEndpoint(edge, endNode, proposedNodeLoc) {
                        var newNode;
                        var minEdgeLength = 0.000005;
                        if (geoVecLength(crossingLoc, endNode.loc) - geoVecLength(crossingLoc, proposedNodeLoc) > minEdgeLength) {
                            newNode = osmNode();
                            graph = actionAddMidpoint({ loc: proposedNodeLoc, edge: edge }, newNode)(graph);
                        } else {
                            newNode = endNode;
                        }
                        var splitAction = actionSplit(newNode.id)
                            .limitWays(resultWayIDs); 
                        graph = splitAction(graph);
                        if (splitAction.getCreatedWayIDs().length) {
                            resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
                        }
                        return newNode;
                    }
function determineEndpoint ( edge , endNode , proposedNodeLoc ) { var newNode ; var minEdgeLength = 0.000005 ; if ( geoVecLength ( crossingLoc , endNode . loc ) - geoVecLength ( crossingLoc , proposedNodeLoc ) > minEdgeLength ) { newNode = osmNode ( ) ; graph = actionAddMidpoint ( { loc : proposedNodeLoc , edge : edge } , newNode ) ( graph ) ; } else { newNode = endNode ; } var splitAction = actionSplit ( newNode . id ) . limitWays ( resultWayIDs ) ; graph = splitAction ( graph ) ; if ( splitAction . getCreatedWayIDs ( ) . length ) { resultWayIDs . push ( splitAction . getCreatedWayIDs ( ) [ 0 ] ) ; } return newNode ; }
decide where to bound the structure along the way, splitting as necessary
decide where to bound the structure along the way splitting as necessary
// avoid creating very short edges from splitting too close to another node // split only if edge is long // if the edge is long, insert a new node // otherwise use the edge endpoint // only split selected or created ways // do the split