@arcgis/core 4.29.2 → 4.29.4
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/686a76adc741eef369ee.js +1 -0
- package/assets/esri/core/workers/chunks/{b125ab84b7761e761734.js → 6ee0e9e56b80296570cb.js} +1 -1
- package/assets/esri/core/workers/chunks/994ca341d8711a4dd473.js +1 -0
- package/assets/esri/core/workers/chunks/{246cba9cd5cadba6be08.js → 9a8ab968ebb18480481d.js} +1 -1
- package/assets/esri/core/workers/chunks/ad9740559e8e45526796.js +1 -0
- package/assets/esri/core/workers/chunks/bd4cb6b02ed52b82ba56.js +1 -0
- package/assets/esri/core/workers/chunks/{712b5cabf4ea3dc8bf33.js → c34ec99627e7645fd218.js} +1 -1
- package/assets/esri/core/workers/chunks/c442480601f9a36e29b9.js +1 -0
- package/assets/esri/core/workers/chunks/c8ecaac448fddd120421.js +1 -0
- package/interfaces.d.ts +39 -51
- package/kernel.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToFeatureFactories.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/ReshufflePlan.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/ProcessorTileMessageQueue.js +5 -0
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/aggregation/GridCell.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/ComputedExpression.js +1 -1
- package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetCache.js +5 -0
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/7427d03e693f32a81377.js +0 -1
- package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +0 -1
- package/assets/esri/core/workers/chunks/8044f34d295ec36aa3f1.js +0 -1
- package/assets/esri/core/workers/chunks/94d72650d556fd0eecc3.js +0 -1
- package/assets/esri/core/workers/chunks/ef3e6209e6ac6a56960b.js +0 -1
- package/assets/esri/core/workers/chunks/ff14214611e1e070235e.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ProtoFeatureCollection as e,ProtoInboundFeatureCollectionRequiredAttributes as t,Feature as a,CompressedGeometry as s,Field as r,Transform as n}from"../ProtoFeatureCollection.js";import{EsriGeometryTypes as o,EsriFieldTypes as l}from"./WasmDataModelWrapperInterfaces.js";import{SqlTypeCode as i,WasmQuantizeOriginPositionTypeCode as c}from"./WasmSerializedLayerData.js";function d(s){const r=new e;r.version=s.version;const n=s.get_query_result();if(0!==n.results_type.value)throw new Error("Got a non-feature collection type");const l=n.get_feature_result(),i=r.queryResult.featureResult;i.objectIdFieldName=l.objectid_field_name,i.exceededTransferLimit=l.exceeded_transfer_limit,i.hasM=l.has_m,i.hasZ=l.has_z,i.geometryType=o[l.geometry_type.value],i.globalIdFieldName=l.globalid_field_name,i.geohashFieldName=l.geohash_field_name;const c=i.uniqueIdField,d=l.unique_id_field;c.name=d.name,c.isSystemMaintained=d.isSystemMaintained;const p=i.geometryProperties,_=l.geometry_properties;p.shapeAreaFieldName=_.shapeAreaFieldName,p.shapeLengthFieldName=_.shapeLengthFieldName,p.units=_.units;const y=i.spatialReference,h=l.spatial_reference;y.wkid=h.wkid,y.latestWkid=h.latestWkid,y.vcsWkid=h.vcsWkid,y.latestVcsWkid=h.latestVcsWkid,y.wkt=h.wkt,i.transform=g(l.transform);const v=i.fields,T=i.fieldNameToAttributeIndexMap,w=l.fields,z=w.size();for(let e=0;e<z;e++){const t=w.get(e),a=m(t);v.push(a),T[a.name]=e,t.delete()}w.delete();
|
|
5
|
+
import{ProtoFeatureCollection as e,ProtoInboundFeatureCollectionRequiredAttributes as t,Feature as a,CompressedGeometry as s,Field as r,Transform as n}from"../ProtoFeatureCollection.js";import{EsriGeometryTypes as o,EsriFieldTypes as l}from"./WasmDataModelWrapperInterfaces.js";import{SqlTypeCode as i,WasmQuantizeOriginPositionTypeCode as c}from"./WasmSerializedLayerData.js";function d(s){const r=new e;r.version=s.version;const n=s.get_query_result();if(0!==n.results_type.value)throw new Error("Got a non-feature collection type");const l=n.get_feature_result(),i=r.queryResult.featureResult;i.objectIdFieldName=l.objectid_field_name,i.exceededTransferLimit=l.exceeded_transfer_limit,i.hasM=l.has_m,i.hasZ=l.has_z,i.geometryType=o[l.geometry_type.value],i.globalIdFieldName=l.globalid_field_name,i.geohashFieldName=l.geohash_field_name;const c=i.uniqueIdField,d=l.unique_id_field;c.name=d.name,c.isSystemMaintained=d.isSystemMaintained;const p=i.geometryProperties,_=l.geometry_properties;p.shapeAreaFieldName=_.shapeAreaFieldName,p.shapeLengthFieldName=_.shapeLengthFieldName,p.units=_.units;const y=i.spatialReference,h=l.spatial_reference;y.wkid=h.wkid,y.latestWkid=h.latestWkid,y.vcsWkid=h.vcsWkid,y.latestVcsWkid=h.latestVcsWkid,y.wkt=h.wkt,i.transform=g(l.transform);const v=i.fields,T=i.fieldNameToAttributeIndexMap,w=l.fields,z=w.size();for(let e=0;e<z;e++){const t=w.get(e),a=m(t);v.push(a),T[a.name]=e,t.delete()}w.delete();const F=i.values,S=l.values_count();for(let e=0;e<S;e++)F.push(l.get_value_at(e));const k=i.features,b=l.features,q=b.size();if(q>0)for(const e of t)if(void 0===T[e])throw new Error(`Feature collection missing required attribute: ${e}`);for(let e=0;e<q;e++){const t=new a,s=b.get(e),r=t.attributes,n=s.attributes_count();for(let e=0;e<n;e++)r.push(s.get_attribute_at(e));const o=s.get_compressed_geometry();o&&(t.compressedGeometry=u(o),t.centroid=u(s.get_centroid()));const l=t.aggregateGeometries,i=s.aggregate_geometries,c=i.size();for(let e=0;e<c;e++){const t=i.get(e),a=u(t);l.push(a),t.delete()}i.delete(),k.push(t),s.delete()}b.delete();const W=i.geometryFields,x=l.geometry_fields,N=x.size();for(let e=0;e<N;e++){const t=x.get(e),a=f(t);W.push(a),t.delete()}return x.delete(),r}function u(e){const t=new s;t.geometryType=o[e.geometry_type.value];const a=[],r=[];for(let s=0;s<e.lengths.length;s++)a.push(e.lengths[s]);for(let s=0;s<e.coords.length;s++)r.push(e.coords[s]);return t.lengths=a,t.coords=r,t}function m(e){const t=new r;return t.name=e.name,t.alias=e.alias,t.fieldType=l[e.field_type.value],t.sqlType=i[e.sql_type.value],t.domain=e.domain,t.defaultValue=e.default_value,t}function f(e){const t=m(e);return t.geometryType=o[e.geometry_type.value],t}function g(e){const t=new n;t.quantizeOriginPosition=c[e.quantizeOriginPosition.value];const a=t.scale,s=e.scale;a.xScale=s.xScale,a.yScale=s.yScale,a.mScale=s.mScale,a.zScale=s.zScale;const r=t.translate,o=e.translate;return r.xTranslate=o.xTranslate,r.yTranslate=o.yTranslate,r.mTranslate=o.mTranslate,r.zTranslate=o.zTranslate,t}export{u as wasmToCompressedGeometry,m as wasmToField,f as wasmToGeometryField,d as wasmToProtoFeatureCollection,g as wasmToTransform};
|
package/rest/print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../kernel.js";import t from"../request.js";import i from"../core/Error.js";import{JSONMap as r}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as n,px2pt as s}from"../core/screenUtils.js";import{normalize as o,dataComponents as l}from"../core/urlUtils.js";import c from"../geometry/Polygon.js";import{collectLabelingFields as u}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as y}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as p}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as f,getToken as d}from"./utils.js";import{execute as m}from"./geoprocessor/execute.js";import{submitJob as g}from"./geoprocessor/submitJob.js";import{toJSON as h}from"./support/fileFormat.js";import{toJSON as b}from"./support/layoutTemplate.js";import{getVisibleLayerViews as w,isScreenshotRequired as S,isBingMapsLayer as x,isCSVLayer as v,isBlendLayer as I,applyVisualVariables as D,getContextBoundingBox as L,createPolygonLayer as T,createPolylineLayer as O,createPointLayer as E,createMultipointLayer as M}from"./support/printTaskUtils.js";import V from"./support/PrintTemplate.js";import{toJSON as P}from"./support/reportTemplate.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},R=new r({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new r({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),J=new Map;async function U(e,i,r){const a=k(e);let n=J.get(a);return Promise.resolve().then((()=>n?{data:n.gpMetadata}:(n={gpServerUrl:a,is11xService:!1,legendLayerNameMap:{},legendLayers:[]},t(a,f({f:"json"},r))))).then((e=>(n.gpMetadata=e.data,n.cimVersion=n.gpMetadata.cimVersion,n.is11xService=!!n.cimVersion,J.set(a,n),C(i,n)))).then((t=>{const a=pe(n);let s;const o=e=>"sync"===a?e.results?.[0]?.value:s.fetchResultData("Output_File",null,r).then((e=>e.value));return"async"===a?g(e,t,void 0,r).then((e=>(s=e,e.waitForJobCompletion({interval:i.updateDelay}).then(o)))):m(e,t,void 0,r).then(o)}))}async function j(e){const t=k(e);return pe(J.get(t))}async function C(t,r){r=r||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new V;null==a.showLabels&&(a.showLabels=!0);const n=a.exportOptions;let s;const o=b(a.layout);if(n){if(s={dpi:n.dpi},"map_only"===o.toLowerCase()||""===o){const e=n.width,t=n.height;s.outputSize=null!=e&&null!=t?[e,t]:void 0}}const l=a.layoutOptions;let c;if(l){let e,t;"Miles"===l.scalebarUnit||"Kilometers"===l.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==l.scalebarUnit&&"Feet"!==l.scalebarUnit||(e="Meters",t="Feet"),c={titleText:l.titleText,authorText:l.authorText,copyrightText:l.copyrightText,customTextElements:l.customTextElements,elementOverrides:l.elementOverrides,scaleBarOptions:{metricUnit:R.toJSON(e),metricLabel:e?F[e]:void 0,nonMetricUnit:R.toJSON(t),nonMetricLabel:t?F[t]:void 0}}}let u=null;l?.legendLayers&&(u=l.legendLayers.map((e=>{const t=e.layerId;r.legendLayerNameMap[t]=e.title;const i={id:t};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i})));const y=await A(t,a,r);if(y.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=i=>{const r=i.text,a=i.font,n=a?.family?.toLowerCase();r&&a&&("arial"===n||"arial unicode ms"===n)&&(a.family=e.test(r)?"Arial Unicode MS":"Arial","normal"!==a.style&&t.test(r)&&(a.family="Arial Unicode MS"))},n=()=>{throw new i("print:cim-symbol-unsupported","CIMSymbol is not supported by a print service published from ArcMap")};for(const i of y.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type?a(t.symbol):"CIMSymbolReference"!==t.symbol.type||r.is11xService||n()}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&("esriTS"===t.symbol.type?a(t.symbol):"CIMSymbolReference"!==t.symbol.type||r.is11xService||n())}else!r.is11xService&&i.layerDefinition?.drawingInfo?.renderer&&JSON.stringify(i.layerDefinition.drawingInfo.renderer).includes('"type":"CIMSymbolReference"')&&n()}t.outSpatialReference&&(y.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(y,{exportOptions:s,layoutOptions:c||{}}),Object.assign(y.layoutOptions,{legendOptions:{operationalLayers:null!=u?u:r.legendLayers.slice()}}),r.legendLayers.length=0,J.set(r.gpServerUrl,r);const p={Web_Map_as_JSON:JSON.stringify(y),Format:h(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:P(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete p.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(r.gpServerUrl),p.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete p.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(r.gpServerUrl),p.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(p,t.extraParameters),p}async function A(e,t,i){const r=e.view;let a=r.spatialReference;const n={operationalLayers:await _(r,t,i)};t.includeTables&&(n.tables=await ie(r));let s=i.ssExtent||e.extent||r.extent;if(a&&a.isWrappable&&(s=s.clone()._normalize(!0),a=s.spatialReference),n.mapOptions={extent:s&&s.toJSON(),spatialReference:a&&a.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,r.background&&(n.background=r.background.toJSON()),r.rotation&&(n.mapOptions.rotation=-r.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||r.scale),null!=r.timeExtent){const e=null!=r.timeExtent.start?r.timeExtent.start.getTime():null,t=null!=r.timeExtent.end?r.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function k(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function _(e,t,i){const r=[],a={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const s=w(e,n);for(const o of s){const e=o.layer;if(!e.loaded||"group"===e?.type)continue;let t;a.layerView=o,t=S(o)?await ee(e,a,i):x(e)?z(e):v(e)?await $(e,a,i):"feature"===e?.type?await W(e,a,i):"geojson"===e?.type?await q(e,a,i):"graphics"===e?.type?await B(e,a,i):"imagery"===e?.type?H(e,i):"imagery-tile"===e?.type?await G(e,a,i):"kml"===e?.type?await Q(e,a,i):"map-image"===e?.type?X(e,a,i):"map-notes"===e?.type?await Y(a,i):"open-street-map"===e?.type?Z():"stream"===e?.type?await te(e,a,i):"tile"===e?.type?re(e,i):"vector-tile"===e?.type?await ae(e,a,i):"web-tile"===e?.type?ne(e):"wms"===e?.type?se(e,i):"wmts"===e?.type?oe(e):await ee(e,a,i),t&&(Array.isArray(t)?r.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=o.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),r.push(t)))}if(n)for(const o of r)o.minScale=0,o.maxScale=0;if(e.graphics?.length){const a=await K(null,e.graphics,t,i);a&&r.push(a)}return r}function z(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function $(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const r=t.layerView,a=t.printTemplate;let n;if(!i.is11xService||r.filter||e.portalItem&&"public"!==e.portalItem.access){return K(e,await ye(r),a,i)}return n={type:"CSV"},e.write(n,{origin:"web-map"}),delete n.popupInfo,delete n.layerType,n.showLabels=a.showLabels&&e.labelsVisible,n}async function K(e,t,i,r){let a;const n=T(),s=O(),o=E(),l=M(),y=E();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=s.layerDefinition.name=o.layerDefinition.name=l.layerDefinition.name=r.legendLayerNameMap[e.id]||e.get("arcgisProps.title")||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const c=l.layerDefinition.drawingInfo;c&&(c.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=e.write({},{origin:"web-map"}),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){a=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=s.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const r=o.layerDefinition.drawingInfo;r&&(r.labelingInfo=i);const c=l.layerDefinition.drawingInfo;c&&(c.labelingInfo=i)}}}let p;e?.renderer||a||(delete n.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete l.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;a&&await u(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,s.layerDefinition.fields=i,o.layerDefinition.fields=i,l.layerDefinition.fields=i}const m=t?.length;let g;for(let u=0;u<m;u++){const a=t[u]||t.at(u);if(!1===a.visible||!a.geometry)continue;if(g=a.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol?.outline&&"esriCLS"===g.symbol.outline.type&&!r.is11xService)continue;!r.is11xService&&g.symbol?.outline?.color?.[3]&&(g.symbol.outline.color[3]=255);const f=e?.renderer&&("valueExpression"in e.renderer&&e.renderer.valueExpression||"hasVisualVariables"in e.renderer&&e.renderer.hasVisualVariables());if(!g.symbol&&e?.renderer&&f&&!r.is11xService){const t=e.renderer,i=await t.getSymbolAsync(a);if(!i)continue;g.symbol=i.toJSON(),"hasVisualVariables"in t&&t.hasVisualVariables()&&D(g.symbol,{renderer:t,graphic:a,symbol:i})}if(g.symbol&&(g.symbol.angle||delete g.symbol.angle,fe(g.symbol)?g.symbol=await ce(g.symbol,r):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===a.geometry.type?n.featureSet.features.push(g):"polyline"===a.geometry.type?s.featureSet.features.push(g):"point"===a.geometry.type?g.symbol?.text?y.featureSet.features.push(g):o.featureSet.features.push(g):"multipoint"===a.geometry.type?l.featureSet.features.push(g):"extent"===a.geometry.type&&(g.geometry=c.fromExtent(a.geometry).toJSON(),n.featureSet.features.push(g))}const h=[n,s,l,o,y].filter((e=>e.featureSet.features.length>0));for(const c of h){const e=c.featureSet.features.every((e=>e.symbol));if(e&&(!i||!i.forceFeatureAttributes))for(const t of c.featureSet.features)delete t.attributes;e&&delete c.layerDefinition.drawingInfo,c.layerDefinition.drawingInfo?.renderer&&await ue(c.layerDefinition.drawingInfo.renderer,r)}return h.length?{featureCollection:{layers:h},showLabels:a}:null}async function W(e,t,i){let r;const a=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(!i.is11xService||n<2.9)||"pie-chart"===a?.type||"dot-density"===a?.type&&(!i.is11xService||n<2.6))return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const s=t.layerView,{printTemplate:o,view:l}=t,c=a&&("valueExpression"in a&&a.valueExpression||"hasVisualVariables"in a&&a.hasVisualVariables()),u="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(!i.is11xService&&c||s.filter||u||!a||"field"in a&&null!=a.field&&("string"!=typeof a.field||!e.getField(a.field))){const t=await ye(s);r=await K(e,t,o,i)}else{if(r={id:(f=e.write()).id,title:f.title,url:f.url,layerType:f.layerType,customParameters:f.customParameters,layerDefinition:f.layerDefinition,charts:o.includeCharts?f.charts:void 0},r.showLabels=o.showLabels&&e.labelsVisible,le(r,e),r.layerDefinition?.drawingInfo?.renderer&&(delete r.layerDefinition.minScale,delete r.layerDefinition.maxScale,await ue(r.layerDefinition.drawingInfo.renderer,i),"visualVariables"in a&&a.visualVariables&&a.visualVariables[0])){const e=a.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=p(e,l.scale);r.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,r.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=y(s);if(t&&(r.layerDefinition||(r.layerDefinition={}),r.layerDefinition.definitionExpression=r.layerDefinition.definitionExpression?`(${r.layerDefinition.definitionExpression}) AND (${t})`:t),s.hasHighlight?.()&&"getHighlightIds"in s){const e=s;r.selectionObjectIds=e.getHighlightIds()}}var f;return r}async function q(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return K(e,await ye(t.layerView),t.printTemplate,i)}async function B(e,{printTemplate:t},i){return K(e,null,t,i)}function H(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;if(i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction||e.renderer)if(t.is11xService)e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition=i.layerDefinition||{},i.layerDefinition.drawingInfo=i.layerDefinition.drawingInfo||{},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON());else{const t=e.exportImageServiceParameters.combineRendererWithRenderingRule();t&&(i.renderingRule=t.toJSON())}return le(i,e),i}async function G(e,t,i){if("flow"===e.renderer?.type)return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const r={bandIds:(a=e.write()||{}).bandIds,customParameters:a.customParameters,interpolation:a.interpolation,layerDefinition:a.layerDefinition};var a;return r.layerType="ArcGISImageServiceLayer",le(r,e),r}async function Q(e,t,i){const r=t.printTemplate;if(i.is11xService){const t={type:"kml"};return e.write(t,{origin:"web-map"}),delete t.layerType,t.url=o(e.url),t}const a=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,i)=>{const r={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?r.imageData=t.href.substr(22):r.url=t.href,a.push(r)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],l={id:e.id,...await K(null,s,r,i)};return a.push(l),a}function X(e,{view:t},i){let r;const a={id:e.id,subLayerIds:[]};let n=[];const s=t.scale,o=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,r=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&r))if(e.sublayers)e.sublayers.forEach(o);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{drawingInfo:t.drawingInfo,definitionExpression:t.definitionExpression,source:t.source}};n.unshift(i),a.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(o),n.length&&(n=n.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),r={layerType:(l=e.write()).layerType,customParameters:l.customParameters},r.layers=n,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:a.subLayerIds,le(r,e),e.legendEnabled&&i.legendLayers.push(a)),r}async function Y({layerView:e,printTemplate:t},i){const r=[],a=e.layer;if(null!=a.featureCollections)for(const n of a.featureCollections){const e=await K(n,n.source,t,i);e&&r.push(...e.featureCollection.layers)}else if(null!=a.sublayers)for(const n of a.sublayers){const e=await K(null,n.graphics,t,i);e&&r.push(...e.featureCollection.layers)}return{featureCollection:{layers:r}}}function Z(){return{type:"OpenStreetMap"}}async function ee(e,{printTemplate:t,view:i},r){const n={type:"image"},s={format:"png",ignoreBackground:!0,layers:[e],rotation:0},o=r.ssExtent||i.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&(s.area={x:0,y:0,width:i.width,height:i.height},u||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=i.toMap(a(s.area.width,s.area.height));o.ymin=e.y,o.xmax=e.x,r.ssExtent=o}n.extent=o.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(s);return n.imageData=l(p.dataUrl)?.data,n}async function te(e,{layerView:t,printTemplate:i},r){e.legendEnabled&&r.legendLayers.push({id:e.id});return K(e,await ye(t),i,r)}async function ie(e){const t=[],i=[];for(const a of e.map.allTables)"feature"!==a.type||a.loaded||i.push(a.load());i.length&&await Promise.allSettled(i);for(const a of e.map.allTables)if("feature"===a.type&&a.loaded&&a.isTable&&"feature-layer"===a.source?.type){const e={id:(r=a.write()).id,title:r.title,customParameters:r.customParameters,layerDefinition:{definitionExpression:r.layerDefinition?.definitionExpression},url:r.url};le(e,a),t.push(e)}var r;return t.length?t:void 0}function re(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;return le(i,e),i}async function ae(e,t,i){if(i.is11xService&&e.serviceUrl&&e.styleUrl){const t=d(e.styleUrl,e.apiKey),r=d(e.serviceUrl,e.apiKey);if(!t&&!r||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=o(e.styleUrl),i.token=t,r!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:r}]),i}}return ee(e,t,i)}function ne(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}function se(e,t){let i;const r=[],a=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(a):e.name&&r.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(a),r.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:r}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:r,url:o(e.url),version:e.version}),i}function oe(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function le(e,t){t.url&&(e.url=o(e.url||t.url),e.token=d(e.url,t.apiKey))}async function ce(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const r=1024;i.canvas.width=r,i.canvas.height=r;const a=i.canvas.getContext("2d");let o,l;if(e.path){const t=new Path2D(e.path);t.closePath(),a.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",a.fill(t);const i=L(a);if(!i)return null;a.clearRect(0,0,r,r);const s=n(e.size)/Math.max(i.width,i.height);a.scale(s,s);const c=r/s,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(a.translate(u,y),Array.isArray(e.color)&&a.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const r=e.outline;a.lineWidth=n(r.width)/s,a.lineJoin="round",a.strokeStyle=`rgba(${r.color[0]},${r.color[1]},${r.color[2]},${r.color[3]/255})`,a.stroke(t),i.width+=a.lineWidth,i.height+=a.lineWidth}i.width*=s,i.height*=s;const p=a.getImageData(r/2-i.width/2,r/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));o=p.width,l=p.height,a.canvas.width=o,a.canvas.height=l,a.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,r=(await t(i,{responseType:"image"})).data;o=n(e.width),l=n(e.height),a.canvas.width=o,a.canvas.height=l,a.drawImage(r,0,0,a.canvas.width,a.canvas.height)}return{type:"esriPMS",imageData:a.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:s(l),width:s(o),xoffset:e.xoffset,yoffset:e.yoffset}}async function ue(e,t){const i=e.type;if("simple"===i&&fe(e.symbol))e.symbol=await ce(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){fe(e.defaultSymbol)&&(e.defaultSymbol=await ce(e.defaultSymbol,t));const r=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(r)for(const e of r)fe(e.symbol)&&(e.symbol=await ce(e.symbol,t))}}async function ye(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function pe(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function fe(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{U as execute,C as getGpPrintParams,k as getGpServerUrl,j as getMode,J as printCacheMap};
|
|
5
|
+
import{id as e}from"../kernel.js";import t from"../request.js";import i from"../core/Error.js";import{JSONMap as r}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as n,px2pt as s}from"../core/screenUtils.js";import{normalize as o,dataComponents as l}from"../core/urlUtils.js";import c from"../geometry/Polygon.js";import{collectLabelingFields as u}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as y}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as p}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as f,getToken as d}from"./utils.js";import{execute as m}from"./geoprocessor/execute.js";import{submitJob as g}from"./geoprocessor/submitJob.js";import{toJSON as h}from"./support/fileFormat.js";import{toJSON as b}from"./support/layoutTemplate.js";import{getVisibleLayerViews as w,isScreenshotRequired as S,isBingMapsLayer as x,isCSVLayer as v,isBlendLayer as I,applyVisualVariables as D,getContextBoundingBox as L,createPolygonLayer as T,createPolylineLayer as O,createPointLayer as E,createMultipointLayer as M}from"./support/printTaskUtils.js";import V from"./support/PrintTemplate.js";import{toJSON as P}from"./support/reportTemplate.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},R=new r({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new r({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),J=new Map;async function U(e,i,r){const a=k(e);let n=J.get(a);return Promise.resolve().then((()=>n?{data:n.gpMetadata}:(n={gpServerUrl:a,is11xService:!1,legendLayerNameMap:{},legendLayers:[]},t(a,f({f:"json"},r))))).then((e=>(n.gpMetadata=e.data,n.cimVersion=n.gpMetadata.cimVersion,n.is11xService=!!n.cimVersion,J.set(a,n),C(i,n)))).then((t=>{const a=pe(n);let s;const o=e=>"sync"===a?e.results?.[0]?.value:s.fetchResultData("Output_File",null,r).then((e=>e.value));return"async"===a?g(e,t,void 0,r).then((e=>(s=e,e.waitForJobCompletion({interval:i.updateDelay}).then(o)))):m(e,t,void 0,r).then(o)}))}async function j(e){const t=k(e);return pe(J.get(t))}async function C(t,r){r=r||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new V;null==a.showLabels&&(a.showLabels=!0);const n=a.exportOptions;let s;const o=b(a.layout);if(n){if(s={dpi:n.dpi},"map_only"===o.toLowerCase()||""===o){const e=n.width,t=n.height;s.outputSize=null!=e&&null!=t?[e,t]:void 0}}const l=a.layoutOptions;let c;if(l){let e,t;"Miles"===l.scalebarUnit||"Kilometers"===l.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==l.scalebarUnit&&"Feet"!==l.scalebarUnit||(e="Meters",t="Feet"),c={titleText:l.titleText,authorText:l.authorText,copyrightText:l.copyrightText,customTextElements:l.customTextElements,elementOverrides:l.elementOverrides,scaleBarOptions:{metricUnit:R.toJSON(e),metricLabel:e?F[e]:void 0,nonMetricUnit:R.toJSON(t),nonMetricLabel:t?F[t]:void 0}}}let u=null;l?.legendLayers&&(u=l.legendLayers.map((e=>{const t=e.layerId;r.legendLayerNameMap[t]=e.title;const i={id:t};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i})));const y=await A(t,a,r);if(y.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=i=>{const r=i.text,a=i.font,n=a?.family?.toLowerCase();r&&a&&("arial"===n||"arial unicode ms"===n)&&(a.family=e.test(r)?"Arial Unicode MS":"Arial","normal"!==a.style&&t.test(r)&&(a.family="Arial Unicode MS"))},n=()=>{throw new i("print:cim-symbol-unsupported","CIMSymbol is not supported by a print service published from ArcMap")};for(const i of y.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type?a(t.symbol):"CIMSymbolReference"!==t.symbol.type||r.is11xService||n()}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&("esriTS"===t.symbol.type?a(t.symbol):"CIMSymbolReference"!==t.symbol.type||r.is11xService||n())}else!r.is11xService&&i.layerDefinition?.drawingInfo?.renderer&&JSON.stringify(i.layerDefinition.drawingInfo.renderer).includes('"type":"CIMSymbolReference"')&&n()}t.outSpatialReference&&(y.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(y,{exportOptions:s,layoutOptions:c||{}}),Object.assign(y.layoutOptions,{legendOptions:{operationalLayers:null!=u?u:r.legendLayers.slice()}}),r.legendLayers.length=0,J.set(r.gpServerUrl,r);const p={Web_Map_as_JSON:JSON.stringify(y),Format:h(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:P(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete p.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(r.gpServerUrl),p.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete p.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(r.gpServerUrl),p.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(p,t.extraParameters),p}async function A(e,t,i){const r=e.view;let a=r.spatialReference;const n={operationalLayers:await _(r,t,i)};t.includeTables&&(n.tables=await ie(r));let s=i.ssExtent||e.extent||r.extent;if(a&&a.isWrappable&&(s=s.clone()._normalize(!0),a=s.spatialReference),n.mapOptions={extent:s&&s.toJSON(),spatialReference:a&&a.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,r.background&&(n.background=r.background.toJSON()),r.rotation&&(n.mapOptions.rotation=-r.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||r.scale),null!=r.timeExtent){const e=null!=r.timeExtent.start?r.timeExtent.start.getTime():null,t=null!=r.timeExtent.end?r.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function k(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function _(e,t,i){const r=[],a={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const s=w(e,n);for(const o of s){const e=o.layer;if(!e.loaded||"group"===e?.type)continue;let t;a.layerView=o,t=S(o)?await ee(e,a,i):x(e)?z(e):v(e)?await $(e,a,i):"feature"===e?.type?await W(e,a,i):"geojson"===e?.type?await q(e,a,i):"graphics"===e?.type?await B(e,a,i):"imagery"===e?.type?H(e,i):"imagery-tile"===e?.type?await G(e,a,i):"kml"===e?.type?await Q(e,a,i):"map-image"===e?.type?X(e,a,i):"map-notes"===e?.type?await Y(a,i):"open-street-map"===e?.type?Z():"stream"===e?.type?await te(e,a,i):"tile"===e?.type?re(e,i):"vector-tile"===e?.type?await ae(e,a,i):"web-tile"===e?.type?ne(e):"wms"===e?.type?se(e,i):"wmts"===e?.type?oe(e):await ee(e,a,i),t&&(Array.isArray(t)?r.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=o.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),r.push(t)))}if(n)for(const o of r)o.minScale=0,o.maxScale=0;if(e.graphics?.length){const a=await K(null,e.graphics,t,i);a&&r.push(a)}return r}function z(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function $(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const r=t.layerView,a=t.printTemplate;let n;if(!i.is11xService||r.filter||e.portalItem&&"public"!==e.portalItem.access){return K(e,await ye(r),a,i)}return n={type:"CSV"},e.write(n,{origin:"web-map"}),delete n.popupInfo,delete n.layerType,n.showLabels=a.showLabels&&e.labelsVisible,n}async function K(e,t,i,r){let a;const n=T(),s=O(),o=E(),l=M(),y=E();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=s.layerDefinition.name=o.layerDefinition.name=l.layerDefinition.name=r.legendLayerNameMap[e.id]||e.get("arcgisProps.title")||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const c=l.layerDefinition.drawingInfo;c&&(c.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=e.write({},{origin:"web-map"}),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){a=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=s.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const r=o.layerDefinition.drawingInfo;r&&(r.labelingInfo=i);const c=l.layerDefinition.drawingInfo;c&&(c.labelingInfo=i)}}}let p;e?.renderer||a||(delete n.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete l.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;a&&await u(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,s.layerDefinition.fields=i,o.layerDefinition.fields=i,l.layerDefinition.fields=i}const m=t?.length;let g;for(let u=0;u<m;u++){const a=t[u]||t.at(u);if(!1===a.visible||!a.geometry)continue;if(g=a.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol?.outline&&"esriCLS"===g.symbol.outline.type&&!r.is11xService)continue;!r.is11xService&&g.symbol?.outline?.color?.[3]&&(g.symbol.outline.color[3]=255);const f=e?.renderer&&("valueExpression"in e.renderer&&e.renderer.valueExpression||"hasVisualVariables"in e.renderer&&e.renderer.hasVisualVariables());if(!g.symbol&&e?.renderer&&f&&!r.is11xService){const t=e.renderer,i=await t.getSymbolAsync(a);if(!i)continue;g.symbol=i.toJSON(),"hasVisualVariables"in t&&t.hasVisualVariables()&&D(g.symbol,{renderer:t,graphic:a,symbol:i})}if(g.symbol&&(g.symbol.angle||delete g.symbol.angle,fe(g.symbol)?g.symbol=await ce(g.symbol,r):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===a.geometry.type?n.featureSet.features.push(g):"polyline"===a.geometry.type?s.featureSet.features.push(g):"point"===a.geometry.type?g.symbol?.text?y.featureSet.features.push(g):o.featureSet.features.push(g):"multipoint"===a.geometry.type?l.featureSet.features.push(g):"extent"===a.geometry.type&&(g.geometry=c.fromExtent(a.geometry).toJSON(),n.featureSet.features.push(g))}const h=[n,s,l,o,y].filter((e=>e.featureSet.features.length>0));for(const c of h){const e=c.featureSet.features.every((e=>e.symbol));if(e&&(!i||!i.forceFeatureAttributes))for(const t of c.featureSet.features)delete t.attributes;e&&delete c.layerDefinition.drawingInfo,c.layerDefinition.drawingInfo?.renderer&&await ue(c.layerDefinition.drawingInfo.renderer,r)}return h.length?{featureCollection:{layers:h},showLabels:a}:null}async function W(e,t,i){let r;const a=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&(!i.is11xService||n<2.9)||"pie-chart"===a?.type||"dot-density"===a?.type&&(!i.is11xService||n<2.6))return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const s=t.layerView,{printTemplate:o,view:l}=t,c=a&&("valueExpression"in a&&a.valueExpression||"hasVisualVariables"in a&&a.hasVisualVariables()),u="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(!i.is11xService&&c||s.filter||u||!a||"field"in a&&null!=a.field&&("string"!=typeof a.field||!e.getField(a.field))){const t=await ye(s);r=await K(e,t,o,i)}else{if(r={id:(f=e.write()).id,title:f.title,url:f.url,layerType:f.layerType,customParameters:f.customParameters,layerDefinition:f.layerDefinition,charts:o.includeCharts?f.charts:void 0},r.showLabels=o.showLabels&&e.labelsVisible,le(r,e),r.layerDefinition?.drawingInfo?.renderer&&(delete r.layerDefinition.minScale,delete r.layerDefinition.maxScale,await ue(r.layerDefinition.drawingInfo.renderer,i),"visualVariables"in a&&a.visualVariables&&a.visualVariables[0])){const e=a.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=p(e,l.scale);r.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,r.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=y(s);if(t&&(r.layerDefinition||(r.layerDefinition={}),r.layerDefinition.definitionExpression=r.layerDefinition.definitionExpression?`(${r.layerDefinition.definitionExpression}) AND (${t})`:t),s.hasHighlight?.()&&"getHighlightIds"in s){const e=s;r.selectionObjectIds=e.getHighlightIds()}}var f;return r}async function q(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return K(e,await ye(t.layerView),t.printTemplate,i)}async function B(e,{printTemplate:t},i){return K(e,null,t,i)}function H(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;if(i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction||e.renderer)if(t.is11xService)e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition=i.layerDefinition||{},i.layerDefinition.drawingInfo=i.layerDefinition.drawingInfo||{},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON());else{const t=e.exportImageServiceParameters.combineRendererWithRenderingRule();t&&(i.renderingRule=t.toJSON())}return le(i,e),i}async function G(e,t,i){if("flow"===e.renderer?.type)return ee(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const r={bandIds:(a=e.write()||{}).bandIds,customParameters:a.customParameters,interpolation:a.interpolation,layerDefinition:a.layerDefinition};var a;return r.layerType="ArcGISImageServiceLayer",le(r,e),r}async function Q(e,t,i){const r=t.printTemplate;if(i.is11xService){const t={type:"kml"};return e.write(t,{origin:"web-map"}),delete t.layerType,t.url=o(e.url),t}const a=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,i)=>{const r={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?r.imageData=t.href.substr(22):r.url=t.href,a.push(r)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],l={id:e.id,...await K(null,s,r,i)};return a.push(l),a}function X(e,{view:t},i){let r;const a={id:e.id,subLayerIds:[]};let n=[];const s=t.scale,o=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,r=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&r))if(e.sublayers)e.sublayers.forEach(o);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{drawingInfo:t.drawingInfo,definitionExpression:t.definitionExpression,source:t.source}};n.unshift(i),a.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(o),n.length&&(n=n.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),r={layerType:(l=e.write()).layerType,customParameters:l.customParameters},r.layers=n,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:a.subLayerIds,le(r,e),e.legendEnabled&&i.legendLayers.push(a)),r}async function Y({layerView:e,printTemplate:t},i){const r=[],a=e.layer;if(null!=a.featureCollections)for(const n of a.featureCollections){const e=await K(n,n.source,t,i);e&&r.push(...e.featureCollection.layers)}else if(null!=a.sublayers)for(const n of a.sublayers){const e=await K(null,n.graphics,t,i);e&&r.push(...e.featureCollection.layers)}return{featureCollection:{layers:r}}}function Z(){return{type:"OpenStreetMap"}}async function ee(e,{printTemplate:t,view:i},r){const n={type:"image"},s={format:"png",ignoreBackground:!0,layers:[e]};0!==i.rotation&&(s.rotation=0);const o=r.ssExtent||i.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&(s.area={x:0,y:0,width:i.width,height:i.height},u||(s.area.width-=1),y||(s.area.height-=1),!r.ssExtent)){const e=i.toMap(a(s.area.width,s.area.height));o.ymin=e.y,o.xmax=e.x,r.ssExtent=o}n.extent=o.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(s);return n.imageData=l(p.dataUrl)?.data,n}async function te(e,{layerView:t,printTemplate:i},r){e.legendEnabled&&r.legendLayers.push({id:e.id});return K(e,await ye(t),i,r)}async function ie(e){const t=[],i=[];for(const a of e.map.allTables)"feature"!==a.type||a.loaded||i.push(a.load());i.length&&await Promise.allSettled(i);for(const a of e.map.allTables)if("feature"===a.type&&a.loaded&&a.isTable&&"feature-layer"===a.source?.type){const e={id:(r=a.write()).id,title:r.title,customParameters:r.customParameters,layerDefinition:{definitionExpression:r.layerDefinition?.definitionExpression},url:r.url};le(e,a),t.push(e)}var r;return t.length?t:void 0}function re(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(r=e.write()).layerType,customParameters:r.customParameters};var r;return le(i,e),i}async function ae(e,t,i){if(i.is11xService&&e.serviceUrl&&e.styleUrl){const t=d(e.styleUrl,e.apiKey),r=d(e.serviceUrl,e.apiKey);if(!t&&!r||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=o(e.styleUrl),i.token=t,r!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:r}]),i}}return ee(e,t,i)}function ne(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}function se(e,t){let i;const r=[],a=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(a):e.name&&r.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(a),r.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:r}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:r,url:o(e.url),version:e.version}),i}function oe(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function le(e,t){t.url&&(e.url=o(e.url||t.url),e.token=d(e.url,t.apiKey))}async function ce(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const r=1024;i.canvas.width=r,i.canvas.height=r;const a=i.canvas.getContext("2d");let o,l;if(e.path){const t=new Path2D(e.path);t.closePath(),a.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",a.fill(t);const i=L(a);if(!i)return null;a.clearRect(0,0,r,r);const s=n(e.size)/Math.max(i.width,i.height);a.scale(s,s);const c=r/s,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(a.translate(u,y),Array.isArray(e.color)&&a.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const r=e.outline;a.lineWidth=n(r.width)/s,a.lineJoin="round",a.strokeStyle=`rgba(${r.color[0]},${r.color[1]},${r.color[2]},${r.color[3]/255})`,a.stroke(t),i.width+=a.lineWidth,i.height+=a.lineWidth}i.width*=s,i.height*=s;const p=a.getImageData(r/2-i.width/2,r/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));o=p.width,l=p.height,a.canvas.width=o,a.canvas.height=l,a.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,r=(await t(i,{responseType:"image"})).data;o=n(e.width),l=n(e.height),a.canvas.width=o,a.canvas.height=l,a.drawImage(r,0,0,a.canvas.width,a.canvas.height)}return{type:"esriPMS",imageData:a.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:s(l),width:s(o),xoffset:e.xoffset,yoffset:e.yoffset}}async function ue(e,t){const i=e.type;if("simple"===i&&fe(e.symbol))e.symbol=await ce(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){fe(e.defaultSymbol)&&(e.defaultSymbol=await ce(e.defaultSymbol,t));const r=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(r)for(const e of r)fe(e.symbol)&&(e.symbol=await ce(e.symbol,t))}}async function ye(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function pe(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function fe(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{U as execute,C as getGpPrintParams,k as getGpServerUrl,j as getMode,J as printCacheMap};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20240304",a="38b01779c6876d655f0c16d5aad92a1c2f6c7077";export{c as buildDate,a as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import{SymbolFader as
|
|
5
|
+
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import t from"../../../../layers/support/TileInfo.js";import{SymbolFader as s}from"./decluttering/SymbolFader.js";import{Visibility as r,StyleLayerType as i}from"./style/StyleDefinition.js";import{WGLDrawPhase as l}from"../webgl/enums.js";import{RenderableTile as o}from"../webgl/RenderableTile.js";import n from"../webgl/TileContainer.js";import a from"../../tiling/TileCoverage.js";import d from"../../tiling/TileKey.js";import{StencilOperation as h,CompareFunction as c,BlendFactor as u}from"../../../webgl/enums.js";const y=1e-6;function p(e,t){if(e){const s=e.getLayoutProperty("visibility");if(!s||s.getValue()!==r.NONE&&(void 0===e.minzoom||e.minzoom<t+y)&&(void 0===e.maxzoom||e.maxzoom>=t-y))return!0}return!1}class m extends n{constructor(e){super(e),this._backgroundTiles=[],this._computeDisplayInfoView(e)}destroy(){this.removeAllChildren(),this._spriteMosaic?.dispose(),this._spriteMosaic=null,this._glyphMosaic?.dispose(),this._glyphMosaic=null,null!=this._symbolFader&&(this._symbolFader.clear(),this._symbolFader=null),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,i){this._spriteMosaic=e,this._glyphMosaic=t,this._styleRepository=r,this._tileInfoView=i,this._computeDisplayInfoView(i),null==this._symbolFader&&(this._symbolFader=new s(this._styleRepository,this.children)),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,hasClipping:!!this._clippingInfos}}doRender(e){!this.visible||e.drawPhase!==l.MAP&&e.drawPhase!==l.DEBUG||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;t!==l.DEBUG?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,state:s}=e,r=this._styleRepository;if(!r)return;const i=r.layers,o=this._displayInfo.scaleToZoom(s.scale);r.backgroundBucketIds.length>0&&(e.renderPass="background",this._renderBackgroundLayers(e,r.backgroundBucketIds,o)),super.renderChildren(e),e.drawPhase===l.MAP&&this._fade(o,s);const n=this.children.filter((e=>e.visible&&e.hasData()));if(!n||0===n.length)return t.bindVAO(),t.setStencilTestEnabled(!0),void t.setBlendingEnabled(!0);for(const l of n)l.triangleCount=0;t.setStencilWriteMask(0),t.setColorMask(!0,!0,!0,!0),t.setStencilOp(h.KEEP,h.KEEP,h.REPLACE),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!1),t.setDepthTestEnabled(!0),t.setDepthWriteEnabled(!0),t.setDepthFunction(c.LEQUAL),t.setClearDepth(1),t.clear(t.gl.DEPTH_BUFFER_BIT),e.renderPass="opaque";for(let l=i.length-1;l>=0;l--)this._renderStyleLayer(i[l],e,n);t.setDepthWriteEnabled(!1),t.setBlendingEnabled(!0),t.setBlendFunctionSeparate(u.ONE,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let l=0;l<i.length;l++)this._renderStyleLayer(i[l],e,n);t.bindVAO(),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!0);for(const l of n)l.debugInfo.display.triangleCount=l.triangleCount}_fade(e,t){null!=this._symbolFader&&(this._symbolFader.update(e,t)||this.requestRender())}_renderStyleLayer(e,t,s){const{displayLevel:l,painter:o,renderPass:n}=t;if(void 0===e)return;const a=e.getLayoutProperty("visibility");if(a&&a.getValue()===r.NONE)return;let d;switch(e.type){case i.BACKGROUND:return;case i.FILL:if("opaque"!==n&&"translucent"!==t.renderPass)return;d="vtlFill";break;case i.LINE:if("translucent"!==n)return;d="vtlLine";break;case i.CIRCLE:if("translucent"!==n)return;d="vtlCircle";break;case i.SYMBOL:if("translucent"!==n)return;d="vtlSymbol"}if(s=e.type===i.SYMBOL?s.filter((e=>e.decluttered)):s.filter((e=>e.neededForCoverage)),"vtlSymbol"!==d&&(0===s.length||void 0!==e.minzoom&&e.minzoom>=l+y||void 0!==e.maxzoom&&e.maxzoom<l-y))return;const h=e.uid;t.styleLayerUID=h,t.styleLayer=e;for(const r of s)if(r.layerData.has(h)){o.renderObjects(t,s,d);break}}_renderBackgroundLayers(t,s,r){const{context:l,painter:n,state:u}=t,y=this._styleRepository;let m=!1;for(const e of s){if(y.getLayerById(e).type===i.BACKGROUND&&p(y.getLayerById(e),r)){m=!0;break}}if(!m)return;const f=this._tileInfoView,g=f.getTileCoverage(t.state,0,!0,"smallest"),{spans:_,lodInfo:b}=g,{level:E}=b,C=e(),F=[];if(this._renderPasses){const e=this._renderPasses[0];null!=this._clippingInfos&&(e.brushes[0].prepareState(t),e.brushes[0].drawMany(t,this._clippingInfos))}const L=this._backgroundTiles;let R,v=0;for(const{row:i,colFrom:a,colTo:h}of _)for(let t=a;t<=h;t++){if(v<L.length)R=L[v],R.key.set(E,i,b.normalizeCol(t),b.getWorldForColumn(t)),f.getTileBounds(C,R.key,!1),R.x=C[0],R.y=C[3],R.resolution=f.getTileResolution(E);else{const s=new d(E,i,b.normalizeCol(t),b.getWorldForColumn(t)),r=f.getTileBounds(e(),s),l=f.getTileResolution(E);R=new o(s,l,r[0],r[3],512,512,4096,4096),L.push(R)}R.setTransform(u),F.push(R),v++}l.setStencilWriteMask(0),l.setColorMask(!0,!0,!0,!0),l.setStencilOp(h.KEEP,h.KEEP,h.REPLACE),l.setStencilFunction(c.EQUAL,0,255),l.setStencilTestEnabled(!0);for(const e of s){const s=y.getLayerById(e);s.type===i.BACKGROUND&&p(s,r)&&(t.styleLayerUID=s.uid,t.styleLayer=s,n.renderObjects(t,F,"vtlBackground"))}a.pool.release(g)}_computeDisplayInfoView(e){let s=e.tileInfo.lods[0].scale;const r=Math.max(25,e.tileInfo.lods.length),i=[];for(let t=0;t<=r;t++)i.push(s),s/=2;this._displayInfo=t.create({scales:i,size:512,spatialReference:e.spatialReference,numLODs:r})}}export{m as VectorTileContainer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{AFeatureTile as s}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as i,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as r,RESHUFFLING_EXEMPT_DRAW_CALLS as o,RESHUFFLING_TARGET_DRAW_EFFICIENCY as
|
|
5
|
+
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{AFeatureTile as s}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as i,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as r,RESHUFFLING_EXEMPT_DRAW_CALLS as o,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as n}from"./definitions.js";import h from"./DisplayEntity.js";import{FeatureBatchingStrategy as a}from"./enums.js";import{DisplayList as f}from"./FeatureDisplayList.js";import{ReshufflePlan as l}from"./ReshufflePlan.js";import{LabelMetric as u}from"./collisions/LabelMetric.js";import{MappedMesh as m}from"./cpuMapped/MappedMesh.js";import{debugMeshDataInfo as p}from"./mesh/meshDebugUtils.js";import _ from"./util/Reader.js";import{deserializeList as c}from"./util/serializationUtils.js";const y=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");let g=0;class b extends s{constructor(e,s,i,r,o=!1){super(e,s,i,r),this._meshes=new Map,this._entities=[],this._invalidated=!1,this._nextUploadAllowed=!1,this.tileAge=g++,this._metrics=[],this._entityIds=new Set,this._entityIdsFromBuffer=new Set,this._attributeEpoch=0,this._encounteredEnd=!1,this.visible=!0,this.transforms.labelMat2d=t(),this.enableDeferredUploads=o}destroy(){super.destroy(),this.clear()}clear(){for(const e of this._meshes.values())e.destroy();this._meshes.clear(),this._entities=[],this._metrics=[],this._displayList=null,this._invalidated=!0,this._entityIds.clear(),this._nextUploadAllowed=!0}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}tryReady(e){const t=this._invalidated&&!this._uploadAllowed;return!(this._isReady||t||!this._encounteredEnd||!(e>=this._attributeEpoch))&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.ready [epoch=${e}]`),this.ready(),this.requestRender(),!0)}get labelMetrics(){return this._metrics}get hasData(){return!!this._meshes.size}get needsUpload(){return this._invalidated}get _uploadAllowed(){return!this.enableDeferredUploads||this._nextUploadAllowed}upload(){this._nextUploadAllowed=!0}getDisplayList(e,t,s=a.BATCHING){if(this._uploadAllowed&&this._invalidated){this._entities.sort(((e,t)=>{const s=t.sortKey,i=e.sortKey;return i===s?e.id-t.id:i-s})),s===a.BATCHING&&this.reshuffle(!0),this._displayList=f.fromDisplayEntities(this._entities,this,t,s);for(const e of this._meshes.values())e.upload();this.debugInfo.display.length=this._displayList.length,this.debugInfo.display.minOrderedLength=this._displayList.minOrderedLength,this.debugInfo.display.minUnorderedLength=this._displayList.minUnorderedLength,this.requestRender(),this._invalidated=!1,this._nextUploadAllowed=!1}return this._displayList}getMesh(e){if(!this._meshes.has(e))throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return this._meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this._entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}onMessage(e){switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}if(this._aggregateMemoryStats(),this.requestRender(),e.end){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end [epoch=${e.attributeEpoch}]`),!e.attributeEpoch)throw new Error("InternalError: Attribute epoch not defined.");this._attributeEpoch=e.attributeEpoch,this._encounteredEnd=!0}}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:p(e?.append)}),e.clear&&this.clear(),!e.append)return;const t=c(new _(e.append.entities),h);this._insert(t,e.append.data,!1)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:p(e.modify),remove:e.remove});const t=c(new _(e.modify.entities),h),s=t.map((e=>e.id)),i=e.isPixelBuffer??!1,r=[...e.remove,...s];i?this._removeByIdsFromBuffer(r):this._removeByIds(r),this._insert(t,e.modify.data,i)}reshuffle(e=!1){if(this.destroyed)return;const t=new Map;for(const s of this._entities)for(const i of s.records){const s=this._meshes.get(i.instanceId);let r=t.get(s);r||(r=new l(e),t.set(s,r)),r.copyRecord(i)}for(const[s,i]of t)s.reshuffle(i);this._invalidated=!0,this._aggregateMemoryStats(),has("esri-2d-update-debug")&&y().info(`Tile ${this.key.id} was reshuffled.`)}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*n,o=i*n;for(const d of e._entities){let s=null;for(const i of d.records)if(i.overlaps&t){const t=this._ensureMesh(i.instanceId),n=e.getMesh(i.instanceId),a=t.copyRecordFrom(n,i,r,o);s||(s=new h(d.id,d.sortKey),this._entityIdsFromBuffer.add(d.id),this._entities.push(s)),s.records.push(a)}}this._invalidated=!0}_ensureMesh(e){return this._meshes.has(e)||this._meshes.set(e,new m(this._stage.bufferPool)),this._meshes.get(e)}_insert(e,t,s){if(!e.length)return;this._removeDuplicatedBufferedEntites(e);const i=this._insertVertexData(t);for(const r of e){for(const e of r.records)e.updateBaseOffsets(i.get(e.instanceId));s?this._tryInsertBufferedEntity(r):this._insertEntity(r)}this._invalidated=!0}_insertVertexData(e){const t=new Map;for(const s of e){const{instanceId:e}=s,i=this._ensureMesh(e).append(s);if(s.metrics){const e=c(new _(s.metrics),u)??[];this._metrics.push(...e)}t.set(e,i)}return t}_insertEntity(e){has("esri-2d-update-debug")&&this._entityIds.has(e.id)&&console.error(`Tile ${this.key.id} insertEnitty: Already have entityId ${e.id}`),this._entityIds.add(e.id),this._entities.push(e)}_tryInsertBufferedEntity(e){this._entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this._entityIdsFromBuffer.add(e.id),this._entities.push(e))}_removeDuplicatedBufferedEntites(e){if(!this._entityIdsFromBuffer.size)return;const t=[];for(const s of e)this._entityIdsFromBuffer.has(s.id)&&t.push(s.id);this._removeByIds(t)}_removeByIdsFromBuffer(e){this._removeByIds(e.filter((e=>this._entityIdsFromBuffer.has(e))))}_removeByIds(e){if(0===e.length)return;const t=new Set(e),s=[];for(const i of this._entities)t.has(i.id)?this._remove(i):s.push(i);this._entities=s,this._invalidated=!0}_remove(e){this._removeRecordsFromMesh(e.records),this._entityIds.delete(e.id),this._entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:o}=t;this._meshes.get(e)?.remove(s,i,r,o)}}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const[e,t]of this._meshes)this.debugInfo.memory.bytesUsed+=t.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=t.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:n,length:h}=this.debugInfo.display;return t>i&&s<r||h>o&&n/h<d}}export{b as FeatureTile};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class t{constructor(t){this._indexOnly=t,this.vertex={count:0,operations:[]},this.index={count:0,operations:[]}}copyRecord(t){let e=0;this._indexOnly||(e=this.vertex.count-t.vertexStart,this.vertex.operations.push({srcFrom:t.vertexStart,dstFrom:this.vertex.count,count:t.vertexCount,mutate:0}),t.vertexStart=this.vertex.count,this.vertex.count+=t.vertexCount),this.index.operations.push({srcFrom:t.indexStart,dstFrom:this.index.count,count:t.indexCount,mutate:e}),t.indexStart=this.index.count,this.index.count+=t.indexCount}}export{t as ReshufflePlan};
|
|
5
|
+
class t{constructor(t){this._indexOnly=t,this.vertex={count:0,operations:[]},this.index={count:0,operations:[]}}copyRecord(t){let e=0;this._indexOnly||(e=this.vertex.count-t.vertexStart,this.vertex.operations.push({srcFrom:t.vertexStart,dstFrom:this.vertex.count,count:t.vertexCount,mutate:0}),t.vertexStart=this.vertex.count,this.vertex.count+=t.vertexCount);let n=!1;if(this._indexOnly&&this.index.operations.length>=1){const e=this.index.operations[this.index.operations.length-1];e.srcFrom+e.count===t.indexStart&&(e.count+=t.indexCount,n=!0)}n||this.index.operations.push({srcFrom:t.indexStart,dstFrom:this.index.count,count:t.indexCount,mutate:e}),t.indexStart=this.index.count,this.index.count+=t.indexCount}}export{t as ReshufflePlan};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{PooledUint32Array as i}from"../PooledUint32Array.js";import{FreeList as e}from"./FreeList.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{Usage as s}from"../../../../webgl/enums.js";const n=1.25,h=32767,a=h<<16|h;class d{constructor(t,e,r,s){this._pool=s;const n=i.create(e*r*Uint32Array.BYTES_PER_ELEMENT,this._pool);this.size=e,this.strideInt=r,this.bufferType=t,this.dirty={start:1/0,end:0},this.memoryStats={bytesUsed:0,bytesReserved:e*r*Uint32Array.BYTES_PER_ELEMENT},this._gpu=null,this._cpu=n,this.clear()}get elementSize(){return this._cpu.length/this.strideInt}get intSize(){return this.fillPointer*this.strideInt}get byteSize(){return this.intSize*Uint32Array.BYTES_PER_ELEMENT}get invalidated(){return this.bufferSize>0&&!this._gpu}get invalidatedComputeBuffer(){return this.bufferSize>0&&!this._gpuComputeTriangles}invalidate(){this._invalidateTriangleBuffer(),this._gpu?.dispose(),this._gpu=null}_invalidateTriangleBuffer(){this._gpuComputeTriangles?.dispose(),this._gpuComputeTriangles=null}destroy(){this._gpu?.dispose(),this._gpuComputeTriangles?.dispose(),this._cpu?.destroy()}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new e({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){this.invalidate();const i=this._cpu.length/this.strideInt,e=Math.round((i+t)*n),r=e*this.strideInt;this._cpu.expand(r*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(i,e-i),this.memoryStats.bytesReserved+=(e-i)*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}}set(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t+1,this.dirty.end))}getGPUBuffer(t,i=!1){if(!this.bufferSize)return null;if(i){if("index"!==this.bufferType)throw new Error("Tired to get triangle buffer, but target is not an index buffer");return null==this._gpuComputeTriangles&&(this._gpuComputeTriangles=this._createComputeBuffer(t)),this._gpuComputeTriangles}return null==this._gpu&&(this._gpu=this._createBuffer(t)),this._gpu}getView(t,i){return this._cpu.getUint32View(t,i/Uint32Array.BYTES_PER_ELEMENT)}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(i,e,r,s){const n=r*this.strideInt;if(!n)return 0;const h=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,a=new Uint32Array(i,h,n),d=this.freeList.firstFit(r);t(d,"First fit region must be defined");const u=d*this.strideInt,o=n;if(this._cpu.array.set(a,u),0!==s)for(let t=0;t<a.length;t++)this._cpu.array[t+u]+=s;return this.dirty.start=Math.min(this.dirty.start,u),this.dirty.end=Math.max(this.dirty.end,u+o),this.fillPointer=Math.max(this.fillPointer,u+o),this.memoryStats.bytesUsed+=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d}copyFrom(i,e,r,s,n){const h=r*this.strideInt;if(!h)return 0;const a=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d=i._cpu.getUint32View(a,h),u=this.freeList.firstFit(r);t(u,"First fit region must be defined");const o=u*this.strideInt,f=h;if(this._cpu.array.set(d,o),0!==s)for(let t=0;t<h;t++)this._cpu.array[o+t*this.strideInt+n]+=s;return this.dirty.start=Math.min(this.dirty.start,o),this.dirty.end=Math.max(this.dirty.end,o+f),this.fillPointer=Math.max(this.fillPointer,o+f),this.memoryStats.bytesUsed+=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,u}free(t,i,e){const r=t*this.strideInt,s=(t+i)*this.strideInt;if(!0===e)for(let n=t;n!==t+i;n++)this._cpu.array[n*this.strideInt]=a;this.dirty.start=Math.min(this.dirty.start,r),this.dirty.end=Math.max(this.dirty.end,s),this.freeList.free(t,i),this.memoryStats.bytesUsed-=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}upload(){if(this.dirty.end){if(this._invalidateTriangleBuffer(),null==this._gpu)return this.dirty.start=1/0,void(this.dirty.end=0);this._gpu.setSubData(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}reshuffle(t,e){if(0===e.length)return;const r=t*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,s=this._cpu,
|
|
5
|
+
import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{PooledUint32Array as i}from"../PooledUint32Array.js";import{FreeList as e}from"./FreeList.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{Usage as s}from"../../../../webgl/enums.js";const n=1.25,h=32767,a=h<<16|h;class d{constructor(t,e,r,s){this._pool=s;const n=i.create(e*r*Uint32Array.BYTES_PER_ELEMENT,this._pool);this.size=e,this.strideInt=r,this.bufferType=t,this.dirty={start:1/0,end:0},this.memoryStats={bytesUsed:0,bytesReserved:e*r*Uint32Array.BYTES_PER_ELEMENT},this._gpu=null,this._cpu=n,this.clear()}get elementSize(){return this._cpu.length/this.strideInt}get intSize(){return this.fillPointer*this.strideInt}get byteSize(){return this.intSize*Uint32Array.BYTES_PER_ELEMENT}get invalidated(){return this.bufferSize>0&&!this._gpu}get invalidatedComputeBuffer(){return this.bufferSize>0&&!this._gpuComputeTriangles}invalidate(){this._invalidateTriangleBuffer(),this._gpu?.dispose(),this._gpu=null}_invalidateTriangleBuffer(){this._gpuComputeTriangles?.dispose(),this._gpuComputeTriangles=null}destroy(){this._gpu?.dispose(),this._gpuComputeTriangles?.dispose(),this._cpu?.destroy()}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new e({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){this.invalidate();const i=this._cpu.length/this.strideInt,e=Math.round((i+t)*n),r=e*this.strideInt;this._cpu.expand(r*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(i,e-i),this.memoryStats.bytesReserved+=(e-i)*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}}set(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t+1,this.dirty.end))}getGPUBuffer(t,i=!1){if(!this.bufferSize)return null;if(i){if("index"!==this.bufferType)throw new Error("Tired to get triangle buffer, but target is not an index buffer");return null==this._gpuComputeTriangles&&(this._gpuComputeTriangles=this._createComputeBuffer(t)),this._gpuComputeTriangles}return null==this._gpu&&(this._gpu=this._createBuffer(t)),this._gpu}getView(t,i){return this._cpu.getUint32View(t,i/Uint32Array.BYTES_PER_ELEMENT)}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(i,e,r,s){const n=r*this.strideInt;if(!n)return 0;const h=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,a=new Uint32Array(i,h,n),d=this.freeList.firstFit(r);t(d,"First fit region must be defined");const u=d*this.strideInt,o=n;if(this._cpu.array.set(a,u),0!==s)for(let t=0;t<a.length;t++)this._cpu.array[t+u]+=s;return this.dirty.start=Math.min(this.dirty.start,u),this.dirty.end=Math.max(this.dirty.end,u+o),this.fillPointer=Math.max(this.fillPointer,u+o),this.memoryStats.bytesUsed+=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d}copyFrom(i,e,r,s,n){const h=r*this.strideInt;if(!h)return 0;const a=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d=i._cpu.getUint32View(a,h),u=this.freeList.firstFit(r);t(u,"First fit region must be defined");const o=u*this.strideInt,f=h;if(this._cpu.array.set(d,o),0!==s)for(let t=0;t<h;t++)this._cpu.array[o+t*this.strideInt+n]+=s;return this.dirty.start=Math.min(this.dirty.start,o),this.dirty.end=Math.max(this.dirty.end,o+f),this.fillPointer=Math.max(this.fillPointer,o+f),this.memoryStats.bytesUsed+=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,u}free(t,i,e){const r=t*this.strideInt,s=(t+i)*this.strideInt;if(!0===e)for(let n=t;n!==t+i;n++)this._cpu.array[n*this.strideInt]=a;this.dirty.start=Math.min(this.dirty.start,r),this.dirty.end=Math.max(this.dirty.end,s),this.freeList.free(t,i),this.memoryStats.bytesUsed-=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}upload(){if(this.dirty.end){if(this._invalidateTriangleBuffer(),null==this._gpu)return this.dirty.start=1/0,void(this.dirty.end=0);this._gpu.setSubData(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}reshuffle(t,e){if(0===e.length)return;const r=this.byteSize,s=t*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,n=r>s,h=this._cpu,a=i.create(s,this._pool);n||a.array.set(this._cpu.getUint32View(0,this.intSize));for(const i of e)if(n||i.srcFrom!==i.dstFrom||0!==i.mutate){this.dirty.start=Math.min(this.dirty.start,i.dstFrom*this.strideInt),this.dirty.end=Math.max(this.dirty.end,(i.dstFrom+i.count)*this.strideInt);for(let t=0;t<i.count;t++){const e=(i.dstFrom+t)*this.strideInt,r=(i.srcFrom+t)*this.strideInt;for(let t=0;t<this.strideInt;t++)a.array[e+t]=h.array[r+t]+i.mutate}}this._cpu.destroy(),this._cpu=a,n&&this.invalidate(),this.freeList.clear(),this.memoryStats.bytesUsed=this.memoryStats.bytesReserved=s}_createBuffer(t){const i=s.DYNAMIC_DRAW;return"index"===this.bufferType?r.createIndex(t,i,this._cpu.array):r.createVertex(t,i,this._cpu.array)}_createComputeBuffer(t){const i=s.DYNAMIC_DRAW,e=new Uint32Array(this.fillPointer/3);for(let r=0;r<this.fillPointer;r+=3)e[r/3]=this._cpu.array[r];return r.createIndex(t,i,e)}}export{d as MappedBuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{i1616to32 as t}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as
|
|
5
|
+
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{i1616to32 as t}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as i}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{vertexLayoutHash as s}from"../shaderGraph/techniques/mesh/utils.js";import{PrimitiveType as o}from"../../../../webgl/enums.js";import{VertexArrayObject as f}from"../../../../webgl/VertexArrayObject.js";const n=0,u=1,a=1e3;class h{constructor(e){this._bufferPool=e,this._computeLayouts=new Map,this._vaos=new Map,this._invalidated=!1}destroy(){for(const[e,t]of this._vaos)t?.disposeVAOOnly();this._indexBuffer=e(this._indexBuffer),this._vertexBuffer=e(this._vertexBuffer)}_getVertexAttributeLayout(e){if(!e)return null;const t=[];for(const r of e.attributes)t.push({name:r.name,type:r.type,count:r.count,divisor:0,normalized:r.normalized??!1,offset:r.offset,stride:e.stride});return{geometry:t}}getLayout(e){if(!this._layout)return null;const{locationInfo:t,useComputeBuffer:r,computeAttributeMap:i}=e,o=this._layout.attributes.filter((e=>t.locations.has(e.name)));if(!r)return{attributes:o,hash:this._layout.hash,stride:this._layout.stride};const f=Object.values(i).flat().join("-");if(this._computeLayouts.has(f))return this._computeLayouts.get(f);const n=this._layout.stride;for(const{name:s,count:a,type:h,normalized:c,offset:d,packPrecisionFactor:l}of this._layout.attributes){const e=i[s];null!=e&&2===e.length&&(o.push({name:e[0],count:a,type:h,normalized:c,offset:d+n,packPrecisionFactor:l}),o.push({name:e[1],count:a,type:h,normalized:c,offset:d+2*n,packPrecisionFactor:l}))}const u={attributes:o,stride:n,hash:s(o)};return this._computeLayouts.set(f,u),u}getDrawArgs(e,t,r,i){return i?{primitive:o.POINTS,count:t/3,offset:r/3}:{primitive:e,count:t,offset:r}}getDebugVertexInfo(e){if(!this._vertexBuffer)return null;const t=this.getLayout(e);if(null==t)return null;const r=t.stride,s=this._vertexBuffer.getView(0,this._vertexBuffer.byteSize),o=new DataView(s.slice().buffer);let f=s.byteLength/r;e.useComputeBuffer&&(f=this._indexBuffer.fillPointer/3);const n=this._indexBuffer.getView(0,this._indexBuffer.byteSize);let u=0;const a=[];for(let h=0;h<f;h++){if(e.useComputeBuffer){u=n[3*h]*r}const s={};for(const e of t.attributes){let t=`${e.offset} ${e.name}`,r=i(o,e,u);if(e.packPrecisionFactor)if(t+=` (precision: ${e.packPrecisionFactor})`,"number"==typeof r)r/=e.packPrecisionFactor;else for(let i=0;i<r.length;i++)r[i]/=e.packPrecisionFactor;s[t]=r}u+=r,a.push(s)}return{vertices:a,layout:t}}_ensure(e,t,i){if(this._vertexBuffer&&this._indexBuffer){if(this._layout?.hash!==e.hash)throw new Error("InternalError: Expected vertex layouts to match");this._indexBuffer.ensure(Math.max(t,1e3)),this._vertexBuffer.ensure(Math.max(i,1e3))}else{const s=e.stride/Uint32Array.BYTES_PER_ELEMENT;if(this._layout=e,this._position=e.attributes.find((e=>"pos"===e.name||"position"===e.name)),!this._position)throw new Error("InternalError: Unable to find position attribute");this._indexBuffer=new r("index",Math.max(t,a),1,this._bufferPool),this._vertexBuffer=new r("vertex",Math.max(i,a),s,this._bufferPool)}}append(e){const t=e.layout.stride,r=e.indices.byteLength/Uint32Array.BYTES_PER_ELEMENT,i=e.vertices.byteLength/t;this._ensure(e.layout,r,i);const{vertices:s,indices:o}=e,f=this._vertexBuffer.insert(s,0,s.byteLength/t,0);return{vertexFrom:f,indexFrom:this._indexBuffer.insert(o,0,o.byteLength/4,f)}}copyRecordFrom(e,r,i,s){const{indexStart:o,indexCount:f,vertexStart:n,vertexCount:u}=r;this._ensure(e._layout,f,u);const a=e._position,h=i*(a.packPrecisionFactor??1),c=s*(a.packPrecisionFactor??1),d=a.offset,l=t(h,c),_=this._vertexBuffer.copyFrom(e._vertexBuffer,n,u,l,d),m=this._indexBuffer.copyFrom(e._indexBuffer,o,f,_-n,0),x=r.clone();return x.vertexStart=_,x.indexStart=m,x.overlaps=0,x}remove(e,t,r,i){this._indexBuffer.free(e,t),this._vertexBuffer.free(r,i)}upload(){this._invalidated=!0}getVAO(e,t,r){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;const i=r?.useComputeBuffer?u:n;let s=this._vaos.get(i);if(this._invalidated||r?.useComputeBuffer){(this._vertexBuffer.invalidated||this._indexBuffer.invalidated||r?.useComputeBuffer&&this._indexBuffer.invalidatedComputeBuffer)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),s?.disposeVAOOnly(),s=null),this._vertexBuffer.upload(),this._indexBuffer.upload();const o=this._indexBuffer.getGPUBuffer(e,1===i),n=this._vertexBuffer.getGPUBuffer(e);s||(s=new f(e,t.locations,this._getVertexAttributeLayout(this.getLayout(r)),{geometry:n},o),this._vaos.set(i,s)),this._invalidated=!1}return s}get memoryStats(){return{bytesUsed:this._vertexBuffer.memoryStats.bytesUsed+this._indexBuffer.memoryStats.bytesUsed,bytesReserved:this._vertexBuffer.memoryStats.bytesReserved+this._indexBuffer.memoryStats.bytesReserved,vertex:this._vertexBuffer.memoryStats,index:this._indexBuffer.memoryStats}}reshuffle(e){this._vertexBuffer&&this._vertexBuffer.reshuffle(e.vertex.count,e.vertex.operations),this._indexBuffer&&this._indexBuffer.reshuffle(e.index.count,e.index.operations)}}export{h as MappedMesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as n,hasDiff as o}from"../../../core/accessorSupport/diffUtils.js";import h from"../../../geometry/Point.js";import{create as u}from"../../../geometry/support/aaBoundingRect.js";import{equals as c}from"../../../geometry/support/spatialReferenceUtils.js";import{StyleUpdateType as y}from"../engine/vectorTiles/enums.js";import{TileHandler as p}from"../engine/vectorTiles/TileHandler.js";import{TileManager as d}from"../engine/vectorTiles/TileManager.js";import{VectorTile as _}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as f}from"../engine/vectorTiles/VectorTileContainer.js";import g from"../engine/vectorTiles/VectorTileFeatureIndex.js";import{StyleLayerType as m}from"../engine/vectorTiles/style/StyleDefinition.js";import T from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import C from"../tiling/TileInfoViewPOT.js";import R from"../tiling/TileQueue.js";import w from"../../layers/LayerView.js";const H=2,I=8,D=512;let S=class extends(v(w)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1}get fading(){return this._vectorTileContainer?.fading??!1}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=null;const a=this._vectorTileContainer?.symbolRepository;a&&(r=a.querySymbols(t,H,s.decluttererOffset,{}));const l=this.view.state,n=this._tileManager.getIntersectingTiles(t.x,t.y,H,l,r);if((!n||0===n.length)&&0===r?.length)return null;e=e.clone().normalize();const o=[],h=[];for(const u of n)o.push(this._queryTile(h,e,H,this.view.state.rotation,u,r?.filter((e=>e.tileKey.id===u.id))));return await Promise.all(o),h}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._start(),void(this._tileHandler.devicePixelRatio=e.pixelRatio)):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._parseQueue.resume(),this._fetchQueue.resume()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new T(e),this._tileInfoView=new C(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new f(this.view.featuresTilingScheme,this._tileInfoView),this._tileHandler=new p(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",(e=>{if(e.isDataDriven)this._styleChanges.push({type:y.PAINTER_CHANGED,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=i.type===m.SYMBOL;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}})),this.layer.on("layout-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=n(i.layout,e.layout);if(null!=s){if(o(s,"visibility")&&1===P(s))return t.setLayoutProperties(e.layer,e.layout),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:y.LAYOUT_CHANGED,data:e}),this.requestUpdate()}})),this.layer.on("style-layer-visibility-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(t.setStyleLayerVisibility(e.layer,e.visibility),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())})),this.layer.on("style-layer-change",(e=>{this._styleChanges.push({type:y.LAYER_CHANGED,data:e}),this.requestUpdate()})),this.layer.on("delete-style-layer",(e=>{this._styleChanges.push({type:y.LAYER_REMOVED,data:e}),this.requestUpdate()})),this.layer.on("load-style",(()=>this._loadStyle())),this.layer.on("spriteSource-change",(e=>{this._styleChanges.push({type:y.SPRITES_CHANGED,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case m.SYMBOL:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:y.LAYOUT_CHANGED,data:{layer:i.id,layout:i.layout}});break;case m.LINE:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:y.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case m.FILL:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:y.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()}))])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return c(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.addPromise(this._fetchQueue.push(t.key).then((e=>this._parseQueue.push({key:t.key,data:e}))).then((e=>{t.once("attach",(()=>this.requestUpdate())),t.setData(e),this.requestUpdate()})).catch((e=>{r(e)||i.getLogger(this).error(e)}))),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then((()=>{this._fetchQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15}),this._parseQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8}),this.requestUpdate(),this._isTileHandlerReady=!0}));this._tileHandler.spriteMosaic.then((e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView,this.view.featuresTilingScheme),this.requestUpdate()})),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach((e=>{if(e.type!==y.LAYER_REMOVED)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)}));const r=new Set;e.forEach((e=>{let i;switch(e.type){case y.PAINTER_CHANGED:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case y.LAYOUT_CHANGED:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case y.LAYER_REMOVED:return void t.deleteStyleLayer(e.data.layer);case y.LAYER_CHANGED:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case y.SPRITES_CHANGED:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}}));const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._fetchQueue.resume(),this._parseQueue.resume(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then((t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e}))).then((e=>i.setData(e))));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._styleRepository=new T(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new C(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView,this.view.featuresTilingScheme),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,this.requestUpdate()}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(u(),e),i=this._tileInfoView.getTileResolution(e.level);return new _(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),n=this._tileInfoView.getTileBounds(u(),r.key,!0),o=I*D*((t.x-n[0])/(n[2]-n[0])),h=I*D*(1-(t.y-n[1])/(n[3]-n[1])),c=await l.queryAttributes(o,h,i,s,a);for(const u of c)u.graphic.geometry=this._tileToMapPoint(u.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:u.graphic,mapPoint:t.clone()});e.sort(((e,t)=>t.graphic.origin.layerIndex-e.graphic.origin.layerIndex))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new h({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=g.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}};function P(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([a()],S.prototype,"_isTileHandlerReady",void 0),S=e([l("esri.views.2d.layers.VectorTileLayerView2D")],S);const A=S;export{A as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as n,hasDiff as o}from"../../../core/accessorSupport/diffUtils.js";import h from"../../../geometry/Point.js";import{create as y}from"../../../geometry/support/aaBoundingRect.js";import{equals as u}from"../../../geometry/support/spatialReferenceUtils.js";import{StyleUpdateType as c}from"../engine/vectorTiles/enums.js";import{TileHandler as p}from"../engine/vectorTiles/TileHandler.js";import{TileManager as d}from"../engine/vectorTiles/TileManager.js";import{VectorTile as _}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as f}from"../engine/vectorTiles/VectorTileContainer.js";import g from"../engine/vectorTiles/VectorTileFeatureIndex.js";import{StyleLayerType as m}from"../engine/vectorTiles/style/StyleDefinition.js";import T from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2DMixin as C}from"./LayerView2D.js";import v from"../tiling/TileInfoViewPOT.js";import R from"../tiling/TileQueue.js";import H from"../../layers/LayerView.js";const w=2,I=8,D=512;let S=class extends(C(H)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1}get fading(){return this._vectorTileContainer?.fading??!1}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=null;const a=this._vectorTileContainer?.symbolRepository;a&&(r=a.querySymbols(t,w,s.decluttererOffset,{}));const l=this.view.state,n=this._tileManager.getIntersectingTiles(t.x,t.y,w,l,r);if((!n||0===n.length)&&0===r?.length)return null;e=e.clone().normalize();const o=[],h=[];for(const y of n)o.push(this._queryTile(h,e,w,this.view.state.rotation,y,r?.filter((e=>e.tileKey.id===y.id))));return await Promise.all(o),h}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._start(),void(this._tileHandler.devicePixelRatio=e.pixelRatio)):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._parseQueue.resume(),this._fetchQueue.resume()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new T(e),this._tileInfoView=new v(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new f(this._tileInfoView),this._tileHandler=new p(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",(e=>{if(e.isDataDriven)this._styleChanges.push({type:c.PAINTER_CHANGED,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=i.type===m.SYMBOL;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}})),this.layer.on("layout-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=n(i.layout,e.layout);if(null!=s){if(o(s,"visibility")&&1===P(s))return t.setLayoutProperties(e.layer,e.layout),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:c.LAYOUT_CHANGED,data:e}),this.requestUpdate()}})),this.layer.on("style-layer-visibility-change",(e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(t.setStyleLayerVisibility(e.layer,e.visibility),i.type===m.SYMBOL&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())})),this.layer.on("style-layer-change",(e=>{this._styleChanges.push({type:c.LAYER_CHANGED,data:e}),this.requestUpdate()})),this.layer.on("delete-style-layer",(e=>{this._styleChanges.push({type:c.LAYER_REMOVED,data:e}),this.requestUpdate()})),this.layer.on("load-style",(()=>this._loadStyle())),this.layer.on("spriteSource-change",(e=>{this._styleChanges.push({type:c.SPRITES_CHANGED,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case m.SYMBOL:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:c.LAYOUT_CHANGED,data:{layer:i.id,layout:i.layout}});break;case m.LINE:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:c.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case m.FILL:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:c.PAINTER_CHANGED,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()}))])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return u(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.addPromise(this._fetchQueue.push(t.key).then((e=>this._parseQueue.push({key:t.key,data:e}))).then((e=>{t.once("attach",(()=>this.requestUpdate())),t.setData(e),this.requestUpdate()})).catch((e=>{r(e)||i.getLogger(this).error(e)}))),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then((()=>{this._fetchQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15}),this._parseQueue=new R({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8}),this.requestUpdate(),this._isTileHandlerReady=!0}));this._tileHandler.spriteMosaic.then((e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()})),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(l){i.getLogger(this).error("error applying vector-tiles style update",l.message),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set;e.forEach((e=>{if(e.type!==c.LAYER_REMOVED)return;const i=e.data,r=t.getLayerById(i.layer);r&&s.add(r.uid)}));const r=new Set;e.forEach((e=>{let i;switch(e.type){case c.PAINTER_CHANGED:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case c.LAYOUT_CHANGED:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case c.LAYER_REMOVED:return void t.deleteStyleLayer(e.data.layer);case c.LAYER_CHANGED:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case c.SPRITES_CHANGED:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&r.add(e.uid)}}));const a=this._vectorTileContainer.children;if(s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._fetchQueue.resume(),this._parseQueue.resume(),r.size>0){const e=Array.from(r),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then((t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e}))).then((e=>i.setData(e))));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._fetchQueue.pause(),this._parseQueue.pause(),this._fetchQueue.clear(),this._parseQueue.clear(),this._styleRepository=new T(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new v(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new d({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._fetchQueue.resume(),this._parseQueue.resume(),this._isTileHandlerReady=!0,this.requestUpdate()}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(y(),e),i=this._tileInfoView.getTileResolution(e.level);return new _(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),n=this._tileInfoView.getTileBounds(y(),r.key,!0),o=I*D*((t.x-n[0])/(n[2]-n[0])),h=I*D*(1-(t.y-n[1])/(n[3]-n[1])),u=await l.queryAttributes(o,h,i,s,a);for(const y of u)y.graphic.geometry=this._tileToMapPoint(y.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:y.graphic,mapPoint:t.clone()});e.sort(((e,t)=>t.graphic.origin.layerIndex-e.graphic.origin.layerIndex))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new h({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=g.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}};function P(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([a()],S.prototype,"_isTileHandlerReady",void 0),S=e([l("esri.views.2d.layers.VectorTileLayerView2D")],S);const A=S;export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import"../../../../core/Logger.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as i}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as r,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/InstanceStore.js";import{RenderState as h}from"./RenderState.js";import{renderHighlight as d}from"../support/util.js";class l{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class u extends i{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._layerView=e}renderChildren(e){if(this.attributeView.update(),this._renderState)for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this.requestRender())
|
|
5
|
+
import has from"../../../../core/has.js";import"../../../../core/Logger.js";import{throwIfAborted as e,createResolver as t}from"../../../../core/promiseUtils.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{AFeatureContainer as i}from"../../engine/AFeatureContainer.js";import{WGLDrawPhase as r,FeatureSelection as n,FeatureBatchingStrategy as a}from"../../engine/webgl/enums.js";import o from"../../engine/webgl/shaderGraph/techniques/InstanceStore.js";import{RenderState as h}from"./RenderState.js";import{renderHighlight as d}from"../support/util.js";class l{constructor(e,s){this.id=e,this.version=s,this._resolver=t(),this._done=!1}get done(){return this._done}get promise(){return this._resolver.promise}end(){this._resolver.resolve(),this._done=!0}destroy(){this._resolver.reject()}}class u extends i{constructor(e){super(e.view.featuresTilingScheme),this.updatingHandles=new s,this._hitTestsRequests=[],this._store=new o,this._visibleTiles=new Set,this._subscriptions=new Map,this._updateStatisticsRequests=[],this._lockStatisticUpdates=!1,this._layerView=e}renderChildren(e){if(this.attributeView.update(),this._renderState){const e=Array.from(this._renderState.tiles()).filter((e=>e.needsUpload));if(e.length){e[Math.floor(Math.random()*e.length)].upload(),e.length>=2&&this.requestRender()}for(const t of this._renderState.tiles())t.tryReady(this.attributeView.currentEpoch)&&(this._layerView.requestUpdate(),this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this.requestRender())}for(const t of this.children)t.setTransform(e.state);if(super.renderChildren(e),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}switch(e.drawPhase){case r.MAP:return this._renderMapPhase(e);case r.HIGHLIGHT:return this._renderHighlightPhase(e);case r.LABEL:return this._renderLabelPhase(e)}}subscriptions(){return this._subscriptions.values()}get _instanceStore(){return this._store}get instanceStore(){return this._store}get layerView(){return this._layerView}get hasLabels(){return this._layerView.labelingCollisionInfos.length>0}get hasHighlight(){return this._layerView.hasHighlight()}get _layer(){return this._layerView.layer}_getExclusivePostprocessingInstance({drawPhase:e}){if(null==this._instanceStore)return null;let t=0,s=null;for(const i of this._instanceStore.values())i.techniqueRef.drawPhase&e&&(t++,i.techniqueRef.postProcessingEnabled&&(s=i));return t>1?null:s}_getOverrideStencilRef({drawPhase:e}){if(null==this._instanceStore)return null;let t=null;for(const s of this._instanceStore.values()){if(!(s.techniqueRef.drawPhase&e))continue;const{overrideStencilRef:i}=s.techniqueRef;if(null==t)t=i;else if(t!==i){t=null;break}}return t}get children(){return this._renderState?Array.from(this._renderState.tiles()).filter((e=>this._visibleTiles.has(e.key.id))):[]}async updateAttributeView(e){this.requestRender(),await this.updatingHandles.addPromise(this.attributeView.requestUpdate(e)),this.hasLabels&&this._layerView.view.labelManager.requestUpdate()}updateSubscriptions(e){for(const{tileId:t,version:s}of e.subscribe)if(this._subscriptions.has(t))this._subscriptions.get(t).version=s;else{const e=new l(t,s);this._subscriptions.set(t,e),this.updatingHandles.addPromise(e.promise)}for(const t of e.unsubscribe){const e=this._subscriptions.get(t);e?.destroy(),this._subscriptions.delete(t),this.removeTile(t)}}isDone(e){return!!this._renderState&&this._renderState.isTileDone(e)}async updateRenderState(e){has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureContainer.updateRenderState`),this._renderStateNext=new h(this._stage,e,this._tileInfoView)}getDisplayStatistics(e,t){const s=this._statisticsByLevel.get(e);return s?s.get(t):null}updateStatistics(e,t){if(this._lockStatisticUpdates)return void this._updateStatisticsRequests.push({level:e,statistics:t});let s=this._statisticsByLevel.get(e);s||(s=new Map,this._statisticsByLevel.set(e,s));for(const i of t)s.set(i.fieldName,{minValue:i.minValue,maxValue:i.maxValue})}editStart(){this._renderState?.lockUploads(),this.attributeView.lockTextureUploads(),this._lockStatisticUpdates=!0}editEnd(){this._renderState?.unlockUploads(),this.attributeView.unlockTextureUploads(),this._lockStatisticUpdates=!1;for(const e of this._updateStatisticsRequests)this.updateStatistics(e.level,e.statistics);this._updateStatisticsRequests=[],this.requestRender()}swapRenderState(){if(this._renderStateNext&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._renderStateNext.version}] FeatureContainer.update.swapRenderState`),this._renderState?.destroy(),this._renderState=this._renderStateNext,this._renderStateNext=null),this._renderState)for(const e of this._renderState.tiles())e.upload();this.requestRender()}setVisibleTiles(e){this._visibleTiles=e}async onMessage(t,s){if(e(s),!this._subscriptions.has(t.id))return;const i=this._subscriptions.get(t.id);if(i.version!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${i.version}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}const r=this._renderStateNext??this._renderState;if(!r)throw new Error("InternalError: No renderState defined");if(r.version!==t.version&&console.error(`InternalError: Version mismatch. [renderState: ${r.version}, message: ${t.version}]`),r.updateTile(t),t.end){this._subscriptions.get(t.id).end()}this.requestRender(),this._layerView.view.labelManager.requestUpdate(),this._layerView.requestUpdate()}removeTile(e){(this._renderState||this._renderStateNext)&&(this._renderState&&this._renderState.removeTile(e),this._renderStateNext&&this._renderStateNext.removeTile(e))}hitTest(e){let s=this._hitTestsRequests.find((({x:t,y:s})=>t===e.x&&s===e.y));const i=t();return s?s.resolvers.push(i):(s={x:e.x,y:e.y,resolvers:[i]},this._hitTestsRequests.push(s)),this.requestRender(),i.promise}getSortKeys(e){const t=new Set(e),s=new Map;for(const i of this.children)if(i.getSortKeys(t).forEach(((e,t)=>s.set(t,e))),s.size===t.size)break;return s}get hasAnimation(){return this.hasLabels}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer.effectiveScaleRange,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}afterRender(e){super.afterRender(e),this._hitTestsRequests.length&&this.requestRender()}setStencilReference(e){const t=this._getOverrideStencilRef(e);if(null==t)super.setStencilReference(e);else for(const s of this.children)s.stencilRef=t(s)}_renderMapPhase(e){this._layerView.featureEffectView.hasEffects?(this._renderOutsideEffect(e),this._renderInsideEffect(e)):this._renderFeatures(e,n.All),this._hitTestsRequests.length>0&&this._renderHittest(e)}_renderHighlightPhase(e){this.hasHighlight&&d(e,!1,(e=>{this._renderFeatures(e,n.Highlight)}))}_renderLabelPhase(e){this._renderFeatures(e,n.All)}_renderInsideEffect(e){const t=e.painter.effects.insideEffect;t.bind(e),this._renderFeatures(e,n.InsideEffect),t.draw(e,this._layerView.featureEffectView.includedEffects),t.unbind()}_renderOutsideEffect(e){const t=e.painter.effects.outsideEffect;t.bind(e),this._renderFeatures(e,n.OutsideEffect),t.draw(e,this._layerView.featureEffectView.excludedEffects),t.unbind()}_renderHittest(e){const{context:t}=e,s=e.painter.effects.hittest,i=t.getBoundFramebufferObject(),r=t.getViewport(),a=e.passOptions;s.bind(e),e.passOptions=s.createOptions(e,this._hitTestsRequests),this._renderFeatures(e,n.All),s.draw(e),s.unbind(),t.bindFramebuffer(i),t.restoreViewport(r),e.passOptions=a}_renderFeatures(e,t){for(const i of this.children){if(!i.visible)continue;const s=has("featurelayer-force-marker-text-draw-order")?a.STRICT_MARKERS_AND_TEXT:a.BATCHING,r=i.getDisplayList(e.drawPhase,this._instanceStore,s);e.selection=t,r?.render(e)}const s=this._getExclusivePostprocessingInstance(e);null!=s&&s.techniqueRef.postProcess(e,s)}}export{u as FeatureContainer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{
|
|
5
|
+
import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{ignoreAbortErrors as e,throwIfNotAbortError as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{diff as i,hasDiff as a}from"../../../../core/accessorSupport/diffUtils.js";import o from"../../../../geometry/SpatialReference.js";import{MultiTileMeshData as n}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as c}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as h}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{ProcessorTileMessageQueue as u}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as g}from"./processor/BinningStrategy.js";import{ClusterStrategy as d}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as y}from"./processor/FeatureUpdateStrategy.js";import{AttributeStore as _}from"./support/AttributeStore.js";import{ComputedAttributeStorage as p}from"./support/ComputedAttributeStorage.js";class l{constructor(t,s){this._connection=t,this._source=s,this._version=1,this._proxy=new h({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new _({isLocal:!1,update:t=>e(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destory(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[]}}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}async update(t,e,s,r,n){const h=t.processor,u=i(this._schema,h);if(!u&&!r)return;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:u,schema:h}),this._schema=h;const g=o.fromJSON(t.source.mutable.dataFilter.outSpatialReference),d=new p({fields:this._source.metadata.fieldsIndex,spatialReference:g});return await this._attributeStore.update(h.storage,d,this._source.metadata,g,e),this._strategy?.invalidateAttributeData(),r||a(u,"mesh")?(a(u,"mesh.strategy")&&await this._updateStrategy(h.mesh.strategy,g,n,h.mesh.timeZone),this._updateSortKey(d,"sortKey"in h.mesh?h.mesh.sortKey:null),(a(u,"mesh.factory")||"dictionary"===h.mesh.factory.symbology.type)&&(this._factory=await c.create(d,this._proxy,h.mesh.factory,s)),this._invalidate(),this._version=e,this._connection.container.updateRenderState(this._version)):void 0}async applyOverride(t){if(!this._strategy)return;const e=this._strategy.applyOverride(t);for await(const r of e)try{await this._process(r)}catch(s){}this._source.applyOverride(t)}async updateChunks(){return this._doUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy)return void this._attributeStore.setHighlight(t.map((({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1}))),t);const e=this._strategy.displayMap(t,(({objectId:t})=>t),((t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e})));this._attributeStore.setHighlight(e,t)}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[],r=new Map;for await(const a of t){let t=r.get(a.id);null==t&&(t=new u({concurrency:16,process:t=>this._process(t)}),r.set(a.id,t));const i=t.push(a).catch((t=>s(t)));e.push(i)}try{await Promise.all(e)}catch(i){}has("esri-2d-update-debug")&&console.log("SendUpdates"),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new y(this._source,this._attributeStore,r);break;case"binning":this._strategy=await g.create(t,e,this._source,this._attributeStore,r);break;case"cluster":this._strategy=await d.create(this._connection,t,e,this._source,this._attributeStore,r)}for(const i of s)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}_invalidate(){this._strategy&&this._strategy.invalidate()}async _process(t){const e=t.subscription;if(has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}await this._fetchResources(t),r(e.signal);const s=await this._write(t,e.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone)),i=e.tile.tileInfoView.tileInfo.isWrappable,{message:a,transferList:o}=s.serialize(i),n=t.createMessage(a,this._version,this._attributeStore.epoch);if(r(e.signal),this._connection.container.onMessage(n,{signal:e.signal,transferList:o}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t){await this._fetchMatcherResources(t),await this._fetchWriterResources(t)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t){if(!t.reader)return;const e=t.reader.getCursor(),s=t.subscription.tile.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;e.next();)this._factory.enqueueWriterRequests(this._proxy,e,s);await this._proxy.fetchEnqueuedResources()}async _write(t,e){const s=t.subscription.tile,r=t.reader?.getCursor(),i=r?.getSize()??0,a=new n(s.key.id,this._strategy.enablePixelBuffering,i);if(!r)return a;const o=s.createArcadeEvaluationOptions(this._schema.mesh.timeZone);for(;r.next();){const t=this._getSortKeyValue(r,e);a.entityStart(r.getDisplayId(),t),this._factory.write(a,this._proxy,r,o,s.level),a.entityEnd()}return a}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}export{l as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{QueueProcessor as s}from"../../../support/QueueProcessor.js";class e{constructor(e){this._outstandingMessages=[],this._queue=new s({concurrency:e.concurrency,process:s=>e.process(s)})}async push(s){if(s.end)return await Promise.all(this._outstandingMessages),await this._queue.push(s),void(this._outstandingMessages=[]);const e=this._queue.push(s);return this._outstandingMessages.push(e),e}}export{e as ProcessorTileMessageQueue};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import t from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as i}from"../../engine/webgl/FeatureTile.js";import{getPow2NeighborKey as s}from"./support/tileUtils.js";class o{constructor(e,t,i){this.stage=e,this.version=t,this._tileInfoView=i,this._tiles=new Map,this._pendingUpdates=[],this._locked=!1}destroy(){}tiles(){return this._tiles.values()}size(){return this._tiles.size}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1;for(const e of this._pendingUpdates)this.updateTile(e);this._pendingUpdates=[]}updateTile(e){if(this._locked)return void this._pendingUpdates.push(e);if(has("esri-2d-update-debug")){const t=e.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${e.version}] Tile[${e.id}] Chunk[${t}] RenderState.updateTile [${e.type}]`,e)}const t=this._ensureTile(e.id);if("update"===e.type){const[i,...s]=e.modify;t.onMessage({type:"update",modify:i,remove:e.remove,end:e.end,attributeEpoch:e.attributeEpoch});for(const t of s){const i=this._tiles.get(t.tileId);i&&i.onMessage({type:"update",modify:t,remove:e.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null})}return}if(null==e.append)return void t.onMessage({type:"append",clear:e.clear,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});const[i,...s]=e.append;t.onMessage({type:"append",clear:e.clear,append:i,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});for(const o of s){const e=this._tiles.get(o.tileId);e&&e.onMessage({type:"update",modify:o,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null})}}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t?.destroy(),this._tiles.delete(e)}isTileDone(e){const t=this._tiles.get(e.id);return!!t&&t.isReady}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(s){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${s}] RenderState.createTile`);const o=new t(s),n=this._tileInfoView.getTileBounds(e(),o),r=this._tileInfoView.getTileResolution(o.level),l=new i(o,r,n[0],n[3]);return l.stage=this.stage,l}_copyPixelBufferedEntitiesInto(e){let t=7;for(let i=-1;i<=1;i++)for(let o=-1;o<=1;o++){if(0===i&&0===o)continue;const n=this._tileInfoView.tileInfo.isWrappable,r=s(e.key,o,i,n).id,l=this._tiles.get(r);if(null!=l){const s=1<<t;e.copyPixelBufferedEntitesFrom(l,s,o,i)}t--}}}export{o as RenderState};
|
|
5
|
+
import has from"../../../../core/has.js";import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import t from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as i}from"../../engine/webgl/FeatureTile.js";import{getPow2NeighborKey as s}from"./support/tileUtils.js";class o{constructor(e,t,i){this.stage=e,this.version=t,this._tileInfoView=i,this._tiles=new Map,this._pendingUpdates=[],this._locked=!1}destroy(){}tiles(){return this._tiles.values()}size(){return this._tiles.size}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1;for(const e of this._pendingUpdates)this.updateTile(e);this._pendingUpdates=[]}updateTile(e){if(this._locked)return void this._pendingUpdates.push(e);if(has("esri-2d-update-debug")){const t=e.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${e.version}] Tile[${e.id}] Chunk[${t}] RenderState.updateTile [${e.type}]`,e)}const t=this._ensureTile(e.id);if("update"===e.type){const[i,...s]=e.modify;t.onMessage({type:"update",modify:i,remove:e.remove,end:e.end,attributeEpoch:e.attributeEpoch});for(const t of s){const i=this._tiles.get(t.tileId);i&&i.onMessage({type:"update",modify:t,remove:e.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null})}return}if(null==e.append)return void t.onMessage({type:"append",clear:e.clear,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});const[i,...s]=e.append;t.onMessage({type:"append",clear:e.clear,append:i,debugInfo:e.debugInfo,end:e.end,attributeEpoch:e.attributeEpoch});for(const o of s){const e=this._tiles.get(o.tileId);e&&e.onMessage({type:"update",modify:o,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null})}}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t?.destroy(),this._tiles.delete(e)}isTileDone(e){const t=this._tiles.get(e.id);return!!t&&t.isReady}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(s){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${s}] RenderState.createTile`);const o=new t(s),n=this._tileInfoView.getTileBounds(e(),o),r=this._tileInfoView.getTileResolution(o.level),l=new i(o,r,n[0],n[3],!0);return l.stage=this.stage,l}_copyPixelBufferedEntitiesInto(e){let t=7;for(let i=-1;i<=1;i++)for(let o=-1;o<=1;o++){if(0===i&&0===o)continue;const n=this._tileInfoView.tileInfo.isWrappable,r=s(e.key,o,i,n).id,l=this._tiles.get(r);if(null!=l){const s=1<<t;e.copyPixelBufferedEntitesFrom(l,s,o,i)}t--}}}export{o as RenderState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{quantizeOptimizedGeometry as
|
|
5
|
+
import{quantizeX as t,quantizeY as r,quantizeOptimizedGeometry as e}from"../../../../../layers/graphics/featureConversionUtils.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{AccumulatedStatistics as i}from"./AccumulatedStatistics.js";class o{static createId(t,r){return`${t}.${r}`}static create(t,r,e,s){return new o(t,r,i.create(e),s)}constructor(t,r,e,s){this.gridX=t,this.gridY=r,this._statistics=e,this._worldUnitsPerCell=s,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._objectIds=new Set}get id(){return o.createId(this.gridX,this.gridY)}get count(){return this._count}get statistics(){return this._statistics}get objectIds(){return this._objectIds}get firstObjectId(){return this._objectIds.values().next().value}get centroidXWorld(){return this._xWorldTotal/this._count}get centroidYWorld(){return this._yWorldTotal/this._count}clone(){const t=new o(this.gridX,this.gridY,this._statistics.clone(),this._worldUnitsPerCell);return t._count=this._count,t._xWorldTotal=this._xWorldTotal,t._yWorldTotal=this._yWorldTotal,t._firstFeatureAttributes=this._firstFeatureAttributes,t._objectIds=new Set(this._objectIds),t}insert(t,r,e,s){0===this._count?this._firstFeatureAttributes=t.readAttributes():this._firstFeatureAttributes=null,this._count+=1,this._xWorldTotal+=e,this._yWorldTotal+=s,this._statistics.insert(t,r),this._objectIds.add(t.getObjectId())}merge(t){if(0!==t._count){this._count+=t._count,this._firstFeatureAttributes=t._firstFeatureAttributes,this._xWorldTotal+=t._xWorldTotal,this._yWorldTotal+=t._yWorldTotal,this._statistics.merge(t._statistics);for(const r of t._objectIds.values())this._objectIds.add(r)}}getCentroidX(r){return null==r?this.centroidXWorld:t(r,this.centroidXWorld)}getCentroidY(t){return null==t?this.centroidYWorld:r(t,this.centroidYWorld)}getCentroid(t){const r=new s([],[this.centroidXWorld,this.centroidYWorld]);if(null!=t){const i=new s;return e(i,r,!1,!1,"esriGeometryPoint",t)}return r}getGeometricCentroid(t){const r=this.gridX*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,i=this.gridY*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,o=new s([],[r,i]);if(null!=t){const r=new s;return e(r,o,!1,!1,"esriGeometryPoint",t)}return o}getAttributes(){const t={aggregateId:this.id};for(const r of this._statistics.values())t[r.field.name]=r.value;return null!=this._firstFeatureAttributes?{...t,...this._firstFeatureAttributes}:t}}export{o as GridCell};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as
|
|
5
|
+
import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as i}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as r}from"../aggregation/ComputedAggregateField.js";import{GridCell as n}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{ASendState as o}from"./AProcessorStrategy.js";import{WithDisplayId as d}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as u}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import h from"../support/FeatureFilter.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as f}from"../support/FeatureSetReaderJSON.js";import g from"../../../tiling/TileKey.js";const _=128;class m extends o{constructor(e){super(e),this.didSend=!1,this.done=!1}}class y{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e,t){let s=!1;for(const a of e){const e=a.queryInfo;if("tileId"in e){if(new g(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(a.normalizedChunkId)){this._handledChunks.add(a.normalizedChunkId),s=!0;a.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=a(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*r/n),s=Math.floor(e[1]*r/n),l=Math.ceil(e[2]*r/n),o=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,t),i.yMin=Math.min(i.yMin,s),i.xMax=Math.max(i.xMax,l),i.yMax=Math.max(i.yMax,o)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,r){const n=e.subscription,a=[],l=n.tile.transform;for(const o of this._clusters.values()){let e=o.inner.getCentroidX(l);const r=o.inner.getCentroidY(l),d=n.tile.lod,u=d.wrap?d.worldSize[0]:null;if(null!=u)if(1===u){const n=new s([],[e,r]),l=new t(n,o.inner.getAttributes(),null);l.geometry.coords[0]-=i,a.push(l);const d=new t(n,o.inner.getAttributes(),null);d.geometry.coords[0]+=i,a.push(d)}else e>i+i/2?e-=u*i:e<-i/2&&(e+=u*i);if(e<i+_&&e>=-_&&r<i+_&&r>=-_){const i=new s([],[e,r]),n=new t(i,o.inner.getAttributes(),null);n.objectId=o.inner.id,n.displayId=o.displayId,a.push(n)}}return f.fromOptimizedFeatures(a,r,n.tile.transform)}_clusterCells(e){let t=Array.from(this._cells.values());t=t.sort(((e,t)=>t.count-e.count)),this._store.releaseAllIds(),this._store.incrementDisplayIdGeneration(),this._clusters.clear();const s=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),i=1+this._clusterRadius/this._indexOptions.cellSize,r=new Set;for(const a of t){if(r.has(a.id))continue;if(a.gridX<e.xMin||a.gridX>e.xMax||a.gridY<e.yMin||a.gridY>e.yMax)continue;const t=this._store.createDisplayIdForObjectId(a.id),l=new d(a.clone(),t);r.add(a.id),this._clusters.set(a.id,l);const o=a.centroidXWorld,u=a.centroidYWorld;for(let e=a.gridY-i;e<=a.gridY+i;e++)for(let t=a.gridX-i;t<=a.gridX+i;t++){if(e===a.gridY&&t===a.gridX)continue;const i=this._cells.get(n.createId(t,e));if(!i||r.has(i.id))continue;const d=Math.abs(i.centroidXWorld-o),c=Math.abs(i.centroidYWorld-u);d<s&&c<s&&(l.inner.merge(i),r.add(i.id))}}}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class S extends l{static async create(e,t,s,i,n,a){const l=new c({spatialReference:s}),o={fields:await Promise.all(t.fields.map((async e=>r.create(l,e)))),spatialReference:s,featureFilter:t.featureFilter?await h.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:a};return new S(e,t.clusterRadius,o,t.fields,i,n)}constructor(e,t,s,i,r,n){super(r,n,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new p({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new m(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const e=i.get(a.inner.firstObjectId);if(null!=e){const t=s(a.displayId,e,a.inner.firstObjectId);r.push(t),i.delete(a.inner.firstObjectId)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter((e=>e.subscription.tile.level===this._requiredLevel));if(t.updateChunks(e,s)||!this._source.updateTracking.updating)for(const n of s)n.subscription.tile.level===this._requiredLevel&&(n.didSend=!1,n.done=!1);const i=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),r=new Set(i);for(const n of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some((e=>e.containsChild(n.subscription.tile.key))))continue;if(n.subscription.tile.key.getChildKeys().every((e=>r.has(e))))continue}n.didSend||n.subscription.tile.level!==this._requiredLevel||(n.didSend=!0,yield*this._update(n,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new y(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.timeZone);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new u(e.subscription,i,!0,e.done,{});yield a}}export{m as ClusterState,S as ClusterStrategy};
|