node-red-contrib-web-worldmap 5.0.7 → 5.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +11 -0
- package/CHANGELOG.md +4 -1
- package/README.md +33 -27
- package/examples/SIDC icons with flags.json +1 -0
- package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/bezier-spline/dist/cjs/index.d.cts +1 -1
- package/node_modules/@turf/bezier-spline/dist/esm/index.d.ts +1 -1
- package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/bezier-spline/package.json +10 -10
- package/node_modules/@turf/helpers/README.md +199 -154
- package/node_modules/@turf/helpers/dist/cjs/index.cjs +10 -7
- package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/helpers/dist/cjs/index.d.cts +149 -110
- package/node_modules/@turf/helpers/dist/esm/index.d.ts +149 -110
- package/node_modules/@turf/helpers/dist/esm/index.js +10 -7
- package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/helpers/package.json +8 -8
- package/node_modules/@turf/invariant/README.md +4 -0
- package/node_modules/@turf/invariant/dist/cjs/index.cjs.map +1 -1
- package/node_modules/@turf/invariant/dist/cjs/index.d.cts +6 -6
- package/node_modules/@turf/invariant/dist/esm/index.d.ts +6 -6
- package/node_modules/@turf/invariant/dist/esm/index.js.map +1 -1
- package/node_modules/@turf/invariant/package.json +9 -9
- package/node_modules/@types/geojson/README.md +1 -1
- package/node_modules/@types/geojson/index.d.ts +4 -1
- package/node_modules/@types/geojson/package.json +4 -3
- package/node_modules/express/History.md +10 -1
- package/node_modules/express/package.json +6 -2
- package/node_modules/path-to-regexp/index.js +13 -3
- package/node_modules/path-to-regexp/package.json +1 -1
- package/package.json +3 -3
- package/worldmap/index.html +2 -2
- package/worldmap/leaflet/leaflet-side-by-side.js +148 -147
- package/worldmap/worldmap.js +83 -64
- package/worldmap.js +8 -7
- package/worldmap/leaflet/dialog-polyfill.css +0 -37
- package/worldmap/leaflet/dialog-polyfill.js +0 -736
- /package/examples/{sidcEdgeIcon.json → sidcEdgeIcon control.json} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
-
- v5.0.
|
|
3
|
+
- v5.0.9 - Slight tidy on flags, bump turf dep.
|
|
4
|
+
- v5.0.8 - Fix flag handling for SIDC 2525D, add example.
|
|
5
|
+
- v5.0.7 - Allow Tooltip options (see new example). #PR295.
|
|
6
|
+
- v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
|
|
4
7
|
- v5.0.4 - Tweak CoT handling slightly.
|
|
5
8
|
- v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
|
|
6
9
|
- v5.0.2 - Fix sidcEdgeIcon docs PR#289.
|
package/README.md
CHANGED
|
@@ -13,33 +13,35 @@ Feel free to [. #PR295.
|
|
19
|
+
- v5.0.6 - Tweak SIDC flag handling slightly to show direction if available and moving.
|
|
20
|
+
- v5.0.4 - Tweak CoT handling slightly.
|
|
21
|
+
- v5.0.3 - Add great context menu example flow. PR#290. Bump express lib. PR#291.
|
|
22
|
+
- v5.0.2 - Fix sidcEdgeIcon docs PR#289.
|
|
23
|
+
- v5.0.1 - Fix isArray error PR #288.
|
|
24
|
+
- v5.0.0 - v5.0.0 - Feedback cleanup PR#281, edgeicons option PR#287, bump libs for vuln fixes.
|
|
25
|
+
- v4.9.0 - If payload.flag is two char ISO code replace it with flag emoji. Revert part of PR #271
|
|
26
|
+
- v4.8.1 - Slight tidy of some of the geojson handling
|
|
27
|
+
- v4.8.0 - Merged PR for feedback functionality cleanup and example. PR #271 and #272
|
|
28
|
+
- v4.7.0 - Update pmtiles library, fix feedback function inconsistency. Issue #270
|
|
29
|
+
- v4.6.5 - Let geojson allow for generic overrides with .icon and .layer.
|
|
30
|
+
- v4.6.4 - Fix deletion of layers logic to actually fully remove points.
|
|
31
|
+
- v4.6.3 - Fix sending of layer events when not wanted. Issue #262
|
|
32
|
+
- v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
|
|
33
|
+
- v4.6.1 - Let default pmtiles be light/dark or monocolored.
|
|
34
|
+
- v4.5.2 - Tidy up when pmtiles removed.
|
|
35
|
+
- v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
|
|
36
|
+
- v4.4.0 - Add quad(copter) drone icon.
|
|
37
|
+
- v4.3.3 - Fix for objects changing layers.
|
|
38
|
+
- v4.3.2 - Fix geojson popup missing label name.
|
|
39
|
+
- v4.3.1 - Small fix to icon transparency, and routing detail.
|
|
40
|
+
- v4.3.0 - Add support for PMtiles files.
|
|
41
|
+
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
|
|
42
|
+
- v4.2.0 - Let icons also be inline images data:image...
|
|
43
|
+
- v4.1.0 - Add optional SOG, COG, altft, altm input properties.
|
|
44
|
+
- v4.0.0 - Breaking - Better context menu variable substitution and retention
|
|
43
45
|
Now uses ${name} syntax rather than $name so we can handle user defined variables in context menus.
|
|
44
46
|
|
|
45
47
|
- see [CHANGELOG](https://github.com/dceejay/RedMap/blob/master/CHANGELOG.md) for full list of changes.
|
|
@@ -144,6 +146,10 @@ SIDC codes can be generated using the online tool - https://www.spatialillusions
|
|
|
144
146
|
|
|
145
147
|
There are lots of extra options you can specify as `msg.payload.options` - see the <a href="https://spatialillusions.com/milsymbol/documentation.html" target="mapinfo">milsymbol docs here</a>.
|
|
146
148
|
|
|
149
|
+
Note: If the SIDC code is a 2525C 15 characters long, where chars 13 and 14 are a country code - then the country flag emoji is added to the staffComments field of the icon. If it's a 20 char 2525D code then the options:country property will be used to create the flag.
|
|
150
|
+
|
|
151
|
+
Note: Not all browsers/OS support unicode emoji - if you can see the Swiss flag here (🇨🇭) then you may be OK.
|
|
152
|
+
|
|
147
153
|
#### TAK Visualisation
|
|
148
154
|
|
|
149
155
|
Users of [TAK](https://tak.gov) can use the [TAK ingest node](https://flows.nodered.org/node/node-red-contrib-tak-registration) to create a JSON formatted TAK event object, received from a TAK server. This can be fed directly into the worldmap node.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"id":"2e5fb67b7383373a","type":"worldmap","z":"51335a8bc38f387c","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"false","showgrid":"false","showruler":"false","allowFileDrop":"false","path":"/worldmap","overlist":"DR,CO,RA,DN","maplist":"OSMG,OSMC,EsriC,EsriS,UKOS","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":740,"y":120,"wires":[]},{"id":"a43cf3b6fb5c779a","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":120,"wires":[["814986215a0adc67"]]},{"id":"814986215a0adc67","type":"function","z":"51335a8bc38f387c","name":"2525C with country","func":"msg.payload = {\n name: \"Dave\",\n lat: 51.0,\n lon: -1.20,\n SIDC: \"SFAPC-------GBR\",\n options:{\n staffComments: \"Comment A\",\n direction:220,\n speed:\"111\",\n targetNumber:\"AB1234\",\n additionalInformation:\"some more info\",\n commonIdentifier:\"Hawk\",\n type:\"Some Type\"\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":120,"wires":[["2e5fb67b7383373a"]]},{"id":"22188e4b94786964","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":180,"wires":[["b33a82ee22d45a25"]]},{"id":"b33a82ee22d45a25","type":"function","z":"51335a8bc38f387c","name":"2525D with flag","func":"msg.payload = {\n name: \"Jon\",\n lat: 51.1,\n lon: -1.20,\n SIDC: \"10061500351105000000\",\n flag: \"DE\",\n options: {\n staffComments: \"Comment B\",\n direction: 300,\n speed: \"110\",\n additionalInformation: \"some more info\",\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":180,"wires":[["2e5fb67b7383373a"]]},{"id":"a505c3cbe0ae507a","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":240,"wires":[["a75fc8cb90ab6b1b"]]},{"id":"a75fc8cb90ab6b1b","type":"function","z":"51335a8bc38f387c","name":"2525D with country","func":"msg.payload = {\n name: \"Mike\",\n lat: 51.0,\n lon: -1.50,\n SIDC: \"10032700000000000000\",\n options: {\n staffComments: \"Comment C\",\n direction: 120,\n country: \"FR\",\n additionalInformation: \"yet more info\",\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":240,"wires":[["2e5fb67b7383373a"]]},{"id":"84429b6fce72a6e1","type":"inject","z":"51335a8bc38f387c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":60,"wires":[["374f2d903bb3dc01"]]},{"id":"374f2d903bb3dc01","type":"function","z":"51335a8bc38f387c","name":"2525C with flag","func":"msg.payload = {\n name: \"Joe\",\n lat: 51.1,\n lon: -1.5,\n SIDC: \"SUGPUCATM---\",\n flag: \"CH\",\n options:{\n staffComments: \"Comment D\",\n direction:60,\n speed:\"111\"\n }\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":60,"wires":[["2e5fb67b7383373a"]]}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../lib/spline.ts"],"names":[],"mappings":";AACA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;;;AC8BxB,IAAM,SAAN,MAAa;AAAA,EAWX,YAAY,SAAe;AACzB,SAAK,SAAS,QAAQ,UAAU,CAAC;AACjC,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,YAAY,QAAQ,aAAa;AACtC,SAAK,UAAU,CAAC;AAChB,SAAK,WAAW,CAAC;AACjB,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,SAAS,KAAK,OAAO;AAC1B,SAAK,QAAQ;AAGb,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAK,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK;AAAA,IACzC;AACA,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,YAAM,KAAK,KAAK,OAAO,CAAC;AACxB,YAAM,KAAK,KAAK,OAAO,IAAI,CAAC;AAC5B,WAAK,QAAQ,KAAK;AAAA,QAChB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,MACrB,CAAC;AAAA,IACH;AACA,SAAK,SAAS,KAAK,CAAC,KAAK,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC;AACnD,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,SAAS,GAAG,KAAK;AAChD,YAAM,KACJ,KAAK,OAAO,IAAI,CAAC,EAAE,KAAK,KAAK,QAAQ,CAAC,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,EAA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CAAC;AACpC,QAAM,SAAS,QAAQ,IAAI,EAAE,YAAY,IAAI,CAAC,OAAO;AACnD,WAAO,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE;AAAA,EAC9B,CAAC;AACD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,YAAY,CAAC,SAAiB;AAClC,QAAI,MAAM,OAAO,IAAI,IAAI;AACzB,QAAI,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG;AACpC,aAAO,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAAA,IAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,OAAO,UAAU,KAAK,IAAI;AAC5C,cAAU,CAAC;AAAA,EACb;AACA,YAAU,OAAO,QAAQ;AAEzB,SAAO,WAAW,QAAQ,QAAQ,UAAU;AAC9C;AAGA,IAAO,6BAAQ","sourcesContent":["import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @name bezierSpline\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-bezier-spline/dist/cjs/index.cjs","../../index.ts","../../lib/spline.ts"],"names":[],"mappings":"AAAA;ACCA,wCAA2B;AAC3B,4CAAwB;ADCxB;AACA;AE4BA,IAAM,OAAA,EAAN,MAAa;AAAA,EAWX,WAAA,CAAY,OAAA,EAAe;AACzB,IAAA,IAAA,CAAK,OAAA,EAAS,OAAA,CAAQ,OAAA,GAAU,CAAC,CAAA;AACjC,IAAA,IAAA,CAAK,SAAA,EAAW,OAAA,CAAQ,SAAA,GAAY,GAAA;AACpC,IAAA,IAAA,CAAK,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,IAAA;AACtC,IAAA,IAAA,CAAK,QAAA,EAAU,CAAC,CAAA;AAChB,IAAA,IAAA,CAAK,SAAA,EAAW,CAAC,CAAA;AACjB,IAAA,IAAA,CAAK,WAAA,EAAa,OAAA,CAAQ,WAAA,GAAc,EAAA;AACxC,IAAA,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,MAAA,CAAO,MAAA;AAC1B,IAAA,IAAA,CAAK,MAAA,EAAQ,CAAA;AAGb,IAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,IAAA,CAAK,MAAA,EAAQ,CAAA,EAAA,EAAK;AACpC,MAAA,IAAA,CAAK,MAAA,CAAO,CAAC,CAAA,CAAE,EAAA,EAAI,IAAA,CAAK,MAAA,CAAO,CAAC,CAAA,CAAE,EAAA,GAAK,CAAA;AAAA,IACzC;AACA,IAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,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CAAO,IAAA,CAAK,CAAC,GAAA,CAAI,CAAA,EAAG,GAAA,CAAI,CAAC,CAAC,CAAA;AAAA,IAC5B;AAAA,EACF,CAAA;AAEA,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,MAAA,CAAO,QAAA,EAAU,EAAA,GAAK,EAAA,EAAI;AAC5C,IAAA,SAAA,CAAU,CAAC,CAAA;AAAA,EACb;AACA,EAAA,SAAA,CAAU,MAAA,CAAO,QAAQ,CAAA;AAEzB,EAAA,OAAO,iCAAA,MAAW,EAAQ,OAAA,CAAQ,UAAU,CAAA;AAC9C;AAGA,IAAO,2BAAA,EAAQ,YAAA;ADuFf;AACE;AACA;AACF,kFAAC","file":"/home/runner/work/turf/turf/packages/turf-bezier-spline/dist/cjs/index.cjs","sourcesContent":[null,"import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @function\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"]}
|
|
@@ -7,7 +7,7 @@ import { GeoJsonProperties, Feature, LineString } from 'geojson';
|
|
|
7
7
|
*
|
|
8
8
|
* The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @function
|
|
11
11
|
* @param {Feature<LineString>} line input LineString
|
|
12
12
|
* @param {Object} [options={}] Optional parameters
|
|
13
13
|
* @param {Object} [options.properties={}] Translate properties to output
|
|
@@ -7,7 +7,7 @@ import { GeoJsonProperties, Feature, LineString } from 'geojson';
|
|
|
7
7
|
*
|
|
8
8
|
* The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @function
|
|
11
11
|
* @param {Feature<LineString>} line input LineString
|
|
12
12
|
* @param {Object} [options={}] Optional parameters
|
|
13
13
|
* @param {Object} [options.properties={}] Translate properties to output
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../lib/spline.ts"],"sourcesContent":["import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @name bezierSpline\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"],"mappings":";AACA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;;;AC8BxB,IAAM,SAAN,MAAa;AAAA,EAWX,YAAY,SAAe;AACzB,SAAK,SAAS,QAAQ,UAAU,CAAC;AACjC,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,YAAY,QAAQ,aAAa;AACtC,SAAK,UAAU,CAAC;AAChB,SAAK,WAAW,CAAC;AACjB,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,SAAS,KAAK,OAAO;AAC1B,SAAK,QAAQ;AAGb,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAK,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK;AAAA,IACzC;AACA,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,YAAM,KAAK,KAAK,OAAO,CAAC;AACxB,YAAM,KAAK,KAAK,OAAO,IAAI,CAAC;AAC5B,WAAK,QAAQ,KAAK;AAAA,QAChB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,MACrB,CAAC;AAAA,IACH;AACA,SAAK,SAAS,KAAK,CAAC,KAAK,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CA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KACtB,IAAI,MAAM,IAAI,MAAM,IAAI;AAAA,EAC3B;AACF;;;ADhKA,SAAS,aACP,MACA,UAII,CAAC,GACmB;AAExB,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,YAAY,QAAQ,aAAa;AAEvC,QAAM,SAA6B,CAAC;AACpC,QAAM,SAAS,QAAQ,IAAI,EAAE,YAAY,IAAI,CAAC,OAAO;AACnD,WAAO,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE;AAAA,EAC9B,CAAC;AACD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,YAAY,CAAC,SAAiB;AAClC,QAAI,MAAM,OAAO,IAAI,IAAI;AACzB,QAAI,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG;AACpC,aAAO,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAAA,IAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,OAAO,UAAU,KAAK,IAAI;AAC5C,cAAU,CAAC;AAAA,EACb;AACA,YAAU,OAAO,QAAQ;AAEzB,SAAO,WAAW,QAAQ,QAAQ,UAAU;AAC9C;AAGA,IAAO,6BAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../lib/spline.ts"],"sourcesContent":["import { Feature, LineString, GeoJsonProperties } from \"geojson\";\nimport { lineString } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\nimport { Spline } from \"./lib/spline.js\";\n\n/**\n * Takes a {@link LineString|line} and returns a curved version\n * by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)\n * algorithm.\n *\n * The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).\n *\n * @function\n * @param {Feature<LineString>} line input LineString\n * @param {Object} [options={}] Optional parameters\n * @param {Object} [options.properties={}] Translate properties to output\n * @param {number} [options.resolution=10000] time in milliseconds between points\n * @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines\n * @returns {Feature<LineString>} curved line\n * @example\n * var line = turf.lineString([\n * [-76.091308, 18.427501],\n * [-76.695556, 18.729501],\n * [-76.552734, 19.40443],\n * [-74.61914, 19.134789],\n * [-73.652343, 20.07657],\n * [-73.157958, 20.210656]\n * ]);\n *\n * var curved = turf.bezierSpline(line);\n *\n * //addToMap\n * var addToMap = [line, curved]\n * curved.properties = { stroke: '#0F0' };\n */\nfunction bezierSpline<P extends GeoJsonProperties = GeoJsonProperties>(\n line: Feature<LineString> | LineString,\n options: {\n properties?: P;\n resolution?: number;\n sharpness?: number;\n } = {}\n): Feature<LineString, P> {\n // Optional params\n const resolution = options.resolution || 10000;\n const sharpness = options.sharpness || 0.85;\n\n const coords: [number, number][] = [];\n const points = getGeom(line).coordinates.map((pt) => {\n return { x: pt[0], y: pt[1] };\n });\n const spline = new Spline({\n duration: resolution,\n points,\n sharpness,\n });\n\n const pushCoord = (time: number) => {\n var pos = spline.pos(time);\n if (Math.floor(time / 100) % 2 === 0) {\n coords.push([pos.x, pos.y]);\n }\n };\n\n for (var i = 0; i < spline.duration; i += 10) {\n pushCoord(i);\n }\n pushCoord(spline.duration);\n\n return lineString(coords, options.properties);\n}\n\nexport { bezierSpline };\nexport default bezierSpline;\n","interface Point {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * BezierSpline\n * https://github.com/leszekr/bezier-spline-js\n *\n * @private\n * @copyright\n * Copyright (c) 2013 Leszek Rybicki\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nclass Spline {\n public duration: number;\n public points: Point[];\n public sharpness: number;\n public centers: Point[];\n public controls: Array<[Point, Point]>;\n public stepLength: number;\n public length: number;\n public delay: number;\n public steps: number[];\n\n constructor(options?: any) {\n this.points = options.points || [];\n this.duration = options.duration || 10000;\n this.sharpness = options.sharpness || 0.85;\n this.centers = [];\n this.controls = [];\n this.stepLength = options.stepLength || 60;\n this.length = this.points.length;\n this.delay = 0;\n\n // this is to ensure compatibility with the 2d version\n for (let i = 0; i < this.length; i++) {\n this.points[i].z = this.points[i].z || 0;\n }\n for (let i = 0; i < this.length - 1; i++) {\n const p1 = this.points[i];\n const p2 = this.points[i + 1];\n this.centers.push({\n x: (p1.x + p2.x) / 2,\n y: (p1.y + p2.y) / 2,\n z: (p1.z + p2.z) / 2,\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (let i = 0; i < this.centers.length - 1; i++) {\n const dx =\n this.points[i + 1].x - (this.centers[i].x + this.centers[i + 1].x) / 2;\n const dy =\n this.points[i + 1].y - (this.centers[i].y + this.centers[i + 1].y) / 2;\n const dz =\n this.points[i + 1].z - (this.centers[i].y + this.centers[i + 1].z) / 2;\n this.controls.push([\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i].z + dz),\n },\n {\n x:\n (1.0 - this.sharpness) * this.points[i + 1].x +\n this.sharpness * (this.centers[i + 1].x + dx),\n y:\n (1.0 - this.sharpness) * this.points[i + 1].y +\n this.sharpness * (this.centers[i + 1].y + dy),\n z:\n (1.0 - this.sharpness) * this.points[i + 1].z +\n this.sharpness * (this.centers[i + 1].z + dz),\n },\n ]);\n }\n this.controls.push([\n this.points[this.length - 1],\n this.points[this.length - 1],\n ]);\n this.steps = this.cacheSteps(this.stepLength);\n return this;\n }\n /**\n * Caches an array of equidistant (more or less) points on the curve.\n */\n public cacheSteps(mindist: number) {\n const steps = [];\n let laststep = this.pos(0);\n steps.push(0);\n for (let t = 0; t < this.duration; t += 10) {\n const step = this.pos(t);\n const dist = Math.sqrt(\n (step.x - laststep.x) * (step.x - laststep.x) +\n (step.y - laststep.y) * (step.y - laststep.y) +\n (step.z - laststep.z) * (step.z - laststep.z)\n );\n if (dist > mindist) {\n steps.push(t);\n laststep = step;\n }\n }\n return steps;\n }\n\n /**\n * returns angle and speed in the given point in the curve\n */\n public vector(t: number) {\n const p1 = this.pos(t + 10);\n const p2 = this.pos(t - 10);\n return {\n angle: (180 * Math.atan2(p1.y - p2.y, p1.x - p2.x)) / 3.14,\n speed: Math.sqrt(\n (p2.x - p1.x) * (p2.x - p1.x) +\n (p2.y - p1.y) * (p2.y - p1.y) +\n (p2.z - p1.z) * (p2.z - p1.z)\n ),\n };\n }\n\n /**\n * Gets the position of the point, given time.\n *\n * WARNING: The speed is not constant. The time it takes between control points is constant.\n *\n * For constant speed, use Spline.steps[i];\n */\n public pos(time: number) {\n let t = time - this.delay;\n if (t < 0) {\n t = 0;\n }\n if (t > this.duration) {\n t = this.duration - 1;\n }\n // t = t-this.delay;\n const t2 = t / this.duration;\n if (t2 >= 1) {\n return this.points[this.length - 1];\n }\n\n const n = Math.floor((this.points.length - 1) * t2);\n const t1 = (this.length - 1) * t2 - n;\n return bezier(\n t1,\n this.points[n],\n this.controls[n][1],\n this.controls[n + 1][0],\n this.points[n + 1]\n );\n }\n}\n\nfunction bezier(t: number, p1: Point, c1: Point, c2: Point, p2: Point) {\n const b = B(t);\n const pos = {\n x: p2.x * b[0] + c2.x * b[1] + c1.x * b[2] + p1.x * b[3],\n y: p2.y * b[0] + c2.y * b[1] + c1.y * b[2] + p1.y * b[3],\n z: p2.z * b[0] + c2.z * b[1] + c1.z * b[2] + p1.z * b[3],\n };\n return pos;\n}\nfunction B(t: number) {\n const t2 = t * t;\n const t3 = t2 * t;\n return [\n t3,\n 3 * t2 * (1 - t),\n 3 * t * (1 - t) * (1 - t),\n (1 - t) * (1 - t) * (1 - t),\n ];\n}\n\nexport { Spline, Point };\nexport default Spline;\n"],"mappings":";AACA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;;;AC8BxB,IAAM,SAAN,MAAa;AAAA,EAWX,YAAY,SAAe;AACzB,SAAK,SAAS,QAAQ,UAAU,CAAC;AACjC,SAAK,WAAW,QAAQ,YAAY;AACpC,SAAK,YAAY,QAAQ,aAAa;AACtC,SAAK,UAAU,CAAC;AAChB,SAAK,WAAW,CAAC;AACjB,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,SAAS,KAAK,OAAO;AAC1B,SAAK,QAAQ;AAGb,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,WAAK,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK;AAAA,IACzC;AACA,aAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACxC,YAAM,KAAK,KAAK,OAAO,CAAC;AACxB,YAAM,KAAK,KAAK,OAAO,IAAI,CAAC;AAC5B,WAAK,QAAQ,KAAK;AAAA,QAChB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,QACnB,IAAI,GAAG,IAAI,GAAG,KAAK;AAAA,MACrB,CAAC;AAAA,IACH;AACA,S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AA,IACA,IAAI,MAAM,IAAI;AAAA,IACd,IAAI,KAAK,IAAI,MAAM,IAAI;AAAA,KACtB,IAAI,MAAM,IAAI,MAAM,IAAI;AAAA,EAC3B;AACF;;;ADhKA,SAAS,aACP,MACA,UAII,CAAC,GACmB;AAExB,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,YAAY,QAAQ,aAAa;AAEvC,QAAM,SAA6B,CAAC;AACpC,QAAM,SAAS,QAAQ,IAAI,EAAE,YAAY,IAAI,CAAC,OAAO;AACnD,WAAO,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE;AAAA,EAC9B,CAAC;AACD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,YAAY,CAAC,SAAiB;AAClC,QAAI,MAAM,OAAO,IAAI,IAAI;AACzB,QAAI,KAAK,MAAM,OAAO,GAAG,IAAI,MAAM,GAAG;AACpC,aAAO,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAAA,IAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,OAAO,UAAU,KAAK,IAAI;AAC5C,cAAU,CAAC;AAAA,EACb;AACA,YAAU,OAAO,QAAQ;AAEzB,SAAO,WAAW,QAAQ,QAAQ,UAAU;AAC9C;AAGA,IAAO,6BAAQ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/bezier-spline",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf bezier-spline module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,21 +53,21 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/benchmark": "^2.1.5",
|
|
56
|
-
"@types/tape": "^4.
|
|
56
|
+
"@types/tape": "^4.13.4",
|
|
57
57
|
"benchmark": "^2.1.4",
|
|
58
58
|
"load-json-file": "^7.0.1",
|
|
59
59
|
"npm-run-all": "^4.1.5",
|
|
60
|
-
"tape": "^5.
|
|
61
|
-
"tsup": "^8.
|
|
62
|
-
"tsx": "^4.
|
|
63
|
-
"typescript": "^5.
|
|
60
|
+
"tape": "^5.9.0",
|
|
61
|
+
"tsup": "^8.3.5",
|
|
62
|
+
"tsx": "^4.19.2",
|
|
63
|
+
"typescript": "^5.5.4",
|
|
64
64
|
"write-json-file": "^5.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@turf/helpers": "^7.
|
|
68
|
-
"@turf/invariant": "^7.
|
|
67
|
+
"@turf/helpers": "^7.2.0",
|
|
68
|
+
"@turf/invariant": "^7.2.0",
|
|
69
69
|
"@types/geojson": "^7946.0.10",
|
|
70
|
-
"tslib": "^2.
|
|
70
|
+
"tslib": "^2.8.1"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
73
73
|
}
|