diff --git a/src/utils/utils.module.js b/src/utils/utils.module.js index 6d5ef27..6071c8f 100644 --- a/src/utils/utils.module.js +++ b/src/utils/utils.module.js @@ -60,37 +60,6 @@ const utils = { runOnTableOfValues, - categorizeIntersection(segments) { - try { - let through, xmin, xmax; - - const n = segments.length; - - const first = segments[0]; - - if (n === 1) { - through = true; - xmin = first.xmin; - xmax = first.xmax; - } /* n > 1 */ else { - const last = segments[n - 1]; - through = first.direction === last.direction; - xmin = Math.min(first.xmin, last.xmin); - xmax = Math.max(first.xmax, last.xmax); - } - - if (xmin === undefined || xmax === undefined || through === undefined || isNaN(xmin) || isNaN(xmax)) { - throw Error("categorizeIntersection failed with xmin", xmin, "and xmax", xmax); - } - - return { xmin, xmax, through }; - } catch (error) { - console.error("[categorizeIntersection] segments:", segments); - console.error("[categorizeIntersection]", error); - throw error; - } - }, - convertToGeojsonIfNecessary(input, debug = false) { if (this.isEsriJson(input, debug)) { return this.toGeoJSON(input, debug); diff --git a/src/utils/utils.test.js b/src/utils/utils.test.js index 2abf6cd..544b405 100644 --- a/src/utils/utils.test.js +++ b/src/utils/utils.test.js @@ -122,57 +122,6 @@ test("Test Intersections", ({ eq }) => { //eq(intersection.y, 41.641892470257524); }); -test("Test Categorization of Intersections", ({ eq }) => { - // through - let segments = [{ xmin: -140, xmax: -140, direction: 1 }]; - let actual = utils.categorizeIntersection(segments); - eq(actual.through, true); - eq(actual.xmin, -140); - eq(actual.xmax, -140); - - // rebound - segments = [ - { xmin: -140, xmax: -140, direction: 1 }, - { xmin: -140, xmax: -140, direction: -1 } - ]; - actual = utils.categorizeIntersection(segments); - eq(actual.through, false); - eq(actual.xmin, -140); - eq(actual.xmax, -140); - - // horizontal through - segments = [ - { xmin: -140, xmax: -140, direction: 1 }, - { xmin: -140, xmax: -130, direction: 0 }, - { xmin: -130, xmax: -130, direction: 1 } - ]; - actual = utils.categorizeIntersection(segments); - eq(actual.through, true); - eq(actual.xmin, -140); - eq(actual.xmax, -130); - - // horizontal rebound - segments = [ - { xmin: -140, xmax: -140, direction: 1 }, - { xmin: -140, xmax: -130, direction: 0 }, - { xmin: -130, xmax: -130, direction: -1 } - ]; - actual = utils.categorizeIntersection(segments); - eq(actual.through, false); - eq(actual.xmin, -140); - eq(actual.xmax, -130); - - // through with stop - segments = [ - { xmin: -140, xmax: -140, direction: 1 }, - { xmin: -140, xmax: -140, direction: 1 } - ]; - actual = utils.categorizeIntersection(segments); - eq(actual.through, true); - eq(actual.xmin, -140); - eq(actual.xmax, -140); -}); - test("get constructor names", ({ eq }) => { eq(utils.getConstructorName(new ArrayBuffer()), "ArrayBuffer"); });