src/util/PolygonSplitter.js
function (start, end, points, iMap, resultPolygon, polygonHashMap) {
                var pass = false;
                var len = points.length;
                var containsPole = false;

                if (end < start) {
                    end += len;
                }

                for (var i = start; i <= end; i++) {
                    var idx = i % len;
                    var pt = points[idx];
                    var intersection = iMap.get(idx);

                    if (intersection) {
                        if (intersection.visited) {
                            break;
                        }

                        resultPolygon.push(pt);
                        polygonHashMap.set(resultPolygon.length - 1, intersection);

                        if (intersection.forPole) {
                            containsPole = true;
                        }
                        else {
                            if (pass) {
                                i = intersection.linkTo - 1;
                                if (i + 1 === start) {
                                    break;
                                }
                            }
                            pass = !pass;
                            intersection.visited = true;
                        }
                    }
                    else {
                        resultPolygon.push(pt);
                    }
                }

                return containsPole;
            }
function (start, end, points, iMap, resultPolygon, polygonHashMap) {
                var pass = false;
                var len = points.length;
                var containsPole = false;

                if (end < start) {
                    end += len;
                }

                for (var i = start; i <= end; i++) {
                    var idx = i % len;
                    var pt = points[idx];
                    var intersection = iMap.get(idx);

                    if (intersection) {
                        if (intersection.visited) {
                            break;
                        }

                        resultPolygon.push(pt);
                        polygonHashMap.set(resultPolygon.length - 1, intersection);

                        if (intersection.forPole) {
                            containsPole = true;
                        }
                        else {
                            if (pass) {
                                i = intersection.linkTo - 1;
                                if (i + 1 === start) {
                                    break;
                                }
                            }
                            pass = !pass;
                            intersection.visited = true;
                        }
                    }
                    else {
                        resultPolygon.push(pt);
                    }
                }

                return containsPole;
            }
function ( start , end , points , iMap , resultPolygon , polygonHashMap ) { var pass = false ; var len = points . length ; var containsPole = false ; if ( end < start ) { end += len ; } for ( var i = start ; i <= end ; i ++ ) { var idx = i % len ; var pt = points [ idx ] ; var intersection = iMap . get ( idx ) ; if ( intersection ) { if ( intersection . visited ) { break ; } resultPolygon . push ( pt ) ; polygonHashMap . set ( resultPolygon . length - 1 , intersection ) ; if ( intersection . forPole ) { containsPole = true ; } else { if ( pass ) { i = intersection . linkTo - 1 ; if ( i + 1 === start ) { break ; } } pass = ! pass ; intersection . visited = true ; } } else { resultPolygon . push ( pt ) ; } } return containsPole ; }
Internal. Applications should not call this method.
Paths from a start intersection index to an end intersection index and makes a polygon and a hashMap
with the intersection indices
@param {Number} start the index of a start type intersection
@param {Number} end the index of an end type intersection
@param {Location[] | Position[]} points
@param {HashMap} iMap
@param {Location[] | Position[]} resultPolygon an empty array to store the resulting polygon
@param {HashMap} polygonHashMap a hash map to record the indices of the intersections in the polygon
@returns {Boolean} true if the polygon contains a pole
Internal . Applications should not call this method . Paths from a start intersection index to an end intersection index and makes a polygon and a hashMap with the intersection indices