@arcgis/core 4.26.0-next.20221221 → 4.26.0-next.20221222
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/interfaces.d.ts +868 -0
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{getElements as s,isSameTagIgnoreNS as a,getElementValue as o,getElementValues as l,getNodeNameIgnoreNS as r,getElement as u,getSpaceDelimitedNumericValues as m}from"./xmlUtilities.js";function p(e){return{requestResponseCRSs:l(e,"requestResponseCRSs").map((e=>e.split(":")[1])),nativeCRSs:l(e,"nativeCRSs").map((e=>e.split(":")[1]))}}function d(e,t){const n=l(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):o(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter((e=>e.toLowerCase()!==i.toLowerCase()))):n}function c(e){return null==e?["nearest"]:e.map((e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null})).filter((e=>!!e))}function f(t){const n=s(t,"pos"),i=m(n[0]),a=m(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:4326}})}function g(e,t){const n=l(e,t);return n?.length&&""!==n[0]&&!isNaN(Number(n[0]))?n.map((e=>Number(e))):null}function h(e){return null==e?null:e.every((t=>t===e[0]))?e[0]:e}function b(e){const t=[],n=s(e,"RangeSet");let i=[];for(let a=0;a<n.length;a++){const e=o(n[a],"name"),r=o(n[a],"label"),u=[],m=g(n[a],"nullValues/singleValue"),p=s(n[a],"AxisDescription");for(let t=0;t<p.length;t++){const e=o(p[t],"name"),n=o(p[t],"label"),s=l(p[t],"singleValue");if(0===s.length){const e=o(p[t],"min"),n=o(p[t],"max"),i=Number(o(p[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)s.push(t.toString())}"band"===e.toLowerCase()&&(i=s),u.push({name:e,label:n,values:s})}t.push({name:e,label:r,nullValues:m,axis:u})}return{rangeSet:t,bandNames:i}}function x(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],s=["Years","Months","Days","Hours","Minutes","Seconds"];let a,o,l;return t.includes("PT")?(t=t.slice(2),l=i.findIndex((e=>t.includes(e))),a=s[3+l],o=parseFloat(t.substring(0,t.length-1))):(t=t.slice(1),l=n.findIndex((e=>t.includes(e))),l>-1&&(a=s[l]),o=parseFloat(t.substring(0,t.length-1))),{resolution:o,units:a}}function v(e){const t=s(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(o(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=u(e,"timePeriod")||u(e,"TimePeriod");if(n){return{begin:new Date(o(n,"beginPosition")||o(n,"BeginPosition")),end:new Date(o(n,"endPosition")||o(n,"EndPosition")),...x(o(n,"timeResolution")||o(n,"TimeResolution"))}}return null}function D(t){const n=u(t,"spatialDomain"),i=u(n,"Envelope")||u(n,"EnvelopeWithTimePeriod"),a=i.getAttribute("srsName").split(":"),l=a[a.length-1],r=s(i,"pos"),p=m(r[0]),d=m(r[1]),c=parseInt(l,10),f=isNaN(c)?null:{wkid:c},g=new e({xmin:p[0],ymin:p[1],xmax:d[0],ymax:d[1],spatialReference:f}),h=u(n,"RectifiedGrid"),b=o(h,"low").split(" "),x=o(h,"high").split(" "),D=parseInt(x[0],10)-parseInt(b[0],10)+1,w=parseInt(x[1],10)-parseInt(b[1],10)+1,y=m(n,"origin/pos"),S=s(n,"offsetVector"),L={envelope:g,columns:D,rows:w,offset:{x:parseFloat(o(S[0]).split(" ")[0]),y:parseFloat(o(S[1]).split(" ")[1])},origin:{x:y[0],y:y[1]}},I=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:L,temporalDomain:I?v(I):null}}function w(e){const t={version:"1.0"};let n,s=[];for(let i=0;i<e.childNodes.length;i++){const r=e.childNodes[i];if(1===r.nodeType)if(a(r,"description"))t.description=o(r);else if(a(r,"name"))t.name=o(r);else if(a(r,"label"))t.label=o(r);else if(a(r,"supportedFormats"))t.supportedFormats=l(r,"formats");else if(a(r,"supportedCRSs"))t.supportedCRSs=p(r);else if(a(r,"supportedInterpolations"))t.supportedInterpolations=d(r,"1.0.0");else if(a(r,"lonLatEnvelope"))t.lonLatEnvelope=f(r);else if(a(r,"rangeSet")){const e=b(r);t.rangeSet=e.rangeSet,s=e.bandNames;const i=e.rangeSet[0].nullValues;i?.length&&(n=h(i))}else a(r,"domainSet")&&(t.domainSet=D(r))}const r=c(t.supportedInterpolations),{name:u,description:m,label:g,lonLatEnvelope:x,supportedFormats:v}=t,{spatialDomain:w}=t.domainSet,S={x:Math.abs(w.offset.x),y:Math.abs(w.offset.y)},L=y(t.domainSet),I=new i({width:w.columns,height:w.rows,pixelSize:S,extent:w.envelope,spatialReference:w.envelope.spatialReference,bandCount:s.length||1,noDataValue:n,multidimensionalInfo:L});return{id:u,title:t.name,description:m||g,lonLatEnvelope:x,rasterInfo:I,bandNames:s,supportedFormats:v,supportedInterpolations:r,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function y(e){if(!e.temporalDomain)return null;const{begin:t,end:n,values:i,units:s,resolution:a}=e.temporalDomain;return{variables:[{name:"default",description:"",dimensions:[{name:"StdTime",description:"",unit:"ISO8601",values:i?.map((e=>e.getTime())),hasRegularIntervals:!i,interval:a,intervalUnit:s,extent:[t.getTime(),n.getTime()]}]}]}}function S(e,t){const n=[],i=s(e,"Field");let a,r=[];for(let u=0;u<i.length;u++){const e=o(i[u],"Identifier"),m=o(i[u],"Description"),p=o(i[u],"Definition"),c=o(i[u],"Abstract"),f=o(i[u],"Title"),h=g(i[u],"NullValue"),b=d(i[u],"1.1.0"),x=[],v=s(i[u],"Axis");for(let n=0;n<v.length;n++){const e=v[n].getAttribute("identifier"),i=o(v[n],"UOM"),s=o(v[n],"DataType"),u=l(v[n],"Key");t&&!e.toLowerCase().includes("band")||(r=u,a=h),x.push({identifier:e,uom:i,dataType:s,values:u,bandNoDataValues:a})}n.push({identifier:e,description:m,definition:p,abstract:c,title:f,supportedInterpolations:b,axis:x,nullValues:h})}return{rangeSet:n,bandNames:r,bandNoDataValues:a}}function L(e,t){if(!t.temporalDomain)return null;const n=e.filter((e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some((e=>e.identifier.includes("band"))))),i=[];if(n.length&&n.forEach((e=>{const t=e.axis.map((e=>{const t=e.values.map((t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())})),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}}));i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t})})),t.temporalDomain){const{begin:e,end:n,values:s,units:a,resolution:o}=t.temporalDomain;i.some((e=>e.dimensions.some((e=>"stdtime"===e.name.toLowerCase()))))||i.forEach((t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map((e=>e.getTime())),hasRegularIntervals:!s,interval:o,intervalUnit:a,extent:[e.getTime(),n.getTime()]})}))}return i.length?{variables:i}:null}function I(t){const i=u(t,"SpatialDomain"),a=u(i,"GridCRS"),l=o(a,"GridBaseCRS"),r=o(a,"GridOrigin")?.split(" ").map((e=>parseFloat(e)))??[0,0],p=m(a,"GridOffsets"),d=s(i,"BoundingBox");let c,f,g,h;for(let n=0;n<d.length;n++){const t=d[n].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=m(d[n],"LowerCorner"),t=m(d[n],"UpperCorner");c=t[0]-e[0]+1,f=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");g=parseInt(i[i.length-1],10);const s=m(d[n],"LowerCorner"),a=m(d[n],"UpperCorner");h=new e({xmin:s[0],ymin:s[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:g}})}}const b=c>f,x=h.xmax-h.xmin>h.ymax-h.ymin;let D=!1;n(g)&&(b===x?D=!1:(D=!0,h=new e({xmin:h.ymin,ymin:h.xmin,xmax:h.ymax,ymax:h.xmax,spatialReference:{wkid:g}})));const w={columns:c,rows:f,origin:{x:r[0],y:r[1]},offset:{x:p[0],y:p[p.length-1]},gridBaseCRS:l,envelope:h,useEPSGAxis:D},y=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:w,temporalDomain:y?v(y):null}}function C(e,t){const n=[],s=[],a={supportedFormats:n,supportedCRSs:s,version:"1.1"};let l,u=[];for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const m=r(t).toLowerCase();switch(m){case"title":case"abstract":case"identifier":a[m]=o(t);break;case"supportedformat":{const e=o(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=o(t);s.includes(e)||s.push(e)}break;case"range":{const e=S(t,!!a.domain?.temporalDomain);a.range=e.rangeSet,u=e.bandNames;const{bandNoDataValues:n}=e;n?.length&&(l=h(n))}break;case"domain":a.domain=I(t)}}const m=c(a.range[0].supportedInterpolations),{identifier:p,abstract:d,title:f,domain:g,range:b}=a,x={x:Math.abs(g.spatialDomain.offset.x),y:Math.abs(g.spatialDomain.offset.y)},v=L(b,g);v&&(l=b[0].nullValues,1===l?.length&&(l=l[0]));const D=new i({width:g.spatialDomain.columns,height:g.spatialDomain.rows,pixelSize:x,extent:g.spatialDomain.envelope,spatialReference:g.spatialDomain.envelope.spatialReference,bandCount:u.length||1,noDataValue:l,multidimensionalInfo:v});return{id:p,title:a.title,description:d||f,lonLatEnvelope:null,bandNames:u,rasterInfo:D,supportedFormats:n,supportedInterpolations:m,coverageDescription:a,version:t,useEPSGAxis:g.spatialDomain.useEPSGAxis}}function R(t){const n=u(t,"Envelope")||u(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),s=i.slice(i.lastIndexOf("/")+1),l=n.getAttribute("axisLabels").split(" ").map((e=>e.trim())).filter((e=>""!==e.trim())),r=m(n,"lowerCorner"),p=m(n,"upperCorner"),d=!["y","lat","latitude","north","nor","n","b"].includes(l[0].toLowerCase());let c;const f=parseInt(s,10),g=isNaN(f)?null:{wkid:f};c=new e(d?{xmin:r[0],ymin:r[1],xmax:p[0],ymax:p[1],spatialReference:g}:{xmin:r[1],ymin:r[0],xmax:p[1],ymax:p[0],spatialReference:g});const h={mins:r,maxs:p},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;if(a(n,"EnvelopeWithTimePeriod")){x=new Date(o(t,"beginPosition")||o(t,"BeginPosition")),v=new Date(o(t,"endPosition")||o(t,"EndPosition"));const e=b?.findIndex((e=>"oledatetime"===e?.toLowerCase()));e>-1&&(b[e]="ISO8601")}return{envelope:c,axisLabels:l,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:d}}function T(e,t){const n=[],i=s(e,"DataRecord"),a=[];let l,r=[];for(let p=0;p<i.length;p++){const e=s(i[p],"field"),d=[];for(let n=0;n<e.length;n++){const i=e[n].getAttribute("name"),s=o(e[n],"description")||"",p=u(e[n],"uom")?.getAttribute("code")||"",c=m(e[n],"interval"),f=g(e[n],"nilValue")?.[0];t&&!i.toLowerCase().includes("band")||(a.push(i),c?.length&&(l=l||[],l.push({min:c[0],max:c[1],avg:-1,stddev:-1})),r.push(f)),d.push({name:i,description:s,uom:p,allowedValues:c,nilValue:f})}n.push(d)}return r.some((e=>null!=e))||(r=null),{rangeType:n,bandNames:a,bandStats:l,bandNoDataValues:r}}function N(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function M(e,t,n){if(n.axisLabels.length<=2)return null;const i=[];for(let a=0;a<e.length;a++){const t=e[a];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const s=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const s=(t.uomLabels?.length??0)>i?t.uomLabels?.[i]:"",a=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===s.toLowerCase()||"oledatetime"===s.toLowerCase();let o,l;if(a){const e=N(n.offset[i]);o=e.interval,l=e.intervalUnit}else o=n.offset[i],l=s;const r=[];a?(r.push((new Date).setTime(24*(t.envelopeAllDims.mins[i]-25569)*3600*1e3)),r.push((new Date).setTime(24*(t.envelopeAllDims.maxs[i]-25569)*3600*1e3))):(r.push(t.envelopeAllDims.mins[i]),r.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:t.uomLabels&&t.uomLabels.length>i?t.uomLabels[i].trim():"",hasRegularIntervals:!0,extent:r,interval:o,intervalUnit:l})}if(i.forEach((t=>{const{allowedValues:n}=t,i=2===n?.length?[{min:n[0],max:n[1],avg:-1,stddev:-1}]:null;s.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),statistics:i,dimensions:e})})),s.length)return{variables:s}}return null}function P(e,t){const n=u(e,"RectifiedGrid"),i=m(n,"low"),a=m(n,"high"),l=[];for(let s=0;s<i.length;s++)l.push(a[s]-i[s]+1);const r=o(n,"axisLabels").split(" "),p=m(n,"origin/pos"),d=s(n,"offsetVector"),c=[];for(let s=0;s<d.length;s++){const e=m(d[s]),t=e.findIndex((e=>0!==e));c[t]=e[t]}const f=["y","lat","latitude","north","nor","n","b"];let g=!1;if(t?.length&&r?.length){g=[...t].sort(((e,t)=>e<t?-1:1)).join(",")===[...r].sort(((e,t)=>e<t?-1:1)).join(",")}const h=g?r:t;let b,x,v;return f.includes(h[0].toLowerCase())?(b=l[1],x=l[0],v={y:Math.abs(c[0]),x:Math.abs(c[1])}):(b=l[0],x=l[1],v={x:Math.abs(c[0]),y:Math.abs(c[1])}),{columns:b,rows:x,origin:p,offset:c,resolution:v,gridSamples:l,axisLabels:r,hasSameAxisLabelsAsBoundedBy:g}}function E(e){const n=u(e,"EarthObservation");if(!n)return null;const i=u(n,"phenomenonTime"),s=i?v(i):null,a=u(n,"phenomenonTime"),l=a?v(a):null,r=o(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let m=null;if(r){const e=r.split(" ").map((e=>e.trim())).filter((e=>null!=e&&""!==e));if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);m=new t({rings:[n],spatialReference:{wkid:4326}})}}return{observation:{phonomenonTime:s,resultTime:l,footprint:m,identifier:o(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:o(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:o(e,"metaDataProperty/EarthObservationMetaData/status")}}}function A(e){const t={version:"2.0"};let n,s,r=[];for(let i=0;i<e.childNodes.length;i++){const m=e.childNodes[i];if(1===m.nodeType)if(a(m,"coverageId"))t.coverageId=o(m);else if(a(m,"ServiceParameters"))t.serviceParameters={supportedFormats:l(m,"nativeFormat")};else if(a(m,"boundedBy"))t.boundedBy=R(m);else if(a(m,"rangeType")){const e=T(m,t.boundedBy?.axisLabels.length>2||t.domainSet?.axisLabels.length>2);t.rangeType=e.rangeType,r=e.bandNames,n=e.bandStats;const{bandNoDataValues:i}=e;i?.length&&(s=h(i))}else if(a(m,"domainSet"))t.domainSet=P(m,t.boundedBy?.axisLabels);else if(a(m,"metadata")){const e=u(m,"EOMetadata");t.eoMetadata=e?E(e):null}}const{coverageId:m,boundedBy:p,domainSet:d,rangeType:c,serviceParameters:f}=t,g=M(c,p,d);!n&&g&&(n=g?.variables[0].statistics),null!=g&&(s=c[0][0].nilValue);return{id:m,title:m,description:m,lonLatEnvelope:null,bandNames:r,rasterInfo:new i({width:d.columns,height:d.rows,pixelSize:d.resolution,extent:p.envelope,spatialReference:p.envelope.spatialReference,bandCount:r.length||1,statistics:n,noDataValue:s,multidimensionalInfo:g}),supportedFormats:f.supportedFormats,supportedInterpolations:null,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function V(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return s(n,"CoverageOffering").map((e=>w(e)))}const i=s(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map((e=>C(e,t))):i.map((e=>A(e)))}export{V as parseCoverages,c as standardizeInterpolations};
|
|
5
|
+
import e from"../../../geometry/Extent.js";import t from"../../../geometry/Polygon.js";import{isAxesOrderReversedForWkid as n}from"../../ogc/crsUtils.js";import i from"../RasterInfo.js";import{getElements as s,isSameTagIgnoreNS as a,getElementValue as o,getElementValues as l,getNodeNameIgnoreNS as r,getElement as u,getSpaceDelimitedNumericValues as m}from"./xmlUtilities.js";function p(e){return{requestResponseCRSs:l(e,"requestResponseCRSs").map((e=>e.split(":")[1])),nativeCRSs:l(e,"nativeCRSs").map((e=>e.split(":")[1]))}}function d(e,t){const n=l(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):o(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter((e=>e.toLowerCase()!==i.toLowerCase()))):n}function c(e){return null==e?["nearest"]:e.map((e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null})).filter((e=>!!e))}function f(t){const n=s(t,"pos"),i=m(n[0]),a=m(n[1]);return new e({xmin:i[0],ymin:i[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:4326}})}function g(e,t){const n=l(e,t);return n?.length&&""!==n[0]&&!isNaN(Number(n[0]))?n.map((e=>Number(e))):null}function h(e){return null==e?null:e.every((t=>t===e[0]))?e[0]:e}function b(e){const t=[],n=s(e,"RangeSet");let i=[];for(let a=0;a<n.length;a++){const e=o(n[a],"name"),r=o(n[a],"label"),u=[],m=g(n[a],"nullValues/singleValue"),p=s(n[a],"AxisDescription");for(let t=0;t<p.length;t++){const e=o(p[t],"name"),n=o(p[t],"label"),s=l(p[t],"singleValue");if(0===s.length){const e=o(p[t],"min"),n=o(p[t],"max"),i=Number(o(p[t],"res"))||1;if(null!==e&&null!==n)for(let t=parseInt(e,10);t<=parseInt(n,10);t+=i)s.push(t.toString())}"band"===e.toLowerCase()&&(i=s),u.push({name:e,label:n,values:s})}t.push({name:e,label:r,nullValues:m,axis:u})}return{rangeSet:t,bandNames:i}}function x(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Y","M","D"],i=["H","M","S"],s=["Years","Months","Days","Hours","Minutes","Seconds"];let a,o,l;return t.includes("PT")?(t=t.slice(2),l=i.findIndex((e=>t.includes(e))),a=s[3+l],o=parseFloat(t.substring(0,t.length-1))):(t=t.slice(1),l=n.findIndex((e=>t.includes(e))),l>-1&&(a=s[l]),o=parseFloat(t.substring(0,t.length-1))),{resolution:o,units:a}}function v(e){const t=s(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date(o(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=u(e,"timePeriod")||u(e,"TimePeriod");if(n){return{begin:new Date(o(n,"beginPosition")||o(n,"BeginPosition")),end:new Date(o(n,"endPosition")||o(n,"EndPosition")),...x(o(n,"timeResolution")||o(n,"TimeResolution"))}}return null}function D(t){const n=u(t,"spatialDomain"),i=u(n,"Envelope")||u(n,"EnvelopeWithTimePeriod"),a=i.getAttribute("srsName").split(":"),l=a[a.length-1],r=s(i,"pos"),p=m(r[0]),d=m(r[1]),c=parseInt(l,10),f=isNaN(c)?null:{wkid:c},g=new e({xmin:p[0],ymin:p[1],xmax:d[0],ymax:d[1],spatialReference:f}),h=u(n,"RectifiedGrid"),b=o(h,"low").split(" "),x=o(h,"high").split(" "),D=parseInt(x[0],10)-parseInt(b[0],10)+1,w=parseInt(x[1],10)-parseInt(b[1],10)+1,y=m(n,"origin/pos"),S=s(n,"offsetVector"),L={envelope:g,columns:D,rows:w,offset:{x:parseFloat(o(S[0]).split(" ")[0]),y:parseFloat(o(S[1]).split(" ")[1])},origin:{x:y[0],y:y[1]}},I=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:L,temporalDomain:I?v(I):null}}function w(e){const t={version:"1.0"};let n,s=[];for(let i=0;i<e.childNodes.length;i++){const r=e.childNodes[i];if(1===r.nodeType)if(a(r,"description"))t.description=o(r);else if(a(r,"name"))t.name=o(r);else if(a(r,"label"))t.label=o(r);else if(a(r,"supportedFormats"))t.supportedFormats=l(r,"formats");else if(a(r,"supportedCRSs"))t.supportedCRSs=p(r);else if(a(r,"supportedInterpolations"))t.supportedInterpolations=d(r,"1.0.0");else if(a(r,"lonLatEnvelope"))t.lonLatEnvelope=f(r);else if(a(r,"rangeSet")){const e=b(r);t.rangeSet=e.rangeSet,s=e.bandNames;const i=e.rangeSet[0].nullValues;i?.length&&(n=h(i))}else a(r,"domainSet")&&(t.domainSet=D(r))}const r=c(t.supportedInterpolations),{name:u,description:m,label:g,lonLatEnvelope:x,supportedFormats:v}=t,{spatialDomain:w}=t.domainSet,S={x:Math.abs(w.offset.x),y:Math.abs(w.offset.y)},L=y(t.domainSet),I=new i({width:w.columns,height:w.rows,pixelSize:S,extent:w.envelope,spatialReference:w.envelope.spatialReference,bandCount:s.length||1,noDataValue:n,multidimensionalInfo:L});return{id:u,title:t.name,description:m||g,lonLatEnvelope:x,rasterInfo:I,bandNames:s,supportedFormats:v,supportedInterpolations:r,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}function y(e){if(!e.temporalDomain)return null;const{begin:t,end:n,values:i,units:s,resolution:a}=e.temporalDomain;return{variables:[{name:"default",description:"",dimensions:[{name:"StdTime",description:"",unit:"ISO8601",values:i?.map((e=>e.getTime())),hasRegularIntervals:!i,interval:a,intervalUnit:s,extent:[t.getTime(),n.getTime()]}]}]}}function S(e,t){const n=[],i=s(e,"Field");let a,r=[];for(let u=0;u<i.length;u++){const e=o(i[u],"Identifier"),m=o(i[u],"Description"),p=o(i[u],"Definition"),c=o(i[u],"Abstract"),f=o(i[u],"Title"),h=g(i[u],"NullValue"),b=d(i[u],"1.1.0"),x=[],v=s(i[u],"Axis");for(let n=0;n<v.length;n++){const e=v[n].getAttribute("identifier"),i=o(v[n],"UOM"),s=o(v[n],"DataType"),u=l(v[n],"Key");t&&!e.toLowerCase().includes("band")||(r=u,a=h),x.push({identifier:e,uom:i,dataType:s,values:u,bandNoDataValues:a})}n.push({identifier:e,description:m,definition:p,abstract:c,title:f,supportedInterpolations:b,axis:x,nullValues:h})}return{rangeSet:n,bandNames:r,bandNoDataValues:a}}function L(e,t){if(!t.temporalDomain)return null;const n=e.filter((e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some((e=>e.identifier.includes("band"))))),i=[];if(n.length&&n.forEach((e=>{const t=e.axis.map((e=>{const t=e.values.map((t=>{if("ISO8601"===e.uom){return(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime()}return parseFloat(t.trim())})),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}}));i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t})})),t.temporalDomain){const{begin:e,end:n,values:s,units:a,resolution:o}=t.temporalDomain;i.some((e=>e.dimensions.some((e=>"stdtime"===e.name.toLowerCase()))))||i.forEach((t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map((e=>e.getTime())),hasRegularIntervals:!s,interval:o,intervalUnit:a,extent:[e.getTime(),n.getTime()]})}))}return i.length?{variables:i}:null}function I(t){const i=u(t,"SpatialDomain"),a=u(i,"GridCRS"),l=o(a,"GridBaseCRS"),r=o(a,"GridOrigin")?.split(" ").map((e=>parseFloat(e)))??[0,0],p=m(a,"GridOffsets"),d=s(i,"BoundingBox");let c,f,g,h;for(let n=0;n<d.length;n++){const t=d[n].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const e=m(d[n],"LowerCorner"),t=m(d[n],"UpperCorner");c=t[0]-e[0]+1,f=t[1]-e[1]+1}else if(t.indexOf("epsg")>0){const i=t.split(":");g=parseInt(i[i.length-1],10);const s=m(d[n],"LowerCorner"),a=m(d[n],"UpperCorner");h=new e({xmin:s[0],ymin:s[1],xmax:a[0],ymax:a[1],spatialReference:{wkid:g}})}}const b=c>f,x=h.xmax-h.xmin>h.ymax-h.ymin;let D=!1;n(g)&&(b===x?D=!1:(D=!0,h=new e({xmin:h.ymin,ymin:h.xmin,xmax:h.ymax,ymax:h.xmax,spatialReference:{wkid:g}})));const w={columns:c,rows:f,origin:{x:r[0],y:r[1]},offset:{x:p[0],y:p[p.length-1]},gridBaseCRS:l,envelope:h,useEPSGAxis:D},y=u(t,"temporalDomain")||u(t,"TemporalDomain");return{spatialDomain:w,temporalDomain:y?v(y):null}}function C(e,t){const n=[],s=[],a={supportedFormats:n,supportedCRSs:s,version:"1.1"};let l,u=[];for(let i=0;i<e.childNodes.length;i++){const t=e.childNodes[i];if(1!==t.nodeType)continue;const m=r(t).toLowerCase();switch(m){case"title":case"abstract":case"identifier":a[m]=o(t);break;case"supportedformat":{const e=o(t);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=o(t);s.includes(e)||s.push(e)}break;case"range":{const e=S(t,!!a.domain?.temporalDomain);a.range=e.rangeSet,u=e.bandNames;const{bandNoDataValues:n}=e;n?.length&&(l=h(n))}break;case"domain":a.domain=I(t)}}const m=c(a.range[0].supportedInterpolations),{identifier:p,abstract:d,title:f,domain:g,range:b}=a,x={x:Math.abs(g.spatialDomain.offset.x),y:Math.abs(g.spatialDomain.offset.y)},v=L(b,g);v&&(l=b[0].nullValues,1===l?.length&&(l=l[0]));const D=new i({width:g.spatialDomain.columns,height:g.spatialDomain.rows,pixelSize:x,extent:g.spatialDomain.envelope,spatialReference:g.spatialDomain.envelope.spatialReference,bandCount:u.length||1,noDataValue:l,multidimensionalInfo:v});return{id:p,title:a.title,description:d||f,lonLatEnvelope:null,bandNames:u,rasterInfo:D,supportedFormats:n,supportedInterpolations:m,coverageDescription:a,version:t,useEPSGAxis:g.spatialDomain.useEPSGAxis}}function R(t){const n=u(t,"Envelope")||u(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName"),s=i.slice(i.lastIndexOf("/")+1),l=n.getAttribute("axisLabels").split(" ").map((e=>e.trim())).filter((e=>""!==e.trim())),r=m(n,"lowerCorner"),p=m(n,"upperCorner"),d=!["y","lat","latitude","north","nor","n","b"].includes(l[0].toLowerCase());let c;const f=parseInt(s,10),g=isNaN(f)?null:{wkid:f};c=new e(d?{xmin:r[0],ymin:r[1],xmax:p[0],ymax:p[1],spatialReference:g}:{xmin:r[1],ymin:r[0],xmax:p[1],ymax:p[0],spatialReference:g});const h={mins:r,maxs:p},b=n.getAttribute("uomLabels").trim().split(" ");let x,v;if(a(n,"EnvelopeWithTimePeriod")){x=new Date(o(t,"beginPosition")||o(t,"BeginPosition")),v=new Date(o(t,"endPosition")||o(t,"EndPosition"));const e=b?.findIndex((e=>"oledatetime"===e?.toLowerCase()));e>-1&&(b[e]="ISO8601")}return{envelope:c,axisLabels:l,uomLabels:b.length?b:null,envelopeAllDims:h,beginPosition:x,endPosition:v,isEastFirst:d}}function T(e,t){const n=[],i=s(e,"DataRecord"),a=[];let l,r=[];for(let p=0;p<i.length;p++){const e=s(i[p],"field"),d=[];for(let n=0;n<e.length;n++){const i=e[n].getAttribute("name"),s=o(e[n],"description")||"",p=u(e[n],"uom")?.getAttribute("code")||"",c=m(e[n],"interval"),f=g(e[n],"nilValue")?.[0];t&&!i.toLowerCase().includes("band")||(a.push(i),c?.length&&(l=l||[],l.push({min:c[0],max:c[1],avg:-1,stddev:-1})),r.push(f)),d.push({name:i,description:s,uom:p,allowedValues:c,nilValue:f})}n.push(d)}return r.some((e=>null!=e))||(r=null),{rangeType:n,bandNames:a,bandStats:l,bandNoDataValues:r}}function N(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function M(e,t,n){if(n.axisLabels.length<=2)return null;const i=[];for(let a=0;a<e.length;a++){const t=e[a];for(let e=0;e<t.length;e++)t[e].name.toLowerCase().includes("band")||i.push(t[e])}const s=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const s=(t.uomLabels?.length??0)>i?t.uomLabels?.[i]:"",a=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===s.toLowerCase()||"oledatetime"===s.toLowerCase();let o,l;if(a){const e=N(n.offset[i]);o=e.interval,l=e.intervalUnit}else o=n.offset[i],l=s;const r=[];a?(r.push((new Date).setTime(24*(t.envelopeAllDims.mins[i]-25569)*3600*1e3)),r.push((new Date).setTime(24*(t.envelopeAllDims.maxs[i]-25569)*3600*1e3))):(r.push(t.envelopeAllDims.mins[i]),r.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:t.uomLabels&&t.uomLabels.length>i?t.uomLabels[i].trim():"",hasRegularIntervals:!0,extent:r,interval:o,intervalUnit:l})}if(i.forEach((t=>{const{allowedValues:n}=t,i=2===n?.length?[{min:n[0],max:n[1],avg:-1,stddev:-1}]:null;s.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),statistics:i,dimensions:e})})),s.length)return{variables:s}}return null}function P(e,t){const n=u(e,"RectifiedGrid"),i=m(n,"low"),a=m(n,"high"),l=[];for(let s=0;s<i.length;s++)l.push(a[s]-i[s]+1);const r=o(n,"axisLabels").split(" "),p=m(n,"origin/pos"),d=s(n,"offsetVector"),c=[];for(let s=0;s<d.length;s++){const e=m(d[s]),t=e.findIndex((e=>0!==e));c[t]=e[t]}const f=["y","lat","latitude","north","nor","n","b"];let g=!1;if(t?.length&&r?.length){g=[...t].sort(((e,t)=>e<t?-1:1)).join(",")===[...r].sort(((e,t)=>e<t?-1:1)).join(",")}const h=g?r:t;let b,x,v;return f.includes(h[0].toLowerCase())?(b=l[1],x=l[0],v={y:Math.abs(c[0]),x:Math.abs(c[1])}):(b=l[0],x=l[1],v={x:Math.abs(c[0]),y:Math.abs(c[1])}),{columns:b,rows:x,origin:p,offset:c,resolution:v,gridSamples:l,axisLabels:r,hasSameAxisLabelsAsBoundedBy:g}}function E(e){const n=u(e,"EarthObservation");if(!n)return null;const i=u(n,"phenomenonTime"),s=i?v(i):null,a=u(n,"phenomenonTime"),l=a?v(a):null,r=o(n,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let m=null;if(r){const e=r.split(" ").map((e=>e.trim())).filter((e=>null!=e&&""!==e));if(e.length){const n=[];for(let t=0;t<e.length/2;t+=2)n.push(e[t],e[t+1]);m=new t({rings:[n],spatialReference:{wkid:4326}})}}return{observation:{phenomenonTime:s,resultTime:l,footprint:m,identifier:o(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:o(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:o(e,"metaDataProperty/EarthObservationMetaData/status")}}}function A(e){const t={version:"2.0"};let n,s,r=[];for(let i=0;i<e.childNodes.length;i++){const m=e.childNodes[i];if(1===m.nodeType)if(a(m,"coverageId"))t.coverageId=o(m);else if(a(m,"ServiceParameters"))t.serviceParameters={supportedFormats:l(m,"nativeFormat")};else if(a(m,"boundedBy"))t.boundedBy=R(m);else if(a(m,"rangeType")){const e=T(m,t.boundedBy?.axisLabels.length>2||t.domainSet?.axisLabels.length>2);t.rangeType=e.rangeType,r=e.bandNames,n=e.bandStats;const{bandNoDataValues:i}=e;i?.length&&(s=h(i))}else if(a(m,"domainSet"))t.domainSet=P(m,t.boundedBy?.axisLabels);else if(a(m,"metadata")){const e=u(m,"EOMetadata");t.eoMetadata=e?E(e):null}}const{coverageId:m,boundedBy:p,domainSet:d,rangeType:c,serviceParameters:f}=t,g=M(c,p,d);!n&&g&&(n=g?.variables[0].statistics),null!=g&&(s=c[0][0].nilValue);return{id:m,title:m,description:m,lonLatEnvelope:null,bandNames:r,rasterInfo:new i({width:d.columns,height:d.rows,pixelSize:d.resolution,extent:p.envelope,spatialReference:p.envelope.spatialReference,bandCount:r.length||1,statistics:n,noDataValue:s,multidimensionalInfo:g}),supportedFormats:f.supportedFormats,supportedInterpolations:null,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}function V(e,t){let n=null;if("string"==typeof e){n=(new DOMParser).parseFromString(e,"text/xml")}else n=e;if("1.0.0"===t){return s(n,"CoverageOffering").map((e=>w(e)))}const i=s(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map((e=>C(e,t))):i.map((e=>A(e)))}export{V as parseCoverages,c as standardizeInterpolations};
|
package/package.json
CHANGED
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20221222",d="55ddc2996bdba795f742d52e07b9a9439a92b8f2";export{b as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import s from"../../../core/Logger.js";import{destroyMaybe as i,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{a as c}from"../../../chunks/vec3.js";import{f as p,c as g}from"../../../chunks/vec3f64.js";import{projectBuffer as m,projectVectorToVector as y}from"../../../geometry/projection.js";import{extentContainsCoords3D as _}from"../../../geometry/support/contains.js";import{getGeometryZScaler as f}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as b}from"../../../layers/LayerConstants.js";import{makeDehydratedPoint as v,estimateSize as x}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as E}from"../../../layers/graphics/hydratedFeatures.js";import I from"../../../layers/graphics/controllers/I3SOnDemandController.js";import w from"../../../layers/support/FeatureFilter.js";import S from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as C}from"./I3SPointsWorkerHandle.js";import{LayerView3D as D}from"./LayerView3D.js";import A from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as F}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as O,processAttributeEdits as j}from"./i3s/attributeEditing.js";import{I3SOverrides as N}from"./i3s/I3SOverrides.js";import{checkSpatialReferences as T,containsDraco as L,whenGraphicAttributes as M,getCachedAttributeValue as V}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as G}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{PopupSceneLayerView as P}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as H}from"./support/SceneLayerViewRequiredFields.js";import U from"../support/debugFlags.js";import{GraphicsMap as q}from"../support/GraphicsMap.js";import{compute as Q}from"../support/orientedBoundingBox.js";import{updatingProgress as k}from"../support/updatingProperties.js";import{Attribute as B}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as z}from"../webgl-engine/lib/basicInterfaces.js";import Z from"../../layers/SceneLayerView.js";import{TaskPriority as W}from"../../support/Scheduler.js";const K=R();let Y=class extends(G(P(D(Z)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new q,this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){const e=this.layer;this.addResolvingPromise(e.indexInfo),this._i3sOverrides=new N({view:this.view,layer:this.layer,memoryController:this.view.resourceController?.memoryController}),T(e,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new H({layerView:this}),this.updatingHandles.add((()=>e.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>e.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted]),(()=>this._filterChange())),this.handles.add(l((()=>U.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&U.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||U.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new A({owner:this,preferredUpdatePolicy:z.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:e.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(e=>this._controller.updateElevationChanged(e.extent,e.spatialReference))),this.supportsHeightUnitConversion&&(this._verticalScale=f("point",e.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(e.uid),this._controller=new I({layerView:this,scaleVisibilityEnabled:!1}),L(this.layer.geometryDefinitions)&&(this._worker=new C((e=>this.view.resourceController.immediate.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{const e=()=>this.processor.featureStore;this._queryEngine=new F({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:W.FEATURE_QUERY_ENGINE}),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=i(this._treeDebugger),this._i3sOverrides=i(this._i3sOverrides),this._set("processor",i(this.processor)),this._controller=i(this._controller),this._queryEngine=i(this._queryEngine),this._worker=i(this._worker),this._memCache=i(this._memCache),this._nodesAddedToStage.clear(),this._fieldsHelper=i(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??1}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return M(this.layer,e,this._getObjectIdField(),t,(()=>[...this._nodesAddedToStage.values()]))}getHit(e){if(!this.loadedGraphics)return null;const t=E(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return O(this._attributeEditingContext,e)}async _extractBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};return o(this._worker)&&(this._worker=new C((e=>this.view.resourceController.immediate.schedule(e)))),this._worker.invoke(r,t).then((e=>{if(a(e)){return{positionData:e.positions,featureIds:e.featureIds}}throw new Error("Failed to decompress Draco point data")}))}_checkExtent(e,t){e&&!_(e,t)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&s.getLogger(this.declaredClass).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&s.getLogger(this.declaredClass).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++)}async addNode(e,t,r){if(!X(t)&&!J(t))throw new Error;if(this._nodesAddedToStage.has(e.index))return void s.getLogger(this.declaredClass).error("I3S node "+e.id+" already added");const i=a(this.layer.fullExtent)?te(this.layer.fullExtent.clone(),.5):null,o=this._controller.crsVertex,n=[],d={graphics:null,featureIds:null,attributeInfo:t.attributeDataInfo,node:e};if(X(t)?await this._addNodeBinaryPointData(e,d,t,i,n,r):J(t)&&this._addNodeLegacyPointData(e,d,t,i,n),await this._i3sOverrides.apply(d.featureIds,t.attributeDataInfo,r),e.numFeatures=d.graphics.length,this._updateNodeMemory(e),ee(d),n.length>0&&(this._computeObb(e,n,o),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(d);if(a(this._verticalScale))for(const s of d.graphics)this._verticalScale(s.geometry);const l=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(a(l))for(let s=0;s<d.featureIds.length;s++){const e=d.featureIds[s];l.setUidToObjectAndLayerId(e,d.graphics[s].uid,this.layer.id,this.layer.uid,this.layer.popupEnabled,d.node.resources.attributes,s)}this._nodesAddedToStage.set(e.index,d),this.loadedGraphics.addMany(d.graphics),this._controller.updateLoadStatus(e.index,!0),this._filterNode(d),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const s=this._controller.crsIndex,i=s.isGeographic?this.view.renderSpatialReference:s;m(t,r,0,t,i,0,t.length/3),e.serviceObb=Q(new B(t,3)),s.isGeographic&&y(e.serviceObb.center,i,e.serviceObb.center,s)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _addNodeBinaryPointData(e,r,s,i,o,d){const l=await this._extractBinaryPointData(s,d);if(null==l)throw new Error;const h=this._getObjectIdField(),u=this._controller.crsVertex,g=this.view.spatialReference,y=this.processor.graphicsCore,{positionData:_,featureIds:f}=l,b=3,x=_.length/b,E=new Array,I=a(e.serviceObb)?e.serviceObb.center:[0,0,0],w=Math.abs(I[2])*2**-20;for(let S=0;S<x;S++){const r=S*b,s=p(_[r+0],_[r+1],_[r+2]);c(s,s,I),Math.abs(s[2])<w&&(s[2]=0),e.serviceObb||o.push(s[0],s[1],s[2]),a(i)&&this._checkExtent(i,s);const d=f[S],l={};null!=d&&(l[h]=d);const x=d??t.generateUID();m(s,u,0,se,g,0,1);const C=v(se[0],se[1],se[2],g),D=this.loadedGraphics.get(x);if(a(D))D.level<e.level&&(ie.property="geometry",ie.graphic=D,ie.oldValue=n(D.geometry),ie.newValue=C,D.geometry=C,y.graphicUpdateHandler(ie)),E.push(D);else{const r=t.generateUID();E.push({objectId:x,uid:r,geometry:C,attributes:l,visible:!0,level:e.level})}}r.graphics=E,r.featureIds=Array.from(f)}_addNodeLegacyPointData(e,r,s,i,o){const n=this._getObjectIdField(),d=this._controller.crsVertex,l=this.view.spatialReference,h=[0,0,0],u=new Array,c=new Array;for(const p of s.pointData){const r=p.featureDataPosition,s=r.length,g=p.geometries&&p.geometries[0]||re[s],y=p.featureIds[0];if("points"!==g.params.type)continue;a(i)&&this._checkExtent(i,r);const _={};null!=y&&(_[n]=y);const f=y??t.generateUID();let b;"Embedded"===g.type&&(b=g.params.vertexAttributes.position);for(let i=0;i<b.length;i+=s){for(let e=0;e<s;e++)h[e]=r[e]+b[i+e];const n=3===s;e.serviceObb||o.push(h[0],h[1],n?h[2]:0),m(h,d,0,se,l,0,1);const u=v(se[0],se[1],n?se[2]:void 0,l),p=this.loadedGraphics.get(f);a(p)?c.push(p):c.push({objectId:f,uid:t.generateUID(),geometry:u,attributes:_,visible:!0})}u.push(y)}r.graphics=c,r.featureIds=u}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>x(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this._nodesAddedToStage.forEach(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,i){this._nodesAddedToStage.has(e.index)?s.getLogger(this.declaredClass).error("I3S node "+e.id+" already added"):(this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),await this.updateAttributes(e.index,r,i),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this._nodesAddedToStage.get(e);r&&!o(r.attributeInfo)&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const s=this._nodesAddedToStage.get(e);s&&(await this._i3sOverrides.apply(s.featureIds,t,r),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){if(ee(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||b}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,s=new Set;let i,o;e?(await e.collectRequiredFields(s,r),i=Array.from(s).sort()):i=[],s.clear(),t?(await t.collectRequiredFields(s,r),o=Array.from(s).sort()):o=[],i.length===o.length&&i.every(((e,t)=>i[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&s.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,s=this._excludeObjectIdsSorted,i=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(s)||r(s,a.attributes[i])<0;a.visible=n&&d,e!==a.visible&&(ie.graphic=a,ie.property="visible",ie.oldValue=e,ie.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(ie))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new S(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():S.from(e))}getUsedMemory(){return this.processor?.graphicsCore?.usedMemory??0}getUnloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){j(this._attributeEditingContext,e)}get _attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo,i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,s)=>{this._setAttributeData(t,r);const i=this._nodesAddedToStage.get(t);if(a(s)){const t=this.loadedGraphics.get(s.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(i)&&this.processor.graphicsCore.recreateGraphics(i.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,loadedGraphics:this.loadedGraphics}}};e([h()],Y.prototype,"processor",void 0),e([h({type:w})],Y.prototype,"filter",void 0),e([h()],Y.prototype,"loadedGraphics",void 0),e([h()],Y.prototype,"i3slayer",null),e([h()],Y.prototype,"_controller",void 0),e([h()],Y.prototype,"updating",void 0),e([h()],Y.prototype,"suspended",void 0),e([h()],Y.prototype,"holeFilling",void 0),e([h(k)],Y.prototype,"updatingProgress",void 0),e([h()],Y.prototype,"updatingProgressValue",null),e([h(K.requiredFields)],Y.prototype,"requiredFields",null),e([h(K.availableFields)],Y.prototype,"availableFields",void 0),e([h()],Y.prototype,"_fieldsHelper",void 0),e([h({type:Number})],Y.prototype,"maximumNumberOfFeatures",null),e([h({readOnly:!0})],Y.prototype,"maximumNumberOfFeaturesExceeded",null),e([h()],Y.prototype,"_excludeObjectIdsSorted",null),e([h({readOnly:!0})],Y.prototype,"lodFactor",null),e([h({readOnly:!0})],Y.prototype,"hasM",null),e([h({readOnly:!0})],Y.prototype,"hasZ",null),Y=e([u("esri.views.3d.layers.SceneLayerGraphicsView3D")],Y);const $=Y;function J(e){return"pointData"in e}function X(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function ee(e){const t=e.attributeInfo;for(let r=0;r<e.graphics.length;r++){const s=e.graphics[r];if(s.attributes||(s.attributes={}),a(t)&&a(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=V(t.attributeData[e],r))}}function te(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const re={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},se=g(),ie={graphic:null,property:null,oldValue:null,newValue:null};export{$ as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import s from"../../../core/Logger.js";import{destroyMaybe as i,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{s as c}from"../../../chunks/vec3.js";import{c as p}from"../../../chunks/vec3f64.js";import{projectBuffer as g,projectVectorToVector as m}from"../../../geometry/projection.js";import{extentContainsCoords3D as y}from"../../../geometry/support/contains.js";import{getGeometryZScaler as _}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{makeDehydratedPoint as b,estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as x}from"../../../layers/graphics/hydratedFeatures.js";import E from"../../../layers/graphics/controllers/I3SOnDemandController.js";import w from"../../../layers/support/FeatureFilter.js";import I from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as S}from"./I3SPointsWorkerHandle.js";import{LayerView3D as C}from"./LayerView3D.js";import A from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as F}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as O,processAttributeEdits as D}from"./i3s/attributeEditing.js";import{I3SOverrides as j}from"./i3s/I3SOverrides.js";import{checkSpatialReferences as N,containsDraco as T,whenGraphicAttributes as L,getCachedAttributeValue as P}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as M}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as G}from"./support/fieldProperties.js";import{PopupSceneLayerView as V}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as R}from"./support/SceneLayerViewRequiredFields.js";import H from"../support/debugFlags.js";import{GraphicsMap as q}from"../support/GraphicsMap.js";import{compute as U}from"../support/orientedBoundingBox.js";import{updatingProgress as Q}from"../support/updatingProperties.js";import{Attribute as B}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as k}from"../webgl-engine/lib/basicInterfaces.js";import z from"../../layers/SceneLayerView.js";import{TaskPriority as Z}from"../../support/Scheduler.js";const W=G();let K=class extends(M(V(C(z)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._nodesAddedToStage=new Map,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new q,this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){const e=this.layer;this.addResolvingPromise(e.indexInfo),this._i3sOverrides=new j({view:this.view,layer:this.layer,memoryController:this.view.resourceController?.memoryController}),N(e,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new R({layerView:this}),this.updatingHandles.add((()=>e.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>e.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted]),(()=>this._filterChange())),this.handles.add(l((()=>H.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&H.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||H.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new A({owner:this,preferredUpdatePolicy:k.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:e.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(e=>this._controller.updateElevationChanged(e.extent,e.spatialReference))),this.supportsHeightUnitConversion&&(this._verticalScale=_("point",e.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(e.uid),this._controller=new E({layerView:this,scaleVisibilityEnabled:!1}),T(this.layer.geometryDefinitions)&&(this._worker=new S((e=>this.view.resourceController.immediate.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{const e=()=>this.processor.featureStore;this._queryEngine=new F({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:Z.FEATURE_QUERY_ENGINE}),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=i(this._treeDebugger),this._i3sOverrides=i(this._i3sOverrides),this._set("processor",i(this.processor)),this._controller=i(this._controller),this._queryEngine=i(this._queryEngine),this._worker=i(this._worker),this._memCache=i(this._memCache),this._nodesAddedToStage.clear(),this._fieldsHelper=i(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??1}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return L(this.layer,e,this._getObjectIdField(),t,(()=>[...this._nodesAddedToStage.values()]))}getHit(e){if(!this.loadedGraphics)return null;const t=x(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return O(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};o(this._worker)&&(this._worker=new S((e=>this.view.resourceController.immediate.schedule(e))));const s=await this._worker.invoke(r,t);if(o(s))throw new Error("Failed to decompress Draco point data");return{positionData:s.positions,featureIds:s.featureIds}}async addNode(e,t,r){if(!J(t)&&!$(t))throw new Error;if(this._nodesAddedToStage.has(e.index))return void s.getLogger(this.declaredClass).error("I3S node "+e.id+" already added");const i=a(this.layer.fullExtent)?ee(this.layer.fullExtent.clone(),.5):null,o=[],{featureIds:n,pointPositions:d}=J(t)?await this._extractBinaryPointPositions(e,t,r):this._extractLegacyPointPositions(t);this._validatePositions(e,n,d,i,o);const l=this._controller.crsVertex,h=this.view.spatialReference;g(d,l,0,d,h,0,n.length);const u=J(t)?e.level:0,c={graphics:this._createGraphics(n,d,u),featureIds:n,attributeInfo:t.attributeDataInfo,node:e};if(await this._i3sOverrides.apply(c.featureIds,t.attributeDataInfo,r),e.numFeatures=c.graphics.length,this._updateNodeMemory(e),X(c),o.length>0&&(this._computeObb(e,o,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(c);if(a(this._verticalScale))for(const s of c.graphics)this._verticalScale(s.geometry);const p=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(a(p))for(let s=0;s<c.featureIds.length;s++){const e=c.featureIds[s];p.setUidToObjectAndLayerId(e,c.graphics[s].uid,this.layer.id,this.layer.uid,this.layer.popupEnabled,c.node.resources.attributes,s)}this._nodesAddedToStage.set(e.index,c),this.loadedGraphics.addMany(c.graphics),this._controller.updateLoadStatus(e.index,!0),this._filterNode(c),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const s=this._controller.crsIndex,i=s.isGeographic?this.view.renderSpatialReference:s;g(t,r,0,t,i,0,t.length/3),e.serviceObb=U(new B(t,3)),s.isGeographic&&m(e.serviceObb.center,i,e.serviceObb.center,s)}isNodeLoaded(e){return this._nodesAddedToStage.has(e)}isNodeReloading(){return!1}updateNodeState(){}async _extractBinaryPointPositions(e,t,r){const s=await this._decompressBinaryPointData(t,r),i=s.positionData,o=3,n=i.length/o,d=new Float64Array(3*n),l=a(e.serviceObb)?e.serviceObb.center:[0,0,0],h=Math.abs(l[2])*2**-20;for(let a=0;a<n;a++){const e=a*o;d[e+0]=i[e+0]+l[0],d[e+1]=i[e+1]+l[1],d[e+2]=i[e+2]+l[2],Math.abs(d[e+2])<h&&(d[e+2]=0)}return{featureIds:Array.from(s.featureIds),pointPositions:d}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=new Float64Array(3*t),s=new Array;for(let i=0;i<t;i++){const t=e.pointData[i],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??te[a],d=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const l=n.params.vertexAttributes?.position??[0,0,0],h=3*s.length;r[h+0]=o[0]+l[0],r[h+1]=o[1]+l[1],r[h+2]=3===a?o[2]+l[2]:NaN,s.push(d)}return{featureIds:s,pointPositions:r}}_validatePositions(e,t,r,i,n){if(o(i)&&e.serviceObb)return;const d=t.length,l=3;for(let o=0;o<d;o++){const t=o*l;c(re,r[t],r[t+1],r[t+2]),a(i)&&!y(i,re)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&s.getLogger(this.declaredClass).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&s.getLogger(this.declaredClass).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObb||n.push(re[0],re[1],re[2])}}_createGraphics(e,r,s){const i=e.length,o=3,d=this._getObjectIdField(),l=this.processor.graphicsCore,h=new Array,u=this.view.spatialReference;for(let c=0;c<i;c++){const i=e[c],p={};null!=i&&(p[d]=i);const g=i??t.generateUID(),m=c*o,y=isNaN(r[m+2])?void 0:r[m+2],_=b(r[m],r[m+1],y,u),f=this.loadedGraphics.get(g);if(a(f))(!f.level||f.level<s)&&(se.property="geometry",se.graphic=f,se.oldValue=n(f.geometry),se.newValue=_,f.geometry=_,f.level=s,l.graphicUpdateHandler(se)),h.push(f);else{const e=t.generateUID();h.push({objectId:g,uid:e,geometry:_,attributes:p,visible:!0,level:s})}}return h}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>v(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this._nodesAddedToStage.forEach(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._nodesAddedToStage.clear(),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this._nodesAddedToStage.get(e);return t?(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeMany(t.graphics),this._nodesAddedToStage.delete(e),this._treeDebugger&&this._treeDebugger.update(),t):null}async loadCachedNodeData(e){return this._memCache.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,i){this._nodesAddedToStage.has(e.index)?s.getLogger(this.declaredClass).error("I3S node "+e.id+" already added"):(this.loadedGraphics.addMany(t.graphics),this._nodesAddedToStage.set(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),await this.updateAttributes(e.index,r,i),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this._nodesAddedToStage.forEach((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this._nodesAddedToStage.forEach((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this._nodesAddedToStage.forEach(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodesAddedToStage.get(e);if(t&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this._nodesAddedToStage.get(e);r&&!o(r.attributeInfo)&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const s=this._nodesAddedToStage.get(e);s&&(await this._i3sOverrides.apply(s.featureIds,t,r),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){if(X(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||f}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,s=new Set;let i,o;e?(await e.collectRequiredFields(s,r),i=Array.from(s).sort()):i=[],s.clear(),t?(await t.collectRequiredFields(s,r),o=Array.from(s).sort()):o=[],i.length===o.length&&i.every(((e,t)=>i[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&s.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this._nodesAddedToStage.forEach((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,s=this._excludeObjectIdsSorted,i=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(s)||r(s,a.attributes[i])<0;a.visible=n&&d,e!==a.visible&&(se.graphic=a,se.property="visible",se.oldValue=e,se.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(se))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new I(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():I.from(e))}getUsedMemory(){return this.processor?.graphicsCore?.usedMemory??0}getUnloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){D(this._attributeEditingContext,e)}get _attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this._nodesAddedToStage.forEach((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo,i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,s)=>{this._setAttributeData(t,r);const i=this._nodesAddedToStage.get(t);if(a(s)){const t=this.loadedGraphics.get(s.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(i)&&this.processor.graphicsCore.recreateGraphics(i.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this._nodesAddedToStage.size,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this._nodesAddedToStage.size,loadedGraphics:this.loadedGraphics}}};e([h()],K.prototype,"processor",void 0),e([h({type:w})],K.prototype,"filter",void 0),e([h()],K.prototype,"loadedGraphics",void 0),e([h()],K.prototype,"i3slayer",null),e([h()],K.prototype,"_controller",void 0),e([h()],K.prototype,"updating",void 0),e([h()],K.prototype,"suspended",void 0),e([h()],K.prototype,"holeFilling",void 0),e([h(Q)],K.prototype,"updatingProgress",void 0),e([h()],K.prototype,"updatingProgressValue",null),e([h(W.requiredFields)],K.prototype,"requiredFields",null),e([h(W.availableFields)],K.prototype,"availableFields",void 0),e([h()],K.prototype,"_fieldsHelper",void 0),e([h({type:Number})],K.prototype,"maximumNumberOfFeatures",null),e([h({readOnly:!0})],K.prototype,"maximumNumberOfFeaturesExceeded",null),e([h()],K.prototype,"_excludeObjectIdsSorted",null),e([h({readOnly:!0})],K.prototype,"lodFactor",null),e([h({readOnly:!0})],K.prototype,"hasM",null),e([h({readOnly:!0})],K.prototype,"hasZ",null),K=e([u("esri.views.3d.layers.SceneLayerGraphicsView3D")],K);const Y=K;function $(e){return"pointData"in e}function J(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function X(e){const t=e.attributeInfo;for(let r=0;r<e.graphics.length;r++){const s=e.graphics[r];if(s.attributes||(s.attributes={}),a(t)&&a(t.loadedAttributes))for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=P(t.attributeData[e],r))}}function ee(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.hasZ&&(e.zmin-=t,e.zmax+=t),e.hasM&&(e.mmin-=t,e.mmax+=t),e}const te={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},re=p(),se={graphic:null,property:null,oldValue:null,newValue:null};export{Y 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as r,isSome as i}from"../../../core/maybe.js";import{whenOnce as a}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{updatingProgress as o,updatingProgressValue as n}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as p}from"../terrain/terrainUtils.js";const c=c=>{let m=class extends c{get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,r=e[e.length-1].scale;return this.levelRangeFromScaleRange(t,r)}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,r=this.layer.maxScale||e[e.length-1].scale,i=this.levelRangeFromScaleRange(t,r);return this.layer.maxScale&&i.maxLevel++,i}getTileUrl(e,t,r){return this.layer.getTileUrl(e,t,r)}_addTilingSchemeMatchPromise(){if(r(this.fullExtent))return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(i(e))return this.addResolvingPromise(Promise.reject(e));const s=a((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t=this._getTileInfoCompatibilityError(this.tileInfo,e);if(t)throw t}));this.addResolvingPromise(s)}_getTileInfoSupportError(e,r){const i=p(e,r,this.view.spatialReference,this.view.state.viewingMode);if(i){const e={layer:this.layer,error:i};let r;switch(i.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":r=new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",e);break;default:r=new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",e)}return r}return null}_getTileInfoCompatibilityError(e,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as r,isSome as i}from"../../../core/maybe.js";import{whenOnce as a}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{updatingProgress as o,updatingProgressValue as n}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as p}from"../terrain/terrainUtils.js";const c=c=>{let m=class extends c{get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,r=e[e.length-1].scale;return this.levelRangeFromScaleRange(t,r)}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,r=this.layer.maxScale||e[e.length-1].scale,i=this.levelRangeFromScaleRange(t,r);return this.layer.maxScale&&i.maxLevel++,i}getTileUrl(e,t,r){return this.layer.getTileUrl(e,t,r)}_addTilingSchemeMatchPromise(){if(r(this.fullExtent))return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(i(e))return this.addResolvingPromise(Promise.reject(e));const s=a((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t=this._getTileInfoCompatibilityError(this.tileInfo,e);if(t)throw t}));this.addResolvingPromise(s)}_getTileInfoSupportError(e,r){const i=p(e,r,this.view.spatialReference,this.view.state.viewingMode);if(i){const e={layer:this.layer,error:i};let r;switch(i.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":r=new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",e);break;default:r=new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",e)}return r}return null}_getTileInfoCompatibilityError(e,i){return r(e)||!i.compatibleWith(e)?new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface"):null}levelRangeFromScaleRange(e,t){const r={minLevel:0,maxLevel:1/0},i=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!i)return r;const a=i.levels[0],s=e=>{const t=Math.log(a.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(r.minLevel=Math.max(0,s(e))),null!=t&&t>0&&(r.maxLevel=Math.max(0,s(t))),r}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([s({readOnly:!0})],m.prototype,"imageFormatIsOpaque",null),e([s({readOnly:!0})],m.prototype,"updating",void 0),e([s(o)],m.prototype,"updatingProgress",void 0),e([s(n)],m.prototype,"updatingProgressValue",void 0),e([s()],m.prototype,"fullExtent",null),e([s({readOnly:!0})],m.prototype,"isOpaque",null),e([s({readOnly:!0})],m.prototype,"dataLevelRange",null),e([s({readOnly:!0})],m.prototype,"displayLevelRange",null),e([s()],m.prototype,"layer",void 0),e([s()],m.prototype,"tileInfo",void 0),m=e([l("esri.views.3d.layers.TiledLayerView3D")],m),m};export{c as TiledLayerView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{getTileMaxtrixSetFromActiveLayer as n}from"../../../layers/support/layerUtils.js";import{LayerView3D as h}from"./LayerView3D.js";import{TiledLayerView3D as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{getTileMaxtrixSetFromActiveLayer as n}from"../../../layers/support/layerUtils.js";import{LayerView3D as h}from"./LayerView3D.js";import{TiledLayerView3D as d}from"./TiledLayerView3D.js";import c from"../../layers/LayerView.js";import m from"../../layers/RefreshableLayerView.js";let p=class extends(m(d(h(c)))){constructor(){super(...arguments),this.type="wmts-3d"}get hasMixedImageFormats(){return!0}_getCompatibleTileInfoMatrixSet(e,s=!1){const o=n(this.layer);if(r(o)){if(t.isCollection(o)){const t=o.find((t=>{const o=e(t);return r(o)&&(s?i.getLogger(this.declaredClass).error("The selected tile matrix set is not compatible with the view",o):this.addResolvingPromise(Promise.reject(o))),null==o}));return t}const a=e(o);return r(a)&&(s?i.getLogger(this.declaredClass).error("The selected tile matrix set is not compatible with the view",a):this.addResolvingPromise(Promise.reject(a))),o}return null}initialize(){this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoSupportError(e.tileInfo,e.fullExtent)));const e=o((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoError(e.tileInfo,e.fullExtent)));s(e)||(null!==e.id&&this.layer.activeLayer.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),e.tileInfo&&(this.tileInfo=e.tileInfo),this.layer.fullExtent=e.fullExtent)}));this.addResolvingPromise(e),this.when((()=>this._postInitialize()))}refresh(){this.emit("data-changed")}canResume(){if(!super.canResume())return!1;const e=this.layer.activeLayer.tileMatrixSet;return r(e)&&!this._getTileInfoError(e.tileInfo,e.fullExtent)}async doRefresh(){this.suspended||this.emit("data-changed")}_postInitialize(){this.updatingHandles.add((()=>this.layer?.activeLayer?.styleId),(()=>this.refresh())),this.updatingHandles.add((()=>this.layer?.activeLayer),(e=>{const t=this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoError(e.tileInfo,e.fullExtent)),!0);r(t)&&null!==t.id&&e.tileMatrixSetId!==t.id&&(this.layer.activeLayer.tileMatrixSetId=t.id),this.notifyChange("suspended"),this.canResume()&&this.refresh()}))}_getTileInfoError(e,t){return this._getTileInfoSupportError(e,t)||this._getTileInfoCompatibilityError(e,this.view.basemapTerrain.tilingScheme)}};e([a({readOnly:!0})],p.prototype,"hasMixedImageFormats",null),e([a()],p.prototype,"layer",void 0),e([a()],p.prototype,"suspended",void 0),p=e([l("esri.views.3d.layers.WMTSLayerView3d")],p);const f=p;export{f 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.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import{storeNode as a}from"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import h from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as u,HIGHLIGHT_COLOR as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g="esri-utility-trace-network",m={base:g,loaderContainer:`${g}__loader-container`,loader:`${g}__loader`,fadeIn:`${g}--fade-in`,addButtonContainer:`${g}__add-button-container`,noticeContainer:`${g}__notice-container`,listContainer:`${g}__list-container`,resultsContainer:`${g}__results-container`,flow:`${g}__flow`,esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",esriWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"esri-icon-handle-vertical",iconPlus:"esri-icon-plus",iconEdit:"esri-icon-edit",iconHandleHorizontal:"esri-icon-handle-horizontal",iconRefresh:"esri-icon-refresh",iconLink:"esri-icon-link",iconRemove:"esri-icon-erase",widgetIcon:"esri-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"esri-icon-loading-indicator",rotating:"esri-rotating"},w="esri.widgets.UtilityNetworkTrace";function _(e){return{height:e+"px"}}function b(e){return{width:e+"px"}}function v(){return{width:"75%"}}function y(){return{textAlign:"center"}}function T(){return{width:"100%"}}function S(){return{height:"100%"}}const f={NOEXTENTION:-2147208474};let R=class extends(t(o)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._warningNoTerminal=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultObjectIdField="objectid",this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this._loadUNError=!0,this._errorMessage="",this.disabled=!0,this.iconClass=m.widgetIcon,this.inputSettings=[],this.messages=null,this.viewModel=new h}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new u}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(e){this.viewModel.gdbVersion=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{switch(e){case"noStart":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}}))}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(m.base,m.esriWidget,m.esriWidgetPanel,{[m.esriWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js")])}switchTab(e){this._activeTab=e}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s}renderLoading(){return d("div",{class:m.loaderContainer,key:"loader"},d("div",{class:m.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"top",layout:"center",styles:T()},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{selected:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{selected:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{selected:"input"===this._activeTab},this.renderInputPanel()),d("calcite-tab",{selected:"result"===this._activeTab},this.viewModel._activeProgress?d("calcite-loader",{label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{open:this._confirmReset,kind:"brand",scale:"m",width:"s",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),this._loadUNError||(t=d("calcite-panel",null,this.renderWarningMessage("loadUNError",!1,this._errorMessage))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:m.flow},d("calcite-flow-item",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTerminal?this.renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:_(10)}):null,d("calcite-button",{slot:"footer",scale:"m",kind:"brand",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("calcite-flow",{styles:S()},this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null,this._showIndividualRecords?this.renderTraceResultIndividualPopover():null)}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:m.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:m.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e?this._warningNoFlag=!1:this._warningNoStartAssetFound=!0,this._selectToolActive=!1}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:m.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:m.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",kind:"brand","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let r=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(r=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.includes(t.id)&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,r?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multiple",scale:"s",maxItems:0,onCalciteComboboxChange:t=>{t.target.selectedItems.length>0?(e.selectedTerminals=[],t.target.selectedItems.forEach((t=>{this.viewModel.addTerminal(t.value,e)}))):e.selectedTerminals=[]},onCalciteComboboxChipClose:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-flow-item",{"height-scale":"s",onCalciteFlowItemBack:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:y()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:y()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multiple",scale:"s",maxItems:0,onCalciteComboboxChipClose:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",kind:"brand",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,l=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,l=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,l=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,l=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",l=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,l=s||""}return d("div",{class:m.noticeContainer,key:e},d("calcite-notice",{key:e,open:!0,closable:t,icon:!0,scale:"s",width:"auto",kind:"danger",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},r),d("div",{slot:"message"},l)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this,i=[];for(let r=0;r<p.length;r++)i.push(d("calcite-action",{key:r,text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(r),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(r).hex,active:e.color===this._graphicHandler.getHighlightColor(r).color})));return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},i))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let r=[],l=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(l=t.results.globalFunctionResults,l.length>0&&(n=!0)),t.results.elements.length>0&&(r=t.results.elements,r.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,description:t.trace.description,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+l.length+")",onCalciteListItemSelect:()=>{this.switchToFunctions(l,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+r.length+")",onCalciteListItemSelect:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+r.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:_(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+r.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto-start",offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-flow-item",{key:"traceResults",styles:S()},s,this.renderStartOverContainer(),d("calcite-modal",{open:this._alertRemoveModal,kind:"brand",scale:"m",width:"s",onCalciteModalClose:()=>{this._alertRemoveModal=!1}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1)}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-flow-item",{key:"functionResultMultiple",onCalciteFlowItemBack:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-flow-item",{key:"assetGroupResultMultiple",onCalciteFlowItemBack:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-flow-item",{key:"assetTypeResult",onCalciteFlowItemBack:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){t[0].details.fields.some((e=>e.name.toLowerCase()===this._resultDisplayField.toLocaleLowerCase()))||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))}return d("calcite-flow-item",{key:"individualResult",onCalciteFlowItemBack:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options"+this.id,afterCreate:a,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer())}renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&t[0].details.fields.forEach((e=>{s.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),i.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"left-start",offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,styles:null!==this.domNode?b(.75*this.domNode.clientWidth):v()},d("calcite-block",{heading:"",open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),d("calcite-label",{scale:"s"},e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s="",i=null;for(let r=0;r<e.details.fields.length;r++)e.details.fields[r].name===this._resultDisplayField&&(i=e.details.fields[r]);if("date"===i.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if(null!==i.domain){const t=i.domain.codedValues;let r="";for(let s=0;s<t.length;s++)t[s].code===e.details.attributes[this._resultDisplayField]&&(r=t[s].name);s=r}else s="assetgroup"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetGroupName(e):"assettype"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetTypeName(e):e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onCalciteListItemSelect:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})):this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))))).catch((e=>{const{messages:t}=this;this._loadUNError=!1,e.details.raw.extendedCode===f.NOEXTENTION?this._errorMessage=t?.alertsStrings?.noUserExtension||e.message:this._errorMessage=e.message,this.disabled=!1}))}_registerWatchers(){this.addHandles([i((()=>this.selectedTraces),(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i((()=>this.defaultGraphicColor),(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))])}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.forEach((t=>{t.featureSet.features.forEach((r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))}))}))})),i}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const e=i.assetGroups.find((e=>e.assetGroupCode===s));e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const r=i.assetGroups.find((e=>e.assetGroupCode===s));if(r){const s=r.assetTypes.find((t=>t.assetTypeCode===e.assetTypeCode));s&&(t=s.assetTypeName)}}return t}_compare(e,t){return(s,i)=>{let r=0,l=s.details.attributes[e],o=i.details.attributes[e];return isNaN(l)&&(l=l.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?l>o?r=1:l<o&&(r=-1):l<o?r=1:l>o&&(r=-1),r}}_groupBy(e,t){return e.reduce(((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e)),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],R.prototype,"_tracesExists",void 0),e([r()],R.prototype,"_selectToolActive",void 0),e([r()],R.prototype,"_activeTrace",void 0),e([r()],R.prototype,"_activeSwatch",void 0),e([r()],R.prototype,"_traceHeaderForFlow",void 0),e([r()],R.prototype,"_assetGroupHeader",void 0),e([r()],R.prototype,"_assetTypeHeader",void 0),e([r()],R.prototype,"_traceResultsFunctions",void 0),e([r()],R.prototype,"_traceResultsAssetGroup",void 0),e([r()],R.prototype,"_traceResultsAssetType",void 0),e([r()],R.prototype,"_traceResultsIndividual",void 0),e([r()],R.prototype,"_showTraceResultFunctions",void 0),e([r()],R.prototype,"_showTraceResultAssetGroup",void 0),e([r()],R.prototype,"_showTraceResultAssetType",void 0),e([r()],R.prototype,"_showIndividualRecords",void 0),e([r()],R.prototype,"_activeTab",void 0),e([r()],R.prototype,"_alertRemoveModal",void 0),e([r()],R.prototype,"_warningNoFlag",void 0),e([r()],R.prototype,"_warningNoTraceSelected",void 0),e([r()],R.prototype,"_confirmReset",void 0),e([r()],R.prototype,"_swatchNode",void 0),e([r()],R.prototype,"_errorMessage",void 0),e([r()],R.prototype,"defaultGraphicColor",null),e([r()],R.prototype,"disabled",void 0),e([r()],R.prototype,"flags",null),e([r()],R.prototype,"gdbVersion",null),e([r()],R.prototype,"iconClass",void 0),e([r()],R.prototype,"inputSettings",void 0),e([r()],R.prototype,"label",null),e([r(),n("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],R.prototype,"messages",void 0),e([r()],R.prototype,"selectedTraces",null),e([r()],R.prototype,"selectOnComplete",null),e([r()],R.prototype,"showGraphicsOnComplete",null),e([r()],R.prototype,"showSelectionAttributes",null),e([r()],R.prototype,"view",null),e([c(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:h})],R.prototype,"viewModel",void 0),R=e([l(w)],R);const C=R;export{C as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import{storeNode as a}from"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import h from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as u,HIGHLIGHT_COLOR as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g="esri-utility-trace-network",m={base:g,loaderContainer:`${g}__loader-container`,loader:`${g}__loader`,fadeIn:`${g}--fade-in`,addButtonContainer:`${g}__add-button-container`,noticeContainer:`${g}__notice-container`,listContainer:`${g}__list-container`,resultsContainer:`${g}__results-container`,flow:`${g}__flow`,esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",esriWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"esri-icon-handle-vertical",iconPlus:"esri-icon-plus",iconEdit:"esri-icon-edit",iconHandleHorizontal:"esri-icon-handle-horizontal",iconRefresh:"esri-icon-refresh",iconLink:"esri-icon-link",iconRemove:"esri-icon-erase",widgetIcon:"esri-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"esri-icon-loading-indicator",rotating:"esri-rotating"},w="esri.widgets.UtilityNetworkTrace";function _(e){return{height:e+"px"}}function b(e){return{width:e+"px"}}function v(){return{width:"75%"}}function y(){return{textAlign:"center"}}function T(){return{width:"100%"}}function S(){return{height:"100%"}}const f={NOEXTENTION:-2147208474};let R=class extends(t(o)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._warningNoTerminal=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultObjectIdField="objectid",this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this._loadUNError=!0,this._errorMessage="",this.disabled=!0,this.iconClass=m.widgetIcon,this.inputSettings=[],this.messages=null,this.viewModel=new h}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new u}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(e){this.viewModel.gdbVersion=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{switch(e){case"noStart":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}}))}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(m.base,m.esriWidget,m.esriWidgetPanel,{[m.esriWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js")])}switchTab(e){this._activeTab=e}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s}renderLoading(){return d("div",{class:m.loaderContainer,key:"loader"},d("div",{class:m.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"top",layout:"center",styles:T()},d("calcite-tab-nav",{slot:"title-group"},d("calcite-tab-title",{selected:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{selected:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{selected:"input"===this._activeTab},this.renderInputPanel()),d("calcite-tab",{selected:"result"===this._activeTab},this.viewModel._activeProgress?d("calcite-loader",{label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{open:this._confirmReset,kind:"brand",scale:"m",width:"s",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),this._loadUNError||(t=d("calcite-panel",null,this.renderWarningMessage("loadUNError",!1,this._errorMessage))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:m.flow},d("calcite-flow-item",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTerminal?this.renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:_(10)}):null,d("calcite-button",{slot:"footer",scale:"m",kind:"brand",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("calcite-flow",{styles:S()},this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null,this._showIndividualRecords?this.renderTraceResultIndividualPopover():null)}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:m.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:m.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e?this._warningNoFlag=!1:this._warningNoStartAssetFound=!0,this._selectToolActive=!1}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:m.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:m.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",kind:"brand","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let r=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(r=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.includes(t.id)&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,r?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multiple",scale:"s",maxItems:0,onCalciteComboboxChange:t=>{t.target.selectedItems.length>0?(e.selectedTerminals=[],t.target.selectedItems.forEach((t=>{this.viewModel.addTerminal(t.value,e)}))):e.selectedTerminals=[]},onCalciteComboboxChipClose:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-flow-item",{"height-scale":"s",onCalciteFlowItemBack:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:y()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:y()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multiple",scale:"s",maxItems:0,onCalciteComboboxChipClose:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",kind:"brand",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,l=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,l=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,l=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,l=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",l=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,l=s||""}return d("div",{class:m.noticeContainer,key:e},d("calcite-notice",{key:e,open:!0,closable:t,icon:!0,scale:"s",width:"auto",kind:"danger",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},r),d("div",{slot:"message"},l)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this,i=[];for(let r=0;r<p.length;r++)i.push(d("calcite-action",{key:r,text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(r),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(r).hex,active:e.color===this._graphicHandler.getHighlightColor(r).color})));return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},i))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let r=[],l=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(l=t.results.globalFunctionResults,l.length>0&&(n=!0)),t.results.elements.length>0&&(r=t.results.elements,r.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,description:t.trace.description,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+l.length+")",onCalciteListItemSelect:()=>{this.switchToFunctions(l,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+r.length+")",onCalciteListItemSelect:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+r.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:_(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+r.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto-start",offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-flow-item",{key:"traceResults",styles:S()},s,this.renderStartOverContainer(),d("calcite-modal",{open:this._alertRemoveModal,kind:"brand",scale:"m",width:"s",onCalciteModalClose:()=>{this._alertRemoveModal=!1}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1)}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-flow-item",{key:"functionResultMultiple",onCalciteFlowItemBack:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-flow-item",{key:"assetGroupResultMultiple",onCalciteFlowItemBack:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-flow-item",{key:"assetTypeResult",onCalciteFlowItemBack:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){t[0].details.fields.some((e=>e.name.toLowerCase()===this._resultDisplayField.toLocaleLowerCase()))||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))}return d("calcite-flow-item",{key:"individualResult",onCalciteFlowItemBack:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options"+this.id,afterCreate:a,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer())}renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&t[0].details.fields.forEach((e=>{s.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),i.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"left-start",offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,styles:null!==this.domNode?b(.75*this.domNode.clientWidth):v()},d("calcite-block",{heading:"",open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),d("calcite-label",{scale:"s"},e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s="",i=null;for(let r=0;r<e.details.fields.length;r++)e.details.fields[r].name===this._resultDisplayField&&(i=e.details.fields[r]);if("date"===i.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if(null!==i.domain){const t=i.domain.codedValues;let r="";for(let s=0;s<t.length;s++)t[s].code===e.details.attributes[this._resultDisplayField]&&(r=t[s].name);s=r}else s="assetgroup"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetGroupName(e):"assettype"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetTypeName(e):e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onCalciteListItemSelect:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})):this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))))).catch((e=>{const{messages:t}=this;this._loadUNError=!1,e.details.raw.extendedCode===f.NOEXTENTION?this._errorMessage=t?.alertsStrings?.noUserExtension||e.message:this._errorMessage=e.message,this.disabled=!1}))}_registerWatchers(){this.addHandles([i((()=>this.selectedTraces),(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i((()=>this.defaultGraphicColor),(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))])}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.forEach((t=>{t.featureSet.features.forEach((r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))}))}))})),i}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const e=i.assetGroups.find((e=>e.assetGroupCode===s));e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const r=i.assetGroups.find((e=>e.assetGroupCode===s));if(r){const s=r.assetTypes.find((t=>t.assetTypeCode===e.assetTypeCode));s&&(t=s.assetTypeName)}}return t}_compare(e,t){return(s,i)=>{let r=0,l=s.details.attributes[e],o=i.details.attributes[e];return isNaN(l)&&(l=l.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?l>o?r=1:l<o&&(r=-1):l<o?r=1:l>o&&(r=-1),r}}_groupBy(e,t){return e.reduce(((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e)),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],R.prototype,"_tracesExists",void 0),e([r()],R.prototype,"_selectToolActive",void 0),e([r()],R.prototype,"_activeTrace",void 0),e([r()],R.prototype,"_activeSwatch",void 0),e([r()],R.prototype,"_traceHeaderForFlow",void 0),e([r()],R.prototype,"_assetGroupHeader",void 0),e([r()],R.prototype,"_assetTypeHeader",void 0),e([r()],R.prototype,"_traceResultsFunctions",void 0),e([r()],R.prototype,"_traceResultsAssetGroup",void 0),e([r()],R.prototype,"_traceResultsAssetType",void 0),e([r()],R.prototype,"_traceResultsIndividual",void 0),e([r()],R.prototype,"_showTraceResultFunctions",void 0),e([r()],R.prototype,"_showTraceResultAssetGroup",void 0),e([r()],R.prototype,"_showTraceResultAssetType",void 0),e([r()],R.prototype,"_showIndividualRecords",void 0),e([r()],R.prototype,"_activeTab",void 0),e([r()],R.prototype,"_alertRemoveModal",void 0),e([r()],R.prototype,"_warningNoFlag",void 0),e([r()],R.prototype,"_warningNoTraceSelected",void 0),e([r()],R.prototype,"_confirmReset",void 0),e([r()],R.prototype,"_swatchNode",void 0),e([r()],R.prototype,"_errorMessage",void 0),e([r()],R.prototype,"defaultGraphicColor",null),e([r()],R.prototype,"disabled",void 0),e([r()],R.prototype,"flags",null),e([r()],R.prototype,"gdbVersion",null),e([r()],R.prototype,"iconClass",void 0),e([r()],R.prototype,"inputSettings",void 0),e([r()],R.prototype,"label",null),e([r(),n("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],R.prototype,"messages",void 0),e([r()],R.prototype,"selectedTraces",null),e([r()],R.prototype,"selectOnComplete",null),e([r()],R.prototype,"showGraphicsOnComplete",null),e([r()],R.prototype,"showSelectionAttributes",null),e([r()],R.prototype,"view",null),e([c(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:h})],R.prototype,"viewModel",void 0),R=e([l(w)],R);const C=R;export{C as default};
|