Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@2gis/general

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@2gis/general - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

dist/general.js

@@ -1,2 +0,2 @@

!function(r,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.General=n():r.General=n()}(window,function(){return function(r){var n={};function e(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return r[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=n,e.d=function(r,n,t){e.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:t})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,n){if(1&n&&(r=e(r)),8&n)return r;if(4&n&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(e.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&n&&"string"!=typeof r)for(var o in r)e.d(t,o,function(n){return r[n]}.bind(null,o));return t},e.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(n,"a",n),n},e.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},e.p="/dist/",e(e.s=4)}([function(r,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"c",function(){return i}),e.d(n,"b",function(){return a}),e.d(n,"d",function(){return u});var t=0,o={pixelPositionX:t++,pixelPositionY:t++,groupIndex:t++,iconIndex:t++,priority:t++},i=Object.keys(o).length;function a(r,n){for(var e=0,t=0;e<n.length;e++,t+=i){var a=n[e];r[t+o.pixelPositionX]=a.pixelPosition[0],r[t+o.pixelPositionY]=a.pixelPosition[1],r[t+o.groupIndex]=a.groupIndex,r[t+o.iconIndex]=a.iconIndex,r[t+o.priority]=Boolean(a.priority)?1:0}}function u(r,n){for(var e=0,t=0;e<r.length;e++,t+=i)r[e].iconIndex=n[t+o.iconIndex]}},function(r,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"c",function(){return i}),e.d(n,"b",function(){return a}),e.d(n,"d",function(){return u});var t=0,o={markerIndex:t++,offsetX:t++,offsetY:t++,width:t++,height:t++,display:t++,minZoom:t++},i=7;function a(r,n,e){for(var t=0,a=0;a<n.length;a++){var u=n[a].htmlLabel;void 0!==u&&(r[t+o.markerIndex]=a,r[t+o.offsetX]=u.offset[0]*e,r[t+o.offsetY]=u.offset[1]*e,r[t+o.width]=u.width*e,r[t+o.height]=u.height*e,r[t+o.display]=u.display?1:0,r[t+o.minZoom]=u.minZoom,t+=i)}}function u(r,n){for(var e=0,t=0,a=r;t<a.length;t++){var u=a[t].htmlLabel;void 0!==u&&(u.display=1===n[e+o.display],u.minZoom=n[e+o.minZoom],e+=i)}}},function(r,n,e){function t(r){var n={};function e(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return r[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=r,e.c=n,e.i=function(r){return r},e.d=function(r,n,t){e.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:t})},e.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},e.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(n,"a",n),n},e.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},e.p="/",e.oe=function(r){throw console.error(r),r};var t=e(e.s=ENTRY_MODULE);return t.default||t}var o="[\\.|\\-|\\+|\\w|/|@]+",i="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+o+").*?\\)";function a(r){return(r+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function u(r,n,t){var u={};u[t]=[];var f=n.toString(),c=f.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return u;for(var m,s=c[1],l=new RegExp("(\\\\n|\\W)"+a(s)+i,"g");m=l.exec(f);)"dll-reference"!==m[3]&&u[t].push(m[3]);for(l=new RegExp("\\("+a(s)+'\\("(dll-reference\\s('+o+'))"\\)\\)'+i,"g");m=l.exec(f);)r[m[2]]||(u[t].push(m[1]),r[m[2]]=e(m[1]).m),u[m[2]]=u[m[2]]||[],u[m[2]].push(m[4]);for(var d,p=Object.keys(u),x=0;x<p.length;x++)for(var v=0;v<u[p[x]].length;v++)d=u[p[x]][v],isNaN(1*d)||(u[p[x]][v]=1*u[p[x]][v]);return u}function f(r){return Object.keys(r).reduce(function(n,e){return n||r[e].length>0},!1)}r.exports=function(r,n){n=n||{};var o={main:e.m},i=n.all?{main:Object.keys(o.main)}:function(r,n){for(var e={main:[n]},t={main:[]},o={main:{}};f(e);)for(var i=Object.keys(e),a=0;a<i.length;a++){var c=i[a],m=e[c].pop();if(o[c]=o[c]||{},!o[c][m]&&r[c][m]){o[c][m]=!0,t[c]=t[c]||[],t[c].push(m);for(var s=u(r,r[c][m],c),l=Object.keys(s),d=0;d<l.length;d++)e[l[d]]=e[l[d]]||[],e[l[d]]=e[l[d]].concat(s[l[d]])}}return t}(o,r),a="";Object.keys(i).filter(function(r){return"main"!==r}).forEach(function(r){for(var n=0;i[r][n];)n++;i[r].push(n),o[r][n]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",a=a+"var "+r+" = ("+t.toString().replace("ENTRY_MODULE",JSON.stringify(n))+")({"+i[r].map(function(n){return JSON.stringify(n)+": "+o[r][n].toString()}).join(",")+"});\n"}),a=a+"new (("+t.toString().replace("ENTRY_MODULE",JSON.stringify(r))+")({"+i.main.map(function(r){return JSON.stringify(r)+": "+o.main[r].toString()}).join(",")+"}))(self);";var c=new window.Blob([a],{type:"text/javascript"});if(n.bare)return c;var m=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(c),s=new window.Worker(m);return s.objectURL=m,s}},function(r,n,e){"use strict";e.r(n);var t={min:-1/0,max:1/0},o={min:-1/0,max:1/0},i={min:-1/0,max:1/0},a={min:0,max:1/0};function u(r,n,e){var u,c,m,s,l=n.anchorX-r.anchorX,d=n.anchorY-r.anchorY;return f(t,r.minX,r.maxX,n.minX,n.maxX,l),f(o,r.minY,r.maxY,n.minY,n.maxY,d),c=t,m=o,s=a,(u=i).min=Math.max(c.min,m.min,s.min),u.max=Math.min(c.max,m.max,s.max),i.min>=i.max?-1/0:e+Math.log(i.max)/Math.log(2)}function f(r,n,e,t,o,i){var a=i>0?n-o:t-e,u=i>0?e-t:o-n;r.min=a/Math.abs(i),r.max=u/Math.abs(i)}var c=e(0),m=e(1),s={minX:0,minY:0,maxX:0,maxY:0},l={minX:0,minY:0,maxX:0,maxY:0},d={minX:0,minY:0,maxX:0,maxY:0},p={minX:0,minY:0,maxX:0,maxY:0},x=[];function v(r){for(var n=r.bounds,e=r.priorityGroups,t=r.markers,o=r.markerCount,i=r.labels,a=r.labelCount,u=1+(n.maxX-n.minX>>3)<<3,f=n.maxY-n.minY,s=u*f+8>>3,l=new Uint8Array(s),d=new Uint8Array(s),p=[],v=0;v<e.length;v++)p[v]=new Uint8Array(s);var y=new Int8Array(o);for(v=0;v<o;v++){var b=v*c.c+c.a.iconIndex;y[v]=t[b],t[b]=-1}var g=new Uint8Array(a),w=new Float32Array(a);for(v=0;v<a;v++){var k=v*m.c+m.a.display,Y=v*m.c+m.a.minZoom;g[v]=i[k],w[v]=i[Y],i[k]=0,i[Y]=-1/0}x=[],h(r,l,d,p,u,f,y,g,w,!0,!0),h(r,l,d,p,u,f,y,g,w,!1,!0),h(r,l,d,p,u,f,y,g,w,!0,!1),h(r,l,d,p,u,f,y,g,w,!1,!1)}function h(r,n,e,t,o,i,a,u,f,s,l){for(var d=r.bounds,p=r.priorityGroups,x=r.sprites,v=r.markers,h=r.markerCount,g=r.labels,w=r.labelCount,k=r.currentZoom,Y=0;Y<p.length;Y++){if(x[p[Y].iconIndex])for(var X=0!==Y?t[Y-1]:void 0,A=Y!==p.length-1?t[Y]:void 0,O=0;O<h;O++){var j=-1!==a[O],_=1===v[c.c*O+c.a.priority],P=l&&_||!l&&!_;(s&&j||!s&&!j)&&P&&y(v,p,x,d,X,A,n,e,o,i,Y,O)}}for(Y=0;Y<w;Y++){var I=g[Y*m.c+m.a.markerIndex];j=1===u[Y]&&k>=f[Y],_=1===v[I*c.c+c.a.priority],P=l&&_||!l&&!_;(s&&j||!s&&!j)&&P&&b(v,g,d,n,e,o,i,k,Y)}}function y(r,n,e,t,o,i,a,u,f,m,x,v){var h=n[x],y=h.safeZone,b=h.iconIndex,X=h.margin,A=h.degradation,O=e[b],j=O.size,_=O.anchor,P=c.c,I=c.a,M=v*P,Z=r[M+I.groupIndex],S=r[M+I.pixelPositionX]-t.minX,U=r[M+I.pixelPositionY]-t.minY;Z>x||(Y(l,f,m,j,_,S,U,X),k(l)||Z===x&&o&&g(o,f,l)||(Y(s,f,m,j,_,S,U,y),k(s)||g(a,f,s)||(Y(d,f,m,j,_,S,U,A),w(a,f,l),Y(p,f,m,j,_,S,U,0),w(u,f,p),i&&w(i,f,d),r[M+I.iconIndex]=b)))}function b(r,n,e,t,o,i,a,f,s){var l=m.c,d=m.a,v=s*l,h=n[v+d.markerIndex]*c.c;if(-1!==r[h+c.a.iconIndex]){var y=r[h+c.a.pixelPositionX]-e.minX,b=r[h+c.a.pixelPositionY]-e.minY,X=[n[v+d.width],n[v+d.height]],A=[-n[v+d.offsetX]/X[0],-n[v+d.offsetY]/X[1]];if(Y(p,i,a,X,A,y,b,0),!k(p)&&!g(o,i,p)){w(t,i,p),n[v+d.display]=1;for(var O={anchorX:y,anchorY:b,minX:-X[0]*A[0],minY:-X[1]*A[1],maxX:X[0]*(1-A[0]),maxY:X[1]*(1-A[1]),minZoom:-1/0},j=0,_=x;j<_.length;j++){var P=_[j],I=u(P,O,f);I>O.minZoom&&I>P.minZoom&&(O.minZoom=I)}n[v+d.minZoom]=O.minZoom,x.push(O)}}}function g(r,n,e){for(var t=e.minX,o=e.minY,i=e.maxX,a=e.maxY,u=o;u<a;u++){var f=u*n+t>>3,c=u*n+i>>3,m=0;if(f===c)m=r[f]&255>>(7&t)&255<<8-(7&i);else{m=r[f]&255>>(7&t);for(var s=f+1;s<c;s++)m=r[s]|m;m=r[c]&255<<8-(7&i)|m}if(0!==m)return!0}return!1}function w(r,n,e){for(var t=e.minX,o=e.minY,i=e.maxX,a=e.maxY,u=o;u<a;u++){var f=u*n+t>>3,c=u*n+i>>3;if(f===c)r[f]=r[f]|255>>(7&t)&255<<8-(7&i);else{r[f]=r[f]|255>>(7&t);for(var m=f+1;m<c;m++)r[m]=255;r[c]=r[c]|255<<8-(7&i)}}}function k(r){return r.minX===r.maxX||r.minY===r.maxY}function Y(r,n,e,t,o,i,a,u){var f=i-t[0]*o[0]-u|0,c=a-t[1]*o[1]-u|0,m=i+t[0]*(1-o[0])+u|0,s=a+t[1]*(1-o[1])+u|0;r.minX=f>0?f<n?f:n:0,r.minY=c>0?c<e?c:e:0,r.maxX=m>0?m<n?m:n:0,r.maxY=s>0?s<e?s:e:0}n.default=function(r){r.onmessage=function(n){v(n.data);var e=n.data,t=e.markers,o=e.labels;r.postMessage({markerArray:t,labelArray:o},[t.buffer,o.buffer])}}},function(r,n,e){"use strict";e.r(n);var t=e(0),o=e(1),i=e(2),a=e.n(i),u=function(){function r(){var r=this;this.worker=a()(3),this.queue=[],this.currentJob=void 0,this.markerArray=new Float32Array(1e3*t.c),this.labelArray=new Float32Array(1e3*o.c),this.worker.onmessage=function(n){if(void 0!==r.currentJob){var e=r.currentJob,i=e.markers,a=e.resolve,u=n.data;t.d(i,u.markerArray),o.d(i,u.labelArray),r.markerArray=u.markerArray,r.labelArray=u.labelArray,r.currentJob=void 0,r.dequeue(),a()}}}return r.prototype.generalize=function(r,n,e,t,o){var i=this,a={bounds:r,priorityGroups:n,sprites:e,currentZoom:o},u=t.length,f=t.filter(function(r){return void 0!==r.htmlLabel}).length;return new Promise(function(r){i.queue.push({message:a,markers:t,resolve:r,markerCount:u,labelCount:f}),i.dequeue()})},r.prototype.clear=function(){this.queue=[]},r.prototype.pack=function(r,n,e){n*t.c>this.markerArray.length&&(this.markerArray=new Float32Array(n*t.c)),e*o.c>this.labelArray.length&&(this.labelArray=new Float32Array(e*o.c)),t.b(this.markerArray,r),o.b(this.labelArray,r,window.devicePixelRatio)},r.prototype.dequeue=function(){if(void 0===this.currentJob){var r=this.queue.shift();if(void 0!==r){this.pack(r.markers,r.markerCount,r.labelCount);var n=r.message;n.markers=this.markerArray,n.markerCount=r.markerCount,n.labels=this.labelArray,n.labelCount=r.labelCount,this.worker.postMessage(n,[n.markers.buffer,n.labels.buffer]),this.currentJob=r}}},r}();e.d(n,"General",function(){return u})}])});
!function(r,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.General=n():r.General=n()}(window,function(){return function(r){var n={};function e(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return r[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=n,e.d=function(r,n,t){e.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:t})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,n){if(1&n&&(r=e(r)),8&n)return r;if(4&n&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(e.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&n&&"string"!=typeof r)for(var o in r)e.d(t,o,function(n){return r[n]}.bind(null,o));return t},e.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(n,"a",n),n},e.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},e.p="/dist/",e(e.s=4)}([function(r,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"c",function(){return i}),e.d(n,"b",function(){return a}),e.d(n,"d",function(){return u});var t=0,o={pixelPositionX:t++,pixelPositionY:t++,groupIndex:t++,iconIndex:t++,priority:t++},i=Object.keys(o).length;function a(r,n){for(var e=0,t=0;e<n.length;e++,t+=i){var a=n[e];r[t+o.pixelPositionX]=a.pixelPosition[0],r[t+o.pixelPositionY]=a.pixelPosition[1],r[t+o.groupIndex]=a.groupIndex,r[t+o.iconIndex]=a.iconIndex,r[t+o.priority]=Boolean(a.priority)?1:0}}function u(r,n){for(var e=0,t=0;e<r.length;e++,t+=i)r[e].iconIndex=n[t+o.iconIndex]}},function(r,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"c",function(){return i}),e.d(n,"b",function(){return a}),e.d(n,"d",function(){return u});var t=0,o={markerIndex:t++,offsetX:t++,offsetY:t++,width:t++,height:t++,display:t++,minZoom:t++},i=7;function a(r,n,e){for(var t=0,a=0;a<n.length;a++){var u=n[a].htmlLabel;void 0!==u&&(r[t+o.markerIndex]=a,r[t+o.offsetX]=u.offset[0]*e,r[t+o.offsetY]=u.offset[1]*e,r[t+o.width]=u.width*e,r[t+o.height]=u.height*e,r[t+o.display]=u.display?1:0,r[t+o.minZoom]=u.minZoom,t+=i)}}function u(r,n){for(var e=0,t=0,a=r;t<a.length;t++){var u=a[t].htmlLabel;void 0!==u&&(u.display=1===n[e+o.display],u.minZoom=n[e+o.minZoom],e+=i)}}},function(r,n,e){function t(r){var n={};function e(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return r[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=r,e.c=n,e.i=function(r){return r},e.d=function(r,n,t){e.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:t})},e.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},e.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(n,"a",n),n},e.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},e.p="/",e.oe=function(r){throw console.error(r),r};var t=e(e.s=ENTRY_MODULE);return t.default||t}var o="[\\.|\\-|\\+|\\w|/|@]+",i="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+o+").*?\\)";function a(r){return(r+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function u(r,n,t){var u={};u[t]=[];var f=n.toString(),c=f.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return u;for(var m,s=c[1],l=new RegExp("(\\\\n|\\W)"+a(s)+i,"g");m=l.exec(f);)"dll-reference"!==m[3]&&u[t].push(m[3]);for(l=new RegExp("\\("+a(s)+'\\("(dll-reference\\s('+o+'))"\\)\\)'+i,"g");m=l.exec(f);)r[m[2]]||(u[t].push(m[1]),r[m[2]]=e(m[1]).m),u[m[2]]=u[m[2]]||[],u[m[2]].push(m[4]);for(var d,p=Object.keys(u),x=0;x<p.length;x++)for(var v=0;v<u[p[x]].length;v++)d=u[p[x]][v],isNaN(1*d)||(u[p[x]][v]=1*u[p[x]][v]);return u}function f(r){return Object.keys(r).reduce(function(n,e){return n||r[e].length>0},!1)}r.exports=function(r,n){n=n||{};var o={main:e.m},i=n.all?{main:Object.keys(o.main)}:function(r,n){for(var e={main:[n]},t={main:[]},o={main:{}};f(e);)for(var i=Object.keys(e),a=0;a<i.length;a++){var c=i[a],m=e[c].pop();if(o[c]=o[c]||{},!o[c][m]&&r[c][m]){o[c][m]=!0,t[c]=t[c]||[],t[c].push(m);for(var s=u(r,r[c][m],c),l=Object.keys(s),d=0;d<l.length;d++)e[l[d]]=e[l[d]]||[],e[l[d]]=e[l[d]].concat(s[l[d]])}}return t}(o,r),a="";Object.keys(i).filter(function(r){return"main"!==r}).forEach(function(r){for(var n=0;i[r][n];)n++;i[r].push(n),o[r][n]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",a=a+"var "+r+" = ("+t.toString().replace("ENTRY_MODULE",JSON.stringify(n))+")({"+i[r].map(function(n){return JSON.stringify(n)+": "+o[r][n].toString()}).join(",")+"});\n"}),a=a+"new (("+t.toString().replace("ENTRY_MODULE",JSON.stringify(r))+")({"+i.main.map(function(r){return JSON.stringify(r)+": "+o.main[r].toString()}).join(",")+"}))(self);";var c=new window.Blob([a],{type:"text/javascript"});if(n.bare)return c;var m=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(c),s=new window.Worker(m);return s.objectURL=m,s}},function(r,n,e){"use strict";e.r(n);var t={min:-1/0,max:1/0},o={min:-1/0,max:1/0},i={min:-1/0,max:1/0},a={min:0,max:1/0};function u(r,n,e){var u,c,m,s,l=n.anchorX-r.anchorX,d=n.anchorY-r.anchorY;return f(t,r.minX,r.maxX,n.minX,n.maxX,l),f(o,r.minY,r.maxY,n.minY,n.maxY,d),c=t,m=o,s=a,(u=i).min=Math.max(c.min,m.min,s.min),u.max=Math.min(c.max,m.max,s.max),i.min>=i.max?-1/0:e+Math.log(i.max)/Math.log(2)}function f(r,n,e,t,o,i){var a=i>0?n-o:t-e,u=i>0?e-t:o-n;r.min=a/Math.abs(i),r.max=u/Math.abs(i)}var c=e(0),m=e(1),s={minX:0,minY:0,maxX:0,maxY:0},l={minX:0,minY:0,maxX:0,maxY:0},d={minX:0,minY:0,maxX:0,maxY:0},p={minX:0,minY:0,maxX:0,maxY:0},x=[];function v(r){for(var n=r.bounds,e=r.priorityGroups,t=r.markers,o=r.markerCount,i=r.labels,a=r.labelCount,u=1+(n.maxX-n.minX>>3)<<3,f=n.maxY-n.minY,s=u*f+8>>3,l=new Uint8Array(s),d=new Uint8Array(s),p=[],v=0;v<e.length;v++)p[v]=new Uint8Array(s);var b=new Int8Array(o);for(v=0;v<o;v++){var g=v*c.c+c.a.iconIndex;b[v]=t[g],t[g]=-1}var w=new Uint8Array(a),k=new Float32Array(a);for(v=0;v<a;v++){var Y=v*m.c+m.a.display,X=v*m.c+m.a.minZoom;w[v]=i[Y],k[v]=i[X],i[Y]=0,i[X]=-1/0}x=[],h(r,l,d,p,u,f,b,!0,!0),h(r,l,d,p,u,f,b,!1,!0),y(r,l,d,u,f,w,k,!0,!0),y(r,l,d,u,f,w,k,!1,!0),h(r,l,d,p,u,f,b,!0,!1),h(r,l,d,p,u,f,b,!1,!1),y(r,l,d,u,f,w,k,!0,!1),y(r,l,d,u,f,w,k,!1,!1)}function h(r,n,e,t,o,i,a,u,f){for(var m=r.bounds,s=r.priorityGroups,l=r.sprites,d=r.markers,p=r.markerCount,x=0;x<s.length;x++){if(l[s[x].iconIndex])for(var v=0!==x?t[x-1]:void 0,h=x!==s.length-1?t[x]:void 0,y=0;y<p;y++){var g=-1!==a[y],w=1===d[c.c*y+c.a.priority];(u&&g||!u&&!g)&&(f&&w||!f&&!w)&&b(d,s,l,m,v,h,n,e,o,i,x,y)}}}function y(r,n,e,t,o,i,a,u,f){for(var s=r.bounds,l=r.markers,d=r.labels,p=r.labelCount,x=r.currentZoom,v=0;v<p;v++){var h=d[v*m.c+m.a.markerIndex],y=1===i[v]&&x>=a[v],b=1===l[h*c.c+c.a.priority];(u&&y||!u&&!y)&&(f&&b||!f&&!b)&&g(l,d,s,n,e,t,o,x,v)}}function b(r,n,e,t,o,i,a,u,f,m,x,v){var h=n[x],y=h.safeZone,b=h.iconIndex,g=h.margin,A=h.degradation,O=e[b],j=O.size,_=O.anchor,P=c.c,I=c.a,M=v*P,Z=r[M+I.groupIndex],S=r[M+I.pixelPositionX]-t.minX,U=r[M+I.pixelPositionY]-t.minY;Z>x||(X(l,f,m,j,_,S,U,g),Y(l)||Z===x&&o&&w(o,f,l)||(X(s,f,m,j,_,S,U,y),Y(s)||w(a,f,s)||(X(d,f,m,j,_,S,U,A),k(a,f,l),X(p,f,m,j,_,S,U,0),k(u,f,p),i&&k(i,f,d),r[M+I.iconIndex]=b)))}function g(r,n,e,t,o,i,a,f,s){var l=m.c,d=m.a,v=s*l,h=n[v+d.markerIndex]*c.c;if(-1!==r[h+c.a.iconIndex]){var y=r[h+c.a.pixelPositionX]-e.minX,b=r[h+c.a.pixelPositionY]-e.minY,g=[n[v+d.width],n[v+d.height]],A=[-n[v+d.offsetX]/g[0],-n[v+d.offsetY]/g[1]];if(X(p,i,a,g,A,y,b,0),!Y(p)&&!w(o,i,p)){k(t,i,p),n[v+d.display]=1;for(var O={anchorX:y,anchorY:b,minX:-g[0]*A[0],minY:-g[1]*A[1],maxX:g[0]*(1-A[0]),maxY:g[1]*(1-A[1]),minZoom:-1/0},j=0,_=x;j<_.length;j++){var P=_[j],I=u(P,O,f);I>O.minZoom&&I>P.minZoom&&(O.minZoom=I)}n[v+d.minZoom]=O.minZoom,x.push(O)}}}function w(r,n,e){for(var t=e.minX,o=e.minY,i=e.maxX,a=e.maxY,u=o;u<a;u++){var f=u*n+t>>3,c=u*n+i>>3,m=0;if(f===c)m=r[f]&255>>(7&t)&255<<8-(7&i);else{m=r[f]&255>>(7&t);for(var s=f+1;s<c;s++)m=r[s]|m;m=r[c]&255<<8-(7&i)|m}if(0!==m)return!0}return!1}function k(r,n,e){for(var t=e.minX,o=e.minY,i=e.maxX,a=e.maxY,u=o;u<a;u++){var f=u*n+t>>3,c=u*n+i>>3;if(f===c)r[f]=r[f]|255>>(7&t)&255<<8-(7&i);else{r[f]=r[f]|255>>(7&t);for(var m=f+1;m<c;m++)r[m]=255;r[c]=r[c]|255<<8-(7&i)}}}function Y(r){return r.minX===r.maxX||r.minY===r.maxY}function X(r,n,e,t,o,i,a,u){var f=i-t[0]*o[0]-u|0,c=a-t[1]*o[1]-u|0,m=i+t[0]*(1-o[0])+u|0,s=a+t[1]*(1-o[1])+u|0;r.minX=f>0?f<n?f:n:0,r.minY=c>0?c<e?c:e:0,r.maxX=m>0?m<n?m:n:0,r.maxY=s>0?s<e?s:e:0}n.default=function(r){r.onmessage=function(n){v(n.data);var e=n.data,t=e.markers,o=e.labels;r.postMessage({markerArray:t,labelArray:o},[t.buffer,o.buffer])}}},function(r,n,e){"use strict";e.r(n);var t=e(0),o=e(1),i=e(2),a=e.n(i),u=function(){function r(){var r=this;this.worker=a()(3),this.queue=[],this.currentJob=void 0,this.markerArray=new Float32Array(1e3*t.c),this.labelArray=new Float32Array(1e3*o.c),this.worker.onmessage=function(n){if(void 0!==r.currentJob){var e=r.currentJob,i=e.markers,a=e.resolve,u=n.data;t.d(i,u.markerArray),o.d(i,u.labelArray),r.markerArray=u.markerArray,r.labelArray=u.labelArray,r.currentJob=void 0,r.dequeue(),a()}}}return r.prototype.generalize=function(r,n,e,t,o){var i=this,a={bounds:r,priorityGroups:n,sprites:e,currentZoom:o},u=t.length,f=t.filter(function(r){return void 0!==r.htmlLabel}).length;return new Promise(function(r){i.queue.push({message:a,markers:t,resolve:r,markerCount:u,labelCount:f}),i.dequeue()})},r.prototype.clear=function(){this.queue=[]},r.prototype.pack=function(r,n,e){n*t.c>this.markerArray.length&&(this.markerArray=new Float32Array(n*t.c)),e*o.c>this.labelArray.length&&(this.labelArray=new Float32Array(e*o.c)),t.b(this.markerArray,r),o.b(this.labelArray,r,window.devicePixelRatio)},r.prototype.dequeue=function(){if(void 0===this.currentJob){var r=this.queue.shift();if(void 0!==r){this.pack(r.markers,r.markerCount,r.labelCount);var n=r.message;n.markers=this.markerArray,n.markerCount=r.markerCount,n.labels=this.labelArray,n.labelCount=r.labelCount,this.worker.postMessage(n,[n.markers.buffer,n.labels.buffer]),this.currentJob=r}}},r}();e.d(n,"General",function(){return u})}])});
//# sourceMappingURL=general.js.map
{
"name": "@2gis/general",
"version": "2.0.0",
"version": "2.0.1",
"description": "Fast marker generalization algorithm",

@@ -5,0 +5,0 @@ "contributors": [

@@ -79,25 +79,48 @@ import { BBox, Vec2, WorkerMessage, PriorityGroup, Sprite, LabelBBox } from '../types';

// Генерализуем в таком порядке:
// 1. Приоритетные маркеры, видимые на экране, затем их подписи
// 2. Приоритетные маркеры, не видимые на экране, затем их подписи
// 3. Неприоритетные маркеры, видимые на экране, затем их подписи
// 4. Неприоритетные маркеры, не видимые на экране, затем их подписи
generalizePart(
// 1. Приоритетные маркеры, видимые на экране
// 2. Приоритетные маркеры, не видимые на экране
// 3. Приоритетные подписи, видимые на экране
// 4. Приоритетные подписи, не видимые на экране
// 5. Неприоритетные маркеры, видимые на экране
// 6. Неприоритетные маркеры, не видимые на экране
// 7. Неприоритетные подписи, видимые на экране
// 8. Неприоритетные подписи, не видимые на экране
generalizeMarkers(
data, plane, noMarginPlane, degradationPlanes, planeWidth, planeHeight,
prevIconIndices, prevLabelState, prevLabelMinZoom, true, true,
prevIconIndices, true, true,
);
generalizePart(
generalizeMarkers(
data, plane, noMarginPlane, degradationPlanes, planeWidth, planeHeight,
prevIconIndices, prevLabelState, prevLabelMinZoom, false, true,
prevIconIndices, false, true,
);
generalizePart(
generalizeLabels(
data, plane, noMarginPlane, planeWidth, planeHeight, prevLabelState,
prevLabelMinZoom, true, true,
);
generalizeLabels(
data, plane, noMarginPlane, planeWidth, planeHeight, prevLabelState,
prevLabelMinZoom, false, true,
);
generalizeMarkers(
data, plane, noMarginPlane, degradationPlanes, planeWidth, planeHeight,
prevIconIndices, prevLabelState, prevLabelMinZoom, true, false,
prevIconIndices, true, false,
);
generalizePart(
generalizeMarkers(
data, plane, noMarginPlane, degradationPlanes, planeWidth, planeHeight,
prevIconIndices, prevLabelState, prevLabelMinZoom, false, false,
prevIconIndices, false, false,
);
generalizeLabels(
data, plane, noMarginPlane, planeWidth, planeHeight, prevLabelState,
prevLabelMinZoom, true, false,
);
generalizeLabels(
data, plane, noMarginPlane, planeWidth, planeHeight, prevLabelState,
prevLabelMinZoom, false, false,
);
}
function generalizePart(
function generalizeMarkers(
data: WorkerMessage,

@@ -110,8 +133,6 @@ plane: Uint8Array,

prevIconIndices: Int8Array,
prevLabelState: Uint8Array,
prevLabelMinZoom: Float32Array,
processVisible: boolean,
processPriority: boolean,
): void {
const { bounds, priorityGroups, sprites, markers, markerCount, labels, labelCount, currentZoom } = data;
const { bounds, priorityGroups, sprites, markers, markerCount } = data;

@@ -152,3 +173,17 @@ for (let i = 0; i < priorityGroups.length; i++) {

}
}
function generalizeLabels(
data: WorkerMessage,
plane: Uint8Array,
noMarginPlane: Uint8Array,
planeWidth: number,
planeHeight: number,
prevLabelState: Uint8Array,
prevLabelMinZoom: Float32Array,
processVisible: boolean,
processPriority: boolean,
): void {
const { bounds, markers, labels, labelCount, currentZoom } = data;
for (let i = 0; i < labelCount; i++) {

@@ -155,0 +190,0 @@ const markerIndex = labels[i * labelArray.stride + labelArray.offsets.markerIndex];

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc