Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

22 lines
9.5 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("exports ../../assets ../../core/colorUtils ../../core/has ../../core/Error ../../core/Logger ../../core/screenUtils ./gfxUtils ./IconSymbol3DLayerResource ./ObjectSymbol3DLayerResource ./previewUtils ./renderUtils ./utils ./webStyleSymbolUtils".split(" "),function(z,O,P,fa,Q,V,w,B,W,X,k,C,R,Y){function y(a){const b=a.outline;var d=null!=a.material?a.material.color:null;d=null!=d?d.toHex():null;if(null==b||"pattern"in b&&null!=b.pattern&&"style"===b.pattern.type&&"none"===b.pattern.style)return"fill"===
a.type&&"#ffffff"===d?{color:"#bdc3c7",width:.75}:null;a=w.pt2px(b.size)||0;return{color:"rgba("+(null!=b.color?b.color.toRgba():"255,255,255,1")+")",width:Math.min(a,J),style:"pattern"in b&&null!=b.pattern&&"style"===b.pattern.type?B.dekebabifyLineStyle(b.pattern.style):null,join:"butt",cap:"patternCap"in b?b.patternCap:"butt"}}async function Z(a,b){if(a.thumbnail?.url)return a.thumbnail.url;if("icon"===b.type&&b?.resource?.href)return R.getIconHref(b);b=O.getAssetUrl("esri/images/Legend/legend3dsymboldefault.png");
return a.styleOrigin&&(a.styleOrigin.styleName||a.styleOrigin.styleUrl)&&(a=await Y.resolveWebStyleSymbol(a.styleOrigin,{portal:a.styleOrigin.portal},"webRef").catch(()=>null))&&"thumbnail"in a&&a.thumbnail?.url?a.thumbnail.url:b}function K(a,b=1){const d=a.a;a=P.toHSV(a);const {r:g,g:t,b:v}=P.toRGB({h:a.h,s:a.s/b,v:100-(100-a.v)/b});return[g,t,v,d]}function D(a){return"water"===a.type?null==a.color?null:a.color:null==a.material?.color?null:a.material.color}function f(a,b=0){var d=D(a);if(!d){if("fill"===
a.type)return null;b=k.adjustColorComponentBrightness(B.defaultThematicColor.r,b);return[b,b,b,100]}a=d.toRgba();for(d=0;3>d;d++)a[d]=k.adjustColorComponentBrightness(a[d],b);return a}async function S(a,b){a=a.style;return"none"===a?null:{type:"pattern",x:0,y:0,src:await B.getPatternUrlWithColor(O.getAssetUrl(`esri/symbols/patterns/${a}.png`),b.toCss(!0)),width:5,height:5}}function T(a){return a.outline?y(a):{color:"rgba(0, 0, 0, 1)",width:1.5}}function L(a,b){a=D(a);if(!a)return null;let d;d="rgba("+
(k.adjustColorComponentBrightness(a.r,b)+",");d+=k.adjustColorComponentBrightness(a.g,b)+",";d+=k.adjustColorComponentBrightness(a.b,b)+",";return d+a.a+");"}function M(a,b){b=L(a,b);if(!b)return{};if("pattern"in a&&null!=a.pattern&&"style"===a.pattern.type&&"none"===a.pattern.style)return null;const d=Math.min(a.size?w.pt2px(a.size):.75,J);return{color:b,width:d,style:"pattern"in a&&null!=a.pattern&&"style"===a.pattern.type?B.dekebabifyLineStyle(a.pattern.style):null,cap:"cap"in a?a.cap:null,join:"join"in
a?"miter"===a.join?w.pt2px(2):a.join:null}}function E(a,b,d){d=null!=d?.75*d:0;return{type:"linear",x1:d?.25*d:0,y1:d?.5*d:0,x2:d||4,y2:d?.5*d:4,colors:[{color:a,offset:0},{color:b,offset:1}]}}function aa(a){const b=a.depth,d=a.height;a=a.width;return 0!==a&&0!==b&&0!==d&&a===b&&null!=a&&null!=d&&a<d}function ba(a,b,d){const g=[];if(!a)return g;switch(a.type){case "icon":switch(a.resource?.primitive??W.defaultPrimitive){case "circle":g.push({shape:{type:"circle",cx:0,cy:0,r:.5*b},fill:f(a,0),stroke:y(a)});
break;case "square":g.push({shape:{type:"path",path:[{command:"M",values:[0,b]},{command:"L",values:[0,0]},{command:"L",values:[b,0]},{command:"L",values:[b,b]},{command:"Z",values:[]}]},fill:f(a,0),stroke:y(a)});break;case "triangle":g.push({shape:{type:"path",path:[{command:"M",values:[0,b]},{command:"L",values:[.5*b,0]},{command:"L",values:[b,b]},{command:"Z",values:[]}]},fill:f(a,0),stroke:y(a)});break;case "cross":g.push({shape:{type:"path",path:[{command:"M",values:[.5*b,0]},{command:"L",values:[.5*
b,b]},{command:"M",values:[0,.5*b]},{command:"L",values:[b,.5*b]}]},stroke:T(a)});break;case "x":g.push({shape:{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[b,b]},{command:"M",values:[b,0]},{command:"L",values:[0,b]}]},stroke:T(a)});break;case "kite":g.push({shape:{type:"path",path:[{command:"M",values:[0,.5*b]},{command:"L",values:[.5*b,0]},{command:"L",values:[b,.5*b]},{command:"L",values:[.5*b,b]},{command:"Z",values:[]}]},fill:f(a,0),stroke:y(a)})}break;case "object":switch(a.resource?.primitive??
X.defaultPrimitive){case "cone":var t=f(a,0);a=f(a,-.6);a=E(t,a,d?N:b);b=k.getConeShapes(b,d);g.push({shape:b[0],fill:a},{shape:b[1],fill:a});break;case "inverted-cone":d=f(a,0);a=f(a,-.6);a=E(d,a,b);b=k.getInvertedConeShapes(b);g.push({shape:b[0],fill:a},{shape:b[1],fill:d});break;case "cube":b=k.getCubeShapes(b,d);g.push({shape:b[0],fill:f(a,0)},{shape:b[1],fill:f(a,-.3)},{shape:b[2],fill:f(a,-.5)});break;case "cylinder":t=f(a,0);const v=f(a,-.6);t=E(t,v,d?N:b);b=k.getCylinderShapes(b,d);g.push({shape:b[0],
fill:t},{shape:b[1],fill:t},{shape:b[2],fill:f(a,0)});break;case "diamond":b=k.getDiamondShapes(b);g.push({shape:b[0],fill:f(a,-.3)},{shape:b[1],fill:f(a,0)},{shape:b[2],fill:f(a,-.3)},{shape:b[3],fill:f(a,-.7)});break;case "sphere":d=f(a,0);a=f(a,-.6);a=E(d,a);a.x1=0;a.y1=0;a.x2=.25*b;a.y2=.25*b;g.push({shape:{type:"circle",cx:0,cy:0,r:.5*b},fill:a});break;case "tetrahedron":b=k.getTetrahedronShapes(b),g.push({shape:b[0],fill:f(a,-.3)},{shape:b[1],fill:f(a,0)},{shape:b[2],fill:f(a,-.6)})}}return g}
function F(a){return(a="number"===typeof a?.size?a?.size:null)?w.pt2px(a):null}async function ca(a,b){const d=F(b),g=b?.maxSize?w.pt2px(b.maxSize):null,t=b?.disableUpsampling??!1,v=a.symbolLayers,q=[];let l=0,r=0;const c=v.at(-1);let h;c&&"icon"===c.type&&(h=c.size&&w.pt2px(c.size));v.forEach(e=>{if("icon"===e.type||"object"===e.type){var p="icon"===e.type?e.size&&w.pt2px(e.size):0,n=d||p?Math.ceil(Math.min(d||p,g||G)):x;if(e?.resource?.href){var u=Z(a,e).then(A=>{const H=e?.material?.color;var I=
"icon"===e.type?"multiply":"tint";return C.tintImageWithColor(A,n,H,I,t)}).then(A=>{const H=A.width,I=A.height;l=Math.max(l,H);r=Math.max(r,I);return[{shape:{type:"image",x:0,y:0,width:H,height:I,src:A.url},fill:null,stroke:null}]});q.push(u)}else u=n,"icon"===e.type&&h&&d&&(u=p/h*n),p="tall"===b?.symbolConfig||b?.symbolConfig?.isTall||("object"===e.type?aa(e):!1),l=Math.max(l,p?N:u),r=Math.max(r,u),q.push(Promise.resolve(ba(e,u,p)))}});const m=[];(await Promise.allSettled(q)).forEach(e=>{"fulfilled"===
e.status?m.push(e.value):e.reason&&V.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",e.reason)});return C.renderSymbol(m,[l,r],{node:b?.node,scale:!1,opacity:b?.opacity,ariaLabel:b?.ariaLabel})}function da(a,b){const d=a.symbolLayers,g=[];a=R.isVolumetricSymbol(a);const t=F(b),v=(b?.maxSize?w.pt2px(b.maxSize):null)||J;let q=0,l=0,r;d.forEach((c,h)=>{if(c&&("line"===c.type||"path"===c.type)){var m=[];switch(c.type){case "line":var e=M(c,0);if(null==e)break;
var p=e?.width||0;0===h&&(r=p);c=Math.min(t||p,v);h=0===h?c:t?p/r*c:c;p=h>U/2?2*h:U;l=Math.max(l,h);q=Math.max(q,p);e.width=h;m.push({shape:{type:"path",path:[{command:"M",values:[0,.5*l]},{command:"L",values:[q,.5*l]}]},stroke:e});break;case "path":e=Math.min(t||x,v);h=f(c,0);p=f(c,-.2);var n=L(c,-.4);n=n?{color:n,width:1}:{};if("quad"===c.profile){const u=c.width;c=c.height;c=k.getPathSymbolShapes(u&&c?u/c:1,0===c,0===u);n={...n,join:"bevel"};m.push({shape:c[0],fill:p,stroke:n},{shape:c[1],fill:p,
stroke:n},{shape:c[2],fill:h,stroke:n})}else m.push({shape:k.shapes.pathSymbol3DLayer[0],fill:p,stroke:n},{shape:k.shapes.pathSymbol3DLayer[1],fill:h,stroke:n});q=l=Math.max(l,e)}g.push(m)}});return Promise.resolve(C.renderSymbol(g,[q,l],{node:b?.node,scale:a,opacity:b?.opacity,ariaLabel:b?.ariaLabel}))}async function ea(a,b){const d="mesh-3d"===a.type;a=a.symbolLayers;var g=F(b);const t=b?.maxSize?w.pt2px(b.maxSize):null;g=g||x;const v=[];let q=0,l=0;var r=!1;for(let p=0;p<a.length;p++){var c=a.at(p);
const n=[];if(!d||"fill"===c.type){switch(c.type){case "fill":r=Math.min(g,t||G);q=Math.max(q,r);l=Math.max(l,r);r=!0;if(d){var h=k.shapes.meshSymbol3DFill,m=L(c,-.4);m=m?{color:m,width:1,join:"round"}:{};n.push({shape:h[0],fill:f(c,0),stroke:m},{shape:h[1],fill:f(c,-.2),stroke:m},{shape:h[2],fill:f(c,-.6),stroke:m})}else{h=f(c,0);m="pattern"in c?c.pattern:null;var e=y(c);c=D(c);null!=m&&"style"===m.type&&"solid"!==m.style&&c&&(h=await S(m,c));n.push({shape:k.shapes.fill[0],fill:h,stroke:e})}break;
case "line":c=M(c,0);if(null==c)break;c={stroke:c,shape:k.shapes.fill[0]};q=Math.max(q,x);l=Math.max(l,x);n.push(c);break;case "extrude":h={join:"round",width:1,...M(c,-.4)};m=f(c,0);c=f(c,-.2);e=Math.min(g,t||G);const u=k.getExtrudeSymbolShapes(e);h.width=1;n.push({shape:u[0],fill:c,stroke:h},{shape:u[1],fill:c,stroke:h},{shape:u[2],fill:m,stroke:h});c=.7*x+.5*e;q=Math.max(q,x);l=Math.max(l,c);break;case "water":r=D(c),c=K(r),h=K(r,2),m=K(r,3),e=k.getWaterSymbolShapes(),r=!0,n.push({shape:e[0],fill:c},
{shape:e[1],fill:h},{shape:e[2],fill:m}),c=Math.min(g,t||G),q=Math.max(q,c),l=Math.max(l,c)}v.push(n)}}return C.renderSymbol(v,[q,l],{node:b?.node,scale:r,opacity:b?.opacity,ariaLabel:b?.ariaLabel})}const x=k.SymbolSizeDefaults.size,G=k.SymbolSizeDefaults.maxSize,J=k.SymbolSizeDefaults.maxOutlineSize,U=k.SymbolSizeDefaults.lineWidth,N=k.SymbolSizeDefaults.tallSymbolWidth;z.getPatternDescriptor=S;z.getSizeFromOptions=F;z.getSymbolLayerFill=f;z.previewSymbol3D=function(a,b){if(0===a.symbolLayers.length)return Promise.reject(new Q("symbolPreview: renderPreviewHTML3D",
"No symbolLayers in the symbol."));switch(a.type){case "point-3d":return ca(a,b);case "line-3d":return da(a,b);case "polygon-3d":case "mesh-3d":return ea(a,b)}return Promise.reject(new Q("symbolPreview: swatchInfo3D","symbol not supported."))};Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});