gisviewer-vue3-arcgis
Version:
在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:
2 lines (1 loc) • 2.8 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("ol/style/Fill"),a=require("ol/style/Stroke"),c=require("ol/style/Style"),D=require("ol/style/Text"),f=new Map;let d=null;function x(e,n){return e?Array.isArray(e)?e.map(o=>{if(o.type==="text"&&o.field){const r=(n==null?void 0:n[o.field])??"";return JSON.stringify({...o,__textContent__:r})}return JSON.stringify(o)}).join("|"):JSON.stringify(e):"__default__"}function h(){return d||(d=new c({stroke:new a({color:"#2563eb",width:2})})),d}function s(e){return new c({stroke:new a({color:e.color??"#2563eb",width:e.width??2,lineCap:e.lineCap??"round",lineJoin:e.lineJoin??"round",lineDash:e.lineDash,lineDashOffset:e.lineDashOffset??0})})}function p(e){const n=new c({stroke:new a({color:e.borderColor??"#000000",width:(e.width??2)+(e.borderWidth??2)*2,lineCap:e.lineCap??"round",lineJoin:e.lineJoin??"round",lineDash:e.lineDash,lineDashOffset:e.lineDashOffset??0})}),t=new c({stroke:new a({color:e.color??"#2563eb",width:e.width??2,lineCap:e.lineCap??"round",lineJoin:e.lineJoin??"round",lineDash:e.lineDash,lineDashOffset:e.lineDashOffset??0})});return[n,t]}function S(e,n){const t=n?n*2:10;switch(e){case"solid":return;case"dash":return[t*4,t*2];case"dot":return[t,t*2];case"dash-dot":return[t*4,t*2,t,t*2];case"long-dash":return[t*6,t*3];case"long-dash-dot":return[t*6,t*2,t,t*2];case"long-dash-dot-dot":return[t*6,t*2,t,t*2,t,t*2];case"short-dash":return[t*2,t];case"short-dot":return[t,t];case"short-dash-dot":return[t*2,t,t,t];case"short-dash-dot-dot":return[t*2,t,t,t,t,t];case"none":return[0,1];default:return}}function w(e){const n=e.width??2,t=S(e.style??"solid",n);return new c({stroke:new a({color:e.color??[0,0,0,1],width:n,lineCap:e.cap??"round",lineJoin:e.join??"round",lineDash:t,lineDashOffset:0})})}function C(e,n){const t=new D({text:String(n),font:e.font??"14px Arial Unicode MS",fill:new g({color:e.fillColor??[0,0,0]}),stroke:new a({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",placement:e.placement??"point",overflow:e.overflow??!1,maxAngle:e.maxAngle??Math.PI/4});return new c({text:t})}function k(e,n){if(!e)return h();const t=x(e,n),o=f.get(t);if(o)return o;let r;if(Array.isArray(e)&&e.length>0){const l=[];if(e.forEach(i=>{if(i.type==="line")l.push(s(i));else if(i.type==="simple-line")l.push(w(i));else if(i.type==="bordered")l.push(...p(i));else if(i.type==="text"&&i.field){const u=(n==null?void 0:n[i.field])??"";u&&l.push(C(i,u))}}),l.length>0)return r=l,f.set(t,r),r}return e&&e.type==="bordered"?(r=p(e),f.set(t,r),r):e&&e.type==="simple-line"?(r=w(e),f.set(t,r),r):e?(r=s(e),f.set(t,r),r):h()}exports.getLineDashByStyle=S;exports.getLineStyle=k;