@arcgis/core 5.1.0-next.47 → 5.1.0-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{521a671182b0f79e3624.js → 193775b3b7de8f5dc578.js} +1 -1
- package/assets/esri/core/workers/chunks/{c0ecb68387e342dddf58.js → 25509953f19fbc4949a1.js} +1 -1
- package/assets/esri/core/workers/chunks/2669a7195f1de21a9cf3.js +1 -0
- package/assets/esri/core/workers/chunks/330da3828eefd8d72d3f.js +1 -0
- package/assets/esri/core/workers/chunks/36425d29aaa5852cb41d.js +1 -0
- package/assets/esri/core/workers/chunks/440a650ed0867a16f559.js +1 -0
- package/assets/esri/core/workers/chunks/{aa367ca7f8326fd67881.js → 4afddb66242438b38df0.js} +1 -1
- package/assets/esri/core/workers/chunks/5344919fc6e8050450f1.js +1 -0
- package/assets/esri/core/workers/chunks/53c149bca42595b7dd1e.js +1 -0
- package/assets/esri/core/workers/chunks/{6afdaa6c4555c467dca7.js → 54420b66fd53d6e19ba5.js} +1 -1
- package/assets/esri/core/workers/chunks/74814678942a47fd48fb.js +1 -0
- package/assets/esri/core/workers/chunks/797bf402489b3677a5f7.js +1 -0
- package/assets/esri/core/workers/chunks/{5c830cce32710d70dfa6.js → 7dba4121cdd20dbc4b20.js} +1 -1
- package/assets/esri/core/workers/chunks/947a715b608c8affd812.js +1 -0
- package/assets/esri/core/workers/chunks/{867c0cd99a005a3d8e08.js → 9f7b5749f3ceca8d5978.js} +12 -9
- package/assets/esri/core/workers/chunks/aa69cbaa38b49677ddff.js +1 -0
- package/assets/esri/core/workers/chunks/{beb53b372d356800f333.js → ab414a60808ea05a63e6.js} +1 -1
- package/assets/esri/core/workers/chunks/b98dd9fc9a7e3ff6bd49.js +1 -0
- package/assets/esri/core/workers/chunks/cb8c17daec7055bf99cc.js +1 -0
- package/assets/esri/core/workers/chunks/{a9f35127c3f5bf42036b.js → de359f89e03da18999fc.js} +1 -1
- package/chunks/Fog.glsl.js +3 -3
- package/chunks/GlowComposition.glsl.js +5 -3
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/core/workers/WorkerHandle.js +1 -1
- package/core/workers/workers.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWorkerHandle.js +1 -1
- package/layers/OrientedImageryLayer.d.ts +152 -0
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/package.json +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/support/revision.js +1 -1
- package/time/TimeExtent.d.ts +34 -0
- package/time/TimeInterval.d.ts +15 -0
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/util/Fader.js +2 -0
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/Intersector.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PolygonOffset.js +2 -0
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/Dithering.glsl.js +4 -0
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +11 -10
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
- package/views/SceneView.d.ts +2 -1
- package/views/SceneView.js +1 -1
- package/views/draw/plugins/FreehandSegmentPlugin.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/types.d.ts +33 -2
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/assets/esri/core/workers/chunks/0601c316da0256a60538.js +0 -1
- package/assets/esri/core/workers/chunks/13d55e3c9aea04116eaa.js +0 -1
- package/assets/esri/core/workers/chunks/1a6a77902dd8c84e059a.js +0 -1
- package/assets/esri/core/workers/chunks/54c1d31e1efab765ee7a.js +0 -1
- package/assets/esri/core/workers/chunks/5b515b5741733bcb4645.js +0 -1
- package/assets/esri/core/workers/chunks/7f07f490c6fcc794c8d9.js +0 -1
- package/assets/esri/core/workers/chunks/970d971551e42f7ae08d.js +0 -1
- package/assets/esri/core/workers/chunks/abcb39ad1e2d54710766.js +0 -1
- package/assets/esri/core/workers/chunks/c2aa3b1344b42a904234.js +0 -1
- package/assets/esri/core/workers/chunks/cf5e4cf9b1aa37eeb6b0.js +0 -1
- package/assets/esri/core/workers/chunks/e63046a9567d84228644.js +0 -1
- package/assets/esri/core/workers/chunks/f4ec2dcdc4bbf7dbcc94.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import{polygonCentroid as s,extentCentroid as i}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as u}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as c,isCoordinate as m,cloneCurve as d}from"../../../geometry/support/curves/curveUtils.js";import p from"./AttributesBuilder.js";import{cleanFromGeometryEngine as f,getGeometry as h,transformCentroid as y}from"./geometryUtils.js";import{project as g}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as F,SnappingCandidateVertex as T}from"./SnappingCandidate.js";import{isDateField as I,isDateOnlyField as _,isTimestampOffsetField as v,isStringField as V,isTimeOnlyField as S}from"../../support/fieldUtils.js";import b from"../../../rest/support/AutoIntervalBinParameters.js";import R from"../../../rest/support/DateBinParameters.js";import{unitsDict as z}from"../../../rest/support/DateBinUtils.js";import B from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as A,calculateStringStatistics as w,calculateStatistics as N,processSummaryStatisticsResult as D,calculateUniqueValuesCount as P,createUVResult as q,calculateClassBreaks as O,resolveCBResult as j,calculateHistogram as C,calculatePercentile as Z,binIndex as G,getBinParams as E,getAttributeComparator as H}from"../../../statistics/utils.js";import{utc as U}from"../../../time/constants.js";import{DateTime as k}from"luxon";const J="bin";class Q{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new p(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const n=new Map,r=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!r.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,this.items,n);s.push(t)}r.set(a,this._calculateUniqueValues(s,this.items,e.returnDistinctValues))}const u=r.get(a);for(const t in u){const{data:i,items:a}=u[t],n=i.join(",");s&&!e.validateItems(a,s)||o.add(n)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=f({spatialReference:this.query.outSR,...g(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=f({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,s){const i=this.featureAdapter,a=X(this.hasZ,this.hasM),{point:n}=e,r="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y;function l(e,t){const s=(e-n.x)/r,i=(t-n.y)/o;return s*s+i*i}const p={candidates:[]},f="esriGeometryPolygon"===this.geometryType,h="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,y=this._getPointCreator(t,this.spatialReference,s),g=new L(null,0),x=new L(null,0),I={x:0,y:0,z:0};for(const u of this.items){const e=i.getObjectId(u),t=i.getGeometryWithCurves?.(u);if(null!=t){v(t,e);continue}const s=i.getGeometry(u);null==s||_(s,e)}return p.candidates.sort((e,t)=>e.distance-t.distance),p;function _(t,s){const{coords:i}=t,r=t.isPoint?W:t.lengths;if(g.coords=i,x.coords=i,e.returnEdge){let e=0;for(let t=0;t<r.length;t++){const i=r[t],o=e;for(let t=0;t<i;t++,e+=a){if(!f&&t===i-1)continue;if(g.coordsIndex=e,x.coordsIndex=t===i-1?o:e+a,!Y(I,n,g,x))continue;const r=l(I.x,I.y);r<=1&&p.candidates.push(new F(s,y(I),Math.sqrt(r),y(g),y(x)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<r.length;t++){const i=r[t],n=e,o=x;o.coordsIndex=n;for(let t=0;t<i;t++,e+=a){if(g.coordsIndex=e,f&&t===i-1&&g.x===o.x&&g.y===o.y)continue;const a=l(g.x,g.y);a<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(a)))}}}else if(h&&"ends"===e.vertexMode){let e=0;const t=[];for(let s=0;s<r.length;s++){t.push(e);const i=r[s];e+=i*a,i>1&&t.push(e-a)}for(const i of t){g.coordsIndex=i;const e=l(g.x,g.y);e<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(e)))}}}function v(t,s){const{candidates:i}=p,a={x:0,y:0,z:0};if(e.returnEdge){const e=[n.x,n.y],r=new L(e,0),o=new L(e,0);for(const{segments:n}of t.parts)for(const{start:t,curve:p}of n){const{curvePoint:n}=u(t,p,e),f=l(...n);if(f>1)continue;[a.x,a.y]=n,r.coords=t,o.coords=c(p);const h=m(p)?null:d(p);i.push(new F(s,y(a),Math.sqrt(f),y(r),y(o),!1,h))}}function r(e){a.x=t.vertexXY[2*e],a.y=t.vertexXY[2*e+1];const n=l(a.x,a.y);n>1||(a.z=t.vertexZ?.[e]??0,i.push(new T(s,y(a),Math.sqrt(n))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)r(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":r(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const s=t.partOffsets[e],i=t.partOffsets[e+1]-1;r(s),i!==s&&r(i)}}}}_getPointCreator(e,t,s){const i=null==s||l(t,s)?e=>e:e=>g(e,t,s),{hasZ:a}=this,n=0;return a&&e?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:n})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,minValue:r,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=I(m)||_(m)||v(m),p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:l,timeZone:u},this.items),f=A({normalizationType:a,normalizationField:i,minValue:r,maxValue:o}),h={value:.5,fieldType:m?.type},y=V(m)?w({values:p,supportsNullCount:f,percentileParams:h,outStatisticTypes:c}):N({values:p,minValue:r,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:h,outStatisticTypes:c});return D(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:n,timeZone:r}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:n,timeZone:r},this.items,!1),l=P(o);return q(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items),f=O(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return j(f,r)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items);return C(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:n}=K(i,this.fieldsIndex);e.sort((e,i)=>t(s(e,a,n),s(i,a,n)))}}_topNFeatures(t,s,i,a){if(t.length>1&&s?.length){const n=s.map(e=>{const{compare:t,fieldOrExpression:s,fieldInfo:i}=K(e,this.fieldsIndex);return(e,n)=>t(a(e,s,i),a(n,s,i))}).reduceRight((e,t)=>(s,i)=>{const a=t(s,i);return 0===a||Number.isNaN(a)?e(s,i):a}),r=[];for(const s of t)e(r,s,i,n);return r}return t.slice(0,i)}_createFeatureQueryResponse(e){const{items:t,geometryType:s,hasM:i,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:p,returnM:h}=e,y=null!=m&&t.length>(d||0)+m,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:s,hasM:i&&h,hasZ:a&&p,objectIdFieldName:n,spatialReference:f(u||o),transform:c&&r(c)||null}}_createFeatures(e,t){const s=new p(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:g=!1}=e,x=a&&f,F=i&&g;let T;const I=m||0,_=null!=d?I+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,n,_,(e,t,i)=>s.getFieldValue(e,t,i)):(T=[...t],this._sortFeatures(T,n,(e,t,i)=>s.getFieldValue(e,t,i))),(I>0||null!=_)&&(T=T.slice(I,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const i of T){const a=this.featureAdapter.getGeometry(i),n=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),geometry:h(this.geometryType,a,c,e,x,F)});t&&a&&!n.geometry&&(n.centroid=y(this,this.featureAdapter.getCentroid(i,this),e)),v[V++]=n}else if(!l&&u)for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:y(this,this.featureAdapter.getCentroid(i,this),e)});else for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:y(this,this.featureAdapter.getCentroid(i,this),e),geometry:h(this.geometryType,this.featureAdapter.getGeometry(i),c,e,x,F)})}else for(const r of T){const e=s.getAttributes(r);e&&(v[V++]=this._addFeatureJSONMetadata(r,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const s=this.featureAdapter.getMetadata?.(e);return void 0!==s&&(t.metadata=s),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,s=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,i=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>s)e=!0;else{const t=X(this.hasZ,this.hasM),s=this.featureAdapter;e=this.items.reduce((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)},0)/t>i}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,s={attributes:{}}){const i=[],a=new Map,n=new Map,r=new Map,o=new Map,l=new p(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,h=c?.length,y=!!h,g=y?c[0]:null,x=y&&!this.fieldsIndex.get(g);for(const p of u??[]){const{outStatisticFieldName:e,statisticType:u}=p,d=p,f="exceedslimit"!==u?p.onStatisticField:void 0,F="percentile_disc"===u||"percentile_cont"===u,T="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,I=y&&1===h&&(f===g||x)&&"count"===u;if(y){if(!r.has(f)){const e=[];for(const s of c){const i=this._getAttributeValues(l,s,t,a);e.push(i)}r.set(f,this._calculateUniqueValues(e,t,!T&&l.returnDistinctValues))}const s=r.get(f);if(!s)continue;const i=Object.keys(s);for(const n of i){const{count:i,data:r,items:u,itemPositions:p}=s[n],h=r.join(",");if(!m||l.validateItems(u,m)){const s=o.get(h)||{attributes:{}};if(T){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(d,u);s.aggregateGeometries[t]=e}else{let n=null;if(I)n=i;else{const e=this._getAttributeValues(l,f,t,a),s=p.map(t=>e[t]);n=F&&"statisticParameters"in d?this._getPercentileValue(d,s):this._getStatisticValue(d,s,null,l.returnDistinctValues)}s.attributes[e]=n}let n=0;c.forEach((e,t)=>s.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++n]=r[t]),o.set(h,s)}}}else if(T){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(d,t);s.aggregateGeometries[i]=e}else{const i=this._getAttributeValues(l,f,t,a);s.attributes[e]=F&&"statisticParameters"in d?this._getPercentileValue(d,i):this._getStatisticValue(d,i,n,l.returnDistinctValues)}const _="min"!==u&&"max"!==u||!V(this.fieldsIndex.get(f))&&!this._isAnyDateField(f)?null:this.fieldsIndex.get(f)?.type;i.push({name:e,alias:e,type:_||"esriFieldTypeDouble"})}const F=y?Array.from(o.values()):[s];return this._sortFeatures(F,d,(e,t)=>e.attributes[t]),f&&(F.length=Math.min(f,F.length)),{fields:i,features:F}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return I(t)||_(t)||v(t)||S(t)}async _getAggregateGeometry(e,t){const{convexHull:r,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,p=t.map(e=>h(d,c.getGeometry(e))),f=r(m,p,!0)[0],y={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=f?a(f):n(o(m,p));y.aggregateGeometries={...e,spatialReference:m},y.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=f?s(f):i(n(o(m,p)));y.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},y.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(y.aggregateGeometries=f,y.outStatisticFieldName=u||"convexHull");return y}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:n}=e;let r=null;r=s?.has(a)?s.get(a):V(this.fieldsIndex.get(a))||this._isAnyDateField(a)?w({values:t,returnDistinct:i}):N({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,r);return r["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:n,orderBy:r}=i,o=this.fieldsIndex.get(s);return Z(t,{value:n,orderBy:r,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s,i){if(i.has(t))return i.get(t);const a=this.fieldsIndex.get(t),n=s.map(s=>e.getFieldValue(s,t,a));return i.set(t,n),n}_calculateUniqueValues(e,t,s){const i={},a=t.length;for(let n=0;n<a;n++){const a=t[n],r=[];for(const t of e)r.push(t[n]);const o=r.join(",");null==i[o]?i[o]={count:1,data:r,items:[a],itemPositions:[n]}:(s||i[o].count++,i[o].items.push(a),i[o].itemPositions.push(n))}return i}async _getDataValues(e,s,i=!0){const a=new p(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:r,timeZone:o}=e;return n?a.getExpressionValues(s,n,{viewingMode:"map",scale:r,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(s,t(e),i)}_calculateHistogramBins(e,t,s){if(null==t.min&&null==t.max)return[];const i=t.intervals,a=t.min??0,n=t.max??0,r=i.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=s[o];if(null!=t&&t>=a&&t<=n){const e=G(i,t);e>-1&&(r[e].count++,r[e].items.push(l))}}return r}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:s,outAlias:i,valueType:a}=t,n=[],r=[{name:i??s,alias:i??s,type:a??"esriFieldTypeString"},{name:J,alias:J,type:"esriFieldTypeInteger"}],o=new p(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[s],(e,t,s)=>o.getFieldValue(e,t,s));const c=this._getAttributeValues(o,s,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(n.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[i??s]:d}}))),a.fields)for(const e of a.fields)r.some(t=>t.name===e.name)||r.push(e)}return{fields:r,features:n}}async _createBinsResponse(e,t){const s=e.bin;switch(t=t??this.items,s.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(b.fromJSON(s),e,t);case"dateBin":return this._createDateBinsResponse(R.fromJSON(s),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(B.fromJSON(s),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(M.fromJSON(s),e,t)}}async _createAutoIntervalBinsResponse(e,t,s){const{field:i,normalizationField:a,numBins:n,normalizationType:r,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),m=E(c,{field:i,normalizationField:a,normalizationType:r,normalizationTotal:o,numBins:n,minValue:x(r?e.normalizationMinValue:l,!1),maxValue:x(r?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,s);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,s){const{field:i,interval:a,start:n,end:r,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),p=S(this.fieldsIndex.get(i)),f=z.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),y=null!=n?x(n,p):h[0],g=null!=r?x(r,p):h[h.length-1],F=[];if(null!=y&&null!=g){const e={zone:t.outTimeReference?.ianaTimeZone??U},s=u?.unit?z.toJSON(u.unit):"milliseconds",i={[s]:u?.value||0},n=k.fromMillis(y,e).minus(i),r=k.fromMillis(g,e).minus(i),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const s=(e.weekday-t+7)%7;return e.minus({days:s}).startOf("day")};if("last"===o){let e="week"===f?((e,t)=>d(e,t).plus({days:7}))(r,m):r;for(;e>n;){const t=e.minus({[f]:a.value});if(t<n){F.unshift([l?t.plus(i).toMillis():n.plus(i).toMillis(),e.plus(i).toMillis()]);break}F.unshift([t.plus(i).toMillis(),e.plus(i).toMillis()]),e=t}}else{let e="first"===o?n:"week"===f?d(n,m):n.startOf(f);for(;e<=r;){const t=e.plus({[f]:a.value});if(t>r){F.push([e.plus(i).toMillis(),l?t.plus(i).toMillis():r.plus(i).toMillis()]);break}F.push([e.plus(i).toMillis(),t.plus(i).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:F,min:y,max:g},s);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,s){const{field:i}=e,a=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),n=S(this.fieldsIndex.get(i)),r=e.boundaries.map(e=>x(e,n)).sort((e,t)=>e-t),o=[];for(let c=0;c<r.length-1;c++)o.push([r[c],r[c+1]]);const l={intervals:o,min:r.at(0),max:r.at(-1)},u=this._calculateHistogramBins(a,l,s);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,s){const{field:i,interval:a,normalizationType:n,start:r,end:o}=e,l=await this._getDataValues({field:i||e.expression,normalizationField:e.normalizationField,normalizationType:n,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),u=S(this.fieldsIndex.get(i)),c=E(l,{field:i,classificationMethod:"defined-interval",definedInterval:a,minValue:x(n?e.normalizationMinValue:r,u),maxValue:x(n?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,s);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:s,lowerBoundaryAlias:i}=t,a=i||"lowerBoundary",n=s||"upperBoundary",r=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:n,alias:n,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:J,alias:J,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const p of e){const{minValue:e,maxValue:s,items:i}=p,f={attributes:{}};let h;if(f.attributes[a]=m&&d&&null!=e?k.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(f.attributes[n]=m&&d&&null!=s?k.fromMillis(s,{zone:d}).toISO():s),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},i),f.attributes[J]=++c,"flat"===t.bin.jsonStyle?r.push(...h.features.map(({attributes:{EXPR_1:e,...t},...s})=>({...s,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),r.push(f))):(t.bin?.splitBy&&(f.attributes[J]=++c),h=await this._createStatisticsQueryResponse(t,i,f),r.push(f)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&r.reverse(),{fields:o,features:r}}}function Y(e,t,s,i){const a=i.x-s.x,n=i.y-s.y,r=t.x-s.x,o=t.y-s.y,l=a*a+n*n;if(0===l)return!1;const u=r*a+o*n,c=Math.min(1,Math.max(0,u/l));return e.x=s.x+a*c,e.y=s.y+n*c,!0}function X(e,t){return e?t?4:3:t?3:2}class L{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const W=[1];function K(e,t){const s=e.split(" "),i=s[0],a=t.get(i),n=!!s[1]&&"desc"===s[1].toLowerCase();return{compare:H(a?.type,n,"case-insensitive"),fieldOrExpression:i,fieldInfo:a}}export{Q as QueryEngineResult};
|
|
2
|
+
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import{polygonCentroid as s,extentCentroid as i}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as u}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as c,isCoordinate as m,cloneCurve as d}from"../../../geometry/support/curves/curveUtils.js";import p from"./AttributesBuilder.js";import{cleanFromGeometryEngine as f,getGeometry as h,transformCentroid as y}from"./geometryUtils.js";import{project as g}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as F,SnappingCandidateVertex as T}from"./SnappingCandidate.js";import{isDateField as I,isDateOnlyField as _,isTimestampOffsetField as v,isStringField as V,isTimeOnlyField as S}from"../../support/fieldUtils.js";import b from"../../../rest/support/AutoIntervalBinParameters.js";import R from"../../../rest/support/DateBinParameters.js";import{unitsDict as z}from"../../../rest/support/DateBinUtils.js";import B from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as A,calculateStatistics as w,processSummaryStatisticsResult as N,calculateUniqueValuesCount as D,createUVResult as P,calculateClassBreaks as q,resolveCBResult as O,calculateHistogram as j,calculatePercentile as C,binIndex as Z,getBinParams as G,isNullCountSupported as E,getAttributeComparator as H}from"../../../statistics/utils.js";import{utc as U}from"../../../time/constants.js";import{DateTime as k}from"luxon";const J="bin";class Q{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new p(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const n=new Map,r=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!r.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,this.items,n);s.push(t)}r.set(a,this._calculateUniqueValues(s,this.items,e.returnDistinctValues))}const u=r.get(a);for(const t in u){const{data:i,items:a}=u[t],n=i.join(",");s&&!e.validateItems(a,s)||o.add(n)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=f({spatialReference:this.query.outSR,...g(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=f({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,s){const i=this.featureAdapter,a=X(this.hasZ,this.hasM),{point:n}=e,r="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y;function l(e,t){const s=(e-n.x)/r,i=(t-n.y)/o;return s*s+i*i}const p={candidates:[]},f="esriGeometryPolygon"===this.geometryType,h="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,y=this._getPointCreator(t,this.spatialReference,s),g=new L(null,0),x=new L(null,0),I={x:0,y:0,z:0};for(const u of this.items){const e=i.getObjectId(u),t=i.getGeometryWithCurves?.(u);if(null!=t){v(t,e);continue}const s=i.getGeometry(u);null==s||_(s,e)}return p.candidates.sort((e,t)=>e.distance-t.distance),p;function _(t,s){const{coords:i}=t,r=t.isPoint?W:t.lengths;if(g.coords=i,x.coords=i,e.returnEdge){let e=0;for(let t=0;t<r.length;t++){const i=r[t],o=e;for(let t=0;t<i;t++,e+=a){if(!f&&t===i-1)continue;if(g.coordsIndex=e,x.coordsIndex=t===i-1?o:e+a,!Y(I,n,g,x))continue;const r=l(I.x,I.y);r<=1&&p.candidates.push(new F(s,y(I),Math.sqrt(r),y(g),y(x)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<r.length;t++){const i=r[t],n=e,o=x;o.coordsIndex=n;for(let t=0;t<i;t++,e+=a){if(g.coordsIndex=e,f&&t===i-1&&g.x===o.x&&g.y===o.y)continue;const a=l(g.x,g.y);a<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(a)))}}}else if(h&&"ends"===e.vertexMode){let e=0;const t=[];for(let s=0;s<r.length;s++){t.push(e);const i=r[s];e+=i*a,i>1&&t.push(e-a)}for(const i of t){g.coordsIndex=i;const e=l(g.x,g.y);e<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(e)))}}}function v(t,s){const{candidates:i}=p,a={x:0,y:0,z:0};if(e.returnEdge){const e=[n.x,n.y],r=new L(e,0),o=new L(e,0);for(const{segments:n}of t.parts)for(const{start:t,curve:p}of n){const{curvePoint:n}=u(t,p,e),f=l(...n);if(f>1)continue;[a.x,a.y]=n,r.coords=t,o.coords=c(p);const h=m(p)?null:d(p);i.push(new F(s,y(a),Math.sqrt(f),y(r),y(o),!1,h))}}function r(e){a.x=t.vertexXY[2*e],a.y=t.vertexXY[2*e+1];const n=l(a.x,a.y);n>1||(a.z=t.vertexZ?.[e]??0,i.push(new T(s,y(a),Math.sqrt(n))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)r(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":r(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const s=t.partOffsets[e],i=t.partOffsets[e+1]-1;r(s),i!==s&&r(i)}}}}_getPointCreator(e,t,s){const i=null==s||l(t,s)?e=>e:e=>g(e,t,s),{hasZ:a}=this,n=0;return a&&e?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:n})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,minValue:r,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=I(m)||_(m)||v(m),p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:l,timeZone:u},this.items),f=E({normalizationType:a,normalizationField:i,minValue:r,maxValue:o}),h={value:.5,fieldType:m?.type},y=V(m)?A({values:p,supportsNullCount:f,percentileParams:h,outStatisticTypes:c}):w({values:p,minValue:r,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:h,outStatisticTypes:c});return N(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:n,timeZone:r}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:n,timeZone:r},this.items,!1),l=D(o);return P(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items),f=q(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return O(f,r)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items);return j(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:n}=K(i,this.fieldsIndex);e.sort((e,i)=>t(s(e,a,n),s(i,a,n)))}}_topNFeatures(t,s,i,a){if(t.length>1&&s?.length){const n=s.map(e=>{const{compare:t,fieldOrExpression:s,fieldInfo:i}=K(e,this.fieldsIndex);return(e,n)=>t(a(e,s,i),a(n,s,i))}).reduceRight((e,t)=>(s,i)=>{const a=t(s,i);return 0===a||Number.isNaN(a)?e(s,i):a}),r=[];for(const s of t)e(r,s,i,n);return r}return t.slice(0,i)}_createFeatureQueryResponse(e){const{items:t,geometryType:s,hasM:i,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:p,returnM:h}=e,y=null!=m&&t.length>(d||0)+m,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:s,hasM:i&&h,hasZ:a&&p,objectIdFieldName:n,spatialReference:f(u||o),transform:c&&r(c)||null}}_createFeatures(e,t){const s=new p(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:g=!1}=e,x=a&&f,F=i&&g;let T;const I=m||0,_=null!=d?I+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,n,_,(e,t,i)=>s.getFieldValue(e,t,i)):(T=[...t],this._sortFeatures(T,n,(e,t,i)=>s.getFieldValue(e,t,i))),(I>0||null!=_)&&(T=T.slice(I,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const i of T){const a=this.featureAdapter.getGeometry(i),n=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),geometry:h(this.geometryType,a,c,e,x,F)});t&&a&&!n.geometry&&(n.centroid=y(this,this.featureAdapter.getCentroid(i,this),e)),v[V++]=n}else if(!l&&u)for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:y(this,this.featureAdapter.getCentroid(i,this),e)});else for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:y(this,this.featureAdapter.getCentroid(i,this),e),geometry:h(this.geometryType,this.featureAdapter.getGeometry(i),c,e,x,F)})}else for(const r of T){const e=s.getAttributes(r);e&&(v[V++]=this._addFeatureJSONMetadata(r,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const s=this.featureAdapter.getMetadata?.(e);return void 0!==s&&(t.metadata=s),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,s=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,i=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>s)e=!0;else{const t=X(this.hasZ,this.hasM),s=this.featureAdapter;e=this.items.reduce((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)},0)/t>i}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,s={attributes:{}}){const i=[],a=new Map,n=new Map,r=new Map,o=new Map,l=new p(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,h=c?.length,y=!!h,g=y?c[0]:null,x=y&&!this.fieldsIndex.get(g);for(const p of u??[]){const{outStatisticFieldName:e,statisticType:u}=p,d=p,f="exceedslimit"!==u?p.onStatisticField:void 0,F="percentile_disc"===u||"percentile_cont"===u,T="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,I=y&&1===h&&(f===g||x)&&"count"===u;if(y){if(!r.has(f)){const e=[];for(const s of c){const i=this._getAttributeValues(l,s,t,a);e.push(i)}r.set(f,this._calculateUniqueValues(e,t,!T&&l.returnDistinctValues))}const s=r.get(f);if(!s)continue;const i=Object.keys(s);for(const n of i){const{count:i,data:r,items:u,itemPositions:p}=s[n],h=r.join(",");if(!m||l.validateItems(u,m)){const s=o.get(h)||{attributes:{}};if(T){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(d,u);s.aggregateGeometries[t]=e}else{let n=null;if(I)n=i;else{const e=this._getAttributeValues(l,f,t,a),s=p.map(t=>e[t]);n=F&&"statisticParameters"in d?this._getPercentileValue(d,s):this._getStatisticValue(d,s,null,l.returnDistinctValues)}s.attributes[e]=n}let n=0;c.forEach((e,t)=>s.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++n]=r[t]),o.set(h,s)}}}else if(T){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(d,t);s.aggregateGeometries[i]=e}else{const i=this._getAttributeValues(l,f,t,a);s.attributes[e]=F&&"statisticParameters"in d?this._getPercentileValue(d,i):this._getStatisticValue(d,i,n,l.returnDistinctValues)}const _="min"!==u&&"max"!==u||!V(this.fieldsIndex.get(f))&&!this._isAnyDateField(f)?null:this.fieldsIndex.get(f)?.type;i.push({name:e,alias:e,type:_||"esriFieldTypeDouble"})}const F=y?Array.from(o.values()):[s];return this._sortFeatures(F,d,(e,t)=>e.attributes[t]),f&&(F.length=Math.min(f,F.length)),{fields:i,features:F}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return I(t)||_(t)||v(t)||S(t)}async _getAggregateGeometry(e,t){const{convexHull:r,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,p=t.map(e=>h(d,c.getGeometry(e))),f=r(m,p,!0)[0],y={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=f?a(f):n(o(m,p));y.aggregateGeometries={...e,spatialReference:m},y.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=f?s(f):i(n(o(m,p)));y.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},y.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(y.aggregateGeometries=f,y.outStatisticFieldName=u||"convexHull");return y}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:n}=e;let r=null;r=s?.has(a)?s.get(a):V(this.fieldsIndex.get(a))||this._isAnyDateField(a)?A({values:t,returnDistinct:i}):w({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,r);return r["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:n,orderBy:r}=i,o=this.fieldsIndex.get(s);return C(t,{value:n,orderBy:r,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s,i){if(i.has(t))return i.get(t);const a=this.fieldsIndex.get(t),n=s.map(s=>e.getFieldValue(s,t,a));return i.set(t,n),n}_calculateUniqueValues(e,t,s){const i={},a=t.length;for(let n=0;n<a;n++){const a=t[n],r=[];for(const t of e)r.push(t[n]);const o=r.join(",");null==i[o]?i[o]={count:1,data:r,items:[a],itemPositions:[n]}:(s||i[o].count++,i[o].items.push(a),i[o].itemPositions.push(n))}return i}async _getDataValues(e,s,i=!0){const a=new p(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:r,timeZone:o}=e;return n?a.getExpressionValues(s,n,{viewingMode:"map",scale:r,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(s,t(e),i)}_calculateHistogramBins(e,t,s){if(null==t.min&&null==t.max)return[];const i=t.intervals,a=t.min??0,n=t.max??0,r=i.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=s[o];if(null!=t&&t>=a&&t<=n){const e=Z(i,t);e>-1&&(r[e].count++,r[e].items.push(l))}}return r}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:s,outAlias:i,valueType:a}=t,n=[],r=[{name:i??s,alias:i??s,type:a??"esriFieldTypeString"},{name:J,alias:J,type:"esriFieldTypeInteger"}],o=new p(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[s],(e,t,s)=>o.getFieldValue(e,t,s));const c=this._getAttributeValues(o,s,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(n.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[i??s]:d}}))),a.fields)for(const e of a.fields)r.some(t=>t.name===e.name)||r.push(e)}return{fields:r,features:n}}async _createBinsResponse(e,t){const s=e.bin;switch(t=t??this.items,s.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(b.fromJSON(s),e,t);case"dateBin":return this._createDateBinsResponse(R.fromJSON(s),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(B.fromJSON(s),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(M.fromJSON(s),e,t)}}async _createAutoIntervalBinsResponse(e,t,s){const{field:i,normalizationField:a,numBins:n,normalizationType:r,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),m=G(c,{field:i,normalizationField:a,normalizationType:r,normalizationTotal:o,numBins:n,minValue:x(r?e.normalizationMinValue:l,!1),maxValue:x(r?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,s);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,s){const{field:i,interval:a,start:n,end:r,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),p=S(this.fieldsIndex.get(i)),f=z.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),y=null!=n?x(n,p):h[0],g=null!=r?x(r,p):h[h.length-1],F=[];if(null!=y&&null!=g){const e={zone:t.outTimeReference?.ianaTimeZone??U},s=u?.unit?z.toJSON(u.unit):"milliseconds",i={[s]:u?.value||0},n=k.fromMillis(y,e).minus(i),r=k.fromMillis(g,e).minus(i),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const s=(e.weekday-t+7)%7;return e.minus({days:s}).startOf("day")};if("last"===o){let e="week"===f?((e,t)=>d(e,t).plus({days:7}))(r,m):r;for(;e>n;){const t=e.minus({[f]:a.value});if(t<n){F.unshift([l?t.plus(i).toMillis():n.plus(i).toMillis(),e.plus(i).toMillis()]);break}F.unshift([t.plus(i).toMillis(),e.plus(i).toMillis()]),e=t}}else{let e="first"===o?n:"week"===f?d(n,m):n.startOf(f);for(;e<=r;){const t=e.plus({[f]:a.value});if(t>r){F.push([e.plus(i).toMillis(),l?t.plus(i).toMillis():r.plus(i).toMillis()]);break}F.push([e.plus(i).toMillis(),t.plus(i).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:F,min:y,max:g},s);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,s){const{field:i}=e,a=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),n=S(this.fieldsIndex.get(i)),r=e.boundaries.map(e=>x(e,n)).sort((e,t)=>e-t),o=[];for(let c=0;c<r.length-1;c++)o.push([r[c],r[c+1]]);const l={intervals:o,min:r.at(0),max:r.at(-1)},u=this._calculateHistogramBins(a,l,s);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,s){const{field:i,interval:a,normalizationType:n,start:r,end:o}=e,l=await this._getDataValues({field:i||e.expression,normalizationField:e.normalizationField,normalizationType:n,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),u=S(this.fieldsIndex.get(i)),c=G(l,{field:i,classificationMethod:"defined-interval",definedInterval:a,minValue:x(n?e.normalizationMinValue:r,u),maxValue:x(n?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,s);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:s,lowerBoundaryAlias:i}=t,a=i||"lowerBoundary",n=s||"upperBoundary",r=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:n,alias:n,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:J,alias:J,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const p of e){const{minValue:e,maxValue:s,items:i}=p,f={attributes:{}};let h;if(f.attributes[a]=m&&d&&null!=e?k.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(f.attributes[n]=m&&d&&null!=s?k.fromMillis(s,{zone:d}).toISO():s),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},i),f.attributes[J]=++c,"flat"===t.bin.jsonStyle?r.push(...h.features.map(({attributes:{EXPR_1:e,...t},...s})=>({...s,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),r.push(f))):(t.bin?.splitBy&&(f.attributes[J]=++c),h=await this._createStatisticsQueryResponse(t,i,f),r.push(f)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&r.reverse(),{fields:o,features:r}}}function Y(e,t,s,i){const a=i.x-s.x,n=i.y-s.y,r=t.x-s.x,o=t.y-s.y,l=a*a+n*n;if(0===l)return!1;const u=r*a+o*n,c=Math.min(1,Math.max(0,u/l));return e.x=s.x+a*c,e.y=s.y+n*c,!0}function X(e,t){return e?t?4:3:t?3:2}class L{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const W=[1];function K(e,t){const s=e.split(" "),i=s[0],a=t.get(i),n=!!s[1]&&"desc"===s[1].toLowerCase();return{compare:H(a?.type,n,"case-insensitive"),fieldOrExpression:i,fieldInfo:a}}export{Q as QueryEngineResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../core/accessorSupport/decorators.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import l from"../support/TileInfo.js";import i from"../support/TileInfoTilemapCache.js";import{TilemapCache as a}from"../support/TilemapCache.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";const s=s=>{const p=s;let c=class extends p{constructor(){super(...arguments),this.copyright=null,this.minScale=0,this.maxScale=0,this.spatialReference=null,this.tileInfo=null,this.tilemapCache=null}destroy(){this.tilemapCache?.destroy?.()}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}get supportsBlankTile(){return this.version>=10.2}readTilemapCache(e,t,o){const r=t.capabilities?.toLowerCase().includes("tilemap");let{minLOD:n,maxLOD:s,minScale:p,maxScale:c}=t;if(null==n&&null==s&&(0!==p||0!==c)){const e=e=>Math.round(1e4*e)/1e4;p=e(p||t.tileInfo.lods[0].scale),c=e(c||t.tileInfo.lods[t.tileInfo.lods.length-1].scale);for(const o of t.tileInfo.lods){const t=e(o.scale);n=t>=p?o.level:n,s=t>=c?o.level:s}}if(r)return new a({layer:this,minLOD:n,maxLOD:s});if(t.tileInfo){const e=new l;return e.read(t.tileInfo,o),new i(e,n,s)}return null}};return e([t({json:{read:{source:"copyrightText"}}})],c.prototype,"copyright",void 0),e([t()],c.prototype,"minScale",void 0),e([n("service","minScale")],c.prototype,"readMinScale",null),e([t()],c.prototype,"maxScale",void 0),e([n("service","maxScale")],c.prototype,"readMaxScale",null),e([t({type:r})],c.prototype,"spatialReference",void 0),e([t({readOnly:!0})],c.prototype,"supportsBlankTile",null),e([t({type:l})],c.prototype,"tileInfo",void 0),e([t()],c.prototype,"tilemapCache",void 0),e([n("service","tilemapCache",["capabilities","tileInfo"])],c.prototype,"readTilemapCache",null),e([t()],c.prototype,"version",void 0),c=e([o("esri.layers.mixins.ArcGISCachedService")],c),c};export{s as ArcGISCachedService};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../request.js";import{some as r}from"../../core/iteratorUtils.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{join as o}from"../../core/urlUtils.js";import a from"../../core/Version.js";import{property as l,subclass as p}from"../../core/accessorSupport/decorators.js";import n from"../../geometry/Extent.js";import u from"../../geometry/SpatialReference.js";import{parse as c}from"../support/arcgisLayerUrl.js";import{id as y,popupEnabled as d}from"../support/commonProperties.js";import{isHostedLayer as m}from"../../portal/support/portalItemUtils.js";import{reader as f}from"../../core/accessorSupport/decorators/reader.js";const h=h=>{const b=h;let v=class extends b{constructor(){super(...arguments),this.capabilities=void 0,this.copyright=null,this.fullExtent=null,this.legendEnabled=!0,this.spatialReference=null,this.version=void 0,this._allLayersAndTablesMap=null}readCapabilities(e,t){const r=t.capabilities&&t.capabilities.split(",").map(e=>e.toLowerCase().trim());if(!r)return{operations:{supportsExportMap:!1,supportsExportTiles:!1,supportsIdentify:!1,supportsQuery:!1,supportsTileMap:!1},exportMap:null,exportTiles:null};const s=this.type,i="tile"!==s&&!!t.supportsDynamicLayers,o=r.includes("query"),l=r.includes("map"),p=!!t.exportTilesAllowed,n=r.includes("tilemap"),u=r.includes("data"),c="tile"!==s&&(!t.tileInfo||i),y="tile"!==s&&(!t.tileInfo||i),d="tile"!==s,m="tile"!==s&&i&&t.currentVersion>=11.1,f=t.cimVersion?a.parse(t.cimVersion):null,h=f?.greaterEqual(1,4)??!1,b=f?.greaterEqual(2,0)??!1;return{operations:{supportsExportMap:l,supportsExportTiles:p,supportsIdentify:o,supportsQuery:u,supportsTileMap:n},exportMap:l?{supportsArcadeExpressionForLabeling:h,supportsCIMSymbols:b,supportsDynamicLayers:i,supportsSublayerOrderBy:m,supportsSublayerDefinitionExpression:y,supportsSublayerVisibility:c,supportsSublayersChanges:d}:null,exportTiles:p?{maxExportTilesCount:+t.maxExportTilesCount}:null}}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("capabilities")||t.hasOwnProperty("tables")?10:t.hasOwnProperty("supportedImageFormatTypes")?9.31:9.3),r}async fetchRelatedService(e){const t=this.portalItem;if(!t||!m(t))return null;this._relatedFeatureServicePromise||(this._relatedFeatureServicePromise=t.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},e).then(e=>e.find(e=>"Feature Service"===e.type)??null,()=>null));const r=await this._relatedFeatureServicePromise;return i(e),r?{itemId:r.id,url:r.url}:null}async fetchSublayerInfo(e,r){const{source:s}=e;if(this?.portalItem&&"tile"===this.type&&"map-layer"===s?.type&&m(this.portalItem)&&e.originIdOf("url")<2){const t=await this.fetchRelatedService(r);t&&(e.url=o(t.url,s.mapLayerId.toString()),e.layerItemId=t.itemId)}const{url:i}=e;let a;if("data-layer"===s.type){a=(await t(i,{responseType:"json",query:{f:"json",...this.customParameters,token:this.apiKey},...r})).data}else{let t=e.id;"map-layer"===s?.type&&(t=s.mapLayerId);try{a=(await this.fetchAllLayersAndTables(r)).get(t)}catch{}if(i&&e.originIdOf("url")>2)try{const e=await this._fetchAllLayersAndTablesFromService(i),t=c(i)?.sublayer??s.mapLayerId,r=structuredClone(e.get(t));if(null!=r){const e=["drawingInfo","maxScale","minScale","name"];for(const t of e)delete r[t];a={...a,...r}}}catch{}}return a}async fetchAllLayersAndTables(e){return this._fetchAllLayersAndTablesFromService(this.parsedUrl?.path,e)}async _fetchAllLayersAndTablesFromService(e,a){await this.load(a),this._allLayersAndTablesMap||=new Map;const l=c(e),p=s(this._allLayersAndTablesMap,l?.url.path,()=>t(o(l?.url.path,"/layers"),{query:{f:"json",...this.customParameters,token:this.apiKey}}).then(async e=>{const s=new Map,{layers:i,tables:o}=e.data,a=[...i??[],...o??[]];for(const t of a)s.set(t.id,t);if(r(s.values(),e=>null==e.capabilities||null==e.extent)){const{data:e}=await t(l?.url.path,{query:{f:"json",...this.customParameters,token:this.apiKey}}).catch(()=>({data:{capabilities:"",fullExtent:void 0}}));for(const t of s.values())t.capabilities??=e.capabilities??"",t.extent??=e.fullExtent}return{result:s}},e=>({error:e}))),n=await p;if(i(a),"result"in n)return n.result;throw n.error}};return e([l({readOnly:!0})],v.prototype,"capabilities",void 0),e([f("service","capabilities",["capabilities","cimVersion","currentVersion","exportTilesAllowed","maxExportTilesCount","supportsDynamicLayers","tileInfo"])],v.prototype,"readCapabilities",null),e([l({json:{read:{source:"copyrightText"}}})],v.prototype,"copyright",void 0),e([l({type:n})],v.prototype,"fullExtent",void 0),e([l(y)],v.prototype,"id",void 0),e([l({type:Boolean,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend"}}})],v.prototype,"legendEnabled",void 0),e([l(d)],v.prototype,"popupEnabled",void 0),e([l({type:u})],v.prototype,"spatialReference",void 0),e([l({readOnly:!0})],v.prototype,"version",void 0),e([f("service","version",["currentVersion","capabilities","tables","supportedImageFormatTypes"])],v.prototype,"readVersion",null),v=e([p("esri.layers.mixins.ArcGISMapService")],v),v};export{h as ArcGISMapService};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{
|
|
2
|
+
import e from"../../core/Error.js";import{removeMaybe as r}from"../../core/maybe.js";import{throwIfNotAbortError as t}from"../../core/promiseUtils.js";import{open as i}from"../../core/workers.js";import a from"./PixelBlock.js";class s{constructor(){this._workerThread=null,this._destroyed=!1,this._onClientConnectedHandle=null,this._symbolizerState=null,this._rasterFunctionState=null}async initialize(){const e=await i("RasterWorker");this._destroyed?e.close():(this._onClientConnectedHandle=r(this._onClientConnectedHandle),this._workerThread=e,this._onClientConnectedHandle=e.onClientConnected(e=>{this._symbolizerState&&e.invoke("updateSymbolizer",this._symbolizerState).catch(e=>t(e)),this._rasterFunctionState&&e.invoke("updateRasterFunction",this._rasterFunctionState).catch(e=>t(e))}))}destroy(){this._destroyed=!0,this._onClientConnectedHandle=r(this._onClientConnectedHandle),this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(e,r){o(this._workerThread);const t=e.pixelBlock.getTransferableObject().pixelBlock,i=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:t,type:e.dataType},r);return i?new a(i):null}async convertPixelBlockToFeatures(e,r){o(this._workerThread);const t=await this._workerThread.invoke("convertPixelBlockToFeatures",{pixelBlock:e.pixelBlock.toJSON(),extent:e.extent.toJSON(),fieldNames:e.fieldNames,skipFactor:e.skipFactor,pixelIdOffset:e.pixelIdOffset,imageRowSize:e.imageRowSize},r),i=e.extent.spatialReference?.toJSON();return t.forEach(e=>e.geometry.spatialReference=i),t}computeStatisticsHistograms(e,r){o(this._workerThread);const{transferList:t,pixelBlock:i}=e.pixelBlock.getTransferableObject();return r?.transferPixelsToWorker&&(r={...r,transferList:t}),this._workerThread.invoke("computeStatisticsHistograms",{...e,pixelBlock:i},r)}async transformPixels(e,r){o(this._workerThread);const{transferList:t,pixelBlock:i}=e.pixelBlock.getTransferableObject();r?.transferPixelsToWorker&&(r={...r,transferList:t});const s=await this._workerThread.invoke("transformPixels",{...e,pixelBlock:i},r);return a.fromJSON(s)}async compositeBands(e,r){o(this._workerThread);const t=e.pixelBlocks.map(e=>e?.getTransferableObject()),i={pixelBlocks:t.map(e=>e?.pixelBlock)};if(r?.transferPixelsToWorker){const e=t.flatMap(e=>e?.transferList).filter(e=>null!=e);r={...r,transferList:e}}const s=await this._workerThread.invoke("compositeBands",i,r);return s?a.fromJSON(s):null}async decode(e,r){o(this._workerThread);const t=await this._workerThread.invoke("decode",e,{...r,transferList:[e.data]});return t?new a(t):null}async symbolize(e,r){o(this._workerThread);const t=e.pixelBlock?.getTransferableObject().pixelBlock,i={extent:e.extent?.toJSON(),pixelBlock:t,simpleStretchParams:e.simpleStretchParams,bandIds:e.bandIds},s=await this._workerThread.invoke("symbolize",i,r);return s?new a(s):null}async highlightPixels(e,r){o(this._workerThread);const t={pixelBlock:e.pixelBlock?.toJSON(),renderedPixelBlock:e.renderedPixelBlock?.toJSON(),highlightOptions:e.highlightOptions},i=await this._workerThread.invoke("highlightPixels",t,r);e.renderedPixelBlock.pixels=i.pixels,e.renderedPixelBlock.mask=i.mask,e.renderedPixelBlock.maskIsAlpha=i.maskIsAlpha}async updateSymbolizer(e,r){o(this._workerThread);const t=e?.rendererJSON?.histograms;this._symbolizerState={symbolizerJSON:e.toJSON(),histograms:t},await Promise.all(this._workerThread.broadcast("updateSymbolizer",this._symbolizerState,r))}async updateRasterFunction(e,r){o(this._workerThread),this._rasterFunctionState={rasterFunctionJSON:e.toJSON()},await Promise.all(this._workerThread.broadcast("updateRasterFunction",this._rasterFunctionState,r))}async process(e,r){o(this._workerThread);const t=await this._workerThread.invoke("process",{extent:e.extent?.toJSON(),primaryPixelSizes:e.primaryPixelSizes?.map(e=>null!=e?e.toJSON():null),primaryPixelBlocks:e.primaryPixelBlocks.map(e=>e?.getTransferableObject().pixelBlock),primaryRasterIds:e.primaryRasterIds,parameters:e.parameters},r);return t?new a(t):null}async stretch(e,r){if(o(this._workerThread),!e?.pixelBlock)return null;const t={srcPixelBlock:e.pixelBlock.getTransferableObject().pixelBlock,stretchParams:e.stretchParams},i=await this._workerThread.invoke("stretch",t,r);return i?new a(i):null}async split(e,r){if(o(this._workerThread),!e?.pixelBlock)return null;const t={srcPixelBlock:e.pixelBlock.getTransferableObject().pixelBlock,tileSize:e.tileSize,maximumPyramidLevel:e.maximumPyramidLevel,useBilinear:e.useBilinear},i=await this._workerThread.invoke("split",t,r);return i&&i.forEach((e,r)=>{i.set(r,e?a.fromJSON(e):null)}),i}async clipTile(e,r){if(o(this._workerThread),!e?.pixelBlock)return null;const t=e.pixelBlock.getTransferableObject().pixelBlock,i={...e,pixelBlock:t},s=await this._workerThread.invoke("clipTile",i,r);return s?a.fromJSON(s):null}async estimateStatisticsHistograms(e,r){if(o(this._workerThread),!e?.pixelBlock)return null;const t={srcPixelBlock:e.pixelBlock.getTransferableObject().pixelBlock};return await this._workerThread.invoke("estimateStatisticsHistograms",t,r)}async mosaicAndTransform(e,r){if(o(this._workerThread),!e?.srcPixelBlocks?.length)return{pixelBlock:null};const t=e.srcPixelBlocks.map(e=>e?.getTransferableObject()),i={...e,srcPixelBlocks:t.map(e=>e?.pixelBlock)};if(r?.transferPixelsToWorker){const e=t.flatMap(e=>e?.transferList).filter(e=>null!=e);r={...r,transferList:e}}const s=await this._workerThread.invoke("mosaicAndTransform",i,r);return{pixelBlock:s.pixelBlock?new a(s.pixelBlock):null,localNorthDirections:s.localNorthDirections}}async createFlowMesh(e,r){o(this._workerThread);const t={buffer:e.flowData.data.buffer,maskBuffer:e.flowData.mask.buffer,width:e.flowData.width,height:e.flowData.height},{meshType:i,simulationSettings:a,startInfo:s}=e,l=await this._workerThread.invoke("createFlowMesh",{meshType:i,flowData:t,simulationSettings:a,startInfo:s},{...r,transferList:[t.buffer,t.maskBuffer]});return{vertexData:new Float32Array(l.vertexBuffer),indexData:new Uint32Array(l.indexBuffer),pathData:new Float32Array(l.pathBuffer)}}getProjectionOffsetGrid(e,r){o(this._workerThread);const t=null!=e.datumTransformation?e.datumTransformation.steps.map(e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse})):null,i=null!=e.rasterTransform?e.rasterTransform.toJSON():null,a={projectedExtent:e.projectedExtent.toJSON(),srcBufferExtent:e.srcBufferExtent.toJSON(),pixelSize:e.pixelSize,hasWrapAround:e.hasWrapAround,spacing:e.spacing,datumTransformationSteps:t,rasterTransform:i,isAdaptive:e.isAdaptive,includeGCSGrid:e.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",a,r)}}function o(r){if(null==r)throw new e("raster-jobhandler:no-connection","no available worker connection")}export{s as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";import{isBasemap as i}from"../../support/userTypeGuards/isBasemap.js";function u(e){return
|
|
2
|
+
import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";import{isBasemap as i}from"../../support/userTypeGuards/isBasemap.js";function u(e,t){return null!=e&&"object"==typeof e&&"type"in e&&e.type===t}function s(e){return h(e)||d(e)}function o(e){return u(e,"feature")}function c(e){return"gaussian-splat"===e?.type}function a(e){return u(e,"graphics")}function l(e){return u(e,"map-image")}function f(e){return u(e,"map-notes")&&"sublayers"in e}function p(e){return u(e,"knowledge-graph")&&"layers"in e}function y(e){return u(e,"knowledge-graph-sublayer")}function g(e){return u(e,"link-chart")&&"layers"in e}function d(e){return u(e,"scene")}function b(e){return u(e,"subtype-group")&&"sublayers"in e}function m(e){return"subtype-sublayer"===e?.type}function h(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function v(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function w(e){return"group"===e?.type}function j(e){const t=e.parent;return w(t)&&t.tables.includes(e)}const L={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function S(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function E(e){return"integrated-mesh"===e.type||"integrated-mesh-3dtiles"===e.type}function k(e){return"integrated-mesh-3dtiles"===e.type}function C(e){return"voxel"===e?.type}function x(e){return"imagery-tile"===e?.type}function T(e,t){return i(e?.parent)&&e.parent[t].includes(e)}function U(e){return T(e,"baseLayers")}function M(e){return T(e,"referenceLayers")}function O(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function P(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function B(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function I(e){return o(e)&&B(e)}function R(e){const t=e?.type;return"binning"===t||"cluster"===t}function q(e,t){if(!I(e))return;const n=t?.graphic,r=e.featureReduction;if(n){if(n.isAggregate){const e=n.origin;return e&&("featureReductionProvider"in e&&r)?R(r)?r:null:void 0}return e}return t?.checkFeatureReduction&&r?R(r)?r:null:e}function F(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)}),n.length>0)){let e;if(r){const t={};n.forEach(e=>{t[e[0]]=e[1]}),e=JSON.stringify(t)}else{const t=[];n.forEach(e=>{t.push(e[0]+":"+e[1])}),e=t.join(";")}return e}return null}function J(e){if(!e)return;const t=[];return e.forEach((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))}),t.length?"{"+t.join(",")+"}":void 0}function N(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function A(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.slice(0,u)}/rest/info`,o=null!=r?r.signal:null,{data:c}=await t(s,{query:{f:"json"},responseType:"json",signal:o});return c?.owningSystemUrl||null}function D(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function G(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function V(e){return D(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function $(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"knowledge-graph-sublayer":return!0;default:return!1}}function z(e){return!!$(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function H(e){if(!e)return[];return("subtypes"in e?e.subtypes:b(e.parent)?e.parent.subtypes:[])??[]}function K(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function Q(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))r(n)||j(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function W(e,t){return null}function X(e){return null}function Y(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function Z(e,t){if(!t||!Y(e))return;const n=W(e.url);n&&(e.url=n)}export{Z as applyPreferredHostToPortalItem,z as getEffectiveEditingEnabled,V as getEffectiveLayerCapabilities,q as getFieldConfigurationsContainer,Q as getLayersWithChartSupport,A as getOwningPortalUrl,X as getPreferredHost,W as getPreferredUrl,H as getSubtypesFromLayer,N as getTileMaxtrixSetFromActiveLayer,U as isBaseLayer,s as isBasemap3DSupportedLayer,h as isBasemapSupportedTiledLayer,O as isFeatureCollectionLayer,o as isFeatureLayer,B as isFeatureServiceLayer,c as isGaussianSplatLayer,a as isGraphicsLayer,w as isGroupLayer,x as isImageryTileLayer,k as isIntegratedMesh3DTilesLayer,E as isIntegratedMeshLayer,p as isKnowledgeGraphLayer,y as isKnowledgeGraphSublayer,D as isLayerWithFeatureCapabilities,P as isLayerWithFeatureLayerSource,K as isLayerWithFlowRenderer,g as isLinkChartLayer,l as isMapImageLayer,f as isMapNotesLayer,Y as isPreferredUrlApplicable,M as isReferenceLayer,d as isSceneLayer,S as isSceneServiceLayer,b as isSubtypeGroupLayer,m as isSubtypeSublayer,G as isTable,v as isTiledLayer,C as isVoxelLayer,L as sceneServiceLayerTypeToClassName,F as serializeLayerDefinitions,J as serializeTimeOptions,I as supportsFieldConfiguration};
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getDataValues as i,quantizeFeatures as e,calculateHeatmapStats as a}from"./utils.js";import{calculateClassBreaks as n,resolveCBResult as t,calculateHistogram as o,
|
|
2
|
+
import{getDataValues as i,quantizeFeatures as e,calculateHeatmapStats as a}from"./utils.js";import{calculateClassBreaks as n,resolveCBResult as t,calculateHistogram as o,isNullCountSupported as l,calculateStringStatistics as s,calculateStatistics as r,processSummaryStatisticsResult as m,calculateUniqueValuesCount as u,createUVResult as f}from"../../../statistics/utils.js";async function d(e){const{attribute:a,features:n}=e,{normalizationType:t,normalizationField:o,minValue:u,maxValue:f,fieldType:d,outStatisticTypes:p}=a,c=await i({field:a.field,valueExpression:a.valueExpression,normalizationType:t,normalizationField:o,normalizationTotal:a.normalizationTotal,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n),v=l({normalizationType:t,normalizationField:o,minValue:u,maxValue:f}),z={value:.5,fieldType:d},T="esriFieldTypeString"===d?s({values:c,supportsNullCount:v,percentileParams:z,outStatisticTypes:p}):r({values:c,minValue:u,maxValue:f,useSampleStdDev:!t,supportsNullCount:v,percentileParams:z,outStatisticTypes:p});return m(T,p,"esriFieldTypeDate"===d)}async function p(e){const{attribute:a,features:n}=e,t=await i({field:a.field,field2:a.field2,field3:a.field3,fieldDelimiter:a.fieldDelimiter,valueExpression:a.valueExpression,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n,!1),o=u(t);return f(o,a.domains,a.returnAllCodedValues,a.fieldDelimiter)}async function c(e){const{attribute:a,features:o}=e,{field:l,normalizationType:s,normalizationField:r,normalizationTotal:m,classificationMethod:u}=a,f=await i({field:l,valueExpression:a.valueExpression,normalizationType:s,normalizationField:r,normalizationTotal:m,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},o),d=n(f,{field:l,normalizationType:s,normalizationField:r,normalizationTotal:m,classificationMethod:u,standardDeviationInterval:a.standardDeviationInterval,numClasses:a.numClasses,minValue:a.minValue,maxValue:a.maxValue});return t(d,u)}async function v(e){const{attribute:a,features:n}=e,{field:t,normalizationType:l,normalizationField:s,normalizationTotal:r,classificationMethod:m}=a,u=await i({field:t,valueExpression:a.valueExpression,sqlExpression:a.sqlExpression,normalizationType:l,normalizationField:s,normalizationTotal:r,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},n);return o(u,{field:t,normalizationType:l,normalizationField:s,normalizationTotal:r,classificationMethod:m,standardDeviationInterval:a.standardDeviationInterval,numBins:a.numBins,minValue:a.minValue,maxValue:a.maxValue})}async function z(i){const{attribute:n,features:t}=i,{field:o,radius:l,transform:s,spatialReference:r}=n,m=n.size??[0,0],u=e(t??[],s,r,m);return a(u,l??void 0,o,m[0],m[1])}export{c as classBreaks,z as heatmapStatistics,v as histogram,d as summaryStatistics,p as uniqueValues};
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const e="20260322",a="94827c0dc829d8f0f6aaee1858bdaaee446d8e34";export{e as buildDate,a as commitHash};
|
package/time/TimeExtent.d.ts
CHANGED
|
@@ -30,6 +30,14 @@ export interface TimeExtentProperties {
|
|
|
30
30
|
* });
|
|
31
31
|
*/
|
|
32
32
|
export default class TimeExtent extends JSONSupport {
|
|
33
|
+
/**
|
|
34
|
+
* @param values - An array of two numbers representing the start and end time of the TimeExtent.
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
static fromArray(values: [
|
|
38
|
+
number | null | undefined,
|
|
39
|
+
number | null | undefined
|
|
40
|
+
]): TimeExtent;
|
|
33
41
|
/**
|
|
34
42
|
* @example
|
|
35
43
|
* // Typical usage
|
|
@@ -43,6 +51,19 @@ export default class TimeExtent extends JSONSupport {
|
|
|
43
51
|
/** The end time of the time extent. */
|
|
44
52
|
get end(): Date | null | undefined;
|
|
45
53
|
set end(value: (Date | number | string) | null | undefined);
|
|
54
|
+
/**
|
|
55
|
+
* Returns true if the TimeExtent represents all time.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
get isAllTime(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if the TimeExtent represents no time for example as the result of the
|
|
62
|
+
* non-intersection of two TimeExtents.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
get isEmpty(): boolean;
|
|
46
67
|
/** The start time of the time extent. */
|
|
47
68
|
get start(): Date | null | undefined;
|
|
48
69
|
set start(value: (Date | number | string) | null | undefined);
|
|
@@ -52,6 +73,14 @@ export default class TimeExtent extends JSONSupport {
|
|
|
52
73
|
* @returns A new instance of a TimeExtent object equal to the object used to call `.clone()`.
|
|
53
74
|
*/
|
|
54
75
|
clone(): TimeExtent;
|
|
76
|
+
/**
|
|
77
|
+
* Tests if the parsed TimeExtent is equivalent to the current instance.
|
|
78
|
+
*
|
|
79
|
+
* @param other - The TimeExtent to compare with the current instance.
|
|
80
|
+
* @returns Returns `true` if the parsed TimeExtent is equivalent to the current instance.
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
equals(other: TimeExtent | null | undefined): boolean;
|
|
55
84
|
/**
|
|
56
85
|
* Expands the TimeExtent so that the start and end dates are rounded down and up, respectively, to the parsed time unit.
|
|
57
86
|
*
|
|
@@ -99,6 +128,11 @@ export default class TimeExtent extends JSONSupport {
|
|
|
99
128
|
* }
|
|
100
129
|
*/
|
|
101
130
|
intersection(timeExtent: TimeExtent | null | undefined): TimeExtent;
|
|
131
|
+
/** @internal */
|
|
132
|
+
toArray(): [
|
|
133
|
+
number | null | undefined,
|
|
134
|
+
number | null | undefined
|
|
135
|
+
];
|
|
102
136
|
/**
|
|
103
137
|
* Returns the time extent resulting from the union of the current time extent and a given time extent.
|
|
104
138
|
*
|
package/time/TimeInterval.d.ts
CHANGED
|
@@ -43,5 +43,20 @@ export default class TimeInterval extends TimeIntervalSuperclass {
|
|
|
43
43
|
* });
|
|
44
44
|
*/
|
|
45
45
|
accessor value: number;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the duration of the time interval in milliseconds.
|
|
48
|
+
*
|
|
49
|
+
* @returns The time interval expressed as milliseconds.
|
|
50
|
+
* @internal
|
|
51
|
+
* @example
|
|
52
|
+
* const interval = new TimeInterval({
|
|
53
|
+
* value: 5,
|
|
54
|
+
* unit: "days"
|
|
55
|
+
* });
|
|
56
|
+
* const milliseconds = interval.toMilliseconds();
|
|
57
|
+
* const formatted = new Intl.NumberFormat().format(milliseconds);
|
|
58
|
+
* console.log("Five days is equivalent to", formatted, "milliseconds.");
|
|
59
|
+
*/
|
|
60
|
+
toMilliseconds(): number;
|
|
46
61
|
}
|
|
47
62
|
declare const TimeIntervalSuperclass: typeof JSONSupport & typeof ClonableMixin
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{abortMaybe as
|
|
2
|
+
import has from"../../../../core/has.js";import{removeMaybe as t,abortMaybe as e}from"../../../../core/maybe.js";import{throwIfNotAbortError as s,throwIfAbortError as i,isAbortError as r,eachAlways as o}from"../../../../core/promiseUtils.js";import{addQueryParameters as n}from"../../../../core/urlUtils.js";import{open as a}from"../../../../core/workers.js";import l from"./SpriteMosaic.js";import c from"../webgl/GlyphMosaic.js";import h from"../webgl/GlyphSource.js";import u from"../../tiling/TileKey.js";class p{constructor(t,e,s,i){this._layer=t,this._styleRepository=e,this.devicePixelRatio=s,this._sourceDataMaxLOD=i,this._spriteMosaic=null,this._glyphMosaic=null,this._connection=null,this._spriteSourceAbortController=null,this._onClientConnectedHandle=null,this.type="TileHandler2D",this._startOptionsInputSignal=null,this._inputSignalEventListener=null}destroy(){this._onClientConnectedHandle=t(this._onClientConnectedHandle),this._connection?.close(),this._connection=null,this._styleRepository=null,this._layer=null,this._spriteMosaic?.destroy(),this._spriteMosaic=null,this._glyphMosaic=null,this._spriteSourceAbortController=e(this._spriteSourceAbortController),this._spriteSourcePromise=null,this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,this._inputSignalEventListener=null}get spriteMosaic(){return this._spriteSourcePromise.then(()=>this._spriteMosaic)}get glyphMosaic(){return this._glyphMosaic}async start(e){this._requestSprite(e);const i=this._layer.currentStyleInfo.glyphsUrl,r=new h(i?n(i,{...this._layer.customParameters,token:this._layer.apiKey}):"");this._onClientConnectedHandle=t(this._onClientConnectedHandle),this._glyphMosaic=new c(1024,1024,r,!0),this._broadcastPromise=a("WorkerTileHandler",{client:this,schedule:e.schedule,signal:e.signal}).then(t=>{if(this._layer&&(this._connection?.close(),this._connection=t,this._onClientConnectedHandle=t.onClientConnected(t=>{this._layer&&!this._connection.closed&&t.invoke("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD}).catch(t=>s(t))}),this._layer&&!this._connection.closed)){const e=t.broadcast("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD});Promise.all(e).catch(t=>s(t))}})}_requestSprite(t){this._spriteSourceAbortController?.abort();const e=new AbortController;this._spriteSourceAbortController=e;const s=t?.signal;this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,s&&(this._inputSignalEventListener=_(e),s.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:r}=e,o={...t,signal:r};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,o),this._spriteSourcePromise.then(t=>{i(r),this._spriteMosaic=new l(1024,1024,250),this._spriteMosaic.setSpriteSource(t)})}async updateStyle(t){const e=[];for(const s of t)4===s.type?e.push({type:4,data:{spriteSource:null}}):e.push(s);return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",e)),this._broadcastPromise}setSpriteSource(t){const e=new l(1024,1024,250);return e.setSpriteSource(t),this._spriteMosaic=e,this._spriteSourcePromise=Promise.resolve(t),this._spriteSourceAbortController=null,e}async setStyle(t,e,s){await this._broadcastPromise,this._styleRepository=t,this._sourceDataMaxLOD=s,this._requestSprite();const i=this._layer.currentStyleInfo.glyphsUrl,r=new h(i?n(i,{...this._layer.customParameters,token:this._layer.apiKey}):"");return this._glyphMosaic=new c(1024,1024,r,!0),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",{style:e,sourceDataMaxLOD:this._sourceDataMaxLOD})),this._broadcastPromise}async fetchTileData(t,e){const s=await this._getRefKeys(t,e);return this._getSourcesData(Object.keys(this._layer.sourceNameToSource),s,e)}async fetchTilePBFs(t){const e=Object.keys(this._layer.sourceNameToSource),s={},i=await this._getRefKeys(t,s),r=[],o=[];for(let n=0;n<i.length;n++)if(null==i[n].value||null==e[n])o.push(null);else{const t=i[n].value,a=this._getTilePayload(t,e[n],s);a.then(e=>{r.push({...e,key:t})}),o.push(a)}return Promise.all(o).then(()=>r)}async parseTileData(t,e){const s=t&&t.data;if(!s)return null;const{sourceName2DataAndRefKey:i,transferList:r}=s;return 0===Object.keys(i).length?null:this._broadcastPromise.then(()=>this._connection.invoke("createTileAndParse",{key:t.key.id,sourceName2DataAndRefKey:i,styleLayerUIDs:t.styleLayerUIDs},{...e,transferList:r}))}async getSprites(t){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(t)}async getGlyphs(t){return has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(t.font),this._glyphMosaic.getGlyphItemsVTL(t.font,t.codePoints)}async _getTilePayload(t,e,s){const i=u.pool.acquire(t.id),o=this._layer.sourceNameToSource[e],{level:n,row:a,col:l}=i;u.pool.release(i);try{return{protobuff:await o.requestTile(n,a,l,s),sourceName:e}}catch(c){if(r(c))throw c;return{protobuff:null,sourceName:e}}}async _getRefKeys(t,e){const s=this._layer.sourceNameToSource,i=new Array;for(const r in s){const o=s[r].getRefKey(t,e);i.push(o)}return o(i)}_getSourcesData(t,e,s){const i=[];for(let r=0;r<e.length;r++)if(null==e[r].value||null==t[r])i.push(null);else{const o=e[r].value,n=this._getTilePayload(o,t[r],s);i.push(n)}return o(i).then(t=>{const s={},i=[];for(let r=0;r<t.length;r++){const o=t[r].value;if(o&&(o.protobuff&&o.protobuff.byteLength>0)){const t=e[r].value.id;s[o.sourceName]={refKey:t,protobuff:o.protobuff},i.push(o.protobuff)}}return{sourceName2DataAndRefKey:s,transferList:i}})}}function _(t){return()=>t.abort()}export{p as TileHandler};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as o}from"../../../../geometry/support/aaBoundingRect.js";import{tileSizeInPixels as s}from"./constants.js";import{TileHandler as r}from"./TileHandler.js";import{VectorTile as n}from"./VectorTile.js";import l from"../../tiling/TileInfoViewPOT.js";import a from"../../tiling/TileKey.js";class
|
|
2
|
+
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as o}from"../../../../geometry/support/aaBoundingRect.js";import{tileSizeInPixels as s}from"./constants.js";import{TileHandler as r}from"./TileHandler.js";import{VectorTile as n}from"./VectorTile.js";import l from"../../tiling/TileInfoViewPOT.js";import a from"../../tiling/TileKey.js";class h extends r{constructor(e,t,i,o){super(e,t,i,e.tileInfo.lods.length-1),this._memCache=o,this.type="TileHandler3D",this._vectorTiles=new Map,this._ongoingTileRequests=new Map,this._ongoingRequestToController=new Map,this._tileInfoView=new l(e.tileInfo,e.fullExtent)}destroy(){super.destroy(),this._ongoingRequestToController.forEach(e=>e.abort()),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear(),this._vectorTiles.clear()}async getVectorTile(r,l){const h=new a(r[0],r[1],r[2],0);let g=this._vectorTiles.get(h.id)??this._memCache.get(h.id);if(g)return g.retain(),g;const c=await this._getVectorTileData(h);if(t(l),!this._layer)return null;if(g=this._vectorTiles.get(h.id)??this._memCache.get(h.id),g)return g.retain(),g;const T=this._layer.tileInfo.getTileBounds(o(),h),m=this._tileInfoView.getTileResolution(r[0]);return g=new n(h,m,T[0],T[3],s,s,this._styleRepository,this),g.setData(c),c&&(g.retain(),this._memCache.put(h.id,g,e),this._vectorTiles.set(h.id,g)),g.neededForCoverage=!0,g.transforms.tileUnitsToPixels=i(1/8,0,0,0,1/8,0,0,0,1),g}updateTileSize(e){this._memCache.updateSize(e.id)}onDisposeTile(e){this._vectorTiles.delete(e.id)}_getVectorTileData(e){const t=e.id;if(this._ongoingTileRequests.has(t))return this._ongoingTileRequests.get(t);const i=new AbortController,o={signal:i.signal},s=this._getParsedVectorTileData(e,o).then(e=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),e)).catch(()=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),null));return this._ongoingTileRequests.set(t,s),this._ongoingRequestToController.set(t,i),s}_getParsedVectorTileData(e,t){return this.fetchTileData(e,t).then(i=>this.parseTileData({key:e,data:i},t))}}export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{LRUCache as e}from"../../../../core/LRUCache.js";import{fromValues as
|
|
2
|
+
import{LRUCache as e}from"../../../../core/LRUCache.js";import{fromValues as t,create as i,intersects as s}from"../../../../geometry/support/aaBoundingRect.js";import{tileSizeInPixels as l}from"./constants.js";import r from"../../tiling/TileCoverage.js";import n from"../../tiling/TileKey.js";const o=1e-6;class a{constructor(t,i){this._tiles=new Map,this._tileCache=new e(40,e=>e.dispose()),this._viewSize=[0,0],this._visibleTiles=new Map,this._previousLevel=-1,this._currentLevel=-1,this.acquireTile=t.acquireTile,this.releaseTile=t.releaseTile,this.tileInfoView=t.tileInfoView,this._container=i}destroy(){for(const e of this._tiles.values())e.dispose();this._tiles=null,this._tileCache.clear(),this._tileCache=null}update(e){this._updateCacheSize(e);const t=this.tileInfoView,i=t.getTileCoverage(e.state,0,!0,"smallest");if(!i)return!0;const{spans:s,lodInfo:l}=i,{level:o}=l,a=this._tiles;this._currentLevel=o;const c=new Set,h=new Set;for(const{row:r,colFrom:f,colTo:u}of s)for(let e=f;e<=u;e++){const t=n.getId(o,r,l.normalizeCol(e),l.getWorldForColumn(e)),i=this._getOrAcquireTile(t);c.add(t),i.processed()?this._addToContainer(i):h.add(new n(t))}for(const[r,n]of a)n.isCoverage=c.has(r);for(const r of h)this._findPlaceholdersForMissingTiles(r,c);let d=!1;for(const[r,n]of a)n.neededForCoverage=c.has(r),n.neededForCoverage||!n.isHoldingForFade&&n.fader.isFinished()||!t.intersects(i,n.key)||c.add(r),n.isFading&&(n.fader.value()<1&&null!=n.parentTile&&n.parentTile.hasData()&&c.add(n.parentTile.id),d=!0);for(const r of this._tiles.keys())c.has(r)||this._releaseTile(r);return r.pool.release(i),this._previousLevel=o,!d}clear(){this._tiles.clear(),this._tileCache.clear(),this._visibleTiles.clear()}clearCache(){this._tileCache.clear()}getIntersectingTiles(e,l,r,n,o){const a=[0,0],c=[0,0];n.toMap(a,e-r,l+r),n.toMap(c,e+r,l-r);const h=Math.min(a[0],c[0]),d=Math.min(a[1],c[1]),f=Math.max(a[0],c[0]),u=Math.max(a[1],c[1]),_=t(h,d,f,u),p=i(),T=[],v=new Set;for(const t of this._visibleTiles.values())this.tileInfoView.getTileBounds(p,t.key),s(_,p)&&(T.push(t),v.add(t.id));if(null!=o)for(const t of o){const e=t.tileKey.id;if(v.has(e))continue;const i=this._visibleTiles.get(e);null!=i&&(T.push(i),v.add(e))}return T}isFading(){for(const e of this._visibleTiles.values())if(e.isFading)return!0;return!1}_findPlaceholdersForMissingTiles(e,t){let i=0;for(const s of this._tiles.values())if(i+=this._addPlaceholderChild(s,e,t),Math.abs(1-i)<o)return null;return this._addPlaceholderParent(e.id,t)}_addPlaceholderChild(e,t,i){if(e.key.level<=t.level||!e.hasData())return 0;if(h(t,e.key)){this._addToContainer(e),i.add(e.id);return 1/(1<<2*(e.key.level-t.level))}return 0}_addPlaceholderParent(e,t){const i=this._tiles;let s=e;for(;;){if(s=c(s),!s||t.has(s))return null;const e=i.get(s);if(e?.hasData())return this._addToContainer(e),t.add(e.id),s}}_getOrAcquireTile(e){let t=this._tiles.get(e);return t||(t=this._tileCache.pop(e),t||(t=this._applyPlaceholderOpacity(this.acquireTile(new n(e)))),this._tiles.set(e,t),t)}_applyPlaceholderOpacity(e){const t=this._tiles;let i=e.id;for(;i&&(i=c(i),i);){const s=t.get(i);if(s?.hasData())return e.fader?.setStartOpacity(s.fader?.value()??1),e}const s=this._currentLevel<this._previousLevel?1:0;return e.fader?.setStartOpacity(s),e}_releaseTile(e){const t=this._tiles.get(e);this.releaseTile(t),this._removeFromContainer(t),this._tiles.delete(e),t.hasData()?this._tileCache.put(e,t,1):t.dispose()}_addToContainer(e){let t;const i=[],s=this._container;if(s.contains(e))return;const l=this._visibleTiles;for(const r of l.values())this._canConnectDirectly(e,r)&&i.push(r),null==t&&this._canConnectDirectly(r,e)&&(t=r);if(null!=t){for(const s of i)t.childrenTiles.delete(s),e.childrenTiles.add(s),s.parentTile=e;t.childrenTiles.add(e),e.parentTile=t,e.fader.setStartOpacity(t.fader?.value()??1)}else{e.fader.reset();for(const t of i)e.childrenTiles.add(t),t.parentTile=e}l.set(e.id,e),s.addChild(e)}_removeFromContainer(e){if(this._visibleTiles.delete(e.id),this._container.removeChild(e),null!=e.parentTile){e.parentTile.childrenTiles.delete(e);for(const t of e.childrenTiles)e.parentTile.childrenTiles.add(t)}for(const t of e.childrenTiles)t.parentTile=e.parentTile;e.parentTile=null,e.childrenTiles.clear()}_canConnectDirectly(e,t){const i=e.key;let{level:s,row:l,col:r,world:n}=t.key;const o=this._visibleTiles;for(;s>0;){if(s--,l>>=1,r>>=1,i.level===s&&i.row===l&&i.col===r&&i.world===n)return!0;if(o.has(`${s}/${l}/${r}/${n}`))return!1}return!1}_updateCacheSize(e){const t=e.state.size;if(t[0]===this._viewSize[0]&&t[1]===this._viewSize[1])return;const i=Math.ceil(t[0]/l)+1,s=Math.ceil(t[1]/l)+1;this._viewSize[0]=t[0],this._viewSize[1]=t[1],this._tileCache.maxSize=5*i*s}}function c(e){const[t,i,s,l]=e.split("/"),r=parseInt(t,10);return 0===r?null:`${r-1}/${parseInt(i,10)>>1}/${parseInt(s,10)>>1}/${parseInt(l,10)}`}function h(e,t){const i=t.level-e.level;return e.row===t.row>>i&&e.col===t.col>>i&&e.world===t.world}export{a as TileManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{RenderingDevice as e}from"../webgl/RenderingDevice.js";import{simplePipelineState as t}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as i}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";const
|
|
2
|
+
import{RenderingDevice as e}from"../webgl/RenderingDevice.js";import{simplePipelineState as t}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as i}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";const r=1e-6;class s{constructor(t,r){this.spriteMosaic=t,this.glyphMosaic=r,this._vtlTechniques=new i,this._context=null,this._vtlTechniques.startup(),this._renderingDevice=new e}dispose(){this._vtlTechniques&&this._vtlTechniques.shutdown(this._context),this.spriteMosaic.dispose(),this.glyphMosaic.dispose(),this._renderingDevice.dispose(),this._context=null}drawSymbols(e,t,i){const s=i.layers;e.renderPass="translucent";const o=this._vtlTechniques.getTechnique(3);n[0]=t;for(let l=0;l<s.length;l++){const t=s[l];if(3!==t.type)continue;const i=t.getLayoutProperty("visibility");if(i&&1===i.getValue())continue;const a=e.displayLevel;void 0!==t.minzoom&&t.minzoom>a+r||void 0!==t.maxzoom&&t.maxzoom<=a-r||(e.styleLayerUID=t.uid,e.styleLayer=t,o.render(e,{tiles:n}))}n[0]=null}drawBackground(e,t,i){if(0===i.backgroundBucketIds.length)return;const{displayLevel:s,requiredLevel:o}=e;t.key.level=o,this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:!1}),e.renderPass="background";const l=this._vtlTechniques.getTechnique(0);n[0]=t,i.backgroundBucketIds.forEach(t=>{const o=i.getLayerById(t);if(0!==o.type)return;const a=o.getLayoutProperty("visibility");a&&1===a.getValue()||void 0!==o.minzoom&&o.minzoom>s+r||void 0!==o.maxzoom&&o.maxzoom<=s-r||(e.styleLayerUID=o.uid,e.styleLayer=o,l.render(e,{tiles:n}))}),n[0]=null}drawTile(e,i,r,s){const n=r.layers,{context:o}=e,l=o.getPipelineState(),{depthWrite:a}=l;let c=0,u=1;void 0!==a?.zNear&&void 0!==a.zFar&&(c=a.zNear,u=a.zFar),this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"none"},stencil:!1,depth:{write:{zNear:c,zFar:u},test:515}});const d=n.filter(e=>{if(null!=s&&s!==e.type||!i.layerData.has(e.uid))return!1;const t=e.getLayoutProperty("visibility");return 1!==t?.getValue()});e.renderPass="opaque";for(let t=d.length-1;t>=0;--t)this._renderStyleLayer(d[t],e,i);this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:{write:!1,test:515}}),e.renderPass="translucent",d.forEach(t=>this._renderStyleLayer(t,e,i)),this._renderingDevice.setPipelineState(t),this._context||(this._context=e.context)}setShader(e){return this._renderingDevice.setShader(e)}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,i){return this._renderingDevice.submitDraw(e,t,i)}submitDrawMesh(e,t,i,r){this._renderingDevice.submitDrawMesh(e,t,i,r)}submitDrawMeshUntyped(e,t,i,r){this._renderingDevice.submitDrawMeshUntyped(e,t,i,r)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}_renderStyleLayer(e,t,i){const{renderPass:s}=t;let o;switch(e.type){case 0:if("background"!==s)return;o=this._vtlTechniques.getTechnique(0);break;case 1:if("opaque"!==s&&"translucent"!==t.renderPass)return;o=this._vtlTechniques.getTechnique(1);break;case 2:if("translucent"!==s)return;o=this._vtlTechniques.getTechnique(2);break;case 4:if("translucent"!==s)return;o=this._vtlTechniques.getTechnique(4);break;case 3:if("translucent"!==s)return;o=this._vtlTechniques.getTechnique(3)}const{displayLevel:l}=t,{minzoom:a,maxzoom:c}=e;void 0!==a&&a>l+r||void 0!==c&&c<=l-r||!o||(this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:{write:{mask:0},test:!1},depth:!1}),t.styleLayerUID=e.uid,t.styleLayer=e,n[0]=i,o.render(t,{tiles:n}),n[0]=null)}}const n=[null];export{s as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{identity as
|
|
2
|
+
import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import has from"../../../../core/has.js";import{identity as t,translate as s,rotate as r,scale as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{tileSizeInTileUnits as o}from"./constants.js";import{CircleRenderBucket as n,SymbolRenderBucket as h,LineRenderBucket as l,FillRenderBucket as c}from"./RenderBucket.js";import{fadeDuration as d}from"./decluttering/config.js";import{TiledDisplayObject as u}from"../webgl/TiledDisplayObject.js";import y from"../webgl/util/Fader.js";const m=null;class p extends u{constructor(t,s,r,a,i,n,h,l=null){super(t,s,r,a,i,n,o,o),this.styleRepository=h,this._owner=l,this.type="vector-tile",this._referenced=1,this._hasSymbolBuckets=!1,this._usedMemory=256,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this.featureIndex=null,this.triangleCount=0,this._processed=!1,this.id=t.id;const c="TileHandler3D"===this._owner?.type?1:0,d=e()?0:has("mapview-transitions-duration")??300;this.fader=y.create(c,d)}get styleLayerUIDs(){return Array.from(this.layerData.keys())}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<d}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<d)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e){const e=this.layerData.get(s);e&&(this._usedMemory-=e.usedMemory,3===e.type&&this.symbols.delete(s)&&(t=!0),e.destroy(),this.layerData.delete(s))}this._owner?.updateTileSize(this),t&&(this.featureIndex?.clear(),this.emit("symbols-changed")),this.requestRender()}processed(){return this._processed}hasData(){return this.layerData.size>0}hasFeatures(){const e=this.layerData.values();for(const t of e)if(t.hasData())return!0;return!1}dispose(){"unloaded"!==this.status&&(p._destroyRenderBuckets(this.layerData),this.layerData.clear(),this.featureIndex=null,this._usedMemory=0,this.destroy(),this.status="unloaded")}release(){0===--this._referenced&&(this._owner?.onDisposeTile(this),this.dispose(),this.stage=null)}retain(){++this._referenced}get usedMemory(){return this._usedMemory}get usedMemoryPerReference(){return this._usedMemory/(this._referenced||1)}changeDataImpl(e){this.featureIndex?.clear();let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:r}=e,a=this._createRenderBuckets(s);if(r&&r.byteLength>0){const e=new Uint32Array(r);for(const t of e)this._deleteLayerData(t)}for(const[e,i]of a)this._deleteLayerData(e),3===i.type&&(this.symbols.set(e,i.symbols),t=!0),this._usedMemory+=i.usedMemory,this.layerData.set(e,i);this._owner?.updateTileSize(this)}this._hasSymbolBuckets=!1;for(const s of this.layerData.values())3===s.type&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(e){super.setTransform(e);const i=this.resolution/(e.resolution*e.pixelRatio),o=this.width/this.rangeX*i,n=this.height/this.rangeY*i,h=[0,0];e.toScreen(h,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;t(l),s(l,l,h),r(l,l,Math.PI*e.rotation/180),a(l,l,[o,n,1])}_createTransforms(){return{displayViewScreenMat3:i(),tileMat3:i(),tileUnitsToPixels:i()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;for(const s of e.values())t.has(s)||(s.destroy(),t.add(s));e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const r of e){const e=this._deserializeBucket(r,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case 1:s=new c(e,this.styleRepository);break;case 2:s=new l(e,this.styleRepository);break;case 3:s=new h(e,this.styleRepository,this);break;case 4:s=new n(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._usedMemory-=t.usedMemory,t.destroy(),this.layerData.delete(e)}}export{p as VectorTile,m as tracer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import t from"../../../../layers/support/TileInfo.js";import{tileSizeInTileUnits as s,tileSizeInPixels as r}from"./constants.js";import{SymbolFader as i}from"./decluttering/SymbolFader.js";import{writeOpacityToBuffers as o}from"./decluttering/util.js";import{RenderableTile as l}from"../webgl/RenderableTile.js";import n from"../webgl/TileContainer.js";import{simplePipelineState as a}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as d}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";import h from"../../tiling/TileCoverage.js";import c from"../../tiling/TileKey.js";const u=1e-6;function y(e,t){if(e){const s=e.getLayoutProperty("visibility");if(!s||1!==s.getValue()&&(void 0===e.minzoom||e.minzoom<t+u)&&(void 0===e.maxzoom||e.maxzoom>=t-u))return!0}return!1}class
|
|
2
|
+
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import t from"../../../../layers/support/TileInfo.js";import{tileSizeInTileUnits as s,tileSizeInPixels as r}from"./constants.js";import{SymbolFader as i}from"./decluttering/SymbolFader.js";import{writeOpacityToBuffers as o}from"./decluttering/util.js";import{RenderableTile as l}from"../webgl/RenderableTile.js";import n from"../webgl/TileContainer.js";import{simplePipelineState as a}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as d}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";import h from"../../tiling/TileCoverage.js";import c from"../../tiling/TileKey.js";const u=1e-6;function y(e,t){if(e){const s=e.getLayoutProperty("visibility");if(!s||1!==s.getValue()&&(void 0===e.minzoom||e.minzoom<t+u)&&(void 0===e.maxzoom||e.maxzoom>=t-u))return!0}return!1}class m extends n{constructor(e){super(e),this._backgroundTiles=[],this._techniques=new d,this._computeDisplayInfoView(e),this._techniques.startup()}destroy(){super.destroy(),this.removeAllChildren(),this._spriteMosaic?.dispose(),this._spriteMosaic=null,this._glyphMosaic?.dispose(),this._glyphMosaic=null,null!=this._symbolFader&&(this._symbolFader.clear(),this._symbolFader=null);const e=this.stage?.context;e&&this._techniques.shutdown(e),this._styleRepository=null,this._backgroundTiles=[]}get fading(){return this._symbolFader?.fading??!1}get symbolFader(){return this._symbolFader}get symbolRepository(){return this._symbolFader?.symbolRepository}setStyleResources(e,t,r,l){if(this._spriteMosaic=e,this._glyphMosaic=t,this._styleRepository=r,this.tilingScheme=l,this._computeDisplayInfoView(l),null==this._symbolFader){const e=(e,t)=>{e.allSymbolsFadingOut=!0,e.lastOpacityUpdate=t,o(e,t,!0),e.decluttered=!0,e.requestRender()};this._symbolFader=new i("vector-tile",this._styleRepository,e,this.children,s)}this._symbolFader.styleRepository=r}setSpriteMosaic(e){this._spriteMosaic?.dispose(),this._spriteMosaic=e}deleteStyleLayers(e){null!=this._symbolFader&&this._symbolFader.deleteStyleLayers(e)}createRenderParams(e){return{...super.createRenderParams(e),renderPass:null,styleLayer:null,styleLayerUID:-1,glyphMosaic:this._glyphMosaic,spriteMosaic:this._spriteMosaic}}doRender(e){const{drawPhase:t}=e,s=1===t||64===t;this.visible&&s&&void 0!==this._spriteMosaic&&super.doRender(e)}addChild(e){return super.addChild(e),null!=this._symbolFader?this._symbolFader.addTile(e):e.decluttered=!0,this.requestRender(),e}removeChild(e){return null!=this._symbolFader&&this._symbolFader.removeTile(e),this.requestRender(),super.removeChild(e)}renderChildren(e){const{drawPhase:t}=e;64!==t?this._doRender(e):super.renderChildren(e)}removeAllChildren(){for(let e=0;e<this.children.length;e++){const t=this.children[e];null!=this._symbolFader&&this._symbolFader.removeTile(t),t.dispose()}super.removeAllChildren()}getStencilTarget(){return this.children.filter(e=>e.neededForCoverage&&e.hasData())}restartDeclutter(){null!=this._symbolFader&&this._symbolFader.restartDeclutter()}_doRender(e){const{context:t,painter:s,state:r}=e,i=this._styleRepository;if(!i)return;const o=i.layers,l=this._displayInfo.scaleToZoom(r.scale);super.renderChildren(e),i.backgroundBucketIds.length>0&&(e.renderPass="background",this._renderBackgroundLayers(e,i.backgroundBucketIds,l)),1===e.drawPhase&&this._fade(l,r);const n=this.children.filter(e=>e.visible&&e.hasData());if(n&&0!==n.length){for(const e of n)e.triangleCount=0;if(1===e.drawPhase)for(const e of n)e.fader.fade()<1&&this.requestRender();t.setClearDepth(1),t.clear(256),s.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:{write:!1,test:{compare:514,op:{fail:7680,zFail:7680,zPass:7681},mask:255}},depth:{write:!1,test:515}}),e.renderPass="translucent";for(let t=0;t<o.length;t++)this._renderStyleLayer(o[t],e,n);t.bindVAO(null),s.setPipelineState(a);for(const e of n)e.debugInfo.display.triangleCount=e.triangleCount}else t.bindVAO(null)}_fade(e,t){null!=this._symbolFader&&(this._symbolFader.update(e,t)||this.requestRender())}_renderStyleLayer(e,t,s){const{displayLevel:r,renderPass:i}=t;if(void 0===e)return;const o=e.getLayoutProperty("visibility");if(o&&1===o.getValue())return;switch(e.type){case 0:return;case 1:case 2:case 4:case 3:if("translucent"!==i)return}if(s=3===e.type?s.filter(e=>e.decluttered):s.filter(e=>e.neededForCoverage),3!==e.type&&(0===s.length||void 0!==e.minzoom&&e.minzoom>=r+u||void 0!==e.maxzoom&&e.maxzoom<r-u))return;const l=e.uid;t.styleLayerUID=l,t.styleLayer=e;const n=this._techniques.getTechnique(e.type);null!=n&&n.render(t,{tiles:s})}_renderBackgroundLayers(t,i,o){const{state:n}=t,a=this._styleRepository;let d=!1;for(const e of i){const t=a.getLayerById(e);if(t&&0===t.type&&y(a.getLayerById(e),o)){d=!0;break}}if(!d)return;const u=this.tilingScheme,m=u.getTileCoverage(t.state,0,!0,"smallest"),{spans:p,lodInfo:f}=m,{level:g}=f,_=e(),b=[],F=this._backgroundTiles;let R,v=0;for(const{row:h,colFrom:y,colTo:C}of p)for(let t=y;t<=C;t++){if(v<F.length)R=F[v],R.key.set(g,h,f.normalizeCol(t),f.getWorldForColumn(t)),u.getTileBounds(_,R.key,!1),R.x=_[0],R.y=_[3],R.resolution=u.getTileResolution(g);else{const i=new c(g,h,f.normalizeCol(t),f.getWorldForColumn(t)),o=u.getTileBounds(e(),i),n=u.getTileResolution(g);R=new l(i,n,o[0],o[3],r,r,s,s),F.push(R)}R.setTransform(n),b.push(R),v++}const T=this._techniques.getTechnique(0);for(const e of i){const s=a.getLayerById(e);0===s.type&&y(s,o)&&(t.styleLayerUID=s.uid,t.styleLayer=s,T.render(t,{tiles:b}))}h.pool.release(m)}_computeDisplayInfoView(e){let s=e.tileInfo.lods[0].scale;const i=Math.max(25,e.tileInfo.lods.length),o=[];for(let t=0;t<=i;t++)o.push(s),s/=2;this._displayInfo=t.create({scales:o,size:r,spatialReference:e.spatialReference,numLODs:i})}}export{m as VectorTileContainer};
|
package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as o,__param as t}from"tslib";import{GraphShaderModule as e,FragmentOutput as
|
|
2
|
+
import{__decorate as o,__param as t}from"tslib";import{GraphShaderModule as e,FragmentOutput as i,location as r,uniform as s,option as p,input as l,VertexInput as a,UniformGroup as d,FragmentInput as y}from"../../../GraphShaderModule.js";import{max as u,mod as v,Vec2 as c,Float as n,Vec3 as h,Vec4 as k,length as x,smoothstep as g,negate as M,cond as T,lessThan as w,mix as C,Mat3 as b}from"../../../graph/glsl.js";class m extends a{}o([r(0,c)],m.prototype,"position",void 0),o([r(1,n)],m.prototype,"radius",void 0),o([r(2,k)],m.prototype,"color",void 0),o([r(3,n)],m.prototype,"opacity",void 0),o([r(4,n)],m.prototype,"strokeWidth",void 0),o([r(5,k)],m.prototype,"strokeColor",void 0),o([r(6,n)],m.prototype,"strokeOpacity",void 0),o([r(7,n)],m.prototype,"blur",void 0),o([r(8,n)],m.prototype,"radiusTo",void 0),o([r(9,k)],m.prototype,"colorTo",void 0),o([r(10,n)],m.prototype,"opacityTo",void 0),o([r(11,n)],m.prototype,"strokeWidthTo",void 0),o([r(12,k)],m.prototype,"strokeColorTo",void 0),o([r(13,n)],m.prototype,"strokeOpacityTo",void 0),o([r(14,n)],m.prototype,"blurTo",void 0);class W extends y{}class f extends d{}o([s(b)],f.prototype,"dvsMat",void 0),o([s(b)],f.prototype,"displayMat",void 0);class O extends d{}o([s(c)],O.prototype,"circleTranslation",void 0),o([s(n)],O.prototype,"depth",void 0),o([s(n)],O.prototype,"antialiasingWidth",void 0),o([s(n)],O.prototype,"tileOpacity",void 0);class S extends d{}o([s(n)],S.prototype,"value",void 0);class j extends d{}o([s(n)],j.prototype,"value",void 0);class B extends d{}o([s(n)],B.prototype,"value",void 0);class R extends d{}o([s(n)],R.prototype,"value",void 0);class G extends d{}o([s(n)],G.prototype,"value",void 0);class L extends d{}o([s(n)],L.prototype,"value",void 0);class P extends d{}o([s(n)],P.prototype,"value",void 0);class V extends d{}o([s(n)],V.prototype,"value",void 0);class q extends d{}o([s(n)],q.prototype,"value",void 0);class z extends d{}o([s(n)],z.prototype,"value",void 0);class A extends d{}o([s(k)],A.prototype,"value",void 0);class D extends d{}o([s(n)],D.prototype,"value",void 0);class E extends d{}o([s(k)],E.prototype,"value",void 0);class F extends d{}o([s(n)],F.prototype,"value",void 0);class H extends e{constructor(){super(...arguments),this.type="VTLShaderCircle"}vertex(o){const t=this.getColor(o).multiply(this.getOpacity(o)),e=this.getStrokeColor(o).multiply(this.getStrokeOpacity(o)),i=this.getStrokeWidth(o),r=this.getRadius(o),s=this.getBlur(o),p=r.add(i),l=u(s,this.config.antialiasingWidth.divide(p)),a=v(o.position,new c(2)).multiply(new n(2)).subtract(new n(1)),d=this.transform.dvsMat.multiply(new h(o.position.multiply(.5),new n(1))).add(this.transform.displayMat.multiply(new h(a.multiply(p).add(this.config.circleTranslation),new n(0))));return{glPosition:new k(d.xy,this.config.depth,1),strokeWidth:i,radius:r,blur:l,color:t,offset:a,strokeColor:e}}fragment(o){const t=new i,e=x(o.offset),r=g(new n(0),M(o.blur),e.subtract(new n(1))),s=T([w(o.strokeWidth,new n(.01)),()=>new n(0)],[!0,g(M(o.blur),new n(0),e.subtract(o.radius.divide(o.radius.add(o.strokeWidth))))]);return t.fragColor=C(o.color,o.strokeColor,s).multiply(r).multiply(this.config.tileOpacity),t}getRadius(o){return this.radiusMix?.value&&o.radius&&o.radiusTo?C(o.radius,o.radiusTo,this.radiusMix.value):o.radius?o.radius:this.radius?.value||new n(0)}getBlur(o){return this.blurMix?.value&&o.blur&&o.blurTo?C(o.blur,o.blurTo,this.blurMix.value):o.blur?o.blur:this.blur?.value||new n(0)}getOpacity(o){return this.opacityMix?.value&&o.opacity&&o.opacityTo?C(o.opacity,o.opacityTo,this.opacityMix.value):o.opacity?o.opacity:this.opacity?.value||new n(1)}getStrokeWidth(o){return this.strokeWidthMix?.value&&o.strokeWidth&&o.strokeWidthTo?C(o.strokeWidth,o.strokeWidthTo,this.strokeWidthMix.value):o.strokeWidth?o.strokeWidth:this.strokeWidth?.value||new n(0)}getColor(o){return this.colorMix?.value&&o.color&&o.colorTo?C(o.color,o.colorTo,this.colorMix.value):o.color?o.color:this.color?.value||new k(0)}getStrokeColor(o){return this.strokeColorMix?.value&&o.strokeColor&&o.strokeColorTo?C(o.strokeColor,o.strokeColorTo,this.strokeColorMix.value):o.strokeColor?o.strokeColor:this.strokeColor?.value||new k(0)}getStrokeOpacity(o){return this.strokeOpacityMix?.value&&o.strokeOpacity&&o.strokeOpacityTo?C(o.strokeOpacity,o.strokeOpacityTo,this.strokeOpacityMix.value):o.strokeOpacity?o.strokeOpacity:this.opacity?.value||new n(0)}}o([s(f)],H.prototype,"transform",void 0),o([s(O)],H.prototype,"config",void 0),o([p(S)],H.prototype,"radius",void 0),o([p(j)],H.prototype,"radiusMix",void 0),o([p(B)],H.prototype,"blur",void 0),o([p(R)],H.prototype,"blurMix",void 0),o([p(G)],H.prototype,"opacity",void 0),o([p(L)],H.prototype,"opacityMix",void 0),o([p(P)],H.prototype,"strokeOpacity",void 0),o([p(V)],H.prototype,"strokeOpacityMix",void 0),o([p(q)],H.prototype,"strokeWidth",void 0),o([p(z)],H.prototype,"strokeWidthMix",void 0),o([p(A)],H.prototype,"color",void 0),o([p(D)],H.prototype,"colorMix",void 0),o([p(E)],H.prototype,"strokeColor",void 0),o([p(F)],H.prototype,"strokeColorMix",void 0),o([t(0,l(m))],H.prototype,"vertex",null),o([t(0,l(W))],H.prototype,"fragment",null);export{H as VTLShaderCircle};
|