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.
 
 

8 lines
2.4 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 ../../core/screenUtils ../cim/CIMSymbolHelper ../cim/CIMSymbolRasterizer ../cim/OverrideHelper ../cim/utils ./previewUtils ./renderUtils".split(" "),function(r,k,m,v,w,x,n,y){async function z(a,c,g){var b=c?.size;let d=null!=b&&"object"===typeof b&&"width"in b?b.width:b;b=null!=b&&"object"===typeof b&&"height"in b?b.height:b;if(null==d||null==b)if("esriGeometryPolygon"===g)b=d=p;else{if(a=await A(a,c,g))d=a.width,b=a.height;"esriGeometryPolyline"===g&&(d=t);d=null!=d&&isFinite(d)?
Math.min(d,u):p;b=null!=b&&isFinite(b)?Math.max(Math.min(b,u),1):p}"legend"===c.style&&"esriGeometryPolyline"===g&&(d=t);return{width:d,height:b}}async function A(a,c,g){const {feature:b,fieldMap:d,viewParams:e}=c.cimOptions||c;c=await w.OverrideHelper.resolveSymbolOverrides(a.data,b,null,d,g,null,e);if(!c)return null;a=a.clone();a.data={type:"CIMSymbolReference",symbol:c};a.data.primitiveOverrides=void 0;a=[];m.CIMSymbolHelper.fetchResources(c,l.resourceManager,a);m.CIMSymbolHelper.fetchFonts(c,
l.resourceManager,a);0<a.length&&await Promise.all(a);return m.CIMSymbolHelper.getEnvelope(c,null,l.resourceManager)}const l=new v.CIMSymbolRasterizer(null),p=k.px2pt(n.SymbolSizeDefaults.size),u=k.px2pt(n.SymbolSizeDefaults.maxSize),t=k.px2pt(n.SymbolSizeDefaults.lineWidth);r.previewCIMSymbol=async function(a,c={}){const {node:g,opacity:b,symbolConfig:d}=c;var e=null!=d&&"object"===typeof d&&"isSquareFill"in d?d.isSquareFill:!1,f=c.cimOptions||c;const q=f.geometryType||x.mapCIMSymbolToGeometryType(a?.data?.symbol);
var h=await z(a,c,q);const {feature:B,fieldMap:C}=f;e=await l.rasterizeCIMSymbolAsync(a,B,h,e||"esriGeometryPolygon"!==q?"preview":"legend",C,q,null,f.viewParams,f.allowScalingUp);if(!e)return null;const {width:D,height:E}=e;a=document.createElement("canvas");a.width=D;a.height=E;a.getContext("2d").putImageData(e,0,0);e=k.pt2px(h.width);h=k.pt2px(h.height);f=new Image(e,h);f.src=a.toDataURL();f.ariaLabel=c.ariaLabel??null;f.alt=c.ariaLabel??"";null!=b&&(f.style.opacity=`${b}`);a=f;null!=c.effectView&&
(a=y.renderSymbol([[{shape:{type:"image",x:0,y:0,width:e,height:h,src:f.src},fill:null,stroke:null,offset:[0,0]}]],[e,h],{effectView:c.effectView,ariaLabel:c.ariaLabel}));g&&a&&g.appendChild(a);return a};Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});