@arcgis/core 4.34.0-next.17 → 4.34.0-next.18
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{400a4c9fa62964f8fa1d.js → 1f48d6c76f0014064eca.js} +1 -1
- package/assets/esri/core/workers/chunks/3cf31e51266f40072f71.js +1 -0
- package/assets/esri/core/workers/chunks/4325fdd96d9ea344132e.js +1 -0
- package/assets/esri/core/workers/chunks/68374cf42a069436830d.js +1 -0
- package/assets/esri/core/workers/chunks/6f8de923519bb16af8ba.js +1 -0
- package/assets/esri/core/workers/chunks/85753105268aeff84e69.js +1 -0
- package/assets/esri/core/workers/chunks/8637b9cb30170ac4eae2.js +1 -0
- package/assets/esri/core/workers/chunks/872f151a3a2bc9052be0.js +1 -0
- package/assets/esri/core/workers/chunks/8b4a35e3ed39d8be3394.js +1 -0
- package/assets/esri/core/workers/chunks/{d33a5d79f2163ad62b1d.js → 9965961bad09910f577b.js} +1 -1
- package/assets/esri/core/workers/chunks/9d499a37b960273c3f84.js +1 -0
- package/assets/esri/core/workers/chunks/a507192771e5f4f82973.js +1 -0
- package/assets/esri/core/workers/chunks/a9e1caf05c81055ae194.js +1 -0
- package/assets/esri/core/workers/chunks/{1415d4e2f5f3193be004.js → aa4ae0e54a0507e8dd0f.js} +1 -1
- package/assets/esri/core/workers/chunks/d3bfd0c382c2f39a787b.js +1 -0
- package/assets/esri/core/workers/chunks/d6df12bed626d56cd6b2.js +1 -0
- package/assets/esri/core/workers/chunks/e0146db608959ead9c97.js +1 -0
- package/assets/esri/core/workers/chunks/f4442a2b40e44f90b461.js +1 -0
- package/assets/esri/core/workers/chunks/{fa5715ca3ce95d005b0a.js → faa892ad4cc8a90b6c79.js} +1 -1
- package/assets/esri/themes/base/widgets/_Legend.scss +2 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/chunks/sphere.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/trackingUtils.js +1 -1
- package/core/sql.js +1 -1
- package/geometry/spatialReferenceEllipsoidUtils.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +38 -33
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/transformations/updateElevation.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/TitleCreator.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/video/VideoCameraSensorModel.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/support/drapedUtils.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Legend/styles/support/sizeRampUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/assets/esri/core/workers/chunks/254c4f7e277ae9915dce.js +0 -1
- package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +0 -1
- package/assets/esri/core/workers/chunks/49a57dc1e6d1048fa949.js +0 -1
- package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +0 -1
- package/assets/esri/core/workers/chunks/52239e958a82ebcd2e7a.js +0 -1
- package/assets/esri/core/workers/chunks/78a57f5aeb277b84b3da.js +0 -1
- package/assets/esri/core/workers/chunks/802c6b1a6cb9264b8e4f.js +0 -1
- package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +0 -1
- package/assets/esri/core/workers/chunks/932808e485f305b6a26a.js +0 -1
- package/assets/esri/core/workers/chunks/beb01d400f1aa089d2dc.js +0 -1
- package/assets/esri/core/workers/chunks/cfc5e0ec9b0290407383.js +0 -1
- package/assets/esri/core/workers/chunks/d2139307f62ea8bf999a.js +0 -1
- package/assets/esri/core/workers/chunks/ddb66fe6fcd0764daa7a.js +0 -1
- package/assets/esri/core/workers/chunks/eac7af86166c09c6a9be.js +0 -1
- package/assets/esri/core/workers/chunks/ec49e2849766402ad5c7.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{rad2deg as n,deg2rad as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as u,f as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projectionUtils.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as w,isElevationSource as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,u,m]=a;F(i,o,r,c);const p=F(s,l,u,m),M=V(i,o,r,c),g=V(s,l,u,m),v=f(e(),M),d=h(e(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function S(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=S(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=D(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],h=c[2],u=e();return u[0]=s*t[0],u[1]=l*n[0],u[2]=h*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=h*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=h*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=h,u[15]=1,u}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,e,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const H={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function N(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function q(t,n=!0){return N(t,H.OPK,n)}function U(t,n=!0){return N(t,H.HPR,n)}function k(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function A(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function K(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=n(O);return[n(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function W(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=Y(t,i);return X(e,o,n,a)}function X(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Y(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function Z(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function J(t,n,a,i=E/2){const{heading:e,pitch:o}=W(t,n,a);return Z(e,o,i)}async function $(t,a,i){const e=await g(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?U([i.heading,i.pitch,i.roll]):U([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>y(t?.elevationSource)&&null!=t?.extent,Mt=t=>w(t?.elevationSource),gt=async(t,n,a)=>null!=n&&(mt(n)||Mt(n))?n:pt(n)?{elevationSample:await b({...p(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent},a),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:n,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,h=i();l(h,r);const p=2*Math.tan(a(f)/2)*e*s,M=2*Math.tan(a(o)/2)*e*s,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*s,s),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,p/2,s),y=R(x,M/2,s),O=u(c(),w,y),b=m(c(),w,y);return[m(c(),v,O),m(c(),v,b),u(c(),v,O),u(c(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,k as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Z as convertHeadingPitchToSphereVertex,X as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,W as convertPixelToHeadingPitch,Y as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,N as createRotationMatrix,U as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,A as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,K as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,z as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
|
|
5
|
+
import t from"../../../core/Error.js";import{rad2deg as n,deg2rad as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as h,f as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as v}from"../../../geometry/projectionUtils.js";import{earth as g}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isConstantElevation as w,ConstantElevation as y,isElevationSource as O}from"../core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as b}from"../core/utils.js";import{getElevationSampler as j}from"./updateElevationUtils.js";import{isNumber as E}from"../../../support/guards.js";import{defaultImageSphereSize as S}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,h,m]=a;F(i,o,r,c);const p=F(s,l,h,m),M=V(i,o,r,c),v=V(s,l,h,m),g=f(e(),M),d=u(e(),g,v),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function R(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=R(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=H(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],u=c[2],h=e();return h[0]=s*t[0],h[1]=l*n[0],h[2]=u*a[0],h[3]=0,h[4]=s*t[1],h[5]=l*n[1],h[6]=u*a[1],h[7]=0,h[8]=s*t[2],h[9]=l*n[2],h[10]=u*a[2],h[11]=0,h[12]=s,h[13]=l,h[14]=u,h[15]=1,h}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function D(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function H(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,e,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const N={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function q(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function U(t,n=!0){return q(t,N.OPK,n)}function k(t,n=!0){return q(t,N.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),u=a(c),h=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-u,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(h*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-h+M*Math.sin(f)]}function W(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,u=a(c),h=a(s),m=l/Math.sqrt(1-f*Math.sin(u)**2),p=e/m,M=o/m,v=r/m,g=Math.cos(u)-Math.sin(u)*M+Math.cos(u)*v,d=Math.sin(u)+Math.cos(u)*M+Math.sin(u)*v,x=Math.sqrt(g**2+p**2),w=f*m*Math.sin(u),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(u),b=Math.atan(e/(m*g))+h,j=n(O);return[n(b),j,e/(Math.cos(O)*Math.sin(b-h))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function T(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function X(t,n,a,i=S/2){const{heading:e,pitch:o}=Z(t,i);return Y(e,o,n,a)}function Y(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Z(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function G(t,n,i=S/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function J(t,n,a,i=S/2){const{heading:e,pitch:o}=T(t,n,a);return G(e,o,i)}async function $(t,a,i){const e=await v(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const Q=t=>t.toArray(),_=(...t)=>t.some((t=>t));function tt(t,n){if(_(0===t.length,t.some((({x:t,y:n})=>_(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function nt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function at(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function it(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/g.radius))):1}const et=t=>n=>new M(n,t),ot=t=>null!=t&&"queryExtent"in t;function rt(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function ct({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(st);return null!=s&<(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function st(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function lt(t){return null!=t[1]&&null!=t[5]}function ft(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=St(t,t.location.spatialReference),u=r??(l.z??0)-i;return{...mt(t,n,a),averageElevation:u,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ut(t,n,a,i){return yt(i)?U([i.omega,i.phi,i.kappa]):Ot(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=St(t,t.location.spatialReference);return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function mt(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:u,cameraRoll:h,focalLength:m,horizontalFieldOfView:p,location:M,matrix:v,principalX:g,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=ct({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=v??ut(l,u,h,f),E=null!=g&&null!=d?[g,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const pt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,Mt=t=>O(t?.elevationSource)&&null!=t?.extent,vt=t=>w(t?.elevationSource),gt=async(t,n,a,i,e)=>{const o=b(t),r=n-a/o;return vt(i)?(i.elevationSource=new y({constantElevation:i.elevationSource.constantElevation/o}),i):pt(i)?i:Mt(i)?{elevationSample:await j({...p(i.elevationSource)?i.elevationSource.toJSON():i.elevationSource,extent:i.extent},e),elevationSource:new y({constantElevation:r})}:{averageGroundElevation:r,spatialReference:t}},dt=t=>E(t?.heading)&&E(t?.pitch),xt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function wt(t){const{cameraLocation:n,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,u=i();l(u,r);const p=2*Math.tan(a(f)/2)*e*s,M=2*Math.tan(a(o)/2)*e*s,v=L([0,0,-1],u),g=C([n.x,n.y,n.z],v,t.farDistance*s,s),d=L([0,1,0],u),x=L([1,0,0],u),w=D(d,p/2,s),y=D(x,M/2,s),O=h(c(),w,y),b=m(c(),w,y);return[m(c(),g,O),m(c(),g,b),h(c(),g,O),h(c(),g,b)]}const yt=t=>2===t?.type,Ot=t=>1===t?.type;function bt(t){const n=t%360;return n<-180?n+360:n}function jt(t,n,a){if("panoramic"===t){const[t,i]=a;return X({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var Et;function St(t,n,a=!0){const i=b(n),e=a?t.clone():t;return e.cameraHeight/=i,e.farDistance/=i,e.nearDistance/=i,w(e.elevationSource)&&(e.elevationSource.constantElevation/=i),e}!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(Et||(Et={}));export{wt as computeFarplaneVertices,A as computeHFOVAndVFOV,rt as computeNewReferenceCoordinates,G as convertHeadingPitchToSphereVertex,Y as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,T as convertPixelToHeadingPitch,Z as convertSphereVertexToOrientation,X as convertSphereVertexToPixelLocation,St as convertToSRUnits,q as createRotationMatrix,k as createRotationMatrixFromHPR,U as createRotationMatrixFromOPK,K as geographicToLTP,ct as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,ft as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,it as getWebMercatorScalingFactor,mt as getWorldToImageProperties,dt as hasAngles,Ot as hasHeadingPitchRoll,yt as hasOmegaPhiKappa,ot as isElevationSampler,pt as isUpdateElevationWithElevationSampler,Mt as isUpdateElevationWithElevationSource,vt as isUpdateUsingConstantElevation,lt as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,bt as normalizeHeading,_ as or,Q as pointToArray,z as projectiveTransform,xt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,D as scaleWithFactor,jt as transformGraphicCoordinatesToPixel,L as transformMat3,H as transformMat4,tt as validatePixelsToTransform,nt as validatePointsToTransform,at as validateRotationMatrix,et as vecToPoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import l from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as h}from"../../core/accessorSupport/layerContainerType.js";import b from"../../form/FormTemplate.js";import g from"../../geometry/SpatialReference.js";import{labelsVisible as j,legendEnabled as v,minScale as w,maxScale as F,popupEnabled as I}from"./commonProperties.js";import{createQuery as T,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import S from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import q from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as R}from"./subtypeGroupLayerUtils.js";import P from"./TitleCreator.js";import L from"../../renderers/SimpleRenderer.js";import _ from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as M,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";import V from"../../tables/AttributeTableTemplate.js";const $=C();let U=0;function k(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=h),e}function Q(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=h),e?.target&&(t.write.target=e.target)),t}function B(e){return new L({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return M.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function W(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function Z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=W(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new S({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let z=class extends(p(r.ClonableMixin(o.IdentifiableMixin(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${U++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new P({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find((e=>e.name===t));if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++})),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find((e=>e.code===r)),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t?.length||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(Y("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&J(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(n=new L({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??g.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[Z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=W(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw Y("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatureCount");return r.parent.queryFeatureCount(K(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");return r.parent.queryFeatures(K(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Y("queryObjectIds");return r.parent.queryObjectIds(K(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],z.prototype,"_titleCreator",null),e([y({type:V,json:Q({name:"attributeTableInfo"})})],z.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"effectiveCapabilities",null),e([y({json:Q()})],z.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:Q({name:"enableEditing"})})],z.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],z.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],z.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],z.prototype,"fieldOverrides",void 0),e([f("fieldOverrides")],z.prototype,"writeFieldOverrides",null),e([y({...$.fields,readOnly:!0,json:{read:!1}})],z.prototype,"fields",null),e([y($.fieldsIndex)],z.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"floorInfo",null),e([y({type:b,json:Q({name:"formInfo"})})],z.prototype,"formTemplate",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),e([y(k(n(j)))],z.prototype,"labelsVisible",void 0),e([y({type:[q],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"layerType",void 0),e([y(k(n(v)))],z.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],z.prototype,"listMode",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"minScale",void 0),e([y((()=>{const e=n(F);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"maxScale",void 0),e([y({readOnly:!0})],z.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:Q({spatialOnly:!0})})],z.prototype,"opacity",void 0),e([y({clonable:!1})],z.prototype,"parent",void 0),e([y(k(n(I)))],z.prototype,"popupEnabled",void 0),e([y({type:t,json:Q({name:"popupInfo"})})],z.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"relationships",null),e([y({types:R,json:Q({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],z.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","subtypeField","type"])],z.prototype,"readRendererFromService",null),e([c("renderer",["layerDefinition.drawingInfo.renderer"])],z.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"subtypeField",null),e([y({type:[S],json:Q({name:"layerDefinition.templates"})})],z.prototype,"templates",void 0),e([c("service","templates",["geometryType","subtypeField","subtypes","type"])],z.prototype,"readTemplatesFromService",null),e([y({type:String,json:Q()})],z.prototype,"title",void 0),e([c("service","title",["subtypes"])],z.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"url",null),e([y({readOnly:!0})],z.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:Q({name:"visibility",spatialOnly:!0})})],z.prototype,"visible",void 0),z=e([m("esri.layers.support.SubtypeSublayer")],z);const K=(e,t,r)=>{if(!r)return t.createQuery();const i=_.from(r);return i.where=X(i.where,e.subtypeField,t.subtypeCode),i},X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},Y=e=>new i("subtype-sublayer:parent-missing",`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`);export{z as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import l from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as h}from"../../core/accessorSupport/layerContainerType.js";import b from"../../form/FormTemplate.js";import g from"../../geometry/SpatialReference.js";import{labelsVisible as j,legendEnabled as v,minScale as w,maxScale as F,popupEnabled as T}from"./commonProperties.js";import{createQuery as I,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import S from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import q from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as R}from"./subtypeGroupLayerUtils.js";import P from"./TitleCreator.js";import L from"../../renderers/SimpleRenderer.js";import _ from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as N,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";import $ from"../../tables/AttributeTableTemplate.js";const M=C();let U=0;function k(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=h),e}function Q(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=h),e?.target&&(t.write.target=e.target)),t}function B(e){return new L({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return N.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function W(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=W(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new S({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let K=class extends(p(r.ClonableMixin(o.IdentifiableMixin(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${U++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new P({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find((e=>e.name===t));if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++})),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find((e=>e.code===r)),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t?.length||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(Z("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Z("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&J(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(n=new L({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??g.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=W(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Z("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw Z("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Z("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Z("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw Z("createQuery");const e=I(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Z("queryAttachments");const i=e.clone();return i.where=Y(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Z("queryFeatureCount");return r.parent.queryFeatureCount(X(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Z("queryFeatures");return r.parent.queryFeatures(X(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Z("queryObjectIds");return r.parent.queryObjectIds(X(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Z("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Z("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],K.prototype,"_titleCreator",null),e([y({type:$,json:Q({name:"attributeTableInfo"})})],K.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"effectiveCapabilities",null),e([y({json:Q()})],K.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:Q({name:"enableEditing"})})],K.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],K.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],K.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],K.prototype,"fieldOverrides",void 0),e([f("fieldOverrides")],K.prototype,"writeFieldOverrides",null),e([y({...M.fields,readOnly:!0,json:{read:!1}})],K.prototype,"fields",null),e([y(M.fieldsIndex)],K.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"floorInfo",null),e([y({type:b,json:Q({name:"formInfo"})})],K.prototype,"formTemplate",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],K.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"type",void 0),e([y(k(n(j)))],K.prototype,"labelsVisible",void 0),e([y({type:[q],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0,layerContainerTypes:h}}})],K.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:h}}})],K.prototype,"layerType",void 0),e([y(k(n(v)))],K.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],K.prototype,"listMode",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],K.prototype,"minScale",void 0),e([y((()=>{const e=n(F);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],K.prototype,"maxScale",void 0),e([y({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:Q({spatialOnly:!0})})],K.prototype,"opacity",void 0),e([y({clonable:!1})],K.prototype,"parent",void 0),e([y(k(n(T)))],K.prototype,"popupEnabled",void 0),e([y({type:t,json:Q({name:"popupInfo"})})],K.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"relationships",null),e([y({types:R,json:Q({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],K.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","subtypeField","type"])],K.prototype,"readRendererFromService",null),e([c("renderer",["layerDefinition.drawingInfo.renderer"])],K.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],K.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"subtypeField",null),e([y({type:[S],json:Q({name:"layerDefinition.templates"})})],K.prototype,"templates",void 0),e([c("service","templates",["geometryType","subtypeField","subtypes","type"])],K.prototype,"readTemplatesFromService",null),e([y({type:String,json:Q()})],K.prototype,"title",void 0),e([c("service","title",["subtypes"])],K.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],K.prototype,"url",null),e([y({readOnly:!0})],K.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:Q({name:"visibility",spatialOnly:!0})})],K.prototype,"visible",void 0),K=e([m("esri.layers.support.SubtypeSublayer")],K);const X=(e,t,r)=>{if(!r)return t.createQuery();const i=_.from(r);return i.where=Y(i.where,e.subtypeField,t.subtypeCode),i},Y=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},Z=e=>new i("subtype-sublayer:parent-missing",`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`);export{K as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{featureHasFields as n,extractSubstitutionTemplatesFromString as l}from"./fieldUtils.js";import{loadArcade as c}from"../../support/loadArcade.js";const p="relationships/",d="expression/";let u=class extends t{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){if(this.expressionsUsedInTitle.length>0){return this._get("_arcadeTask")||i((()=>c()))}return null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??import("../../widgets/Feature/support/featureUtils.js").then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new r;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const s=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(s.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:s,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(s,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter((t=>e.includes(`{expression/${t.name.toLowerCase()}}`)))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some((e=>!0===e.invalid))}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const s of this.calculatedExpressions?.toArray()??[])try{const t=this._arcadeTask.value.arcade.extractFieldLiterals(s.syntax);for(const s of t){const t=s.split("."),i=this.fieldsIndex.get(t.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const s of t){const t=this.fieldsIndex.get(s);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,s){return(await this.getTitles(e,[t],s)).get(t)??""}async getTitles(e,t,s){const i=new Map,r=s?.timeZone??"system";try{const[{substituteFieldsInLinksAndAttributes:a}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);s?.fetchMissingFields&&(t=await this._checkAndReQueryGraphics(e,t));const{fieldInfoMap:o,workingTitle:n}=this,l=n&&o;t.forEach((t=>{const s=l?a({attributes:t.attributes,expressionAttributes:null,fieldInfoMap:o,globalAttributes:this._createFormattedAttributes(e,t,r).global,layer:e,text:n}):"";i.set(t,s)}))}catch{}return i}async _checkAndReQueryGraphics(e,t){const i=t.map((t=>t.getObjectId()??t.attributes[e.objectIdField])).filter(s);if(i.length!==t.length)return t;if(t.some((e=>!n(e,this.requiredFields)))){const s=e.createQuery();s.where="1=1",s.outFields=[...this.requiredFields],s.objectIds=i;const r=await e.queryFeatures(s);if(r?.features.length===t.length)return r.features}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const s of e){if(!s.fieldName)continue;const e=this.fieldsIndex.get(s.fieldName),i=e?.name??s.fieldName;s.fieldName=i,t.set(i.toLowerCase(),s)}return t}_createFormattedAttributes(e,t,s="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],r={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const s=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{r[`expression/${e.name}`]=e.func({vars:{$feature:s}})}catch{}}const a={...t.attributes,...r};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:a,graphic:t,timeZone:s,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return l(e).filter((e=>!(0===e.indexOf(p)||0===e.indexOf(d))))}};e([a({readOnly:!0})],u.prototype,"_arcadeTask",null),e([a()],u.prototype,"_featureUtils",void 0),e([a({readOnly:!0})],u.prototype,"featureUtilsPromise",null),e([a({readOnly:!0})],u.prototype,"calculatedExpressions",null),e([a()],u.prototype,"displayField",void 0),e([a()],u.prototype,"effectivePopupTemplate",void 0),e([a()],u.prototype,"expressionsUsedInTitle",null),e([a()],u.prototype,"fieldsIndex",void 0),e([a()],u.prototype,"fieldInfoMap",null),e([a()],u.prototype,"fields",void 0),e([a()],u.prototype,"objectIdField",void 0),e([a()],u.prototype,"requiredFields",null),u=e([o("esri.layers.support.TitleCreator")],u);export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{DomainValidationError as l,getDomainRange as o}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as s}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as a,isString as u}from"../../support/guards.js";import{loadArcade as f}from"../../support/loadArcade.js";const c=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function p(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(c,"F$1")||null}const m=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],y=["field","normalizationField"];function g(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(F(m,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)F(y,e,n)}function F(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function I(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function w(e,n){return e&&n?(b.clear(),T(b,e,n),Array.from(b).sort()):[]}function T(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function h(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map((e=>e.name)):n}function E(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=w(e,n);return t.length/e.fields.length>=i?["*"]:t}async function A(e,n,i){if(!i)return;let t;const r=s(i);if(r)t=[r];else{const{arcadeUtils:e}=await f();t=e.extractFieldNames(i,n?.fields?.map((e=>e.name)))}for(const l of t)x(e,n,l)}async function _(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});T(n,i,l.fieldNames)}}function v({displayField:e,fields:n}){return e||(n?.length?N(n,"name-or-title")||N(n,"unique-identifier")||N(n,"type-or-category")||S(n):null)}function S(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function N(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function $(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function O(e,n,i){i.onStatisticExpression?A(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function D(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(V(e,n,r)),i.fields&&t.push(...i.fields.map((async i=>O(e,n.fieldsIndex,i)))),await Promise.all(t)}async function M(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(V(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Z(e,i,n));await Promise.all(r)}async function V(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map((i=>A(e,n.fieldsIndex,i.expression))));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(A(e,n.fieldsIndex,l.expressionInfo.expression));await Promise.all(t)}async function R(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&T(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&T(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await _(e,n.fieldsIndex,i.where))}async function j(e,n,i){n&&i&&await Promise.all(i.map((i=>U(e,n,i))))}async function U(e,n,i){n&&i&&(i.valueExpression?await A(e,n.fieldsIndex,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?w(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?w(e.fieldsIndex,Y(e)):[]}function G(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?w(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function P(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map((n=>_(e,t,n.where))))}const q=new Set(["oid","global-id","guid"]),X=new Set(["oid","global-id"]),z=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/perimeter/i,/objectid/i,/_i$/i];function B(e){const n=new Set;J(e).forEach((e=>n.add(e))),G(e).forEach((e=>n.add(e.toLowerCase())));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach((e=>n.add(e.toLowerCase()))),Object.values(i.transformFieldRoles).forEach((e=>n.add(e.toLowerCase())))),Array.from(n)}function Y(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return Y(e).map((e=>e.toLowerCase()))}function W(e,n){return e.editable&&!q.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||X.has(e.type)||z.some((e=>e.test(i))))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map((n=>Z(e,t,n))))}async function Z(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await A(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach((i=>{x(e,n,i.slice(1,-1))}))}await _(e,n,r)}function ee(e){const n=e.defaultValue;return void 0!==n&&oe(e,n)?n:e.nullable?null:void 0}function ne(e){const n="string"==typeof e?{type:e}:e;return Fe(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ie(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function te(e){return null===e||ie(e)}function re(e){return null===e||Number.isInteger(e)}function le(){return!0}function oe(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?re:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?te:ie;break;case"string":case"esriFieldTypeString":i=e.nullable?a:u;break;default:i=le}return 1===arguments.length?i:i(n)}const se=["integer","small-integer","big-integer","long"],ae=["single","double"],ue=[...se,...ae],fe=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],ce=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...se,...fe]),pe=new Set([...ae,...ce]),me=t(de,pe);function ye(e){return null!=e&&de.has(e.type)}function ge(e){return null!=e&&me.has(e.type)}function Fe(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Ie(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function be(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function we(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function Te(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function he(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function Ee(e,n){return null===Se(e,n)}var Ae,_e;function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:oe(e,n)?ge(e)&&!Ne(e.type,Number(n))?Ae.OUT_OF_RANGE:null:_e.INVALID_TYPE}function Ne(e,n){const i="string"==typeof e?Le(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function $e(e,n){const i=o(e,n);return i||(ge(e)?Le(e.type):void 0)}function Le(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return De;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Me;case"esriFieldTypeBigInteger":case"big-integer":return Ve;case"esriFieldTypeSingle":case"single":return Re;case"esriFieldTypeDouble":case"double":return je}}function Oe(e){if(!ie(e))return null;if(Number.isInteger(e)){if(e>=De.min&&e<=De.max)return"esriFieldTypeSmallInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeInteger";if(e>=Ve.min&&e<=Ve.max)return"esriFieldTypeBigInteger"}return e>=Re.min&&e<=Re.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}!function(e){e.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"}(Ae||(Ae={})),function(e){e.INVALID_TYPE="type-validation-error::invalid-type"}(_e||(_e={}));const De={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Me={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Ve={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Re={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},je={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Ue(e,n,i){switch(e){case l.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case l.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case _e.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case Ae.OUT_OF_RANGE:{const{min:e,max:t}=Le(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function ke(e,n){return!Ce(e,n,null)}function Ce(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ge(e,n){const i=new Set;for(const t of n)await A(i,e.fieldsIndex,t);return Array.from(i).sort()}function Pe(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some((n=>e.toLowerCase().startsWith(n)))}async function qe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Xe(e){const n=e?.match(/{[^}]+}/g);return n?n.map((e=>e.slice(1,-1).split(":")[0].trim())):[]}export{Ae as NumericRangeValidationError,_e as TypeValidationError,Ve as bigIntegerRange,A as collectArcadeFieldNames,P as collectDisplayFilterFields,L as collectElevationFields,D as collectFeatureReductionFields,x as collectField,T as collectFields,R as collectFilterFields,Q as collectLabelingFields,j as collectOrderByInfos,V as collectPopupTemplateFields,M as collectTrackInfoFields,je as doubleRange,Xe as extractSubstitutionTemplatesFromString,ke as featureHasFields,w as fixFields,g as fixRendererFields,I as fixTimeInfoFields,ce as floatJSONTypes,ae as floatTypes,v as getDisplayFieldName,Y as getEditTrackingFields,$ as getElevationFields,Ge as getExpressionFields,C as getFeatureEditFields,G as getFeatureGeometryFields,ne as getFieldDefaultLength,ee as getFieldDefaultValue,$e as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,Oe as getNumericTypeForValue,qe as getRendererFields,k as getTimeFields,fe as integerJSONTypes,Me as integerRange,se as integerTypes,Ie as isDateField,be as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,he as isGlobalIDField,ye as isIntegerField,Ne as isNumberInRange,ge as isNumericField,xe as isObjectIDField,Pe as isRasterPixelValueField,Fe as isStringField,Te as isTimeOnlyField,we as isTimestampOffsetField,Ee as isValidFieldValue,oe as isValueMatchingFieldType,p as normalizeFieldName,ue as numericTypes,E as packFields,Ce as populateMissingFields,m as rendererFields,ve as sanitizeNullFieldValue,Re as singleRange,De as smallIntegerRange,h as unpackFieldNames,Se as validateFieldValue,Ue as validationErrorToString,y as visualVariableFields};
|
|
5
|
+
import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{DomainValidationError as l,getDomainRange as o}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as s}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as a,isString as u}from"../../support/guards.js";import{loadArcade as f}from"../../support/loadArcade.js";const c=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function p(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(c,"F$1")||null}const m=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],y=["field","normalizationField"];function g(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(F(m,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)F(y,e,n)}function F(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function I(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function w(e,n){return e&&n?(b.clear(),T(b,e,n),Array.from(b).sort()):[]}function T(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function h(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map((e=>e.name)):n}function _(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=w(e,n);return t.length/e.fields.length>=i?["*"]:t}async function E(e,n,i){if(!i)return;let t;const r=s(i);if(r)t=[r];else{const{arcadeUtils:e}=await f();t=e.extractFieldNames(i,n?.fields?.map((e=>e.name)))}for(const l of t)x(e,n,l)}async function A(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});T(n,i,l.fieldNames)}}function v({displayField:e,fields:n}){return e||(n?.length?N(n,"name-or-title")||N(n,"unique-identifier")||N(n,"type-or-category")||S(n):null)}function S(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function N(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function $(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function O(e,n,i){i.onStatisticExpression?E(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function D(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(V(e,n,r)),i.fields&&t.push(...i.fields.map((async i=>O(e,n.fieldsIndex,i)))),await Promise.all(t)}async function M(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(V(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Z(e,i,n));await Promise.all(r)}async function V(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map((i=>E(e,n.fieldsIndex,i.expression))));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(E(e,n.fieldsIndex,l.expressionInfo.expression));await Promise.all(t)}async function R(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&T(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&T(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await A(e,n.fieldsIndex,i.where))}async function j(e,n,i){n&&i&&await Promise.all(i.map((i=>U(e,n,i))))}async function U(e,n,i){n&&i&&(i.valueExpression?await E(e,n.fieldsIndex,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?w(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?w(e.fieldsIndex,Y(e)):[]}function G(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?w(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function P(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map((n=>A(e,t,n.where))))}const q=new Set(["oid","global-id","guid"]),X=new Set(["oid","global-id"]),z=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function B(e){const n=new Set;J(e).forEach((e=>n.add(e))),G(e).forEach((e=>n.add(e.toLowerCase())));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach((e=>n.add(e.toLowerCase()))),Object.values(i.transformFieldRoles).forEach((e=>n.add(e.toLowerCase())))),Array.from(n)}function Y(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return Y(e).map((e=>e.toLowerCase()))}function W(e,n){return e.editable&&!q.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||X.has(e.type)||z.some((e=>e.test(i))))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map((n=>Z(e,t,n))))}async function Z(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await E(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach((i=>{x(e,n,i.slice(1,-1))}))}await A(e,n,r)}function ee(e){const n=e.defaultValue;return void 0!==n&&oe(e,n)?n:e.nullable?null:void 0}function ne(e){const n="string"==typeof e?{type:e}:e;return Fe(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ie(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function te(e){return null===e||ie(e)}function re(e){return null===e||Number.isInteger(e)}function le(){return!0}function oe(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?re:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?te:ie;break;case"string":case"esriFieldTypeString":i=e.nullable?a:u;break;default:i=le}return 1===arguments.length?i:i(n)}const se=["integer","small-integer","big-integer","long"],ae=["single","double"],ue=[...se,...ae],fe=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],ce=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...se,...fe]),pe=new Set([...ae,...ce]),me=t(de,pe);function ye(e){return null!=e&&de.has(e.type)}function ge(e){return null!=e&&me.has(e.type)}function Fe(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Ie(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function be(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function we(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function Te(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function he(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function _e(e,n){return null===Se(e,n)}var Ee,Ae;function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:oe(e,n)?ge(e)&&!Ne(e.type,Number(n))?Ee.OUT_OF_RANGE:null:Ae.INVALID_TYPE}function Ne(e,n){const i="string"==typeof e?Le(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function $e(e,n){const i=o(e,n);return i||(ge(e)?Le(e.type):void 0)}function Le(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return De;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Me;case"esriFieldTypeBigInteger":case"big-integer":return Ve;case"esriFieldTypeSingle":case"single":return Re;case"esriFieldTypeDouble":case"double":return je}}function Oe(e){if(!ie(e))return null;if(Number.isInteger(e)){if(e>=De.min&&e<=De.max)return"esriFieldTypeSmallInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeInteger";if(e>=Ve.min&&e<=Ve.max)return"esriFieldTypeBigInteger"}return e>=Re.min&&e<=Re.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}!function(e){e.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"}(Ee||(Ee={})),function(e){e.INVALID_TYPE="type-validation-error::invalid-type"}(Ae||(Ae={}));const De={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Me={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Ve={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Re={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},je={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Ue(e,n,i){switch(e){case l.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case l.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case Ae.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case Ee.OUT_OF_RANGE:{const{min:e,max:t}=Le(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function ke(e,n){return!Ce(e,n,null)}function Ce(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ge(e,n){const i=new Set;for(const t of n)await E(i,e.fieldsIndex,t);return Array.from(i).sort()}function Pe(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some((n=>e.toLowerCase().startsWith(n)))}async function qe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Xe(e){const n=e?.match(/{[^}]+}/g);return n?n.map((e=>e.slice(1,-1).split(":")[0].trim())):[]}export{Ee as NumericRangeValidationError,Ae as TypeValidationError,Ve as bigIntegerRange,E as collectArcadeFieldNames,P as collectDisplayFilterFields,L as collectElevationFields,D as collectFeatureReductionFields,x as collectField,T as collectFields,R as collectFilterFields,Q as collectLabelingFields,j as collectOrderByInfos,V as collectPopupTemplateFields,M as collectTrackInfoFields,je as doubleRange,Xe as extractSubstitutionTemplatesFromString,ke as featureHasFields,w as fixFields,g as fixRendererFields,I as fixTimeInfoFields,ce as floatJSONTypes,ae as floatTypes,v as getDisplayFieldName,Y as getEditTrackingFields,$ as getElevationFields,Ge as getExpressionFields,C as getFeatureEditFields,G as getFeatureGeometryFields,ne as getFieldDefaultLength,ee as getFieldDefaultValue,$e as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,Oe as getNumericTypeForValue,qe as getRendererFields,k as getTimeFields,fe as integerJSONTypes,Me as integerRange,se as integerTypes,Ie as isDateField,be as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,he as isGlobalIDField,ye as isIntegerField,Ne as isNumberInRange,ge as isNumericField,xe as isObjectIDField,Pe as isRasterPixelValueField,Fe as isStringField,Te as isTimeOnlyField,we as isTimestampOffsetField,_e as isValidFieldValue,oe as isValueMatchingFieldType,p as normalizeFieldName,ue as numericTypes,_ as packFields,Ce as populateMissingFields,m as rendererFields,ve as sanitizeNullFieldValue,Re as singleRange,De as smallIntegerRange,h as unpackFieldNames,Se as validateFieldValue,Ue as validationErrorToString,y as visualVariableFields};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as o}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";import{fromValues as i,create as a}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as r,fromValues as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as n,transpose as h}from"../../core/libs/gl-matrix-2/math/mat3.js";import{e as m,b as g,d as u,o as c}from"../../chunks/vec32.js";import p from"../../geometry/Point.js";import d from"../../geometry/SpatialReference.js";import{WGS84ECEFSpatialReference as f}from"../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as v}from"../../geometry/projection/projectBuffer.js";import{earth as _}from"../../geometry/support/Ellipsoid.js";import{videoMetadataEntryId as A}from"./videoUtils.js";const M=Math.PI/180;let V=class extends e{constructor(t){super(),this.averageElevation=0,this.imageHeight=0,this.imageWidth=0,this.metadataSupportsTransforms=!1,this.platformHeadingAngle=0,this.platformPitchAngle=0,this.platformRollAngle=0,this.sensorHeadingAngle=0,this.sensorAltitude=0,this.sensorHorizontalFieldOfView=0,this.sensorLatitude=0,this.sensorLongitude=0,this.sensorPitchAngle=0,this.sensorRollAngle=0,this.sensorVerticalFieldOfView=0,this.vttMetadata=new Map,this._createMat3FromValues=t=>{const e=t[0],o=t[1],s=t[2];return i(e[0],o[0],s[0],e[1],o[1],s[1],e[2],o[2],s[2])},this._multiplyMat3=(t,e)=>{const o=a();return n(o,t,e),o},this._transposeMat3=t=>{const e=a();return h(e,t),e},this._calculateCameraFovForward=()=>this._createMat3FromValues([[0,0,1],[Math.tan(.5*this.sensorHorizontalFieldOfView*M),0,0],[0,Math.tan(.5*this.sensorVerticalFieldOfView*M),0]]),this._calculateCameraFovReverse=()=>this._createMat3FromValues([[0,1/Math.tan(.5*this.sensorHorizontalFieldOfView*M),0],[0,0,1/Math.tan(.5*this.sensorVerticalFieldOfView*M)],[1,0,0]]),this._calculateCameraLook=()=>this._getRotationMatrixZYX(this.sensorHeadingAngle*M,this.sensorPitchAngle*M,this.sensorRollAngle*M),this._calculateImageDimensionsForward=()=>this._createMat3FromValues([[2/this.imageWidth,0,-1],[0,-2/this.imageHeight,-1],[0,0,1]]),this._calculateImageDimensionsReverse=()=>this._createMat3FromValues([[this.imageWidth/2,0,this.imageWidth/2],[0,-this.imageHeight/2,-this.imageHeight/2],[0,0,1]]),this._calculatePlatformPositionMatrix=()=>{const t=Math.sin(this.sensorLatitude*M),e=Math.cos(this.sensorLatitude*M),o=Math.sin(this.sensorLongitude*M),s=Math.cos(this.sensorLongitude*M);return this._createMat3FromValues([[-t*s,-o,-e*s],[-t*o,s,-e*o],[e,0,-t]])},this._calculatePlatformOrientation=()=>this._getRotationMatrixZYX(this.platformHeadingAngle*M,this.platformPitchAngle*M,this.platformRollAngle*M),this._extractValues=t=>{this.imageWidth=t.get(A.EsriVideoWidth)?.value,this.imageHeight=t.get(A.EsriVideoHeight)?.value;const e=t.get(A.SensorEllipsoidHeight)?.value;this.sensorAltitude=e??t.get(A.SensorTrueAltitude)?.value,this.sensorLatitude=t.get(A.SensorLatitude)?.value,this.sensorLongitude=t.get(A.SensorLongitude)?.value,this.sensorHeadingAngle=t.get(A.SensorAzimuthAngle)?.value,this.sensorPitchAngle=t.get(A.SensorElevationAngle)?.value,this.sensorRollAngle=t.get(A.SensorRollAngle)?.value,this.sensorHorizontalFieldOfView=t.get(A.SensorHorizontalFOV)?.value,this.sensorVerticalFieldOfView=t.get(A.SensorVerticalFOV)?.value,this.platformHeadingAngle=t.get(A.PlatformHeadingAngle)?.value,this.platformPitchAngle=t.get(A.PlatformPitchAngle)?.value,this.platformRollAngle=t.get(A.PlatformRollAngle)?.value,this.averageElevation=t.get(A.FrameCenterElevation)?.value||0},this._getRotationMatrixZYX=(t,e,o)=>{const s=Math.cos(t),i=Math.sin(t),a=Math.cos(e),r=Math.sin(e),l=Math.cos(o),n=Math.sin(o);return this._createMat3FromValues([[s*a,s*r*n-l*i,i*n+s*l*r],[a*i,s*l+i*r*n,l*i*r-s*n],[-r,a*n,a*l]])},this._initCameraSensor=()=>{const t=this._calculateCameraFovForward(),e=this._calculateCameraFovReverse(),o=this._calculateCameraLook(),s=this._calculateImageDimensionsForward(),i=this._calculateImageDimensionsReverse(),a=this._calculatePlatformPositionMatrix(),r=this._calculatePlatformOrientation(),l=this._multiplyMat3(this._multiplyMat3(a,r),o);this._imageToEarthTransform=this._multiplyMat3(this._multiplyMat3(l,t),s);const n=this._multiplyMat3(i,e);this._earthToImageTransform=this._multiplyMat3(n,this._transposeMat3(l)),this._platformPositionEcef=this._projectPointToECEF(this.sensorLongitude,this.sensorLatitude,this.sensorAltitude||this.averageElevation)},this._metadataSupportsTransforms=t=>{if(!t?.size)return!1;const e=t.get(A.EsriVideoWidth)?.value??0,o=t.get(A.EsriVideoHeight)?.value??0;if(e<=0||o<=0)return!1;const s=t.get(A.SensorEllipsoidHeight)?.value,i=t.get(A.SensorTrueAltitude)?.value,a=t.get(A.SensorLatitude)?.value,r=t.get(A.SensorLongitude)?.value;if(null==s&&null==i||null==a||null==r)return!1;const l=t.get(A.PlatformHeadingAngle)?.value,n=t.get(A.PlatformPitchAngle)?.value,h=t.get(A.PlatformRollAngle)?.value;if(null==l||null==n||null==h)return!1;const m=t.get(A.SensorHorizontalFOV)?.value,g=t.get(A.SensorVerticalFOV)?.value;if(null==m||null==g)return!1;const u=t.get(A.SensorAzimuthAngle)?.value,c=t.get(A.SensorElevationAngle)?.value,p=t.get(A.SensorRollAngle)?.value;return null!=u&&null!=c&&null!=p},this._projectPointToECEF=(t,e,o)=>{const s=[];return v([t,e,o],d.WGS84,0,s,f,0),new p({x:s[0],y:s[1],z:s[2],spatialReference:f})},this._projectImageVectorToEllipsoid=(t,e)=>{const o=_.semiMajorAxis+e,s=_.semiMinorAxis+e,i=s/o,a=o/s,{x:n,y:h,z:u}=this._platformPositionEcef,c=u??this.averageElevation,p=l(n,h,a*c),d=m(t,t),f=m(t,p),v=m(p,p)-o*o,A=(-f-Math.sqrt(f*f-d*v))/d;if(A<0)return[NaN,NaN,NaN];const M=r();return g(M,p,t,A),M[2]=M[2]*i,M};const e=t?.videoMetadata;this._set("metadataSupportsTransforms",this._metadataSupportsTransforms(
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as o}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";import{fromValues as i,create as a}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as r,fromValues as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as n,transpose as h}from"../../core/libs/gl-matrix-2/math/mat3.js";import{e as m,b as g,d as u,o as c}from"../../chunks/vec32.js";import p from"../../geometry/Point.js";import d from"../../geometry/SpatialReference.js";import{WGS84ECEFSpatialReference as f}from"../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as v}from"../../geometry/projection/projectBuffer.js";import{earth as _}from"../../geometry/support/Ellipsoid.js";import{videoMetadataEntryId as A}from"./videoUtils.js";const M=Math.PI/180;let V=class extends e{constructor(t){super(),this.averageElevation=0,this.imageHeight=0,this.imageWidth=0,this.metadataSupportsTransforms=!1,this.platformHeadingAngle=0,this.platformPitchAngle=0,this.platformRollAngle=0,this.sensorHeadingAngle=0,this.sensorAltitude=0,this.sensorHorizontalFieldOfView=0,this.sensorLatitude=0,this.sensorLongitude=0,this.sensorPitchAngle=0,this.sensorRollAngle=0,this.sensorVerticalFieldOfView=0,this.vttMetadata=new Map,this._createMat3FromValues=t=>{const e=t[0],o=t[1],s=t[2];return i(e[0],o[0],s[0],e[1],o[1],s[1],e[2],o[2],s[2])},this._multiplyMat3=(t,e)=>{const o=a();return n(o,t,e),o},this._transposeMat3=t=>{const e=a();return h(e,t),e},this._calculateCameraFovForward=()=>this._createMat3FromValues([[0,0,1],[Math.tan(.5*this.sensorHorizontalFieldOfView*M),0,0],[0,Math.tan(.5*this.sensorVerticalFieldOfView*M),0]]),this._calculateCameraFovReverse=()=>this._createMat3FromValues([[0,1/Math.tan(.5*this.sensorHorizontalFieldOfView*M),0],[0,0,1/Math.tan(.5*this.sensorVerticalFieldOfView*M)],[1,0,0]]),this._calculateCameraLook=()=>this._getRotationMatrixZYX(this.sensorHeadingAngle*M,this.sensorPitchAngle*M,this.sensorRollAngle*M),this._calculateImageDimensionsForward=()=>this._createMat3FromValues([[2/this.imageWidth,0,-1],[0,-2/this.imageHeight,-1],[0,0,1]]),this._calculateImageDimensionsReverse=()=>this._createMat3FromValues([[this.imageWidth/2,0,this.imageWidth/2],[0,-this.imageHeight/2,-this.imageHeight/2],[0,0,1]]),this._calculatePlatformPositionMatrix=()=>{const t=Math.sin(this.sensorLatitude*M),e=Math.cos(this.sensorLatitude*M),o=Math.sin(this.sensorLongitude*M),s=Math.cos(this.sensorLongitude*M);return this._createMat3FromValues([[-t*s,-o,-e*s],[-t*o,s,-e*o],[e,0,-t]])},this._calculatePlatformOrientation=()=>this._getRotationMatrixZYX(this.platformHeadingAngle*M,this.platformPitchAngle*M,this.platformRollAngle*M),this._extractValues=t=>{this.imageWidth=t.get(A.EsriVideoWidth)?.value,this.imageHeight=t.get(A.EsriVideoHeight)?.value;const e=t.get(A.SensorEllipsoidHeight)?.value;this.sensorAltitude=e??t.get(A.SensorTrueAltitude)?.value,this.sensorLatitude=t.get(A.SensorLatitude)?.value,this.sensorLongitude=t.get(A.SensorLongitude)?.value,this.sensorHeadingAngle=t.get(A.SensorAzimuthAngle)?.value,this.sensorPitchAngle=t.get(A.SensorElevationAngle)?.value,this.sensorRollAngle=t.get(A.SensorRollAngle)?.value,this.sensorHorizontalFieldOfView=t.get(A.SensorHorizontalFOV)?.value,this.sensorVerticalFieldOfView=t.get(A.SensorVerticalFOV)?.value,this.platformHeadingAngle=t.get(A.PlatformHeadingAngle)?.value,this.platformPitchAngle=t.get(A.PlatformPitchAngle)?.value,this.platformRollAngle=t.get(A.PlatformRollAngle)?.value,this.averageElevation=t.get(A.FrameCenterElevation)?.value||0},this._getRotationMatrixZYX=(t,e,o)=>{const s=Math.cos(t),i=Math.sin(t),a=Math.cos(e),r=Math.sin(e),l=Math.cos(o),n=Math.sin(o);return this._createMat3FromValues([[s*a,s*r*n-l*i,i*n+s*l*r],[a*i,s*l+i*r*n,l*i*r-s*n],[-r,a*n,a*l]])},this._initCameraSensor=()=>{const t=this._calculateCameraFovForward(),e=this._calculateCameraFovReverse(),o=this._calculateCameraLook(),s=this._calculateImageDimensionsForward(),i=this._calculateImageDimensionsReverse(),a=this._calculatePlatformPositionMatrix(),r=this._calculatePlatformOrientation(),l=this._multiplyMat3(this._multiplyMat3(a,r),o);this._imageToEarthTransform=this._multiplyMat3(this._multiplyMat3(l,t),s);const n=this._multiplyMat3(i,e);this._earthToImageTransform=this._multiplyMat3(n,this._transposeMat3(l)),this._platformPositionEcef=this._projectPointToECEF(this.sensorLongitude,this.sensorLatitude,this.sensorAltitude||this.averageElevation)},this._metadataSupportsTransforms=t=>{if(!t?.size)return!1;const e=t.get(A.EsriVideoWidth)?.value??0,o=t.get(A.EsriVideoHeight)?.value??0;if(e<=0||o<=0)return!1;const s=t.get(A.SensorEllipsoidHeight)?.value,i=t.get(A.SensorTrueAltitude)?.value,a=t.get(A.SensorLatitude)?.value,r=t.get(A.SensorLongitude)?.value;if(null==s&&null==i||null==a||null==r)return!1;const l=t.get(A.PlatformHeadingAngle)?.value,n=t.get(A.PlatformPitchAngle)?.value,h=t.get(A.PlatformRollAngle)?.value;if(null==l||null==n||null==h)return!1;const m=t.get(A.SensorHorizontalFOV)?.value,g=t.get(A.SensorVerticalFOV)?.value;if(null==m||null==g)return!1;const u=t.get(A.SensorAzimuthAngle)?.value,c=t.get(A.SensorElevationAngle)?.value,p=t.get(A.SensorRollAngle)?.value;return null!=u&&null!=c&&null!=p},this._projectPointToECEF=(t,e,o)=>{const s=[];return v([t,e,o],d.WGS84,0,s,f,0),new p({x:s[0],y:s[1],z:s[2],spatialReference:f})},this._projectImageVectorToEllipsoid=(t,e)=>{const o=_.semiMajorAxis+e,s=_.semiMinorAxis+e,i=s/o,a=o/s,{x:n,y:h,z:u}=this._platformPositionEcef,c=u??this.averageElevation,p=l(n,h,a*c),d=m(t,t),f=m(t,p),v=m(p,p)-o*o,A=(-f-Math.sqrt(f*f-d*v))/d;if(A<0)return[NaN,NaN,NaN];const M=r();return g(M,p,t,A),M[2]=M[2]*i,M};const e=t?.videoMetadata;this.updateSensorModel(e)}updateSensorModel(t){t?.size&&(this._set("metadataSupportsTransforms",this._metadataSupportsTransforms(t)),this.metadataSupportsTransforms&&(this._extractValues(t),this._initCameraSensor()))}transformGeoToImage(t,e,o){const s=this._platformPositionEcef;if(!s)return[0,0];const{x:i,y:a,z:n}=s,h=l(i,a,n),m=this._projectPointToECEF(t,e,o||this.averageElevation),g=r(),p=l(m.x,m.y,m.z);u(g,p,h),c(g,g,this._earthToImageTransform);const d=g[0],f=g[1],v=g[2];let _=l(NaN,NaN,NaN);return isNaN(v)||(_=l(d/v,f/v,v/v)),[_[0],_[1]]}transformImageToGeo(t,e){const o=l(t,e,1),s=r();c(s,o,this._imageToEarthTransform);const i=this._projectImageVectorToEllipsoid(s,this.averageElevation);let a;if(!isNaN(i[0])){const t=[];v([i[0],i[1],i[2]],f,0,t,d.WGS84,0),a=new p({x:t[0],y:t[1],z:t[2],spatialReference:d.WGS84})}return a}};t([o()],V.prototype,"averageElevation",void 0),t([o()],V.prototype,"imageHeight",void 0),t([o()],V.prototype,"imageWidth",void 0),t([o({readOnly:!0})],V.prototype,"metadataSupportsTransforms",void 0),t([o()],V.prototype,"platformHeadingAngle",void 0),t([o()],V.prototype,"platformPitchAngle",void 0),t([o()],V.prototype,"platformRollAngle",void 0),t([o()],V.prototype,"sensorHeadingAngle",void 0),t([o()],V.prototype,"sensorAltitude",void 0),t([o()],V.prototype,"sensorHorizontalFieldOfView",void 0),t([o()],V.prototype,"sensorLatitude",void 0),t([o()],V.prototype,"sensorLongitude",void 0),t([o()],V.prototype,"sensorPitchAngle",void 0),t([o()],V.prototype,"sensorRollAngle",void 0),t([o()],V.prototype,"sensorVerticalFieldOfView",void 0),t([o()],V.prototype,"vttMetadata",void 0),V=t([s("esri.layers.video.VideoCameraSensorModel")],V);export{V as default};
|