@rws-framework/client 2.13.1 → 2.13.3
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/.bin/add-v.sh +9 -9
- package/.bin/emerge.sh +15 -15
- package/.emerge-fast.yaml +46 -46
- package/.emerge-typescript-template.yaml +23 -23
- package/.emerge-vis-output/fast-element/emerge-file_result_dependency_graph.graphml +693 -693
- package/.emerge-vis-output/fast-element/emerge-filesystem_graph.graphml +705 -705
- package/.emerge-vis-output/fast-element/emerge-statistics-metrics.txt +440 -440
- package/.emerge-vis-output/fast-element/html/emerge.html +500 -500
- package/.emerge-vis-output/fast-element/html/jsconfig.json +8 -8
- package/.emerge-vis-output/fast-element/html/resources/css/custom.css +211 -211
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_common.js +44 -44
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_data.js +13 -13
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_git.js +1413 -1413
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_graph.js +539 -539
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_heatmap.js +219 -219
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_hull.js +179 -179
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_main.js +1002 -1002
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_search.js +71 -71
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_ui.js +199 -199
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.css +4123 -4123
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +4122 -4122
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.css +487 -487
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +484 -484
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.css +4265 -4265
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +4256 -4256
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.css +10877 -10877
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.css +10841 -10841
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.js +7075 -7075
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.js +5202 -5202
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.js +5249 -5249
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/d3/d3.v7.8.4.min.js +2 -2
- package/.emerge-vis-output/fast-element/html/vendors/d3/d3.v7.min.js +2 -2
- package/.emerge-vis-output/fast-element/html/vendors/dark-mode-switch/css/dark-mode.css +148 -148
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/daterangepicker.min.js +7 -7
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/moment.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/hull/hull.js +373 -373
- package/.emerge-vis-output/fast-element/html/vendors/jquery/jquery-3.6.0.min.js +2 -2
- package/.emerge-vis-output/fast-element/html/vendors/popper/popper.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/simpleheat/simpleheat.js +141 -141
- package/.emerge-vis-output/fast-foundation/emerge-file_result_dependency_graph.graphml +4043 -4043
- package/.emerge-vis-output/fast-foundation/emerge-filesystem_graph.graphml +4538 -4538
- package/.emerge-vis-output/fast-foundation/emerge-statistics-metrics.txt +2510 -2510
- package/.emerge-vis-output/fast-foundation/html/emerge.html +500 -500
- package/.emerge-vis-output/fast-foundation/html/jsconfig.json +8 -8
- package/.emerge-vis-output/fast-foundation/html/resources/css/custom.css +211 -211
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_common.js +44 -44
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_data.js +13 -13
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_git.js +1413 -1413
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_graph.js +539 -539
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_heatmap.js +219 -219
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_hull.js +179 -179
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_main.js +1002 -1002
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_search.js +71 -71
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_ui.js +199 -199
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.css +4123 -4123
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +4122 -4122
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.css +487 -487
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +484 -484
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.css +4265 -4265
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +4256 -4256
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.css +10877 -10877
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.css +10841 -10841
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.js +7075 -7075
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.js +5202 -5202
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.js +5249 -5249
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/d3/d3.v7.8.4.min.js +2 -2
- package/.emerge-vis-output/fast-foundation/html/vendors/d3/d3.v7.min.js +2 -2
- package/.emerge-vis-output/fast-foundation/html/vendors/dark-mode-switch/css/dark-mode.css +148 -148
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/daterangepicker.min.js +7 -7
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/moment.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/hull/hull.js +373 -373
- package/.emerge-vis-output/fast-foundation/html/vendors/jquery/jquery-3.6.0.min.js +2 -2
- package/.emerge-vis-output/fast-foundation/html/vendors/popper/popper.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/simpleheat/simpleheat.js +141 -141
- package/.emerge-vis-output/rws-client/emerge-file_result_dependency_graph.graphml +1143 -1143
- package/.emerge-vis-output/rws-client/emerge-filesystem_graph.graphml +1003 -1003
- package/.emerge-vis-output/rws-client/emerge-statistics-metrics.txt +655 -655
- package/.emerge-vis-output/rws-client/html/emerge.html +500 -500
- package/.emerge-vis-output/rws-client/html/jsconfig.json +8 -8
- package/.emerge-vis-output/rws-client/html/resources/css/custom.css +211 -211
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_common.js +44 -44
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_data.js +13 -13
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_git.js +1413 -1413
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_graph.js +539 -539
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_heatmap.js +219 -219
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_hull.js +179 -179
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_main.js +1002 -1002
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_search.js +71 -71
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_ui.js +199 -199
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.css +4123 -4123
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +4122 -4122
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.css +487 -487
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +484 -484
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.css +4265 -4265
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +4256 -4256
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.css +10877 -10877
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.css +10841 -10841
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.js +7075 -7075
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.js +5202 -5202
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.js +5249 -5249
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/d3/d3.v7.8.4.min.js +2 -2
- package/.emerge-vis-output/rws-client/html/vendors/d3/d3.v7.min.js +2 -2
- package/.emerge-vis-output/rws-client/html/vendors/dark-mode-switch/css/dark-mode.css +148 -148
- package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/daterangepicker.min.js +7 -7
- package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/moment.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/hull/hull.js +373 -373
- package/.emerge-vis-output/rws-client/html/vendors/jquery/jquery-3.6.0.min.js +2 -2
- package/.emerge-vis-output/rws-client/html/vendors/popper/popper.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/simpleheat/simpleheat.js +141 -141
- package/.eslintrc.json +51 -51
- package/.gitmodules +2 -2
- package/.setup/.eslintrc.json +11 -11
- package/.setup/_base.eslintrc.json +48 -48
- package/.setup/tsconfig.json +28 -28
- package/PLUGINS.MD +188 -188
- package/README.md +1023 -1023
- package/_tools.js +396 -396
- package/builder/vite/index.ts +4 -4
- package/{cfg/build_steps → builder}/vite/loaders/html.ts +11 -11
- package/{cfg/build_steps → builder}/vite/loaders/index.ts +8 -8
- package/{cfg/build_steps → builder}/vite/loaders/loader.type.ts +27 -27
- package/{cfg/build_steps → builder}/vite/loaders/scss.ts +32 -32
- package/{cfg/build_steps → builder}/vite/loaders/ts.ts +309 -312
- package/builder/vite/rws.vite.config.ts +56 -49
- package/{cfg/build_steps → builder}/vite/rws_scss_plugin.ts +61 -60
- package/{cfg/build_steps → builder}/vite/scss/_compiler.ts +95 -94
- package/{cfg/build_steps → builder}/vite/scss/_fonts.ts +80 -80
- package/{cfg/build_steps → builder}/vite/scss/_fs.ts +83 -81
- package/{cfg/build_steps → builder}/vite/scss/_import.ts +191 -184
- package/builder/webpack/after/copy.js +78 -78
- package/builder/webpack/after/sw.js +13 -13
- package/builder/webpack/index.js +10 -10
- package/builder/webpack/loaders/rws_fast_html_loader.js +17 -17
- package/builder/webpack/loaders/rws_fast_scss_loader.js +43 -43
- package/builder/webpack/loaders/rws_fast_ts_loader.js +96 -96
- package/builder/webpack/loaders/ts/html_error.js +19 -19
- package/builder/webpack/rws.webpack.config.js +169 -169
- package/builder/webpack/rws_scss_plugin.js +62 -62
- package/builder/webpack/rws_webpack_plugin.js +137 -137
- package/builder/webpack/scss/_compiler.js +97 -97
- package/builder/webpack/scss/_fonts.js +80 -80
- package/builder/webpack/scss/_fs.js +84 -84
- package/builder/webpack/scss/_import.js +186 -186
- package/cfg/_default.cfg.js +26 -26
- package/cfg/_storage.d.ts +22 -22
- package/cfg/_storage.js +42 -42
- package/cfg/build_steps/vite/_build_config.ts +105 -105
- package/cfg/build_steps/vite/_env_defines.ts +17 -17
- package/cfg/build_steps/vite/_loaders.ts +187 -184
- package/cfg/build_steps/vite/index.ts +2 -2
- package/cfg/build_steps/vite/types.ts +7 -7
- package/cfg/build_steps/webpack/_actions.js +85 -85
- package/cfg/build_steps/webpack/_aliases.js +9 -9
- package/cfg/build_steps/webpack/_build_config.js +76 -76
- package/cfg/build_steps/webpack/_cache.js +98 -98
- package/cfg/build_steps/webpack/_component_handling.js +60 -60
- package/cfg/build_steps/webpack/_dev_servers.js +14 -14
- package/cfg/build_steps/webpack/_env_defines.js +18 -18
- package/cfg/build_steps/webpack/_info.js +18 -18
- package/cfg/build_steps/webpack/_loaders.js +223 -223
- package/cfg/build_steps/webpack/_plugins.js +102 -102
- package/cfg/build_steps/webpack/_production.js +37 -37
- package/cfg/build_steps/webpack/_rws_externals.js +68 -68
- package/cfg/build_steps/webpack/_timing.js +52 -52
- package/cfg/build_steps/webpack/_webpack_config.js +58 -58
- package/cfg/tsconfigSetup.js +150 -150
- package/console.js +86 -86
- package/docs/assets/26e93147f10415a0ed4a.svg +6 -6
- package/docs/assets/75c9471662e97ee24f29.svg +7 -7
- package/docs/assets/db90e4df2373980c497d.svg +9 -9
- package/docs/assets/highlight.css +127 -127
- package/docs/assets/main.js +59 -59
- package/docs/assets/style.css +1414 -1414
- package/docs/classes/ApiServiceInstance.html +25 -25
- package/docs/classes/ConfigServiceInstance.html +21 -21
- package/docs/classes/DOMServiceInstance.html +17 -17
- package/docs/classes/NotifyServiceInstance.html +15 -15
- package/docs/classes/RWSClientInstance.html +45 -45
- package/docs/classes/RWSPlugin.html +13 -13
- package/docs/classes/RWSService.html +10 -10
- package/docs/classes/RWSViewComponent.html +1022 -1022
- package/docs/classes/ServiceWorkerServiceInstance.html +13 -13
- package/docs/classes/UtilsServiceInstance.html +13 -13
- package/docs/functions/attr.html +5 -5
- package/docs/functions/observable.html +3 -3
- package/docs/index.html +179 -179
- package/docs/interfaces/HTMLTag.html +3 -3
- package/docs/interfaces/IRWSConfig.html +20 -20
- package/docs/interfaces/IRWSDecoratorOptions.html +5 -5
- package/docs/interfaces/IRWSHttpRoute.html +2 -2
- package/docs/interfaces/IRWSPrefixedHTTProutes.html +2 -2
- package/docs/interfaces/IRWSUser.html +5 -5
- package/docs/modules.html +45 -45
- package/foundation/index.js +1 -1
- package/foundation/rws-foundation.d.ts +7 -7
- package/foundation/rws-foundation.js +7 -7
- package/package.json +108 -108
- package/service_worker/src/_service_worker.ts +83 -83
- package/service_worker/tsconfig.json +20 -20
- package/service_worker/webpack.config.js +66 -66
- package/src/client/components.ts +67 -67
- package/src/client/config.ts +165 -165
- package/src/client/services.ts +27 -27
- package/src/client.ts +212 -212
- package/src/components/_attrs/_default_observable_accessor.ts +8 -8
- package/src/components/_attrs/_extended_accessor.ts +40 -40
- package/src/components/_attrs/_external_handler.ts +7 -7
- package/src/components/_attrs/_external_observable_accessor.ts +8 -8
- package/src/components/_attrs/angular-attr.ts +34 -34
- package/src/components/_attrs/external-attr.ts +59 -59
- package/src/components/_attrs/external-observable.ts +52 -52
- package/src/components/_attrs/sanitize-html.ts +80 -80
- package/src/components/_component.ts +245 -245
- package/src/components/_container.ts +15 -15
- package/src/components/_decorator.ts +122 -122
- package/src/components/_decorators/RWSFillBuild.ts +54 -54
- package/src/components/_decorators/RWSInject.ts +49 -49
- package/src/components/_decorators/RWSService.ts +11 -11
- package/src/components/_decorators/_di.ts +15 -15
- package/src/components/_definitions.ts +64 -64
- package/src/components/_event_handling.ts +40 -40
- package/src/components/index.ts +14 -14
- package/src/components/loader/component.ts +12 -12
- package/src/components/loader/styles/layout.scss +13 -13
- package/src/components/progress/component.ts +54 -54
- package/src/components/progress/styles/layout.scss +90 -90
- package/src/components/progress/template.html +24 -24
- package/src/components/uploader/component.ts +83 -83
- package/src/components/uploader/styles/layout.scss +130 -130
- package/src/components/uploader/template.html +16 -16
- package/src/index.ts +93 -93
- package/src/plugins/_builder.js +31 -31
- package/src/plugins/_plugin.ts +63 -63
- package/src/services/ApiService.ts +242 -242
- package/src/services/ConfigService.ts +134 -134
- package/src/services/DOMService.ts +100 -100
- package/src/services/NotifyService.ts +47 -47
- package/src/services/ServiceWorkerService.ts +60 -60
- package/src/services/UtilsService.ts +60 -60
- package/src/services/_service.ts +64 -64
- package/src/styles/_darkreader.scss +30 -30
- package/src/styles/_grid.scss +75 -75
- package/src/styles/_misc.scss +8 -8
- package/src/styles/_scrollbars.scss +40 -40
- package/src/styles/includes.scss +4 -4
- package/src/types/IRWSConfig.ts +30 -30
- package/src/types/IRWSPlugin.ts +18 -18
- package/src/types/IRWSUser.ts +6 -6
- package/src/types/IRWSViewComponent.ts +36 -36
- package/src/types/RWSNotify.ts +6 -6
- package/src/types/RWSWindow.ts +41 -41
- package/tsconfig.json +30 -30
- package/typedoc.json +13 -13
- package/types/declarations.d.ts +8 -8
- package/types/docs-typings.d.ts +15 -15
|
@@ -1,373 +1,373 @@
|
|
|
1
|
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.hull = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
-
function _cross(o, a, b) {
|
|
3
|
-
return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function _upperTangent(pointset) {
|
|
7
|
-
const lower = [];
|
|
8
|
-
for (let l = 0; l < pointset.length; l++) {
|
|
9
|
-
while (lower.length >= 2 && (_cross(lower[lower.length - 2], lower[lower.length - 1], pointset[l]) <= 0)) {
|
|
10
|
-
lower.pop();
|
|
11
|
-
}
|
|
12
|
-
lower.push(pointset[l]);
|
|
13
|
-
}
|
|
14
|
-
lower.pop();
|
|
15
|
-
return lower;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _lowerTangent(pointset) {
|
|
19
|
-
const reversed = pointset.reverse(),
|
|
20
|
-
upper = [];
|
|
21
|
-
for (let u = 0; u < reversed.length; u++) {
|
|
22
|
-
while (upper.length >= 2 && (_cross(upper[upper.length - 2], upper[upper.length - 1], reversed[u]) <= 0)) {
|
|
23
|
-
upper.pop();
|
|
24
|
-
}
|
|
25
|
-
upper.push(reversed[u]);
|
|
26
|
-
}
|
|
27
|
-
upper.pop();
|
|
28
|
-
return upper;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// pointset has to be sorted by X
|
|
32
|
-
function convex(pointset) {
|
|
33
|
-
const upper = _upperTangent(pointset),
|
|
34
|
-
lower = _lowerTangent(pointset);
|
|
35
|
-
const convex = lower.concat(upper);
|
|
36
|
-
convex.push(pointset[0]);
|
|
37
|
-
return convex;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = convex;
|
|
41
|
-
|
|
42
|
-
},{}],2:[function(require,module,exports){
|
|
43
|
-
module.exports = {
|
|
44
|
-
|
|
45
|
-
toXy: function(pointset, format) {
|
|
46
|
-
if (format === undefined) {
|
|
47
|
-
return pointset.slice();
|
|
48
|
-
}
|
|
49
|
-
return pointset.map(function(pt) {
|
|
50
|
-
/*jslint evil: true */
|
|
51
|
-
const _getXY = new Function('pt', 'return [pt' + format[0] + ',' + 'pt' + format[1] + '];');
|
|
52
|
-
return _getXY(pt);
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
fromXy: function(pointset, format) {
|
|
57
|
-
if (format === undefined) {
|
|
58
|
-
return pointset.slice();
|
|
59
|
-
}
|
|
60
|
-
return pointset.map(function(pt) {
|
|
61
|
-
/*jslint evil: true */
|
|
62
|
-
const _getObj = new Function('pt', 'const o = {}; o' + format[0] + '= pt[0]; o' + format[1] + '= pt[1]; return o;');
|
|
63
|
-
return _getObj(pt);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
},{}],3:[function(require,module,exports){
|
|
69
|
-
function Grid(points, cellSize) {
|
|
70
|
-
this._cells = [];
|
|
71
|
-
this._cellSize = cellSize;
|
|
72
|
-
this._reverseCellSize = 1 / cellSize;
|
|
73
|
-
|
|
74
|
-
for (let i = 0; i < points.length; i++) {
|
|
75
|
-
const point = points[i];
|
|
76
|
-
const x = this.coordToCellNum(point[0]);
|
|
77
|
-
const y = this.coordToCellNum(point[1]);
|
|
78
|
-
if (!this._cells[x]) {
|
|
79
|
-
const array = [];
|
|
80
|
-
array[y] = [point];
|
|
81
|
-
this._cells[x] = array;
|
|
82
|
-
} else if (!this._cells[x][y]) {
|
|
83
|
-
this._cells[x][y] = [point];
|
|
84
|
-
} else {
|
|
85
|
-
this._cells[x][y].push(point);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
Grid.prototype = {
|
|
91
|
-
cellPoints: function(x, y) { // (Number, Number) -> Array
|
|
92
|
-
return (this._cells[x] !== undefined && this._cells[x][y] !== undefined) ? this._cells[x][y] : [];
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
rangePoints: function(bbox) { // (Array) -> Array
|
|
96
|
-
const tlCellX = this.coordToCellNum(bbox[0]);
|
|
97
|
-
const tlCellY = this.coordToCellNum(bbox[1]);
|
|
98
|
-
const brCellX = this.coordToCellNum(bbox[2]);
|
|
99
|
-
const brCellY = this.coordToCellNum(bbox[3]);
|
|
100
|
-
const points = [];
|
|
101
|
-
|
|
102
|
-
for (let x = tlCellX; x <= brCellX; x++) {
|
|
103
|
-
for (let y = tlCellY; y <= brCellY; y++) {
|
|
104
|
-
// replaced Array.prototype.push.apply to avoid hitting stack size limit on larger arrays.
|
|
105
|
-
for (let i = 0; i < this.cellPoints(x, y).length; i++) {
|
|
106
|
-
points.push(this.cellPoints(x, y)[i]);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return points;
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
removePoint: function(point) { // (Array) -> Array
|
|
115
|
-
const cellX = this.coordToCellNum(point[0]);
|
|
116
|
-
const cellY = this.coordToCellNum(point[1]);
|
|
117
|
-
const cell = this._cells[cellX][cellY];
|
|
118
|
-
let pointIdxInCell;
|
|
119
|
-
|
|
120
|
-
for (let i = 0; i < cell.length; i++) {
|
|
121
|
-
if (cell[i][0] === point[0] && cell[i][1] === point[1]) {
|
|
122
|
-
pointIdxInCell = i;
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
cell.splice(pointIdxInCell, 1);
|
|
128
|
-
|
|
129
|
-
return cell;
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
trunc: Math.trunc || function(val) { // (number) -> number
|
|
133
|
-
return val - val % 1;
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
coordToCellNum: function(x) { // (number) -> number
|
|
137
|
-
return this.trunc(x * this._reverseCellSize);
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
extendBbox: function(bbox, scaleFactor) { // (Array, Number) -> Array
|
|
141
|
-
return [
|
|
142
|
-
bbox[0] - (scaleFactor * this._cellSize),
|
|
143
|
-
bbox[1] - (scaleFactor * this._cellSize),
|
|
144
|
-
bbox[2] + (scaleFactor * this._cellSize),
|
|
145
|
-
bbox[3] + (scaleFactor * this._cellSize)
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
function grid(points, cellSize) {
|
|
151
|
-
return new Grid(points, cellSize);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
module.exports = grid;
|
|
155
|
-
},{}],4:[function(require,module,exports){
|
|
156
|
-
/*
|
|
157
|
-
(c) 2014-2020, Andrii Heonia
|
|
158
|
-
Hull.js, a JavaScript library for concave hull generation by set of points.
|
|
159
|
-
https://github.com/AndriiHeonia/hull
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
'use strict';
|
|
163
|
-
|
|
164
|
-
const intersect = require('./intersect.js');
|
|
165
|
-
const grid = require('./grid.js');
|
|
166
|
-
const formatUtil = require('./format.js');
|
|
167
|
-
const convexHull = require('./convex.js');
|
|
168
|
-
|
|
169
|
-
function _filterDuplicates(pointset) {
|
|
170
|
-
const unique = [pointset[0]];
|
|
171
|
-
let lastPoint = pointset[0];
|
|
172
|
-
for (let i = 1; i < pointset.length; i++) {
|
|
173
|
-
const currentPoint = pointset[i];
|
|
174
|
-
if (lastPoint[0] !== currentPoint[0] || lastPoint[1] !== currentPoint[1]) {
|
|
175
|
-
unique.push(currentPoint);
|
|
176
|
-
}
|
|
177
|
-
lastPoint = currentPoint;
|
|
178
|
-
}
|
|
179
|
-
return unique;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function _sortByX(pointset) {
|
|
183
|
-
return pointset.sort(function(a, b) {
|
|
184
|
-
return (a[0] - b[0]) || (a[1] - b[1]);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function _sqLength(a, b) {
|
|
189
|
-
return Math.pow(b[0] - a[0], 2) + Math.pow(b[1] - a[1], 2);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function _cos(o, a, b) {
|
|
193
|
-
const aShifted = [a[0] - o[0], a[1] - o[1]],
|
|
194
|
-
bShifted = [b[0] - o[0], b[1] - o[1]],
|
|
195
|
-
sqALen = _sqLength(o, a),
|
|
196
|
-
sqBLen = _sqLength(o, b),
|
|
197
|
-
dot = aShifted[0] * bShifted[0] + aShifted[1] * bShifted[1];
|
|
198
|
-
|
|
199
|
-
return dot / Math.sqrt(sqALen * sqBLen);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function _intersect(segment, pointset) {
|
|
203
|
-
for (let i = 0; i < pointset.length - 1; i++) {
|
|
204
|
-
const seg = [pointset[i], pointset[i + 1]];
|
|
205
|
-
if (segment[0][0] === seg[0][0] && segment[0][1] === seg[0][1] ||
|
|
206
|
-
segment[0][0] === seg[1][0] && segment[0][1] === seg[1][1]) {
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
if (intersect(segment, seg)) {
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function _occupiedArea(pointset) {
|
|
217
|
-
let minX = Infinity;
|
|
218
|
-
let minY = Infinity;
|
|
219
|
-
let maxX = -Infinity;
|
|
220
|
-
let maxY = -Infinity;
|
|
221
|
-
|
|
222
|
-
for (let i = pointset.length - 1; i >= 0; i--) {
|
|
223
|
-
if (pointset[i][0] < minX) {
|
|
224
|
-
minX = pointset[i][0];
|
|
225
|
-
}
|
|
226
|
-
if (pointset[i][1] < minY) {
|
|
227
|
-
minY = pointset[i][1];
|
|
228
|
-
}
|
|
229
|
-
if (pointset[i][0] > maxX) {
|
|
230
|
-
maxX = pointset[i][0];
|
|
231
|
-
}
|
|
232
|
-
if (pointset[i][1] > maxY) {
|
|
233
|
-
maxY = pointset[i][1];
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return [
|
|
238
|
-
maxX - minX, // width
|
|
239
|
-
maxY - minY // height
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function _bBoxAround(edge) {
|
|
244
|
-
return [
|
|
245
|
-
Math.min(edge[0][0], edge[1][0]), // left
|
|
246
|
-
Math.min(edge[0][1], edge[1][1]), // top
|
|
247
|
-
Math.max(edge[0][0], edge[1][0]), // right
|
|
248
|
-
Math.max(edge[0][1], edge[1][1]) // bottom
|
|
249
|
-
];
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function _midPoint(edge, innerPoints, convex) {
|
|
253
|
-
let point = null,
|
|
254
|
-
angle1Cos = MAX_CONCAVE_ANGLE_COS,
|
|
255
|
-
angle2Cos = MAX_CONCAVE_ANGLE_COS,
|
|
256
|
-
a1Cos, a2Cos;
|
|
257
|
-
|
|
258
|
-
for (let i = 0; i < innerPoints.length; i++) {
|
|
259
|
-
a1Cos = _cos(edge[0], edge[1], innerPoints[i]);
|
|
260
|
-
a2Cos = _cos(edge[1], edge[0], innerPoints[i]);
|
|
261
|
-
|
|
262
|
-
if (a1Cos > angle1Cos && a2Cos > angle2Cos &&
|
|
263
|
-
!_intersect([edge[0], innerPoints[i]], convex) &&
|
|
264
|
-
!_intersect([edge[1], innerPoints[i]], convex)) {
|
|
265
|
-
|
|
266
|
-
angle1Cos = a1Cos;
|
|
267
|
-
angle2Cos = a2Cos;
|
|
268
|
-
point = innerPoints[i];
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return point;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function _concave(convex, maxSqEdgeLen, maxSearchArea, grid, edgeSkipList) {
|
|
276
|
-
let midPointInserted = false;
|
|
277
|
-
|
|
278
|
-
for (let i = 0; i < convex.length - 1; i++) {
|
|
279
|
-
const edge = [convex[i], convex[i + 1]];
|
|
280
|
-
// generate a key in the format X0,Y0,X1,Y1
|
|
281
|
-
const keyInSkipList = edge[0][0] + ',' + edge[0][1] + ',' + edge[1][0] + ',' + edge[1][1];
|
|
282
|
-
|
|
283
|
-
if (_sqLength(edge[0], edge[1]) < maxSqEdgeLen ||
|
|
284
|
-
edgeSkipList.has(keyInSkipList)) { continue; }
|
|
285
|
-
|
|
286
|
-
let scaleFactor = 0;
|
|
287
|
-
let bBoxAround = _bBoxAround(edge);
|
|
288
|
-
let bBoxWidth;
|
|
289
|
-
let bBoxHeight;
|
|
290
|
-
let midPoint;
|
|
291
|
-
do {
|
|
292
|
-
bBoxAround = grid.extendBbox(bBoxAround, scaleFactor);
|
|
293
|
-
bBoxWidth = bBoxAround[2] - bBoxAround[0];
|
|
294
|
-
bBoxHeight = bBoxAround[3] - bBoxAround[1];
|
|
295
|
-
|
|
296
|
-
midPoint = _midPoint(edge, grid.rangePoints(bBoxAround), convex);
|
|
297
|
-
scaleFactor++;
|
|
298
|
-
} while (midPoint === null && (maxSearchArea[0] > bBoxWidth || maxSearchArea[1] > bBoxHeight));
|
|
299
|
-
|
|
300
|
-
if (bBoxWidth >= maxSearchArea[0] && bBoxHeight >= maxSearchArea[1]) {
|
|
301
|
-
edgeSkipList.add(keyInSkipList);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (midPoint !== null) {
|
|
305
|
-
convex.splice(i + 1, 0, midPoint);
|
|
306
|
-
grid.removePoint(midPoint);
|
|
307
|
-
midPointInserted = true;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (midPointInserted) {
|
|
312
|
-
return _concave(convex, maxSqEdgeLen, maxSearchArea, grid, edgeSkipList);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return convex;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function hull(pointset, concavity, format) {
|
|
319
|
-
let maxEdgeLen = concavity || 20;
|
|
320
|
-
|
|
321
|
-
const points = _filterDuplicates(_sortByX(formatUtil.toXy(pointset, format)));
|
|
322
|
-
|
|
323
|
-
if (points.length < 4) {
|
|
324
|
-
return points.concat([points[0]]);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
const occupiedArea = _occupiedArea(points);
|
|
328
|
-
const maxSearchArea = [
|
|
329
|
-
occupiedArea[0] * MAX_SEARCH_BBOX_SIZE_PERCENT,
|
|
330
|
-
occupiedArea[1] * MAX_SEARCH_BBOX_SIZE_PERCENT
|
|
331
|
-
];
|
|
332
|
-
|
|
333
|
-
const convex = convexHull(points);
|
|
334
|
-
const innerPoints = points.filter(function(pt) {
|
|
335
|
-
return convex.indexOf(pt) < 0;
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
const cellSize = Math.ceil(1 / (points.length / (occupiedArea[0] * occupiedArea[1])));
|
|
339
|
-
|
|
340
|
-
const concave = _concave(
|
|
341
|
-
convex, Math.pow(maxEdgeLen, 2),
|
|
342
|
-
maxSearchArea, grid(innerPoints, cellSize), new Set());
|
|
343
|
-
|
|
344
|
-
if (format) {
|
|
345
|
-
return formatUtil.fromXy(concave, format);
|
|
346
|
-
} else {
|
|
347
|
-
return concave;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
const MAX_CONCAVE_ANGLE_COS = Math.cos(90 / (180 / Math.PI)); // angle = 90 deg
|
|
352
|
-
const MAX_SEARCH_BBOX_SIZE_PERCENT = 0.6;
|
|
353
|
-
|
|
354
|
-
module.exports = hull;
|
|
355
|
-
|
|
356
|
-
},{"./convex.js":1,"./format.js":2,"./grid.js":3,"./intersect.js":5}],5:[function(require,module,exports){
|
|
357
|
-
function ccw(x1, y1, x2, y2, x3, y3) {
|
|
358
|
-
const cw = ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1));
|
|
359
|
-
return cw > 0 ? true : cw < 0 ? false : true; // colinear
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
function intersect(seg1, seg2) {
|
|
363
|
-
const x1 = seg1[0][0], y1 = seg1[0][1],
|
|
364
|
-
x2 = seg1[1][0], y2 = seg1[1][1],
|
|
365
|
-
x3 = seg2[0][0], y3 = seg2[0][1],
|
|
366
|
-
x4 = seg2[1][0], y4 = seg2[1][1];
|
|
367
|
-
|
|
368
|
-
return ccw(x1, y1, x3, y3, x4, y4) !== ccw(x2, y2, x3, y3, x4, y4) && ccw(x1, y1, x2, y2, x3, y3) !== ccw(x1, y1, x2, y2, x4, y4);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
module.exports = intersect;
|
|
372
|
-
},{}]},{},[4])(4)
|
|
373
|
-
});
|
|
1
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.hull = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
|
+
function _cross(o, a, b) {
|
|
3
|
+
return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function _upperTangent(pointset) {
|
|
7
|
+
const lower = [];
|
|
8
|
+
for (let l = 0; l < pointset.length; l++) {
|
|
9
|
+
while (lower.length >= 2 && (_cross(lower[lower.length - 2], lower[lower.length - 1], pointset[l]) <= 0)) {
|
|
10
|
+
lower.pop();
|
|
11
|
+
}
|
|
12
|
+
lower.push(pointset[l]);
|
|
13
|
+
}
|
|
14
|
+
lower.pop();
|
|
15
|
+
return lower;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _lowerTangent(pointset) {
|
|
19
|
+
const reversed = pointset.reverse(),
|
|
20
|
+
upper = [];
|
|
21
|
+
for (let u = 0; u < reversed.length; u++) {
|
|
22
|
+
while (upper.length >= 2 && (_cross(upper[upper.length - 2], upper[upper.length - 1], reversed[u]) <= 0)) {
|
|
23
|
+
upper.pop();
|
|
24
|
+
}
|
|
25
|
+
upper.push(reversed[u]);
|
|
26
|
+
}
|
|
27
|
+
upper.pop();
|
|
28
|
+
return upper;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// pointset has to be sorted by X
|
|
32
|
+
function convex(pointset) {
|
|
33
|
+
const upper = _upperTangent(pointset),
|
|
34
|
+
lower = _lowerTangent(pointset);
|
|
35
|
+
const convex = lower.concat(upper);
|
|
36
|
+
convex.push(pointset[0]);
|
|
37
|
+
return convex;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = convex;
|
|
41
|
+
|
|
42
|
+
},{}],2:[function(require,module,exports){
|
|
43
|
+
module.exports = {
|
|
44
|
+
|
|
45
|
+
toXy: function(pointset, format) {
|
|
46
|
+
if (format === undefined) {
|
|
47
|
+
return pointset.slice();
|
|
48
|
+
}
|
|
49
|
+
return pointset.map(function(pt) {
|
|
50
|
+
/*jslint evil: true */
|
|
51
|
+
const _getXY = new Function('pt', 'return [pt' + format[0] + ',' + 'pt' + format[1] + '];');
|
|
52
|
+
return _getXY(pt);
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
fromXy: function(pointset, format) {
|
|
57
|
+
if (format === undefined) {
|
|
58
|
+
return pointset.slice();
|
|
59
|
+
}
|
|
60
|
+
return pointset.map(function(pt) {
|
|
61
|
+
/*jslint evil: true */
|
|
62
|
+
const _getObj = new Function('pt', 'const o = {}; o' + format[0] + '= pt[0]; o' + format[1] + '= pt[1]; return o;');
|
|
63
|
+
return _getObj(pt);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
},{}],3:[function(require,module,exports){
|
|
69
|
+
function Grid(points, cellSize) {
|
|
70
|
+
this._cells = [];
|
|
71
|
+
this._cellSize = cellSize;
|
|
72
|
+
this._reverseCellSize = 1 / cellSize;
|
|
73
|
+
|
|
74
|
+
for (let i = 0; i < points.length; i++) {
|
|
75
|
+
const point = points[i];
|
|
76
|
+
const x = this.coordToCellNum(point[0]);
|
|
77
|
+
const y = this.coordToCellNum(point[1]);
|
|
78
|
+
if (!this._cells[x]) {
|
|
79
|
+
const array = [];
|
|
80
|
+
array[y] = [point];
|
|
81
|
+
this._cells[x] = array;
|
|
82
|
+
} else if (!this._cells[x][y]) {
|
|
83
|
+
this._cells[x][y] = [point];
|
|
84
|
+
} else {
|
|
85
|
+
this._cells[x][y].push(point);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Grid.prototype = {
|
|
91
|
+
cellPoints: function(x, y) { // (Number, Number) -> Array
|
|
92
|
+
return (this._cells[x] !== undefined && this._cells[x][y] !== undefined) ? this._cells[x][y] : [];
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
rangePoints: function(bbox) { // (Array) -> Array
|
|
96
|
+
const tlCellX = this.coordToCellNum(bbox[0]);
|
|
97
|
+
const tlCellY = this.coordToCellNum(bbox[1]);
|
|
98
|
+
const brCellX = this.coordToCellNum(bbox[2]);
|
|
99
|
+
const brCellY = this.coordToCellNum(bbox[3]);
|
|
100
|
+
const points = [];
|
|
101
|
+
|
|
102
|
+
for (let x = tlCellX; x <= brCellX; x++) {
|
|
103
|
+
for (let y = tlCellY; y <= brCellY; y++) {
|
|
104
|
+
// replaced Array.prototype.push.apply to avoid hitting stack size limit on larger arrays.
|
|
105
|
+
for (let i = 0; i < this.cellPoints(x, y).length; i++) {
|
|
106
|
+
points.push(this.cellPoints(x, y)[i]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return points;
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
removePoint: function(point) { // (Array) -> Array
|
|
115
|
+
const cellX = this.coordToCellNum(point[0]);
|
|
116
|
+
const cellY = this.coordToCellNum(point[1]);
|
|
117
|
+
const cell = this._cells[cellX][cellY];
|
|
118
|
+
let pointIdxInCell;
|
|
119
|
+
|
|
120
|
+
for (let i = 0; i < cell.length; i++) {
|
|
121
|
+
if (cell[i][0] === point[0] && cell[i][1] === point[1]) {
|
|
122
|
+
pointIdxInCell = i;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
cell.splice(pointIdxInCell, 1);
|
|
128
|
+
|
|
129
|
+
return cell;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
trunc: Math.trunc || function(val) { // (number) -> number
|
|
133
|
+
return val - val % 1;
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
coordToCellNum: function(x) { // (number) -> number
|
|
137
|
+
return this.trunc(x * this._reverseCellSize);
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
extendBbox: function(bbox, scaleFactor) { // (Array, Number) -> Array
|
|
141
|
+
return [
|
|
142
|
+
bbox[0] - (scaleFactor * this._cellSize),
|
|
143
|
+
bbox[1] - (scaleFactor * this._cellSize),
|
|
144
|
+
bbox[2] + (scaleFactor * this._cellSize),
|
|
145
|
+
bbox[3] + (scaleFactor * this._cellSize)
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
function grid(points, cellSize) {
|
|
151
|
+
return new Grid(points, cellSize);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
module.exports = grid;
|
|
155
|
+
},{}],4:[function(require,module,exports){
|
|
156
|
+
/*
|
|
157
|
+
(c) 2014-2020, Andrii Heonia
|
|
158
|
+
Hull.js, a JavaScript library for concave hull generation by set of points.
|
|
159
|
+
https://github.com/AndriiHeonia/hull
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
'use strict';
|
|
163
|
+
|
|
164
|
+
const intersect = require('./intersect.js');
|
|
165
|
+
const grid = require('./grid.js');
|
|
166
|
+
const formatUtil = require('./format.js');
|
|
167
|
+
const convexHull = require('./convex.js');
|
|
168
|
+
|
|
169
|
+
function _filterDuplicates(pointset) {
|
|
170
|
+
const unique = [pointset[0]];
|
|
171
|
+
let lastPoint = pointset[0];
|
|
172
|
+
for (let i = 1; i < pointset.length; i++) {
|
|
173
|
+
const currentPoint = pointset[i];
|
|
174
|
+
if (lastPoint[0] !== currentPoint[0] || lastPoint[1] !== currentPoint[1]) {
|
|
175
|
+
unique.push(currentPoint);
|
|
176
|
+
}
|
|
177
|
+
lastPoint = currentPoint;
|
|
178
|
+
}
|
|
179
|
+
return unique;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function _sortByX(pointset) {
|
|
183
|
+
return pointset.sort(function(a, b) {
|
|
184
|
+
return (a[0] - b[0]) || (a[1] - b[1]);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function _sqLength(a, b) {
|
|
189
|
+
return Math.pow(b[0] - a[0], 2) + Math.pow(b[1] - a[1], 2);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function _cos(o, a, b) {
|
|
193
|
+
const aShifted = [a[0] - o[0], a[1] - o[1]],
|
|
194
|
+
bShifted = [b[0] - o[0], b[1] - o[1]],
|
|
195
|
+
sqALen = _sqLength(o, a),
|
|
196
|
+
sqBLen = _sqLength(o, b),
|
|
197
|
+
dot = aShifted[0] * bShifted[0] + aShifted[1] * bShifted[1];
|
|
198
|
+
|
|
199
|
+
return dot / Math.sqrt(sqALen * sqBLen);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function _intersect(segment, pointset) {
|
|
203
|
+
for (let i = 0; i < pointset.length - 1; i++) {
|
|
204
|
+
const seg = [pointset[i], pointset[i + 1]];
|
|
205
|
+
if (segment[0][0] === seg[0][0] && segment[0][1] === seg[0][1] ||
|
|
206
|
+
segment[0][0] === seg[1][0] && segment[0][1] === seg[1][1]) {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (intersect(segment, seg)) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function _occupiedArea(pointset) {
|
|
217
|
+
let minX = Infinity;
|
|
218
|
+
let minY = Infinity;
|
|
219
|
+
let maxX = -Infinity;
|
|
220
|
+
let maxY = -Infinity;
|
|
221
|
+
|
|
222
|
+
for (let i = pointset.length - 1; i >= 0; i--) {
|
|
223
|
+
if (pointset[i][0] < minX) {
|
|
224
|
+
minX = pointset[i][0];
|
|
225
|
+
}
|
|
226
|
+
if (pointset[i][1] < minY) {
|
|
227
|
+
minY = pointset[i][1];
|
|
228
|
+
}
|
|
229
|
+
if (pointset[i][0] > maxX) {
|
|
230
|
+
maxX = pointset[i][0];
|
|
231
|
+
}
|
|
232
|
+
if (pointset[i][1] > maxY) {
|
|
233
|
+
maxY = pointset[i][1];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return [
|
|
238
|
+
maxX - minX, // width
|
|
239
|
+
maxY - minY // height
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function _bBoxAround(edge) {
|
|
244
|
+
return [
|
|
245
|
+
Math.min(edge[0][0], edge[1][0]), // left
|
|
246
|
+
Math.min(edge[0][1], edge[1][1]), // top
|
|
247
|
+
Math.max(edge[0][0], edge[1][0]), // right
|
|
248
|
+
Math.max(edge[0][1], edge[1][1]) // bottom
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function _midPoint(edge, innerPoints, convex) {
|
|
253
|
+
let point = null,
|
|
254
|
+
angle1Cos = MAX_CONCAVE_ANGLE_COS,
|
|
255
|
+
angle2Cos = MAX_CONCAVE_ANGLE_COS,
|
|
256
|
+
a1Cos, a2Cos;
|
|
257
|
+
|
|
258
|
+
for (let i = 0; i < innerPoints.length; i++) {
|
|
259
|
+
a1Cos = _cos(edge[0], edge[1], innerPoints[i]);
|
|
260
|
+
a2Cos = _cos(edge[1], edge[0], innerPoints[i]);
|
|
261
|
+
|
|
262
|
+
if (a1Cos > angle1Cos && a2Cos > angle2Cos &&
|
|
263
|
+
!_intersect([edge[0], innerPoints[i]], convex) &&
|
|
264
|
+
!_intersect([edge[1], innerPoints[i]], convex)) {
|
|
265
|
+
|
|
266
|
+
angle1Cos = a1Cos;
|
|
267
|
+
angle2Cos = a2Cos;
|
|
268
|
+
point = innerPoints[i];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return point;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function _concave(convex, maxSqEdgeLen, maxSearchArea, grid, edgeSkipList) {
|
|
276
|
+
let midPointInserted = false;
|
|
277
|
+
|
|
278
|
+
for (let i = 0; i < convex.length - 1; i++) {
|
|
279
|
+
const edge = [convex[i], convex[i + 1]];
|
|
280
|
+
// generate a key in the format X0,Y0,X1,Y1
|
|
281
|
+
const keyInSkipList = edge[0][0] + ',' + edge[0][1] + ',' + edge[1][0] + ',' + edge[1][1];
|
|
282
|
+
|
|
283
|
+
if (_sqLength(edge[0], edge[1]) < maxSqEdgeLen ||
|
|
284
|
+
edgeSkipList.has(keyInSkipList)) { continue; }
|
|
285
|
+
|
|
286
|
+
let scaleFactor = 0;
|
|
287
|
+
let bBoxAround = _bBoxAround(edge);
|
|
288
|
+
let bBoxWidth;
|
|
289
|
+
let bBoxHeight;
|
|
290
|
+
let midPoint;
|
|
291
|
+
do {
|
|
292
|
+
bBoxAround = grid.extendBbox(bBoxAround, scaleFactor);
|
|
293
|
+
bBoxWidth = bBoxAround[2] - bBoxAround[0];
|
|
294
|
+
bBoxHeight = bBoxAround[3] - bBoxAround[1];
|
|
295
|
+
|
|
296
|
+
midPoint = _midPoint(edge, grid.rangePoints(bBoxAround), convex);
|
|
297
|
+
scaleFactor++;
|
|
298
|
+
} while (midPoint === null && (maxSearchArea[0] > bBoxWidth || maxSearchArea[1] > bBoxHeight));
|
|
299
|
+
|
|
300
|
+
if (bBoxWidth >= maxSearchArea[0] && bBoxHeight >= maxSearchArea[1]) {
|
|
301
|
+
edgeSkipList.add(keyInSkipList);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (midPoint !== null) {
|
|
305
|
+
convex.splice(i + 1, 0, midPoint);
|
|
306
|
+
grid.removePoint(midPoint);
|
|
307
|
+
midPointInserted = true;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (midPointInserted) {
|
|
312
|
+
return _concave(convex, maxSqEdgeLen, maxSearchArea, grid, edgeSkipList);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return convex;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function hull(pointset, concavity, format) {
|
|
319
|
+
let maxEdgeLen = concavity || 20;
|
|
320
|
+
|
|
321
|
+
const points = _filterDuplicates(_sortByX(formatUtil.toXy(pointset, format)));
|
|
322
|
+
|
|
323
|
+
if (points.length < 4) {
|
|
324
|
+
return points.concat([points[0]]);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const occupiedArea = _occupiedArea(points);
|
|
328
|
+
const maxSearchArea = [
|
|
329
|
+
occupiedArea[0] * MAX_SEARCH_BBOX_SIZE_PERCENT,
|
|
330
|
+
occupiedArea[1] * MAX_SEARCH_BBOX_SIZE_PERCENT
|
|
331
|
+
];
|
|
332
|
+
|
|
333
|
+
const convex = convexHull(points);
|
|
334
|
+
const innerPoints = points.filter(function(pt) {
|
|
335
|
+
return convex.indexOf(pt) < 0;
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const cellSize = Math.ceil(1 / (points.length / (occupiedArea[0] * occupiedArea[1])));
|
|
339
|
+
|
|
340
|
+
const concave = _concave(
|
|
341
|
+
convex, Math.pow(maxEdgeLen, 2),
|
|
342
|
+
maxSearchArea, grid(innerPoints, cellSize), new Set());
|
|
343
|
+
|
|
344
|
+
if (format) {
|
|
345
|
+
return formatUtil.fromXy(concave, format);
|
|
346
|
+
} else {
|
|
347
|
+
return concave;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const MAX_CONCAVE_ANGLE_COS = Math.cos(90 / (180 / Math.PI)); // angle = 90 deg
|
|
352
|
+
const MAX_SEARCH_BBOX_SIZE_PERCENT = 0.6;
|
|
353
|
+
|
|
354
|
+
module.exports = hull;
|
|
355
|
+
|
|
356
|
+
},{"./convex.js":1,"./format.js":2,"./grid.js":3,"./intersect.js":5}],5:[function(require,module,exports){
|
|
357
|
+
function ccw(x1, y1, x2, y2, x3, y3) {
|
|
358
|
+
const cw = ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1));
|
|
359
|
+
return cw > 0 ? true : cw < 0 ? false : true; // colinear
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function intersect(seg1, seg2) {
|
|
363
|
+
const x1 = seg1[0][0], y1 = seg1[0][1],
|
|
364
|
+
x2 = seg1[1][0], y2 = seg1[1][1],
|
|
365
|
+
x3 = seg2[0][0], y3 = seg2[0][1],
|
|
366
|
+
x4 = seg2[1][0], y4 = seg2[1][1];
|
|
367
|
+
|
|
368
|
+
return ccw(x1, y1, x3, y3, x4, y4) !== ccw(x2, y2, x3, y3, x4, y4) && ccw(x1, y1, x2, y2, x3, y3) !== ccw(x1, y1, x2, y2, x4, y4);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
module.exports = intersect;
|
|
372
|
+
},{}]},{},[4])(4)
|
|
373
|
+
});
|