UNPKG

gisviewer-vue3-arcgis

Version:

在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:

2 lines (1 loc) 3.6 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("ol/style/Circle"),d=require("ol/style/Fill"),M=require("ol/style/Icon"),u=require("ol/style/RegularShape"),s=require("ol/style/Stroke"),f=require("ol/style/Style"),_=require("ol/style/Text"),a=new Map;let w=null;function A(e,t){return e?Array.isArray(e)?e.map(c=>{if(c.type==="text"&&c.field){const n=(t==null?void 0:t[c.field])??"";return JSON.stringify({...c,__textContent__:n})}return JSON.stringify(c)}).join("|"):JSON.stringify(e):"__default__"}function k(){return w||(w=new f({image:new h({radius:6,fill:new d({color:"#2563eb"}),stroke:new s({color:"#ffffff",width:1.5})})})),w}function S(e){const t=new M({src:e.url,scale:e.scale??1,anchor:e.anchor??[.5,.5],anchorXUnits:e.anchorXUnits??"fraction",anchorYUnits:e.anchorYUnits??"fraction",rotation:e.rotation??0});return new f({image:t})}function x(e){const t=new h({radius:e.radius??6,fill:new d({color:e.fillColor??"#2563eb"}),stroke:new s({color:e.strokeColor??"#ffffff",width:e.strokeWidth??1.5})});return new f({image:t})}function C(e){const t=new u({points:e.points??4,radius:e.radius??10,radius2:e.radius2,angle:e.angle??0,rotation:e.rotation??0,fill:e.fillColor?new d({color:e.fillColor}):void 0,stroke:new s({color:e.strokeColor??"#000000",width:e.strokeWidth??1})});return new f({image:t})}function P(e){const t=e.width!=null||e.height!=null,i={src:e.url,anchor:e.anchor??[.5,.5],anchorXUnits:"fraction",anchorYUnits:"fraction",rotation:(e.angle??0)*Math.PI/180,displacement:[e.xoffset??0,-(e.yoffset??0)]};t?(e.width!=null&&(i.width=e.width),e.height!=null&&(i.height=e.height)):e.scale!=null&&(i.scale=e.scale);const c=new M(i);return new f({image:c})}function q(e){var p,g;const t=e.size??12,i=e.color??[0,0,0,1],c=((p=e.outline)==null?void 0:p.color)??[255,255,255,1],n=((g=e.outline)==null?void 0:g.width)??1,o=new d({color:i}),r=new s({color:c,width:n});let l;switch(e.style){case"circle":l=new h({radius:t/2,fill:o,stroke:r});break;case"square":l=new u({points:4,radius:t/2,angle:Math.PI/4,fill:o,stroke:r});break;case"diamond":l=new u({points:4,radius:t/2,angle:0,fill:o,stroke:r});break;case"triangle":l=new u({points:3,radius:t/2,angle:0,fill:o,stroke:r});break;case"cross":l=new u({points:4,radius:t/2,radius2:0,angle:0,stroke:r});break;case"x":l=new u({points:4,radius:t/2,radius2:0,angle:Math.PI/4,stroke:r});break;case"path":l=new h({radius:t/2,fill:o,stroke:r});break;default:l=new h({radius:t/2,fill:o,stroke:r});break}return new f({image:l})}function U(e,t){const i=new _({text:String(t),font:e.font??"14px Arial Unicode MS",fill:new d({color:e.fillColor??[0,0,0]}),stroke:new s({color:e.strokeColor??[255,255,255],width:e.strokeWidth??3}),offsetX:e.offsetX??0,offsetY:e.offsetY??0,textAlign:e.textAlign??"center",textBaseline:e.textBaseline??"middle"});return new f({text:i})}function I(e,t){if(!e)return k();const i=A(e,t),c=a.get(i);if(c)return c;let n;if(Array.isArray(e)&&e.length>0){const o=[];if(e.forEach(r=>{if(r.type==="icon"&&r.url)o.push(S(r));else if(r.type==="picture-marker"&&r.url)o.push(P(r));else if(r.type==="simple-marker")o.push(q(r));else if(r.type==="circle")o.push(x(r));else if(r.type==="shape")o.push(C(r));else if(r.type==="text"&&r.field){const l=(t==null?void 0:t[r.field])??"";l&&o.push(U(r,l))}}),o.length>0)return n=o,a.set(i,n),n}return e&&e.url?(n=S(e),a.set(i,n),n):e&&e.type==="picture-marker"&&e.url?(n=P(e),a.set(i,n),n):e&&e.type==="simple-marker"?(n=q(e),a.set(i,n),n):e&&e.type==="circle"?(n=x(e),a.set(i,n),n):e&&e.type==="shape"?(n=C(e),a.set(i,n),n):k()}exports.getPointStyle=I;