@arcgis/core 4.30.0-next.20240613 → 4.30.0-next.20240614
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/UndoRedo.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/31f7a3c8e1a5b4ca4a73.js +1 -0
- package/assets/esri/core/workers/chunks/{82f982d9dde0ab137403.js → 339929c10fa8366b1615.js} +1 -1
- package/assets/esri/core/workers/chunks/{de21dffe546dd45dd1fb.js → 7fd9134246a9dbfa603b.js} +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/package.json +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/effects/EffectDashes.js +1 -1
- package/symbols/cim/rasterizingUtils.js +1 -1
- package/undoredo/support/ServiceVersionInfo.js +1 -1
- package/views/2d/engine/webgl/collisions/CollisionGrid.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/RelationshipColumn.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/assets/esri/core/workers/chunks/5379a5f4cb36b8003dcc.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3622],{43334:(e,t,r)=>{r.d(t,{N3:()=>s,Om:()=>o});var n=r(92722);class o{constructor(e=null,t={},r,n){this.geometry=e,this.attributes=t,this.centroid=r,this.objectId=n,this.displayId=0,this.geohashX=0,this.geohashY=0}static fromJSON(e,t){const r=e.geometry?n.A.fromJSON(e.geometry):null,s=e.centroid?n.A.fromJSON(e.centroid):null,i=e.attributes[t];return new o(r,e.attributes,s,i)}weakClone(){const e=new o(this.geometry,this.attributes,this.centroid,this.objectId);return e.displayId=this.displayId,e.geohashX=this.geohashX,e.geohashY=this.geohashY,e}clone(){const e=this.geometry?.clone(),t=new o(e,{...this.attributes},this.centroid?.clone(),this.objectId);return t.displayId=this.displayId,t.geohashX=this.geohashX,t.geohashY=this.geohashY,t}}function s(e){return!!e.geometry?.coords?.length}},58512:(e,t,r)=>{r.d(t,{A:()=>n});class n{constructor(){this.objectIdFieldName=null,this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new n;return e.objectIdFieldName=this.objectIdFieldName,e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}},92722:(e,t,r)=>{r.d(t,{A:()=>n});class n{constructor(e=[],t=[],r=!1){this.lengths=e??[],this.coords=t??[],this.hasIndeterminateRingOrder=r}static fromJSON(e){return new n(e.lengths,e.coords,e.hasIndeterminateRingOrder)}static fromRect(e){const[t,r,o,s]=e,i=o-t,a=s-r;return new n([5],[t,r,i,0,0,a,-i,0,0,-a])}get isPoint(){return 0===this.lengths.length}get maxLength(){return Math.max(...this.lengths)}get size(){return this.lengths.reduce(((e,t)=>e+t))}forEachVertex(e){let t=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let r=0;r<this.lengths.length;r++){const n=this.lengths[r];for(let r=0;r<n;r++)e(this.coords[2*(r+t)],this.coords[2*(r+t)+1]);t+=n}}deltaDecode(){const e=this.clone(),{coords:t,lengths:r}=e;let n=0;for(const e of r){for(let r=1;r<e;r++)t[2*(n+r)]+=t[2*(n+r)-2],t[2*(n+r)+1]+=t[2*(n+r)-1];n+=e}return e}clone(e){if(0===this.lengths.length)return new n([],[this.coords[0],this.coords[1]]);const t=2*(0===this.lengths.length?1:this.lengths.reduce(((e,t)=>e+t))),r=this.coords.slice(0,t);return e?(e.set(r),new n(this.lengths,e,this.hasIndeterminateRingOrder)):new n(Array.from(this.lengths),Array.from(r),this.hasIndeterminateRingOrder)}}},90708:(e,t,r)=>{r.d(t,{B2:()=>F,BW:()=>Z,Ch:()=>ne,DF:()=>x,Di:()=>Q,E2:()=>z,IE:()=>w,Nl:()=>H,Q4:()=>oe,Rk:()=>ie,Ux:()=>J,Ye:()=>k,ZF:()=>U,eY:()=>$,jH:()=>W,jQ:()=>re,kz:()=>K,oN:()=>E,q3:()=>X,qK:()=>D,qN:()=>v,z5:()=>j,zv:()=>Y});var n=r(49186),o=r(53966),s=r(97768),i=r(70328),a=r(19419),u=r(65864),l=r(43334),c=r(58512),h=r(92722);function d(e,t){return e?t?4:3:t?3:2}const f=()=>o.A.getLogger("esri.layers.graphics.featureConversionUtils"),m={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:3,esriGeometryMultipoint:0,esriGeometryEnvelope:0},y=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s},p=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s,e[r+2]=t[n+2]},g=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s,e[r+2]=t[n+3]},b=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s,e[r+2]=t[n+2],e[r+3]=t[n+3]};function _(e,t,r,n){if(e){if(r)return t&&n?b:p;if(t&&n)return g}else if(t&&n)return p;return y}function w({scale:e,translate:t},r){return Math.round((r-t[0])/e[0])}function F({scale:e,translate:t},r){return Math.round((t[1]-r)/e[1])}function I({scale:e,translate:t},r,n){return r*e[n]+t[n]}function x(e,t,r){return e?t?r?T(e):A(e):r?M(e):P(e):null}function P(e){const t=e.coords;return{x:t[0],y:t[1]}}function S(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e}function A(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2]}}function G(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e}function M(e){const t=e.coords;return{x:t[0],y:t[1],m:t[2]}}function N(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.m,e}function T(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2],m:t[3]}}function C(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e.coords[3]=t.m,e}function R(e,t){return e&&t?C:e?G:t?N:S}function v(e,t,r=R(null!=t.z,null!=t.m)){return r(e,t)}function D(e,t,r){if(null==e)return null;const n=d(t,r),o=[];for(let t=0;t<e.coords.length;t+=n){const r=[];for(let o=0;o<n;o++)r.push(e.coords[t+o]);o.push(r)}return t?r?{points:o,hasZ:t,hasM:r}:{points:o,hasZ:t}:r?{points:o,hasM:r}:{points:o}}function O(e,t,r=d(t.hasZ,t.hasM)){e.lengths[0]=t.points.length;const n=e.coords;let o=0;for(const e of t.points)for(let t=0;t<r;t++)n[o++]=e[t];return e}function Z(e,t,r){if(!e)return null;const n=d(t,r),{coords:o,lengths:s}=e,i=[];let a=0;for(const e of s){const t=[];for(let r=0;r<e;r++){const e=[];for(let t=0;t<n;t++)e.push(o[a++]);t.push(e)}i.push(t)}return t?r?{paths:i,hasZ:t,hasM:r}:{paths:i,hasZ:t}:r?{paths:i,hasM:r}:{paths:i}}function q(e,t,r=d(t.hasZ,t.hasM)){const{lengths:n,coords:o}=e;let s=0;for(const e of t.paths){for(const t of e)for(let e=0;e<r;e++)o[s++]=t[e];n.push(e.length)}return e}function j(e,t,r){if(!e)return null;const n=d(t,r),{coords:o,lengths:s}=e,i=[];let a=0;for(const e of s){const t=[];for(let r=0;r<e;r++){const e=[];for(let t=0;t<n;t++)e.push(o[a++]);t.push(e)}i.push(t)}return t?r?{rings:i,hasZ:t,hasM:r}:{rings:i,hasZ:t}:r?{rings:i,hasM:r}:{rings:i}}function k(e,t,r=t.hasZ,n=t.hasM){return function(e,t,r,n){const o=d(r,n),{lengths:s,coords:i}=e;let a=0;ae(e);for(const e of t){for(const t of e)for(let e=0;e<o;e++)i[a++]=t[e];s.push(e.length)}return e}(e,t.rings,r,n)}const V=[],L=[];function z(e,t,r,n,o){V[0]=e;const[s]=Q(L,V,t,r,n,o);return ue(V),ue(L),s}function Q(e,t,r,o,s,i){if(ue(e),!r){for(const r of t){const t=i?r.attributes[i]:void 0;e.push(new l.Om(null,r.attributes,null,t))}return e}switch(r){case"esriGeometryPoint":return function(e,t,r,n,o){const s=R(r,n);for(const{geometry:r,attributes:n}of t){const t=null!=r?s(new h.A,r):null;e.push(new l.Om(t,n,null,o?n[o]:void 0))}return e}(e,t,o,s,i);case"esriGeometryMultipoint":return function(e,t,r,n,o){const s=d(r,n);for(const{geometry:r,attributes:n}of t){const t=null!=r?O(new h.A,r,s):null;e.push(new l.Om(t,n,null,o?n[o]:void 0))}return e}(e,t,o,s,i);case"esriGeometryPolyline":return function(e,t,r,n,o){const s=d(r,n);for(const{geometry:r,attributes:n,centroid:i}of t){const t=null!=r?q(new h.A,r,s):null,a=null!=i?v(new h.A,i):null;e.push(new l.Om(t,n,a,o?n[o]:void 0))}return e}(e,t,o,s,i);case"esriGeometryPolygon":return function(e,t,r,n,o){for(const{geometry:s,centroid:i,attributes:a}of t){const t=null!=s?k(new h.A,s,r,n):null,u=o?a[o]:void 0;null!=i?e.push(new l.Om(t,a,S(new h.A,i),u)):e.push(new l.Om(t,a,null,u))}return e}(e,t,o,s,i);default:f().error("convertToFeatureSet:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${r}'`)),ue(e)}return e}function E(e,t,r,n){L[0]=e,B(V,L,t,r,n);const o=V[0];return ue(V),ue(L),o}function J(e,t,r){if(null==e)return null;const o=new h.A;return"hasZ"in e&&null==t&&(t=e.hasZ),"hasM"in e&&null==r&&(r=e.hasM),(0,u.fT)(e)?R(null!=t?t:null!=e.z,null!=r?r:null!=e.m)(o,e):(0,u.Bi)(e)?k(o,e,t,r):(0,u.Rg)(e)?q(o,e,d(t,r)):(0,u.U9)(e)?O(o,e,d(t,r)):void f().error("convertFromGeometry:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${e}'`))}function Y(e,t,r,o){const s=e&&("coords"in e?e:e.geometry);if(null==s)return null;switch(t){case"esriGeometryPoint":{let e=P;return r&&o?e=T:r?e=A:o&&(e=M),e(s)}case"esriGeometryMultipoint":return D(s,r,o);case"esriGeometryPolyline":return Z(s,r,o);case"esriGeometryPolygon":return j(s,r,o);default:return f().error("convertToGeometry:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${t}'`)),null}}function B(e,t,r,o,s){if(ue(e),null==r)return function(e,t){for(const r of t)e.push({attributes:r.attributes});return e}(e,t);switch(r){case"esriGeometryPoint":return function(e,t,r,n){let o=P;r&&n?o=T:r?o=A:n&&(o=M);for(const r of t){const{geometry:t,attributes:n}=r,s=null!=t?o(t):null;e.push({attributes:n,geometry:s})}return e}(e,t,o,s);case"esriGeometryMultipoint":return function(e,t,r,n){for(const{geometry:o,attributes:s}of t)e.push({attributes:s,geometry:null!=o?D(o,r,n):null});return e}(e,t,o,s);case"esriGeometryPolyline":return function(e,t,r,n){for(const{geometry:o,attributes:s}of t)e.push({attributes:s,geometry:null!=o?Z(o,r,n):null});return e}(e,t,o,s);case"esriGeometryPolygon":return function(e,t,r,n){for(const{geometry:o,attributes:s,centroid:i}of t){const t=null!=o?j(o,r,n):null;if(null!=i){const r=P(i);e.push({attributes:s,centroid:r,geometry:t})}else e.push({attributes:s,geometry:t})}return e}(e,t,o,s);default:f().error("convertToFeatureSet:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${r}'`))}return e}function U(e){const{objectIdFieldName:t,spatialReference:r,transform:n,fields:o,hasM:s,hasZ:i,features:a,geometryType:u,exceededTransferLimit:l,uniqueIdField:c,queryGeometry:h,queryGeometryType:d}=e,f={features:B([],a,u,i,s),fields:o,geometryType:u,objectIdFieldName:t,spatialReference:r,uniqueIdField:c,queryGeometry:Y(h,d,!1,!1)};return n&&(f.transform=n),l&&(f.exceededTransferLimit=l),s&&(f.hasM=s),i&&(f.hasZ=i),f}function X(e,t){const r=new c.A,{hasM:o,hasZ:s,features:i,objectIdFieldName:a,spatialReference:u,geometryType:l,exceededTransferLimit:h,transform:d,fields:m}=e;return m&&(r.fields=m),r.geometryType=l??null,r.objectIdFieldName=a??t??null,r.spatialReference=u??null,r.objectIdFieldName?(i&&Q(r.features,i,l,s,o,r.objectIdFieldName),h&&(r.exceededTransferLimit=h),o&&(r.hasM=o),s&&(r.hasZ=s),d&&(r.transform=d),r):(f().error(new n.A("optimized-features:invalid-objectIdFieldName","objectIdFieldName is missing")),r)}function $(e){const{transform:t,features:r,hasM:n,hasZ:o}=e;if(!t)return e;for(const e of r)null!=e.geometry&&ne(e.geometry,e.geometry,n,o,t),null!=e.centroid&&ne(e.centroid,e.centroid,n,o,t);return e.transform=null,e}function W(e,t){const{geometryType:r,features:n,hasM:o,hasZ:s}=t;if(!e)return t;for(let t=0;t<n.length;t++){const i=n[t],a=i.weakClone();a.geometry=new h.A,H(a.geometry,i.geometry,o,s,r,e),i.centroid&&(a.centroid=new h.A,H(a.centroid,i.centroid,o,s,"esriGeometryPoint",e)),n[t]=a}return t.transform=e,t}function H(e,t,r,n,o,s,i=r,a=n){if(ae(e),!t?.coords.length)return null;const u=m[o],{coords:l,lengths:c}=t,h=d(r,n),f=d(r&&i,n&&a),y=_(r,n,i,a);if(!c.length)return y(e.coords,l,0,0,w(s,l[0]),F(s,l[1])),ae(e,h,0),e;let p,g,b,I,x=0,P=0,S=P;for(const t of c){if(t<u)continue;let r=0;P=S,b=p=w(s,l[x]),I=g=F(s,l[x+1]),y(e.coords,l,P,x,b,I),r++,x+=h,P+=f;for(let n=1;n<t;n++,x+=h)b=w(s,l[x]),I=F(s,l[x+1]),b===p&&I===g||(y(e.coords,l,P,x,b-p,I-g),P+=f,r++,p=b,g=I);r>=u&&(e.lengths.push(r),S=P)}return ue(e.coords,S),e.coords.length?e:null}function K(e,t,r,n,o,s,i=r,a=n){if(ae(e),!t?.coords.length)return null;const u=m[o],{coords:l,lengths:c}=t,h=d(r,n),f=d(r&&i,n&&a),y=_(r,n,i,a);if(!c.length)return y(e.coords,l,0,0,l[0],l[1]),ae(e,h,0),e;let p=0;const g=s*s;for(const t of c){if(t<u){p+=t*h;continue}const r=e.coords.length/f,n=p,o=p+(t-1)*h;y(e.coords,l,e.coords.length,n,l[n],l[n+1]),te(e.coords,l,h,g,y,n,o),y(e.coords,l,e.coords.length,o,l[o],l[o+1]);const s=e.coords.length/f-r;s>=u?e.lengths.push(s):ue(e.coords,r*f),p+=t*h}return e.coords.length?e:null}function ee(e,t,r,n){const o=e[t],s=e[t+1],i=e[r],a=e[r+1],u=e[n],l=e[n+1];let c=i,h=a,d=u-c,f=l-h;if(0!==d||0!==f){const e=((o-c)*d+(s-h)*f)/(d*d+f*f);e>1?(c=u,h=l):e>0&&(c+=d*e,h+=f*e)}return d=o-c,f=s-h,d*d+f*f}function te(e,t,r,n,o,s,i){let a,u=n,l=0;for(let e=s+r;e<i;e+=r)a=ee(t,e,s,i),a>u&&(l=e,u=a);u>n&&(l-s>r&&te(e,t,r,n,o,s,l),o(e,t,e.length,l,t[l],t[l+1]),i-l>r&&te(e,t,r,n,o,l,i))}function re(e,t,r,n){if(!t?.coords?.length)return null;const o=d(r,n);let s=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;if(t&&t.coords){const e=t.coords;for(let t=0;t<e.length;t+=o){const r=e[t],n=e[t+1];s=Math.min(s,r),l=Math.max(l,r),u=Math.min(u,n),c=Math.max(c,n)}}return(0,i.is)(e)?(0,i.BI)(e,s,u,l,c):(0,a.fA)(s,u,l,c,e),e}function ne(e,t,r,n,o){const{coords:i,lengths:a}=t,u=d(r,n);if(!i.length)return e!==t&&ae(e),e;(0,s.Lw)(o);const{originPosition:l,scale:c,translate:h}=o,f=le;f.originPosition=l;const m=f.scale;m[0]=c[0]??1,m[1]=-(c[1]??1),m[2]=c[2]??1,m[3]=c[3]??1;const y=f.translate;if(y[0]=h[0]??0,y[1]=h[1]??0,y[2]=h[2]??0,y[3]=h[3]??0,!a.length){for(let t=0;t<u;++t)e.coords[t]=I(f,i[t],t);return e!==t&&ae(e,u,0),e}let p=0;for(let t=0;t<a.length;t++){const r=a[t];e.lengths[t]=r;for(let t=0;t<u;++t)e.coords[p+t]=I(f,i[p+t],t);let n=e.coords[p],o=e.coords[p+1];p+=u;for(let t=1;t<r;t++,p+=u){n+=i[p]*m[0],o+=i[p+1]*m[1],e.coords[p]=n,e.coords[p+1]=o;for(let t=2;t<u;++t)e.coords[p+t]=I(f,i[p+t],t)}}return e!==t&&ae(e,i.length,a.length),e}function oe(e,t,r,n,o,s){if(ae(e),e.lengths.push(...t.lengths),r===o&&n===s)for(let r=0;r<t.coords.length;r++)e.coords.push(t.coords[r]);else{const i=d(r,n),a=_(r,n,o,s),u=t.coords;for(let t=0;t<u.length;t+=i)a(e.coords,u,e.coords.length,t,u[t],u[t+1])}return e}function se(e,t,r,n){let o=0,s=e[n*t],i=e[n*(t+1)];for(let a=1;a<r;a++){const r=s+e[n*(t+a)],u=i+e[n*(t+a)+1],l=(r-s)*(u+i);s=r,i=u,o+=l}return.5*o}function ie(e,t){const{coords:r,lengths:n}=e;let o=0,s=0;for(let e=0;e<n.length;e++){const i=n[e];s+=se(r,o,i,t),o+=i}return Math.abs(s)}function ae(e,t=0,r=0){ue(e.lengths,r),ue(e.coords,t)}function ue(e,t=0){e.length!==t&&(e.length=t)}const le={originPosition:"lowerLeft",scale:[1,1,1,1],translate:[0,0,0,0]}},93622:(e,t,r)=>{r.d(t,{A:()=>P});var n=r(90237),o=r(69622),s=r(49186),i=r(44208),a=r(74887),u=r(84952),l=r(10107),c=(r(53966),r(87811),r(40608)),h=r(21325),d=r(20557),f=r(27733),m=r(2272),y=r(20615),p=(r(59456),r(80893)),g=r(61956),b=r(5443),_=r(78286),w=r(99199),F=r(71575),I=r(22671);let x=class extends o.A{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.queryAttachmentsSupported=!1,this.sourceSpatialReference=null,this.url=null}get parsedUrl(){return(0,u.An)(this.url)}async execute(e,t){const r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){const r=this._normalizeQuery(e),n=null!=e.outStatistics?.[0],o=(0,i.A)("featurelayer-pbf-statistics"),s=!n||o;let a;if(this.pbfSupported&&s)try{a=await(0,F.S)(this.url,r,t)}catch(e){if("query:parsing-pbf"!==e.name)throw e;this.pbfSupported=!1}return this.pbfSupported&&s||(a=await(0,w.e)(this.url,r,t)),this._normalizeFields(a.fields),a}async featureSetFromJSON(e,t,n){if(!this._queryIs3DObjectFormat(e)||null==this.infoFor3D||!t.features)return I.A.fromJSON(t);const{meshFeatureSetFromJSON:o}=await(0,a.qr)(Promise.all([r.e(3030),r.e(1535),r.e(1215)]).then(r.bind(r,40050)),n);return o(e,this.infoFor3D,t)}executeForCount(e,t){return(0,y.I)(this.url,this._normalizeQuery(e),t)}executeForExtent(e,t){return async function(e,t,r){const n=(0,m.Dl)(e),o=await(0,p.Jf)(n,g.A.from(t),{...r}),s=o.data.extent;return!s||isNaN(s.xmin)||isNaN(s.ymin)||isNaN(s.xmax)||isNaN(s.ymax)?{count:o.data.count,extent:null}:{count:o.data.count,extent:b.A.fromJSON(s)}}(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return(0,_.V)(this.url,this._normalizeQuery(e),t)}async executeRelationshipQuery(e,t){const[{default:n},{executeRelationshipQuery:o}]=await(0,a.qr)(Promise.all([Promise.resolve().then(r.bind(r,26591)),r.e(5257).then(r.bind(r,15257))]),t);return e=n.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeRelationshipQueryForCount(e,t){const[{default:n},{executeRelationshipQueryForCount:o}]=await(0,a.qr)(Promise.all([Promise.resolve().then(r.bind(r,26591)),r.e(5257).then(r.bind(r,15257))]),t);return e=n.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeAttachmentQuery(e,t){const{executeAttachmentQuery:n,fetchAttachments:o,processAttachmentQueryResult:s}=await(0,a.qr)(r.e(5771).then(r.bind(r,65771)),t),i=(0,m.Dl)(this.url);return s(i,await(this.queryAttachmentsSupported?n(i,e,t):o(i,e,t)))}async executeTopFeaturesQuery(e,t){const{executeTopFeaturesQuery:n}=await(0,a.qr)(r.e(1273).then(r.bind(r,11273)),t);return n(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){const{executeForTopIds:n}=await(0,a.qr)(r.e(1277).then(r.bind(r,21277)),t);return n(this.parsedUrl,e,t)}async executeForTopExtents(e,t){const{executeForTopExtents:n}=await(0,a.qr)(r.e(8018).then(r.bind(r,8018)),t);return n(this.parsedUrl,e,t)}async executeForTopCount(e,t){const{executeForTopCount:n}=await(0,a.qr)(r.e(980).then(r.bind(r,10980)),t);return n(this.parsedUrl,e,t)}_normalizeQuery(e){let t=g.A.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource?f.L.from(e.dynamicDataSource):this.dynamicDataSource);const{infoFor3D:r}=this;if(null!=r&&this._queryIs3DObjectFormat(e)){t=t===e?t.clone():t,t.formatOf3DObjects=null;const{supportedFormats:n,queryFormats:o}=r,i=(0,d.R_)("model/gltf-binary",n)??(0,d.E1)("glb",n),a=(0,d.R_)("model/gltf+json",n)??(0,d.E1)("gltf",n);for(const e of o){if(e===i){t.formatOf3DObjects=e;break}e!==a||t.formatOf3DObjects||(t.formatOf3DObjects=e)}if(!t.formatOf3DObjects)throw new s.A("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(t.outSpatialReference&&!(0,h.aI)(t.outSpatialReference,this.sourceSpatialReference))throw new s.A("query:unsupported-out-spatial-reference","3D object feature services do not support projection of geometries");if(null==t.outFields||!t.outFields.includes("*")){t=t===e?t.clone():t,null==t.outFields&&(t.outFields=[]);const{originX:n,originY:o,originZ:s,translationX:i,translationY:a,translationZ:u,scaleX:l,scaleY:c,scaleZ:h,rotationX:d,rotationY:f,rotationZ:m,rotationDeg:y}=r.transformFieldRoles;t.outFields.push(n,o,s,i,a,u,l,c,h,d,f,m,y)}}return t}_normalizeFields(e){if(null!=this.fieldsIndex&&null!=e)for(const t of e){const e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryIs3DObjectFormat(e){return null!=this.infoFor3D&&!0===e.returnGeometry&&"xyFootprint"!==e.multipatchOption&&!e.outStatistics}};(0,n._)([(0,l.MZ)({type:f.L})],x.prototype,"dynamicDataSource",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"fieldsIndex",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"gdbVersion",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"infoFor3D",void 0),(0,n._)([(0,l.MZ)({readOnly:!0})],x.prototype,"parsedUrl",null),(0,n._)([(0,l.MZ)()],x.prototype,"pbfSupported",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"queryAttachmentsSupported",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"sourceSpatialReference",void 0),(0,n._)([(0,l.MZ)({type:String})],x.prototype,"url",void 0),x=(0,n._)([(0,c.$)("esri.layers.graphics.sources.support.QueryTask")],x);const P=x},20557:(e,t,r)=>{r.d(t,{E1:()=>a,Fm:()=>u,JZ:()=>m,R_:()=>i,fu:()=>o,oF:()=>s,rq:()=>l});const n=[["binary","application/octet-stream","bin",""]];function o(e,t){return null!=h(t.name,e?.supportedFormats??[])}function s(e,t){if(!e)return!1;const r=l(t,e.supportedFormats??[]);return null!=r&&e.editFormats.includes(r)}function i(e,t){return d(function(e,t){const r=e.toLowerCase();return c(t).find((e=>f(e)===r))}(e,t))}function a(e,t){return d(h(e,t))}function u(e,t){return f(function(e,t){return c(t).find((t=>d(t)===e))}(e,t))}function l(e,t){return a(e.name,t)??i(e.type,t)}function c(e){return[...n,...e]}function h(e,t){const r=e.toLowerCase();return c(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>r.endsWith(e)))))}function d(e){return e?.[0]}function f(e){return e?.[1].toLowerCase()}function m(e){return e.tables?.find((e=>"assetMaps"===e.role))}},20615:(e,t,r)=>{r.d(t,{I:()=>i});var n=r(2272),o=r(80893),s=r(61956);async function i(e,t,r){const i=(0,n.Dl)(e),{data:a}=await(0,o.gW)(i,s.A.from(t),r);return a.count}},78286:(e,t,r)=>{r.d(t,{V:()=>i});var n=r(2272),o=r(80893),s=r(61956);async function i(e,t,r){const i=(0,n.Dl)(e),{data:a}=await(0,o.Pk)(i,s.A.from(t),r);return a.objectIds}},99199:(e,t,r)=>{r.d(t,{e:()=>u,s:()=>a});var n=r(2272),o=r(80893),s=r(22671),i=r(61956);async function a(e,t,r){const n=await u(e,t,r);return s.A.fromJSON(n)}async function u(e,t,r){const s=(0,n.Dl)(e),a={...r},u=i.A.from(t),{data:l}=await(0,o.eW)(s,u,u.sourceSpatialReference,a);return l}},71575:(e,t,r)=>{r.d(t,{S:()=>p});var n=r(2272),o=r(97768),s=r(62815),i=r(90708);function a(e,t){return t}function u(e,t,r,n){switch(r){case 0:return d(e,t+n,0);case 1:return"lowerLeft"===e.originPosition?d(e,t+n,1):function({translate:e,scale:t},r,n){return e[n]-r*t[n]}(e,t+n,1)}}function l(e,t,r,n){return 2===r?d(e,t,2):u(e,t,r,n)}function c(e,t,r,n){return 2===r?0===t?0:d(e,t,3):u(e,t,r,n)}function h(e,t,r,n){return 3===r?0===t?0:d(e,t,3):l(e,t,r,n)}function d({translate:e,scale:t},r,n){return e[n]+r*t[n]}class f{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=a,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=(0,s.N)(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=t)for(const r of e.features)t(r.geometry)}createSpatialReference(){return{}}addField(e,t){const r=e.fields;(0,o.Lw)(r),r.push(t);const n=r.map((e=>e.name));this._attributesConstructor=function(){for(const e of n)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:r,queryGeometryType:n}=t,o=(0,i.Ch)(r.clone(),r,!1,!1,this._transform),s=(0,i.zv)(o,n,!1,!1);e.queryGeometryType=n,e.queryGeometry={...s}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const n=this._transform;switch(t=this._applyTransform(n,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const n=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(n,e,t,r):0}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const n=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(n)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const n=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=n}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?l:r?c:u}}var m=r(80893),y=(r(22671),r(61956));async function p(e,t,r){const o=(0,n.Dl)(e),s={...r},i=y.A.from(t),a=!i.quantizationParameters,{data:u}=await(0,m.IJ)(o,i,new f({sourceSpatialReference:i.sourceSpatialReference,applyTransform:a}),s);return u}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3622],{43334:(e,t,r)=>{r.d(t,{N3:()=>s,Om:()=>o});var n=r(92722);class o{constructor(e=null,t={},r,n){this.geometry=e,this.attributes=t,this.centroid=r,this.objectId=n,this.displayId=0,this.geohashX=0,this.geohashY=0}static fromJSON(e,t){const r=e.geometry?n.A.fromJSON(e.geometry):null,s=e.centroid?n.A.fromJSON(e.centroid):null,i=e.attributes[t];return new o(r,e.attributes,s,i)}weakClone(){const e=new o(this.geometry,this.attributes,this.centroid,this.objectId);return e.displayId=this.displayId,e.geohashX=this.geohashX,e.geohashY=this.geohashY,e}clone(){const e=this.geometry?.clone(),t=new o(e,{...this.attributes},this.centroid?.clone(),this.objectId);return t.displayId=this.displayId,t.geohashX=this.geohashX,t.geohashY=this.geohashY,t}}function s(e){return!!e.geometry?.coords?.length}},58512:(e,t,r)=>{r.d(t,{A:()=>n});class n{constructor(){this.objectIdFieldName=null,this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new n;return e.objectIdFieldName=this.objectIdFieldName,e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}},92722:(e,t,r)=>{r.d(t,{A:()=>n});class n{constructor(e=[],t=[],r=!1){this.lengths=e??[],this.coords=t??[],this.hasIndeterminateRingOrder=r}static fromJSON(e){return new n(e.lengths,e.coords,e.hasIndeterminateRingOrder)}static fromRect(e){const[t,r,o,s]=e,i=o-t,a=s-r;return new n([5],[t,r,i,0,0,a,-i,0,0,-a])}get isPoint(){return 0===this.lengths.length}get maxLength(){return Math.max(...this.lengths)}get size(){return this.lengths.reduce(((e,t)=>e+t))}forEachVertex(e){let t=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let r=0;r<this.lengths.length;r++){const n=this.lengths[r];for(let r=0;r<n;r++)e(this.coords[2*(r+t)],this.coords[2*(r+t)+1]);t+=n}}deltaDecode(){const e=this.clone(),{coords:t,lengths:r}=e;let n=0;for(const e of r){for(let r=1;r<e;r++)t[2*(n+r)]+=t[2*(n+r)-2],t[2*(n+r)+1]+=t[2*(n+r)-1];n+=e}return e}clone(e){if(0===this.lengths.length)return new n([],[this.coords[0],this.coords[1]]);const t=2*(0===this.lengths.length?1:this.lengths.reduce(((e,t)=>e+t))),r=this.coords.slice(0,t);return e?(e.set(r),new n(this.lengths,e,this.hasIndeterminateRingOrder)):new n(Array.from(this.lengths),Array.from(r),this.hasIndeterminateRingOrder)}}},90708:(e,t,r)=>{r.d(t,{B2:()=>F,BW:()=>Z,Ch:()=>ne,DF:()=>x,Di:()=>Q,E2:()=>z,IE:()=>w,Nl:()=>H,Q4:()=>oe,Rk:()=>ie,Ux:()=>J,Ye:()=>k,ZF:()=>U,eY:()=>$,jH:()=>W,jQ:()=>re,kz:()=>K,oN:()=>E,q3:()=>X,qK:()=>D,qN:()=>v,z5:()=>j,zv:()=>Y});var n=r(49186),o=r(53966),s=r(97768),i=r(70328),a=r(19419),u=r(65864),l=r(43334),c=r(58512),h=r(92722);function d(e,t){return e?t?4:3:t?3:2}const f=()=>o.A.getLogger("esri.layers.graphics.featureConversionUtils"),m={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:3,esriGeometryMultipoint:0,esriGeometryEnvelope:0},y=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s},p=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s,e[r+2]=t[n+2]},g=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s,e[r+2]=t[n+3]},b=(e,t,r,n,o,s)=>{e[r]=o,e[r+1]=s,e[r+2]=t[n+2],e[r+3]=t[n+3]};function _(e,t,r,n){if(e){if(r)return t&&n?b:p;if(t&&n)return g}else if(t&&n)return p;return y}function w({scale:e,translate:t},r){return Math.round((r-t[0])/e[0])}function F({scale:e,translate:t},r){return Math.round((t[1]-r)/e[1])}function I({scale:e,translate:t},r,n){return r*e[n]+t[n]}function x(e,t,r){return e?t?r?T(e):A(e):r?M(e):P(e):null}function P(e){const t=e.coords;return{x:t[0],y:t[1]}}function S(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e}function A(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2]}}function G(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e}function M(e){const t=e.coords;return{x:t[0],y:t[1],m:t[2]}}function N(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.m,e}function T(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2],m:t[3]}}function C(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e.coords[3]=t.m,e}function R(e,t){return e&&t?C:e?G:t?N:S}function v(e,t,r=R(null!=t.z,null!=t.m)){return r(e,t)}function D(e,t,r){if(null==e)return null;const n=d(t,r),o=[];for(let t=0;t<e.coords.length;t+=n){const r=[];for(let o=0;o<n;o++)r.push(e.coords[t+o]);o.push(r)}return t?r?{points:o,hasZ:t,hasM:r}:{points:o,hasZ:t}:r?{points:o,hasM:r}:{points:o}}function O(e,t,r=d(t.hasZ,t.hasM)){e.lengths[0]=t.points.length;const n=e.coords;let o=0;for(const e of t.points)for(let t=0;t<r;t++)n[o++]=e[t];return e}function Z(e,t,r){if(!e)return null;const n=d(t,r),{coords:o,lengths:s}=e,i=[];let a=0;for(const e of s){const t=[];for(let r=0;r<e;r++){const e=[];for(let t=0;t<n;t++)e.push(o[a++]);t.push(e)}i.push(t)}return t?r?{paths:i,hasZ:t,hasM:r}:{paths:i,hasZ:t}:r?{paths:i,hasM:r}:{paths:i}}function q(e,t,r=d(t.hasZ,t.hasM)){const{lengths:n,coords:o}=e;let s=0;for(const e of t.paths){for(const t of e)for(let e=0;e<r;e++)o[s++]=t[e];n.push(e.length)}return e}function j(e,t,r){if(!e)return null;const n=d(t,r),{coords:o,lengths:s}=e,i=[];let a=0;for(const e of s){const t=[];for(let r=0;r<e;r++){const e=[];for(let t=0;t<n;t++)e.push(o[a++]);t.push(e)}i.push(t)}return t?r?{rings:i,hasZ:t,hasM:r}:{rings:i,hasZ:t}:r?{rings:i,hasM:r}:{rings:i}}function k(e,t,r=t.hasZ,n=t.hasM){return function(e,t,r,n){const o=d(r,n),{lengths:s,coords:i}=e;let a=0;ae(e);for(const e of t){for(const t of e)for(let e=0;e<o;e++)i[a++]=t[e];s.push(e.length)}return e}(e,t.rings,r,n)}const V=[],L=[];function z(e,t,r,n,o){V[0]=e;const[s]=Q(L,V,t,r,n,o);return ue(V),ue(L),s}function Q(e,t,r,o,s,i){if(ue(e),!r){for(const r of t){const t=i?r.attributes[i]:void 0;e.push(new l.Om(null,r.attributes,null,t))}return e}switch(r){case"esriGeometryPoint":return function(e,t,r,n,o){const s=R(r,n);for(const{geometry:r,attributes:n}of t){const t=null!=r?s(new h.A,r):null;e.push(new l.Om(t,n,null,o?n[o]:void 0))}return e}(e,t,o,s,i);case"esriGeometryMultipoint":return function(e,t,r,n,o){const s=d(r,n);for(const{geometry:r,attributes:n}of t){const t=null!=r?O(new h.A,r,s):null;e.push(new l.Om(t,n,null,o?n[o]:void 0))}return e}(e,t,o,s,i);case"esriGeometryPolyline":return function(e,t,r,n,o){const s=d(r,n);for(const{geometry:r,attributes:n,centroid:i}of t){const t=null!=r?q(new h.A,r,s):null,a=null!=i?v(new h.A,i):null;e.push(new l.Om(t,n,a,o?n[o]:void 0))}return e}(e,t,o,s,i);case"esriGeometryPolygon":return function(e,t,r,n,o){for(const{geometry:s,centroid:i,attributes:a}of t){const t=null!=s?k(new h.A,s,r,n):null,u=o?a[o]:void 0;null!=i?e.push(new l.Om(t,a,S(new h.A,i),u)):e.push(new l.Om(t,a,null,u))}return e}(e,t,o,s,i);default:f().error("convertToFeatureSet:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${r}'`)),ue(e)}return e}function E(e,t,r,n){L[0]=e,B(V,L,t,r,n);const o=V[0];return ue(V),ue(L),o}function J(e,t,r){if(null==e)return null;const o=new h.A;return"hasZ"in e&&null==t&&(t=e.hasZ),"hasM"in e&&null==r&&(r=e.hasM),(0,u.fT)(e)?R(null!=t?t:null!=e.z,null!=r?r:null!=e.m)(o,e):(0,u.Bi)(e)?k(o,e,t,r):(0,u.Rg)(e)?q(o,e,d(t,r)):(0,u.U9)(e)?O(o,e,d(t,r)):void f().error("convertFromGeometry:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${e}'`))}function Y(e,t,r,o){const s=e&&("coords"in e?e:e.geometry);if(null==s)return null;switch(t){case"esriGeometryPoint":{let e=P;return r&&o?e=T:r?e=A:o&&(e=M),e(s)}case"esriGeometryMultipoint":return D(s,r,o);case"esriGeometryPolyline":return Z(s,r,o);case"esriGeometryPolygon":return j(s,r,o);default:return f().error("convertToGeometry:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${t}'`)),null}}function B(e,t,r,o,s){if(ue(e),null==r)return function(e,t){for(const r of t)e.push({attributes:r.attributes});return e}(e,t);switch(r){case"esriGeometryPoint":return function(e,t,r,n){let o=P;r&&n?o=T:r?o=A:n&&(o=M);for(const r of t){const{geometry:t,attributes:n}=r,s=null!=t?o(t):null;e.push({attributes:n,geometry:s})}return e}(e,t,o,s);case"esriGeometryMultipoint":return function(e,t,r,n){for(const{geometry:o,attributes:s}of t)e.push({attributes:s,geometry:null!=o?D(o,r,n):null});return e}(e,t,o,s);case"esriGeometryPolyline":return function(e,t,r,n){for(const{geometry:o,attributes:s}of t)e.push({attributes:s,geometry:null!=o?Z(o,r,n):null});return e}(e,t,o,s);case"esriGeometryPolygon":return function(e,t,r,n){for(const{geometry:o,attributes:s,centroid:i}of t){const t=null!=o?j(o,r,n):null;if(null!=i){const r=P(i);e.push({attributes:s,centroid:r,geometry:t})}else e.push({attributes:s,geometry:t})}return e}(e,t,o,s);default:f().error("convertToFeatureSet:unknown-geometry",new n.A(`Unable to parse unknown geometry type '${r}'`))}return e}function U(e){const{objectIdFieldName:t,spatialReference:r,transform:n,fields:o,hasM:s,hasZ:i,features:a,geometryType:u,exceededTransferLimit:l,uniqueIdField:c,queryGeometry:h,queryGeometryType:d}=e,f={features:B([],a,u,i,s),fields:o,geometryType:u,objectIdFieldName:t,spatialReference:r,uniqueIdField:c,queryGeometry:Y(h,d,!1,!1)};return n&&(f.transform=n),l&&(f.exceededTransferLimit=l),s&&(f.hasM=s),i&&(f.hasZ=i),f}function X(e,t){const r=new c.A,{hasM:o,hasZ:s,features:i,objectIdFieldName:a,spatialReference:u,geometryType:l,exceededTransferLimit:h,transform:d,fields:m}=e;return m&&(r.fields=m),r.geometryType=l??null,r.objectIdFieldName=a??t??null,r.spatialReference=u??null,r.objectIdFieldName?(i&&Q(r.features,i,l,s,o,r.objectIdFieldName),h&&(r.exceededTransferLimit=h),o&&(r.hasM=o),s&&(r.hasZ=s),d&&(r.transform=d),r):(f().error(new n.A("optimized-features:invalid-objectIdFieldName","objectIdFieldName is missing")),r)}function $(e){const{transform:t,features:r,hasM:n,hasZ:o}=e;if(!t)return e;for(const e of r)null!=e.geometry&&ne(e.geometry,e.geometry,n,o,t),null!=e.centroid&&ne(e.centroid,e.centroid,n,o,t);return e.transform=null,e}function W(e,t){const{geometryType:r,features:n,hasM:o,hasZ:s}=t;if(!e)return t;for(let t=0;t<n.length;t++){const i=n[t],a=i.weakClone();a.geometry=new h.A,H(a.geometry,i.geometry,o,s,r,e),i.centroid&&(a.centroid=new h.A,H(a.centroid,i.centroid,o,s,"esriGeometryPoint",e)),n[t]=a}return t.transform=e,t}function H(e,t,r,n,o,s,i=r,a=n){if(ae(e),!t?.coords.length)return null;const u=m[o],{coords:l,lengths:c}=t,h=d(r,n),f=d(r&&i,n&&a),y=_(r,n,i,a);if(!c.length)return y(e.coords,l,0,0,w(s,l[0]),F(s,l[1])),ae(e,h,0),e;let p,g,b,I,x=0,P=0,S=P;for(const t of c){if(t<u)continue;let r=0;P=S,b=p=w(s,l[x]),I=g=F(s,l[x+1]),y(e.coords,l,P,x,b,I),r++,x+=h,P+=f;for(let n=1;n<t;n++,x+=h)b=w(s,l[x]),I=F(s,l[x+1]),b===p&&I===g||(y(e.coords,l,P,x,b-p,I-g),P+=f,r++,p=b,g=I);r>=u&&(e.lengths.push(r),S=P)}return ue(e.coords,S),e.coords.length?e:null}function K(e,t,r,n,o,s,i=r,a=n){if(ae(e),!t?.coords.length)return null;const u=m[o],{coords:l,lengths:c}=t,h=d(r,n),f=d(r&&i,n&&a),y=_(r,n,i,a);if(!c.length)return y(e.coords,l,0,0,l[0],l[1]),ae(e,h,0),e;let p=0;const g=s*s;for(const t of c){if(t<u){p+=t*h;continue}const r=e.coords.length/f,n=p,o=p+(t-1)*h;y(e.coords,l,e.coords.length,n,l[n],l[n+1]),te(e.coords,l,h,g,y,n,o),y(e.coords,l,e.coords.length,o,l[o],l[o+1]);const s=e.coords.length/f-r;s>=u?e.lengths.push(s):ue(e.coords,r*f),p+=t*h}return e.coords.length?e:null}function ee(e,t,r,n){const o=e[t],s=e[t+1],i=e[r],a=e[r+1],u=e[n],l=e[n+1];let c=i,h=a,d=u-c,f=l-h;if(0!==d||0!==f){const e=((o-c)*d+(s-h)*f)/(d*d+f*f);e>1?(c=u,h=l):e>0&&(c+=d*e,h+=f*e)}return d=o-c,f=s-h,d*d+f*f}function te(e,t,r,n,o,s,i){let a,u=n,l=0;for(let e=s+r;e<i;e+=r)a=ee(t,e,s,i),a>u&&(l=e,u=a);u>n&&(l-s>r&&te(e,t,r,n,o,s,l),o(e,t,e.length,l,t[l],t[l+1]),i-l>r&&te(e,t,r,n,o,l,i))}function re(e,t,r,n){if(!t?.coords?.length)return null;const o=d(r,n);let s=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;if(t&&t.coords){const e=t.coords;for(let t=0;t<e.length;t+=o){const r=e[t],n=e[t+1];s=Math.min(s,r),l=Math.max(l,r),u=Math.min(u,n),c=Math.max(c,n)}}return(0,i.is)(e)?(0,i.BI)(e,s,u,l,c):(0,a.fA)(s,u,l,c,e),e}function ne(e,t,r,n,o){const{coords:i,lengths:a}=t,u=d(r,n);if(!i.length)return e!==t&&ae(e),e;(0,s.Lw)(o);const{originPosition:l,scale:c,translate:h}=o,f=le;f.originPosition=l;const m=f.scale;m[0]=c[0]??1,m[1]=-(c[1]??1),m[2]=c[2]??1,m[3]=c[3]??1;const y=f.translate;if(y[0]=h[0]??0,y[1]=h[1]??0,y[2]=h[2]??0,y[3]=h[3]??0,!a.length){for(let t=0;t<u;++t)e.coords[t]=I(f,i[t],t);return e!==t&&ae(e,u,0),e}let p=0;for(let t=0;t<a.length;t++){const r=a[t];e.lengths[t]=r;for(let t=0;t<u;++t)e.coords[p+t]=I(f,i[p+t],t);let n=e.coords[p],o=e.coords[p+1];p+=u;for(let t=1;t<r;t++,p+=u){n+=i[p]*m[0],o+=i[p+1]*m[1],e.coords[p]=n,e.coords[p+1]=o;for(let t=2;t<u;++t)e.coords[p+t]=I(f,i[p+t],t)}}return e!==t&&ae(e,i.length,a.length),e}function oe(e,t,r,n,o,s){if(ae(e),e.lengths.push(...t.lengths),r===o&&n===s)for(let r=0;r<t.coords.length;r++)e.coords.push(t.coords[r]);else{const i=d(r,n),a=_(r,n,o,s),u=t.coords;for(let t=0;t<u.length;t+=i)a(e.coords,u,e.coords.length,t,u[t],u[t+1])}return e}function se(e,t,r,n){let o=0,s=e[n*t],i=e[n*(t+1)];for(let a=1;a<r;a++){const r=s+e[n*(t+a)],u=i+e[n*(t+a)+1],l=(r-s)*(u+i);s=r,i=u,o+=l}return.5*o}function ie(e,t){const{coords:r,lengths:n}=e;let o=0,s=0;for(let e=0;e<n.length;e++){const i=n[e];s+=se(r,o,i,t),o+=i}return Math.abs(s)}function ae(e,t=0,r=0){ue(e.lengths,r),ue(e.coords,t)}function ue(e,t=0){e.length!==t&&(e.length=t)}const le={originPosition:"lowerLeft",scale:[1,1,1,1],translate:[0,0,0,0]}},93622:(e,t,r)=>{r.d(t,{A:()=>P});var n=r(90237),o=r(69622),s=r(49186),i=r(44208),a=r(74887),u=r(84952),l=r(10107),c=(r(53966),r(87811),r(40608)),h=r(21325),d=r(20557),f=r(27733),m=r(2272),y=r(20615),p=(r(59456),r(80893)),g=r(61956),b=r(5443),_=r(78286),w=r(99199),F=r(71575),I=r(22671);let x=class extends o.A{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.queryAttachmentsSupported=!1,this.sourceSpatialReference=null,this.url=null}get parsedUrl(){return(0,u.An)(this.url)}async execute(e,t){const r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){const r=this._normalizeQuery(e),n=null!=e.outStatistics?.[0],o=(0,i.A)("featurelayer-pbf-statistics"),s=!n||o;let a;if(this.pbfSupported&&s)try{a=await(0,F.S)(this.url,r,t)}catch(e){if("query:parsing-pbf"!==e.name)throw e;this.pbfSupported=!1}return this.pbfSupported&&s||(a=await(0,w.e)(this.url,r,t)),this._normalizeFields(a.fields),a}async featureSetFromJSON(e,t,n){if(!this._queryIs3DObjectFormat(e)||null==this.infoFor3D||!t.features)return I.A.fromJSON(t);const{meshFeatureSetFromJSON:o}=await(0,a.qr)(Promise.all([r.e(3030),r.e(1535),r.e(1215)]).then(r.bind(r,40050)),n);return o(e,this.infoFor3D,t)}executeForCount(e,t){return(0,y.I)(this.url,this._normalizeQuery(e),t)}executeForExtent(e,t){return async function(e,t,r){const n=(0,m.Dl)(e),o=await(0,p.Jf)(n,g.A.from(t),{...r}),s=o.data.extent;return!s||isNaN(s.xmin)||isNaN(s.ymin)||isNaN(s.xmax)||isNaN(s.ymax)?{count:o.data.count,extent:null}:{count:o.data.count,extent:b.A.fromJSON(s)}}(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return(0,_.V)(this.url,this._normalizeQuery(e),t)}async executeRelationshipQuery(e,t){const[{default:n},{executeRelationshipQuery:o}]=await(0,a.qr)(Promise.all([Promise.resolve().then(r.bind(r,26591)),r.e(5257).then(r.bind(r,15257))]),t);return e=n.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeRelationshipQueryForCount(e,t){const[{default:n},{executeRelationshipQueryForCount:o}]=await(0,a.qr)(Promise.all([Promise.resolve().then(r.bind(r,26591)),r.e(5257).then(r.bind(r,15257))]),t);return e=n.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeAttachmentQuery(e,t){const{executeAttachmentQuery:n,fetchAttachments:o,processAttachmentQueryResult:s}=await(0,a.qr)(r.e(5771).then(r.bind(r,65771)),t),i=(0,m.Dl)(this.url);return s(i,await(this.queryAttachmentsSupported?n(i,e,t):o(i,e,t)))}async executeTopFeaturesQuery(e,t){const{executeTopFeaturesQuery:n}=await(0,a.qr)(r.e(1273).then(r.bind(r,11273)),t);return n(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){const{executeForTopIds:n}=await(0,a.qr)(r.e(1277).then(r.bind(r,21277)),t);return n(this.parsedUrl,e,t)}async executeForTopExtents(e,t){const{executeForTopExtents:n}=await(0,a.qr)(r.e(8018).then(r.bind(r,8018)),t);return n(this.parsedUrl,e,t)}async executeForTopCount(e,t){const{executeForTopCount:n}=await(0,a.qr)(r.e(980).then(r.bind(r,10980)),t);return n(this.parsedUrl,e,t)}_normalizeQuery(e){let t=g.A.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource?f.L.from(e.dynamicDataSource):this.dynamicDataSource);const{infoFor3D:r}=this;if(null!=r&&this._queryIs3DObjectFormat(e)){t=t===e?t.clone():t,t.formatOf3DObjects=null;const{supportedFormats:n,queryFormats:o}=r,i=(0,d.R_)("model/gltf-binary",n)??(0,d.E1)("glb",n),a=(0,d.R_)("model/gltf+json",n)??(0,d.E1)("gltf",n);for(const e of o){if(e===i){t.formatOf3DObjects=e;break}e!==a||t.formatOf3DObjects||(t.formatOf3DObjects=e)}if(!t.formatOf3DObjects)throw new s.A("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(t.outSpatialReference&&!(0,h.aI)(t.outSpatialReference,this.sourceSpatialReference))throw new s.A("query:unsupported-out-spatial-reference","3D object feature services do not support projection of geometries");if(null==t.outFields||!t.outFields.includes("*")){t=t===e?t.clone():t,null==t.outFields&&(t.outFields=[]);const{originX:n,originY:o,originZ:s,translationX:i,translationY:a,translationZ:u,scaleX:l,scaleY:c,scaleZ:h,rotationX:d,rotationY:f,rotationZ:m,rotationDeg:y}=r.transformFieldRoles;t.outFields.push(n,o,s,i,a,u,l,c,h,d,f,m,y)}}return t}_normalizeFields(e){if(null!=this.fieldsIndex&&null!=e)for(const t of e){const e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryIs3DObjectFormat(e){return null!=this.infoFor3D&&!0===e.returnGeometry&&"xyFootprint"!==e.multipatchOption&&!e.outStatistics}};(0,n._)([(0,l.MZ)({type:f.L})],x.prototype,"dynamicDataSource",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"fieldsIndex",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"gdbVersion",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"infoFor3D",void 0),(0,n._)([(0,l.MZ)({readOnly:!0})],x.prototype,"parsedUrl",null),(0,n._)([(0,l.MZ)()],x.prototype,"pbfSupported",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"queryAttachmentsSupported",void 0),(0,n._)([(0,l.MZ)()],x.prototype,"sourceSpatialReference",void 0),(0,n._)([(0,l.MZ)({type:String})],x.prototype,"url",void 0),x=(0,n._)([(0,c.$)("esri.layers.graphics.sources.support.QueryTask")],x);const P=x},20557:(e,t,r)=>{r.d(t,{E1:()=>a,Fm:()=>u,JZ:()=>m,R_:()=>i,fu:()=>o,oF:()=>s,rq:()=>l});const n=[["binary","application/octet-stream","bin",""]];function o(e,t){return null!=h(t.name,e?.supportedFormats??[])}function s(e,t){if(!e)return!1;const r=l(t,e.supportedFormats??[]);return null!=r&&e.editFormats.includes(r)}function i(e,t){return d(function(e,t){const r=e.toLowerCase();return c(t).find((e=>f(e)===r))}(e,t))}function a(e,t){return d(h(e,t))}function u(e,t){return f(function(e,t){return c(t).find((t=>d(t)===e))}(e,t))}function l(e,t){return a(e.name,t)??i(e.type,t)}function c(e){return[...n,...e]}function h(e,t){const r=e.toLowerCase();return c(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>r.endsWith(e)))))}function d(e){return e?.[0]}function f(e){return e?.[1].toLowerCase()}function m(e){return e.tables?.find((e=>"assetMaps"===e.role))}},20615:(e,t,r)=>{r.d(t,{I:()=>i});var n=r(2272),o=r(80893),s=r(61956);async function i(e,t,r){const i=(0,n.Dl)(e),{data:a}=await(0,o.gW)(i,s.A.from(t),r);return a.count}},78286:(e,t,r)=>{r.d(t,{V:()=>i});var n=r(2272),o=r(80893),s=r(61956);async function i(e,t,r){const i=(0,n.Dl)(e),{data:a}=await(0,o.Pk)(i,s.A.from(t),r);return a.objectIds}},99199:(e,t,r)=>{r.d(t,{e:()=>u,s:()=>a});var n=r(2272),o=r(80893),s=r(22671),i=r(61956);async function a(e,t,r){const n=await u(e,t,r);return s.A.fromJSON(n)}async function u(e,t,r){const s=(0,n.Dl)(e),a={...r},u=i.A.from(t),{data:l}=await(0,o.eW)(s,u,u.sourceSpatialReference,a);return l}},71575:(e,t,r)=>{r.d(t,{S:()=>p});var n=r(2272),o=r(97768),s=r(62815),i=r(90708);function a(e,t){return t}function u(e,t,r,n){switch(r){case 0:return d(e,t+n,0);case 1:return"lowerLeft"===e.originPosition?d(e,t+n,1):function({translate:e,scale:t},r,n){return e[n]-r*t[n]}(e,t+n,1)}}function l(e,t,r,n){return 2===r?d(e,t,2):u(e,t,r,n)}function c(e,t,r,n){return 2===r?0===t?0:d(e,t,3):u(e,t,r,n)}function h(e,t,r,n){return 3===r?0===t?0:d(e,t,3):l(e,t,r,n)}function d({translate:e,scale:t},r,n){return e[n]+r*t[n]}class f{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=a,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=(0,s.N)(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=t)for(const r of e.features)t(r.geometry)}createSpatialReference(){return{}}addField(e,t){const r=e.fields;(0,o.Lw)(r),r.push(t);const n=r.map((e=>e.name));this._attributesConstructor=function(){for(const e of n)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:r,queryGeometryType:n}=t,o=(0,i.Ch)(r.clone(),r,!1,!1,this._transform),s=(0,i.zv)(o,n,!1,!1);e.queryGeometryType=n,e.queryGeometry={...s}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const n=this._transform;switch(t=this._applyTransform(n,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const n=this._transform;return null!==this._mValueOffset&&0===e&&t>0&&!(t%this._mValueOffset)?0:this._applyTransform(n,e,t,r)}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const n=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(n)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const n=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=n}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?l:r?c:u}}var m=r(80893),y=(r(22671),r(61956));async function p(e,t,r){const o=(0,n.Dl)(e),s={...r},i=y.A.from(t),a=!i.quantizationParameters,{data:u}=await(0,m.IJ)(o,i,new f({sourceSpatialReference:i.sourceSpatialReference,applyTransform:a}),s);return u}}}]);
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import"../../../core/has.js";import"../../../core/Logger.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{m as a,z as n,g as i}from"../../../chunks/vec32.js";import o from"../../../geometry/Point.js";import{projectWithZConversion as s,initializeProjection as c,project as f}from"../../../geometry/projection.js";import{fromPoints as m,fromValues as p}from"../../../geometry/support/ray.js";import{k as l,i as y}from"../../../chunks/sphere.js";import{geographicToWebMercator as u,webMercatorToGeographic as x}from"../../../geometry/support/webMercatorUtils.js";import{limitZToGround as z}from"../core/coverageUtils.js";import w from"../core/ExposurePoint.js";import{transformPoints as g,updateElevation as h}from"./groundToImageUtils.js";import{getWebMercatorScalingFactor as d,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as j,scaleAndAddWithFactor as b,hasCameraOrientationLTP as P,computeHFOVAndVFOV as v,ltpToGeographic as M,projectiveTransform2 as O,scaleWithFactor as S,calculateRotationMatrix as F,transformMat3 as L,projectiveTransform as H,getPlaneLineIntersectionPoint as V}from"./utils.js";import{defaultImageSphereCenter as A}from"../../../widgets/PanoramicViewer/constants.js";import{isNumber as T}from"../../../widgets/support/dataUtils.js";import U from"../../../geometry/Polygon.js";import C from"../../../geometry/SpatialReference.js";function D(e,t){if(!e)return Promise.resolve([]);const r=t.feature;let a=r.attributes;return a instanceof w||(a=w.fromJSON(r),a&&(r.attributes=a)),E(e,t)}function E(e,t){const{attributes:r}=t.feature;if(r.isSpherical||360===r.horizontalFieldOfView){const{location:a,cameraOrientation:n,farDistance:i,cameraHeading:o,cameraHeight:s}=r;return G(e,a,i,[t.imageProperties.width,t.imageProperties.height],o,s,n)}return W(e,t)}async function G(e,t,a,n,i,s,c){let f=new o(t);
|
|
5
|
+
import"../../../geometry.js";import"../../../core/has.js";import"../../../core/Logger.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{m as a,z as n,g as i}from"../../../chunks/vec32.js";import o from"../../../geometry/Point.js";import{projectWithZConversion as s,initializeProjection as c,project as f}from"../../../geometry/projection.js";import{fromPoints as m,fromValues as p}from"../../../geometry/support/ray.js";import{k as l,i as y}from"../../../chunks/sphere.js";import{geographicToWebMercator as u,webMercatorToGeographic as x}from"../../../geometry/support/webMercatorUtils.js";import{limitZToGround as z}from"../core/coverageUtils.js";import w from"../core/ExposurePoint.js";import{transformPoints as g,updateElevation as h}from"./groundToImageUtils.js";import{getWebMercatorScalingFactor as d,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as j,scaleAndAddWithFactor as b,hasCameraOrientationLTP as P,computeHFOVAndVFOV as v,ltpToGeographic as M,projectiveTransform2 as O,scaleWithFactor as S,calculateRotationMatrix as F,transformMat3 as L,projectiveTransform as H,getPlaneLineIntersectionPoint as V}from"./utils.js";import{defaultImageSphereCenter as A}from"../../../widgets/PanoramicViewer/constants.js";import{isNumber as T}from"../../../widgets/support/dataUtils.js";import U from"../../../geometry/Polygon.js";import C from"../../../geometry/SpatialReference.js";function D(e,t){if(!e)return Promise.resolve([]);const r=t.feature;let a=r.attributes;return a instanceof w||(a=w.fromJSON(r),a&&(r.attributes=a)),E(e,t)}function E(e,t){const{attributes:r}=t.feature;if(r.isSpherical||360===r.horizontalFieldOfView){const{location:a,cameraOrientation:n,farDistance:i,cameraHeading:o,cameraHeight:s}=r;return G(e,a,i,[t.imageProperties.width,t.imageProperties.height],o,s,n)}return W(e,t)}async function G(e,t,a,n,i,s,c){let f=new o(t);f.spatialReference.isGeographic&&f.spatialReference.isWGS84&&4!==c?.type&&(f=u(f));const x=d(f),z=new Array,[w,g,h]=f.toArray(),P=l([w,g,h??0],a*x),v=A.toArray();for(const l of e){let e,t;if(T(l.heading)&&T(l.pitch))e=l.heading,t=l.pitch;else{const r=R({x:l.x,y:l.y},n[0],n[1]);e=r.heading,t=r.pitch}e=(e+i)%360;const a=m([v[0],v[1],v[2]],j(e,t)),c=p([w,g,h??0],a.direction),u=r();y(P,c,u);const d=(f.z??0)-s;if(u[2]<d){const e=Math.abs((f.z-d)/-a.direction[2])*x;b([f.x,f.y,f.z],a.direction,e,x,u)}else u[2]=d;z.push(new o(u,f.spatialReference))}return z}async function W(e,t){const{feature:r,footprintExtent:a,options:n}=t,{attributes:{cameraHeight:i,cameraOrientation:c,cameraPitch:f,cameraRoll:m,elevationSource:p,horizontalFieldOfView:l,location:y,verticalFieldOfView:z},elevationSample:w}=r,h=P(c),{vfov:R}=v(l,z,m??0);let j=new o(y),b=!1;h&&(j=new o(M(j,[c.latitude,c.longitude,c.ellipsoidRadius,c.squaredEccentricity]))),j.spatialReference.isWGS84&&(b=!0,j=u(j));const S=d(j),F=N(t,j,S),L=h?F.map((e=>x(new o(e)))):F,H=await g(L,t,!0).then((e=>e.map((e=>({x:e.x,y:e.y,z:1}))))),V=new Array;for(const u of e){const e={...u,z:1},r={...O(e,H,L),spatialReference:j.spatialReference},[c]=await g([h?x(new o(r)):new o(r)],t,!0);await Z(e,c,H,L,j,r,h,t);const m=await s(p||w?await k({cameraLocation:j,groundFootPrint:L,projectedPoint:r,webMercatorScalingFactor:S,vfov:R,shouldConvertToLatLong:b,isCameraOrientationLTP:h,imgPoint:e},t):new o(J(r,j,S,j.z-i,f,R,b)),a.spatialReference,n);V.push(m)}return V}async function k(e,t){const{cameraLocation:r,groundFootPrint:a,projectedPoint:n,webMercatorScalingFactor:i,vfov:s,shouldConvertToLatLong:f,isCameraOrientationLTP:m,imgPoint:p}=e,{cameraHeight:l,cameraPitch:y}=t.feature.attributes;await c(r.spatialReference,t.footprintExtent.spatialReference,null,t.options);let u=await I(a,t),z=0,w=r.z??0-l,d=0;for(;d<10;){const e=B(u,r,n);if(!e||!q([r.x,r.y,r.z],[e.x,e.y,e.z],[n.x,n.y,n.z]))return new o(J(n,r,i,w,y,s,f));const a=new o({x:e.x,y:e.y,z:e.z,spatialReference:r.spatialReference}),c=await g([m?x(a):a],t);if(z=Math.abs(p.x-c[0].x)+Math.abs(p.y-c[0].y),w=e.z,z<=1)return new o(J(n,r,i,w,y,s,f));d+=1;const{extent:l}=u,R=(l?.width??0)/10,j=(l?.height??0)/10;if(R<1||j<1)return new o(J(n,r,i,w,y,s,f));const{x:b,y:P}=e,v=await h(K(R,j).map((([e,t])=>new o({x:b+e,y:P+t,spatialReference:r.spatialReference}))),t,!1);v.push(v[0]),u=new U({rings:[v.map((e=>e.toArray()))],spatialReference:r.spatialReference})}return new o(J(n,r,i,w,y,s,f))}const q=(e,r,i)=>a(n(t(),r,e),n(t(),i,e))>0;function J(e,r,a,i,s,c,f){const m=Math.sqrt((e.z-r.z)**2+(Math.sqrt((e.x-r.x)**2+(e.y-r.y)**2)/a)**2)*a,p=S(n(t(),[e.x,e.y,e.z],[r.x,r.y,r.z]),1/m,1/a);if(e.z<i||s+c/2<90){const t=Math.abs((r.z-i)/-p[2])*a,n=b([r.x,r.y,r.z],p,t,a);e.x=n[0],e.y=n[1],e.z=n[2]}else e.z=i;return f?x(new o(e)).toJSON():e}function N(r,a,s){const{feature:c}=r,{attributes:f}=c,m=2*Math.tan(e(f.verticalFieldOfView)/2)*f.farDistance*s,p=2*Math.tan(e(f.horizontalFieldOfView)/2)*f.farDistance*s,l=F("HPR",[f.cameraHeading,f.cameraPitch,f.cameraRoll??0]),y=L([0,0,-1],l),u=b([a.x,a.y,a.z],y,f.farDistance*s,s),x=L([0,1,0],l),z=L([1,0,0],l),w=S(x,m/2,s),g=S(z,p/2,s),h=n(t(),w,g),d=i(t(),w,g);return[i(t(),u,h),i(t(),u,d),n(t(),u,h),n(t(),u,d)].map((e=>{const[t,r,n]=e;return new o({x:t,y:r,z:n,spatialReference:a.spatialReference})}))}async function I(e,t){const r=e[0].spatialReference.isWGS84?C.WebMercator:e[0].spatialReference,{cameraHeight:a,location:n,elevation:i}=t.feature.attributes,s="number"==typeof n.z&&"number"==typeof i?n.z-i:a,c=z(e.map((({x:e,y:t,z:r})=>[e,t,r])),s,n,d(n)),m=(await h(c.map((e=>new o(e,n.spatialReference))),t,!1)).map((e=>f(e,r)));return new U({hasZ:!0,rings:[m.map((e=>[e.x,e.y,e.z]))],spatialReference:r})}async function Z(e,t,r,a,n,i,s,c){let f=0;const m=8;for(let p=0;p<=m;p+=1){if(f=Math.abs(e.x-t.x)+Math.abs(e.y-t.y),f<=1)return;const[m,p,l,y]=K(f,f).map((([t,i])=>({...H({x:e.x+t,y:e.y+i,z:1},r[0],r[1],r[2],r[3],{x:a[0].x,y:a[0].y,z:a[0].z},{x:a[1].x,y:a[1].y,z:a[1].z},{x:a[2].x,y:a[2].y,z:a[2].z},{x:a[3].x,y:a[3].y,z:a[3].z}),spatialReference:n.spatialReference}))),[u,z,w,h]=await g(s?[x(new o(m)),x(new o(p)),x(new o(l)),x(new o(y))]:[new o(m),new o(p),new o(l),new o(y)],c,!0).then((e=>e.map((e=>({...e,z:0}))))),{x:d,y:R,z:j}=H(e,u,z,w,h,m,p,l,y);i.x=d,i.y=R,i.z=j,[t]=await g([s?x(new o(i)):new o(i)],c,!0)}}function B(e,t,r){const a={x:e.rings[0][0][0],y:e.rings[0][0][1],z:e.rings[0][0][2]},n={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},i={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},o={x:e.rings[0][2][0],y:e.rings[0][2][1],z:e.rings[0][2][2]},s=(o.z-i.z)*(n.y-a.y)-(o.y-i.y)*(n.z-a.z),c=-((o.z-i.z)*(n.x-a.x)-(n.z-a.z)*(o.x-i.x)),f=(o.y-i.y)*(n.x-a.x)-(n.y-a.y)*(o.x-i.x),m=-(s*a.x+c*a.y+f*a.z);return V(t.toJSON(),r,s,c,f,m)}const K=(e,t)=>[[-e,-t],[e,-t],[e,t],[-e,t]];export{D as transformPoints};
|
package/package.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,3):i(e,t,r,s)}function h(e,t,r,s){return 3===r?0===t?0:u(e,t,3):n(e,t,r,s)}function u({translate:e,scale:t},r,s){return e[s]+r*t[s]}function l({translate:e,scale:t},r,s){return e[s]-r*t[s]}class d{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=o,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const r=t(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=r)for(const t of e.features)r(t.geometry)}createSpatialReference(){return{}}addField(t,r){const s=t.fields;e(s),s.push(r);const o=s.map((e=>e.name));this._attributesConstructor=function(){for(const e of o)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:o,queryGeometryType:i}=t,n=r(o.clone(),o,!1,!1,this._transform),a=s(n,i,!1,!1);e.queryGeometryType=i,e.queryGeometry={...a}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform;switch(t=this._applyTransform(s,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null
|
|
5
|
+
import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,3):i(e,t,r,s)}function h(e,t,r,s){return 3===r?0===t?0:u(e,t,3):n(e,t,r,s)}function u({translate:e,scale:t},r,s){return e[s]+r*t[s]}function l({translate:e,scale:t},r,s){return e[s]-r*t[s]}class d{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=o,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const r=t(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=r)for(const t of e.features)r(t.geometry)}createSpatialReference(){return{}}addField(t,r){const s=t.fields;e(s),s.push(r);const o=s.map((e=>e.name));this._attributesConstructor=function(){for(const e of o)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:o,queryGeometryType:i}=t,n=r(o.clone(),o,!1,!1,this._transform),a=s(n,i,!1,!1);e.queryGeometryType=i,e.queryGeometry={...a}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform;switch(t=this._applyTransform(s,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null!==this._mValueOffset&&0===e&&t>0&&!(t%this._mValueOffset)?0:this._applyTransform(s,e,t,r)}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?n:r?a:i}}export{d as JSONFeatureSetParserContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import i from"../../core/Error.js";import{toPt as r}from"../../core/screenUtils.js";import{ensureClass as a}from"../../core/accessorSupport/ensureType.js";import{fetchMessageBundle as n}from"../../intl/messages.js";import{substitute as s}from"../../intl/substitute.js";import l from"../../renderers/support/AuthoringInfo.js";import o from"../../renderers/support/AuthoringInfoSizeStop.js";import t from"../../renderers/support/AuthoringInfoVisualVariable.js";import{setLabelsForClassBreaks as m}from"../../renderers/support/utils.js";import u from"../../renderers/visualVariables/SizeVariable.js";import{castSizeFromStringOrNumber as p}from"../../renderers/visualVariables/support/castSizeVariable.js";import d from"../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{TransformationType as c}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import y from"../heuristics/ageUnit.js";import f from"../heuristics/outline.js";import z from"../heuristics/referenceSize.js";import b from"../heuristics/sizeRange.js";import{createPrimitiveOverrides as v,updateReferenceSizeSymbol as w,createReferenceSizeSymbol as h,getReferenceSizeStops as g}from"./support/referenceSizeUtils.js";import{getSummaryStatistics as S,errorCallback as T,createColors as x,getClassBreaks as V,formatDate as E,updateAgeRendererAuthoringInfoVV as j,verifyBasicFieldValidity as O,getSizeRangeForAxis as I,createSymbol as k,getSymbolOutlineFromScheme as q,getSymbolSizeFromScheme as B,getBasemapInfo as F,getDataRange as R}from"./support/utils.js";import{getAgeExpressions as U,verifyDates as D,supportedAgeUnits as M}from"../statistics/support/ageUtils.js";import{verifyBinningParams as G}from"../support/binningUtils.js";import{getFieldsList as A,getNormalizationType as C,isAnyDateField as L}from"../support/utils.js";import{binningCapableLayerTypes as P,featureCapableLayerTypes as W,createLayerAdapter as $,getLayerTypeLabels as H}from"../support/adapters/support/layerUtils.js";import{cloneScheme as _,getSchemes as J}from"../symbology/size.js";import{getColorFromSymbol as K}from"../../symbols/support/utils.js";const N=2**53-1;async function Q(e){if(!(e&&e.layer&&(e.field||e.valueExpression||e.sqlExpression)))throw new i("size-visual-variable:missing-parameters","'layer' and 'field', 'valueExpression' or 'sqlExpression' parameters are required");if(e.valueExpression&&!e.sqlExpression&&!e.view)throw new i("size-visual-variable:missing-parameters","View is required when 'valueExpression' is specified");if("reference-size"===e.theme&&!e.view&&!e.field)throw new i("size-visual-variable:missing-parameters","'view' and 'field' are required when 'theme' is 'reference-size'");if("reference-size"===e.theme&&e.valueExpression)throw new i("size-visual-variable:missing-parameters","'valueExpression' is not supported when 'theme' is 'reference-size'");e.forBinning&&G(e,"size-visual-variable");const r={...e},a=e.forBinning?P:W,n=$(r.layer,a,e.forBinning);if(!n)throw new i("size-visual-variable:invalid-parameters","'layer' must be one of these types: "+H(a).join(", "));r.layer=n,"height"===r.axis&&(r.sizeOptimizationEnabled=!1);const s=null!=r.signal?{signal:r.signal}:null;await n.load(s);const l=n.geometryType;if("mesh"===l)throw new i("size-visual-variable:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(r.worldScale){if("polyline"===l||"polygon"===l)throw new i("size-visual-variable:not-supported","'worldScale' sizing is not supported for polyline and polygon layers");if(!r.view||"3d"!==r.view.type)throw new i("size-visual-variable:invalid-parameters","'view' parameter should be an instance of SceneView when 'worldScale' parameter is true")}if("reference-size"===r.theme&&!e.forBinning&&"polygon"!==l)throw new i("size-visual-variable:invalid-parameters","Reference size is only supported for polygon layers");const o=await A({field:r.field,normalizationField:r.normalizationField,valueExpression:r.valueExpression}),t=O(n,o,"size-visual-variable:invalid-parameters");if(t)throw t;return await Y(r),r}async function X(e){if(!(e&&e.layer&&(e.field||e.valueExpression||e.sqlExpression)))throw new i("size-continuous-renderer:missing-parameters","'layer' and 'field', 'valueExpression' or 'sqlExpression' parameters are required");if(e.valueExpression&&!e.sqlExpression&&!e.view)throw new i("size-continuous-renderer:missing-parameters","View is required when 'valueExpression' is specified");e.forBinning&&G(e,"size-continuous-renderer");const r={...e};r.symbolType=r.symbolType||"2d",r.defaultSymbolEnabled??=!0;const a=e.forBinning?P:W,n=$(r.layer,a,e.forBinning);if(!n)throw new i("size-continuous-renderer:invalid-parameters","'layer' must be one of these types: "+H(a).join(", "));r.layer=n;const s=null!=r.signal?{signal:r.signal}:null;await n.load(s);const l=n.geometryType,o=r.symbolType.includes("3d");if(r.outlineOptimizationEnabled="reference-size"!==r.theme&&"polygon"===l&&r.outlineOptimizationEnabled,"mesh"===l)throw new i("size-continuous-renderer:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(o&&("polyline"===l||"polygon"===l))throw new i("size-continuous-renderer:not-supported","3d symbols are not supported for polyline and polygon layers");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new i("size-continuous-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or 3d-volumetric-uniform");if("reference-size"===r.theme&&!e.forBinning&&"polygon"!==l)throw new i("size-continuous-renderer:invalid-parameters","Reference size is only supported for polygon layers");const t=await A({field:r.field,normalizationField:r.normalizationField,valueExpression:r.valueExpression}),m=O(n,t,"size-continuous-renderer:invalid-parameters");if(m)throw m;return await Y(r),r}async function Y(e){const i=e.layer;if(("polygon"===i.geometryType||e.forBinning)&&e.view&&e.field&&!e.valueExpression&&(!e.theme||"reference-size"===e.theme)){try{e.referenceSizeResult=e.referenceSizeResult??await z({layer:i,view:e.view,forBinning:e.forBinning,signal:e.signal})}catch{}!e.theme&&e.referenceSizeResult?.isGrid&&(e.theme="reference-size"),e.referenceSizeOptions?.symbolStyle||(e.referenceSizeOptions?e.referenceSizeOptions.symbolStyle="circle":e.referenceSizeOptions={symbolStyle:"circle"})}}function Z(e){if(!e||!(e.layer&&e.view&&e.sizeStops))throw new i("update-renderer-with-reference-size:missing-parameters","'layer', 'view and 'sizeStops' parameters are required");const r=e.layer;let a=e.renderer;if(!a)if(e.forBinning){if(!("featureReduction"in r&&r.featureReduction&&"renderer"in r.featureReduction&&r.featureReduction.renderer)||"class-breaks"!==r.featureReduction.renderer.type&&"unique-value"!==r.featureReduction.renderer.type)throw new i("update-renderer-with-reference-size:invalid-parameters","Feature reduction renderer is not supported");a=r.featureReduction.renderer}else{if(!("renderer"in r)||!r.renderer||"class-breaks"!==r.renderer.type&&"unique-value"!==r.renderer.type)throw new i("update-renderer-with-reference-size:invalid-parameters","Renderer is not supported");a=r.renderer}const n=a.authoringInfo;if(!n||!n?.visualVariables?.some((e=>"reference-size"===e.theme)))throw new i("update-renderer-with-reference-size:invalid-parameters","'renderer.authoringInfo.visualVariables' should have an authoringInfoVisualVariable with 'theme' set to 'reference-size'");return{...e,renderer:a}}async function ee(e){if(!e||!e.layer||!e.field&&!e.valueExpression)throw new i("size-class-breaks-renderer:missing-parameters","'layer' and 'field' or 'valueExpression' parameters are required");if(e.valueExpression&&!e.view)throw new i("size-class-breaks-renderer:missing-parameters","View is required when 'valueExpression' is specified");e.forBinning&&G(e,"size-class-breaks-renderer");const r={...e};r.symbolType=r.symbolType||"2d",r.defaultSymbolEnabled??=!0,r.classificationMethod??="equal-interval",r.normalizationType=C(r);const a=e.forBinning?P:W,n=$(r.layer,a,e.forBinning);if(!n)throw new i("size-class-breaks-renderer:invalid-parameters","'layer' must be one of these types: "+H(a).join(", "));r.layer=n;if(!(null!=r.minValue&&null!=r.maxValue)&&(null!=r.minValue||null!=r.maxValue))throw new i("size-class-breaks-renderer:missing-parameters","Both 'minValue' and 'maxValue' are required when specifying custom data range");const s=null!=r.signal?{signal:r.signal}:null;await n.load(s);const l=n.geometryType,o=r.symbolType.includes("3d");if(r.outlineOptimizationEnabled="polygon"===l&&r.outlineOptimizationEnabled,"mesh"===l)throw new i("size-class-breaks-renderer:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(o&&("polyline"===l||"polygon"===l))throw new i("size-class-breaks-renderer:not-supported","3d symbols are not supported for polyline and polygon layers");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new i("size-class-breaks-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or 3d-volumetric-uniform");const t=await A({field:r.field,normalizationField:r.normalizationField}),m=O(n,t,"size-class-breaks-renderer:invalid-parameters");if(m)throw m;return r}function ie(e){const i={...e};delete i.basemap,delete i.sizeScheme,delete i.legendOptions,delete i.symbolType,delete i.defaultSymbolEnabled;const r=i;return r.analyzeData=!(null!=i.minValue&&null!=i.maxValue),r}function re(e){const i={...e},r=!!i.symbolType?.includes("3d-volumetric"),a=i;return a.worldScale=r,r&&(a.axis="3d-volumetric-uniform"===i.symbolType?"all":"height"),delete i.symbolType,delete i.defaultSymbolEnabled,a}async function ae(e){if(!(e&&e.layer&&e.view&&e.startTime&&e.endTime))throw new i("size-age-renderer:missing-parameters","'layer', 'view', 'startTime', 'endTime' parameters are required");const r={...e};r.symbolType??="2d",r.defaultSymbolEnabled??=!0;const a=$(r.layer,W);if(!a)throw new i("size-age-renderer:invalid-parameters","'layer' must be one of these types: "+H(W).join(", "));r.layer=a;const n=null!=r.signal?{signal:r.signal}:null;await a.load(n);const s=a.geometryType,l=r.symbolType.includes("3d");if(r.outlineOptimizationEnabled="polygon"===s&&r.outlineOptimizationEnabled,"mesh"===s)throw new i("size-age-renderer:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(l&&("polyline"===s||"polygon"===s))throw new i("size-age-renderer:not-supported","3d symbols are not supported for polyline and polygon layers");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new i("size-age-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or 3d-volumetric-uniform");const o=D(a,r.startTime,r.endTime,"size-age-renderer:invalid-parameters");if(o)throw o;if(r.unit&&!M.includes(r.unit))throw new i("size-age-renderer:invalid-unit",`Supported units are: ${M.join(", ")}`);return r}async function ne(e){let i=e.sizeScheme,r=null,a=null;const n=await F(e.basemap,e.view);if(r=null!=n.basemapId?n.basemapId:null,a=null!=n.basemapTheme?n.basemapTheme:null,i)return{scheme:_(i),basemapId:r,basemapTheme:a};const s=J({basemapTheme:a,geometryType:e.geometryType,worldScale:e.worldScale,view:e.view});return s&&(i=s.primaryScheme,r=s.basemapId,a=s.basemapTheme),{scheme:i,basemapId:r,basemapTheme:a}}function se(e,i){switch(i){case"point":case"multipoint":{const i=e;return[p(i.minSize),p(i.maxSize)]}case"polyline":{const i=e;return[p(i.minWidth),p(i.maxWidth)]}case"polygon":{const i=e;return[p(i.marker.minSize),p(i.marker.maxSize)]}}}function le(e,i){e.transformationType===c.ClampedLinear&&"below"===i&&e.flipSizes()}async function oe(e,i,r,a,n){return"reference-size"===r&&i?[0,i.size]:e?[e.minSize,e.maxSize]:se(a,n)}function te(e,i){if("reference-size"===i.theme&&null!=e.min&&null!=e.max&&null!=e.avg&&null!=e.stddev){const i=100,r=0,a=0,n=1,s=e.avg,l=e.min,o=e.max,t=e.stddev,m=0!==s?t/s:0,u=l>a&&l<n&&o<2*n&&m<.5,p=l>r&&l<i&&o<2*i&&m<.5;return{minDataValue:u?a:p?r:l,maxDataValue:u?n:p?i:s+2*t,defaultValuesUsed:!1}}const{theme:r,field:a}=i,n=i.layer,s=a&&!("function"==typeof a)?n.getField(a):null,l=L(s);return R(e,r,l,"above"===r||"below"===r)}async function me(e,r,n,s){const{theme:m,field:p,normalizationField:c,minValue:y,maxValue:f,axis:z}=e,b=e.layer.geometryType,v=await ne({basemap:e.basemap,geometryType:b,sizeScheme:e.sizeScheme,worldScale:e.worldScale,view:e.view}),w=v.scheme;if(!w)throw new i("size-visual-variable:insufficient-info","Unable to find size scheme");const h=await oe(n,s,m,w,b),{minDataValue:S,maxDataValue:T,defaultValuesUsed:x}=te(r,e),V=[],E="height"===z,j=E?z:void 0,O=h[0];let k=h[1];if(E&&"number"==typeof O&&"number"==typeof k){const e=I({minSize:O,maxSize:k},j);V.push(new u({axis:"width-and-depth",minSize:e.minSize})),k=e.maxSize}const q=new u({field:p??void 0,valueExpression:e.valueExpression,valueExpressionTitle:e.valueExpressionTitle,valueUnit:"unknown",normalizationField:c,axis:j,minSize:O,maxSize:k,minDataValue:S,maxDataValue:T,legendOptions:a(d,e.legendOptions)});le(q,m),V.unshift(q);const B=new t("reference-size"===m?{type:"size",field:e.field,normalizationField:e.normalizationField,sizeStops:g(q).map((({label:e,size:i,value:r})=>new o({label:e,size:i,value:r}))),theme:m,referenceSizeScale:s?.isGrid||e.sizeOptimizationEnabled?e?.view?.scale:void 0,referenceSizeSymbolStyle:e.referenceSizeOptions?.symbolStyle,minSliderValue:null!=y?y:r.min,maxSliderValue:null!=f?f:r.max}:{type:"size",theme:m,minSliderValue:null!=y?y:r.min,maxSliderValue:null!=f?f:r.max}),F=new l({visualVariables:[B]});return{basemapId:v.basemapId,basemapTheme:v.basemapTheme,visualVariables:V,statistics:r,isGrid:s?.isGrid,defaultValuesUsed:x,sizeScheme:_(w),authoringInfo:F}}async function ue(i,r,a,s,l){const o=await n("esri/smartMapping/t9n/smartMapping"),t=l.layer,m=l.field,u=t.geometryType,p=l.defaultSymbolEnabled,d=_(i.sizeScheme),c="polygon"===u,y=c?d.marker:d,f=c?d.background:null,z=c?"point":u,b=r?.opacity,w=i.isGrid,S="reference-size"===l.theme,T=S?[]:i.visualVariables.map((e=>e.clone()));r?.visualVariables?.length&&T.push(...r.visualVariables.map((e=>e.clone())));const x=S?v({view:l.view,field:m,normalizationField:s,sizeStops:g(i.visualVariables[0]),sizeByScaleEnabled:w||!!l.sizeOptimizationEnabled}):null;return{renderer:new e({backgroundFillSymbol:!w&&f&&k(u,{type:l.symbolType,color:f.color,outline:q(f,u,b)}),classBreakInfos:[{minValue:-N,maxValue:N,symbol:x?h({type:l.referenceSizeOptions?.symbolStyle||"circle",color:y.color,primitiveOverrides:x}):k(z,{type:l.symbolType,color:y.color,size:B(y,z),outline:q(y,z,b)})}],defaultLabel:p?o.other:null,defaultSymbol:p&&!S?k(z,{type:l.symbolType,color:y.noDataColor,size:B(y,z,!0),outline:q(y,z,b)}):null,field:m,normalizationField:s,normalizationType:a,valueExpression:l.valueExpression,valueExpressionTitle:l.valueExpressionTitle,visualVariables:T,authoringInfo:i.authoringInfo?.clone()}),visualVariables:i.visualVariables.map((e=>e.clone())),statistics:i.statistics,defaultValuesUsed:i.defaultValuesUsed,isGrid:w,sizeScheme:_(i.sizeScheme),basemapId:i.basemapId,basemapTheme:i.basemapTheme}}function pe(e,i){const a=r(e.minSize),n=(r(e.maxSize)-a)/(i>=4?i-1:i),s=[];for(let r=0;r<i;r++)s.push(a+n*r);return s}async function de(i,r){const a=await n("esri/smartMapping/t9n/smartMapping"),s=i.layer,o=i.defaultSymbolEnabled,t=s.geometryType,u="polygon"===t,p=i.symbolType?.includes("3d-volumetric"),d=await ne({basemap:i.basemap,geometryType:t,sizeScheme:i.sizeScheme,worldScale:p,view:i.view}),c=d.scheme,{result:y,outlineResult:f}=r,z=y?.classBreakInfos??[],b=i.classificationMethod,v=i.normalizationType,w=u?c.marker:c,h=u?c.background:null,g=u?"point":t,S=se(w,g),T=p?I({minSize:S[0],maxSize:S[1]},"height"):null,x=pe({minSize:S[0],maxSize:T?T.maxSize:S[1]},z.length),V=f?.opacity,E=new e({backgroundFillSymbol:h&&k(t,{type:i.symbolType,color:h.color,outline:q(h,t,V)}),classBreakInfos:z.map(((e,r)=>({minValue:e.minValue,maxValue:e.maxValue,symbol:k(g,{type:i.symbolType,color:w.color,size:x[r],widthAndDepth:T?.minSize,outline:q(w,g,V)}),label:e.label}))),defaultLabel:o?a.other:null,defaultSymbol:o?k(g,{type:i.symbolType,color:w.noDataColor,size:B(w,g,!0),widthAndDepth:T?.minSize,outline:q(w,g,V)}):null,field:i.field,valueExpression:i.valueExpression,valueExpressionTitle:i.valueExpressionTitle,normalizationType:v,normalizationField:i.normalizationField,normalizationTotal:"percent-of-total"===v?y?.normalizationTotal:void 0,legendOptions:i.legendOptions,authoringInfo:new l({type:"class-breaks-size",classificationMethod:b,standardDeviationInterval:i.standardDeviationInterval})});return"standard-deviation"!==b&&m({classBreakInfos:E.classBreakInfos,classificationMethod:b,normalizationType:v,round:!0}),f?.visualVariables?.length&&(E.visualVariables=f.visualVariables.map((e=>e.clone()))),{renderer:E,sizeScheme:_(c),classBreaksResult:y,defaultValuesUsed:!!r.defaultValuesUsed,basemapId:d.basemapId,basemapTheme:d.basemapTheme}}async function ce(e){const i=await Q(e),{view:r,field:a,valueExpression:n,minValue:s,maxValue:l,layer:o,normalizationField:t,signal:m,statistics:u}=i,p=t?"field":void 0,[d,c]=await Promise.all([u??S({layer:o,field:a,valueExpression:n,sqlExpression:i.sqlExpression,sqlWhere:i.sqlWhere,normalizationType:p,normalizationField:t,minValue:s,maxValue:l,view:r,signal:m}),i.sizeOptimizationEnabled?b({view:r,layer:o,signal:m}).catch(T):null]);return me(i,d,c,i.referenceSizeResult)}async function ye(e){const i=await X(e),r={layer:i.layer,view:i.view,signal:i.signal},[a,n]=await Promise.all([ce(re(i)),i.outlineOptimizationEnabled?f(r).catch(T):null]),s=i.normalizationField;return ue(a,n,s?"field":void 0,s,i)}async function fe(e){const{forBinning:r,layer:a,referenceSizeOptions:n,renderer:s,sizeScheme:t,sizeStops:m,typeScheme:u,view:p}=Z(e),{isGrid:d}=await z({view:p,layer:a,forBinning:r}),c=s.clone();c.authoringInfo??=new l;const y=c.authoringInfo.visualVariables.find((e=>"reference-size"===e.theme)),f=e.field??y?.field,b=e.normalizationField??y?.normalizationField;if(!f)throw new i("update-renderer-with-reference-size:invalid-parameters","'field' parameter or authoring info with 'field' is required.");const g=v({view:p,field:f,normalizationField:b,sizeStops:m,sizeByScaleEnabled:d||!!e.sizeOptimizationEnabled}),S=n?.symbolStyle||y?.referenceSizeSymbolStyle||"circle";if("class-breaks"===c.type){const e="polygon"===("geometryType"in a?a.geometryType:null)&&t&&"marker"in t?t.marker:null;c.classBreakInfos.forEach((i=>{const r=e?.color??K(i.symbol,1);"cim"===i.symbol.type?w(i.symbol,{type:S,color:r,primitiveOverrides:g}):r&&(i.symbol=h({type:S,color:r,primitiveOverrides:g}))}))}else if("unique-value"===c.type){const e=c.uniqueValueGroups,i="polygon"===("geometryType"in a?a.geometryType:null)&&u&&"colors"in u?u.colors:null,r=i?x(i,c.uniqueValueInfos?.length??0):null;let n=0;if(e){for(const i of e)for(const e of i.classes??[]){const i=r?r[n]:K(e.symbol,1);"cim"===e.symbol?.type?w(e.symbol,{type:S,color:i,primitiveOverrides:g}):i&&(e.symbol=h({type:S,color:i,primitiveOverrides:g})),n++}c.uniqueValueGroups=e}}return y&&(y.field=f,y.normalizationField=b,y.sizeStops=m.map((({label:e,size:i,value:r})=>new o({label:e,size:i,value:r}))),y.referenceSizeScale=d||e.sizeOptimizationEnabled?p.scale:void 0,y.referenceSizeSymbolStyle=S),c}async function ze(e){const i=await ee(e);return de(i,await V(ie(i),i.outlineOptimizationEnabled))}async function be(e){const i=await ae(e),{defaultSymbolEnabled:r,view:a,startTime:l,endTime:o,symbolType:t,minValue:m,maxValue:u,signal:p}=i,d=i.layer,c={layer:i.layer,view:i.view,signal:p},[z,b]=await Promise.all([i.unit?{unit:i.unit,statistics:null,valueExpression:null}:await y({view:a,layer:d,startTime:l,endTime:o,minValue:m,maxValue:u,signal:p}),i.outlineOptimizationEnabled?f(c).catch(T):null]),{unit:v,statistics:w}=z,h=U({layer:d,startTime:l,endTime:o,unit:v}).valueExpression,g=await n("esri/smartMapping/t9n/smartMapping"),S=s(g[`ageInfo_${v}`],{unit:v,startTime:E(l,v,d,a),endTime:E(o,v,d,a)}),x=await ce(re({layer:d,basemap:i.basemap,valueExpression:h,symbolType:t,statistics:w,legendOptions:{title:S},theme:i.theme,sizeScheme:i.sizeScheme,sizeOptimizationEnabled:i.sizeOptimizationEnabled,view:i.view,minValue:m,maxValue:u,signal:p})),V={layer:d,valueExpression:h,defaultSymbolEnabled:r,symbolType:t},O=await ue(x,b,null,null,V),I=O.renderer.authoringInfo?.visualVariables;return I?.forEach((e=>j(e,l,o,v))),{...O,unit:v}}export{be as createAgeRenderer,ze as createClassBreaksRenderer,ye as createContinuousRenderer,ce as createVisualVariables,fe as updateRendererWithReferenceSize};
|
|
5
|
+
import e from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import i from"../../core/Error.js";import{toPt as r}from"../../core/screenUtils.js";import{ensureClass as a}from"../../core/accessorSupport/ensureType.js";import{fetchMessageBundle as n}from"../../intl/messages.js";import{substitute as s}from"../../intl/substitute.js";import l from"../../renderers/support/AuthoringInfo.js";import o from"../../renderers/support/AuthoringInfoSizeStop.js";import t from"../../renderers/support/AuthoringInfoVisualVariable.js";import{setLabelsForClassBreaks as m}from"../../renderers/support/utils.js";import u from"../../renderers/visualVariables/SizeVariable.js";import{castSizeFromStringOrNumber as p}from"../../renderers/visualVariables/support/castSizeVariable.js";import d from"../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{TransformationType as c}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import y from"../heuristics/ageUnit.js";import f from"../heuristics/outline.js";import z from"../heuristics/referenceSize.js";import b from"../heuristics/sizeRange.js";import{createPrimitiveOverrides as v,updateReferenceSizeSymbol as w,createReferenceSizeSymbol as h,getReferenceSizeStops as g}from"./support/referenceSizeUtils.js";import{getSummaryStatistics as S,errorCallback as T,createColors as x,getClassBreaks as V,formatDate as E,updateAgeRendererAuthoringInfoVV as j,verifyBasicFieldValidity as O,getSizeRangeForAxis as I,createSymbol as k,getSymbolOutlineFromScheme as q,getSymbolSizeFromScheme as B,getBasemapInfo as F,getDataRange as R}from"./support/utils.js";import{getAgeExpressions as U,verifyDates as D,supportedAgeUnits as M}from"../statistics/support/ageUtils.js";import{verifyBinningParams as G}from"../support/binningUtils.js";import{getFieldsList as A,getNormalizationType as C,isAnyDateField as L}from"../support/utils.js";import{binningCapableLayerTypes as P,featureCapableLayerTypes as W,createLayerAdapter as $,getLayerTypeLabels as H}from"../support/adapters/support/layerUtils.js";import{cloneScheme as _,getSchemes as J}from"../symbology/size.js";import{getColorFromSymbol as K}from"../../symbols/support/utils.js";const N=2**53-1;async function Q(e){if(!(e&&e.layer&&(e.field||e.valueExpression||e.sqlExpression)))throw new i("size-visual-variable:missing-parameters","'layer' and 'field', 'valueExpression' or 'sqlExpression' parameters are required");if(e.valueExpression&&!e.sqlExpression&&!e.view)throw new i("size-visual-variable:missing-parameters","View is required when 'valueExpression' is specified");if("reference-size"===e.theme&&!e.view&&!e.field)throw new i("size-visual-variable:missing-parameters","'view' and 'field' are required when 'theme' is 'reference-size'");if("reference-size"===e.theme&&e.valueExpression)throw new i("size-visual-variable:missing-parameters","'valueExpression' is not supported when 'theme' is 'reference-size'");e.forBinning&&G(e,"size-visual-variable");const r={...e},a=e.forBinning?P:W,n=$(r.layer,a,e.forBinning);if(!n)throw new i("size-visual-variable:invalid-parameters","'layer' must be one of these types: "+H(a).join(", "));r.layer=n,"height"===r.axis&&(r.sizeOptimizationEnabled=!1);const s=null!=r.signal?{signal:r.signal}:null;await n.load(s);const l=n.geometryType;if("mesh"===l)throw new i("size-visual-variable:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(r.worldScale){if("polyline"===l||"polygon"===l)throw new i("size-visual-variable:not-supported","'worldScale' sizing is not supported for polyline and polygon layers");if(!r.view||"3d"!==r.view.type)throw new i("size-visual-variable:invalid-parameters","'view' parameter should be an instance of SceneView when 'worldScale' parameter is true")}if("reference-size"===r.theme&&!e.forBinning&&"polygon"!==l)throw new i("size-visual-variable:invalid-parameters","Reference size is only supported for polygon layers");const o=await A({field:r.field,normalizationField:r.normalizationField,valueExpression:r.valueExpression}),t=O(n,o,"size-visual-variable:invalid-parameters");if(t)throw t;return await Y(r),r}async function X(e){if(!(e&&e.layer&&(e.field||e.valueExpression||e.sqlExpression)))throw new i("size-continuous-renderer:missing-parameters","'layer' and 'field', 'valueExpression' or 'sqlExpression' parameters are required");if(e.valueExpression&&!e.sqlExpression&&!e.view)throw new i("size-continuous-renderer:missing-parameters","View is required when 'valueExpression' is specified");e.forBinning&&G(e,"size-continuous-renderer");const r={...e};r.symbolType=r.symbolType||"2d",r.defaultSymbolEnabled??=!0;const a=e.forBinning?P:W,n=$(r.layer,a,e.forBinning);if(!n)throw new i("size-continuous-renderer:invalid-parameters","'layer' must be one of these types: "+H(a).join(", "));r.layer=n;const s=null!=r.signal?{signal:r.signal}:null;await n.load(s);const l=n.geometryType,o=r.symbolType.includes("3d");if(r.outlineOptimizationEnabled="reference-size"!==r.theme&&"polygon"===l&&r.outlineOptimizationEnabled,"mesh"===l)throw new i("size-continuous-renderer:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(o&&("polyline"===l||"polygon"===l))throw new i("size-continuous-renderer:not-supported","3d symbols are not supported for polyline and polygon layers");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new i("size-continuous-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or 3d-volumetric-uniform");if("reference-size"===r.theme&&!e.forBinning&&"polygon"!==l)throw new i("size-continuous-renderer:invalid-parameters","Reference size is only supported for polygon layers");const t=await A({field:r.field,normalizationField:r.normalizationField,valueExpression:r.valueExpression}),m=O(n,t,"size-continuous-renderer:invalid-parameters");if(m)throw m;return await Y(r),r}async function Y(e){const i=e.layer;if(("polygon"===i.geometryType||e.forBinning)&&e.view&&e.field&&!e.valueExpression&&(!e.theme||"reference-size"===e.theme)){try{e.referenceSizeResult=e.referenceSizeResult??await z({layer:i,view:e.view,forBinning:e.forBinning,signal:e.signal})}catch{}!e.theme&&e.referenceSizeResult?.isGrid&&(e.theme="reference-size"),e.referenceSizeOptions?.symbolStyle||(e.referenceSizeOptions?e.referenceSizeOptions.symbolStyle="circle":e.referenceSizeOptions={symbolStyle:"circle"})}}function Z(e){if(!e||!(e.layer&&e.view&&e.sizeStops))throw new i("update-renderer-with-reference-size:missing-parameters","'layer', 'view and 'sizeStops' parameters are required");const r=e.layer;let a=e.renderer;if(!a)if(e.forBinning){if(!("featureReduction"in r&&r.featureReduction&&"renderer"in r.featureReduction&&r.featureReduction.renderer)||"class-breaks"!==r.featureReduction.renderer.type&&"unique-value"!==r.featureReduction.renderer.type)throw new i("update-renderer-with-reference-size:invalid-parameters","Feature reduction renderer is not supported");a=r.featureReduction.renderer}else{if(!("renderer"in r)||!r.renderer||"class-breaks"!==r.renderer.type&&"unique-value"!==r.renderer.type)throw new i("update-renderer-with-reference-size:invalid-parameters","Renderer is not supported");a=r.renderer}const n=a.authoringInfo;if(!n||!n?.visualVariables?.some((e=>"reference-size"===e.theme)))throw new i("update-renderer-with-reference-size:invalid-parameters","'renderer.authoringInfo.visualVariables' should have an authoringInfoVisualVariable with 'theme' set to 'reference-size'");return{...e,renderer:a}}async function ee(e){if(!e||!e.layer||!e.field&&!e.valueExpression)throw new i("size-class-breaks-renderer:missing-parameters","'layer' and 'field' or 'valueExpression' parameters are required");if(e.valueExpression&&!e.view)throw new i("size-class-breaks-renderer:missing-parameters","View is required when 'valueExpression' is specified");e.forBinning&&G(e,"size-class-breaks-renderer");const r={...e};r.symbolType=r.symbolType||"2d",r.defaultSymbolEnabled??=!0,r.classificationMethod??="equal-interval",r.normalizationType=C(r);const a=e.forBinning?P:W,n=$(r.layer,a,e.forBinning);if(!n)throw new i("size-class-breaks-renderer:invalid-parameters","'layer' must be one of these types: "+H(a).join(", "));r.layer=n;if(!(null!=r.minValue&&null!=r.maxValue)&&(null!=r.minValue||null!=r.maxValue))throw new i("size-class-breaks-renderer:missing-parameters","Both 'minValue' and 'maxValue' are required when specifying custom data range");const s=null!=r.signal?{signal:r.signal}:null;await n.load(s);const l=n.geometryType,o=r.symbolType.includes("3d");if(r.outlineOptimizationEnabled="polygon"===l&&r.outlineOptimizationEnabled,"mesh"===l)throw new i("size-class-breaks-renderer:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(o&&("polyline"===l||"polygon"===l))throw new i("size-class-breaks-renderer:not-supported","3d symbols are not supported for polyline and polygon layers");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new i("size-class-breaks-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or 3d-volumetric-uniform");const t=await A({field:r.field,normalizationField:r.normalizationField}),m=O(n,t,"size-class-breaks-renderer:invalid-parameters");if(m)throw m;return r}function ie(e){const i={...e};delete i.basemap,delete i.sizeScheme,delete i.legendOptions,delete i.symbolType,delete i.defaultSymbolEnabled;const r=i;return r.analyzeData=!(null!=i.minValue&&null!=i.maxValue),r}function re(e){const i={...e},r=!!i.symbolType?.includes("3d-volumetric"),a=i;return a.worldScale=r,r&&(a.axis="3d-volumetric-uniform"===i.symbolType?"all":"height"),delete i.symbolType,delete i.defaultSymbolEnabled,a}async function ae(e){if(!(e&&e.layer&&e.view&&e.startTime&&e.endTime))throw new i("size-age-renderer:missing-parameters","'layer', 'view', 'startTime', 'endTime' parameters are required");const r={...e};r.symbolType??="2d",r.defaultSymbolEnabled??=!0;const a=$(r.layer,W);if(!a)throw new i("size-age-renderer:invalid-parameters","'layer' must be one of these types: "+H(W).join(", "));r.layer=a;const n=null!=r.signal?{signal:r.signal}:null;await a.load(n);const s=a.geometryType,l=r.symbolType.includes("3d");if(r.outlineOptimizationEnabled="polygon"===s&&r.outlineOptimizationEnabled,"mesh"===s)throw new i("size-age-renderer:invalid-parameters","Size visualization is not applicable to layers with 'mesh' geometry type");if(l&&("polyline"===s||"polygon"===s))throw new i("size-age-renderer:not-supported","3d symbols are not supported for polyline and polygon layers");if(r.symbolType.includes("3d-volumetric")&&(!r.view||"3d"!==r.view.type))throw new i("size-age-renderer:invalid-parameters","'view' parameter should be an instance of SceneView when 'symbolType' parameter is '3d-volumetric' or 3d-volumetric-uniform");const o=D(a,r.startTime,r.endTime,"size-age-renderer:invalid-parameters");if(o)throw o;if(r.unit&&!M.includes(r.unit))throw new i("size-age-renderer:invalid-unit",`Supported units are: ${M.join(", ")}`);return r}async function ne(e){let i=e.sizeScheme,r=null,a=null;const n=await F(e.basemap,e.view);if(r=null!=n.basemapId?n.basemapId:null,a=null!=n.basemapTheme?n.basemapTheme:null,i)return{scheme:_(i),basemapId:r,basemapTheme:a};const s=J({basemapTheme:a,geometryType:e.geometryType,worldScale:e.worldScale,view:e.view});return s&&(i=s.primaryScheme,r=s.basemapId,a=s.basemapTheme),{scheme:i,basemapId:r,basemapTheme:a}}function se(e,i){switch(i){case"point":case"multipoint":{const i=e;return[p(i.minSize),p(i.maxSize)]}case"polyline":{const i=e;return[p(i.minWidth),p(i.maxWidth)]}case"polygon":{const i=e;return[p(i.marker.minSize),p(i.marker.maxSize)]}}}function le(e,i){e.transformationType===c.ClampedLinear&&"below"===i&&e.flipSizes()}async function oe(e,i,r,a,n){return"reference-size"===r&&i?[1,i.size]:e?[e.minSize,e.maxSize]:se(a,n)}function te(e,i){if("reference-size"===i.theme&&null!=e.min&&null!=e.max&&null!=e.avg&&null!=e.stddev){const i=100,r=0,a=0,n=1,s=e.avg,l=e.min,o=e.max,t=e.stddev,m=0!==s?t/s:0,u=l>a&&l<n&&o<2*n&&m<.5,p=l>r&&l<i&&o<2*i&&m<.5;return{minDataValue:u?a:p?r:l,maxDataValue:u?n:p?i:s+2*t,defaultValuesUsed:!1}}const{theme:r,field:a}=i,n=i.layer,s=a&&!("function"==typeof a)?n.getField(a):null,l=L(s);return R(e,r,l,"above"===r||"below"===r)}async function me(e,r,n,s){const{theme:m,field:p,normalizationField:c,minValue:y,maxValue:f,axis:z}=e,b=e.layer.geometryType,v=await ne({basemap:e.basemap,geometryType:b,sizeScheme:e.sizeScheme,worldScale:e.worldScale,view:e.view}),w=v.scheme;if(!w)throw new i("size-visual-variable:insufficient-info","Unable to find size scheme");const h=await oe(n,s,m,w,b),{minDataValue:S,maxDataValue:T,defaultValuesUsed:x}=te(r,e),V=[],E="height"===z,j=E?z:void 0,O=h[0];let k=h[1];if(E&&"number"==typeof O&&"number"==typeof k){const e=I({minSize:O,maxSize:k},j);V.push(new u({axis:"width-and-depth",minSize:e.minSize})),k=e.maxSize}const q=new u({field:p??void 0,valueExpression:e.valueExpression,valueExpressionTitle:e.valueExpressionTitle,valueUnit:"unknown",normalizationField:c,axis:j,minSize:O,maxSize:k,minDataValue:S,maxDataValue:T,legendOptions:a(d,e.legendOptions)});le(q,m),V.unshift(q);const B=new t("reference-size"===m?{type:"size",field:e.field,normalizationField:e.normalizationField,sizeStops:g(q).map((({label:e,size:i,value:r})=>new o({label:e,size:i,value:r}))),theme:m,referenceSizeScale:s?.isGrid||e.sizeOptimizationEnabled?e?.view?.scale:void 0,referenceSizeSymbolStyle:e.referenceSizeOptions?.symbolStyle,minSliderValue:null!=y?y:r.min,maxSliderValue:null!=f?f:r.max}:{type:"size",theme:m,minSliderValue:null!=y?y:r.min,maxSliderValue:null!=f?f:r.max}),F=new l({visualVariables:[B]});return{basemapId:v.basemapId,basemapTheme:v.basemapTheme,visualVariables:V,statistics:r,isGrid:s?.isGrid,defaultValuesUsed:x,sizeScheme:_(w),authoringInfo:F}}async function ue(i,r,a,s,l){const o=await n("esri/smartMapping/t9n/smartMapping"),t=l.layer,m=l.field,u=t.geometryType,p=l.defaultSymbolEnabled,d=_(i.sizeScheme),c="polygon"===u,y=c?d.marker:d,f=c?d.background:null,z=c?"point":u,b=r?.opacity,w=i.isGrid,S="reference-size"===l.theme,T=S?[]:i.visualVariables.map((e=>e.clone()));r?.visualVariables?.length&&T.push(...r.visualVariables.map((e=>e.clone())));const x=S?v({view:l.view,field:m,normalizationField:s,sizeStops:g(i.visualVariables[0]),sizeByScaleEnabled:w||!!l.sizeOptimizationEnabled}):null;return{renderer:new e({backgroundFillSymbol:!w&&f&&k(u,{type:l.symbolType,color:f.color,outline:q(f,u,b)}),classBreakInfos:[{minValue:-N,maxValue:N,symbol:x?h({type:l.referenceSizeOptions?.symbolStyle||"circle",color:y.color,primitiveOverrides:x}):k(z,{type:l.symbolType,color:y.color,size:B(y,z),outline:q(y,z,b)})}],defaultLabel:p?o.other:null,defaultSymbol:p&&!S?k(z,{type:l.symbolType,color:y.noDataColor,size:B(y,z,!0),outline:q(y,z,b)}):null,field:m,normalizationField:s,normalizationType:a,valueExpression:l.valueExpression,valueExpressionTitle:l.valueExpressionTitle,visualVariables:T,authoringInfo:i.authoringInfo?.clone()}),visualVariables:i.visualVariables.map((e=>e.clone())),statistics:i.statistics,defaultValuesUsed:i.defaultValuesUsed,isGrid:w,sizeScheme:_(i.sizeScheme),basemapId:i.basemapId,basemapTheme:i.basemapTheme}}function pe(e,i){const a=r(e.minSize),n=(r(e.maxSize)-a)/(i>=4?i-1:i),s=[];for(let r=0;r<i;r++)s.push(a+n*r);return s}async function de(i,r){const a=await n("esri/smartMapping/t9n/smartMapping"),s=i.layer,o=i.defaultSymbolEnabled,t=s.geometryType,u="polygon"===t,p=i.symbolType?.includes("3d-volumetric"),d=await ne({basemap:i.basemap,geometryType:t,sizeScheme:i.sizeScheme,worldScale:p,view:i.view}),c=d.scheme,{result:y,outlineResult:f}=r,z=y?.classBreakInfos??[],b=i.classificationMethod,v=i.normalizationType,w=u?c.marker:c,h=u?c.background:null,g=u?"point":t,S=se(w,g),T=p?I({minSize:S[0],maxSize:S[1]},"height"):null,x=pe({minSize:S[0],maxSize:T?T.maxSize:S[1]},z.length),V=f?.opacity,E=new e({backgroundFillSymbol:h&&k(t,{type:i.symbolType,color:h.color,outline:q(h,t,V)}),classBreakInfos:z.map(((e,r)=>({minValue:e.minValue,maxValue:e.maxValue,symbol:k(g,{type:i.symbolType,color:w.color,size:x[r],widthAndDepth:T?.minSize,outline:q(w,g,V)}),label:e.label}))),defaultLabel:o?a.other:null,defaultSymbol:o?k(g,{type:i.symbolType,color:w.noDataColor,size:B(w,g,!0),widthAndDepth:T?.minSize,outline:q(w,g,V)}):null,field:i.field,valueExpression:i.valueExpression,valueExpressionTitle:i.valueExpressionTitle,normalizationType:v,normalizationField:i.normalizationField,normalizationTotal:"percent-of-total"===v?y?.normalizationTotal:void 0,legendOptions:i.legendOptions,authoringInfo:new l({type:"class-breaks-size",classificationMethod:b,standardDeviationInterval:i.standardDeviationInterval})});return"standard-deviation"!==b&&m({classBreakInfos:E.classBreakInfos,classificationMethod:b,normalizationType:v,round:!0}),f?.visualVariables?.length&&(E.visualVariables=f.visualVariables.map((e=>e.clone()))),{renderer:E,sizeScheme:_(c),classBreaksResult:y,defaultValuesUsed:!!r.defaultValuesUsed,basemapId:d.basemapId,basemapTheme:d.basemapTheme}}async function ce(e){const i=await Q(e),{view:r,field:a,valueExpression:n,minValue:s,maxValue:l,layer:o,normalizationField:t,signal:m,statistics:u}=i,p=t?"field":void 0,[d,c]=await Promise.all([u??S({layer:o,field:a,valueExpression:n,sqlExpression:i.sqlExpression,sqlWhere:i.sqlWhere,normalizationType:p,normalizationField:t,minValue:s,maxValue:l,view:r,signal:m}),i.sizeOptimizationEnabled?b({view:r,layer:o,signal:m}).catch(T):null]);return me(i,d,c,i.referenceSizeResult)}async function ye(e){const i=await X(e),r={layer:i.layer,view:i.view,signal:i.signal},[a,n]=await Promise.all([ce(re(i)),i.outlineOptimizationEnabled?f(r).catch(T):null]),s=i.normalizationField;return ue(a,n,s?"field":void 0,s,i)}async function fe(e){const{forBinning:r,layer:a,referenceSizeOptions:n,renderer:s,sizeScheme:t,sizeStops:m,typeScheme:u,view:p}=Z(e),{isGrid:d}=await z({view:p,layer:a,forBinning:r}),c=s.clone();c.authoringInfo??=new l;const y=c.authoringInfo.visualVariables.find((e=>"reference-size"===e.theme)),f=e.field??y?.field,b=e.normalizationField??y?.normalizationField;if(!f)throw new i("update-renderer-with-reference-size:invalid-parameters","'field' parameter or authoring info with 'field' is required.");const g=v({view:p,field:f,normalizationField:b,sizeStops:m,sizeByScaleEnabled:d||!!e.sizeOptimizationEnabled}),S=n?.symbolStyle||y?.referenceSizeSymbolStyle||"circle";if("class-breaks"===c.type){const e="polygon"===("geometryType"in a?a.geometryType:null)&&t&&"marker"in t?t.marker:null;c.classBreakInfos.forEach((i=>{const r=e?.color??K(i.symbol,1);"cim"===i.symbol.type?w(i.symbol,{type:S,color:r,primitiveOverrides:g}):r&&(i.symbol=h({type:S,color:r,primitiveOverrides:g}))}))}else if("unique-value"===c.type){const e=c.uniqueValueGroups,i="polygon"===("geometryType"in a?a.geometryType:null)&&u&&"colors"in u?u.colors:null,r=i?x(i,c.uniqueValueInfos?.length??0):null;let n=0;if(e){for(const i of e)for(const e of i.classes??[]){const i=r?r[n]:K(e.symbol,1);"cim"===e.symbol?.type?w(e.symbol,{type:S,color:i,primitiveOverrides:g}):i&&(e.symbol=h({type:S,color:i,primitiveOverrides:g})),n++}c.uniqueValueGroups=e}}return y&&(y.field=f,y.normalizationField=b,y.sizeStops=m.map((({label:e,size:i,value:r})=>new o({label:e,size:i,value:r}))),y.referenceSizeScale=d||e.sizeOptimizationEnabled?p.scale:void 0,y.referenceSizeSymbolStyle=S),c}async function ze(e){const i=await ee(e);return de(i,await V(ie(i),i.outlineOptimizationEnabled))}async function be(e){const i=await ae(e),{defaultSymbolEnabled:r,view:a,startTime:l,endTime:o,symbolType:t,minValue:m,maxValue:u,signal:p}=i,d=i.layer,c={layer:i.layer,view:i.view,signal:p},[z,b]=await Promise.all([i.unit?{unit:i.unit,statistics:null,valueExpression:null}:await y({view:a,layer:d,startTime:l,endTime:o,minValue:m,maxValue:u,signal:p}),i.outlineOptimizationEnabled?f(c).catch(T):null]),{unit:v,statistics:w}=z,h=U({layer:d,startTime:l,endTime:o,unit:v}).valueExpression,g=await n("esri/smartMapping/t9n/smartMapping"),S=s(g[`ageInfo_${v}`],{unit:v,startTime:E(l,v,d,a),endTime:E(o,v,d,a)}),x=await ce(re({layer:d,basemap:i.basemap,valueExpression:h,symbolType:t,statistics:w,legendOptions:{title:S},theme:i.theme,sizeScheme:i.sizeScheme,sizeOptimizationEnabled:i.sizeOptimizationEnabled,view:i.view,minValue:m,maxValue:u,signal:p})),V={layer:d,valueExpression:h,defaultSymbolEnabled:r,symbolType:t},O=await ue(x,b,null,null,V),I=O.renderer.authoringInfo?.visualVariables;return I?.forEach((e=>j(e,l,o,v))),{...O,unit:v}}export{be as createAgeRenderer,ze as createClassBreaksRenderer,ye as createContinuousRenderer,ce as createVisualVariables,fe as updateRendererWithReferenceSize};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const d="20240614",b="b5776552c0dd654e46313b70dff370ac8ea7bd47";export{d as buildDate,b as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{bidiText as e}from"../../core/BidiText.js";import has from"../../core/has.js";import{clone as t}from"../../core/lang.js";import r from"../../core/Logger.js";import o from"../../core/RandomLCG.js";import{px2pt as a}from"../../core/screenUtils.js";import{create as s,expandPointInPlace as i}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as n}from"../../geometry/support/boundsUtils.js";import l from"../Font.js";import{Placement as c}from"./CIMPlacements.js";import{EnvDrawHelper as m,Transformation as f,CanvasDrawHelper as y,lineGapType2LineHeight as h}from"./CIMSymbolDrawHelper.js";import{defaultCIMValues as u}from"./defaultCIMValues.js";import{LineCapStyle as p,LineJoinStyle as M,TextureFilter as S,ExtremityPlacement as d,BlockProgression as g,FontEffects as b,FontEncoding as C,FontType as I,GlyphHinting as x,TextReadingDirection as k,VerticalGlyphOrientation as w,BillBoardMode as P,LineDashEnding as L}from"./enums.js";import{getNumericValue as F,fromCIMFontStyle as z,fromCIMFontDecoration as D,isGeometryEngineRequired as E,importGeometryEngine as G}from"./utils.js";import{defaultPolylineSymbol2D as T}from"../support/defaults.js";import{cInfinity as v}from"../../views/2d/engine/vectorTiles/GeometryUtils.js";import{glyphSize as A,magicLabelLineHeight as R,randomInsidePolygonTextureSize as j}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as B}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as X,getLineWidth as V}from"../../views/2d/layers/graphics/graphicsUtils.js";const N=Math.PI,Y=N/2,_=Math.PI/180,U=96/72,q=1.4142135623730951,H=4,O=()=>r.getLogger("esri.symbols.cim.CIMSymbolHelper");function W(e){let t;switch(e.type){case"cim":return e.data;case"web-style":return e;case"simple-marker":{const r=ee.fromSimpleMarker(e);if(!r)throw new Error("InternalError: Cannot convert symbol to CIM");t=r;break}case"picture-marker":t=ee.fromPictureMarker(e);break;case"simple-line":t=ee.fromSimpleLineSymbol(e);break;case"simple-fill":t=ee.fromSimpleFillSymbol(e);break;case"picture-fill":t=ee.fromPictureFillSymbol(e);break;case"text":t=ee.fromTextSymbol(e)}return{type:"CIMSymbolReference",symbol:t}}function $(e,t,r){switch(t.type){case"CIMSymbolReference":return $(e,t.symbol,r);case"CIMPointSymbol":null==r&&(r={x:0,y:0}),e.drawSymbol(t,r);break;case"CIMLineSymbol":null==r&&(r={paths:[[[0,0],[10,0]]]}),e.drawSymbol(t,r);break;case"CIMPolygonSymbol":null==r&&(r={rings:[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}),e.drawSymbol(t,r);break;case"CIMTextSymbol":{const r={x:0,y:0};e.drawSymbol(t,r);break}case"CIMVectorMarker":{const r=new c;e.drawMarker(t,r);break}}return e.envelope()}function J(e){if(!e)return 0;switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAtExtremities":case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementAtRatioPositions":case"CIMMarkerPlacementOnLine":case"CIMMarkerPlacementOnVertices":return Math.abs(e.offset);default:return 0}}function K(e){if(!e)return 0;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(F(e.offsetX)),Math.abs(F(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function Q(e){if(!e)return 0;let t=0;for(const r of e)t+=K(r);return t}class Z{static getSymbolInflateSize(e,t,r,o,a){return e||(e=[0,0,0,0]),t?this._getInflateSize(e,t,r,o,a):e}static safeSize(e){const t=Math.max(Math.abs(e[0]),Math.abs(e[2])),r=Math.max(Math.abs(e[1]),Math.abs(e[3]));return Math.sqrt(t*t+r*r)}static _vectorMarkerBounds(e,t,r,o){let a=!0;const i=s();if(t?.markerGraphics)for(const s of t.markerGraphics){const t=[0,0,0,0];s.geometry&&(n(i,s.geometry),t[0]=0,t[1]=0,t[2]=0,t[3]=0,this.getSymbolInflateSize(t,s.symbol,r,0,o),i[0]+=t[0],i[1]+=t[1],i[2]+=t[2],i[3]+=t[3],a?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],a=!1):(e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[2]),e[3]=Math.max(e[3],i[3])))}return e}static _getInflateSize(e,t,r,o,a){if(fe(t)){const s=this._getLayersInflateSize(e,t.symbolLayers,r,o,a),i=Q(t.effects);return i>0&&(s[0]-=i,s[1]-=i,s[2]+=i,s[3]+=i),s}return this._getTextInflatedSize(e,t,a)}static _getLayersInflateSize(e,t,r,o,a){let n=!0;if(!t)return e;for(const l of t){if(!l)continue;let t=[0,0,0,0];switch(l.type){case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=l;let r=e.width;null!=r&&(e.capStyle===p.Square||e.joinStyle===M.Miter?r/=q:r/=2,t[0]=-r,t[1]=-r,t[2]=r,t[3]=r);break}case"CIMCharacterMarker":case"CIMVectorMarker":case"CIMPictureMarker":{const e=l;if("CIMVectorMarker"===l.type){const e=l;if(t=this._vectorMarkerBounds(t,e,r,a),e.frame){const r=(e.frame.xmin+e.frame.xmax)/2,o=(e.frame.ymin+e.frame.ymax)/2;if(t[0]-=r,t[1]-=o,t[2]-=r,t[3]-=o,null!=e.size){const r=e.size/(e.frame.ymax-e.frame.ymin);t[0]*=r,t[1]*=r,t[2]*=r,t[3]*=r}}}else if("CIMPictureMarker"===l.type){const o=l,a=r.getResource(o.url);let s=1;if(null!=a&&a.height&&(s=a.width/a.height),null!=e.size){const r=e.size/2,a=e.size*s*o.scaleX/2;t=[-a,-r,a,r]}}else if(null!=e.size){const r=e.size/2;t=[-r,-r,r,r]}if(e.anchorPoint){let r,o;"Absolute"===e.anchorPointUnits?(r=e.anchorPoint.x,o=e.anchorPoint.y):(r=e.anchorPoint.x*(t[2]-t[0]),o=e.anchorPoint.y*(t[3]-t[1]));const a=1.25*Math.sqrt(r*r+o*o);t[0]-=a,t[1]-=a,t[2]+=a,t[3]+=a}let n=F(e.rotation);if(e.rotateClockwise&&(n=-n),o&&(n-=o),n){const e=_*n,r=Math.cos(e),o=Math.sin(e),a=s([v,v,-v,-v]);i(a,[t[0]*r-t[1]*o,t[0]*o+t[1]*r]),i(a,[t[0]*r-t[3]*o,t[0]*o+t[3]*r]),i(a,[t[2]*r-t[1]*o,t[2]*o+t[1]*r]),i(a,[t[2]*r-t[3]*o,t[2]*o+t[3]*r]),t=a}let c=F(e.offsetX),m=F(e.offsetY);if(o){const e=_*o,t=Math.cos(e),r=Math.sin(e),a=c*r+m*t;c=c*t-m*r,m=a}t[0]+=c,t[1]+=m,t[2]+=c,t[3]+=m;const f=J(e.markerPlacement);f>0&&(t[0]-=f,t[1]-=f,t[2]+=f,t[3]+=f);break}}const c=Q(l.effects);c>0&&(t[0]-=c,t[1]-=c,t[2]+=c,t[3]+=c),n?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],n=!1):(e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3]))}return e}static _getTextInflatedSize(e,t,r){const o=X(t.height??u.CIMTextSymbol.height);if(e[0]=-o/2,e[1]=-o/2,e[2]=o/2,e[3]=o/2,!r)return e;const a=r.get(t);if(!a)return e;if(!a.glyphMosaicItems.glyphs.length)return e;const{lineGapType:s,lineGap:i}=t,n=s?h(s,i??0,o):0,l="CIMBackgroundCallout"===t.callout?.type,c=B(a.glyphMosaicItems,{scale:o/A,angle:F(t.angle),xOffset:F(t.offsetX),yOffset:F(t.offsetY),horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:V(t.lineWidth),lineHeight:R*Math.max(.25,Math.min(n||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}).boundsT,m=Math.sqrt(c.width*c.width+c.height*c.height);return e[0]-=c.x+m,e[1]-=c.y-m,e[2]+=c.x+m,e[3]+=-c.y+m,e}}class ee{static getEnvelope(e,t,r){if(!e)return null;const o=new m(r);if(Array.isArray(e)){let r;for(const a of e)r?r.union($(o,a,t)):r=$(o,a,t);return r}return $(o,e,t)}static getTextureAnchor(e,t){const r=this.getEnvelope(e,null,t);if(!r)return[0,0,0];const o=(r.x+.5*r.width)*U,a=(r.y+.5*r.height)*U,s=r.width*U+2,i=r.height*U+2;return[-o/s,-a/i,i]}static rasterize(e,t,r,o,a=!0){const s=r||this.getEnvelope(t,null,o);if(!s)return[null,0,0,0,0];const i=(s.x+.5*s.width)*U,n=(s.y+.5*s.height)*U;e.width=s.width*U,e.height=s.height*U,r||(e.width+=2,e.height+=2);const l=e.getContext("2d",{willReadFrequently:!0}),m=f.createScale(U,-U);m.translate(.5*e.width-i,.5*e.height+n);const h=new y(l,o,m);switch(t.type){case"CIMPointSymbol":{const e={type:"point",x:0,y:0};h.drawSymbol(t,e);break}case"CIMVectorMarker":{const e=new c;h.drawMarker(t,e);break}}const u=l.getImageData(0,0,e.width,e.height),p=new Uint8Array(u.data);if(a){let e;for(let t=0;t<p.length;t+=4)e=p[t+3]/255,p[t]=p[t]*e,p[t+1]=p[t+1]*e,p[t+2]=p[t+2]*e}return[p,e.width,e.height,-i/e.width,-n/e.height]}static fromTextSymbol(e){const{text:t}=e;return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:10,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:ee.createCIMTextSymbolfromTextSymbol(e),textString:t}],scaleSymbolsProportionally:!0,respectFrame:!0}],scaleX:1,angleAlignment:"Display"}}static fromPictureFillSymbol(e){const{height:t,outline:r,width:o,xoffset:a,xscale:s,yoffset:i,yscale:n}=e,l=[],c={type:"CIMPolygonSymbol",symbolLayers:l};if(r){const e=pe(r);e&&l.push(e)}let m=e.url;"esriPFS"===e.type&&e.imageData&&(m=e.imageData);const f="angle"in e?e.angle??0:0,y=(o??0)*(s||1),h=(t??0)*(n||1);return l.push({type:"CIMPictureFill",invertBackfaceTexture:!1,scaleX:1,textureFilter:S.Picture,tintColor:null,url:m,height:h,width:y,offsetX:F(a),offsetY:F(i),rotation:F(-f),colorSubstitutions:null}),c}static fromSimpleFillSymbol(e){const{color:r,style:o,outline:s}=e,i=[],n={type:"CIMPolygonSymbol",symbolLayers:i};if(s){const e=pe(s);e&&i.push(e)}if(o&&"solid"!==o&&"none"!==o&&"esriSFSSolid"!==o&&"esriSFSNull"!==o){const e={type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",color:ie(r),capStyle:p.Butt,joinStyle:M.Miter,width:.75}]};let s=0;const n=a(he(o)?8:10);switch(o){case"vertical":case"esriSFSVertical":s=90;break;case"forward-diagonal":case"esriSFSForwardDiagonal":case"diagonal-cross":case"esriSFSDiagonalCross":s=-45;break;case"backward-diagonal":case"esriSFSBackwardDiagonal":s=45;break;case"cross":case"esriSFSCross":s=0}i.push({type:"CIMHatchFill",lineSymbol:e,offsetX:0,offsetY:0,rotation:s,separation:n}),"cross"===o||"esriSFSCross"===o?i.push({type:"CIMHatchFill",lineSymbol:t(e),offsetX:0,offsetY:0,rotation:90,separation:n}):"diagonal-cross"!==o&&"esriSFSDiagonalCross"!==o||i.push({type:"CIMHatchFill",lineSymbol:t(e),offsetX:0,offsetY:0,rotation:45,separation:n})}else!o||"solid"!==o&&"esriSFSSolid"!==o||i.push({type:"CIMSolidFill",enable:!0,color:ie(r)});return n}static fromSimpleLineSymbol(e){const{cap:t,color:r,join:o,marker:a,miterLimit:s,style:i,width:n}=e;let l=null;"solid"!==i&&"none"!==i&&"esriSLSSolid"!==i&&"esriSLSNull"!==i&&(l=[{type:"CIMGeometricEffectDashes",dashTemplate:me(i,t),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);const c=[];if(a){let e;switch(a.placement){case"begin-end":e=d.Both;break;case"begin":e=d.JustBegin;break;case"end":e=d.JustEnd;break;default:e=d.None}const t=ee.fromSimpleMarker(a,n,r).symbolLayers[0];t.markerPlacement={type:"CIMMarkerPlacementAtExtremities",placePerPart:!1,angleToLine:!0,offset:0,extremityPlacement:e,offsetAlongLine:0},c.push(t)}return c.push({type:"CIMSolidStroke",color:"none"!==i&&"esriSLSNull"!==i?ie(r):[0,0,0,0],capStyle:re(t),joinStyle:oe(o),miterLimit:s,width:n,effects:l}),{type:"CIMLineSymbol",symbolLayers:c}}static fromPictureMarker(e){const{angle:t,height:r,width:o,xoffset:a,yoffset:s}=e;let i=e.url;return"esriPMS"===e.type&&e.imageData&&(i=e.imageData),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:S.Picture,tintColor:null,url:i,size:r,width:o,offsetX:F(a),offsetY:F(s),rotation:F(-t)}]}}static createCIMTextSymbolfromTextSymbol(t){const{angle:r,color:o,font:a,haloColor:s,haloSize:i,horizontalAlignment:n,kerning:l,lineWidth:c,text:m,verticalAlignment:f,xoffset:y,yoffset:h,backgroundColor:u,borderLineColor:p,borderLineSize:M}=t;let S,d,L,z,D,E;a&&(S=a.family,d=a.style,L=a.weight,z=a.size,D=a.decoration);let G=!1;if(m){G=e(m)[1]}return(u||M)&&(E={type:"CIMBackgroundCallout",margin:null,backgroundSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",color:ie(u)},{type:"CIMSolidStroke",color:ie(p),width:M}]},accentBarSymbol:null,gap:null,leaderLineSymbol:null,lineStyle:null}),{type:"CIMTextSymbol",angle:r,blockProgression:g.BTT,depth3D:1,extrapolateBaselines:!0,fontEffects:b.Normal,fontEncoding:C.Unicode,fontFamilyName:S||"Arial",fontStyleName:ne(d,L),fontType:I.Unspecified,haloSize:i,height:z,hinting:x.Default,horizontalAlignment:ae(n??"center"),kerning:l,letterWidth:100,ligatures:!0,lineGapType:"Multiple",lineWidth:c,offsetX:F(y),offsetY:F(h),strikethrough:"line-through"===D,underline:"underline"===D,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ie(o)}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ie(s)}]},shadowColor:[0,0,0,255],shadowOffsetX:1,shadowOffsetY:1,textCase:"Normal",textDirection:G?k.RTL:k.LTR,verticalAlignment:se(f??"baseline"),verticalGlyphOrientation:w.Right,wordSpacing:100,billboardMode3D:P.FaceNearPlane,callout:E}}static createPictureMarkerRasterizationParam(e){const{angle:t,height:r,width:o,xoffset:a,yoffset:s}=e,i=e.url??e.source?.url??e.source?.imageData;return i?{type:"sprite-rasterization-param",overrides:[],resource:{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:S.Picture,tintColor:null,url:i,size:r,width:o,offsetX:F(a),offsetY:F(s),rotation:F(-t)}}:null}static createPictureFillRasterizationParam(e){const{width:t,height:r,xoffset:o,yoffset:a,url:s}=e;return s?{type:"sprite-rasterization-param",overrides:[],resource:{type:"CIMPictureFill",scaleX:1,textureFilter:S.Picture,tintColor:null,url:s,width:t,height:r,offsetX:F(o),offsetY:F(a),rotation:0}}:null}static fromSimpleMarker(e,t,r){const{style:o}=e,a=e.color??r;if("path"===o||"esriSMSPath"===o){const t=[];if("outline"in e&&e.outline){const r=e.outline;t.push({type:"CIMSolidStroke",enable:!0,width:r.width,color:ie(r.color),path:e.path})}t.push({type:"CIMSolidFill",enable:!0,color:ie(a),path:e.path});const[r,o]=ye("square");return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:-F(e.angle),size:F(e.size||6),offsetX:F(e.xoffset),offsetY:F(e.yoffset),scaleSymbolsProportionally:!1,frame:r,markerGraphics:[{type:"CIMMarkerGraphic",geometry:o,symbol:{type:"CIMPolygonSymbol",symbolLayers:t}}]}]}}const s=[];let i,n,l=e.size;if("outline"in e&&e.outline&&"none"!==e.outline.style&&"esriSLSNull"!==e.outline.style){const t=e.outline,r="solid"!==t.style&&"esriSLSSolid"!==t.style;[i,n]=r?ye(o,e.size):ye(o);const a=t.width??T.width;if(r){const t=a/e.size,r=(i.xmax-i.xmin)*t/2,o=(i.ymax-i.ymin)*t/2;i.xmin-=r,i.xmax+=r,i.ymin-=o,i.ymax+=o,l&&(l+=a)}const c="cross"!==e.style&&"x"!==e.style||"dot"===e?.outline.style||"short-dot"===e?.outline.style?L.HalfGap:L.FullPattern,m=r?[{type:"CIMGeometricEffectAddControlPoints"},{type:"CIMGeometricEffectDashes",dashTemplate:me(t.style,null).map((e=>t.width&&t.width>0?e*t.width:e)),lineDashEnding:c,controlPointEnding:L.FullPattern}]:void 0;s.push({type:"CIMSolidStroke",capStyle:r?p.Round:p.Butt,enable:!0,width:a,color:ie(t.color),effects:m})}else!t||"line-marker"!==e.type||"cross"!==e.style&&"x"!==e.style?[i,n]=ye(o):([i,n]=ye(o),s.push({type:"CIMSolidStroke",enable:!0,width:t,color:ie(a)}));s.push({type:"CIMSolidFill",enable:!0,color:ie(a)});const c={type:"CIMPolygonSymbol",symbolLayers:s};return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:F(-e.angle),size:F(l||6*t),offsetX:F(e.xoffset),offsetY:F(e.yoffset),scaleSymbolsProportionally:!1,frame:i,markerGraphics:[{type:"CIMMarkerGraphic",geometry:n,symbol:c}]}]}}static fromCIMHatchFill(e,r){const o=r*(e.separation??u.CIMHatchFill.separation),a=o/2,s=t(e.lineSymbol);s.symbolLayers?.forEach((e=>{switch(e.type){case"CIMSolidStroke":null!=e.width&&(e.width*=r),e.effects?.forEach((e=>{if("CIMGeometricEffectDashes"===e.type){const t=e.dashTemplate;e.dashTemplate=t.map((e=>e*r))}}));break;case"CIMVectorMarker":{null!=e.size&&(e.size*=r);const t=e.markerPlacement;null!=t&&"placementTemplate"in t&&(t.placementTemplate=t.placementTemplate.map((e=>e*r)));break}}}));let i=this._getLineSymbolPeriod(s)||H;for(;i<H;)i*=2;const n=i/2;return{type:"CIMVectorMarker",frame:{xmin:-n,xmax:n,ymin:-a,ymax:a},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[-n,0],[n,0]]]},symbol:s}],size:o}}static fetchResources(e,t,r,o=null){return e&&t?(te(e,(e=>{ue(e,t,r),"url"in e&&e.url&&r.push(t.fetchResource(e.url,{signal:o}))})),r):r}static fetchFonts(e,t,r){if(e&&t)if("symbolLayers"in e&&e.symbolLayers){for(const o of e.symbolLayers)if("CIMVectorMarker"===o.type&&o.markerGraphics)for(const e of o.markerGraphics)e?.symbol&&ee.fetchFonts(e.symbol,t,r)}else if("CIMTextSymbol"===e.type){const{fontFamilyName:o,fontStyleName:a}=e;if(!o||"calcitewebcoreicons"===o.toLowerCase())return;const{style:s,weight:i}=z(a),n=D(e),c=new l({family:o,style:s,weight:i,decoration:n});r.push(t.loadFont(c).catch((()=>{O().error(`Unsupported font ${o} in CIM symbol`)})))}}static _getLineSymbolPeriod(e){if(e){const t=this._getEffectsRepeat(e.effects);if(t)return t;if(e.symbolLayers)for(const r of e.symbolLayers)if(r){const e=this._getEffectsRepeat(r.effects);if(e)return e;switch(r.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=this._getPlacementRepeat(r.markerPlacement);if(e)return e}}}}return 0}static _getEffectsRepeat(e){if(e)for(const t of e)if(t)switch(t.type){case"CIMGeometricEffectDashes":{const e=t.dashTemplate;if(e&&e.length){let t=0;for(const r of e)t+=r;return 1&e.length&&(t*=2),t}break}case"CIMGeometricEffectWave":return t.period;default:O().error(`unsupported geometric effect type ${t.type}`)}return 0}static _getPlacementRepeat(e){if(e)switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const t=e.placementTemplate;if(t&&t.length){let e=0;for(const r of t)e+=+r;return 1&t.length&&(e*=2),e}break}}return 0}static fromCIMInsidePolygon(e){const t=e.markerPlacement,r={...e};r.markerPlacement=null,r.anchorPoint=null;const s=Math.abs(t.stepX),i=Math.abs(t.stepY),n=(t.randomness??100)/100;let l,c,m,f;if("Random"===t.gridType){const e=a(j),r=Math.max(Math.floor(e/s),1),y=Math.max(Math.floor(e/i),1);l=r*s/2,c=y*i/2,m=2*c;const h=new o(t.seed),u=n*s/1.5,p=n*i/1.5;f=[];for(let t=0;t<r;t++)for(let e=0;e<y;e++){const r=t*s-l+u*(.5-h.getFloat()),o=e*i-c+p*(.5-h.getFloat());f.push({x:r,y:o}),0===t&&f.push({x:r+2*l,y:o}),0===e&&f.push({x:r,y:o+2*c})}}else!0===t.shiftOddRows?(l=s/2,c=i,m=2*i,f=[{x:-l,y:0},{x:l,y:0},{x:0,y:c},{x:0,y:-c}]):(l=s/2,c=i/2,m=i,f=[{x:-s,y:0},{x:0,y:-i},{x:-s,y:-i},{x:0,y:0},{x:s,y:0},{x:0,y:i},{x:s,y:i},{x:-s,y:i},{x:s,y:-i}]);return{type:"CIMVectorMarker",frame:{xmin:-l,xmax:l,ymin:-c,ymax:c},markerGraphics:f.map((e=>({type:"CIMMarkerGraphic",geometry:e,symbol:{type:"CIMPointSymbol",symbolLayers:[r]}}))),size:m}}}function te(e,t){if(e)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const r=e.symbolLayers;if(!r)return;for(const e of r)if(t(e),"CIMVectorMarker"===e.type){const r=e.markerGraphics;if(!r)continue;for(const e of r)if(e){const r=e.symbol;r&&te(r,t)}}break}}}const re=e=>{if(!e)return p.Butt;switch(e){case"butt":return p.Butt;case"square":return p.Square;case"round":return p.Round}},oe=e=>{if(!e)return M.Miter;switch(e){case"miter":return M.Miter;case"round":return M.Round;case"bevel":return M.Bevel}},ae=e=>{if(null==e)return"Center";switch(e){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},se=e=>{if(null==e)return"Center";switch(e){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},ie=e=>{if(!e)return[0,0,0,0];const{r:t,g:r,b:o,a}=e;return[t,r,o,255*a]},ne=(e,t)=>{const r=le(t),o=ce(e);return r&&o?`${r}-${o}`:`${r}${o}`},le=e=>{if(!e)return"";switch(e.toLowerCase()){case"bold":case"bolder":return"bold"}return""},ce=e=>{if(!e)return"";switch(e.toLowerCase()){case"italic":case"oblique":return"italic"}return""},me=(e,t)=>{const r=has("safari")?.001:0,o="butt"===t;switch(e){case"dash":case"esriSLSDash":return o?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return o?[4,3,1,3]:[3,4,r,4];case"dot":case"esriSLSDot":return o?[1,3]:[r,4];case"long-dash":case"esriSLSLongDash":return o?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return o?[8,3,1,3]:[7,4,r,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return o?[8,3,1,3,1,3]:[7,4,r,4,r,4];case"short-dash":case"esriSLSShortDash":return o?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return o?[4,1,1,1]:[3,2,r,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return o?[4,1,1,1,1,1]:[3,2,r,2,r,2];case"short-dot":case"esriSLSShortDot":return o?[1,1]:[r,2];case"solid":case"esriSLSSolid":case"none":return O().error("Unexpected: style does not require rasterization"),[0,0];default:return O().error(`Tried to rasterize SLS, but found an unexpected style: ${e}!`),[0,0]}};function fe(e){return void 0!==e.symbolLayers}const ye=(e,t=100)=>{const r=t/2;let o,a;const s=e;if("circle"===s||"esriSMSCircle"===s){const e=.25;let t=Math.acos(1-e/r),s=Math.ceil(N/t/4);0===s&&(s=1),t=Y/s,s*=4;const i=[];i.push([r,0]);for(let o=1;o<s;o++)i.push([r*Math.cos(o*t),-r*Math.sin(o*t)]);i.push([r,0]),o={rings:[i]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("cross"===s||"esriSMSCross"===s){const e=0;o={paths:[[[e,r],[e,-r]],[[r,e],[-r,e]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("diamond"===s||"esriSMSDiamond"===s)o={rings:[[[-r,0],[0,r],[r,0],[0,-r],[-r,0]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("square"===s||"esriSMSSquare"===s)o={rings:[[[-r,-r],[-r,r],[r,r],[r,-r],[-r,-r]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("x"===s||"esriSMSX"===s)o={paths:[[[r,r],[-r,-r]],[[r,-r],[-r,r]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("triangle"===s||"esriSMSTriangle"===s){const e=t*.5773502691896257,r=-e,s=2/3*t,i=s-t;o={rings:[[[r,i],[0,s],[e,i],[r,i]]]},a={xmin:r,ymin:i,xmax:e,ymax:s}}else"arrow"===s&&(o={rings:[[[-50,50],[50,0],[-50,-50],[-33,-20],[-33,20],[-50,50]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r});return[a,o]},he=e=>"vertical"===e||"horizontal"===e||"cross"===e||"esriSFSCross"===e||"esriSFSVertical"===e||"esriSFSHorizontal"===e;function ue(e,t,r){if(!e.effects||null!=t.geometryEngine)return;if(t.geometryEnginePromise)return void r.push(t.geometryEnginePromise);E(e.effects)&&(t.geometryEnginePromise=G(),r.push(t.geometryEnginePromise),t.geometryEnginePromise.then((e=>t.geometryEngine=e)))}function pe(e){if(!e)return null;let t=null;const{cap:r,color:o,join:a,miterLimit:s,style:i,width:n}=e;return"solid"!==i&&"none"!==i&&"esriSLSSolid"!==i&&"esriSLSNull"!==i&&(t=[{type:"CIMGeometricEffectDashes",dashTemplate:me(i,r),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),{type:"CIMSolidStroke",color:"esriSLSNull"!==i&&"none"!==i?ie(o):[0,0,0,0],capStyle:re(r),joinStyle:oe(a),miterLimit:s,width:n,effects:t}}export{ee as CIMSymbolHelper,Z as CIMSymbolInflatedSizeHelper,re as capTypeToEnum,Q as getEffectsInflateSize,me as slsDashToTemplateArray,W as symbolToCIM};
|
|
5
|
+
import{bidiText as e}from"../../core/BidiText.js";import has from"../../core/has.js";import{clone as t}from"../../core/lang.js";import r from"../../core/Logger.js";import o from"../../core/RandomLCG.js";import{px2pt as a}from"../../core/screenUtils.js";import{create as s,expandPointInPlace as i}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as n}from"../../geometry/support/boundsUtils.js";import l from"../Font.js";import{Placement as c}from"./CIMPlacements.js";import{EnvDrawHelper as m,Transformation as f,CanvasDrawHelper as y,lineGapType2LineHeight as h}from"./CIMSymbolDrawHelper.js";import{defaultCIMValues as u}from"./defaultCIMValues.js";import{LineCapStyle as p,LineJoinStyle as M,TextureFilter as S,ExtremityPlacement as d,BlockProgression as g,FontEffects as b,FontEncoding as C,FontType as I,GlyphHinting as x,TextReadingDirection as k,VerticalGlyphOrientation as w,BillBoardMode as P,LineDashEnding as L}from"./enums.js";import{getNumericValue as F,fromCIMFontStyle as z,fromCIMFontDecoration as D,isGeometryEngineRequired as E,importGeometryEngine as G}from"./utils.js";import{defaultPolylineSymbol2D as T}from"../support/defaults.js";import{cInfinity as v}from"../../views/2d/engine/vectorTiles/GeometryUtils.js";import{glyphSize as A,magicLabelLineHeight as R,randomInsidePolygonTextureSize as j}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as B}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as X,getLineWidth as V}from"../../views/2d/layers/graphics/graphicsUtils.js";const N=Math.PI,Y=N/2,_=Math.PI/180,U=96/72,q=1.4142135623730951,H=4,O=()=>r.getLogger("esri.symbols.cim.CIMSymbolHelper");function W(e){let t;switch(e.type){case"cim":return e.data;case"web-style":return e;case"simple-marker":{const r=ee.fromSimpleMarker(e);if(!r)throw new Error("InternalError: Cannot convert symbol to CIM");t=r;break}case"picture-marker":t=ee.fromPictureMarker(e);break;case"simple-line":t=ee.fromSimpleLineSymbol(e);break;case"simple-fill":t=ee.fromSimpleFillSymbol(e);break;case"picture-fill":t=ee.fromPictureFillSymbol(e);break;case"text":t=ee.fromTextSymbol(e)}return{type:"CIMSymbolReference",symbol:t}}function $(e,t,r){switch(t.type){case"CIMSymbolReference":return $(e,t.symbol,r);case"CIMPointSymbol":null==r&&(r={x:0,y:0}),e.drawSymbol(t,r);break;case"CIMLineSymbol":null==r&&(r={paths:[[[0,0],[10,0]]]}),e.drawSymbol(t,r);break;case"CIMPolygonSymbol":null==r&&(r={rings:[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}),e.drawSymbol(t,r);break;case"CIMTextSymbol":{const r={x:0,y:0};e.drawSymbol(t,r);break}case"CIMVectorMarker":{const r=new c;e.drawMarker(t,r);break}}return e.envelope()}function J(e){if(!e)return 0;switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAtExtremities":case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementAtRatioPositions":case"CIMMarkerPlacementOnLine":case"CIMMarkerPlacementOnVertices":return Math.abs(e.offset);default:return 0}}function K(e){if(!e)return 0;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(F(e.offsetX)),Math.abs(F(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function Q(e){if(!e)return 0;let t=0;for(const r of e)t+=K(r);return t}class Z{static getSymbolInflateSize(e,t,r,o,a){return e||(e=[0,0,0,0]),t?this._getInflateSize(e,t,r,o,a):e}static safeSize(e){const t=Math.max(Math.abs(e[0]),Math.abs(e[2])),r=Math.max(Math.abs(e[1]),Math.abs(e[3]));return Math.sqrt(t*t+r*r)}static _vectorMarkerBounds(e,t,r,o){let a=!0;const i=s();if(t?.markerGraphics)for(const s of t.markerGraphics){const t=[0,0,0,0];s.geometry&&(n(i,s.geometry),t[0]=0,t[1]=0,t[2]=0,t[3]=0,this.getSymbolInflateSize(t,s.symbol,r,0,o),i[0]+=t[0],i[1]+=t[1],i[2]+=t[2],i[3]+=t[3],a?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],a=!1):(e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[2]),e[3]=Math.max(e[3],i[3])))}return e}static _getInflateSize(e,t,r,o,a){if(fe(t)){const s=this._getLayersInflateSize(e,t.symbolLayers,r,o,a),i=Q(t.effects);return i>0&&(s[0]-=i,s[1]-=i,s[2]+=i,s[3]+=i),s}return this._getTextInflatedSize(e,t,a)}static _getLayersInflateSize(e,t,r,o,a){let n=!0;if(!t)return e;for(const l of t){if(!l)continue;let t=[0,0,0,0];switch(l.type){case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=l;let r=e.width;null!=r&&(e.capStyle===p.Square||e.joinStyle===M.Miter?r/=q:r/=2,t[0]=-r,t[1]=-r,t[2]=r,t[3]=r);break}case"CIMCharacterMarker":case"CIMVectorMarker":case"CIMPictureMarker":{const e=l;if("CIMVectorMarker"===l.type){const e=l;if(t=this._vectorMarkerBounds(t,e,r,a),e.frame){const r=(e.frame.xmin+e.frame.xmax)/2,o=(e.frame.ymin+e.frame.ymax)/2;if(t[0]-=r,t[1]-=o,t[2]-=r,t[3]-=o,null!=e.size){const r=e.size/(e.frame.ymax-e.frame.ymin);t[0]*=r,t[1]*=r,t[2]*=r,t[3]*=r}}}else if("CIMPictureMarker"===l.type){const o=l,a=r.getResource(o.url);let s=1;if(null!=a&&a.height&&(s=a.width/a.height),null!=e.size){const r=e.size/2,a=e.size*s*o.scaleX/2;t=[-a,-r,a,r]}}else if(null!=e.size){const r=e.size/2;t=[-r,-r,r,r]}if(e.anchorPoint){let r,o;"Absolute"===e.anchorPointUnits?(r=e.anchorPoint.x,o=e.anchorPoint.y):(r=e.anchorPoint.x*(t[2]-t[0]),o=e.anchorPoint.y*(t[3]-t[1]));const a=1.25*Math.sqrt(r*r+o*o);t[0]-=a,t[1]-=a,t[2]+=a,t[3]+=a}let n=F(e.rotation);if(e.rotateClockwise&&(n=-n),o&&(n-=o),n){const e=_*n,r=Math.cos(e),o=Math.sin(e),a=s([v,v,-v,-v]);i(a,[t[0]*r-t[1]*o,t[0]*o+t[1]*r]),i(a,[t[0]*r-t[3]*o,t[0]*o+t[3]*r]),i(a,[t[2]*r-t[1]*o,t[2]*o+t[1]*r]),i(a,[t[2]*r-t[3]*o,t[2]*o+t[3]*r]),t=a}let c=F(e.offsetX),m=F(e.offsetY);if(o){const e=_*o,t=Math.cos(e),r=Math.sin(e),a=c*r+m*t;c=c*t-m*r,m=a}t[0]+=c,t[1]+=m,t[2]+=c,t[3]+=m;const f=J(e.markerPlacement);f>0&&(t[0]-=f,t[1]-=f,t[2]+=f,t[3]+=f);break}}const c=Q(l.effects);c>0&&(t[0]-=c,t[1]-=c,t[2]+=c,t[3]+=c),n?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],n=!1):(e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3]))}return e}static _getTextInflatedSize(e,t,r){const o=X(t.height??u.CIMTextSymbol.height);if(e[0]=-o/2,e[1]=-o/2,e[2]=o/2,e[3]=o/2,!r)return e;const a=r.get(t);if(!a)return e;if(!a.glyphMosaicItems.glyphs.length)return e;const{lineGapType:s,lineGap:i}=t,n=s?h(s,i??0,o):0,l="CIMBackgroundCallout"===t.callout?.type,c=B(a.glyphMosaicItems,{scale:o/A,angle:F(t.angle),xOffset:F(t.offsetX),yOffset:F(t.offsetY),horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:V(t.lineWidth),lineHeight:R*Math.max(.25,Math.min(n||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}).boundsT,m=Math.sqrt(c.width*c.width+c.height*c.height);return e[0]-=c.x+m,e[1]-=c.y-m,e[2]+=c.x+m,e[3]+=-c.y+m,e}}class ee{static getEnvelope(e,t,r){if(!e)return null;const o=new m(r);if(Array.isArray(e)){let r;for(const a of e)r?r.union($(o,a,t)):r=$(o,a,t);return r}return $(o,e,t)}static getTextureAnchor(e,t){const r=this.getEnvelope(e,null,t);if(!r)return[0,0,0];const o=(r.x+.5*r.width)*U,a=(r.y+.5*r.height)*U,s=r.width*U+2,i=r.height*U+2;return[-o/s,-a/i,i]}static rasterize(e,t,r,o,a=!0){const s=r||this.getEnvelope(t,null,o);if(!s)return[null,0,0,0,0];const i=(s.x+.5*s.width)*U,n=(s.y+.5*s.height)*U;e.width=s.width*U,e.height=s.height*U,r||(e.width+=2,e.height+=2);const l=e.getContext("2d",{willReadFrequently:!0}),m=f.createScale(U,-U);m.translate(.5*e.width-i,.5*e.height+n);const h=new y(l,o,m);switch(t.type){case"CIMPointSymbol":{const e={type:"point",x:0,y:0};h.drawSymbol(t,e);break}case"CIMVectorMarker":{const e=new c;h.drawMarker(t,e);break}}const u=l.getImageData(0,0,e.width,e.height),p=new Uint8Array(u.data);if(a){let e;for(let t=0;t<p.length;t+=4)e=p[t+3]/255,p[t]=p[t]*e,p[t+1]=p[t+1]*e,p[t+2]=p[t+2]*e}return[p,e.width,e.height,-i/e.width,-n/e.height]}static fromTextSymbol(e){const{text:t}=e;return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:10,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:ee.createCIMTextSymbolfromTextSymbol(e),textString:t}],scaleSymbolsProportionally:!0,respectFrame:!0}],scaleX:1,angleAlignment:"Display"}}static fromPictureFillSymbol(e){const{height:t,outline:r,width:o,xoffset:a,xscale:s,yoffset:i,yscale:n}=e,l=[],c={type:"CIMPolygonSymbol",symbolLayers:l};if(r){const e=pe(r);e&&l.push(e)}let m=e.url;"esriPFS"===e.type&&e.imageData&&(m=e.imageData);const f="angle"in e?e.angle??0:0,y=(o??0)*(s||1),h=(t??0)*(n||1);return l.push({type:"CIMPictureFill",invertBackfaceTexture:!1,scaleX:1,textureFilter:S.Picture,tintColor:null,url:m,height:h,width:y,offsetX:F(a),offsetY:F(i),rotation:F(-f),colorSubstitutions:null}),c}static fromSimpleFillSymbol(e){const{color:r,style:o,outline:s}=e,i=[],n={type:"CIMPolygonSymbol",symbolLayers:i};if(s){const e=pe(s);e&&i.push(e)}if(o&&"solid"!==o&&"none"!==o&&"esriSFSSolid"!==o&&"esriSFSNull"!==o){const e={type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",color:ie(r),capStyle:p.Butt,joinStyle:M.Miter,width:.75}]};let s=0;const n=a(he(o)?8:10);switch(o){case"vertical":case"esriSFSVertical":s=90;break;case"forward-diagonal":case"esriSFSForwardDiagonal":case"diagonal-cross":case"esriSFSDiagonalCross":s=-45;break;case"backward-diagonal":case"esriSFSBackwardDiagonal":s=45;break;case"cross":case"esriSFSCross":s=0}i.push({type:"CIMHatchFill",lineSymbol:e,offsetX:0,offsetY:0,rotation:s,separation:n}),"cross"===o||"esriSFSCross"===o?i.push({type:"CIMHatchFill",lineSymbol:t(e),offsetX:0,offsetY:0,rotation:90,separation:n}):"diagonal-cross"!==o&&"esriSFSDiagonalCross"!==o||i.push({type:"CIMHatchFill",lineSymbol:t(e),offsetX:0,offsetY:0,rotation:45,separation:n})}else!o||"solid"!==o&&"esriSFSSolid"!==o||i.push({type:"CIMSolidFill",enable:!0,color:ie(r)});return n}static fromSimpleLineSymbol(e){const{cap:t,color:r,join:o,marker:a,miterLimit:s,style:i,width:n}=e;let l=null;"solid"!==i&&"none"!==i&&"esriSLSSolid"!==i&&"esriSLSNull"!==i&&(l=[{type:"CIMGeometricEffectDashes",dashTemplate:me(i,t),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);const c=[];if(a){let e;switch(a.placement){case"begin-end":e=d.Both;break;case"begin":e=d.JustBegin;break;case"end":e=d.JustEnd;break;default:e=d.None}const t=ee.fromSimpleMarker(a,n,r).symbolLayers[0];t.markerPlacement={type:"CIMMarkerPlacementAtExtremities",placePerPart:!1,angleToLine:!0,offset:0,extremityPlacement:e,offsetAlongLine:0},c.push(t)}return c.push({type:"CIMSolidStroke",color:"none"!==i&&"esriSLSNull"!==i?ie(r):[0,0,0,0],capStyle:re(t),joinStyle:oe(o),miterLimit:s,width:n,effects:l}),{type:"CIMLineSymbol",symbolLayers:c}}static fromPictureMarker(e){const{angle:t,height:r,width:o,xoffset:a,yoffset:s}=e;let i=e.url;return"esriPMS"===e.type&&e.imageData&&(i=e.imageData),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:S.Picture,tintColor:null,url:i,size:r,width:o,offsetX:F(a),offsetY:F(s),rotation:F(-t)}]}}static createCIMTextSymbolfromTextSymbol(t){const{angle:r,color:o,font:a,haloColor:s,haloSize:i,horizontalAlignment:n,kerning:l,lineWidth:c,text:m,verticalAlignment:f,xoffset:y,yoffset:h,backgroundColor:u,borderLineColor:p,borderLineSize:M}=t;let S,d,L,z,D,E;a&&(S=a.family,d=a.style,L=a.weight,z=a.size,D=a.decoration);let G=!1;if(m){G=e(m)[1]}return(u||M)&&(E={type:"CIMBackgroundCallout",margin:null,backgroundSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",color:ie(u)},{type:"CIMSolidStroke",color:ie(p),width:M}]},accentBarSymbol:null,gap:null,leaderLineSymbol:null,lineStyle:null}),{type:"CIMTextSymbol",angle:r,blockProgression:g.BTT,depth3D:1,extrapolateBaselines:!0,fontEffects:b.Normal,fontEncoding:C.Unicode,fontFamilyName:S||"Arial",fontStyleName:ne(d,L),fontType:I.Unspecified,haloSize:i,height:z,hinting:x.Default,horizontalAlignment:ae(n??"center"),kerning:l,letterWidth:100,ligatures:!0,lineGapType:"Multiple",lineWidth:c,offsetX:F(y),offsetY:F(h),strikethrough:"line-through"===D,underline:"underline"===D,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ie(o)}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ie(s)}]},shadowColor:[0,0,0,255],shadowOffsetX:1,shadowOffsetY:1,textCase:"Normal",textDirection:G?k.RTL:k.LTR,verticalAlignment:se(f??"baseline"),verticalGlyphOrientation:w.Right,wordSpacing:100,billboardMode3D:P.FaceNearPlane,callout:E}}static createPictureMarkerRasterizationParam(e){const{angle:t,height:r,width:o,xoffset:a,yoffset:s}=e,i=e.url??e.source?.url??e.source?.imageData;return i?{type:"sprite-rasterization-param",overrides:[],resource:{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:S.Picture,tintColor:null,url:i,size:r,width:o,offsetX:F(a),offsetY:F(s),rotation:F(-t)}}:null}static createPictureFillRasterizationParam(e){const{width:t,height:r,xoffset:o,yoffset:a,url:s}=e;return s?{type:"sprite-rasterization-param",overrides:[],resource:{type:"CIMPictureFill",scaleX:1,textureFilter:S.Picture,tintColor:null,url:s,width:t,height:r,offsetX:F(o),offsetY:F(a),rotation:0}}:null}static fromSimpleMarker(e,t,r){const{style:o}=e,a=e.color??r;if("path"===o||"esriSMSPath"===o){const t=[];if("outline"in e&&e.outline){const r=e.outline;t.push({type:"CIMSolidStroke",enable:!0,width:r.width,color:ie(r.color),path:e.path})}t.push({type:"CIMSolidFill",enable:!0,color:ie(a),path:e.path});const[r,o]=ye("square");return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:-F(e.angle),size:F(e.size||6),offsetX:F(e.xoffset),offsetY:F(e.yoffset),scaleSymbolsProportionally:!1,frame:r,markerGraphics:[{type:"CIMMarkerGraphic",geometry:o,symbol:{type:"CIMPolygonSymbol",symbolLayers:t}}]}]}}const s=[];let i,n,l=e.size;if("outline"in e&&e.outline&&"none"!==e.outline.style&&"esriSLSNull"!==e.outline.style){const t=e.outline,r="solid"!==t.style&&"esriSLSSolid"!==t.style;[i,n]=r?ye(o,e.size):ye(o);const a=t.width??T.width;if(r){const t=a/e.size,r=(i.xmax-i.xmin)*t/2,o=(i.ymax-i.ymin)*t/2;i.xmin-=r,i.xmax+=r,i.ymin-=o,i.ymax+=o,l&&(l+=a)}const c="cross"!==e.style&&"x"!==e.style||"dot"===e?.outline.style||"short-dot"===e?.outline.style?L.HalfGap:L.FullPattern,m=r?[{type:"CIMGeometricEffectAddControlPoints"},{type:"CIMGeometricEffectDashes",dashTemplate:me(t.style,null).map((e=>t.width&&t.width>0?e*t.width:e)),lineDashEnding:c,controlPointEnding:L.FullPattern}]:void 0;s.push({type:"CIMSolidStroke",capStyle:r?p.Round:p.Butt,enable:!0,width:a,color:ie(t.color),effects:m})}else!t||"line-marker"!==e.type||"cross"!==e.style&&"x"!==e.style?[i,n]=ye(o):([i,n]=ye(o),s.push({type:"CIMSolidStroke",enable:!0,width:t,color:ie(a)}));s.push({type:"CIMSolidFill",enable:!0,color:ie(a)});const c={type:"CIMPolygonSymbol",symbolLayers:s};return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:F(-e.angle),size:F(l||6*t),offsetX:F(e.xoffset),offsetY:F(e.yoffset),scaleSymbolsProportionally:!1,frame:i,markerGraphics:[{type:"CIMMarkerGraphic",geometry:n,symbol:c}]}]}}static fromCIMHatchFill(e,r){const o=r*(e.separation??u.CIMHatchFill.separation),a=o/2,s=t(e.lineSymbol);s.symbolLayers?.forEach((e=>{switch(e.type){case"CIMSolidStroke":null!=e.width&&(e.width*=r),e.effects?.forEach((e=>{if("CIMGeometricEffectDashes"===e.type){const t=e.dashTemplate;e.dashTemplate=t?.map((e=>e*r))}}));break;case"CIMVectorMarker":{null!=e.size&&(e.size*=r);const t=e.markerPlacement;null!=t&&"placementTemplate"in t&&(t.placementTemplate=t.placementTemplate.map((e=>e*r)));break}}}));let i=this._getLineSymbolPeriod(s)||H;for(;i<H;)i*=2;const n=i/2;return{type:"CIMVectorMarker",frame:{xmin:-n,xmax:n,ymin:-a,ymax:a},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[-n,0],[n,0]]]},symbol:s}],size:o}}static fetchResources(e,t,r,o=null){return e&&t?(te(e,(e=>{ue(e,t,r),"url"in e&&e.url&&r.push(t.fetchResource(e.url,{signal:o}))})),r):r}static fetchFonts(e,t,r){if(e&&t)if("symbolLayers"in e&&e.symbolLayers){for(const o of e.symbolLayers)if("CIMVectorMarker"===o.type&&o.markerGraphics)for(const e of o.markerGraphics)e?.symbol&&ee.fetchFonts(e.symbol,t,r)}else if("CIMTextSymbol"===e.type){const{fontFamilyName:o,fontStyleName:a}=e;if(!o||"calcitewebcoreicons"===o.toLowerCase())return;const{style:s,weight:i}=z(a),n=D(e),c=new l({family:o,style:s,weight:i,decoration:n});r.push(t.loadFont(c).catch((()=>{O().error(`Unsupported font ${o} in CIM symbol`)})))}}static _getLineSymbolPeriod(e){if(e){const t=this._getEffectsRepeat(e.effects);if(t)return t;if(e.symbolLayers)for(const r of e.symbolLayers)if(r){const e=this._getEffectsRepeat(r.effects);if(e)return e;switch(r.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=this._getPlacementRepeat(r.markerPlacement);if(e)return e}}}}return 0}static _getEffectsRepeat(e){if(e)for(const t of e)if(t)switch(t.type){case"CIMGeometricEffectDashes":{const e=t.dashTemplate;if(e&&e.length){let t=0;for(const r of e)t+=r;return 1&e.length&&(t*=2),t}break}case"CIMGeometricEffectWave":return t.period;default:O().error(`unsupported geometric effect type ${t.type}`)}return 0}static _getPlacementRepeat(e){if(e)switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const t=e.placementTemplate;if(t&&t.length){let e=0;for(const r of t)e+=+r;return 1&t.length&&(e*=2),e}break}}return 0}static fromCIMInsidePolygon(e){const t=e.markerPlacement,r={...e};r.markerPlacement=null,r.anchorPoint=null;const s=Math.abs(t.stepX),i=Math.abs(t.stepY),n=(t.randomness??100)/100;let l,c,m,f;if("Random"===t.gridType){const e=a(j),r=Math.max(Math.floor(e/s),1),y=Math.max(Math.floor(e/i),1);l=r*s/2,c=y*i/2,m=2*c;const h=new o(t.seed),u=n*s/1.5,p=n*i/1.5;f=[];for(let t=0;t<r;t++)for(let e=0;e<y;e++){const r=t*s-l+u*(.5-h.getFloat()),o=e*i-c+p*(.5-h.getFloat());f.push({x:r,y:o}),0===t&&f.push({x:r+2*l,y:o}),0===e&&f.push({x:r,y:o+2*c})}}else!0===t.shiftOddRows?(l=s/2,c=i,m=2*i,f=[{x:-l,y:0},{x:l,y:0},{x:0,y:c},{x:0,y:-c}]):(l=s/2,c=i/2,m=i,f=[{x:-s,y:0},{x:0,y:-i},{x:-s,y:-i},{x:0,y:0},{x:s,y:0},{x:0,y:i},{x:s,y:i},{x:-s,y:i},{x:s,y:-i}]);return{type:"CIMVectorMarker",frame:{xmin:-l,xmax:l,ymin:-c,ymax:c},markerGraphics:f.map((e=>({type:"CIMMarkerGraphic",geometry:e,symbol:{type:"CIMPointSymbol",symbolLayers:[r]}}))),size:m}}}function te(e,t){if(e)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const r=e.symbolLayers;if(!r)return;for(const e of r)if(t(e),"CIMVectorMarker"===e.type){const r=e.markerGraphics;if(!r)continue;for(const e of r)if(e){const r=e.symbol;r&&te(r,t)}}break}}}const re=e=>{if(!e)return p.Butt;switch(e){case"butt":return p.Butt;case"square":return p.Square;case"round":return p.Round}},oe=e=>{if(!e)return M.Miter;switch(e){case"miter":return M.Miter;case"round":return M.Round;case"bevel":return M.Bevel}},ae=e=>{if(null==e)return"Center";switch(e){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},se=e=>{if(null==e)return"Center";switch(e){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},ie=e=>{if(!e)return[0,0,0,0];const{r:t,g:r,b:o,a}=e;return[t,r,o,255*a]},ne=(e,t)=>{const r=le(t),o=ce(e);return r&&o?`${r}-${o}`:`${r}${o}`},le=e=>{if(!e)return"";switch(e.toLowerCase()){case"bold":case"bolder":return"bold"}return""},ce=e=>{if(!e)return"";switch(e.toLowerCase()){case"italic":case"oblique":return"italic"}return""},me=(e,t)=>{const r=has("safari")?.001:0,o="butt"===t;switch(e){case"dash":case"esriSLSDash":return o?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return o?[4,3,1,3]:[3,4,r,4];case"dot":case"esriSLSDot":return o?[1,3]:[r,4];case"long-dash":case"esriSLSLongDash":return o?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return o?[8,3,1,3]:[7,4,r,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return o?[8,3,1,3,1,3]:[7,4,r,4,r,4];case"short-dash":case"esriSLSShortDash":return o?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return o?[4,1,1,1]:[3,2,r,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return o?[4,1,1,1,1,1]:[3,2,r,2,r,2];case"short-dot":case"esriSLSShortDot":return o?[1,1]:[r,2];case"solid":case"esriSLSSolid":case"none":return O().error("Unexpected: style does not require rasterization"),[0,0];default:return O().error(`Tried to rasterize SLS, but found an unexpected style: ${e}!`),[0,0]}};function fe(e){return void 0!==e.symbolLayers}const ye=(e,t=100)=>{const r=t/2;let o,a;const s=e;if("circle"===s||"esriSMSCircle"===s){const e=.25;let t=Math.acos(1-e/r),s=Math.ceil(N/t/4);0===s&&(s=1),t=Y/s,s*=4;const i=[];i.push([r,0]);for(let o=1;o<s;o++)i.push([r*Math.cos(o*t),-r*Math.sin(o*t)]);i.push([r,0]),o={rings:[i]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("cross"===s||"esriSMSCross"===s){const e=0;o={paths:[[[e,r],[e,-r]],[[r,e],[-r,e]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("diamond"===s||"esriSMSDiamond"===s)o={rings:[[[-r,0],[0,r],[r,0],[0,-r],[-r,0]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("square"===s||"esriSMSSquare"===s)o={rings:[[[-r,-r],[-r,r],[r,r],[r,-r],[-r,-r]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("x"===s||"esriSMSX"===s)o={paths:[[[r,r],[-r,-r]],[[r,-r],[-r,r]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("triangle"===s||"esriSMSTriangle"===s){const e=t*.5773502691896257,r=-e,s=2/3*t,i=s-t;o={rings:[[[r,i],[0,s],[e,i],[r,i]]]},a={xmin:r,ymin:i,xmax:e,ymax:s}}else"arrow"===s&&(o={rings:[[[-50,50],[50,0],[-50,-50],[-33,-20],[-33,20],[-50,50]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r});return[a,o]},he=e=>"vertical"===e||"horizontal"===e||"cross"===e||"esriSFSCross"===e||"esriSFSVertical"===e||"esriSFSHorizontal"===e;function ue(e,t,r){if(!e.effects||null!=t.geometryEngine)return;if(t.geometryEnginePromise)return void r.push(t.geometryEnginePromise);E(e.effects)&&(t.geometryEnginePromise=G(),r.push(t.geometryEnginePromise),t.geometryEnginePromise.then((e=>t.geometryEngine=e)))}function pe(e){if(!e)return null;let t=null;const{cap:r,color:o,join:a,miterLimit:s,style:i,width:n}=e;return"solid"!==i&&"none"!==i&&"esriSLSSolid"!==i&&"esriSLSNull"!==i&&(t=[{type:"CIMGeometricEffectDashes",dashTemplate:me(i,r),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),{type:"CIMSolidStroke",color:"esriSLSNull"!==i&&"none"!==i?ie(o):[0,0,0,0],capStyle:re(r),joinStyle:oe(a),miterLimit:s,width:n,effects:t}}export{ee as CIMSymbolHelper,Z as CIMSymbolInflatedSizeHelper,re as capTypeToEnum,Q as getEffectsInflateSize,me as slsDashToTemplateArray,W as symbolToCIM};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e,collectMultipath as s}from"../../../geometry/geometryCursorCollectUtils.js";import{getPathLength as r}from"../../../geometry/support/coordsUtils.js";import{PathEffectCursor as i}from"../CIMCursor.js";import{LineDashEnding as a}from"../enums.js";import{GeometryWalker as n,DashPattern as h}from"../GeometryWalker.js";import{normalizeDashTemplate as l}from"../utils.js";const o=1e3;class
|
|
5
|
+
import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e,collectMultipath as s}from"../../../geometry/geometryCursorCollectUtils.js";import{getPathLength as r}from"../../../geometry/support/coordsUtils.js";import{PathEffectCursor as i}from"../CIMCursor.js";import{LineDashEnding as a}from"../enums.js";import{GeometryWalker as n,DashPattern as h}from"../GeometryWalker.js";import{normalizeDashTemplate as l}from"../utils.js";const o=1e3,u=1e-7;class _{static local(){return null===_.instance&&(_.instance=new _),_.instance}execute(t,e,s,r,i){return new p(t,e,s,r)}}_.instance=null;class p extends i{constructor(t,e,s,r){super(t,!0,!0),this._firstCurve=null,this._walker=new n,this._walker.updateTolerance(s),this._endings=e.lineDashEnding,this._customDashPos=-(e.offsetAlongLine??0)*s,this._offsetAtEnd=(e.customEndingOffset??0)*s,this._tileKey=r;let i=l(e).dashTemplate;null==i&&(i=[]),i.length%2&&(i=[...i,...i]);let a=0;for(let n=0;n<i.length;n++){let t=Math.abs(i[n]);t<u&&(t=u),a+=t}this._patternLength=a,this._numOfDashesPerPattern=i.length/2,this._pattern=new h,this._pattern.init(i,!0),this._pattern.scale(s)}processPath(s){if(0===this._pattern.length()){this.iteratePath=!1;const r=e(s);return t.fromJSONCIM({paths:[r]})}if(!this.iteratePath){let r=!0;switch(this._endings){case a.HalfPattern:case a.HalfGap:default:this._pattern.extPtGap=0;break;case a.FullPattern:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.firstValue());break;case a.FullGap:this.isClosed||(this._pattern.extPtGap=.5*this._pattern.lastValue());break;case a.NoConstraint:this.isClosed||(r=!1);break;case a.Custom:this.isClosed||(this._pattern.extPtGap=.5*this._offsetAtEnd)}const i=s.pathLength();if(this._pattern.isEmpty()||i<.1*this._pattern.length()){const r=e(s);return t.fromJSONCIM({paths:[r]})}if(!this._walker.init(s,this._pattern,r)){const r=e(s);return t.fromJSONCIM({paths:[r]})}}let r;if(this.iteratePath)r=this._pattern.nextValue();else{let t;switch(this._endings){case a.HalfPattern:default:t=.5*this._pattern.firstValue();break;case a.HalfGap:t=.5*-this._pattern.lastValue();break;case a.FullGap:t=-this._pattern.lastValue();break;case a.FullPattern:t=0;break;case a.NoConstraint:case a.Custom:t=-this._customDashPos}let e=t/this._pattern.length();e-=Math.floor(e),t=e*this._pattern.length(),this._pattern.reset(),r=this._pattern.nextValue();let s=!1;for(;t>=r;)t-=r,r=this._pattern.nextValue(),s=!s;r-=t,s?(this._walker.nextPosition(r),r=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(r),r=this._pattern.nextValue(),this._walker.nextPosition(r),r=this._pattern.nextValue())}let i=this._walker.nextCurve(r);if(i)if(this._walker.isPathEnd()){if(this.iteratePath=!1,this._firstCurve){for(this._firstCurve.nextPath();this._firstCurve.nextPoint();)i.pushXY(this._firstCurve.x,this._firstCurve.y);this._firstCurve=null}}else r=this._pattern.nextValue(),!this._walker.nextPosition(r)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(i.pushCursor(this._firstCurve),this._firstCurve=null)):this.iteratePath=!0;else this.iteratePath=!1,i=this._firstCurve,this._firstCurve=null;return i?.reset(),i}isClippingRequired(t){const e=s(t);let i=0;for(const s of e)i+=r(s);return Math.round(this._numOfDashesPerPattern*(i/this._patternLength))>o}}export{_ as EffectDashes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{packFloatRGBA as o}from"../../core/floatRGBA.js";import{nextPowerOfTwo as t}from"../../core/mathUtils.js";import{dashRadius as a}from"./constants.js";const r=o=>"vertical"===o||"horizontal"===o||"cross"===o||"esriSFSCross"===o||"esriSFSVertical"===o||"esriSFSHorizontal"===o;function e(o,a,e){const i=a.style,n=t(Math.ceil(e)),s=r(i)?8*n:16*n,l=2*n;o.width=s,o.height=s;const h=o.getContext("2d");h.strokeStyle="#FFFFFF",h.lineWidth=n,h.beginPath(),"vertical"!==i&&"cross"!==i&&"esriSFSCross"!==i&&"esriSFSVertical"!==i||(h.moveTo(s/2,-l),h.lineTo(s/2,s+l)),"horizontal"!==i&&"cross"!==i&&"esriSFSCross"!==i&&"esriSFSHorizontal"!==i||(h.moveTo(-l,s/2),h.lineTo(s+l,s/2)),"backward-diagonal"!==i&&"diagonal-cross"!==i&&"esriSFSDiagonalCross"!==i&&"esriSFSBackwardDiagonal"!==i||(h.moveTo(-l,-l),h.lineTo(s+l,s+l),h.moveTo(s-l,-l),h.lineTo(s+l,l),h.moveTo(-l,s-l),h.lineTo(l,s+l)),"forward-diagonal"!==i&&"diagonal-cross"!==i&&"esriSFSForwardDiagonal"!==i&&"esriSFSDiagonalCross"!==i||(h.moveTo(s+l,-l),h.lineTo(-l,s+l),h.moveTo(l,-l),h.lineTo(-l,l),h.moveTo(s+l,s-l),h.lineTo(s-l,s+l)),h.stroke();const c=h.getImageData(0,0,o.width,o.height),m=new Uint8Array(c.data);let S;for(let t=0;t<m.length;t+=4)S=m[t+3]/255,m[t]=m[t]*S,m[t+1]=m[t+1]*S,m[t+2]=m[t+2]*S;return[m,o.width,o.height,n]}function i(t,r){const e="Butt"===r,i="Square"===r,n=!e&&!i;t.length%2==1&&(t=[...t,...t]);const s=a,l=2*s;let h=0;for(const o of t)h+=o;const c=Math.round(h*s),m=new Float32Array(c*l),S=.5*s;let F=0,g=0,T=.5,d=!0;for(const o of t){for(F=g,g+=o*s;T<=g;){let o=.5;for(;o<l;){const t=(o-.5)*c+T-.5,a=n?(o-s)*(o-s):Math.abs(o-s);m[t]=d?e?Math.max(Math.max(F+S-T,a),Math.max(T-g+S,a)):a:n?Math.min((T-F)*(T-F)+a,(T-g)*(T-g)+a):i?Math.min(Math.max(T-F,a),Math.max(g-T,a)):Math.min(Math.max(T-F+S,a),Math.max(g+S-T,a)),o++}T++}d=!d}const f=m.length,M=new Uint8Array(4*f);for(let a=0;a<f;++a){const t=(n?Math.sqrt(m[a]):m[a])/s;o(t,M,4*a)}return[M,c,l]}export{i as rasterizeDash,e as rasterizeFillStyle};
|
|
5
|
+
import{packFloatRGBA as o}from"../../core/floatRGBA.js";import{nextPowerOfTwo as t}from"../../core/mathUtils.js";import{dashRadius as a}from"./constants.js";const r=o=>"vertical"===o||"horizontal"===o||"cross"===o||"esriSFSCross"===o||"esriSFSVertical"===o||"esriSFSHorizontal"===o;function e(o,a,e){const i=a.style,n=t(Math.ceil(e)),s=r(i)?8*n:16*n,l=2*n;o.width=s,o.height=s;const h=o.getContext("2d");h.strokeStyle="#FFFFFF",h.lineWidth=n,h.beginPath(),"vertical"!==i&&"cross"!==i&&"esriSFSCross"!==i&&"esriSFSVertical"!==i||(h.moveTo(s/2,-l),h.lineTo(s/2,s+l)),"horizontal"!==i&&"cross"!==i&&"esriSFSCross"!==i&&"esriSFSHorizontal"!==i||(h.moveTo(-l,s/2),h.lineTo(s+l,s/2)),"backward-diagonal"!==i&&"diagonal-cross"!==i&&"esriSFSDiagonalCross"!==i&&"esriSFSBackwardDiagonal"!==i||(h.moveTo(-l,-l),h.lineTo(s+l,s+l),h.moveTo(s-l,-l),h.lineTo(s+l,l),h.moveTo(-l,s-l),h.lineTo(l,s+l)),"forward-diagonal"!==i&&"diagonal-cross"!==i&&"esriSFSForwardDiagonal"!==i&&"esriSFSDiagonalCross"!==i||(h.moveTo(s+l,-l),h.lineTo(-l,s+l),h.moveTo(l,-l),h.lineTo(-l,l),h.moveTo(s+l,s-l),h.lineTo(s-l,s+l)),h.stroke();const c=h.getImageData(0,0,o.width,o.height),m=new Uint8Array(c.data);let S;for(let t=0;t<m.length;t+=4)S=m[t+3]/255,m[t]=m[t]*S,m[t+1]=m[t+1]*S,m[t+2]=m[t+2]*S;return[m,o.width,o.height,n]}function i(t,r){null==t&&(t=[]);const e="Butt"===r,i="Square"===r,n=!e&&!i;t.length%2==1&&(t=[...t,...t]);const s=a,l=2*s;let h=0;for(const o of t)h+=o;const c=Math.round(h*s),m=new Float32Array(c*l),S=.5*s;let F=0,g=0,T=.5,d=!0;for(const o of t){for(F=g,g+=o*s;T<=g;){let o=.5;for(;o<l;){const t=(o-.5)*c+T-.5,a=n?(o-s)*(o-s):Math.abs(o-s);m[t]=d?e?Math.max(Math.max(F+S-T,a),Math.max(T-g+S,a)):a:n?Math.min((T-F)*(T-F)+a,(T-g)*(T-g)+a):i?Math.min(Math.max(T-F,a),Math.max(g-T,a)):Math.min(Math.max(T-F+S,a),Math.max(g+S-T,a)),o++}T++}d=!d}const f=m.length,M=new Uint8Array(4*f);for(let a=0;a<f;++a){const t=(n?Math.sqrt(m[a]):m[a])/s;o(t,M,4*a)}return[M,c,l]}export{i as rasterizeDash,e as rasterizeFillStyle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import r from"../../core/Collection.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let n=class extends o{constructor(e){super(e),this.layers=new r,this.lockType="none",this.tables=new r,this.versionInfo=null,this.versionService=null}get layersAndTables(){return new r([...this.layers.toArray(),...this.tables.toArray()])}updateLockType(){this.lockType=this.versionInfo?this.versionService.getLockType(this.versionInfo.versionIdentifier)??"none":"none"}get featureServiceVersion(){return this.featureService.sourceJSON?.currentVersion??0}};e([t({constructOnly:!0})],n.prototype,"canCreateVersion",void 0),e([t({constructOnly:!0})],n.prototype,"canEditVersionedData",void 0),e([t({constructOnly:!0})],n.prototype,"featureService",void 0),e([t({constructOnly:!0})],n.prototype,"layers",void 0),e([t()],n.prototype,"layersAndTables",null),e([t()],n.prototype,"lockType",void 0),e([t({constructOnly:!0})],n.prototype,"tables",void 0),e([t()],n.prototype,"versionInfo",void 0),e([t({constructOnly:!0})],n.prototype,"versionService",void 0),e([t(
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import r from"../../core/Collection.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let n=class extends o{constructor(e){super(e),this.layers=new r,this.lockType="none",this.tables=new r,this.versionInfo=null,this.versionService=null}get layersAndTables(){return new r([...this.layers.toArray(),...this.tables.toArray()])}updateLockType(){this.lockType=this.versionInfo?this.versionService.getLockType(this.versionInfo.versionIdentifier)??"none":"none"}get featureServiceVersion(){return this.featureService.sourceJSON?.currentVersion??0}};e([t({constructOnly:!0})],n.prototype,"canCreateVersion",void 0),e([t({constructOnly:!0})],n.prototype,"canEditVersionedData",void 0),e([t({constructOnly:!0})],n.prototype,"featureService",void 0),e([t({constructOnly:!0})],n.prototype,"layers",void 0),e([t()],n.prototype,"layersAndTables",null),e([t()],n.prototype,"lockType",void 0),e([t({constructOnly:!0})],n.prototype,"tables",void 0),e([t()],n.prototype,"versionInfo",void 0),e([t({constructOnly:!0})],n.prototype,"versionService",void 0),e([t()],n.prototype,"hasAdvancedEditingUserTypeExtension",void 0),e([t()],n.prototype,"loggedInServiceUser",void 0),e([t()],n.prototype,"featureServiceVersion",null),n=e([s("esri.undoredo.support.ServiceVersionInfo")],n);export{n as ServiceVersionInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as t}from"../../../../../core/mathUtils.js";import{labelPlacementOffsetPadding as s}from"../definitions.js";import{StaticBitSet as i}from"../../../layers/features/support/StaticBitSet.js";const e=1,h=0,o=1,r=2;class l{constructor(t,s,h){this.
|
|
5
|
+
import{clamp as t}from"../../../../../core/mathUtils.js";import{labelPlacementOffsetPadding as s}from"../definitions.js";import{StaticBitSet as i}from"../../../layers/features/support/StaticBitSet.js";const e=1,h=0,o=1,r=2;class l{constructor(t,s,h){this._width=t*h,this._height=s*h,this._pixelRatio=h;const o=Math.ceil(this._width/e),r=Math.ceil(this._height/e);this._cols=o,this._rows=r,this._cells=i.create(o*r)}insertMetrics(t){this._markMetrics(t)}hasCollision(t){let i=0;for(const{computedX:e,computedY:h,width:l,height:c}of t.bounds){const t=(l+s)*this._pixelRatio,a=(c+s)*this._pixelRatio;switch(this._collide(e,h,t,a)){case r:return r;case o:i++}}return i===t.bounds.length?o:h}getCellId(t,s){return t+s*this._cols}has(t){return this._cells.has(t)}hasRange(t,s){return this._cells.hasRange(t,s)}set(t){this._cells.set(t)}setRange(t,s){this._cells.setRange(t,s)}_collide(s,i,l,c){const a=s-l/2,n=i-c/2,_=a+l,f=n+c;if(_<0||f<0||a>this._width||n>this._height)return o;const u=t(Math.floor(a/e),0,this._cols),d=t(Math.floor(n/e),0,this._rows),m=t(Math.ceil(_/e),0,this._cols),p=t(Math.ceil(f/e),0,this._rows);for(let t=d;t<=p;t++)for(let s=u;s<=m;s++){const i=this.getCellId(s,t);if(this.has(i))return r}return h}_mark(s,i,h,o,r){const l=s-h/2,c=i-o/2,a=l+h,n=c+o,_=t(Math.floor(l/e),0,this._cols),f=t(Math.floor(c/e),0,this._rows),u=t(Math.ceil(a/e),0,this._cols),d=t(Math.ceil(n/e),0,this._rows);for(let t=f;t<=d;t++)for(let s=_;s<=u;s++){const i=this.getCellId(s,t);this.set(i)}return!1}_markMetrics(t){for(const{computedX:i,computedY:e,width:h,height:o}of t.bounds){const r=(h+s)*this._pixelRatio,l=(o+s)*this._pixelRatio;this._mark(i,e,r,l,t.entityTexel)}}}export{l as CollisionBitsetGrid,r as hasCollision,h as none,o as outsideExtent};
|