From 6d5fda5827ef99a1732d3c03a9cd21af3fe1b9a8 Mon Sep 17 00:00:00 2001 From: James Beard Date: Tue, 31 Oct 2023 12:21:59 +1100 Subject: [PATCH] Migrating isobands and isolines to use the third party marchingsquares library from NPM. This commit supercedes PR #1801 which is a few years old now. Resolves #1797 based on a test case mentioned in that issue (added to unit tests in isobands). Slight changes to resulting coordinates in most fixtures, though all fixtures verified visually using geojson.io --- packages/turf-isobands/index.ts | 53 +- .../lib/marchingsquares-isobands.js | 3454 ----------------- packages/turf-isobands/marchingsquares.d.ts | 1 + packages/turf-isobands/package.json | 1 + packages/turf-isobands/test.js | 17 +- packages/turf-isobands/test/in/matrix2.json | 33 +- .../turf-isobands/test/out/bigMatrix.geojson | 487 +-- .../turf-isobands/test/out/matrix1.geojson | 1 + .../turf-isobands/test/out/matrix2.geojson | 25 +- .../turf-isobands/test/out/pointGrid.geojson | 39 +- packages/turf-isolines/bench.js | 2 +- packages/turf-isolines/index.ts | 38 +- packages/turf-isolines/package.json | 1 + packages/turf-isolines/test.js | 1 + .../turf-isolines/test/out/bigMatrix.geojson | 1923 ++++----- .../turf-isolines/test/out/matrix1.geojson | 67 +- .../turf-isolines/test/out/matrix2.geojson | 129 +- .../turf-isolines/test/out/pointGrid.geojson | 157 +- yarn.lock | 5 + 19 files changed, 1605 insertions(+), 4829 deletions(-) delete mode 100644 packages/turf-isobands/lib/marchingsquares-isobands.js create mode 100644 packages/turf-isobands/marchingsquares.d.ts diff --git a/packages/turf-isobands/index.ts b/packages/turf-isobands/index.ts index 9884ca02c9..3f3f28227b 100644 --- a/packages/turf-isobands/index.ts +++ b/packages/turf-isobands/index.ts @@ -21,7 +21,7 @@ import { } from "geojson"; import gridToMatrix from "./lib/grid-to-matrix"; -import isoBands from "./lib/marchingsquares-isobands"; +const { isoBands } = require("marchingsquares"); type GroupRingProps = { [prop: string]: string }; type GroupedRings = @@ -163,20 +163,21 @@ function rescaleContours( const scaleX = originalWidth / matrixWidth; const scaleY = originalHeigth / matrixHeight; - const resize = (point: Position) => { - point[0] = point[0] * scaleX + x0; - point[1] = point[1] * scaleY + y0; - }; - // resize and shift each point/line of the isobands - contours.forEach(function (contour) { - (contour.groupedRings as Position[][][]).forEach(function (lineRingSet) { - lineRingSet.forEach(function (lineRing) { - lineRing.forEach(resize); - }); - }); + return contours.map(function (contour) { + contour.groupedRings = (contour.groupedRings as Position[][][]).map( + function (lineRingSet) { + return lineRingSet.map(function (lineRing) { + return lineRing.map((point: Position) => [ + point[0] * scaleX + x0, + point[1] * scaleY + y0, + ]); + }); + } + ); + + return contour; }); - return contours; } /* utility functions */ @@ -189,32 +190,18 @@ function rescaleContours( * @returns {Array} array of the input LineString ordered by area */ function orderByArea(ringsCoords: Position[][]): Position[][] { - const ringsWithArea: { ring: Position[]; area: number }[] = []; - const areas: number[] = []; - ringsCoords.forEach(function (coords) { - // const poly = polygon([points]); - const ringArea = area(polygon([coords])); - // create an array of areas value - areas.push(ringArea); + const ringsWithArea = ringsCoords.map(function (coords) { // associate each lineRing with its area - ringsWithArea.push({ ring: coords, area: ringArea }); + return { ring: coords, area: area(polygon([coords])) }; }); - areas.sort(function (a, b) { + ringsWithArea.sort(function (a, b) { // bigger --> smaller - return b - a; + return b.area - a.area; }); // create a new array of linearRings coordinates ordered by their area - const orderedByArea: Position[][] = []; - areas.forEach(function (area) { - for (let lr = 0; lr < ringsWithArea.length; lr++) { - if (ringsWithArea[lr].area === area) { - orderedByArea.push(ringsWithArea[lr].ring); - ringsWithArea.splice(lr, 1); - break; - } - } + return ringsWithArea.map(function (x) { + return x.ring; }); - return orderedByArea; } /** diff --git a/packages/turf-isobands/lib/marchingsquares-isobands.js b/packages/turf-isobands/lib/marchingsquares-isobands.js deleted file mode 100644 index 768d30dc3d..0000000000 --- a/packages/turf-isobands/lib/marchingsquares-isobands.js +++ /dev/null @@ -1,3454 +0,0 @@ -/*! - * @license GNU Affero General Public License. - * Copyright (c) 2015, 2015 Ronny Lorenz - * v. 1.2.0 - * https://github.com/RaumZeit/MarchingSquares.js - * - * MarchingSquaresJS is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MarchingSquaresJS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * As additional permission under GNU Affero General Public License version 3 - * section 7, third-party projects (personal or commercial) may distribute, - * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the - * requirement that said third-party project for that reason alone becomes - * subject to any requirement of the GNU Affero General Public License version 3. - * Any modifications to MarchingSquaresJS, however, must be shared with the public - * and made available. - * - * In summary this: - * - allows you to use MarchingSquaresJS at no cost - * - allows you to use MarchingSquaresJS for both personal and commercial purposes - * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any - * license as long as this license notice is included - * - enables you to keep the source code of your program that uses MarchingSquaresJS - * undisclosed - * - forces you to share any modifications you have made to MarchingSquaresJS, - * e.g. bug-fixes - * - * You should have received a copy of the GNU Affero General Public License - * along with MarchingSquaresJS. If not, see . - */ -var defaultSettings = { - successCallback: null, - verbose: false, - polygons: false, -}; - -var settings = {}; - -/* - Compute isobands(s) of a scalar 2D field given a certain - threshold and a bandwidth by applying the Marching Squares - Algorithm. The function returns a list of path coordinates - either for individual polygons within each grid cell, or the - outline of connected polygons. -*/ -export default function isoBands(data, minV, bandwidth, options) { - /* process options */ - options = options ? options : {}; - - var optionKeys = Object.keys(defaultSettings); - - for (var i = 0; i < optionKeys.length; i++) { - var key = optionKeys[i]; - var val = options[key]; - val = - typeof val !== "undefined" && val !== null ? val : defaultSettings[key]; - - settings[key] = val; - } - - if (settings.verbose) - console.log( - "MarchingSquaresJS-isoBands: computing isobands for [" + - minV + - ":" + - (minV + bandwidth) + - "]" - ); - - var grid = computeBandGrid(data, minV, bandwidth); - - var ret; - if (settings.polygons) { - if (settings.verbose) - console.log( - "MarchingSquaresJS-isoBands: returning single polygons for each grid cell" - ); - ret = BandGrid2Areas(grid); - } else { - if (settings.verbose) - console.log( - "MarchingSquaresJS-isoBands: returning polygon paths for entire data grid" - ); - ret = BandGrid2AreaPaths(grid); - } - - if (typeof settings.successCallback === "function") - settings.successCallback(ret); - - return ret; -} - -/* - Thats all for the public interface, below follows the actual - implementation -*/ - -/* Some private variables */ -var Node0 = 64, - Node1 = 16, - Node2 = 4, - Node3 = 1; - -/* - The look-up tables for tracing back the contour path - of isoBands -*/ - -var isoBandNextXTL = []; -var isoBandNextYTL = []; -var isoBandNextOTL = []; - -var isoBandNextXTR = []; -var isoBandNextYTR = []; -var isoBandNextOTR = []; - -var isoBandNextXRT = []; -var isoBandNextYRT = []; -var isoBandNextORT = []; - -var isoBandNextXRB = []; -var isoBandNextYRB = []; -var isoBandNextORB = []; - -var isoBandNextXBL = []; -var isoBandNextYBL = []; -var isoBandNextOBL = []; - -var isoBandNextXBR = []; -var isoBandNextYBR = []; -var isoBandNextOBR = []; - -var isoBandNextXLT = []; -var isoBandNextYLT = []; -var isoBandNextOLT = []; - -var isoBandNextXLB = []; -var isoBandNextYLB = []; -var isoBandNextOLB = []; - -isoBandNextXRT[85] = isoBandNextXRB[85] = -1; -isoBandNextYRT[85] = isoBandNextYRB[85] = 0; -isoBandNextORT[85] = isoBandNextORB[85] = 1; -isoBandNextXLT[85] = isoBandNextXLB[85] = 1; -isoBandNextYLT[85] = isoBandNextYLB[85] = 0; -isoBandNextOLT[85] = isoBandNextOLB[85] = 1; - -isoBandNextXTL[85] = isoBandNextXTR[85] = 0; -isoBandNextYTL[85] = isoBandNextYTR[85] = -1; -isoBandNextOTL[85] = isoBandNextOBL[85] = 0; -isoBandNextXBR[85] = isoBandNextXBL[85] = 0; -isoBandNextYBR[85] = isoBandNextYBL[85] = 1; -isoBandNextOTR[85] = isoBandNextOBR[85] = 1; - -/* triangle cases */ -isoBandNextXLB[1] = isoBandNextXLB[169] = 0; -isoBandNextYLB[1] = isoBandNextYLB[169] = -1; -isoBandNextOLB[1] = isoBandNextOLB[169] = 0; -isoBandNextXBL[1] = isoBandNextXBL[169] = -1; -isoBandNextYBL[1] = isoBandNextYBL[169] = 0; -isoBandNextOBL[1] = isoBandNextOBL[169] = 0; - -isoBandNextXRB[4] = isoBandNextXRB[166] = 0; -isoBandNextYRB[4] = isoBandNextYRB[166] = -1; -isoBandNextORB[4] = isoBandNextORB[166] = 1; -isoBandNextXBR[4] = isoBandNextXBR[166] = 1; -isoBandNextYBR[4] = isoBandNextYBR[166] = 0; -isoBandNextOBR[4] = isoBandNextOBR[166] = 0; - -isoBandNextXRT[16] = isoBandNextXRT[154] = 0; -isoBandNextYRT[16] = isoBandNextYRT[154] = 1; -isoBandNextORT[16] = isoBandNextORT[154] = 1; -isoBandNextXTR[16] = isoBandNextXTR[154] = 1; -isoBandNextYTR[16] = isoBandNextYTR[154] = 0; -isoBandNextOTR[16] = isoBandNextOTR[154] = 1; - -isoBandNextXLT[64] = isoBandNextXLT[106] = 0; -isoBandNextYLT[64] = isoBandNextYLT[106] = 1; -isoBandNextOLT[64] = isoBandNextOLT[106] = 0; -isoBandNextXTL[64] = isoBandNextXTL[106] = -1; -isoBandNextYTL[64] = isoBandNextYTL[106] = 0; -isoBandNextOTL[64] = isoBandNextOTL[106] = 1; - -/* single trapezoid cases */ -isoBandNextXLT[2] = isoBandNextXLT[168] = 0; -isoBandNextYLT[2] = isoBandNextYLT[168] = -1; -isoBandNextOLT[2] = isoBandNextOLT[168] = 1; -isoBandNextXLB[2] = isoBandNextXLB[168] = 0; -isoBandNextYLB[2] = isoBandNextYLB[168] = -1; -isoBandNextOLB[2] = isoBandNextOLB[168] = 0; -isoBandNextXBL[2] = isoBandNextXBL[168] = -1; -isoBandNextYBL[2] = isoBandNextYBL[168] = 0; -isoBandNextOBL[2] = isoBandNextOBL[168] = 0; -isoBandNextXBR[2] = isoBandNextXBR[168] = -1; -isoBandNextYBR[2] = isoBandNextYBR[168] = 0; -isoBandNextOBR[2] = isoBandNextOBR[168] = 1; - -isoBandNextXRT[8] = isoBandNextXRT[162] = 0; -isoBandNextYRT[8] = isoBandNextYRT[162] = -1; -isoBandNextORT[8] = isoBandNextORT[162] = 0; -isoBandNextXRB[8] = isoBandNextXRB[162] = 0; -isoBandNextYRB[8] = isoBandNextYRB[162] = -1; -isoBandNextORB[8] = isoBandNextORB[162] = 1; -isoBandNextXBL[8] = isoBandNextXBL[162] = 1; -isoBandNextYBL[8] = isoBandNextYBL[162] = 0; -isoBandNextOBL[8] = isoBandNextOBL[162] = 1; -isoBandNextXBR[8] = isoBandNextXBR[162] = 1; -isoBandNextYBR[8] = isoBandNextYBR[162] = 0; -isoBandNextOBR[8] = isoBandNextOBR[162] = 0; - -isoBandNextXRT[32] = isoBandNextXRT[138] = 0; -isoBandNextYRT[32] = isoBandNextYRT[138] = 1; -isoBandNextORT[32] = isoBandNextORT[138] = 1; -isoBandNextXRB[32] = isoBandNextXRB[138] = 0; -isoBandNextYRB[32] = isoBandNextYRB[138] = 1; -isoBandNextORB[32] = isoBandNextORB[138] = 0; -isoBandNextXTL[32] = isoBandNextXTL[138] = 1; -isoBandNextYTL[32] = isoBandNextYTL[138] = 0; -isoBandNextOTL[32] = isoBandNextOTL[138] = 0; -isoBandNextXTR[32] = isoBandNextXTR[138] = 1; -isoBandNextYTR[32] = isoBandNextYTR[138] = 0; -isoBandNextOTR[32] = isoBandNextOTR[138] = 1; - -isoBandNextXLB[128] = isoBandNextXLB[42] = 0; -isoBandNextYLB[128] = isoBandNextYLB[42] = 1; -isoBandNextOLB[128] = isoBandNextOLB[42] = 1; -isoBandNextXLT[128] = isoBandNextXLT[42] = 0; -isoBandNextYLT[128] = isoBandNextYLT[42] = 1; -isoBandNextOLT[128] = isoBandNextOLT[42] = 0; -isoBandNextXTL[128] = isoBandNextXTL[42] = -1; -isoBandNextYTL[128] = isoBandNextYTL[42] = 0; -isoBandNextOTL[128] = isoBandNextOTL[42] = 1; -isoBandNextXTR[128] = isoBandNextXTR[42] = -1; -isoBandNextYTR[128] = isoBandNextYTR[42] = 0; -isoBandNextOTR[128] = isoBandNextOTR[42] = 0; - -/* single rectangle cases */ -isoBandNextXRB[5] = isoBandNextXRB[165] = -1; -isoBandNextYRB[5] = isoBandNextYRB[165] = 0; -isoBandNextORB[5] = isoBandNextORB[165] = 0; -isoBandNextXLB[5] = isoBandNextXLB[165] = 1; -isoBandNextYLB[5] = isoBandNextYLB[165] = 0; -isoBandNextOLB[5] = isoBandNextOLB[165] = 0; - -isoBandNextXBR[20] = isoBandNextXBR[150] = 0; -isoBandNextYBR[20] = isoBandNextYBR[150] = 1; -isoBandNextOBR[20] = isoBandNextOBR[150] = 1; -isoBandNextXTR[20] = isoBandNextXTR[150] = 0; -isoBandNextYTR[20] = isoBandNextYTR[150] = -1; -isoBandNextOTR[20] = isoBandNextOTR[150] = 1; - -isoBandNextXRT[80] = isoBandNextXRT[90] = -1; -isoBandNextYRT[80] = isoBandNextYRT[90] = 0; -isoBandNextORT[80] = isoBandNextORT[90] = 1; -isoBandNextXLT[80] = isoBandNextXLT[90] = 1; -isoBandNextYLT[80] = isoBandNextYLT[90] = 0; -isoBandNextOLT[80] = isoBandNextOLT[90] = 1; - -isoBandNextXBL[65] = isoBandNextXBL[105] = 0; -isoBandNextYBL[65] = isoBandNextYBL[105] = 1; -isoBandNextOBL[65] = isoBandNextOBL[105] = 0; -isoBandNextXTL[65] = isoBandNextXTL[105] = 0; -isoBandNextYTL[65] = isoBandNextYTL[105] = -1; -isoBandNextOTL[65] = isoBandNextOTL[105] = 0; - -isoBandNextXRT[160] = isoBandNextXRT[10] = -1; -isoBandNextYRT[160] = isoBandNextYRT[10] = 0; -isoBandNextORT[160] = isoBandNextORT[10] = 1; -isoBandNextXRB[160] = isoBandNextXRB[10] = -1; -isoBandNextYRB[160] = isoBandNextYRB[10] = 0; -isoBandNextORB[160] = isoBandNextORB[10] = 0; -isoBandNextXLB[160] = isoBandNextXLB[10] = 1; -isoBandNextYLB[160] = isoBandNextYLB[10] = 0; -isoBandNextOLB[160] = isoBandNextOLB[10] = 0; -isoBandNextXLT[160] = isoBandNextXLT[10] = 1; -isoBandNextYLT[160] = isoBandNextYLT[10] = 0; -isoBandNextOLT[160] = isoBandNextOLT[10] = 1; - -isoBandNextXBR[130] = isoBandNextXBR[40] = 0; -isoBandNextYBR[130] = isoBandNextYBR[40] = 1; -isoBandNextOBR[130] = isoBandNextOBR[40] = 1; -isoBandNextXBL[130] = isoBandNextXBL[40] = 0; -isoBandNextYBL[130] = isoBandNextYBL[40] = 1; -isoBandNextOBL[130] = isoBandNextOBL[40] = 0; -isoBandNextXTL[130] = isoBandNextXTL[40] = 0; -isoBandNextYTL[130] = isoBandNextYTL[40] = -1; -isoBandNextOTL[130] = isoBandNextOTL[40] = 0; -isoBandNextXTR[130] = isoBandNextXTR[40] = 0; -isoBandNextYTR[130] = isoBandNextYTR[40] = -1; -isoBandNextOTR[130] = isoBandNextOTR[40] = 1; - -/* single hexagon cases */ -isoBandNextXRB[37] = isoBandNextXRB[133] = 0; -isoBandNextYRB[37] = isoBandNextYRB[133] = 1; -isoBandNextORB[37] = isoBandNextORB[133] = 1; -isoBandNextXLB[37] = isoBandNextXLB[133] = 0; -isoBandNextYLB[37] = isoBandNextYLB[133] = 1; -isoBandNextOLB[37] = isoBandNextOLB[133] = 0; -isoBandNextXTL[37] = isoBandNextXTL[133] = -1; -isoBandNextYTL[37] = isoBandNextYTL[133] = 0; -isoBandNextOTL[37] = isoBandNextOTL[133] = 0; -isoBandNextXTR[37] = isoBandNextXTR[133] = 1; -isoBandNextYTR[37] = isoBandNextYTR[133] = 0; -isoBandNextOTR[37] = isoBandNextOTR[133] = 0; - -isoBandNextXBR[148] = isoBandNextXBR[22] = -1; -isoBandNextYBR[148] = isoBandNextYBR[22] = 0; -isoBandNextOBR[148] = isoBandNextOBR[22] = 0; -isoBandNextXLB[148] = isoBandNextXLB[22] = 0; -isoBandNextYLB[148] = isoBandNextYLB[22] = -1; -isoBandNextOLB[148] = isoBandNextOLB[22] = 1; -isoBandNextXLT[148] = isoBandNextXLT[22] = 0; -isoBandNextYLT[148] = isoBandNextYLT[22] = 1; -isoBandNextOLT[148] = isoBandNextOLT[22] = 1; -isoBandNextXTR[148] = isoBandNextXTR[22] = -1; -isoBandNextYTR[148] = isoBandNextYTR[22] = 0; -isoBandNextOTR[148] = isoBandNextOTR[22] = 1; - -isoBandNextXRT[82] = isoBandNextXRT[88] = 0; -isoBandNextYRT[82] = isoBandNextYRT[88] = -1; -isoBandNextORT[82] = isoBandNextORT[88] = 1; -isoBandNextXBR[82] = isoBandNextXBR[88] = 1; -isoBandNextYBR[82] = isoBandNextYBR[88] = 0; -isoBandNextOBR[82] = isoBandNextOBR[88] = 1; -isoBandNextXBL[82] = isoBandNextXBL[88] = -1; -isoBandNextYBL[82] = isoBandNextYBL[88] = 0; -isoBandNextOBL[82] = isoBandNextOBL[88] = 1; -isoBandNextXLT[82] = isoBandNextXLT[88] = 0; -isoBandNextYLT[82] = isoBandNextYLT[88] = -1; -isoBandNextOLT[82] = isoBandNextOLT[88] = 0; - -isoBandNextXRT[73] = isoBandNextXRT[97] = 0; -isoBandNextYRT[73] = isoBandNextYRT[97] = 1; -isoBandNextORT[73] = isoBandNextORT[97] = 0; -isoBandNextXRB[73] = isoBandNextXRB[97] = 0; -isoBandNextYRB[73] = isoBandNextYRB[97] = -1; -isoBandNextORB[73] = isoBandNextORB[97] = 0; -isoBandNextXBL[73] = isoBandNextXBL[97] = 1; -isoBandNextYBL[73] = isoBandNextYBL[97] = 0; -isoBandNextOBL[73] = isoBandNextOBL[97] = 0; -isoBandNextXTL[73] = isoBandNextXTL[97] = 1; -isoBandNextYTL[73] = isoBandNextYTL[97] = 0; -isoBandNextOTL[73] = isoBandNextOTL[97] = 1; - -isoBandNextXRT[145] = isoBandNextXRT[25] = 0; -isoBandNextYRT[145] = isoBandNextYRT[25] = -1; -isoBandNextORT[145] = isoBandNextORT[25] = 0; -isoBandNextXBL[145] = isoBandNextXBL[25] = 1; -isoBandNextYBL[145] = isoBandNextYBL[25] = 0; -isoBandNextOBL[145] = isoBandNextOBL[25] = 1; -isoBandNextXLB[145] = isoBandNextXLB[25] = 0; -isoBandNextYLB[145] = isoBandNextYLB[25] = 1; -isoBandNextOLB[145] = isoBandNextOLB[25] = 1; -isoBandNextXTR[145] = isoBandNextXTR[25] = -1; -isoBandNextYTR[145] = isoBandNextYTR[25] = 0; -isoBandNextOTR[145] = isoBandNextOTR[25] = 0; - -isoBandNextXRB[70] = isoBandNextXRB[100] = 0; -isoBandNextYRB[70] = isoBandNextYRB[100] = 1; -isoBandNextORB[70] = isoBandNextORB[100] = 0; -isoBandNextXBR[70] = isoBandNextXBR[100] = -1; -isoBandNextYBR[70] = isoBandNextYBR[100] = 0; -isoBandNextOBR[70] = isoBandNextOBR[100] = 1; -isoBandNextXLT[70] = isoBandNextXLT[100] = 0; -isoBandNextYLT[70] = isoBandNextYLT[100] = -1; -isoBandNextOLT[70] = isoBandNextOLT[100] = 1; -isoBandNextXTL[70] = isoBandNextXTL[100] = 1; -isoBandNextYTL[70] = isoBandNextYTL[100] = 0; -isoBandNextOTL[70] = isoBandNextOTL[100] = 0; - -/* single pentagon cases */ -isoBandNextXRB[101] = isoBandNextXRB[69] = 0; -isoBandNextYRB[101] = isoBandNextYRB[69] = 1; -isoBandNextORB[101] = isoBandNextORB[69] = 0; -isoBandNextXTL[101] = isoBandNextXTL[69] = 1; -isoBandNextYTL[101] = isoBandNextYTL[69] = 0; -isoBandNextOTL[101] = isoBandNextOTL[69] = 0; - -isoBandNextXLB[149] = isoBandNextXLB[21] = 0; -isoBandNextYLB[149] = isoBandNextYLB[21] = 1; -isoBandNextOLB[149] = isoBandNextOLB[21] = 1; -isoBandNextXTR[149] = isoBandNextXTR[21] = -1; -isoBandNextYTR[149] = isoBandNextYTR[21] = 0; -isoBandNextOTR[149] = isoBandNextOTR[21] = 0; - -isoBandNextXBR[86] = isoBandNextXBR[84] = -1; -isoBandNextYBR[86] = isoBandNextYBR[84] = 0; -isoBandNextOBR[86] = isoBandNextOBR[84] = 1; -isoBandNextXLT[86] = isoBandNextXLT[84] = 0; -isoBandNextYLT[86] = isoBandNextYLT[84] = -1; -isoBandNextOLT[86] = isoBandNextOLT[84] = 1; - -isoBandNextXRT[89] = isoBandNextXRT[81] = 0; -isoBandNextYRT[89] = isoBandNextYRT[81] = -1; -isoBandNextORT[89] = isoBandNextORT[81] = 0; -isoBandNextXBL[89] = isoBandNextXBL[81] = 1; -isoBandNextYBL[89] = isoBandNextYBL[81] = 0; -isoBandNextOBL[89] = isoBandNextOBL[81] = 1; - -isoBandNextXRT[96] = isoBandNextXRT[74] = 0; -isoBandNextYRT[96] = isoBandNextYRT[74] = 1; -isoBandNextORT[96] = isoBandNextORT[74] = 0; -isoBandNextXRB[96] = isoBandNextXRB[74] = -1; -isoBandNextYRB[96] = isoBandNextYRB[74] = 0; -isoBandNextORB[96] = isoBandNextORB[74] = 1; -isoBandNextXLT[96] = isoBandNextXLT[74] = 1; -isoBandNextYLT[96] = isoBandNextYLT[74] = 0; -isoBandNextOLT[96] = isoBandNextOLT[74] = 0; -isoBandNextXTL[96] = isoBandNextXTL[74] = 1; -isoBandNextYTL[96] = isoBandNextYTL[74] = 0; -isoBandNextOTL[96] = isoBandNextOTL[74] = 1; - -isoBandNextXRT[24] = isoBandNextXRT[146] = 0; -isoBandNextYRT[24] = isoBandNextYRT[146] = -1; -isoBandNextORT[24] = isoBandNextORT[146] = 1; -isoBandNextXBR[24] = isoBandNextXBR[146] = 1; -isoBandNextYBR[24] = isoBandNextYBR[146] = 0; -isoBandNextOBR[24] = isoBandNextOBR[146] = 1; -isoBandNextXBL[24] = isoBandNextXBL[146] = 0; -isoBandNextYBL[24] = isoBandNextYBL[146] = 1; -isoBandNextOBL[24] = isoBandNextOBL[146] = 1; -isoBandNextXTR[24] = isoBandNextXTR[146] = 0; -isoBandNextYTR[24] = isoBandNextYTR[146] = -1; -isoBandNextOTR[24] = isoBandNextOTR[146] = 0; - -isoBandNextXRB[6] = isoBandNextXRB[164] = -1; -isoBandNextYRB[6] = isoBandNextYRB[164] = 0; -isoBandNextORB[6] = isoBandNextORB[164] = 1; -isoBandNextXBR[6] = isoBandNextXBR[164] = -1; -isoBandNextYBR[6] = isoBandNextYBR[164] = 0; -isoBandNextOBR[6] = isoBandNextOBR[164] = 0; -isoBandNextXLB[6] = isoBandNextXLB[164] = 0; -isoBandNextYLB[6] = isoBandNextYLB[164] = -1; -isoBandNextOLB[6] = isoBandNextOLB[164] = 1; -isoBandNextXLT[6] = isoBandNextXLT[164] = 1; -isoBandNextYLT[6] = isoBandNextYLT[164] = 0; -isoBandNextOLT[6] = isoBandNextOLT[164] = 0; - -isoBandNextXBL[129] = isoBandNextXBL[41] = 0; -isoBandNextYBL[129] = isoBandNextYBL[41] = 1; -isoBandNextOBL[129] = isoBandNextOBL[41] = 1; -isoBandNextXLB[129] = isoBandNextXLB[41] = 0; -isoBandNextYLB[129] = isoBandNextYLB[41] = 1; -isoBandNextOLB[129] = isoBandNextOLB[41] = 0; -isoBandNextXTL[129] = isoBandNextXTL[41] = -1; -isoBandNextYTL[129] = isoBandNextYTL[41] = 0; -isoBandNextOTL[129] = isoBandNextOTL[41] = 0; -isoBandNextXTR[129] = isoBandNextXTR[41] = 0; -isoBandNextYTR[129] = isoBandNextYTR[41] = -1; -isoBandNextOTR[129] = isoBandNextOTR[41] = 0; - -isoBandNextXBR[66] = isoBandNextXBR[104] = 0; -isoBandNextYBR[66] = isoBandNextYBR[104] = 1; -isoBandNextOBR[66] = isoBandNextOBR[104] = 0; -isoBandNextXBL[66] = isoBandNextXBL[104] = -1; -isoBandNextYBL[66] = isoBandNextYBL[104] = 0; -isoBandNextOBL[66] = isoBandNextOBL[104] = 1; -isoBandNextXLT[66] = isoBandNextXLT[104] = 0; -isoBandNextYLT[66] = isoBandNextYLT[104] = -1; -isoBandNextOLT[66] = isoBandNextOLT[104] = 0; -isoBandNextXTL[66] = isoBandNextXTL[104] = 0; -isoBandNextYTL[66] = isoBandNextYTL[104] = -1; -isoBandNextOTL[66] = isoBandNextOTL[104] = 1; - -isoBandNextXRT[144] = isoBandNextXRT[26] = -1; -isoBandNextYRT[144] = isoBandNextYRT[26] = 0; -isoBandNextORT[144] = isoBandNextORT[26] = 0; -isoBandNextXLB[144] = isoBandNextXLB[26] = 1; -isoBandNextYLB[144] = isoBandNextYLB[26] = 0; -isoBandNextOLB[144] = isoBandNextOLB[26] = 1; -isoBandNextXLT[144] = isoBandNextXLT[26] = 0; -isoBandNextYLT[144] = isoBandNextYLT[26] = 1; -isoBandNextOLT[144] = isoBandNextOLT[26] = 1; -isoBandNextXTR[144] = isoBandNextXTR[26] = -1; -isoBandNextYTR[144] = isoBandNextYTR[26] = 0; -isoBandNextOTR[144] = isoBandNextOTR[26] = 1; - -isoBandNextXRB[36] = isoBandNextXRB[134] = 0; -isoBandNextYRB[36] = isoBandNextYRB[134] = 1; -isoBandNextORB[36] = isoBandNextORB[134] = 1; -isoBandNextXBR[36] = isoBandNextXBR[134] = 0; -isoBandNextYBR[36] = isoBandNextYBR[134] = 1; -isoBandNextOBR[36] = isoBandNextOBR[134] = 0; -isoBandNextXTL[36] = isoBandNextXTL[134] = 0; -isoBandNextYTL[36] = isoBandNextYTL[134] = -1; -isoBandNextOTL[36] = isoBandNextOTL[134] = 1; -isoBandNextXTR[36] = isoBandNextXTR[134] = 1; -isoBandNextYTR[36] = isoBandNextYTR[134] = 0; -isoBandNextOTR[36] = isoBandNextOTR[134] = 0; - -isoBandNextXRT[9] = isoBandNextXRT[161] = -1; -isoBandNextYRT[9] = isoBandNextYRT[161] = 0; -isoBandNextORT[9] = isoBandNextORT[161] = 0; -isoBandNextXRB[9] = isoBandNextXRB[161] = 0; -isoBandNextYRB[9] = isoBandNextYRB[161] = -1; -isoBandNextORB[9] = isoBandNextORB[161] = 0; -isoBandNextXBL[9] = isoBandNextXBL[161] = 1; -isoBandNextYBL[9] = isoBandNextYBL[161] = 0; -isoBandNextOBL[9] = isoBandNextOBL[161] = 0; -isoBandNextXLB[9] = isoBandNextXLB[161] = 1; -isoBandNextYLB[9] = isoBandNextYLB[161] = 0; -isoBandNextOLB[9] = isoBandNextOLB[161] = 1; - -/* 8-sided cases */ -isoBandNextXRT[136] = 0; -isoBandNextYRT[136] = 1; -isoBandNextORT[136] = 1; -isoBandNextXRB[136] = 0; -isoBandNextYRB[136] = 1; -isoBandNextORB[136] = 0; -isoBandNextXBR[136] = -1; -isoBandNextYBR[136] = 0; -isoBandNextOBR[136] = 1; -isoBandNextXBL[136] = -1; -isoBandNextYBL[136] = 0; -isoBandNextOBL[136] = 0; -isoBandNextXLB[136] = 0; -isoBandNextYLB[136] = -1; -isoBandNextOLB[136] = 0; -isoBandNextXLT[136] = 0; -isoBandNextYLT[136] = -1; -isoBandNextOLT[136] = 1; -isoBandNextXTL[136] = 1; -isoBandNextYTL[136] = 0; -isoBandNextOTL[136] = 0; -isoBandNextXTR[136] = 1; -isoBandNextYTR[136] = 0; -isoBandNextOTR[136] = 1; - -isoBandNextXRT[34] = 0; -isoBandNextYRT[34] = -1; -isoBandNextORT[34] = 0; -isoBandNextXRB[34] = 0; -isoBandNextYRB[34] = -1; -isoBandNextORB[34] = 1; -isoBandNextXBR[34] = 1; -isoBandNextYBR[34] = 0; -isoBandNextOBR[34] = 0; -isoBandNextXBL[34] = 1; -isoBandNextYBL[34] = 0; -isoBandNextOBL[34] = 1; -isoBandNextXLB[34] = 0; -isoBandNextYLB[34] = 1; -isoBandNextOLB[34] = 1; -isoBandNextXLT[34] = 0; -isoBandNextYLT[34] = 1; -isoBandNextOLT[34] = 0; -isoBandNextXTL[34] = -1; -isoBandNextYTL[34] = 0; -isoBandNextOTL[34] = 1; -isoBandNextXTR[34] = -1; -isoBandNextYTR[34] = 0; -isoBandNextOTR[34] = 0; - -isoBandNextXRT[35] = 0; -isoBandNextYRT[35] = 1; -isoBandNextORT[35] = 1; -isoBandNextXRB[35] = 0; -isoBandNextYRB[35] = -1; -isoBandNextORB[35] = 1; -isoBandNextXBR[35] = 1; -isoBandNextYBR[35] = 0; -isoBandNextOBR[35] = 0; -isoBandNextXBL[35] = -1; -isoBandNextYBL[35] = 0; -isoBandNextOBL[35] = 0; -isoBandNextXLB[35] = 0; -isoBandNextYLB[35] = -1; -isoBandNextOLB[35] = 0; -isoBandNextXLT[35] = 0; -isoBandNextYLT[35] = 1; -isoBandNextOLT[35] = 0; -isoBandNextXTL[35] = -1; -isoBandNextYTL[35] = 0; -isoBandNextOTL[35] = 1; -isoBandNextXTR[35] = 1; -isoBandNextYTR[35] = 0; -isoBandNextOTR[35] = 1; - -/* 6-sided cases */ -isoBandNextXRT[153] = 0; -isoBandNextYRT[153] = 1; -isoBandNextORT[153] = 1; -isoBandNextXBL[153] = -1; -isoBandNextYBL[153] = 0; -isoBandNextOBL[153] = 0; -isoBandNextXLB[153] = 0; -isoBandNextYLB[153] = -1; -isoBandNextOLB[153] = 0; -isoBandNextXTR[153] = 1; -isoBandNextYTR[153] = 0; -isoBandNextOTR[153] = 1; - -isoBandNextXRB[102] = 0; -isoBandNextYRB[102] = -1; -isoBandNextORB[102] = 1; -isoBandNextXBR[102] = 1; -isoBandNextYBR[102] = 0; -isoBandNextOBR[102] = 0; -isoBandNextXLT[102] = 0; -isoBandNextYLT[102] = 1; -isoBandNextOLT[102] = 0; -isoBandNextXTL[102] = -1; -isoBandNextYTL[102] = 0; -isoBandNextOTL[102] = 1; - -isoBandNextXRT[155] = 0; -isoBandNextYRT[155] = -1; -isoBandNextORT[155] = 0; -isoBandNextXBL[155] = 1; -isoBandNextYBL[155] = 0; -isoBandNextOBL[155] = 1; -isoBandNextXLB[155] = 0; -isoBandNextYLB[155] = 1; -isoBandNextOLB[155] = 1; -isoBandNextXTR[155] = -1; -isoBandNextYTR[155] = 0; -isoBandNextOTR[155] = 0; - -isoBandNextXRB[103] = 0; -isoBandNextYRB[103] = 1; -isoBandNextORB[103] = 0; -isoBandNextXBR[103] = -1; -isoBandNextYBR[103] = 0; -isoBandNextOBR[103] = 1; -isoBandNextXLT[103] = 0; -isoBandNextYLT[103] = -1; -isoBandNextOLT[103] = 1; -isoBandNextXTL[103] = 1; -isoBandNextYTL[103] = 0; -isoBandNextOTL[103] = 0; - -/* 7-sided cases */ -isoBandNextXRT[152] = 0; -isoBandNextYRT[152] = 1; -isoBandNextORT[152] = 1; -isoBandNextXBR[152] = -1; -isoBandNextYBR[152] = 0; -isoBandNextOBR[152] = 1; -isoBandNextXBL[152] = -1; -isoBandNextYBL[152] = 0; -isoBandNextOBL[152] = 0; -isoBandNextXLB[152] = 0; -isoBandNextYLB[152] = -1; -isoBandNextOLB[152] = 0; -isoBandNextXLT[152] = 0; -isoBandNextYLT[152] = -1; -isoBandNextOLT[152] = 1; -isoBandNextXTR[152] = 1; -isoBandNextYTR[152] = 0; -isoBandNextOTR[152] = 1; - -isoBandNextXRT[156] = 0; -isoBandNextYRT[156] = -1; -isoBandNextORT[156] = 1; -isoBandNextXBR[156] = 1; -isoBandNextYBR[156] = 0; -isoBandNextOBR[156] = 1; -isoBandNextXBL[156] = -1; -isoBandNextYBL[156] = 0; -isoBandNextOBL[156] = 0; -isoBandNextXLB[156] = 0; -isoBandNextYLB[156] = -1; -isoBandNextOLB[156] = 0; -isoBandNextXLT[156] = 0; -isoBandNextYLT[156] = 1; -isoBandNextOLT[156] = 1; -isoBandNextXTR[156] = -1; -isoBandNextYTR[156] = 0; -isoBandNextOTR[156] = 1; - -isoBandNextXRT[137] = 0; -isoBandNextYRT[137] = 1; -isoBandNextORT[137] = 1; -isoBandNextXRB[137] = 0; -isoBandNextYRB[137] = 1; -isoBandNextORB[137] = 0; -isoBandNextXBL[137] = -1; -isoBandNextYBL[137] = 0; -isoBandNextOBL[137] = 0; -isoBandNextXLB[137] = 0; -isoBandNextYLB[137] = -1; -isoBandNextOLB[137] = 0; -isoBandNextXTL[137] = 1; -isoBandNextYTL[137] = 0; -isoBandNextOTL[137] = 0; -isoBandNextXTR[137] = 1; -isoBandNextYTR[137] = 0; -isoBandNextOTR[137] = 1; - -isoBandNextXRT[139] = 0; -isoBandNextYRT[139] = 1; -isoBandNextORT[139] = 1; -isoBandNextXRB[139] = 0; -isoBandNextYRB[139] = -1; -isoBandNextORB[139] = 0; -isoBandNextXBL[139] = 1; -isoBandNextYBL[139] = 0; -isoBandNextOBL[139] = 0; -isoBandNextXLB[139] = 0; -isoBandNextYLB[139] = 1; -isoBandNextOLB[139] = 0; -isoBandNextXTL[139] = -1; -isoBandNextYTL[139] = 0; -isoBandNextOTL[139] = 0; -isoBandNextXTR[139] = 1; -isoBandNextYTR[139] = 0; -isoBandNextOTR[139] = 1; - -isoBandNextXRT[98] = 0; -isoBandNextYRT[98] = -1; -isoBandNextORT[98] = 0; -isoBandNextXRB[98] = 0; -isoBandNextYRB[98] = -1; -isoBandNextORB[98] = 1; -isoBandNextXBR[98] = 1; -isoBandNextYBR[98] = 0; -isoBandNextOBR[98] = 0; -isoBandNextXBL[98] = 1; -isoBandNextYBL[98] = 0; -isoBandNextOBL[98] = 1; -isoBandNextXLT[98] = 0; -isoBandNextYLT[98] = 1; -isoBandNextOLT[98] = 0; -isoBandNextXTL[98] = -1; -isoBandNextYTL[98] = 0; -isoBandNextOTL[98] = 1; - -isoBandNextXRT[99] = 0; -isoBandNextYRT[99] = 1; -isoBandNextORT[99] = 0; -isoBandNextXRB[99] = 0; -isoBandNextYRB[99] = -1; -isoBandNextORB[99] = 1; -isoBandNextXBR[99] = 1; -isoBandNextYBR[99] = 0; -isoBandNextOBR[99] = 0; -isoBandNextXBL[99] = -1; -isoBandNextYBL[99] = 0; -isoBandNextOBL[99] = 1; -isoBandNextXLT[99] = 0; -isoBandNextYLT[99] = -1; -isoBandNextOLT[99] = 0; -isoBandNextXTL[99] = 1; -isoBandNextYTL[99] = 0; -isoBandNextOTL[99] = 1; - -isoBandNextXRB[38] = 0; -isoBandNextYRB[38] = -1; -isoBandNextORB[38] = 1; -isoBandNextXBR[38] = 1; -isoBandNextYBR[38] = 0; -isoBandNextOBR[38] = 0; -isoBandNextXLB[38] = 0; -isoBandNextYLB[38] = 1; -isoBandNextOLB[38] = 1; -isoBandNextXLT[38] = 0; -isoBandNextYLT[38] = 1; -isoBandNextOLT[38] = 0; -isoBandNextXTL[38] = -1; -isoBandNextYTL[38] = 0; -isoBandNextOTL[38] = 1; -isoBandNextXTR[38] = -1; -isoBandNextYTR[38] = 0; -isoBandNextOTR[38] = 0; - -isoBandNextXRB[39] = 0; -isoBandNextYRB[39] = 1; -isoBandNextORB[39] = 1; -isoBandNextXBR[39] = -1; -isoBandNextYBR[39] = 0; -isoBandNextOBR[39] = 0; -isoBandNextXLB[39] = 0; -isoBandNextYLB[39] = -1; -isoBandNextOLB[39] = 1; -isoBandNextXLT[39] = 0; -isoBandNextYLT[39] = 1; -isoBandNextOLT[39] = 0; -isoBandNextXTL[39] = -1; -isoBandNextYTL[39] = 0; -isoBandNextOTL[39] = 1; -isoBandNextXTR[39] = 1; -isoBandNextYTR[39] = 0; -isoBandNextOTR[39] = 0; - -/* - Define helper functions for the polygon_table - */ - -/* triangle cases */ -var p00 = function (cell) { - return [ - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - ]; -}; -var p01 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - ]; -}; -var p02 = function (cell) { - return [ - [cell.topright, 1], - [1, 1], - [1, cell.righttop], - ]; -}; -var p03 = function (cell) { - return [ - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* trapezoid cases */ -var p04 = function (cell) { - return [ - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - ]; -}; -var p05 = function (cell) { - return [ - [cell.bottomright, 0], - [cell.bottomleft, 0], - [1, cell.righttop], - [1, cell.rightbottom], - ]; -}; -var p06 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -var p07 = function (cell) { - return [ - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* rectangle cases */ -var p08 = function (cell) { - return [ - [0, 0], - [0, cell.leftbottom], - [1, cell.rightbottom], - [1, 0], - ]; -}; -var p09 = function (cell) { - return [ - [1, 0], - [cell.bottomright, 0], - [cell.topright, 1], - [1, 1], - ]; -}; -var p10 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [0, cell.lefttop], - [0, 1], - ]; -}; -var p11 = function (cell) { - return [ - [cell.bottomleft, 0], - [0, 0], - [0, 1], - [cell.topleft, 1], - ]; -}; -var p12 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [0, cell.leftbottom], - [0, cell.lefttop], - ]; -}; -var p13 = function (cell) { - return [ - [cell.topleft, 1], - [cell.topright, 1], - [cell.bottomright, 0], - [cell.bottomleft, 0], - ]; -}; -/* square case */ -var p14 = function () { - return [ - [0, 0], - [0, 1], - [1, 1], - [1, 0], - ]; -}; -/* pentagon cases */ -var p15 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [0, 0], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1211 || 1011 */ -var p16 = function (cell) { - return [ - [cell.topright, 1], - [1, 1], - [1, 0], - [0, 0], - [0, cell.leftbottom], - ]; -}; -/* 2111 || 0111 */ -var p17 = function (cell) { - return [ - [1, 0], - [cell.bottomright, 0], - [0, cell.lefttop], - [0, 1], - [1, 1], - ]; -}; -/* 1112 || 1110 */ -var p18 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomleft, 0], - [0, 0], - [0, 1], - ]; -}; -/* 1121 || 1101 */ -var p19 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1200 || 1022 */ -var p20 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [cell.topright, 1], - ]; -}; -/* 0120 || 2102 */ -var p21 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - ]; -}; -/* 0012 || 2210 */ -var p22 = function (cell) { - return [ - [cell.topright, 1], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topleft, 1], - ]; -}; -/* 2001 || 0221 */ -var p23 = function (cell) { - return [ - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1002 || 1220 */ -var p24 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topright, 1], - ]; -}; -/* 2100 || 0122 */ -var p25 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 0210 || 2012 */ -var p26 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - ]; -}; -/* 0021 || 2201 */ -/*hexagon cases */ -var p27 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 0211 || 2011 */ -var p28 = function (cell) { - return [ - [1, 1], - [1, 0], - [cell.bottomright, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topright, 1], - ]; -}; -/* 2110 || 0112 */ -var p29 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.lefttop], - [0, 1], - ]; -}; -/* 1102 || 1120 */ -var p30 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomleft, 0], - [0, 0], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1021 || 1201 */ -var p31 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topright, 1], - ]; -}; -/* 2101 || 0121 */ -var p32 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1012 || 1210 */ -/* 8-sided cases */ -var p33 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* flipped == 1 state for 0202 and 2020 */ -/* 6-sided cases */ -var p34 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topright, 1], - ]; -}; -/* 0101 with flipped == 1 || 2121 with flipped == 1 */ -var p35 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1010 with flipped == 1 || 1212 with flipped == 1 */ -/* 7-sided cases */ -var p36 = function (cell) { - return [ - [1, 1], - [1, cell.righttop], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topright, 1], - ]; -}; -/* 2120 with flipped == 1 || 0102 with flipped == 1 */ -var p37 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomleft, 0], - [0, 0], - [0, cell.leftbottom], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 2021 with flipped == 1 || 0201 with flipped == 1 */ -var p38 = function (cell) { - return [ - [1, cell.righttop], - [1, cell.rightbottom], - [cell.bottomright, 0], - [cell.bottomleft, 0], - [0, cell.lefttop], - [0, 1], - [cell.topleft, 1], - ]; -}; -/* 1202 with flipped == 1 || 1020 with flipped == 1 */ -var p39 = function (cell) { - return [ - [1, cell.rightbottom], - [1, 0], - [cell.bottomright, 0], - [0, cell.leftbottom], - [0, cell.lefttop], - [cell.topleft, 1], - [cell.topright, 1], - ]; -}; -/* 0212 with flipped == 1 || 2010 with flipped == 1 */ - -/* - The lookup tables for edge number given the polygon - is entered at a specific location -*/ - -var isoBandEdgeRT = []; -var isoBandEdgeRB = []; -var isoBandEdgeBR = []; -var isoBandEdgeBL = []; -var isoBandEdgeLB = []; -var isoBandEdgeLT = []; -var isoBandEdgeTL = []; -var isoBandEdgeTR = []; - -/* triangle cases */ -isoBandEdgeBL[1] = isoBandEdgeLB[1] = 18; -isoBandEdgeBL[169] = isoBandEdgeLB[169] = 18; -isoBandEdgeBR[4] = isoBandEdgeRB[4] = 12; -isoBandEdgeBR[166] = isoBandEdgeRB[166] = 12; -isoBandEdgeRT[16] = isoBandEdgeTR[16] = 4; -isoBandEdgeRT[154] = isoBandEdgeTR[154] = 4; -isoBandEdgeLT[64] = isoBandEdgeTL[64] = 22; -isoBandEdgeLT[106] = isoBandEdgeTL[106] = 22; - -/* trapezoid cases */ -isoBandEdgeBR[2] = isoBandEdgeLT[2] = 17; -isoBandEdgeBL[2] = isoBandEdgeLB[2] = 18; -isoBandEdgeBR[168] = isoBandEdgeLT[168] = 17; -isoBandEdgeBL[168] = isoBandEdgeLB[168] = 18; -isoBandEdgeRT[8] = isoBandEdgeBL[8] = 9; -isoBandEdgeRB[8] = isoBandEdgeBR[8] = 12; -isoBandEdgeRT[162] = isoBandEdgeBL[162] = 9; -isoBandEdgeRB[162] = isoBandEdgeBR[162] = 12; -isoBandEdgeRT[32] = isoBandEdgeTR[32] = 4; -isoBandEdgeRB[32] = isoBandEdgeTL[32] = 1; -isoBandEdgeRT[138] = isoBandEdgeTR[138] = 4; -isoBandEdgeRB[138] = isoBandEdgeTL[138] = 1; -isoBandEdgeLB[128] = isoBandEdgeTR[128] = 21; -isoBandEdgeLT[128] = isoBandEdgeTL[128] = 22; -isoBandEdgeLB[42] = isoBandEdgeTR[42] = 21; -isoBandEdgeLT[42] = isoBandEdgeTL[42] = 22; - -/* rectangle cases */ -isoBandEdgeRB[5] = isoBandEdgeLB[5] = 14; -isoBandEdgeRB[165] = isoBandEdgeLB[165] = 14; -isoBandEdgeBR[20] = isoBandEdgeTR[20] = 6; -isoBandEdgeBR[150] = isoBandEdgeTR[150] = 6; -isoBandEdgeRT[80] = isoBandEdgeLT[80] = 11; -isoBandEdgeRT[90] = isoBandEdgeLT[90] = 11; -isoBandEdgeBL[65] = isoBandEdgeTL[65] = 3; -isoBandEdgeBL[105] = isoBandEdgeTL[105] = 3; -isoBandEdgeRT[160] = isoBandEdgeLT[160] = 11; -isoBandEdgeRB[160] = isoBandEdgeLB[160] = 14; -isoBandEdgeRT[10] = isoBandEdgeLT[10] = 11; -isoBandEdgeRB[10] = isoBandEdgeLB[10] = 14; -isoBandEdgeBR[130] = isoBandEdgeTR[130] = 6; -isoBandEdgeBL[130] = isoBandEdgeTL[130] = 3; -isoBandEdgeBR[40] = isoBandEdgeTR[40] = 6; -isoBandEdgeBL[40] = isoBandEdgeTL[40] = 3; - -/* pentagon cases */ -isoBandEdgeRB[101] = isoBandEdgeTL[101] = 1; -isoBandEdgeRB[69] = isoBandEdgeTL[69] = 1; -isoBandEdgeLB[149] = isoBandEdgeTR[149] = 21; -isoBandEdgeLB[21] = isoBandEdgeTR[21] = 21; -isoBandEdgeBR[86] = isoBandEdgeLT[86] = 17; -isoBandEdgeBR[84] = isoBandEdgeLT[84] = 17; -isoBandEdgeRT[89] = isoBandEdgeBL[89] = 9; -isoBandEdgeRT[81] = isoBandEdgeBL[81] = 9; -isoBandEdgeRT[96] = isoBandEdgeTL[96] = 0; -isoBandEdgeRB[96] = isoBandEdgeLT[96] = 15; -isoBandEdgeRT[74] = isoBandEdgeTL[74] = 0; -isoBandEdgeRB[74] = isoBandEdgeLT[74] = 15; -isoBandEdgeRT[24] = isoBandEdgeBR[24] = 8; -isoBandEdgeBL[24] = isoBandEdgeTR[24] = 7; -isoBandEdgeRT[146] = isoBandEdgeBR[146] = 8; -isoBandEdgeBL[146] = isoBandEdgeTR[146] = 7; -isoBandEdgeRB[6] = isoBandEdgeLT[6] = 15; -isoBandEdgeBR[6] = isoBandEdgeLB[6] = 16; -isoBandEdgeRB[164] = isoBandEdgeLT[164] = 15; -isoBandEdgeBR[164] = isoBandEdgeLB[164] = 16; -isoBandEdgeBL[129] = isoBandEdgeTR[129] = 7; -isoBandEdgeLB[129] = isoBandEdgeTL[129] = 20; -isoBandEdgeBL[41] = isoBandEdgeTR[41] = 7; -isoBandEdgeLB[41] = isoBandEdgeTL[41] = 20; -isoBandEdgeBR[66] = isoBandEdgeTL[66] = 2; -isoBandEdgeBL[66] = isoBandEdgeLT[66] = 19; -isoBandEdgeBR[104] = isoBandEdgeTL[104] = 2; -isoBandEdgeBL[104] = isoBandEdgeLT[104] = 19; -isoBandEdgeRT[144] = isoBandEdgeLB[144] = 10; -isoBandEdgeLT[144] = isoBandEdgeTR[144] = 23; -isoBandEdgeRT[26] = isoBandEdgeLB[26] = 10; -isoBandEdgeLT[26] = isoBandEdgeTR[26] = 23; -isoBandEdgeRB[36] = isoBandEdgeTR[36] = 5; -isoBandEdgeBR[36] = isoBandEdgeTL[36] = 2; -isoBandEdgeRB[134] = isoBandEdgeTR[134] = 5; -isoBandEdgeBR[134] = isoBandEdgeTL[134] = 2; -isoBandEdgeRT[9] = isoBandEdgeLB[9] = 10; -isoBandEdgeRB[9] = isoBandEdgeBL[9] = 13; -isoBandEdgeRT[161] = isoBandEdgeLB[161] = 10; -isoBandEdgeRB[161] = isoBandEdgeBL[161] = 13; - -/* hexagon cases */ -isoBandEdgeRB[37] = isoBandEdgeTR[37] = 5; -isoBandEdgeLB[37] = isoBandEdgeTL[37] = 20; -isoBandEdgeRB[133] = isoBandEdgeTR[133] = 5; -isoBandEdgeLB[133] = isoBandEdgeTL[133] = 20; -isoBandEdgeBR[148] = isoBandEdgeLB[148] = 16; -isoBandEdgeLT[148] = isoBandEdgeTR[148] = 23; -isoBandEdgeBR[22] = isoBandEdgeLB[22] = 16; -isoBandEdgeLT[22] = isoBandEdgeTR[22] = 23; -isoBandEdgeRT[82] = isoBandEdgeBR[82] = 8; -isoBandEdgeBL[82] = isoBandEdgeLT[82] = 19; -isoBandEdgeRT[88] = isoBandEdgeBR[88] = 8; -isoBandEdgeBL[88] = isoBandEdgeLT[88] = 19; -isoBandEdgeRT[73] = isoBandEdgeTL[73] = 0; -isoBandEdgeRB[73] = isoBandEdgeBL[73] = 13; -isoBandEdgeRT[97] = isoBandEdgeTL[97] = 0; -isoBandEdgeRB[97] = isoBandEdgeBL[97] = 13; -isoBandEdgeRT[145] = isoBandEdgeBL[145] = 9; -isoBandEdgeLB[145] = isoBandEdgeTR[145] = 21; -isoBandEdgeRT[25] = isoBandEdgeBL[25] = 9; -isoBandEdgeLB[25] = isoBandEdgeTR[25] = 21; -isoBandEdgeRB[70] = isoBandEdgeTL[70] = 1; -isoBandEdgeBR[70] = isoBandEdgeLT[70] = 17; -isoBandEdgeRB[100] = isoBandEdgeTL[100] = 1; -isoBandEdgeBR[100] = isoBandEdgeLT[100] = 17; - -/* 8-sided cases */ -isoBandEdgeRT[34] = isoBandEdgeBL[34] = 9; -isoBandEdgeRB[34] = isoBandEdgeBR[34] = 12; -isoBandEdgeLB[34] = isoBandEdgeTR[34] = 21; -isoBandEdgeLT[34] = isoBandEdgeTL[34] = 22; -isoBandEdgeRT[136] = isoBandEdgeTR[136] = 4; -isoBandEdgeRB[136] = isoBandEdgeTL[136] = 1; -isoBandEdgeBR[136] = isoBandEdgeLT[136] = 17; -isoBandEdgeBL[136] = isoBandEdgeLB[136] = 18; -isoBandEdgeRT[35] = isoBandEdgeTR[35] = 4; -isoBandEdgeRB[35] = isoBandEdgeBR[35] = 12; -isoBandEdgeBL[35] = isoBandEdgeLB[35] = 18; -isoBandEdgeLT[35] = isoBandEdgeTL[35] = 22; - -/* 6-sided cases */ -isoBandEdgeRT[153] = isoBandEdgeTR[153] = 4; -isoBandEdgeBL[153] = isoBandEdgeLB[153] = 18; -isoBandEdgeRB[102] = isoBandEdgeBR[102] = 12; -isoBandEdgeLT[102] = isoBandEdgeTL[102] = 22; -isoBandEdgeRT[155] = isoBandEdgeBL[155] = 9; -isoBandEdgeLB[155] = isoBandEdgeTR[155] = 23; -isoBandEdgeRB[103] = isoBandEdgeTL[103] = 1; -isoBandEdgeBR[103] = isoBandEdgeLT[103] = 17; - -/* 7-sided cases */ -isoBandEdgeRT[152] = isoBandEdgeTR[152] = 4; -isoBandEdgeBR[152] = isoBandEdgeLT[152] = 17; -isoBandEdgeBL[152] = isoBandEdgeLB[152] = 18; -isoBandEdgeRT[156] = isoBandEdgeBR[156] = 8; -isoBandEdgeBL[156] = isoBandEdgeLB[156] = 18; -isoBandEdgeLT[156] = isoBandEdgeTR[156] = 23; -isoBandEdgeRT[137] = isoBandEdgeTR[137] = 4; -isoBandEdgeRB[137] = isoBandEdgeTL[137] = 1; -isoBandEdgeBL[137] = isoBandEdgeLB[137] = 18; -isoBandEdgeRT[139] = isoBandEdgeTR[139] = 4; -isoBandEdgeRB[139] = isoBandEdgeBL[139] = 13; -isoBandEdgeLB[139] = isoBandEdgeTL[139] = 20; -isoBandEdgeRT[98] = isoBandEdgeBL[98] = 9; -isoBandEdgeRB[98] = isoBandEdgeBR[98] = 12; -isoBandEdgeLT[98] = isoBandEdgeTL[98] = 22; -isoBandEdgeRT[99] = isoBandEdgeTL[99] = 0; -isoBandEdgeRB[99] = isoBandEdgeBR[99] = 12; -isoBandEdgeBL[99] = isoBandEdgeLT[99] = 19; -isoBandEdgeRB[38] = isoBandEdgeBR[38] = 12; -isoBandEdgeLB[38] = isoBandEdgeTR[38] = 21; -isoBandEdgeLT[38] = isoBandEdgeTL[38] = 22; -isoBandEdgeRB[39] = isoBandEdgeTR[39] = 5; -isoBandEdgeBR[39] = isoBandEdgeLB[39] = 16; -isoBandEdgeLT[39] = isoBandEdgeTL[39] = 22; - -/* - The lookup tables for all different polygons that - may appear within a grid cell -*/ - -var polygon_table = []; - -/* triangle cases */ -polygon_table[1] = polygon_table[169] = p00; /* 2221 || 0001 */ -polygon_table[4] = polygon_table[166] = p01; /* 2212 || 0010 */ -polygon_table[16] = polygon_table[154] = p02; /* 2122 || 0100 */ -polygon_table[64] = polygon_table[106] = p03; /* 1222 || 1000 */ - -/* trapezoid cases */ -polygon_table[168] = polygon_table[2] = p04; /* 2220 || 0002 */ -polygon_table[162] = polygon_table[8] = p05; /* 2202 || 0020 */ -polygon_table[138] = polygon_table[32] = p06; /* 2022 || 0200 */ -polygon_table[42] = polygon_table[128] = p07; /* 0222 || 2000 */ - -/* rectangle cases */ -polygon_table[5] = polygon_table[165] = p08; /* 0011 || 2211 */ -polygon_table[20] = polygon_table[150] = p09; /* 0110 || 2112 */ -polygon_table[80] = polygon_table[90] = p10; /* 1100 || 1122 */ -polygon_table[65] = polygon_table[105] = p11; /* 1001 || 1221 */ -polygon_table[160] = polygon_table[10] = p12; /* 2200 || 0022 */ -polygon_table[130] = polygon_table[40] = p13; /* 2002 || 0220 */ - -/* square case */ -polygon_table[85] = p14; /* 1111 */ - -/* pentagon cases */ -polygon_table[101] = polygon_table[69] = p15; /* 1211 || 1011 */ -polygon_table[149] = polygon_table[21] = p16; /* 2111 || 0111 */ -polygon_table[86] = polygon_table[84] = p17; /* 1112 || 1110 */ -polygon_table[89] = polygon_table[81] = p18; /* 1121 || 1101 */ -polygon_table[96] = polygon_table[74] = p19; /* 1200 || 1022 */ -polygon_table[24] = polygon_table[146] = p20; /* 0120 || 2102 */ -polygon_table[6] = polygon_table[164] = p21; /* 0012 || 2210 */ -polygon_table[129] = polygon_table[41] = p22; /* 2001 || 0221 */ -polygon_table[66] = polygon_table[104] = p23; /* 1002 || 1220 */ -polygon_table[144] = polygon_table[26] = p24; /* 2100 || 0122 */ -polygon_table[36] = polygon_table[134] = p25; /* 0210 || 2012 */ -polygon_table[9] = polygon_table[161] = p26; /* 0021 || 2201 */ - -/* hexagon cases */ -polygon_table[37] = polygon_table[133] = p27; /* 0211 || 2011 */ -polygon_table[148] = polygon_table[22] = p28; /* 2110 || 0112 */ -polygon_table[82] = polygon_table[88] = p29; /* 1102 || 1120 */ -polygon_table[73] = polygon_table[97] = p30; /* 1021 || 1201 */ -polygon_table[145] = polygon_table[25] = p31; /* 2101 || 0121 */ -polygon_table[70] = polygon_table[100] = p32; /* 1012 || 1210 */ - -/* 8-sided cases */ -polygon_table[34] = function (c) { - return [p07(c), p05(c)]; -}; /* 0202 || 2020 with flipped == 0 */ -polygon_table[35] = p33; /* flipped == 1 state for 0202 and 2020 */ -polygon_table[136] = function (c) { - return [p06(c), p04(c)]; -}; /* 2020 || 0202 with flipped == 0 */ - -/* 6-sided cases */ -polygon_table[153] = function (c) { - return [p02(c), p00(c)]; -}; /* 0101 with flipped == 0 || 2121 with flipped == 2 */ -polygon_table[102] = function (c) { - return [p01(c), p03(c)]; -}; /* 1010 with flipped == 0 || 1212 with flipped == 2 */ -polygon_table[155] = p34; /* 0101 with flipped == 1 || 2121 with flipped == 1 */ -polygon_table[103] = p35; /* 1010 with flipped == 1 || 1212 with flipped == 1 */ - -/* 7-sided cases */ -polygon_table[152] = function (c) { - return [p02(c), p04(c)]; -}; /* 2120 with flipped == 2 || 0102 with flipped == 0 */ -polygon_table[156] = p36; /* 2120 with flipped == 1 || 0102 with flipped == 1 */ -polygon_table[137] = function (c) { - return [p06(c), p00(c)]; -}; /* 2021 with flipped == 2 || 0201 with flipped == 0 */ -polygon_table[139] = p37; /* 2021 with flipped == 1 || 0201 with flipped == 1 */ -polygon_table[98] = function (c) { - return [p05(c), p03(c)]; -}; /* 1202 with flipped == 2 || 1020 with flipped == 0 */ -polygon_table[99] = p38; /* 1202 with flipped == 1 || 1020 with flipped == 1 */ -polygon_table[38] = function (c) { - return [p01(c), p07(c)]; -}; /* 0212 with flipped == 2 || 2010 with flipped == 0 */ -polygon_table[39] = p39; /* 0212 with flipped == 1 || 2010 with flipped == 1 */ - -/* -#################################### -Some small helper functions -#################################### -*/ - -/* assume that x1 == 1 && x0 == 0 */ -function interpolateX(y, y0, y1) { - return (y - y0) / (y1 - y0); -} - -function isArray(myArray) { - return myArray.constructor.toString().indexOf("Array") > -1; -} - -/* -#################################### -Below is the actual Marching Squares implementation -#################################### -*/ - -function computeBandGrid(data, minV, bandwidth) { - var rows = data.length - 1; - var cols = data[0].length - 1; - var BandGrid = { rows: rows, cols: cols, cells: [] }; - - var maxV = minV + Math.abs(bandwidth); - - for (var j = 0; j < rows; ++j) { - BandGrid.cells[j] = []; - for (var i = 0; i < cols; ++i) { - /* compose the 4-trit corner representation */ - var cval = 0; - - var tl = data[j + 1][i]; - var tr = data[j + 1][i + 1]; - var br = data[j][i + 1]; - var bl = data[j][i]; - - if (isNaN(tl) || isNaN(tr) || isNaN(br) || isNaN(bl)) { - continue; - } - - cval |= tl < minV ? 0 : tl > maxV ? 128 : 64; - cval |= tr < minV ? 0 : tr > maxV ? 32 : 16; - cval |= br < minV ? 0 : br > maxV ? 8 : 4; - cval |= bl < minV ? 0 : bl > maxV ? 2 : 1; - - var cval_real = +cval; - - /* resolve ambiguity via averaging */ - var flipped = 0; - if ( - cval === 17 /* 0101 */ || - cval === 18 /* 0102 */ || - cval === 33 /* 0201 */ || - cval === 34 /* 0202 */ || - cval === 38 /* 0212 */ || - cval === 68 /* 1010 */ || - cval === 72 /* 1020 */ || - cval === 98 /* 1202 */ || - cval === 102 /* 1212 */ || - cval === 132 /* 2010 */ || - cval === 136 /* 2020 */ || - cval === 137 /* 2021 */ || - cval === 152 /* 2120 */ || - cval === 153 /* 2121 */ - ) { - var average = (tl + tr + br + bl) / 4; - /* set flipped state */ - flipped = average > maxV ? 2 : average < minV ? 0 : 1; - - /* adjust cval for flipped cases */ - - /* 8-sided cases */ - if (cval === 34) { - if (flipped === 1) { - cval = 35; - } else if (flipped === 0) { - cval = 136; - } - } else if (cval === 136) { - if (flipped === 1) { - cval = 35; - flipped = 4; - } else if (flipped === 0) { - cval = 34; - } - } else if (cval === 17) { - /* 6-sided polygon cases */ - if (flipped === 1) { - cval = 155; - flipped = 4; - } else if (flipped === 0) { - cval = 153; - } - } else if (cval === 68) { - if (flipped === 1) { - cval = 103; - flipped = 4; - } else if (flipped === 0) { - cval = 102; - } - } else if (cval === 153) { - if (flipped === 1) cval = 155; - } else if (cval === 102) { - if (flipped === 1) cval = 103; - } else if (cval === 152) { - /* 7-sided polygon cases */ - if (flipped < 2) { - cval = 156; - flipped = 1; - } - } else if (cval === 137) { - if (flipped < 2) { - cval = 139; - flipped = 1; - } - } else if (cval === 98) { - if (flipped < 2) { - cval = 99; - flipped = 1; - } - } else if (cval === 38) { - if (flipped < 2) { - cval = 39; - flipped = 1; - } - } else if (cval === 18) { - if (flipped > 0) { - cval = 156; - flipped = 4; - } else { - cval = 152; - } - } else if (cval === 33) { - if (flipped > 0) { - cval = 139; - flipped = 4; - } else { - cval = 137; - } - } else if (cval === 72) { - if (flipped > 0) { - cval = 99; - flipped = 4; - } else { - cval = 98; - } - } else if (cval === 132) { - if (flipped > 0) { - cval = 39; - flipped = 4; - } else { - cval = 38; - } - } - } - - /* add cell to BandGrid if it contains at least one polygon-side */ - if (cval != 0 && cval != 170) { - var topleft, - topright, - bottomleft, - bottomright, - righttop, - rightbottom, - lefttop, - leftbottom; - - topleft = - topright = - bottomleft = - bottomright = - righttop = - rightbottom = - lefttop = - leftbottom = - 0.5; - - var edges = []; - - /* do interpolation here */ - /* 1st Triangles */ - if (cval === 1) { - /* 0001 */ - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 169) { - /* 2221 */ - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 4) { - /* 0010 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 166) { - /* 2212 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 16) { - /* 0100 */ - righttop = interpolateX(minV, br, tr); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 154) { - /* 2122 */ - righttop = 1 - interpolateX(maxV, tr, br); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 64) { - /* 1000 */ - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 106) { - /* 1222 */ - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 168) { - /* 2nd Trapezoids */ - /* 2220 */ - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 2) { - /* 0002 */ - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 162) { - /* 2202 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 8) { - /* 0020 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 138) { - /* 2022 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 32) { - /* 0200 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 42) { - /* 0222 */ - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 128) { - /* 2000 */ - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } - - /* 3rd rectangle cases */ - if (cval === 5) { - /* 0011 */ - rightbottom = 1 - interpolateX(minV, tr, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 165) { - /* 2211 */ - rightbottom = interpolateX(maxV, br, tr); - leftbottom = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 20) { - /* 0110 */ - bottomright = interpolateX(minV, bl, br); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 150) { - /* 2112 */ - bottomright = 1 - interpolateX(maxV, br, bl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 80) { - /* 1100 */ - righttop = interpolateX(minV, br, tr); - lefttop = interpolateX(minV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 90) { - /* 1122 */ - righttop = 1 - interpolateX(maxV, tr, br); - lefttop = 1 - interpolateX(maxV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - } else if (cval === 65) { - /* 1001 */ - bottomleft = 1 - interpolateX(minV, br, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 105) { - /* 1221 */ - bottomleft = interpolateX(maxV, bl, br); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 160) { - /* 2200 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 10) { - /* 0022 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 130) { - /* 2002 */ - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 40) { - /* 0220 */ - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 101) { - /* 4th single pentagon cases */ - /* 1211 */ - rightbottom = interpolateX(maxV, br, tr); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 69) { - /* 1011 */ - rightbottom = 1 - interpolateX(minV, tr, br); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 149) { - /* 2111 */ - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 21) { - /* 0111 */ - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 86) { - /* 1112 */ - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 84) { - /* 1110 */ - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 89) { - /* 1121 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 81) { - /* 1101 */ - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 96) { - /* 1200 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - lefttop = interpolateX(minV, bl, tl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 74) { - /* 1022 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 24) { - /* 0120 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 146) { - /* 2102 */ - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 6) { - /* 0012 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 164) { - /* 2210 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 129) { - /* 2001 */ - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 41) { - /* 0221 */ - bottomleft = interpolateX(maxV, bl, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 66) { - /* 1002 */ - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 104) { - /* 1220 */ - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeTL[cval]); - } else if (cval === 144) { - /* 2100 */ - righttop = interpolateX(minV, br, tr); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 26) { - /* 0122 */ - righttop = 1 - interpolateX(maxV, tr, br); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 36) { - /* 0210 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = interpolateX(minV, bl, br); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 134) { - /* 2012 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = 1 - interpolateX(maxV, br, bl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 9) { - /* 0021 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 161) { - /* 2201 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = interpolateX(maxV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 37) { - /* 5th single hexagon cases */ - /* 0211 */ - rightbottom = interpolateX(maxV, br, tr); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 133) { - /* 2011 */ - rightbottom = 1 - interpolateX(minV, tr, br); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 148) { - /* 2110 */ - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 22) { - /* 0112 */ - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 82) { - /* 1102 */ - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 88) { - /* 1120 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 73) { - /* 1021 */ - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 97) { - /* 1201 */ - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - } else if (cval === 145) { - /* 2101 */ - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 25) { - /* 0121 */ - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 70) { - /* 1012 */ - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = 1 - interpolateX(minV, tr, tl); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 100) { - /* 1210 */ - rightbottom = interpolateX(maxV, br, tr); - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = interpolateX(maxV, tl, tr); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 34) { - /* 8-sided cases */ - /* 0202 || 2020 with flipped == 0 */ - if (flipped === 0) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 35) { - /* flipped == 1 state for 0202, and 2020 with flipped == 4*/ - if (flipped === 4) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 136) { - /* 2020 || 0202 with flipped == 0 */ - if (flipped === 0) { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } else { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 153) { - /* 6-sided polygon cases */ - /* 0101 with flipped == 0 || 2121 with flipped == 2 */ - if (flipped === 0) { - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 102) { - /* 1010 with flipped == 0 || 1212 with flipped == 2 */ - if (flipped === 0) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 155) { - /* 0101 with flipped == 4 || 2121 with flipped == 1 */ - if (flipped === 4) { - righttop = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 103) { - /* 1010 with flipped == 4 || 1212 with flipped == 1 */ - if (flipped === 4) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - } else if (cval === 152) { - /* 7-sided polygon cases */ - /* 2120 with flipped == 2 || 0102 with flipped == 0 */ - if (flipped === 0) { - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 156) { - /* 2120 with flipped == 1 || 0102 with flipped == 4 */ - if (flipped === 4) { - righttop = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topright = interpolateX(minV, tl, tr); - } else { - righttop = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topright = 1 - interpolateX(maxV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeBL[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 137) { - /* 2021 with flipped == 2 || 0201 with flipped == 0 */ - if (flipped === 0) { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } else { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 139) { - /* 2021 with flipped == 1 || 0201 with flipped == 4 */ - if (flipped === 4) { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomleft = 1 - interpolateX(minV, br, bl); - leftbottom = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } else { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomleft = interpolateX(maxV, bl, br); - leftbottom = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - } else if (cval === 98) { - /* 1202 with flipped == 2 || 1020 with flipped == 0 */ - if (flipped === 0) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 99) { - /* 1202 with flipped == 1 || 1020 with flipped == 4 */ - if (flipped === 4) { - righttop = 1 - interpolateX(minV, tr, br); - rightbottom = 1 - interpolateX(maxV, tr, br); - bottomright = interpolateX(maxV, bl, br); - bottomleft = interpolateX(minV, bl, br); - lefttop = interpolateX(minV, bl, tl); - topleft = 1 - interpolateX(minV, tr, tl); - } else { - righttop = interpolateX(maxV, br, tr); - rightbottom = interpolateX(minV, br, tr); - bottomright = 1 - interpolateX(minV, br, bl); - bottomleft = 1 - interpolateX(maxV, br, bl); - lefttop = 1 - interpolateX(maxV, tl, bl); - topleft = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRT[cval]); - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBL[cval]); - } else if (cval === 38) { - /* 0212 with flipped == 2 || 2010 with flipped == 0 */ - if (flipped === 0) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeLB[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 39) { - /* 0212 with flipped == 1 || 2010 with flipped == 4 */ - if (flipped === 4) { - rightbottom = 1 - interpolateX(minV, tr, br); - bottomright = interpolateX(minV, bl, br); - leftbottom = interpolateX(minV, bl, tl); - lefttop = interpolateX(maxV, bl, tl); - topleft = 1 - interpolateX(maxV, tr, tl); - topright = 1 - interpolateX(minV, tr, tl); - } else { - rightbottom = interpolateX(maxV, br, tr); - bottomright = 1 - interpolateX(maxV, br, bl); - leftbottom = 1 - interpolateX(maxV, tl, bl); - lefttop = 1 - interpolateX(minV, tl, bl); - topleft = interpolateX(minV, tl, tr); - topright = interpolateX(maxV, tl, tr); - } - edges.push(isoBandEdgeRB[cval]); - edges.push(isoBandEdgeBR[cval]); - edges.push(isoBandEdgeLT[cval]); - } else if (cval === 85) { - righttop = 1; - rightbottom = 0; - bottomright = 1; - bottomleft = 0; - leftbottom = 0; - lefttop = 1; - topleft = 0; - topright = 1; - } - - if ( - topleft < 0 || - topleft > 1 || - topright < 0 || - topright > 1 || - righttop < 0 || - righttop > 1 || - bottomright < 0 || - bottomright > 1 || - leftbottom < 0 || - leftbottom > 1 || - lefttop < 0 || - lefttop > 1 - ) { - console.log( - "MarchingSquaresJS-isoBands: " + - cval + - " " + - cval_real + - " " + - tl + - "," + - tr + - "," + - br + - "," + - bl + - " " + - flipped + - " " + - topleft + - " " + - topright + - " " + - righttop + - " " + - rightbottom + - " " + - bottomright + - " " + - bottomleft + - " " + - leftbottom + - " " + - lefttop - ); - } - - BandGrid.cells[j][i] = { - cval: cval, - cval_real: cval_real, - flipped: flipped, - topleft: topleft, - topright: topright, - righttop: righttop, - rightbottom: rightbottom, - bottomright: bottomright, - bottomleft: bottomleft, - leftbottom: leftbottom, - lefttop: lefttop, - edges: edges, - }; - } - } - } - - return BandGrid; -} - -function BandGrid2AreaPaths(grid) { - var areas = []; - var rows = grid.rows; - var cols = grid.cols; - var currentPolygon = []; - - for (var j = 0; j < rows; j++) { - for (var i = 0; i < cols; i++) { - if ( - typeof grid.cells[j][i] !== "undefined" && - grid.cells[j][i].edges.length > 0 - ) { - /* trace back polygon path starting from this cell */ - - var cell = grid.cells[j][i]; - - /* get start coordinates */ - - var prev = getStartXY(cell), - next = null, - p = i, - q = j; - - if (prev !== null) { - currentPolygon.push([prev.p[0] + p, prev.p[1] + q]); - //console.log(cell); - //console.log("coords: " + (prev.p[0] + p) + " " + (prev.p[1] + q)); - } - - do { - //console.log(p + "," + q); - //console.log(grid.cells[q][p]); - //console.log(grid.cells[q][p].edges); - //console.log("from : " + prev.x + " " + prev.y + " " + prev.o); - - next = getExitXY(grid.cells[q][p], prev.x, prev.y, prev.o); - if (next !== null) { - //console.log("coords: " + (next.p[0] + p) + " " + (next.p[1] + q)); - currentPolygon.push([next.p[0] + p, next.p[1] + q]); - p += next.x; - q += next.y; - prev = next; - } else { - //console.log("getExitXY() returned null!"); - break; - } - //console.log("to : " + next.x + " " + next.y + " " + next.o); - /* special case, where we've reached the grid boundaries */ - if ( - q < 0 || - q >= rows || - p < 0 || - p >= cols || - typeof grid.cells[q][p] === "undefined" - ) { - /* to create a closed path, we need to trace our way - arround the missing data, until we find an entry - point again - */ - - /* set back coordinates of current cell */ - p -= next.x; - q -= next.y; - - //console.log("reached boundary at " + p + " " + q); - - var missing = traceOutOfGridPath( - grid, - p, - q, - next.x, - next.y, - next.o - ); - if (missing !== null) { - missing.path.forEach(function (pp) { - //console.log("coords: " + (pp[0]) + " " + (pp[1])); - currentPolygon.push(pp); - }); - p = missing.i; - q = missing.j; - prev = missing; - } else { - break; - } - //console.log(grid.cells[q][p]); - } - } while ( - typeof grid.cells[q][p] !== "undefined" && - grid.cells[q][p].edges.length > 0 - ); - - areas.push(currentPolygon); - //console.log("next polygon"); - //console.log(currentPolygon); - currentPolygon = []; - if (grid.cells[j][i].edges.length > 0) i--; - } - } - } - return areas; -} - -function traceOutOfGridPath(grid, i, j, d_x, d_y, d_o) { - var cell = grid.cells[j][i]; - var cval = cell.cval_real; - var p = i + d_x, - q = j + d_y; - var path = []; - var closed = false; - - while (!closed) { - //console.log("processing cell " + p + "," + q + " " + d_x + " " + d_y + " " + d_o); - if ( - typeof grid.cells[q] === "undefined" || - typeof grid.cells[q][p] === "undefined" - ) { - //console.log("which is undefined"); - /* we can't move on, so we have to change direction to proceed further */ - - /* go back to previous cell */ - q -= d_y; - p -= d_x; - cell = grid.cells[q][p]; - cval = cell.cval_real; - - /* check where we've left defined cells of the grid... */ - if (d_y === -1) { - /* we came from top */ - if (d_o === 0) { - /* exit left */ - if (cval & Node3) { - /* lower left node is within range, so we move left */ - path.push([p, q]); - d_x = -1; - d_y = 0; - d_o = 0; - } else if (cval & Node2) { - /* lower right node is within range, so we move right */ - path.push([p + 1, q]); - d_x = 1; - d_y = 0; - d_o = 0; - } else { - /* close the path */ - path.push([p + cell.bottomright, q]); - d_x = 0; - d_y = 1; - d_o = 1; - closed = true; - break; - } - } else if (cval & Node3) { - path.push([p, q]); - d_x = -1; - d_y = 0; - d_o = 0; - } else if (cval & Node2) { - path.push([p + cell.bottomright, q]); - d_x = 0; - d_y = 1; - d_o = 1; - closed = true; - break; - } else { - path.push([p + cell.bottomleft, q]); - d_x = 0; - d_y = 1; - d_o = 0; - closed = true; - break; - } - } else if (d_y === 1) { - /* we came from bottom */ - //console.log("we came from bottom and hit a non-existing cell " + (p + d_x) + "," + (q + d_y) + "!"); - if (d_o === 0) { - /* exit left */ - if (cval & Node1) { - /* top right node is within range, so we move right */ - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - } else if (!(cval & Node0)) { - /* found entry within same cell */ - path.push([p + cell.topright, q + 1]); - d_x = 0; - d_y = -1; - d_o = 1; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } else { - path.push([p + cell.topleft, q + 1]); - d_x = 0; - d_y = -1; - d_o = 0; - closed = true; - break; - } - } else if (cval & Node1) { - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - } else { - /* move right */ - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - //console.log("wtf"); - //break; - } - } else if (d_x === -1) { - /* we came from right */ - //console.log("we came from right and hit a non-existing cell at " + (p + d_x) + "," + (q + d_y) + "!"); - if (d_o === 0) { - //console.log("continue at bottom"); - if (cval & Node0) { - path.push([p, q + 1]); - d_x = 0; - d_y = 1; - d_o = 0; - //console.log("moving upwards to " + (p + d_x) + "," + (q + d_y) + "!"); - } else if (!(cval & Node3)) { - /* there has to be an entry into the regular grid again! */ - //console.log("exiting top"); - path.push([p, q + cell.lefttop]); - d_x = 1; - d_y = 0; - d_o = 1; - closed = true; - break; - } else { - //console.log("exiting bottom"); - path.push([p, q + cell.leftbottom]); - d_x = 1; - d_y = 0; - d_o = 0; - closed = true; - break; - } - } else { - //console.log("continue at top"); - if (cval & Node0) { - path.push([p, q + 1]); - d_x = 0; - d_y = 1; - d_o = 0; - //console.log("moving upwards to " + (p + d_x) + "," + (q + d_y) + "!"); - } else { - /* */ - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } - } - } else if (d_x === 1) { - /* we came from left */ - //console.log("we came from left and hit a non-existing cell " + (p + d_x) + "," + (q + d_y) + "!"); - if (d_o === 0) { - /* exit bottom */ - if (cval & Node2) { - path.push([p + 1, q]); - d_x = 0; - d_y = -1; - d_o = 1; - } else { - path.push([p + 1, q + cell.rightbottom]); - d_x = -1; - d_y = 0; - d_o = 0; - closed = true; - break; - } - } else { - /* exit top */ - if (cval & Node2) { - path.push([p + 1, q]); - d_x = 0; - d_y = -1; - d_o = 1; - } else if (!(cval & Node1)) { - path.push([p + 1, q + cell.rightbottom]); - d_x = -1; - d_y = 0; - d_o = 0; - closed = true; - break; - } else { - path.push([p + 1, q + cell.righttop]); - d_x = -1; - d_y = 0; - d_o = 1; - break; - } - } - } else { - /* we came from the same cell */ - console.log("MarchingSquaresJS-isoBands: we came from nowhere!"); - break; - } - } else { - /* try to find an entry into the regular grid again! */ - cell = grid.cells[q][p]; - cval = cell.cval_real; - //console.log("which is defined"); - - if (d_x === -1) { - if (d_o === 0) { - /* try to go downwards */ - if ( - typeof grid.cells[q - 1] !== "undefined" && - typeof grid.cells[q - 1][p] !== "undefined" - ) { - d_x = 0; - d_y = -1; - d_o = 1; - } else if (cval & Node3) { - /* proceed searching in x-direction */ - //console.log("proceeding in x-direction!"); - path.push([p, q]); - } else { - /* we must have found an entry into the regular grid */ - path.push([p + cell.bottomright, q]); - d_x = 0; - d_y = 1; - d_o = 1; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } - } else if (cval & Node0) { - /* proceed searchin in x-direction */ - console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!"); - } else { - /* we must have found an entry into the regular grid */ - console.log( - "MarchingSquaresJS-isoBands: found entry from top at " + p + "," + q - ); - break; - } - } else if (d_x === 1) { - if (d_o === 0) { - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } else { - /* try to go upwards */ - if ( - typeof grid.cells[q + 1] !== "undefined" && - typeof grid.cells[q + 1][p] !== "undefined" - ) { - d_x = 0; - d_y = 1; - d_o = 0; - } else if (cval & Node1) { - path.push([p + 1, q + 1]); - d_x = 1; - d_y = 0; - d_o = 1; - } else { - /* found an entry point into regular grid! */ - path.push([p + cell.topleft, q + 1]); - d_x = 0; - d_y = -1; - d_o = 0; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } - } - } else if (d_y === -1) { - if (d_o === 1) { - /* try to go right */ - if (typeof grid.cells[q][p + 1] !== "undefined") { - d_x = 1; - d_y = 0; - d_o = 1; - } else if (cval & Node2) { - path.push([p + 1, q]); - d_x = 0; - d_y = -1; - d_o = 1; - } else { - /* found entry into regular grid! */ - path.push([p + 1, q + cell.righttop]); - d_x = -1; - d_y = 0; - d_o = 1; - closed = true; - //console.log("found entry from top at " + p + "," + q); - break; - } - } else { - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } - } else if (d_y === 1) { - if (d_o === 0) { - //console.log("we came from bottom left and proceed to the left"); - /* try to go left */ - if (typeof grid.cells[q][p - 1] !== "undefined") { - d_x = -1; - d_y = 0; - d_o = 0; - } else if (cval & Node0) { - path.push([p, q + 1]); - d_x = 0; - d_y = 1; - d_o = 0; - } else { - /* found an entry point into regular grid! */ - path.push([p, q + cell.leftbottom]); - d_x = 1; - d_y = 0; - d_o = 0; - closed = true; - //console.log("found entry from bottom at " + p + "," + q); - break; - } - } else { - //console.log("we came from bottom right and proceed to the right"); - console.log("MarchingSquaresJS-isoBands: wtf"); - break; - } - } else { - console.log("MarchingSquaresJS-isoBands: where did we came from???"); - break; - } - } - - p += d_x; - q += d_y; - //console.log("going on to " + p + "," + q + " via " + d_x + " " + d_y + " " + d_o); - - if (p === i && q === j) { - /* bail out, once we've closed a circle path */ - break; - } - } - - //console.log("exit with " + p + "," + q + " " + d_x + " " + d_y + " " + d_o); - return { path: path, i: p, j: q, x: d_x, y: d_y, o: d_o }; -} - -function deleteEdge(cell, edgeIdx) { - delete cell.edges[edgeIdx]; - for (var k = edgeIdx + 1; k < cell.edges.length; k++) { - cell.edges[k - 1] = cell.edges[k]; - } - cell.edges.pop(); -} - -function getStartXY(cell) { - if (cell.edges.length > 0) { - var e = cell.edges[cell.edges.length - 1]; - //console.log("starting with edge " + e); - var cval = cell.cval_real; - switch (e) { - case 0: - if (cval & Node1) { - /* node 1 within range */ - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - /* node 1 below or above threshold */ - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } - case 1: - if (cval & Node2) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 2: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } - case 3: - if (cval & Node3) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 4: - if (cval & Node1) { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - case 5: - if (cval & Node2) { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 6: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - case 7: - if (cval & Node3) { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 8: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } - case 9: - if (cval & Node3) { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 10: - if (cval & Node3) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } - case 11: - if (cval & Node0) { - return { p: [1, cell.righttop], x: -1, y: 0, o: 1 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 12: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 13: - if (cval & Node3) { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 14: - if (cval & Node3) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } - case 15: - if (cval & Node0) { - return { p: [1, cell.rightbottom], x: -1, y: 0, o: 0 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 16: - if (cval & Node2) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } - case 17: - if (cval & Node0) { - return { p: [cell.bottomright, 0], x: 0, y: 1, o: 1 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 18: - if (cval & Node3) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } - case 19: - if (cval & Node0) { - return { p: [cell.bottomleft, 0], x: 0, y: 1, o: 0 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 20: - if (cval & Node0) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } - case 21: - if (cval & Node1) { - return { p: [0, cell.leftbottom], x: 1, y: 0, o: 0 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - case 22: - if (cval & Node0) { - return { p: [cell.topleft, 1], x: 0, y: -1, o: 0 }; - } else { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } - case 23: - if (cval & Node1) { - return { p: [0, cell.lefttop], x: 1, y: 0, o: 1 }; - } else { - return { p: [cell.topright, 1], x: 0, y: -1, o: 1 }; - } - default: - console.log("MarchingSquaresJS-isoBands: edge index out of range!"); - console.log(cell); - break; - } - } - - return null; -} - -function getExitXY(cell, x, y, o) { - var e, - id_x, - d_x, - d_y, - cval = cell.cval; - var d_o; - - switch (x) { - case -1: - switch (o) { - case 0: - e = isoBandEdgeRB[cval]; - d_x = isoBandNextXRB[cval]; - d_y = isoBandNextYRB[cval]; - d_o = isoBandNextORB[cval]; - break; - default: - e = isoBandEdgeRT[cval]; - d_x = isoBandNextXRT[cval]; - d_y = isoBandNextYRT[cval]; - d_o = isoBandNextORT[cval]; - break; - } - break; - case 1: - switch (o) { - case 0: - e = isoBandEdgeLB[cval]; - d_x = isoBandNextXLB[cval]; - d_y = isoBandNextYLB[cval]; - d_o = isoBandNextOLB[cval]; - break; - default: - e = isoBandEdgeLT[cval]; - d_x = isoBandNextXLT[cval]; - d_y = isoBandNextYLT[cval]; - d_o = isoBandNextOLT[cval]; - break; - } - break; - default: - switch (y) { - case -1: - switch (o) { - case 0: - e = isoBandEdgeTL[cval]; - d_x = isoBandNextXTL[cval]; - d_y = isoBandNextYTL[cval]; - d_o = isoBandNextOTL[cval]; - break; - default: - e = isoBandEdgeTR[cval]; - d_x = isoBandNextXTR[cval]; - d_y = isoBandNextYTR[cval]; - d_o = isoBandNextOTR[cval]; - break; - } - break; - case 1: - switch (o) { - case 0: - e = isoBandEdgeBL[cval]; - d_x = isoBandNextXBL[cval]; - d_y = isoBandNextYBL[cval]; - d_o = isoBandNextOBL[cval]; - break; - default: - e = isoBandEdgeBR[cval]; - d_x = isoBandNextXBR[cval]; - d_y = isoBandNextYBR[cval]; - d_o = isoBandNextOBR[cval]; - break; - } - break; - default: - break; - } - break; - } - - id_x = cell.edges.indexOf(e); - if (typeof cell.edges[id_x] !== "undefined") { - deleteEdge(cell, id_x); - } else { - //console.log("wrong edges..."); - //console.log(x + " " + y + " " + o); - //console.log(cell); - return null; - } - - cval = cell.cval_real; - - switch (e) { - case 0: - if (cval & Node1) { - /* node 1 within range */ - x = cell.topleft; - y = 1; - } else { - /* node 1 below or above threshold */ - x = 1; - y = cell.righttop; - } - break; - case 1: - if (cval & Node2) { - x = 1; - y = cell.rightbottom; - } else { - x = cell.topleft; - y = 1; - } - break; - case 2: - if (cval & Node2) { - x = cell.topleft; - y = 1; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 3: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = cell.topleft; - y = 1; - } - break; - case 4: - if (cval & Node1) { - x = cell.topright; - y = 1; - } else { - x = 1; - y = cell.righttop; - } - break; - case 5: - if (cval & Node2) { - x = 1; - y = cell.rightbottom; - } else { - x = cell.topright; - y = 1; - } - break; - case 6: - if (cval & Node2) { - x = cell.topright; - y = 1; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 7: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = cell.topright; - y = 1; - } - break; - case 8: - if (cval & Node2) { - x = 1; - y = cell.righttop; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 9: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = 1; - y = cell.righttop; - } - break; - case 10: - if (cval & Node3) { - x = 1; - y = cell.righttop; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 11: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = 1; - y = cell.righttop; - } - break; - case 12: - if (cval & Node2) { - x = 1; - y = cell.rightbottom; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 13: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = 1; - y = cell.rightbottom; - } - break; - case 14: - if (cval & Node3) { - x = 1; - y = cell.rightbottom; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 15: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = 1; - y = cell.rightbottom; - } - break; - case 16: - if (cval & Node2) { - x = 0; - y = cell.leftbottom; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 17: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = cell.bottomright; - y = 0; - } - break; - case 18: - if (cval & Node3) { - x = cell.bottomleft; - y = 0; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 19: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = cell.bottomleft; - y = 0; - } - break; - case 20: - if (cval & Node0) { - x = 0; - y = cell.leftbottom; - } else { - x = cell.topleft; - y = 1; - } - break; - case 21: - if (cval & Node1) { - x = cell.topright; - y = 1; - } else { - x = 0; - y = cell.leftbottom; - } - break; - case 22: - if (cval & Node0) { - x = 0; - y = cell.lefttop; - } else { - x = cell.topleft; - y = 1; - } - break; - case 23: - if (cval & Node1) { - x = cell.topright; - y = 1; - } else { - x = 0; - y = cell.lefttop; - } - break; - default: - console.log("MarchingSquaresJS-isoBands: edge index out of range!"); - console.log(cell); - return null; - } - - if ( - typeof x === "undefined" || - typeof y === "undefined" || - typeof d_x === "undefined" || - typeof d_y === "undefined" || - typeof d_o === "undefined" - ) { - console.log("MarchingSquaresJS-isoBands: undefined value!"); - console.log(cell); - console.log(x + " " + y + " " + d_x + " " + d_y + " " + d_o); - } - return { p: [x, y], x: d_x, y: d_y, o: d_o }; -} - -function BandGrid2Areas(grid) { - var areas = []; - var area_idx = 0; - - grid.cells.forEach(function (g, j) { - g.forEach(function (gg, i) { - if (typeof gg !== "undefined") { - var a = polygon_table[gg.cval](gg); - if (typeof a === "object" && isArray(a)) { - if (typeof a[0] === "object" && isArray(a[0])) { - if (typeof a[0][0] === "object" && isArray(a[0][0])) { - a.forEach(function (aa) { - aa.forEach(function (aaa) { - aaa[0] += i; - aaa[1] += j; - }); - areas[area_idx++] = aa; - }); - } else { - a.forEach(function (aa) { - aa[0] += i; - aa[1] += j; - }); - areas[area_idx++] = a; - } - } else { - console.log( - "MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates" - ); - } - } else { - console.log( - "MarchingSquaresJS-isoBands: bandcell polygon with null coordinates" - ); - } - } - }); - }); - - return areas; -} diff --git a/packages/turf-isobands/marchingsquares.d.ts b/packages/turf-isobands/marchingsquares.d.ts new file mode 100644 index 0000000000..5e3233864f --- /dev/null +++ b/packages/turf-isobands/marchingsquares.d.ts @@ -0,0 +1 @@ +declare module "marchingsquares"; diff --git a/packages/turf-isobands/package.json b/packages/turf-isobands/package.json index bc73918f2d..809e7d92b0 100644 --- a/packages/turf-isobands/package.json +++ b/packages/turf-isobands/package.json @@ -77,6 +77,7 @@ "@turf/helpers": "^7.0.0-alpha.2", "@turf/invariant": "^7.0.0-alpha.2", "@turf/meta": "^7.0.0-alpha.2", + "marchingsquares": "^1.3.3", "tslib": "^2.3.0" } } diff --git a/packages/turf-isobands/test.js b/packages/turf-isobands/test.js index 0e4228e6bb..4cc13624ca 100644 --- a/packages/turf-isobands/test.js +++ b/packages/turf-isobands/test.js @@ -38,9 +38,10 @@ test("isobands", (t) => { // Results const results = truncate(isobands(points, breaks, options)); - // Add red line around point data + // Add line around point data results.features.push( lineString(getCoords(envelope(points))[0], { + description: "Debug line for testing", stroke: "#F00", "stroke-width": 1, }) @@ -54,6 +55,20 @@ test("isobands", (t) => { t.end(); }); +test("isobands - flat data, from issue #1797", (t) => { + const points = pointGrid( + [-70.823364, -33.553984, -70.473175, -33.302986], + 5, + { + properties: { elevation: 1 }, + } + ); + + const lines = isobands(points, [0, 2]); + t.assert(lines.features[0].geometry.coordinates[0][0].length > 4); + t.end(); +}); + test("isobands -- throws", (t) => { const points = pointGrid([-70.823364, -33.553984, -70.473175, -33.302986], 5); diff --git a/packages/turf-isobands/test/in/matrix2.json b/packages/turf-isobands/test/in/matrix2.json index 937a5a0175..73f2e4cf64 100644 --- a/packages/turf-isobands/test/in/matrix2.json +++ b/packages/turf-isobands/test/in/matrix2.json @@ -1,16 +1,16 @@ { "matrix": [ - [18, 13, 10, 9, 10, 13, 18], - [13, 8, 5, 4, 5, 8, 13], - [10, 5, 2, 1, 2, 5, 10], - [10, 5, 2, 1, 2, 5, 10], - [9, 4, 1, 12, 1, 4, 9], - [10, 5, 2, 1, 2, 5, 10], - [10, 5, 2, 1, 2, 5, 10], - [13, 8, 5, 4, 5, 8, 13], - [18, 13, 10, 9, 10, 13, 18] - ], - "origin": [10.85, 44], + [18, 13, 10, 9, 10, 13, 18], + [13, 8, 5, 4, 5, 8, 13], + [10, 5, 2, 1, 2, 5, 10], + [10, 5, 2, 1, 2, 5, 10], + [ 9, 4, 1, 12, 1, 4, 9], + [10, 5, 2, 1, 2, 5, 10], + [10, 5, 2, 1, 2, 5, 10], + [13, 8, 5, 4, 5, 8, 13], + [18, 13, 10, 9, 10, 13, 18] +], + "origin": [ 10.85, 44 ], "cellSize": 20, "breaks": [0, 4.5, 9, 13.5, 18], "commonProperties": { @@ -21,15 +21,12 @@ "breaksProperties": [ { "fill-opacity": 0.4 - }, - { + },{ "fill-opacity": 0.5 - }, - { + },{ "fill-opacity": 0.7 - }, - { + },{ "fill-opacity": 0.8 } ] -} +} \ No newline at end of file diff --git a/packages/turf-isobands/test/out/bigMatrix.geojson b/packages/turf-isobands/test/out/bigMatrix.geojson index 1c5c01210c..7309f0d95f 100644 --- a/packages/turf-isobands/test/out/bigMatrix.geojson +++ b/packages/turf-isobands/test/out/bigMatrix.geojson @@ -15,14 +15,6 @@ "coordinates": [ [ [ - [7.884954, 47.158747], - [7.857297, 47.169116], - [7.746458, 47.240282], - [7.721771, 47.259049], - [7.660303, 47.348981], - [7.607963, 47.432938], - [7.602787, 47.438913], - [7.483616, 47.528845], [7.469468, 47.539233], [7.398672, 47.618777], [7.369353, 47.708709], @@ -47,13 +39,19 @@ [8.21777, 47.169116], [8.161944, 47.147462], [8.023449, 47.134087], - [7.884954, 47.158747] + [7.884954, 47.158747], + [7.857297, 47.169116], + [7.746458, 47.240282], + [7.721771, 47.259049], + [7.660303, 47.348981], + [7.607963, 47.432938], + [7.602787, 47.438913], + [7.483616, 47.528845], + [7.469468, 47.539233] ] ], [ [ - [13.009282, 46.076361], - [12.98133, 46.089932], [12.870787, 46.176678], [12.867497, 46.179864], [12.815364, 46.269796], @@ -80,7 +78,9 @@ [13.424768, 46.088913], [13.286273, 46.043257], [13.147778, 46.040078], - [13.009282, 46.076361] + [13.009282, 46.076361], + [12.98133, 46.089932], + [12.870787, 46.176678] ] ], [ @@ -167,9 +167,6 @@ ], [ [ - [15.640694, 47.070845], - [15.606895, 47.079184], - [15.502199, 47.115385], [15.363703, 47.167282], [15.361223, 47.169116], [15.336906, 47.259049], @@ -181,7 +178,10 @@ [15.834548, 47.169116], [15.789098, 47.079184], [15.77919, 47.072803], - [15.640694, 47.070845] + [15.640694, 47.070845], + [15.606895, 47.079184], + [15.502199, 47.115385], + [15.363703, 47.167282] ] ], [ @@ -305,19 +305,6 @@ "coordinates": [ [ [ - [7.746458, 46.964747], - [7.631978, 46.989252], - [7.607963, 46.995477], - [7.469468, 47.045416], - [7.394797, 47.079184], - [7.330972, 47.116044], - [7.245823, 47.169116], - [7.192477, 47.210822], - [7.132951, 47.259049], - [7.053981, 47.339333], - [7.04482, 47.348981], - [6.977129, 47.438913], - [6.931048, 47.528845], [6.915486, 47.583233], [6.904869, 47.618777], [6.898708, 47.708709], @@ -379,9 +366,30 @@ [8.161944, 46.979726], [8.023449, 46.955862], [7.884954, 46.95147], - [7.746458, 46.964747] + [7.746458, 46.964747], + [7.631978, 46.989252], + [7.607963, 46.995477], + [7.469468, 47.045416], + [7.394797, 47.079184], + [7.330972, 47.116044], + [7.245823, 47.169116], + [7.192477, 47.210822], + [7.132951, 47.259049], + [7.053981, 47.339333], + [7.04482, 47.348981], + [6.977129, 47.438913], + [6.931048, 47.528845], + [6.915486, 47.583233] ], [ + [7.398672, 47.618777], + [7.469468, 47.539233], + [7.483616, 47.528845], + [7.602787, 47.438913], + [7.607963, 47.432938], + [7.660303, 47.348981], + [7.721771, 47.259049], + [7.746458, 47.240282], [7.857297, 47.169116], [7.884954, 47.158747], [8.023449, 47.134087], @@ -406,15 +414,7 @@ [7.469468, 47.873837], [7.392465, 47.798641], [7.369353, 47.708709], - [7.398672, 47.618777], - [7.469468, 47.539233], - [7.483616, 47.528845], - [7.602787, 47.438913], - [7.607963, 47.432938], - [7.660303, 47.348981], - [7.721771, 47.259049], - [7.746458, 47.240282], - [7.857297, 47.169116] + [7.398672, 47.618777] ], [ [8.767107, 47.438913], @@ -440,19 +440,6 @@ ], [ [ - [12.593796, 46.075577], - [12.578669, 46.089932], - [12.510938, 46.179864], - [12.469615, 46.269796], - [12.455301, 46.327499], - [12.446405, 46.359728], - [12.435651, 46.44966], - [12.429156, 46.539592], - [12.394556, 46.629524], - [12.316805, 46.66745], - [12.206125, 46.719456], - [12.17831, 46.726561], - [12.040741, 46.809388], [12.039815, 46.810095], [11.968106, 46.89932], [11.950779, 46.989252], @@ -504,9 +491,24 @@ [12.870787, 46], [12.732292, 46], [12.683417, 46], - [12.593796, 46.075577] + [12.593796, 46.075577], + [12.578669, 46.089932], + [12.510938, 46.179864], + [12.469615, 46.269796], + [12.455301, 46.327499], + [12.446405, 46.359728], + [12.435651, 46.44966], + [12.429156, 46.539592], + [12.394556, 46.629524], + [12.316805, 46.66745], + [12.206125, 46.719456], + [12.17831, 46.726561], + [12.040741, 46.809388], + [12.039815, 46.810095] ], [ + [12.867497, 46.179864], + [12.870787, 46.176678], [12.98133, 46.089932], [13.009282, 46.076361], [13.147778, 46.040078], @@ -533,9 +535,7 @@ [12.794113, 46.44966], [12.792558, 46.359728], [12.815364, 46.269796], - [12.867497, 46.179864], - [12.870787, 46.176678], - [12.98133, 46.089932] + [12.867497, 46.179864] ], [ [12.177161, 46.89932], @@ -620,8 +620,6 @@ ], [ [ - [15.363703, 47.051232], - [15.301081, 47.079184], [15.225208, 47.140803], [15.175394, 47.169116], [15.128914, 47.259049], @@ -638,9 +636,14 @@ [15.77919, 47.01095], [15.640694, 46.99557], [15.502199, 47.014524], - [15.363703, 47.051232] + [15.363703, 47.051232], + [15.301081, 47.079184], + [15.225208, 47.140803] ], [ + [15.361223, 47.169116], + [15.363703, 47.167282], + [15.502199, 47.115385], [15.606895, 47.079184], [15.640694, 47.070845], [15.77919, 47.072803], @@ -652,10 +655,7 @@ [15.502199, 47.319692], [15.363703, 47.279081], [15.336906, 47.259049], - [15.361223, 47.169116], - [15.363703, 47.167282], - [15.502199, 47.115385], - [15.606895, 47.079184] + [15.361223, 47.169116] ] ], [ @@ -725,8 +725,6 @@ ], [ [ - [12.732292, 47.971499], - [12.707656, 47.978505], [12.593796, 48.030327], [12.551601, 48.068437], [12.561575, 48.158369], @@ -737,7 +735,9 @@ [12.941498, 48.068437], [12.870787, 48.007987], [12.789645, 47.978505], - [12.732292, 47.971499] + [12.732292, 47.971499], + [12.707656, 47.978505], + [12.593796, 48.030327] ], [ [12.607371, 48.068437], @@ -879,59 +879,6 @@ "coordinates": [ [ [ - [9.023838, 46.089932], - [9.076637, 46], - [8.992917, 46], - [8.854421, 46], - [8.715926, 46], - [8.577431, 46], - [8.438935, 46], - [8.30044, 46], - [8.161944, 46], - [8.023449, 46], - [7.884954, 46], - [7.746458, 46], - [7.607963, 46], - [7.469468, 46], - [7.330972, 46], - [7.192477, 46], - [7.053981, 46], - [6.915486, 46], - [6.776991, 46], - [6.638495, 46], - [6.5, 46], - [6.5, 46.089932], - [6.5, 46.179864], - [6.5, 46.269796], - [6.5, 46.359728], - [6.5, 46.44966], - [6.5, 46.539592], - [6.5, 46.629524], - [6.5, 46.719456], - [6.5, 46.809388], - [6.5, 46.89932], - [6.5, 46.989252], - [6.5, 47.079184], - [6.5, 47.169116], - [6.5, 47.259049], - [6.5, 47.348981], - [6.5, 47.438913], - [6.5, 47.528845], - [6.5, 47.618777], - [6.5, 47.708709], - [6.5, 47.798641], - [6.5, 47.888573], - [6.5, 47.978505], - [6.5, 48.068437], - [6.5, 48.158369], - [6.5, 48.248301], - [6.5, 48.338233], - [6.5, 48.428165], - [6.5, 48.518097], - [6.5, 48.608029], - [6.5, 48.697961], - [6.5, 48.787893], - [6.5, 48.877825], [6.5, 48.911051], [6.638495, 48.924741], [6.776991, 48.955575], @@ -1024,9 +971,75 @@ [8.947567, 46.269796], [8.980847, 46.179864], [8.992917, 46.149581], - [9.023838, 46.089932] + [9.023838, 46.089932], + [9.076637, 46], + [8.992917, 46], + [8.854421, 46], + [8.715926, 46], + [8.577431, 46], + [8.438935, 46], + [8.30044, 46], + [8.161944, 46], + [8.023449, 46], + [7.884954, 46], + [7.746458, 46], + [7.607963, 46], + [7.469468, 46], + [7.330972, 46], + [7.192477, 46], + [7.053981, 46], + [6.915486, 46], + [6.776991, 46], + [6.638495, 46], + [6.5, 46], + [6.5, 46.089932], + [6.5, 46.179864], + [6.5, 46.269796], + [6.5, 46.359728], + [6.5, 46.44966], + [6.5, 46.539592], + [6.5, 46.629524], + [6.5, 46.719456], + [6.5, 46.809388], + [6.5, 46.89932], + [6.5, 46.989252], + [6.5, 47.079184], + [6.5, 47.169116], + [6.5, 47.259049], + [6.5, 47.348981], + [6.5, 47.438913], + [6.5, 47.528845], + [6.5, 47.618777], + [6.5, 47.708709], + [6.5, 47.798641], + [6.5, 47.888573], + [6.5, 47.978505], + [6.5, 48.068437], + [6.5, 48.158369], + [6.5, 48.248301], + [6.5, 48.338233], + [6.5, 48.428165], + [6.5, 48.518097], + [6.5, 48.608029], + [6.5, 48.697961], + [6.5, 48.787893], + [6.5, 48.877825], + [6.5, 48.911051] ], [ + [6.904869, 47.618777], + [6.915486, 47.583233], + [6.931048, 47.528845], + [6.977129, 47.438913], + [7.04482, 47.348981], + [7.053981, 47.339333], + [7.132951, 47.259049], + [7.192477, 47.210822], + [7.245823, 47.169116], + [7.330972, 47.116044], + [7.394797, 47.079184], + [7.469468, 47.045416], + [7.607963, 46.995477], [7.631978, 46.989252], [7.746458, 46.964747], [7.884954, 46.95147], @@ -1088,20 +1101,7 @@ [6.915486, 47.799543], [6.915094, 47.798641], [6.898708, 47.708709], - [6.904869, 47.618777], - [6.915486, 47.583233], - [6.931048, 47.528845], - [6.977129, 47.438913], - [7.04482, 47.348981], - [7.053981, 47.339333], - [7.132951, 47.259049], - [7.192477, 47.210822], - [7.245823, 47.169116], - [7.330972, 47.116044], - [7.394797, 47.079184], - [7.469468, 47.045416], - [7.607963, 46.995477], - [7.631978, 46.989252] + [6.904869, 47.618777] ] ], [ @@ -1349,6 +1349,8 @@ [10.407143, 46] ], [ + [15.175394, 47.169116], + [15.225208, 47.140803], [15.301081, 47.079184], [15.363703, 47.051232], [15.502199, 47.014524], @@ -1365,9 +1367,7 @@ [15.286403, 47.348981], [15.225208, 47.29727], [15.128914, 47.259049], - [15.175394, 47.169116], - [15.225208, 47.140803], - [15.301081, 47.079184] + [15.175394, 47.169116] ], [ [14.505265, 47.169116], @@ -1389,6 +1389,8 @@ [14.505265, 47.169116] ], [ + [12.551601, 48.068437], + [12.593796, 48.030327], [12.707656, 47.978505], [12.732292, 47.971499], [12.789645, 47.978505], @@ -1399,9 +1401,7 @@ [12.732292, 48.232741], [12.593796, 48.193019], [12.561575, 48.158369], - [12.551601, 48.068437], - [12.593796, 48.030327], - [12.707656, 47.978505] + [12.551601, 48.068437] ], [ [16.806188, 46.629524], @@ -1424,8 +1424,6 @@ ], [ [ - [19.241574, 46.143947], - [19.110731, 46.179864], [19.103078, 46.183635], [19.03808, 46.269796], [19.0463, 46.359728], @@ -1444,7 +1442,9 @@ [19.454091, 46.269796], [19.380069, 46.217079], [19.290855, 46.179864], - [19.241574, 46.143947] + [19.241574, 46.143947], + [19.110731, 46.179864], + [19.103078, 46.183635] ], [ [19.192764, 46.269796], @@ -1537,8 +1537,6 @@ "coordinates": [ [ [ - [9.076637, 46], - [9.023838, 46.089932], [8.992917, 46.149581], [8.980847, 46.179864], [8.947567, 46.269796], @@ -1853,9 +1851,15 @@ [9.408403, 46], [9.269907, 46], [9.131412, 46], - [9.076637, 46] + [9.076637, 46], + [9.023838, 46.089932], + [8.992917, 46.149581] ], [ + [9.337463, 46.809388], + [9.408403, 46.722835], + [9.412794, 46.719456], + [9.546898, 46.641769], [9.598208, 46.629524], [9.685393, 46.606681], [9.823889, 46.60198], @@ -1882,13 +1886,11 @@ [9.377816, 47.079184], [9.322633, 46.989252], [9.310428, 46.89932], - [9.337463, 46.809388], - [9.408403, 46.722835], - [9.412794, 46.719456], - [9.546898, 46.641769], - [9.598208, 46.629524] + [9.337463, 46.809388] ], [ + [11.841028, 47.798641], + [11.901319, 47.714874], [11.904159, 47.708709], [12.039815, 47.646328], [12.17831, 47.628932], @@ -1907,9 +1909,7 @@ [11.979483, 47.978505], [11.901319, 47.928979], [11.860265, 47.888573], - [11.841028, 47.798641], - [11.901319, 47.714874], - [11.904159, 47.708709] + [11.841028, 47.798641] ], [ [16.459871, 47.528845], @@ -1929,8 +1929,6 @@ ], [ [ - [18.964583, 46.020322], - [18.876486, 46.089932], [18.826088, 46.163575], [18.814561, 46.179864], [18.775267, 46.269796], @@ -1959,9 +1957,13 @@ [19.241574, 46], [19.103078, 46], [19.006245, 46], - [18.964583, 46.020322] + [18.964583, 46.020322], + [18.876486, 46.089932], + [18.826088, 46.163575] ], [ + [19.03808, 46.269796], + [19.103078, 46.183635], [19.110731, 46.179864], [19.241574, 46.143947], [19.290855, 46.179864], @@ -1980,9 +1982,7 @@ [18.997661, 46.539592], [18.997368, 46.44966], [19.0463, 46.359728], - [19.03808, 46.269796], - [19.103078, 46.183635], - [19.110731, 46.179864] + [19.03808, 46.269796] ] ], [ @@ -2028,80 +2028,6 @@ "coordinates": [ [ [ - [17.228682, 46], - [17.291854, 46.089932], - [17.302639, 46.097422], - [17.407115, 46.179864], - [17.441134, 46.193583], - [17.541729, 46.269796], - [17.579629, 46.28893], - [17.634275, 46.359728], - [17.680021, 46.44966], - [17.691965, 46.539592], - [17.66221, 46.629524], - [17.579629, 46.703093], - [17.528871, 46.719456], - [17.441134, 46.748337], - [17.302639, 46.78247], - [17.246781, 46.809388], - [17.164143, 46.841479], - [17.025648, 46.889983], - [16.970246, 46.89932], - [16.887153, 46.916589], - [16.748657, 46.930836], - [16.610162, 46.951422], - [16.523719, 46.989252], - [16.471666, 47.045057], - [16.451039, 47.079184], - [16.424896, 47.169116], - [16.424356, 47.259049], - [16.471666, 47.331177], - [16.484599, 47.348981], - [16.610162, 47.392326], - [16.701619, 47.438913], - [16.748657, 47.452226], - [16.839894, 47.528845], - [16.887153, 47.602076], - [16.893165, 47.618777], - [16.887153, 47.663804], - [16.876259, 47.708709], - [16.782712, 47.798641], - [16.748657, 47.826174], - [16.610162, 47.869874], - [16.471666, 47.885475], - [16.424961, 47.888573], - [16.333171, 47.898463], - [16.194676, 47.921745], - [16.05618, 47.952087], - [15.952032, 47.978505], - [15.917685, 47.98884], - [15.77919, 48.037764], - [15.708671, 48.068437], - [15.640694, 48.102297], - [15.536352, 48.158369], - [15.502199, 48.179469], - [15.390694, 48.248301], - [15.363703, 48.267499], - [15.260608, 48.338233], - [15.225208, 48.366249], - [15.142925, 48.428165], - [15.086713, 48.476862], - [15.03645, 48.518097], - [14.948217, 48.600843], - [14.940128, 48.608029], - [14.849822, 48.697961], - [14.809722, 48.742499], - [14.766367, 48.787893], - [14.687931, 48.877825], - [14.671227, 48.898571], - [14.611763, 48.967757], - [14.539245, 49.057689], - [14.532731, 49.066291], - [14.466594, 49.147621], - [14.39668, 49.237553], - [14.394236, 49.240875], - [14.325526, 49.327485], - [14.256739, 49.417417], [14.255741, 49.418794], [14.186388, 49.507349], [14.255741, 49.507349], @@ -2222,7 +2148,81 @@ [17.579629, 46], [17.441134, 46], [17.302639, 46], - [17.228682, 46] + [17.228682, 46], + [17.291854, 46.089932], + [17.302639, 46.097422], + [17.407115, 46.179864], + [17.441134, 46.193583], + [17.541729, 46.269796], + [17.579629, 46.28893], + [17.634275, 46.359728], + [17.680021, 46.44966], + [17.691965, 46.539592], + [17.66221, 46.629524], + [17.579629, 46.703093], + [17.528871, 46.719456], + [17.441134, 46.748337], + [17.302639, 46.78247], + [17.246781, 46.809388], + [17.164143, 46.841479], + [17.025648, 46.889983], + [16.970246, 46.89932], + [16.887153, 46.916589], + [16.748657, 46.930836], + [16.610162, 46.951422], + [16.523719, 46.989252], + [16.471666, 47.045057], + [16.451039, 47.079184], + [16.424896, 47.169116], + [16.424356, 47.259049], + [16.471666, 47.331177], + [16.484599, 47.348981], + [16.610162, 47.392326], + [16.701619, 47.438913], + [16.748657, 47.452226], + [16.839894, 47.528845], + [16.887153, 47.602076], + [16.893165, 47.618777], + [16.887153, 47.663804], + [16.876259, 47.708709], + [16.782712, 47.798641], + [16.748657, 47.826174], + [16.610162, 47.869874], + [16.471666, 47.885475], + [16.424961, 47.888573], + [16.333171, 47.898463], + [16.194676, 47.921745], + [16.05618, 47.952087], + [15.952032, 47.978505], + [15.917685, 47.98884], + [15.77919, 48.037764], + [15.708671, 48.068437], + [15.640694, 48.102297], + [15.536352, 48.158369], + [15.502199, 48.179469], + [15.390694, 48.248301], + [15.363703, 48.267499], + [15.260608, 48.338233], + [15.225208, 48.366249], + [15.142925, 48.428165], + [15.086713, 48.476862], + [15.03645, 48.518097], + [14.948217, 48.600843], + [14.940128, 48.608029], + [14.849822, 48.697961], + [14.809722, 48.742499], + [14.766367, 48.787893], + [14.687931, 48.877825], + [14.671227, 48.898571], + [14.611763, 48.967757], + [14.539245, 49.057689], + [14.532731, 49.066291], + [14.466594, 49.147621], + [14.39668, 49.237553], + [14.394236, 49.240875], + [14.325526, 49.327485], + [14.256739, 49.417417], + [14.255741, 49.418794] ], [ [18.233988, 46.44966], @@ -2242,10 +2242,6 @@ ], [ [ - [9.685393, 46.606681], - [9.598208, 46.629524], - [9.546898, 46.641769], - [9.412794, 46.719456], [9.408403, 46.722835], [9.337463, 46.809388], [9.310428, 46.89932], @@ -2272,13 +2268,15 @@ [9.969751, 46.629524], [9.962384, 46.626776], [9.823889, 46.60198], - [9.685393, 46.606681] + [9.685393, 46.606681], + [9.598208, 46.629524], + [9.546898, 46.641769], + [9.412794, 46.719456], + [9.408403, 46.722835] ] ], [ [ - [12.039815, 47.646328], - [11.904159, 47.708709], [11.901319, 47.714874], [11.841028, 47.798641], [11.860265, 47.888573], @@ -2297,7 +2295,9 @@ [12.455301, 47.631881], [12.316805, 47.62992], [12.17831, 47.628932], - [12.039815, 47.646328] + [12.039815, 47.646328], + [11.904159, 47.708709], + [11.901319, 47.714874] ] ] ] @@ -2306,6 +2306,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isobands/test/out/matrix1.geojson b/packages/turf-isobands/test/out/matrix1.geojson index 696cfdb16b..d7b541a908 100644 --- a/packages/turf-isobands/test/out/matrix1.geojson +++ b/packages/turf-isobands/test/out/matrix1.geojson @@ -143,6 +143,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isobands/test/out/matrix2.geojson b/packages/turf-isobands/test/out/matrix2.geojson index 13b8c18ff8..6d673f4207 100644 --- a/packages/turf-isobands/test/out/matrix2.geojson +++ b/packages/turf-isobands/test/out/matrix2.geojson @@ -15,11 +15,6 @@ "coordinates": [ [ [ - [11.619012, 44.161878], - [11.490843, 44.179864], - [11.362675, 44.209841], - [11.14906, 44.359728], - [11.14906, 44.539592], [11.106337, 44.629524], [11.080704, 44.719456], [11.106337, 44.809388], @@ -39,7 +34,12 @@ [12.088964, 44.359728], [11.87535, 44.209841], [11.747181, 44.179864], - [11.619012, 44.161878] + [11.619012, 44.161878], + [11.490843, 44.179864], + [11.362675, 44.209841], + [11.14906, 44.359728], + [11.14906, 44.539592], + [11.106337, 44.629524] ], [ [11.444237, 44.719456], @@ -101,6 +101,11 @@ [11.106337, 44.143891] ], [ + [11.080704, 44.719456], + [11.106337, 44.629524], + [11.14906, 44.539592], + [11.14906, 44.359728], + [11.362675, 44.209841], [11.490843, 44.179864], [11.619012, 44.161878], [11.747181, 44.179864], @@ -120,12 +125,7 @@ [11.14906, 45.079184], [11.14906, 44.89932], [11.106337, 44.809388], - [11.080704, 44.719456], - [11.106337, 44.629524], - [11.14906, 44.539592], - [11.14906, 44.359728], - [11.362675, 44.209841], - [11.490843, 44.179864] + [11.080704, 44.719456] ], [ [11.619012, 44.596822], @@ -281,6 +281,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isobands/test/out/pointGrid.geojson b/packages/turf-isobands/test/out/pointGrid.geojson index 581f4dc5c4..70146a2fa3 100644 --- a/packages/turf-isobands/test/out/pointGrid.geojson +++ b/packages/turf-isobands/test/out/pointGrid.geojson @@ -51,10 +51,6 @@ ], [ [ - [-70.499722, -33.442285], - [-70.514512, -33.419128], - [-70.511237, -33.374176], - [-70.553662, -33.335329], [-70.607603, -33.337216], [-70.629732, -33.329224], [-70.607603, -33.329224], @@ -62,7 +58,11 @@ [-70.499722, -33.329224], [-70.499722, -33.374176], [-70.499722, -33.419128], - [-70.499722, -33.442285] + [-70.499722, -33.442285], + [-70.514512, -33.419128], + [-70.511237, -33.374176], + [-70.553662, -33.335329], + [-70.607603, -33.337216] ] ] ] @@ -140,13 +140,13 @@ ], [ [ - [-70.715483, -33.533756], - [-70.743491, -33.553984], [-70.764237, -33.553984], [-70.715483, -33.518772], [-70.671006, -33.553984], [-70.689933, -33.553984], - [-70.715483, -33.533756] + [-70.715483, -33.533756], + [-70.743491, -33.553984], + [-70.764237, -33.553984] ] ], [ @@ -171,10 +171,6 @@ "coordinates": [ [ [ - [-70.661543, -33.475106], - [-70.681022, -33.46408], - [-70.688513, -33.419128], - [-70.71204, -33.374176], [-70.715483, -33.370887], [-70.764287, -33.329224], [-70.715483, -33.329224], @@ -187,9 +183,15 @@ [-70.553662, -33.437858], [-70.607603, -33.450249], [-70.642591, -33.46408], - [-70.661543, -33.475106] + [-70.661543, -33.475106], + [-70.681022, -33.46408], + [-70.688513, -33.419128], + [-70.71204, -33.374176], + [-70.715483, -33.370887] ], [ + [-70.666134, -33.374176], + [-70.661543, -33.379976], [-70.626021, -33.419128], [-70.607603, -33.427196], [-70.581563, -33.419128], @@ -198,9 +200,7 @@ [-70.553662, -33.368626], [-70.607603, -33.367184], [-70.661543, -33.369791], - [-70.666134, -33.374176], - [-70.661543, -33.379976], - [-70.626021, -33.419128] + [-70.666134, -33.374176] ] ], [ @@ -263,8 +263,6 @@ "coordinates": [ [ [ - [-70.607603, -33.427196], - [-70.626021, -33.419128], [-70.661543, -33.379976], [-70.666134, -33.374176], [-70.661543, -33.369791], @@ -273,7 +271,9 @@ [-70.547602, -33.374176], [-70.553662, -33.392157], [-70.581563, -33.419128], - [-70.607603, -33.427196] + [-70.607603, -33.427196], + [-70.626021, -33.419128], + [-70.661543, -33.379976] ] ], [ @@ -290,6 +290,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isolines/bench.js b/packages/turf-isolines/bench.js index 6a548f2819..720165f27c 100644 --- a/packages/turf-isolines/bench.js +++ b/packages/turf-isolines/bench.js @@ -2,7 +2,7 @@ import fs from "fs"; import path from "path"; import load from "load-json-file"; import Benchmark from "benchmark"; -import matrixToGrid from "matrix-to-grid"; +import matrixToGrid from "./lib/matrix-to-grid"; import isolines from "./index"; // Define Fixtures diff --git a/packages/turf-isolines/index.ts b/packages/turf-isolines/index.ts index ac56c58c50..077701467d 100644 --- a/packages/turf-isolines/index.ts +++ b/packages/turf-isolines/index.ts @@ -1,8 +1,9 @@ import bbox from "@turf/bbox"; +import clone from "@turf/clone"; import { coordEach } from "@turf/meta"; import { collectionOf } from "@turf/invariant"; import { multiLineString, featureCollection, isObject } from "@turf/helpers"; -import isoContours from "./lib/marchingsquares-isocontours"; +const { isoContours } = require("marchingsquares"); import gridToMatrix from "./lib/grid-to-matrix"; import { FeatureCollection, @@ -108,7 +109,12 @@ function createIsoLines( const properties = { ...commonProperties, ...breaksProperties[i] }; properties[zProperty] = threshold; - const isoline = multiLineString(isoContours(matrix, threshold), properties); + // Pass options to marchingsquares lib to reproduce historical turf + // behaviour. + const isoline = multiLineString( + isoContours(matrix, threshold, { linearRing: false, noFrame: true }), + properties + ); results.push(isoline); } @@ -151,11 +157,35 @@ function rescaleIsolines( point[1] = point[1] * scaleY + y0; }; - // resize and shift each point/line of the createdIsoLines + // Ok. We need to *clone* the returned isolines due to the behaviour of + // the marchingsquare library behaviour. Long story short, if we don't + // do this, the last point in some isoLines has the coordEach function + // run twice, leading to one point in the isoline rendering WAY out of + // position. + const clonedIsoLines: Feature[] = []; createdIsoLines.forEach((isoline) => { + clonedIsoLines.push(clone(isoline)); + }); + + // resize and shift each point/line of the createdIsoLines + clonedIsoLines.forEach((isoline) => { coordEach(isoline, resize); }); - return createdIsoLines; + return clonedIsoLines; } +/* + * A bit more background on the isoContours behaviour described above. It + * seems like in some cases the last coord of the line references the same + * coord array as the first point. This just seems to be the way they're + * returned from the library: + * [0] -> A + * [1] -> B + * [2] -> C + * [3] -> A + * Running coordEach over this mutates the values in A, then B and C, then + * mutates [3] which happens to also be a reference to A. So the rescale + * transform is run twice on that coord. + */ + export default isolines; diff --git a/packages/turf-isolines/package.json b/packages/turf-isolines/package.json index 883077cb63..f09a1c2210 100644 --- a/packages/turf-isolines/package.json +++ b/packages/turf-isolines/package.json @@ -73,6 +73,7 @@ "@turf/helpers": "^7.0.0-alpha.2", "@turf/invariant": "^7.0.0-alpha.2", "@turf/meta": "^7.0.0-alpha.2", + "marchingsquares": "^1.3.3", "tslib": "^2.3.0" } } diff --git a/packages/turf-isolines/test.js b/packages/turf-isolines/test.js index 22318216c7..d0d545271f 100644 --- a/packages/turf-isolines/test.js +++ b/packages/turf-isolines/test.js @@ -41,6 +41,7 @@ test("isolines", (t) => { // Add red line around point data results.features.push( lineString(getCoords(envelope(points))[0], { + description: "Debug line for testing", stroke: "#F00", "stroke-width": 1, }) diff --git a/packages/turf-isolines/test/out/bigMatrix.geojson b/packages/turf-isolines/test/out/bigMatrix.geojson index de359cbb24..bd5e9245ec 100644 --- a/packages/turf-isolines/test/out/bigMatrix.geojson +++ b/packages/turf-isolines/test/out/bigMatrix.geojson @@ -14,797 +14,947 @@ "type": "MultiLineString", "coordinates": [ [ - [12.98133, 46.089932], - [13.009282, 46.076361], - [13.147778, 46.040078], - [13.286273, 46.043257], - [13.424768, 46.088913], - [13.426546, 46.089932], - [13.527199, 46.179864], - [13.563264, 46.267861], - [13.564023, 46.269796], - [13.567553, 46.359728], - [13.563264, 46.386354], - [13.551757, 46.44966], - [13.52061, 46.539592], - [13.467696, 46.629524], - [13.424768, 46.665438], - [13.333575, 46.719456], - [13.286273, 46.736988], - [13.147778, 46.750639], - [13.009282, 46.72173], - [13.003638, 46.719456], - [12.873239, 46.629524], - [12.870787, 46.625291], - [12.817878, 46.539592], - [12.794113, 46.44966], - [12.792558, 46.359728], - [12.815364, 46.269796], - [12.867497, 46.179864], - [12.870787, 46.176678], - [12.98133, 46.089932] - ], - [ - [15.073333, 46], - [14.9629, 46.089932], - [14.948217, 46.095223], - [14.809722, 46.118811], - [14.684441, 46.089932], - [14.671227, 46.0847], - [14.586932, 46] + [6.638495, 49.179071], + [6.5, 49.161809] ], [ - [15.989697, 46], - [16.019208, 46.089932], - [16.004625, 46.179864], - [15.917685, 46.245906], - [15.77919, 46.265899], - [15.640694, 46.214118], - [15.5712, 46.179864], - [15.502199, 46.131327], - [15.404796, 46.089932], - [15.363703, 46.074808], - [15.248809, 46] + [6.5, 49.444426], + [6.596926, 49.507349] ], [ - [19.227967, 46.269796], - [19.241574, 46.261638], - [19.261103, 46.269796], - [19.241574, 46.28155], - [19.227967, 46.269796] + [6.776991, 49.222896], + [6.638495, 49.179071] ], [ - [17.398412, 46.539592], - [17.441134, 46.509911], - [17.483942, 46.539592], - [17.441134, 46.565069], - [17.398412, 46.539592] + [6.805692, 49.237553], + [6.776991, 49.222896] ], [ - [18.271836, 46.539592], - [18.272106, 46.539023], - [18.274679, 46.539592], - [18.272106, 46.540117], - [18.271836, 46.539592] + [6.915486, 49.311577], + [6.805692, 49.237553] ], [ - [16.866868, 46.629524], - [16.887153, 46.616213], - [16.983186, 46.629524], - [16.887153, 46.686717], - [16.866868, 46.629524] + [6.932951, 49.327485], + [6.915486, 49.311577] ], [ - [12.177161, 46.89932], - [12.17831, 46.898495], - [12.316805, 46.859784], - [12.455301, 46.893482], - [12.464469, 46.89932], - [12.532649, 46.989252], - [12.496746, 47.079184], - [12.455301, 47.13561], - [12.316805, 47.14904], - [12.17831, 47.097102], - [12.154879, 47.079184], - [12.112964, 46.989252], - [12.177161, 46.89932] + [6.994818, 49.417417], + [6.932951, 49.327485] ], [ - [15.606895, 47.079184], - [15.640694, 47.070845], - [15.77919, 47.072803], - [15.789098, 47.079184], - [15.834548, 47.169116], - [15.77919, 47.222509], - [15.664979, 47.259049], - [15.640694, 47.267231], - [15.502199, 47.319692], - [15.363703, 47.279081], - [15.336906, 47.259049], - [15.361223, 47.169116], - [15.363703, 47.167282], - [15.502199, 47.115385], - [15.606895, 47.079184] + [7.017371, 49.507349], + [6.994818, 49.417417] ], [ - [7.857297, 47.169116], - [7.884954, 47.158747], - [8.023449, 47.134087], - [8.161944, 47.147462], - [8.21777, 47.169116], - [8.30044, 47.213026], - [8.353418, 47.259049], - [8.390349, 47.348981], - [8.355468, 47.438913], - [8.30044, 47.478736], - [8.204604, 47.528845], - [8.161944, 47.551659], - [8.062848, 47.618777], - [8.044106, 47.708709], - [8.023449, 47.751713], - [8.000611, 47.798641], - [7.899188, 47.888573], - [7.884954, 47.89919], - [7.746458, 47.938693], - [7.607963, 47.931492], - [7.49141, 47.888573], - [7.469468, 47.873837], - [7.392465, 47.798641], - [7.369353, 47.708709], - [7.398672, 47.618777], [7.469468, 47.539233], - [7.483616, 47.528845], - [7.602787, 47.438913], - [7.607963, 47.432938], - [7.660303, 47.348981], - [7.721771, 47.259049], + [7.398672, 47.618777], + [7.369353, 47.708709], + [7.392465, 47.798641], + [7.469468, 47.873837], + [7.49141, 47.888573], + [7.607963, 47.931492], + [7.746458, 47.938693], + [7.884954, 47.89919], + [7.899188, 47.888573], + [8.000611, 47.798641], + [8.023449, 47.751713], + [8.044106, 47.708709], + [8.062848, 47.618777], + [8.161944, 47.551659], + [8.204604, 47.528845], + [8.30044, 47.478736], + [8.355468, 47.438913], + [8.390349, 47.348981], + [8.353418, 47.259049], + [8.30044, 47.213026], + [8.21777, 47.169116], + [8.161944, 47.147462], + [8.023449, 47.134087], + [7.884954, 47.158747], + [7.857297, 47.169116], [7.746458, 47.240282], - [7.857297, 47.169116] - ], - [ - [12.329096, 47.259049], - [12.455301, 47.183226], - [12.579726, 47.259049], - [12.559982, 47.348981], - [12.455301, 47.385966], - [12.352189, 47.348981], - [12.329096, 47.259049] - ], - [ - [14.575353, 47.259049], - [14.671227, 47.203042], - [14.809722, 47.2071], - [14.890392, 47.259049], - [14.897997, 47.348981], - [14.809722, 47.411845], - [14.671227, 47.417355], - [14.565439, 47.348981], - [14.575353, 47.259049] + [7.721771, 47.259049], + [7.660303, 47.348981], + [7.607963, 47.432938], + [7.602787, 47.438913], + [7.483616, 47.528845], + [7.469468, 47.539233] ], [ - [8.767107, 47.438913], [8.854421, 47.393577], - [8.992917, 47.372654], - [9.131412, 47.412762], - [9.17041, 47.438913], - [9.220799, 47.528845], - [9.206551, 47.618777], - [9.216462, 47.708709], - [9.212607, 47.798641], - [9.131412, 47.87878], - [9.101873, 47.888573], - [8.992917, 47.908661], - [8.942356, 47.888573], - [8.854421, 47.854382], - [8.805405, 47.798641], - [8.779112, 47.708709], - [8.774536, 47.618777], + [8.767107, 47.438913], [8.738554, 47.528845], - [8.767107, 47.438913] + [8.774536, 47.618777], + [8.779112, 47.708709], + [8.805405, 47.798641], + [8.854421, 47.854382], + [8.942356, 47.888573], + [8.992917, 47.908661], + [9.101873, 47.888573], + [9.131412, 47.87878], + [9.212607, 47.798641], + [9.216462, 47.708709], + [9.206551, 47.618777], + [9.220799, 47.528845], + [9.17041, 47.438913], + [9.131412, 47.412762], + [8.992917, 47.372654], + [8.854421, 47.393577] + ], + [ + [12.17831, 46.898495], + [12.177161, 46.89932], + [12.112964, 46.989252], + [12.154879, 47.079184], + [12.17831, 47.097102], + [12.316805, 47.14904], + [12.455301, 47.13561], + [12.496746, 47.079184], + [12.532649, 46.989252], + [12.464469, 46.89932], + [12.455301, 46.893482], + [12.316805, 46.859784], + [12.17831, 46.898495] ], [ - [12.274592, 47.528845], [12.316805, 47.48062], - [12.360972, 47.528845], + [12.274592, 47.528845], [12.316805, 47.539311], - [12.274592, 47.528845] + [12.360972, 47.528845], + [12.316805, 47.48062] ], [ - [16.590133, 47.618777], - [16.610162, 47.604288], - [16.668716, 47.618777], - [16.610162, 47.644458], - [16.590133, 47.618777] + [12.455301, 47.183226], + [12.329096, 47.259049], + [12.352189, 47.348981], + [12.455301, 47.385966], + [12.559982, 47.348981], + [12.579726, 47.259049], + [12.455301, 47.183226] ], [ - [12.607371, 48.068437], [12.732292, 48.019172], - [12.842427, 48.068437], - [12.765117, 48.158369], - [12.732292, 48.169413], + [12.607371, 48.068437], [12.69843, 48.158369], - [12.607371, 48.068437] - ], - [ - [6.5, 49.161809], - [6.638495, 49.179071], - [6.776991, 49.222896], - [6.805692, 49.237553], - [6.915486, 49.311577], - [6.932951, 49.327485], - [6.994818, 49.417417], - [7.017371, 49.507349] + [12.732292, 48.169413], + [12.765117, 48.158369], + [12.842427, 48.068437], + [12.732292, 48.019172] ], [ - [6.596926, 49.507349], - [6.5, 49.444426] - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "stroke-width": 4, - "fill-opacity": 0.4, - "stroke": "green", - "fill": "green", - "pressure": 0.5 - }, - "geometry": { - "type": "MultiLineString", - "coordinates": [ + [12.870787, 46.176678], + [12.867497, 46.179864], + [12.815364, 46.269796], + [12.792558, 46.359728], + [12.794113, 46.44966], + [12.817878, 46.539592], + [12.870787, 46.625291], + [12.873239, 46.629524], + [13.003638, 46.719456], + [13.009282, 46.72173], + [13.147778, 46.750639], + [13.286273, 46.736988], + [13.333575, 46.719456], + [13.424768, 46.665438], + [13.467696, 46.629524], + [13.52061, 46.539592], + [13.551757, 46.44966], + [13.563264, 46.386354], + [13.567553, 46.359728], + [13.564023, 46.269796], + [13.563264, 46.267861], + [13.527199, 46.179864], + [13.426546, 46.089932], + [13.424768, 46.088913], + [13.286273, 46.043257], + [13.147778, 46.040078], + [13.009282, 46.076361], + [12.98133, 46.089932], + [12.870787, 46.176678] + ], [ - [13.682327, 46], - [13.701759, 46.015819], - [13.782815, 46.089932], - [13.833446, 46.179864], - [13.840254, 46.206993], - [13.858124, 46.269796], - [13.858366, 46.359728], - [13.840254, 46.442365], - [13.838909, 46.44966], - [13.804668, 46.539592], - [13.749338, 46.629524], - [13.701759, 46.68041], - [13.664117, 46.719456], - [13.563264, 46.789296], - [13.525358, 46.809388], - [13.424768, 46.851978], - [13.286273, 46.885734], - [13.151005, 46.89932], - [13.147778, 46.899728], - [13.009282, 46.903932], - [12.870787, 46.917991], - [12.792784, 46.989252], - [12.746385, 47.079184], - [12.732292, 47.136674], - [12.726633, 47.169116], - [12.723597, 47.259049], - [12.681485, 47.348981], - [12.593796, 47.396831], - [12.456106, 47.438913], - [12.455301, 47.439296], - [12.409847, 47.528845], - [12.316805, 47.550894], - [12.227878, 47.528845], - [12.286307, 47.438913], - [12.228722, 47.348981], - [12.178407, 47.259049], - [12.17831, 47.258912], - [12.085344, 47.169116], - [12.039815, 47.132358], - [11.986492, 47.079184], - [11.950779, 46.989252], - [11.968106, 46.89932], - [12.039815, 46.810095], - [12.040741, 46.809388], - [12.17831, 46.726561], - [12.206125, 46.719456], - [12.316805, 46.66745], - [12.394556, 46.629524], - [12.429156, 46.539592], - [12.435651, 46.44966], - [12.446405, 46.359728], - [12.455301, 46.327499], - [12.469615, 46.269796], - [12.510938, 46.179864], - [12.578669, 46.089932], - [12.593796, 46.075577], - [12.683417, 46] + [14.586932, 46], + [14.671227, 46.0847], + [14.684441, 46.089932], + [14.809722, 46.118811], + [14.948217, 46.095223], + [14.9629, 46.089932], + [15.073333, 46] ], [ - [16.136546, 46], - [16.150722, 46.089932], - [16.128158, 46.179864], - [16.05618, 46.26467], - [16.049628, 46.269796], - [15.917685, 46.330436], - [15.77919, 46.349711], - [15.640694, 46.338291], - [15.502199, 46.304995], - [15.380442, 46.269796], - [15.363703, 46.263342], - [15.225208, 46.226715], - [15.086713, 46.218284], - [14.948217, 46.232071], - [14.809722, 46.23732], - [14.671227, 46.22058], - [14.552367, 46.179864], - [14.532731, 46.170845], - [14.418486, 46.089932], - [14.394236, 46.040341], - [14.369931, 46] + [14.671227, 47.203042], + [14.575353, 47.259049], + [14.565439, 47.348981], + [14.671227, 47.417355], + [14.809722, 47.411845], + [14.897997, 47.348981], + [14.890392, 47.259049], + [14.809722, 47.2071], + [14.671227, 47.203042] ], [ - [19.192764, 46.269796], - [19.241574, 46.240533], - [19.311629, 46.269796], - [19.241574, 46.311959], - [19.192764, 46.269796] + [15.248809, 46], + [15.363703, 46.074808], + [15.404796, 46.089932], + [15.502199, 46.131327], + [15.5712, 46.179864], + [15.640694, 46.214118], + [15.77919, 46.265899], + [15.917685, 46.245906], + [16.004625, 46.179864], + [16.019208, 46.089932], + [15.989697, 46] ], [ - [17.347844, 46.539592], - [17.441134, 46.474778], - [17.53461, 46.539592], - [17.441134, 46.595224], - [17.347844, 46.539592] + [15.363703, 47.167282], + [15.361223, 47.169116], + [15.336906, 47.259049], + [15.363703, 47.279081], + [15.502199, 47.319692], + [15.640694, 47.267231], + [15.664979, 47.259049], + [15.77919, 47.222509], + [15.834548, 47.169116], + [15.789098, 47.079184], + [15.77919, 47.072803], + [15.640694, 47.070845], + [15.606895, 47.079184], + [15.502199, 47.115385], + [15.363703, 47.167282] ], [ - [18.264737, 46.539592], - [18.272106, 46.524045], - [18.342339, 46.539592], - [18.272106, 46.553925], - [18.264737, 46.539592] + [16.610162, 47.604288], + [16.590133, 47.618777], + [16.610162, 47.644458], + [16.668716, 47.618777], + [16.610162, 47.604288] ], [ - [19.212444, 46.539592], - [19.241574, 46.505856], - [19.245592, 46.539592], - [19.241574, 46.551269], - [19.212444, 46.539592] + [16.887153, 46.616213], + [16.866868, 46.629524], + [16.887153, 46.686717], + [16.983186, 46.629524], + [16.887153, 46.616213] ], [ - [16.806188, 46.629524], - [16.887153, 46.576391], - [17.025648, 46.593742], - [17.066899, 46.629524], - [17.036451, 46.719456], - [17.025648, 46.72559], - [16.887153, 46.739855], - [16.837829, 46.719456], - [16.806188, 46.629524] + [17.441134, 46.509911], + [17.398412, 46.539592], + [17.441134, 46.565069], + [17.483942, 46.539592], + [17.441134, 46.509911] ], [ - [19.230795, 46.719456], - [19.241574, 46.712954], - [19.242707, 46.719456], - [19.241574, 46.720647], - [19.230795, 46.719456] + [18.272106, 46.539023], + [18.271836, 46.539592], + [18.272106, 46.540117], + [18.274679, 46.539592], + [18.272106, 46.539023] ], [ - [7.631978, 46.989252], - [7.746458, 46.964747], - [7.884954, 46.95147], - [8.023449, 46.955862], - [8.161944, 46.979726], - [8.19031, 46.989252], - [8.30044, 47.024747], - [8.407681, 47.079184], - [8.438935, 47.097703], - [8.54754, 47.169116], - [8.577431, 47.193019], - [8.715926, 47.250708], - [8.769221, 47.259049], - [8.854421, 47.268068], - [8.992917, 47.287089], - [9.131412, 47.328127], - [9.172092, 47.348981], - [9.269907, 47.414426], - [9.300866, 47.438913], - [9.36534, 47.528845], - [9.404835, 47.618777], - [9.408403, 47.633183], - [9.42796, 47.708709], - [9.429829, 47.798641], - [9.408403, 47.863255], - [9.398156, 47.888573], - [9.312693, 47.978505], - [9.269907, 48.008354], - [9.131412, 48.054733], - [8.992917, 48.053553], - [8.854421, 47.984391], - [8.85046, 47.978505], - [8.776872, 47.888573], - [8.715926, 47.816949], - [8.699335, 47.798641], - [8.606313, 47.708709], - [8.577431, 47.679114], - [8.438935, 47.645604], - [8.30044, 47.68159], - [8.262172, 47.708709], - [8.164137, 47.798641], - [8.161944, 47.801618], - [8.100121, 47.888573], - [8.038183, 47.978505], - [8.023449, 48.002007], - [7.944769, 48.068437], - [7.884954, 48.114893], - [7.757103, 48.158369], - [7.746458, 48.162429], - [7.607963, 48.182831], - [7.469468, 48.177716], - [7.372032, 48.158369], - [7.330972, 48.150124], - [7.192477, 48.097719], - [7.140225, 48.068437], - [7.053981, 48.005076], - [7.024108, 47.978505], - [6.953518, 47.888573], - [6.915486, 47.799543], - [6.915094, 47.798641], - [6.898708, 47.708709], - [6.904869, 47.618777], - [6.915486, 47.583233], - [6.931048, 47.528845], - [6.977129, 47.438913], - [7.04482, 47.348981], - [7.053981, 47.339333], - [7.132951, 47.259049], - [7.192477, 47.210822], - [7.245823, 47.169116], - [7.330972, 47.116044], - [7.394797, 47.079184], - [7.469468, 47.045416], - [7.607963, 46.995477], - [7.631978, 46.989252] - ], + [19.241574, 46.261638], + [19.227967, 46.269796], + [19.241574, 46.28155], + [19.261103, 46.269796], + [19.241574, 46.261638] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 4, + "fill-opacity": 0.4, + "stroke": "green", + "fill": "green", + "pressure": 0.5 + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [ [ - [15.301081, 47.079184], - [15.363703, 47.051232], - [15.502199, 47.014524], - [15.640694, 46.99557], - [15.77919, 47.01095], - [15.885133, 47.079184], - [15.915177, 47.169116], - [15.829116, 47.259049], - [15.77919, 47.289836], - [15.640953, 47.348981], - [15.640694, 47.349087], - [15.502199, 47.382661], - [15.363703, 47.372228], - [15.286403, 47.348981], - [15.225208, 47.29727], - [15.128914, 47.259049], - [15.175394, 47.169116], - [15.225208, 47.140803], - [15.301081, 47.079184] + [6.638495, 48.924741], + [6.5, 48.911051] ], [ - [14.505265, 47.169116], - [14.532731, 47.151788], - [14.671227, 47.108275], - [14.809722, 47.110822], - [14.948217, 47.157858], - [14.981512, 47.169116], - [15.070376, 47.259049], - [15.049066, 47.348981], - [14.948217, 47.43651], - [14.944964, 47.438913], - [14.809722, 47.491608], - [14.671227, 47.497036], - [14.532731, 47.45479], - [14.505161, 47.438913], - [14.428693, 47.348981], - [14.428535, 47.259049], - [14.505265, 47.169116] + [6.5, 49.476205], + [6.547975, 49.507349] ], [ - [16.55221, 47.618777], - [16.610162, 47.576856], - [16.748657, 47.61171], - [16.753843, 47.618777], - [16.748657, 47.632192], - [16.610162, 47.693084], - [16.55221, 47.618777] + [6.776991, 48.955575], + [6.638495, 48.924741] ], [ - [12.707656, 47.978505], - [12.732292, 47.971499], - [12.789645, 47.978505], - [12.870787, 48.007987], - [12.941498, 48.068437], - [12.920539, 48.158369], - [12.870787, 48.197294], - [12.732292, 48.232741], - [12.593796, 48.193019], - [12.561575, 48.158369], - [12.551601, 48.068437], - [12.593796, 48.030327], - [12.707656, 47.978505] + [6.915486, 47.583233], + [6.904869, 47.618777], + [6.898708, 47.708709], + [6.915094, 47.798641], + [6.915486, 47.799543], + [6.953518, 47.888573], + [7.024108, 47.978505], + [7.053981, 48.005076], + [7.140225, 48.068437], + [7.192477, 48.097719], + [7.330972, 48.150124], + [7.372032, 48.158369], + [7.469468, 48.177716], + [7.607963, 48.182831], + [7.746458, 48.162429], + [7.757103, 48.158369], + [7.884954, 48.114893], + [7.944769, 48.068437], + [8.023449, 48.002007], + [8.038183, 47.978505], + [8.100121, 47.888573], + [8.161944, 47.801618], + [8.164137, 47.798641], + [8.262172, 47.708709], + [8.30044, 47.68159], + [8.438935, 47.645604], + [8.577431, 47.679114], + [8.606313, 47.708709], + [8.699335, 47.798641], + [8.715926, 47.816949], + [8.776872, 47.888573], + [8.85046, 47.978505], + [8.854421, 47.984391], + [8.992917, 48.053553], + [9.131412, 48.054733], + [9.269907, 48.008354], + [9.312693, 47.978505], + [9.398156, 47.888573], + [9.408403, 47.863255], + [9.429829, 47.798641], + [9.42796, 47.708709], + [9.408403, 47.633183], + [9.404835, 47.618777], + [9.36534, 47.528845], + [9.300866, 47.438913], + [9.269907, 47.414426], + [9.172092, 47.348981], + [9.131412, 47.328127], + [8.992917, 47.287089], + [8.854421, 47.268068], + [8.769221, 47.259049], + [8.715926, 47.250708], + [8.577431, 47.193019], + [8.54754, 47.169116], + [8.438935, 47.097703], + [8.407681, 47.079184], + [8.30044, 47.024747], + [8.19031, 46.989252], + [8.161944, 46.979726], + [8.023449, 46.955862], + [7.884954, 46.95147], + [7.746458, 46.964747], + [7.631978, 46.989252], + [7.607963, 46.995477], + [7.469468, 47.045416], + [7.394797, 47.079184], + [7.330972, 47.116044], + [7.245823, 47.169116], + [7.192477, 47.210822], + [7.132951, 47.259049], + [7.053981, 47.339333], + [7.04482, 47.348981], + [6.977129, 47.438913], + [6.931048, 47.528845], + [6.915486, 47.583233] ], [ - [6.5, 48.911051], - [6.638495, 48.924741], - [6.776991, 48.955575], [6.811596, 48.967757], + [6.776991, 48.955575] + ], + [ [6.915486, 49.00276], + [6.811596, 48.967757] + ], + [ [7.021939, 49.057689], + [6.915486, 49.00276] + ], + [ [7.053981, 49.07576], + [7.021939, 49.057689] + ], + [ [7.150894, 49.147621], + [7.053981, 49.07576] + ], + [ [7.192477, 49.187048], + [7.150894, 49.147621] + ], + [ [7.23853, 49.237553], + [7.192477, 49.187048] + ], + [ [7.296208, 49.327485], + [7.23853, 49.237553] + ], + [ [7.329322, 49.417417], - [7.330972, 49.429189], - [7.342413, 49.507349] + [7.296208, 49.327485] ], [ - [6.547975, 49.507349], - [6.5, 49.476205] - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "stroke-width": 4, - "fill-opacity": 0.4, - "stroke": "yellow", - "fill": "yellow", - "pressure": 1.5 - }, - "geometry": { - "type": "MultiLineString", - "coordinates": [ + [7.330972, 49.429189], + [7.329322, 49.417417] + ], [ - [9.076637, 46], - [9.023838, 46.089932], - [8.992917, 46.149581], - [8.980847, 46.179864], - [8.947567, 46.269796], - [8.923286, 46.359728], - [8.908239, 46.44966], - [8.902529, 46.539592], - [8.906369, 46.629524], - [8.920539, 46.719456], - [8.947278, 46.809388], - [8.992196, 46.89932], - [8.992917, 46.900185], - [9.045901, 46.989252], - [9.131412, 47.073855], - [9.13541, 47.079184], - [9.246341, 47.169116], - [9.269907, 47.182985], - [9.388374, 47.259049], - [9.408403, 47.271404], - [9.546898, 47.345925], - [9.55524, 47.348981], - [9.685393, 47.413084], - [9.769285, 47.438913], - [9.823889, 47.464844], - [9.962384, 47.506672], - [10.072761, 47.528845], - [10.10088, 47.538375], - [10.239375, 47.56654], - [10.37787, 47.586162], - [10.516366, 47.600939], - [10.654861, 47.617167], - [10.664976, 47.618777], - [10.793356, 47.70784], - [10.793733, 47.708709], - [10.812499, 47.798641], - [10.821454, 47.888573], - [10.829158, 47.978505], - [10.837701, 48.068437], - [10.847375, 48.158369], - [10.857529, 48.248301], - [10.86678, 48.338233], - [10.873146, 48.428165], - [10.874253, 48.518097], - [10.867657, 48.608029], - [10.851227, 48.697961], - [10.823483, 48.787893], - [10.793356, 48.856992], - [10.784598, 48.877825], - [10.737184, 48.967757], - [10.67907, 49.057689], - [10.654861, 49.090475], - [10.613554, 49.147621], - [10.540663, 49.237553], - [10.516366, 49.265234], - [10.462155, 49.327485], - [10.377889, 49.417417], - [10.37787, 49.417436], - [10.290136, 49.507349] + [7.342413, 49.507349], + [7.330972, 49.429189] ], [ - [16.592577, 46], - [16.590061, 46.089932], - [16.578313, 46.179864], - [16.559915, 46.269796], - [16.541407, 46.359728], - [16.610162, 46.434062], - [16.748657, 46.403885], - [16.887153, 46.396626], - [17.025648, 46.407986], - [17.164143, 46.411907], - [17.302639, 46.377954], - [17.441134, 46.373181], - [17.579629, 46.428804], - [17.595745, 46.44966], - [17.628462, 46.539592], - [17.581379, 46.629524], - [17.579629, 46.631083], - [17.441134, 46.677818], - [17.302639, 46.676038], - [17.215772, 46.719456], - [17.164143, 46.743029], - [17.043406, 46.809388], - [17.025648, 46.815838], - [16.887153, 46.83267], - [16.748657, 46.810272], - [16.74529, 46.809388], - [16.610162, 46.733621], - [16.580533, 46.719456], - [16.511648, 46.629524], - [16.493105, 46.539592], - [16.471666, 46.474268], - [16.333171, 46.53624], - [16.32789, 46.539592], - [16.194676, 46.613232], - [16.169279, 46.629524], - [16.083398, 46.719456], - [16.073257, 46.809388], - [16.102939, 46.89932], - [16.136477, 46.989252], - [16.155541, 47.079184], - [16.152129, 47.169116], - [16.120148, 47.259049], - [16.05618, 47.33774], - [16.044939, 47.348981], - [15.917685, 47.434794], - [15.910069, 47.438913], - [15.77919, 47.513401], - [15.744222, 47.528845], - [15.640694, 47.586458], - [15.55448, 47.618777], - [15.502199, 47.64359], - [15.363703, 47.692849], - [15.313234, 47.708709], - [15.225208, 47.740815], - [15.086713, 47.786132], - [15.041543, 47.798641], - [14.948217, 47.827326], - [14.809722, 47.860662], - [14.671227, 47.885177], - [14.642906, 47.888573], - [14.532731, 47.905513], - [14.394236, 47.921896], - [14.255741, 47.937765], - [14.117245, 47.958595], - [14.028933, 47.978505], - [13.97875, 47.993475], - [13.840254, 48.058984], - [13.827353, 48.068437], - [13.727302, 48.158369], - [13.701759, 48.183307], - [13.650372, 48.248301], - [13.567587, 48.338233], - [13.563264, 48.342195], - [13.473265, 48.428165], - [13.424768, 48.465242], - [13.347942, 48.518097], - [13.286273, 48.554543], - [13.168702, 48.608029], - [13.147778, 48.617236], - [13.009282, 48.661622], - [12.870787, 48.686808], - [12.732292, 48.69587], - [12.593796, 48.6893], - [12.455301, 48.6621], - [12.333473, 48.608029], - [12.316805, 48.598311], - [12.230607, 48.518097], - [12.195719, 48.428165], - [12.198193, 48.338233], - [12.226051, 48.248301], - [12.282371, 48.158369], - [12.316805, 48.134861], - [12.363634, 48.068437], - [12.455301, 48.009023], - [12.491218, 47.978505], - [12.593796, 47.924983], - [12.693198, 47.888573], - [12.732292, 47.86344], - [12.870787, 47.81152], - [12.920553, 47.798641], - [12.987237, 47.708709], - [12.902702, 47.618777], - [12.870787, 47.608209], - [12.732292, 47.572032], - [12.593796, 47.56206], - [12.455301, 47.576126], - [12.316805, 47.595442], - [12.17831, 47.57302], - [12.039815, 47.539121], - [11.966066, 47.528845], - [11.901319, 47.506535], - [11.762824, 47.49419], - [11.624329, 47.494233], - [11.485833, 47.501139], - [11.347338, 47.511257], - [11.208842, 47.520545], - [11.070347, 47.52122], - [10.931852, 47.447818], - [10.92844, 47.438913], - [10.915491, 47.348981], - [10.91425, 47.259049], - [10.915149, 47.169116], - [10.914888, 47.079184], - [10.911672, 46.989252], - [10.904169, 46.89932], - [10.891167, 46.809388], - [10.871485, 46.719456], - [10.844069, 46.629524], - [10.808187, 46.539592], - [10.793356, 46.507156], - [10.765193, 46.44966], - [10.713111, 46.359728], - [10.654861, 46.273738], - [10.6517, 46.269796], - [10.580211, 46.179864], - [10.516366, 46.105213], + [12.039815, 46.810095], + [11.968106, 46.89932], + [11.950779, 46.989252], + [11.986492, 47.079184], + [12.039815, 47.132358], + [12.085344, 47.169116], + [12.17831, 47.258912], + [12.178407, 47.259049], + [12.228722, 47.348981], + [12.286307, 47.438913], + [12.227878, 47.528845], + [12.316805, 47.550894], + [12.409847, 47.528845], + [12.455301, 47.439296], + [12.456106, 47.438913], + [12.593796, 47.396831], + [12.681485, 47.348981], + [12.723597, 47.259049], + [12.726633, 47.169116], + [12.732292, 47.136674], + [12.746385, 47.079184], + [12.792784, 46.989252], + [12.870787, 46.917991], + [13.009282, 46.903932], + [13.147778, 46.899728], + [13.151005, 46.89932], + [13.286273, 46.885734], + [13.424768, 46.851978], + [13.525358, 46.809388], + [13.563264, 46.789296], + [13.664117, 46.719456], + [13.701759, 46.68041], + [13.749338, 46.629524], + [13.804668, 46.539592], + [13.838909, 46.44966], + [13.840254, 46.442365], + [13.858366, 46.359728], + [13.858124, 46.269796], + [13.840254, 46.206993], + [13.833446, 46.179864], + [13.782815, 46.089932], + [13.701759, 46.015819], + [13.682327, 46] + ], + [ + [12.17831, 46.726561], + [12.040741, 46.809388], + [12.039815, 46.810095] + ], + [ + [12.316805, 46.66745], + [12.206125, 46.719456], + [12.17831, 46.726561] + ], + [ + [12.455301, 46.327499], + [12.446405, 46.359728], + [12.435651, 46.44966], + [12.429156, 46.539592], + [12.394556, 46.629524], + [12.316805, 46.66745] + ], + [ + [12.593796, 46.075577], + [12.578669, 46.089932], + [12.510938, 46.179864], + [12.469615, 46.269796], + [12.455301, 46.327499] + ], + [ + [12.593796, 48.030327], + [12.551601, 48.068437], + [12.561575, 48.158369], + [12.593796, 48.193019], + [12.732292, 48.232741], + [12.870787, 48.197294], + [12.920539, 48.158369], + [12.941498, 48.068437], + [12.870787, 48.007987], + [12.789645, 47.978505], + [12.732292, 47.971499], + [12.707656, 47.978505], + [12.593796, 48.030327] + ], + [ + [12.683417, 46], + [12.593796, 46.075577] + ], + [ + [14.369931, 46], + [14.394236, 46.040341], + [14.418486, 46.089932], + [14.532731, 46.170845], + [14.552367, 46.179864], + [14.671227, 46.22058], + [14.809722, 46.23732], + [14.948217, 46.232071], + [15.086713, 46.218284], + [15.225208, 46.226715], + [15.363703, 46.263342], + [15.380442, 46.269796], + [15.502199, 46.304995], + [15.640694, 46.338291], + [15.77919, 46.349711], + [15.917685, 46.330436], + [16.049628, 46.269796], + [16.05618, 46.26467], + [16.128158, 46.179864], + [16.150722, 46.089932], + [16.136546, 46] + ], + [ + [14.532731, 47.151788], + [14.505265, 47.169116], + [14.428535, 47.259049], + [14.428693, 47.348981], + [14.505161, 47.438913], + [14.532731, 47.45479], + [14.671227, 47.497036], + [14.809722, 47.491608], + [14.944964, 47.438913], + [14.948217, 47.43651], + [15.049066, 47.348981], + [15.070376, 47.259049], + [14.981512, 47.169116], + [14.948217, 47.157858], + [14.809722, 47.110822], + [14.671227, 47.108275], + [14.532731, 47.151788] + ], + [ + [15.225208, 47.140803], + [15.175394, 47.169116], + [15.128914, 47.259049], + [15.225208, 47.29727], + [15.286403, 47.348981], + [15.363703, 47.372228], + [15.502199, 47.382661], + [15.640694, 47.349087], + [15.640953, 47.348981], + [15.77919, 47.289836], + [15.829116, 47.259049], + [15.915177, 47.169116], + [15.885133, 47.079184], + [15.77919, 47.01095], + [15.640694, 46.99557], + [15.502199, 47.014524], + [15.363703, 47.051232], + [15.301081, 47.079184], + [15.225208, 47.140803] + ], + [ + [16.610162, 47.576856], + [16.55221, 47.618777], + [16.610162, 47.693084], + [16.748657, 47.632192], + [16.753843, 47.618777], + [16.748657, 47.61171], + [16.610162, 47.576856] + ], + [ + [16.887153, 46.576391], + [16.806188, 46.629524], + [16.837829, 46.719456], + [16.887153, 46.739855], + [17.025648, 46.72559], + [17.036451, 46.719456], + [17.066899, 46.629524], + [17.025648, 46.593742], + [16.887153, 46.576391] + ], + [ + [17.441134, 46.474778], + [17.347844, 46.539592], + [17.441134, 46.595224], + [17.53461, 46.539592], + [17.441134, 46.474778] + ], + [ + [18.272106, 46.524045], + [18.264737, 46.539592], + [18.272106, 46.553925], + [18.342339, 46.539592], + [18.272106, 46.524045] + ], + [ + [19.241574, 46.240533], + [19.192764, 46.269796], + [19.241574, 46.311959], + [19.311629, 46.269796], + [19.241574, 46.240533] + ], + [ + [19.241574, 46.505856], + [19.212444, 46.539592], + [19.241574, 46.551269], + [19.245592, 46.539592], + [19.241574, 46.505856] + ], + [ + [19.241574, 46.712954], + [19.230795, 46.719456], + [19.241574, 46.720647], + [19.242707, 46.719456], + [19.241574, 46.712954] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 4, + "fill-opacity": 0.4, + "stroke": "yellow", + "fill": "yellow", + "pressure": 1.5 + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [ + [ + [8.980847, 46.179864], + [8.992917, 46.149581], + [9.023838, 46.089932], + [9.076637, 46] + ], + [ + [8.947567, 46.269796], + [8.980847, 46.179864] + ], + [ + [8.923286, 46.359728], + [8.947567, 46.269796] + ], + [ + [8.908239, 46.44966], + [8.923286, 46.359728] + ], + [ + [8.902529, 46.539592], + [8.908239, 46.44966] + ], + [ + [8.906369, 46.629524], + [8.902529, 46.539592] + ], + [ + [8.920539, 46.719456], + [8.906369, 46.629524] + ], + [ + [8.947278, 46.809388], + [8.920539, 46.719456] + ], + [ + [8.992196, 46.89932], + [8.947278, 46.809388] + ], + [ + [8.992917, 46.900185], + [8.992196, 46.89932] + ], + [ + [9.045901, 46.989252], + [8.992917, 46.900185] + ], + [ + [9.131412, 47.073855], + [9.045901, 46.989252] + ], + [ + [9.13541, 47.079184], + [9.131412, 47.073855] + ], + [ + [9.246341, 47.169116], + [9.13541, 47.079184] + ], + [ + [9.269907, 47.182985], + [9.246341, 47.169116] + ], + [ + [9.388374, 47.259049], + [9.269907, 47.182985] + ], + [ + [9.408403, 47.271404], + [9.388374, 47.259049] + ], + [ + [9.546898, 47.345925], + [9.408403, 47.271404] + ], + [ + [9.55524, 47.348981], + [9.546898, 47.345925] + ], + [ + [9.685393, 47.413084], + [9.55524, 47.348981] + ], + [ + [9.769285, 47.438913], + [9.685393, 47.413084] + ], + [ + [9.823889, 47.464844], + [9.769285, 47.438913] + ], + [ + [9.962384, 47.506672], + [9.823889, 47.464844] + ], + [ + [10.072761, 47.528845], + [9.962384, 47.506672] + ], + [ + [10.10088, 47.538375], + [10.072761, 47.528845] + ], + [ + [10.239375, 47.56654], + [10.10088, 47.538375] + ], + [ + [10.37787, 47.586162], + [10.239375, 47.56654] + ], + [ + [10.290136, 49.507349], + [10.37787, 49.417436], + [10.377889, 49.417417], + [10.462155, 49.327485], + [10.516366, 49.265234], + [10.540663, 49.237553], + [10.613554, 49.147621], + [10.654861, 49.090475], + [10.67907, 49.057689], + [10.737184, 48.967757], + [10.784598, 48.877825], + [10.793356, 48.856992], + [10.823483, 48.787893], + [10.851227, 48.697961], + [10.867657, 48.608029], + [10.874253, 48.518097], + [10.873146, 48.428165], + [10.86678, 48.338233], + [10.857529, 48.248301], + [10.847375, 48.158369], + [10.837701, 48.068437], + [10.829158, 47.978505], + [10.821454, 47.888573], + [10.812499, 47.798641], + [10.793733, 47.708709], + [10.793356, 47.70784], + [10.664976, 47.618777], + [10.654861, 47.617167], + [10.516366, 47.600939], + [10.37787, 47.586162] + ], + [ + [10.407143, 46], [10.499599, 46.089932], - [10.407143, 46] + [10.516366, 46.105213], + [10.580211, 46.179864], + [10.6517, 46.269796], + [10.654861, 46.273738], + [10.713111, 46.359728], + [10.765193, 46.44966], + [10.793356, 46.507156], + [10.808187, 46.539592], + [10.844069, 46.629524], + [10.871485, 46.719456], + [10.891167, 46.809388], + [10.904169, 46.89932], + [10.911672, 46.989252], + [10.914888, 47.079184], + [10.915149, 47.169116], + [10.91425, 47.259049], + [10.915491, 47.348981], + [10.92844, 47.438913], + [10.931852, 47.447818], + [11.070347, 47.52122], + [11.208842, 47.520545], + [11.347338, 47.511257], + [11.485833, 47.501139], + [11.624329, 47.494233], + [11.762824, 47.49419], + [11.901319, 47.506535], + [11.966066, 47.528845], + [12.039815, 47.539121], + [12.17831, 47.57302], + [12.316805, 47.595442], + [12.455301, 47.576126], + [12.593796, 47.56206], + [12.732292, 47.572032], + [12.870787, 47.608209], + [12.902702, 47.618777], + [12.987237, 47.708709], + [12.920553, 47.798641], + [12.870787, 47.81152], + [12.732292, 47.86344], + [12.693198, 47.888573], + [12.593796, 47.924983], + [12.491218, 47.978505], + [12.455301, 48.009023], + [12.363634, 48.068437], + [12.316805, 48.134861], + [12.282371, 48.158369], + [12.226051, 48.248301], + [12.198193, 48.338233], + [12.195719, 48.428165], + [12.230607, 48.518097], + [12.316805, 48.598311], + [12.333473, 48.608029], + [12.455301, 48.6621], + [12.593796, 48.6893], + [12.732292, 48.69587], + [12.870787, 48.686808], + [13.009282, 48.661622], + [13.147778, 48.617236], + [13.168702, 48.608029], + [13.286273, 48.554543], + [13.347942, 48.518097], + [13.424768, 48.465242], + [13.473265, 48.428165], + [13.563264, 48.342195], + [13.567587, 48.338233], + [13.650372, 48.248301], + [13.701759, 48.183307], + [13.727302, 48.158369], + [13.827353, 48.068437], + [13.840254, 48.058984], + [13.97875, 47.993475], + [14.028933, 47.978505], + [14.117245, 47.958595], + [14.255741, 47.937765], + [14.394236, 47.921896], + [14.532731, 47.905513], + [14.642906, 47.888573], + [14.671227, 47.885177], + [14.809722, 47.860662], + [14.948217, 47.827326], + [15.041543, 47.798641], + [15.086713, 47.786132], + [15.225208, 47.740815], + [15.313234, 47.708709], + [15.363703, 47.692849], + [15.502199, 47.64359], + [15.55448, 47.618777], + [15.640694, 47.586458], + [15.744222, 47.528845], + [15.77919, 47.513401], + [15.910069, 47.438913], + [15.917685, 47.434794], + [16.044939, 47.348981], + [16.05618, 47.33774], + [16.120148, 47.259049], + [16.152129, 47.169116], + [16.155541, 47.079184], + [16.136477, 46.989252], + [16.102939, 46.89932], + [16.073257, 46.809388], + [16.083398, 46.719456], + [16.169279, 46.629524], + [16.194676, 46.613232], + [16.32789, 46.539592], + [16.333171, 46.53624], + [16.471666, 46.474268], + [16.493105, 46.539592], + [16.511648, 46.629524], + [16.580533, 46.719456], + [16.610162, 46.733621], + [16.74529, 46.809388], + [16.748657, 46.810272], + [16.887153, 46.83267], + [17.025648, 46.815838], + [17.043406, 46.809388], + [17.164143, 46.743029], + [17.215772, 46.719456], + [17.302639, 46.676038], + [17.441134, 46.677818], + [17.579629, 46.631083], + [17.581379, 46.629524], + [17.628462, 46.539592], + [17.595745, 46.44966], + [17.579629, 46.428804], + [17.441134, 46.373181], + [17.302639, 46.377954], + [17.164143, 46.411907], + [17.025648, 46.407986], + [16.887153, 46.396626], + [16.748657, 46.403885], + [16.610162, 46.434062], + [16.541407, 46.359728], + [16.559915, 46.269796], + [16.578313, 46.179864], + [16.590061, 46.089932], + [16.592577, 46] ], [ - [19.110731, 46.179864], - [19.241574, 46.143947], - [19.290855, 46.179864], - [19.380069, 46.217079], - [19.454091, 46.269796], - [19.390246, 46.359728], - [19.380069, 46.373683], - [19.328314, 46.44966], - [19.308501, 46.539592], - [19.270089, 46.629524], - [19.276687, 46.719456], - [19.241574, 46.756326], - [19.103078, 46.752041], - [19.043162, 46.719456], - [19.031576, 46.629524], - [18.997661, 46.539592], - [18.997368, 46.44966], - [19.0463, 46.359728], - [19.03808, 46.269796], - [19.103078, 46.183635], - [19.110731, 46.179864] + [16.471666, 47.523183], + [16.459871, 47.528845], + [16.39275, 47.618777], + [16.423799, 47.708709], + [16.471666, 47.739752], + [16.610162, 47.780929], + [16.748657, 47.750989], + [16.795822, 47.708709], + [16.825353, 47.618777], + [16.760528, 47.528845], + [16.748657, 47.518876], + [16.610162, 47.486471], + [16.471666, 47.523183] ], [ - [18.237432, 46.539592], [18.272106, 46.466439], - [18.410602, 46.458147], - [18.486898, 46.539592], - [18.410602, 46.606569], + [18.237432, 46.539592], [18.272106, 46.607031], - [18.237432, 46.539592] + [18.410602, 46.606569], + [18.486898, 46.539592], + [18.410602, 46.458147], + [18.272106, 46.466439] ], [ - [16.459871, 47.528845], - [16.471666, 47.523183], - [16.610162, 47.486471], - [16.748657, 47.518876], - [16.760528, 47.528845], - [16.825353, 47.618777], - [16.795822, 47.708709], - [16.748657, 47.750989], - [16.610162, 47.780929], - [16.471666, 47.739752], - [16.423799, 47.708709], - [16.39275, 47.618777], - [16.459871, 47.528845] + [19.103078, 46.183635], + [19.03808, 46.269796], + [19.0463, 46.359728], + [18.997368, 46.44966], + [18.997661, 46.539592], + [19.031576, 46.629524], + [19.043162, 46.719456], + [19.103078, 46.752041], + [19.241574, 46.756326], + [19.276687, 46.719456], + [19.270089, 46.629524], + [19.308501, 46.539592], + [19.328314, 46.44966], + [19.380069, 46.373683], + [19.390246, 46.359728], + [19.454091, 46.269796], + [19.380069, 46.217079], + [19.290855, 46.179864], + [19.241574, 46.143947], + [19.110731, 46.179864], + [19.103078, 46.183635] ] ] } @@ -812,191 +962,197 @@ { "type": "Feature", "properties": { - "stroke-width": 4, - "fill-opacity": 0.4, - "stroke": "red", - "fill": "red", - "pressure": 2.5 - }, - "geometry": { - "type": "MultiLineString", - "coordinates": [ - [ - [17.228682, 46], - [17.291854, 46.089932], - [17.302639, 46.097422], - [17.407115, 46.179864], - [17.441134, 46.193583], - [17.541729, 46.269796], - [17.579629, 46.28893], - [17.634275, 46.359728], - [17.680021, 46.44966], - [17.691965, 46.539592], - [17.66221, 46.629524], - [17.579629, 46.703093], - [17.528871, 46.719456], - [17.441134, 46.748337], - [17.302639, 46.78247], - [17.246781, 46.809388], - [17.164143, 46.841479], - [17.025648, 46.889983], - [16.970246, 46.89932], - [16.887153, 46.916589], - [16.748657, 46.930836], - [16.610162, 46.951422], - [16.523719, 46.989252], - [16.471666, 47.045057], - [16.451039, 47.079184], - [16.424896, 47.169116], - [16.424356, 47.259049], - [16.471666, 47.331177], - [16.484599, 47.348981], - [16.610162, 47.392326], - [16.701619, 47.438913], - [16.748657, 47.452226], - [16.839894, 47.528845], - [16.887153, 47.602076], - [16.893165, 47.618777], - [16.887153, 47.663804], - [16.876259, 47.708709], - [16.782712, 47.798641], - [16.748657, 47.826174], - [16.610162, 47.869874], - [16.471666, 47.885475], - [16.424961, 47.888573], - [16.333171, 47.898463], - [16.194676, 47.921745], - [16.05618, 47.952087], - [15.952032, 47.978505], - [15.917685, 47.98884], - [15.77919, 48.037764], - [15.708671, 48.068437], - [15.640694, 48.102297], - [15.536352, 48.158369], - [15.502199, 48.179469], - [15.390694, 48.248301], - [15.363703, 48.267499], - [15.260608, 48.338233], - [15.225208, 48.366249], - [15.142925, 48.428165], - [15.086713, 48.476862], - [15.03645, 48.518097], - [14.948217, 48.600843], - [14.940128, 48.608029], - [14.849822, 48.697961], - [14.809722, 48.742499], - [14.766367, 48.787893], - [14.687931, 48.877825], - [14.671227, 48.898571], - [14.611763, 48.967757], - [14.539245, 49.057689], - [14.532731, 49.066291], - [14.466594, 49.147621], - [14.39668, 49.237553], - [14.394236, 49.240875], - [14.325526, 49.327485], - [14.256739, 49.417417], - [14.255741, 49.418794], - [14.186388, 49.507349] + "stroke-width": 4, + "fill-opacity": 0.4, + "stroke": "red", + "fill": "red", + "pressure": 2.5 + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [ + [ + [9.337463, 46.809388], + [9.408403, 46.722835], + [9.412794, 46.719456], + [9.546898, 46.641769], + [9.598208, 46.629524], + [9.685393, 46.606681], + [9.823889, 46.60198], + [9.962384, 46.626776], + [9.969751, 46.629524], + [10.10088, 46.681361], + [10.157625, 46.719456], + [10.239375, 46.80073], + [10.246587, 46.809388], + [10.291062, 46.89932], + [10.297274, 46.989252], + [10.264072, 47.079184], + [10.239375, 47.107527], + [10.181396, 47.169116], + [10.10088, 47.214757], + [9.962384, 47.256597], + [9.928408, 47.259049], + [9.823889, 47.265833], + [9.781217, 47.259049], + [9.685393, 47.247314], + [9.546898, 47.20002], + [9.491862, 47.169116], + [9.408403, 47.10523], + [9.377816, 47.079184], + [9.322633, 46.989252], + [9.310428, 46.89932], + [9.337463, 46.809388] ], [ - [19.524275, 46], - [19.604919, 46.089932], - [19.613445, 46.179864], - [19.573761, 46.269796], - [19.518564, 46.328235], - [19.494163, 46.359728], - [19.41019, 46.44966], - [19.380069, 46.519113], - [19.37141, 46.539592], - [19.319945, 46.629524], - [19.310666, 46.719456], - [19.241574, 46.792005], - [19.103078, 46.805928], - [18.964583, 46.738569], - [18.931088, 46.719456], - [18.86127, 46.629524], - [18.826088, 46.563233], - [18.78062, 46.539592], - [18.726895, 46.44966], - [18.747193, 46.359728], - [18.775267, 46.269796], - [18.814561, 46.179864], - [18.826088, 46.163575], - [18.876486, 46.089932], - [18.964583, 46.020322], - [19.006245, 46] + [11.841028, 47.798641], + [11.901319, 47.714874], + [11.904159, 47.708709], + [12.039815, 47.646328], + [12.17831, 47.628932], + [12.316805, 47.62992], + [12.455301, 47.631881], + [12.593796, 47.671104], + [12.655704, 47.708709], + [12.648396, 47.798641], + [12.593796, 47.833834], + [12.522784, 47.888573], + [12.455301, 47.924652], + [12.316805, 47.976579], + [12.300928, 47.978505], + [12.17831, 48.008742], + [12.039815, 47.999507], + [11.979483, 47.978505], + [11.901319, 47.928979], + [11.860265, 47.888573], + [11.841028, 47.798641] + ], + [ + [14.186388, 49.507349], + [14.255741, 49.418794], + [14.256739, 49.417417], + [14.325526, 49.327485], + [14.394236, 49.240875], + [14.39668, 49.237553], + [14.466594, 49.147621], + [14.532731, 49.066291], + [14.539245, 49.057689], + [14.611763, 48.967757], + [14.671227, 48.898571], + [14.687931, 48.877825], + [14.766367, 48.787893], + [14.809722, 48.742499], + [14.849822, 48.697961], + [14.940128, 48.608029], + [14.948217, 48.600843], + [15.03645, 48.518097], + [15.086713, 48.476862], + [15.142925, 48.428165], + [15.225208, 48.366249], + [15.260608, 48.338233], + [15.363703, 48.267499], + [15.390694, 48.248301], + [15.502199, 48.179469], + [15.536352, 48.158369], + [15.640694, 48.102297], + [15.708671, 48.068437], + [15.77919, 48.037764], + [15.917685, 47.98884], + [15.952032, 47.978505], + [16.05618, 47.952087], + [16.194676, 47.921745], + [16.333171, 47.898463], + [16.424961, 47.888573], + [16.471666, 47.885475], + [16.610162, 47.869874], + [16.748657, 47.826174], + [16.782712, 47.798641], + [16.876259, 47.708709], + [16.887153, 47.663804], + [16.893165, 47.618777], + [16.887153, 47.602076], + [16.839894, 47.528845], + [16.748657, 47.452226], + [16.701619, 47.438913], + [16.610162, 47.392326], + [16.484599, 47.348981], + [16.471666, 47.331177], + [16.424356, 47.259049], + [16.424896, 47.169116], + [16.451039, 47.079184], + [16.471666, 47.045057], + [16.523719, 46.989252], + [16.610162, 46.951422], + [16.748657, 46.930836], + [16.887153, 46.916589], + [16.970246, 46.89932], + [17.025648, 46.889983], + [17.164143, 46.841479], + [17.246781, 46.809388], + [17.302639, 46.78247], + [17.441134, 46.748337], + [17.528871, 46.719456], + [17.579629, 46.703093], + [17.66221, 46.629524], + [17.691965, 46.539592], + [17.680021, 46.44966], + [17.634275, 46.359728], + [17.579629, 46.28893], + [17.541729, 46.269796], + [17.441134, 46.193583], + [17.407115, 46.179864], + [17.302639, 46.097422], + [17.291854, 46.089932], + [17.228682, 46] ], [ - [18.233988, 46.44966], [18.272106, 46.391555], - [18.410602, 46.36377], - [18.549097, 46.390896], - [18.657319, 46.44966], - [18.652106, 46.539592], - [18.549097, 46.617108], - [18.538193, 46.629524], - [18.410602, 46.675969], - [18.272106, 46.663224], - [18.240845, 46.629524], + [18.233988, 46.44966], [18.210127, 46.539592], - [18.233988, 46.44966] + [18.240845, 46.629524], + [18.272106, 46.663224], + [18.410602, 46.675969], + [18.538193, 46.629524], + [18.549097, 46.617108], + [18.652106, 46.539592], + [18.657319, 46.44966], + [18.549097, 46.390896], + [18.410602, 46.36377], + [18.272106, 46.391555] ], [ - [9.685393, 46.606681], - [9.598208, 46.629524], - [9.546898, 46.641769], - [9.412794, 46.719456], - [9.408403, 46.722835], - [9.337463, 46.809388], - [9.310428, 46.89932], - [9.322633, 46.989252], - [9.377816, 47.079184], - [9.408403, 47.10523], - [9.491862, 47.169116], - [9.546898, 47.20002], - [9.685393, 47.247314], - [9.781217, 47.259049], - [9.823889, 47.265833], - [9.928408, 47.259049], - [9.962384, 47.256597], - [10.10088, 47.214757], - [10.181396, 47.169116], - [10.239375, 47.107527], - [10.264072, 47.079184], - [10.297274, 46.989252], - [10.291062, 46.89932], - [10.246587, 46.809388], - [10.239375, 46.80073], - [10.157625, 46.719456], - [10.10088, 46.681361], - [9.969751, 46.629524], - [9.962384, 46.626776], - [9.823889, 46.60198], - [9.685393, 46.606681] + [18.826088, 46.163575], + [18.814561, 46.179864], + [18.775267, 46.269796], + [18.747193, 46.359728], + [18.726895, 46.44966], + [18.78062, 46.539592], + [18.826088, 46.563233], + [18.86127, 46.629524], + [18.931088, 46.719456], + [18.964583, 46.738569], + [19.103078, 46.805928], + [19.241574, 46.792005], + [19.310666, 46.719456], + [19.319945, 46.629524], + [19.37141, 46.539592], + [19.380069, 46.519113], + [19.41019, 46.44966], + [19.494163, 46.359728], + [19.518564, 46.328235], + [19.573761, 46.269796], + [19.613445, 46.179864], + [19.604919, 46.089932], + [19.524275, 46] ], [ - [12.039815, 47.646328], - [11.904159, 47.708709], - [11.901319, 47.714874], - [11.841028, 47.798641], - [11.860265, 47.888573], - [11.901319, 47.928979], - [11.979483, 47.978505], - [12.039815, 47.999507], - [12.17831, 48.008742], - [12.300928, 47.978505], - [12.316805, 47.976579], - [12.455301, 47.924652], - [12.522784, 47.888573], - [12.593796, 47.833834], - [12.648396, 47.798641], - [12.655704, 47.708709], - [12.593796, 47.671104], - [12.455301, 47.631881], - [12.316805, 47.62992], - [12.17831, 47.628932], - [12.039815, 47.646328] + [18.964583, 46.020322], + [18.876486, 46.089932], + [18.826088, 46.163575] + ], + [ + [19.006245, 46], + [18.964583, 46.020322] ] ] } @@ -1016,6 +1172,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isolines/test/out/matrix1.geojson b/packages/turf-isolines/test/out/matrix1.geojson index a486ad2c56..e245719583 100644 --- a/packages/turf-isolines/test/out/matrix1.geojson +++ b/packages/turf-isolines/test/out/matrix1.geojson @@ -10,25 +10,25 @@ "type": "MultiLineString", "coordinates": [ [ - [11.054363, 44.234898], [10.990772, 44.279864], - [10.990772, 44.459728], - [10.990772, 44.639592], - [10.990772, 44.819456], - [11.054363, 44.864422], - [11.308726, 44.864422], - [11.56309, 44.864422], - [11.817453, 44.864422], - [12.071816, 44.864422], - [12.135407, 44.819456], - [12.135407, 44.639592], - [12.135407, 44.459728], - [12.135407, 44.279864], - [12.071816, 44.234898], - [11.817453, 44.234898], - [11.56309, 44.234898], + [11.054363, 44.234898], [11.308726, 44.234898], - [11.054363, 44.234898] + [11.56309, 44.234898], + [11.817453, 44.234898], + [12.071816, 44.234898], + [12.135407, 44.279864], + [12.135407, 44.459728], + [12.135407, 44.639592], + [12.135407, 44.819456], + [12.071816, 44.864422], + [11.817453, 44.864422], + [11.56309, 44.864422], + [11.308726, 44.864422], + [11.054363, 44.864422], + [10.990772, 44.819456], + [10.990772, 44.639592], + [10.990772, 44.459728], + [10.990772, 44.279864] ] ] } @@ -42,17 +42,17 @@ "type": "MultiLineString", "coordinates": [ [ - [11.308726, 44.387783], [11.206981, 44.459728], - [11.130672, 44.639592], - [11.308726, 44.765497], - [11.56309, 44.765497], - [11.817453, 44.765497], - [11.995507, 44.639592], - [11.919198, 44.459728], - [11.817453, 44.387783], + [11.308726, 44.387783], [11.56309, 44.387783], - [11.308726, 44.387783] + [11.817453, 44.387783], + [11.919198, 44.459728], + [11.995507, 44.639592], + [11.817453, 44.765497], + [11.56309, 44.765497], + [11.308726, 44.765497], + [11.130672, 44.639592], + [11.206981, 44.459728] ] ] } @@ -66,15 +66,15 @@ "type": "MultiLineString", "coordinates": [ [ - [11.308726, 44.531674], [11.232417, 44.639592], - [11.308726, 44.693551], - [11.56309, 44.693551], - [11.817453, 44.693551], - [11.893762, 44.639592], - [11.817453, 44.531674], + [11.308726, 44.531674], [11.56309, 44.531674], - [11.308726, 44.531674] + [11.817453, 44.531674], + [11.893762, 44.639592], + [11.817453, 44.693551], + [11.56309, 44.693551], + [11.308726, 44.693551], + [11.232417, 44.639592] ] ] } @@ -82,6 +82,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isolines/test/out/matrix2.geojson b/packages/turf-isolines/test/out/matrix2.geojson index ebcf84ca71..6d9c5ed85e 100644 --- a/packages/turf-isolines/test/out/matrix2.geojson +++ b/packages/turf-isolines/test/out/matrix2.geojson @@ -14,38 +14,38 @@ "type": "MultiLineString", "coordinates": [ [ - [11.490843, 44.179864], - [11.619012, 44.161878], - [11.747181, 44.179864], - [11.87535, 44.209841], - [12.088964, 44.359728], - [12.088964, 44.539592], - [12.131687, 44.629524], - [12.157321, 44.719456], - [12.131687, 44.809388], - [12.088964, 44.89932], - [12.088964, 45.079184], - [11.87535, 45.229071], - [11.747181, 45.259049], - [11.619012, 45.277035], - [11.490843, 45.259049], - [11.362675, 45.229071], - [11.14906, 45.079184], - [11.14906, 44.89932], - [11.106337, 44.809388], - [11.080704, 44.719456], [11.106337, 44.629524], - [11.14906, 44.539592], - [11.14906, 44.359728], + [11.080704, 44.719456], + [11.106337, 44.809388], + [11.14906, 44.89932], + [11.14906, 45.079184], + [11.362675, 45.229071], + [11.490843, 45.259049], + [11.619012, 45.277035], + [11.747181, 45.259049], + [11.87535, 45.229071], + [12.088964, 45.079184], + [12.088964, 44.89932], + [12.131687, 44.809388], + [12.157321, 44.719456], + [12.131687, 44.629524], + [12.088964, 44.539592], + [12.088964, 44.359728], + [11.87535, 44.209841], + [11.747181, 44.179864], + [11.619012, 44.161878], + [11.490843, 44.179864], [11.362675, 44.209841], - [11.490843, 44.179864] + [11.14906, 44.359728], + [11.14906, 44.539592], + [11.106337, 44.629524] ], [ - [11.619012, 44.596822], [11.444237, 44.719456], - [11.619012, 44.842091], + [11.619012, 44.596822], [11.793788, 44.719456], - [11.619012, 44.596822] + [11.619012, 44.842091], + [11.444237, 44.719456] ] ] } @@ -63,38 +63,38 @@ "type": "MultiLineString", "coordinates": [ [ - [11.05507, 44.179864], [11.106337, 44.143891], - [11.362675, 44.035973], - [11.619012, 44], - [11.87535, 44.035973], - [12.131687, 44.143891], - [12.182954, 44.179864], - [12.336757, 44.359728], - [12.336757, 44.539592], - [12.388024, 44.719456], - [12.336757, 44.89932], - [12.336757, 45.079184], - [12.182954, 45.259049], - [12.131687, 45.295021], - [11.87535, 45.40294], - [11.619012, 45.438913], - [11.362675, 45.40294], - [11.106337, 45.295021], - [11.05507, 45.259049], - [10.901267, 45.079184], - [10.901267, 44.89932], - [10.85, 44.719456], - [10.901267, 44.539592], + [11.05507, 44.179864], [10.901267, 44.359728], - [11.05507, 44.179864] + [10.901267, 44.539592], + [10.85, 44.719456], + [10.901267, 44.89932], + [10.901267, 45.079184], + [11.05507, 45.259049], + [11.106337, 45.295021], + [11.362675, 45.40294], + [11.619012, 45.438913], + [11.87535, 45.40294], + [12.131687, 45.295021], + [12.182954, 45.259049], + [12.336757, 45.079184], + [12.336757, 44.89932], + [12.388024, 44.719456], + [12.336757, 44.539592], + [12.336757, 44.359728], + [12.182954, 44.179864], + [12.131687, 44.143891], + [11.87535, 44.035973], + [11.619012, 44], + [11.362675, 44.035973], + [11.106337, 44.143891] ], [ - [11.619012, 44.670402], [11.549102, 44.719456], - [11.619012, 44.76851], + [11.619012, 44.670402], [11.688922, 44.719456], - [11.619012, 44.670402] + [11.619012, 44.76851], + [11.549102, 44.719456] ] ] } @@ -112,20 +112,20 @@ "type": "MultiLineString", "coordinates": [ [ - [10.85, 44.161878], - [11.080704, 44] + [11.080704, 44], + [10.85, 44.161878] ], [ - [12.157321, 44], - [12.388024, 44.161878] + [10.85, 45.277035], + [11.080704, 45.438913] ], [ - [11.080704, 45.438913], - [10.85, 45.277035] + [12.388024, 44.161878], + [12.157321, 44] ], [ - [12.388024, 45.277035], - [12.157321, 45.438913] + [12.157321, 45.438913], + [12.388024, 45.277035] ] ] } @@ -145,14 +145,14 @@ [10.85, 44], [10.85, 44] ], - [ - [12.388024, 44], - [12.388024, 44] - ], [ [10.85, 45.438913], [10.85, 45.438913] ], + [ + [12.388024, 44], + [12.388024, 44] + ], [ [12.388024, 45.438913], [12.388024, 45.438913] @@ -163,6 +163,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/packages/turf-isolines/test/out/pointGrid.geojson b/packages/turf-isolines/test/out/pointGrid.geojson index 7adbcc9de6..9d55c33376 100644 --- a/packages/turf-isolines/test/out/pointGrid.geojson +++ b/packages/turf-isolines/test/out/pointGrid.geojson @@ -11,43 +11,55 @@ "type": "MultiLineString", "coordinates": [ [ - [-70.645198, -33.553984], - [-70.607603, -33.512628], - [-70.553662, -33.521999], - [-70.542579, -33.509032], - [-70.527562, -33.46408], - [-70.553662, -33.452842], - [-70.607603, -33.461775], - [-70.613434, -33.46408], - [-70.661543, -33.492069], - [-70.710988, -33.46408], - [-70.715483, -33.450594], - [-70.725002, -33.46408], - [-70.769424, -33.48259], + [-70.823364, -33.535057], [-70.79511, -33.509032], - [-70.823364, -33.535057] + [-70.769424, -33.48259], + [-70.725002, -33.46408], + [-70.715483, -33.450594], + [-70.710988, -33.46408], + [-70.661543, -33.492069], + [-70.613434, -33.46408], + [-70.607603, -33.461775], + [-70.553662, -33.452842], + [-70.527562, -33.46408], + [-70.542579, -33.509032], + [-70.553662, -33.521999], + [-70.607603, -33.512628], + [-70.645198, -33.553984] ], [ - [-70.764237, -33.553984], - [-70.715483, -33.518772], - [-70.671006, -33.553984] + [-70.769424, -33.443779], + [-70.823364, -33.429795] ], [ - [-70.823364, -33.429795], - [-70.769424, -33.443779], - [-70.731216, -33.419128], - [-70.742454, -33.374176], - [-70.769424, -33.351019], + [-70.823364, -33.406542], [-70.786725, -33.374176], - [-70.823364, -33.406542] + [-70.769424, -33.351019], + [-70.742454, -33.374176], + [-70.731216, -33.419128], + [-70.769424, -33.443779] + ], + [ + [-70.715483, -33.518772], + [-70.764237, -33.553984] + ], + [ + [-70.671006, -33.553984], + [-70.715483, -33.518772] ], [ - [-70.629732, -33.329224], [-70.607603, -33.337216], + [-70.629732, -33.329224] + ], + [ [-70.553662, -33.335329], - [-70.511237, -33.374176], + [-70.607603, -33.337216] + ], + [ + [-70.499722, -33.442285], [-70.514512, -33.419128], - [-70.499722, -33.442285] + [-70.511237, -33.374176], + [-70.553662, -33.335329] ] ] } @@ -62,43 +74,59 @@ "type": "MultiLineString", "coordinates": [ [ - [-70.823364, -33.445033], - [-70.779864, -33.46408], + [-70.823364, -33.511398], [-70.820795, -33.509032], - [-70.823364, -33.511398] + [-70.779864, -33.46408], + [-70.823364, -33.445033] + ], + [ + [-70.823364, -33.388561], + [-70.80708, -33.374176], + [-70.771237, -33.329224] ], [ - [-70.743491, -33.553984], [-70.715483, -33.533756], - [-70.689933, -33.553984] + [-70.743491, -33.553984] + ], + [ + [-70.764287, -33.329224], + [-70.715483, -33.370887], + [-70.71204, -33.374176], + [-70.688513, -33.419128], + [-70.681022, -33.46408], + [-70.661543, -33.475106], + [-70.642591, -33.46408], + [-70.607603, -33.450249], + [-70.553662, -33.437858], + [-70.531912, -33.419128], + [-70.523359, -33.374176], + [-70.553662, -33.346428], + [-70.607603, -33.347205], + [-70.657394, -33.329224] + ], + [ + [-70.689933, -33.553984], + [-70.715483, -33.533756] ], [ - [-70.612506, -33.553984], [-70.607603, -33.54859], + [-70.612506, -33.553984] + ], + [ [-70.553662, -33.539288], - [-70.527801, -33.509032], - [-70.499722, -33.468361] + [-70.607603, -33.54859] ], [ - [-70.657394, -33.329224], - [-70.607603, -33.347205], - [-70.553662, -33.346428], - [-70.523359, -33.374176], - [-70.531912, -33.419128], - [-70.553662, -33.437858], - [-70.607603, -33.450249], - [-70.642591, -33.46408], - [-70.661543, -33.475106], - [-70.681022, -33.46408], - [-70.688513, -33.419128], - [-70.71204, -33.374176], - [-70.715483, -33.370887], - [-70.764287, -33.329224] + [-70.515455, -33.553984], + [-70.499722, -33.546991] ], [ - [-70.771237, -33.329224], - [-70.80708, -33.374176], - [-70.823364, -33.388561] + [-70.527801, -33.509032], + [-70.553662, -33.539288] + ], + [ + [-70.499722, -33.468361], + [-70.527801, -33.509032] ] ] } @@ -113,21 +141,21 @@ "type": "MultiLineString", "coordinates": [ [ - [-70.607603, -33.427196], - [-70.626021, -33.419128], - [-70.661543, -33.379976], - [-70.666134, -33.374176], - [-70.661543, -33.369791], - [-70.607603, -33.367184], - [-70.553662, -33.368626], - [-70.547602, -33.374176], - [-70.553662, -33.392157], - [-70.581563, -33.419128], - [-70.607603, -33.427196] + [-70.823364, -33.363279], + [-70.789368, -33.329224] ], [ - [-70.789368, -33.329224], - [-70.823364, -33.363279] + [-70.666134, -33.374176], + [-70.661543, -33.379976], + [-70.626021, -33.419128], + [-70.607603, -33.427196], + [-70.581563, -33.419128], + [-70.553662, -33.392157], + [-70.547602, -33.374176], + [-70.553662, -33.368626], + [-70.607603, -33.367184], + [-70.661543, -33.369791], + [-70.666134, -33.374176] ] ] } @@ -145,6 +173,7 @@ { "type": "Feature", "properties": { + "description": "Debug line for testing", "stroke": "#F00", "stroke-width": 1 }, diff --git a/yarn.lock b/yarn.lock index 59bc2983e9..d899887f8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7900,6 +7900,11 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +marchingsquares@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/marchingsquares/-/marchingsquares-1.3.3.tgz#67404af4b883ade3a589221f4e9dd010a1f706fc" + integrity sha512-gz6nNQoVK7Lkh2pZulrT4qd4347S/toG9RXH2pyzhLgkL5mLkBoqgv4EvAGXcV0ikDW72n/OQb3Xe8bGagQZCg== + markdown-table@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b"