@arcgis/core 5.1.0-next.98 → 5.1.0-next.99
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/WebLinkChart.d.ts +5 -1
- package/WebLinkChart.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{a68b5cb66c2c5e6b46e0.js → 0253292939b981134663.js} +1 -1
- package/assets/esri/core/workers/chunks/{c514135bf7703ba69a47.js → 1d451ef24230d96c8341.js} +1 -1
- package/assets/esri/core/workers/chunks/24247ee93f43fff5e596.js +2 -0
- package/assets/esri/core/workers/chunks/{0e6b24e8864940ed9877.js → 2b2e5628d08d0e3108d2.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c2d2f22df057ba8cb50.js → 3ff0041bed0fa3d365f7.js} +1 -1
- package/assets/esri/core/workers/chunks/{d93a4ccf8f0208dc6ad7.js → 6881ae969b48bd04f064.js} +1 -1
- package/assets/esri/core/workers/chunks/{f31deeedb2508e81293b.js → 7a20941913d0115cfe26.js} +2 -2
- package/assets/esri/core/workers/chunks/7e57029ec958f6423d5d.js +2 -0
- package/assets/esri/core/workers/chunks/{4456bbb4b7dfe80c7477.js → 889a0405e3cdfa59b8e7.js} +1 -1
- package/assets/esri/core/workers/chunks/{3241e0ed26aff61ec213.js → 8fedb32055ac7f771419.js} +1 -1
- package/assets/esri/core/workers/chunks/{f68c12e0c1eda7f73a17.js → 90ea570f6b6ce8ca693b.js} +1 -1
- package/assets/esri/core/workers/chunks/{40e887e87ae24ace27a5.js → 9478a0478fb49a88685e.js} +1 -1
- package/assets/esri/core/workers/chunks/9940b318f38ea9d7a533.js +1 -0
- package/assets/esri/core/workers/chunks/aca9591d3467a24f8329.js +1 -0
- package/assets/esri/core/workers/chunks/{ce4e09b623ebb640c46c.js → adf72d87f0114aeade0e.js} +1 -1
- package/assets/esri/core/workers/chunks/{40afdb74517a7df59e0d.js → b8d10d8db44c7c6acebe.js} +1 -1
- package/assets/esri/core/workers/chunks/c0e4fd6fa1d765275248.js +2 -0
- package/assets/esri/core/workers/chunks/{308e1b0aea941958de44.js → d345030a89914348d3c5.js} +1 -1
- package/assets/esri/core/workers/chunks/{a50fd0e66b01fe205033.js → da644117bdf601f528b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{509beae195c900a85e0b.js → df232b8aa77f7e3285e3.js} +1 -1
- package/assets/esri/core/workers/chunks/e7637d6a8ce0af46843c.js +2 -0
- package/assets/esri/core/workers/chunks/fff4b9e43464ebb3fb4e.js +1 -0
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/linkChart/LayoutSettings.d.ts +7 -0
- package/linkChart/LayoutSettings.js +1 -1
- package/linkChart/RootedLayoutSettings.d.ts +18 -0
- package/linkChart/RootedLayoutSettings.js +2 -0
- package/package.json +3 -3
- package/renderers/support/ClassBreakInfo.d.ts +76 -2
- package/renderers/support/UniqueValueClass.d.ts +12 -0
- package/renderers/support/UniqueValueInfo.d.ts +68 -4
- package/support/revision.js +1 -1
- package/symbols/cim/CIMResourceManager.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerViewPerformanceInfo.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
- package/widgets/Histogram/HistogramViewModel.d.ts +1 -0
- package/widgets/Histogram/HistogramViewModel.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/246253fbbb2ecea48f91.js +0 -1
- package/assets/esri/core/workers/chunks/4df19e670b6ed76c1dea.js +0 -2
- package/assets/esri/core/workers/chunks/bf6c6bc15b0d2d82d1a4.js +0 -2
- package/assets/esri/core/workers/chunks/ce2ed9405ff1b704d35c.js +0 -1
- package/assets/esri/core/workers/chunks/d1ba118ddd0390c07f35.js +0 -2
- package/assets/esri/core/workers/chunks/d87e504082e293640ece.js +0 -2
- package/assets/esri/core/workers/chunks/d897412b99b9fba44bb4.js +0 -1
- /package/assets/esri/core/workers/chunks/{d87e504082e293640ece.js.LICENSE.txt → 24247ee93f43fff5e596.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f31deeedb2508e81293b.js.LICENSE.txt → 7a20941913d0115cfe26.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4df19e670b6ed76c1dea.js.LICENSE.txt → 7e57029ec958f6423d5d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bf6c6bc15b0d2d82d1a4.js.LICENSE.txt → c0e4fd6fa1d765275248.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d1ba118ddd0390c07f35.js.LICENSE.txt → e7637d6a8ce0af46843c.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import{getJsonType as t,isPoint as i}from"../../../../geometry/support/jsonTypeUtils.js";import{wgs84 as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatures as n,convertToFeature as r,convertFromFeature as a}from"../../featureConversionUtils.js";import{initialObjectId as o,findLastObjectIdFromFeatures as u}from"../../objectIdUtils.js";import l from"../../data/FeatureStore.js";import{checkProjectionSupport as d,project as p}from"../../data/projectionSupport.js";import{QueryEngine as f}from"../../data/QueryEngine.js";import{createDefaultAttributesFunction as c,createDefaultTemplate as y,createDrawingInfo as m}from"./clientSideDefaults.js";import{queryBinsCapabilities as h,loadGeometryEngineForSimplify as g,createFeatureEditErrorResult as I,mixAttributes as b,createFeatureEditSuccessResult as F,simplify as j}from"./sourceUtils.js";import _ from"../../../support/FieldsIndex.js";import{kebabDict as q}from"../../../support/fieldType.js";import{getFieldDefaultLength as E,getFieldDefaultValue as T}from"../../../support/fieldUtils.js";import{utc as x}from"../../../../time/constants.js";const R=s,O={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:s},v={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentsCountOnly:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryAttachmentWithTypeWildcard:!1,supportsQueryBins:!0,supportsQueryPivot:!1,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:["EnvelopeAggregate","CentroidAggregate","ConvexHullAggregate"],supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsOutDistance:!1,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0,supportsQueryWithCacheHint:!0},queryBinsCapabilities:h};function S(e){return i(e)?null!=e.z:!!e.hasZ}function w(e){return i(e)?null!=e.m:!!e.hasM}function D(e,t){let i;const s=[];if("unique-id-composite"===t.type){const n=[];for(const i of t.fieldNames)e.attributes[i]?n.push(e.attributes[i]):s.push(i);i=0===s.length?JSON.stringify(n):null}else i=e.attributes[t.fieldName],i||s.push(t.fieldName);return{objectId:i,missingFields:s}}class Q{constructor(){this._uniqueIdInfo=null,this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(t){const i=[],{features:s}=t,n=this._inferLayerProperties(s,t.fields),r=t.fields||[],a=null!=t.hasM?t.hasM:!!n.hasM,p=null!=t.hasZ?t.hasZ:!!n.hasZ,h=!t.spatialReference&&!n.spatialReference,g=h?R:t.spatialReference||n.spatialReference,I=h?O:null,b=t.geometryType||n.geometryType,F=!b,j=t.uniqueIdInfo;let S=t.objectIdField??n.objectIdField,w=t.timeInfo;const D=new _(r);if(!F&&(h&&i.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!b))throw new e("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(j){const t=new Set(r.map(({name:e})=>e));if(!j.fields.every(e=>t.has(e))){const i=j.fields.filter(e=>!t.has(e));throw new e("feature-layer:missing-property","UniqueIdFields not set and couldn't be found in the provided fields. Fields: "+i+" are mssing.")}S=null}else if(!S)throw new e("feature-layer:missing-property","objectIdField not set and uniqueIdInfo not provided.");if(n.objectIdField&&S!==n.objectIdField&&(i.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${S}" doesn't match the field name "${n.objectIdField}", found in the provided fields`}),S=n.objectIdField),S&&!n.objectIdField){const e=D.get(S);e?(S=e.name,e.type="esriFieldTypeOID",e.editable=!1,e.nullable=!1):r.unshift({alias:S,name:S,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const o of r){if(null==o.name&&(o.name=o.alias),null==o.alias&&(o.alias=o.name),!o.name)throw new e("feature-layer:invalid-field-name","field name is missing",{field:o});if(o.name===S&&(o.type="esriFieldTypeOID"),!q.jsonValues.includes(o.type))throw new e("feature-layer:invalid-field-type",`invalid type for field "${o.name}"`,{field:o});null==o.length&&(o.length=E(o))}const Q={};for(const e of r)if("esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type){const t=T(e);void 0!==t&&(Q[e.name]=t)}if(w){if(w.startTimeField){const e=D.get(w.startTimeField);e?(w.startTimeField=e.name,e.type="esriFieldTypeDate"):w.startTimeField=null}if(w.endTimeField){const e=D.get(w.endTimeField);e?(w.endTimeField=e.name,e.type="esriFieldTypeDate"):w.endTimeField=null}if(w.trackIdField){const e=D.get(w.trackIdField);e?w.trackIdField=e.name:(w.trackIdField=null,i.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:w}}))}w.startTimeField||w.endTimeField||(i.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:w}}),w=null)}const A=D.dateFields.length?{timeZoneIANA:t.dateFieldsTimeZone??x}:null;this._createDefaultAttributes=c(Q,S),this._uniqueIdInfo=t.uniqueIdInfo??void 0;const M={warnings:i,featureErrors:[],layerDefinition:{...v,drawingInfo:m(b),templates:y(Q),extent:I,geometryType:b,objectIdField:S,fields:r,hasZ:p,hasM:a,timeInfo:w,dateFieldsTimeReference:A,uniqueIdInfo:this._uniqueIdInfo??void 0},assignedObjectIds:{}},C=this._uniqueIdInfo?.OIDFieldContainsHashValue?"simple"===this._uniqueIdInfo.type?{type:"unique-id-simple",fieldName:this._uniqueIdInfo.fields[0]}:{type:"unique-id-composite",fieldNames:this._uniqueIdInfo.fields}:{type:"object-id",fieldName:S};if(this._queryEngine=new f({fieldsIndex:_.fromLayerJSON({fields:r,timeInfo:w,dateFieldsTimeReference:A}),geometryType:b,hasM:a,hasZ:p,featureIdInfo:C,spatialReference:g,featureStore:new l({geometryType:b,hasM:a,hasZ:p}),timeInfo:w}),!s?.length)return this._nextObjectId=o,M;if(S){const e=u(S,s);this._nextObjectId=e+1}return await d(s,g),this._loadInitialFeatures(M,s)}async applyEdits(e){const{spatialReference:t,geometryType:i}=this._queryEngine;return await Promise.all([g(t,i),d(e.adds,t),d(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return this._queryEngine.executeQueryForSnapping(e,t.signal)}queryAttributeBins(e,t={}){return this._queryEngine.executeAttributeBinsQuery(e,t.signal)}_inferLayerProperties(e,i){let s,n,r=null,a=null,o=null;for(const u of e){const e=u.geometry;if(null!=e&&(r||(r=t(e)),a||(a=e.spatialReference),null==s&&(s=S(e)),null==n&&(n=w(e)),r&&a&&null!=s&&null!=n))break}if(i&&i.length){let e=null;i.some(t=>{const i="esriFieldTypeOID"===t.type,s=!t.type&&t.name&&"objectid"===t.name.toLowerCase();return e=t,i||s})&&(o=e.name)}return{geometryType:r,spatialReference:a,objectIdField:o,hasM:n,hasZ:s}}async _loadInitialFeatures(e,i){const{geometryType:s,hasM:r,hasZ:a,spatialReference:o,featureStore:u,fieldsIndex:l,featureIdInfo:d}=this._queryEngine,f=[];for(const n of i){if(null!=n.uid&&(e.assignedObjectIds[n.uid]=-1),n.geometry&&s!==t(n.geometry)){e.featureErrors.push(I("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),r=b(l,i,n.attributes,!0);r?e.featureErrors.push(r):(this._assignObjectId(i,n.attributes,!0),n.attributes=i,n.uid&&(e.assignedObjectIds[n.uid]=D(n,d).objectId),null!=n.geometry&&(n.geometry=p(n.geometry,n.geometry.spatialReference,o)),f.push(n))}u.addMany(n([],f,s,a,r,d));const{fullExtent:c,timeExtent:y}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=c,y){const{start:t,end:i}=y;e.layerDefinition.timeInfo.timeExtent=[t,i]}return e}async _applyEdits(e){const{adds:t,updates:i,deletes:s}=e,n={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(n,t),i?.length&&this._applyUpdateEdits(n,i),s?.length){for(const e of s)n.deleteResults.push(F(e));this._queryEngine.featureStore.removeManyById(s)}const{fullExtent:r,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:r,timeExtent:a,featureEditResults:n}}_applyAddEdits(e,i){const{addResults:s,updateResults:r}=e,{geometryType:a,hasM:o,hasZ:u,spatialReference:l,featureStore:d,featureIdInfo:f,fieldsIndex:c}=this._queryEngine,y=[];for(const m of i){if(m.geometry&&a!==t(m.geometry)){s.push(I("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),h=b(c,i,m.attributes);if(h){s.push(h);continue}this._assignObjectId(i,m.attributes),m.attributes=i;const{objectId:g,missingFields:_}=D(m,f);if(g){if(null!=m.uid&&(e.uidToObjectId[m.uid]=g),null!=m.geometry){const e=m.geometry.spatialReference??l;m.geometry=p(j(m.geometry,e),e,l)}y.push(m);const t=F(g);d.has(g)?r.push(t):s.push(t),d.addMany(n([],y,a,u,o,f))}else s.push(I(`Missing unique id field value for fields: ${_.join()}`))}}_applyUpdateEdits({updateResults:e},i){const{geometryType:s,hasM:n,hasZ:o,spatialReference:u,featureStore:l,fieldsIndex:d,featureIdInfo:f}=this._queryEngine;for(const c of i){const{attributes:i,geometry:y}=c,{objectId:m,missingFields:h}=D(c,f);if(null==m){const t="unique-id-composite"===f.type?h:f.fieldName;e.push(I(`Identifier fields: ${t} missing`));continue}if(!l.has(m)){e.push(I(`Feature with object id ${m} missing`));continue}const g=r(l.getFeature(m),s,o,n);if(null!=y){if(s!==t(y)){e.push(I("Incorrect geometry type."));continue}const i=y.spatialReference??u;g.geometry=p(j(y,i),i,u)}if(i){const t=b(d,g.attributes,i);if(t){e.push(t);continue}}l.add(a(g,s,o,n,f)),e.push(F(m))}}_assignObjectId(e,t,i=!1){if("object-id"===this._queryEngine.featureIdInfo.type){const s=this._queryEngine.featureIdInfo.fieldName;i&&t&&isFinite(t[s])?e[s]=t[s]:e[s]=this._nextObjectId++}}}export{Q as default};
|
|
2
|
+
import e from"../../../../core/Error.js";import{getJsonType as t,isPoint as i}from"../../../../geometry/support/jsonTypeUtils.js";import{wgs84 as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatures as n,convertToFeature as r,convertFromFeature as a}from"../../featureConversionUtils.js";import{initialObjectId as o,findLastObjectIdFromFeatures as u}from"../../objectIdUtils.js";import l from"../../data/FeatureStore.js";import{checkProjectionSupport as d,project as p}from"../../data/projectionSupport.js";import{QueryEngine as f}from"../../data/QueryEngine.js";import{createDefaultAttributesFunction as c,createDefaultTemplate as y,createDrawingInfo as m}from"./clientSideDefaults.js";import{queryBinsCapabilities as h,loadGeometryEngineForSimplify as g,createFeatureEditErrorResult as I,mixAttributes as b,createFeatureEditSuccessResult as F,simplify as j}from"./sourceUtils.js";import _ from"../../../support/FieldsIndex.js";import{kebabDict as q}from"../../../support/fieldType.js";import{getFieldDefaultLength as E,getFieldDefaultValue as T}from"../../../support/fieldUtils.js";import{utc as x}from"../../../../time/constants.js";const R=s,O={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:s},v={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentsCountOnly:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryAttachmentWithTypeWildcard:!1,supportsQueryBins:!0,supportsQueryPivot:!1,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:["EnvelopeAggregate","CentroidAggregate","ConvexHullAggregate"],supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsOutDistance:!1,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0,supportsQueryWithCacheHint:!0},queryBinsCapabilities:h};function S(e){return i(e)?null!=e.z:!!e.hasZ}function w(e){return i(e)?null!=e.m:!!e.hasM}function D(e,t){let i;const s=[];if("unique-id-composite"===t.type){const n=[];for(const i of t.fieldNames)e.attributes[i]?n.push(e.attributes[i]):s.push(i);i=0===s.length?JSON.stringify(n):null}else i=e.attributes[t.fieldName],i||s.push(t.fieldName);return{objectId:i,missingFields:s}}class Q{constructor(){this._uniqueIdInfo=null,this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(t){const i=[],{features:s}=t,n=this._inferLayerProperties(s,t.fields),r=t.fields||[],a=null!=t.hasM?t.hasM:!!n.hasM,p=null!=t.hasZ?t.hasZ:!!n.hasZ,h=!t.spatialReference&&!n.spatialReference,g=h?R:t.spatialReference||n.spatialReference,I=h?O:null,b=t.geometryType||n.geometryType,F=!b,j=t.uniqueIdInfo;let S=t.objectIdField??n.objectIdField,w=t.timeInfo;const D=new _(r);if(!F&&(h&&i.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!b))throw new e("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(j){const t=new Set(r.map(({name:e})=>e));if(!j.fields.every(e=>t.has(e))){const i=j.fields.filter(e=>!t.has(e));throw new e("feature-layer:missing-property","UniqueIdFields not set and couldn't be found in the provided fields. Fields: "+i+" are mssing.")}S=null}else if(!S)throw new e("feature-layer:missing-property","objectIdField not set and uniqueIdInfo not provided.");if(n.objectIdField&&S!==n.objectIdField&&(i.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${S}" doesn't match the field name "${n.objectIdField}", found in the provided fields`}),S=n.objectIdField),S&&!n.objectIdField){const e=D.get(S);e?(S=e.name,e.type="esriFieldTypeOID",e.editable=!1,e.nullable=!1):r.unshift({alias:S,name:S,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const o of r){if(null==o.name&&(o.name=o.alias),null==o.alias&&(o.alias=o.name),!o.name)throw new e("feature-layer:invalid-field-name","field name is missing",{field:o});if(o.name===S&&(o.type="esriFieldTypeOID"),!q.jsonValues.includes(o.type))throw new e("feature-layer:invalid-field-type",`invalid type for field "${o.name}"`,{field:o});null==o.length&&(o.length=E(o))}const Q={};for(const e of r)if("esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type){const t=T(e);void 0!==t&&(Q[e.name]=t)}if(w){if(w.startTimeField){const e=D.get(w.startTimeField);e?(w.startTimeField=e.name,e.type="esriFieldTypeDate"):w.startTimeField=null}if(w.endTimeField){const e=D.get(w.endTimeField);e?(w.endTimeField=e.name,e.type="esriFieldTypeDate"):w.endTimeField=null}if(w.trackIdField){const e=D.get(w.trackIdField);e?w.trackIdField=e.name:(w.trackIdField=null,i.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:w}}))}w.startTimeField||w.endTimeField||(i.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:w}}),w=null)}const A=D.dateFields.length?{timeZoneIANA:t.dateFieldsTimeZone??x}:null;this._createDefaultAttributes=c(Q,S),this._uniqueIdInfo=t.uniqueIdInfo??void 0;const M={warnings:i,featureErrors:[],layerDefinition:{...v,drawingInfo:m(b),templates:y(Q),extent:I,geometryType:b,objectIdField:S,fields:r,hasZ:p,hasM:a,timeInfo:w,dateFieldsTimeReference:A,uniqueIdInfo:this._uniqueIdInfo??void 0},assignedObjectIds:{}},C=this._uniqueIdInfo?.OIDFieldContainsHashValue?"simple"===this._uniqueIdInfo.type?{type:"unique-id-simple",fieldName:this._uniqueIdInfo.fields[0]}:{type:"unique-id-composite",fieldNames:this._uniqueIdInfo.fields}:{type:"object-id",fieldName:S};if(this._queryEngine=new f({fieldsIndex:_.fromLayerJSON({fields:r,timeInfo:w,dateFieldsTimeReference:A}),geometryType:b,hasM:a,hasZ:p,featureIdInfo:C,spatialReference:g,featureStore:new l({geometryType:b,hasM:a,hasZ:p}),timeInfo:w}),!s?.length)return this._nextObjectId=o,M;if(S){const e=u(S,s);this._nextObjectId=e+1}return await d(s,g),this._loadInitialFeatures(M,s)}async applyEdits(e){const{spatialReference:t,geometryType:i}=this._queryEngine;return await Promise.all([g(t,i),d(e.adds,t),d(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return this._queryEngine.executeQueryForSnapping(e,t.signal)}queryAttributeBins(e,t={}){return this._queryEngine.executeAttributeBinsQuery(e,t.signal)}_inferLayerProperties(e,i){let s,n,r=null,a=null,o=null;for(const u of e){const e=u.geometry;if(null!=e&&(r||(r=t(e)),a||(a=e.spatialReference),null==s&&(s=S(e)),null==n&&(n=w(e)),r&&a&&null!=s&&null!=n))break}if(i&&i.length){let e=null;i.some(t=>{const i="esriFieldTypeOID"===t.type,s=!t.type&&t.name&&"objectid"===t.name.toLowerCase();return e=t,i||s})&&(o=e.name)}return{geometryType:r,spatialReference:a,objectIdField:o,hasM:n,hasZ:s}}async _loadInitialFeatures(e,i){const{geometryType:s,hasM:r,hasZ:a,spatialReference:o,featureStore:u,fieldsIndex:l,featureIdInfo:d}=this._queryEngine,f=[];for(const n of i){if(null!=n.uid&&(e.assignedObjectIds[n.uid]=-1),n.geometry&&s!==t(n.geometry)){e.featureErrors.push(I("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),r=b(l,i,n.attributes,!0);r?e.featureErrors.push(r):(this._assignObjectId(i,n.attributes,!0),n.attributes=i,n.uid&&(e.assignedObjectIds[n.uid]=D(n,d).objectId),null!=n.geometry&&(n.geometry=p(n.geometry,n.geometry.spatialReference,o)),f.push(n))}u.addMany(n([],f,s,a,r,d));const{fullExtent:c,timeExtent:y}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=c,y){const{start:t,end:i}=y;e.layerDefinition.timeInfo.timeExtent=[t,i]}return e}async _applyEdits(e){const{adds:t,updates:i,deletes:s}=e,n={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(n,t),i?.length&&this._applyUpdateEdits(n,i),s?.length){for(const e of s)n.deleteResults.push(F(e));this._queryEngine.featureStore.removeManyById(s)}const{fullExtent:r,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:r,timeExtent:a,featureEditResults:n}}_applyAddEdits(e,i){const{addResults:s,updateResults:r}=e,{geometryType:a,hasM:o,hasZ:u,spatialReference:l,featureStore:d,featureIdInfo:f,fieldsIndex:c}=this._queryEngine,y=[];for(const n of i){if(n.geometry&&a!==t(n.geometry)){s.push(I("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),o=b(c,i,n.attributes);if(o){s.push(o);continue}this._assignObjectId(i,n.attributes),n.attributes=i;const{objectId:u,missingFields:m}=D(n,f);if(u){if(null!=n.uid&&(e.uidToObjectId[n.uid]=u),null!=n.geometry){const e=n.geometry.spatialReference??l;n.geometry=p(j(n.geometry,e),e,l)}y.push(n);const t=F(u);d.has(u)?r.push(t):s.push(t)}else s.push(I(`Missing unique id field value for fields: ${m.join()}`))}d.addMany(n([],y,a,u,o,f))}_applyUpdateEdits({updateResults:e},i){const{geometryType:s,hasM:n,hasZ:o,spatialReference:u,featureStore:l,fieldsIndex:d,featureIdInfo:f}=this._queryEngine;for(const c of i){const{attributes:i,geometry:y}=c,{objectId:m,missingFields:h}=D(c,f);if(null==m){const t="unique-id-composite"===f.type?h:f.fieldName;e.push(I(`Identifier fields: ${t} missing`));continue}if(!l.has(m)){e.push(I(`Feature with object id ${m} missing`));continue}const g=r(l.getFeature(m),s,o,n);if(null!=y){if(s!==t(y)){e.push(I("Incorrect geometry type."));continue}const i=y.spatialReference??u;g.geometry=p(j(y,i),i,u)}if(i){const t=b(d,g.attributes,i);if(t){e.push(t);continue}}l.add(a(g,s,o,n,f)),e.push(F(m))}}_assignObjectId(e,t,i=!1){if("object-id"===this._queryEngine.featureIdInfo.type){const s=this._queryEngine.featureIdInfo.fieldName;i&&t&&isFinite(t[s])?e[s]=t[s]:e[s]=this._nextObjectId++}}}export{Q as default};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type ChronologicalLayoutSettings from "./ChronologicalLayoutSettings.js";
|
|
2
2
|
import type OrganicLayoutSettings from "./OrganicLayoutSettings.js";
|
|
3
|
+
import type RootedLayoutSettings from "./RootedLayoutSettings.js";
|
|
3
4
|
import type { ClonableMixin } from "../core/Clonable.js";
|
|
4
5
|
import type { JSONSupport } from "../core/JSONSupport.js";
|
|
5
6
|
import type { ChronologicalLayoutSettingsProperties } from "./ChronologicalLayoutSettings.js";
|
|
6
7
|
import type { OrganicLayoutSettingsProperties } from "./OrganicLayoutSettings.js";
|
|
8
|
+
import type { RootedLayoutSettingsProperties } from "./RootedLayoutSettings.js";
|
|
7
9
|
|
|
8
10
|
export interface LayoutSettingsProperties {
|
|
9
11
|
/**
|
|
@@ -14,6 +16,8 @@ export interface LayoutSettingsProperties {
|
|
|
14
16
|
chronologicalLayoutSettings?: ChronologicalLayoutSettingsProperties | null;
|
|
15
17
|
/** Settings for organic layout calculations that allow you to customize how the entities are placed. */
|
|
16
18
|
organicLayoutSettings?: OrganicLayoutSettingsProperties | null;
|
|
19
|
+
/** Settings for tree and hierarchical layout calculations that allow you to customize how the entities are placed. */
|
|
20
|
+
rootedLayoutSettings?: RootedLayoutSettingsProperties | null;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
/**
|
|
@@ -36,5 +40,8 @@ export default class LayoutSettings extends LayoutSettingsSuperclass {
|
|
|
36
40
|
/** Settings for organic layout calculations that allow you to customize how the entities are placed. */
|
|
37
41
|
get organicLayoutSettings(): OrganicLayoutSettings | null | undefined;
|
|
38
42
|
set organicLayoutSettings(value: OrganicLayoutSettingsProperties | null | undefined);
|
|
43
|
+
/** Settings for tree and hierarchical layout calculations that allow you to customize how the entities are placed. */
|
|
44
|
+
get rootedLayoutSettings(): RootedLayoutSettings | null | undefined;
|
|
45
|
+
set rootedLayoutSettings(value: RootedLayoutSettingsProperties | null | undefined);
|
|
39
46
|
}
|
|
40
47
|
declare const LayoutSettingsSuperclass: typeof JSONSupport & typeof ClonableMixin
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as t}from"tslib";import{ClonableMixin as o}from"../core/Clonable.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{property as e,subclass as i}from"../core/accessorSupport/decorators.js";import s from"./ChronologicalLayoutSettings.js";import n from"./OrganicLayoutSettings.js";import a from"./RootedLayoutSettings.js";let p=class extends(o(r)){constructor(t){super(t),this.chronologicalLayoutSettings=null,this.organicLayoutSettings=null,this.rootedLayoutSettings=null}};t([e({type:s,json:{write:!0}})],p.prototype,"chronologicalLayoutSettings",void 0),t([e({type:n,json:{write:!0}})],p.prototype,"organicLayoutSettings",void 0),t([e({type:a,json:{write:!0}})],p.prototype,"rootedLayoutSettings",void 0),p=t([i("esri.linkChart.LayoutSettings")],p);export{p as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ClonableMixin } from "../core/Clonable.js";
|
|
2
|
+
import type { JSONSupport } from "../core/JSONSupport.js";
|
|
3
|
+
import type { IdTypePair } from "../layers/knowledgeGraph/types.js";
|
|
4
|
+
|
|
5
|
+
export interface RootedLayoutSettingsProperties extends Partial<Pick<RootedLayoutSettings, "rootEntities">> {}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Settings for rooted layout calculations.
|
|
9
|
+
*
|
|
10
|
+
* @since 4.32
|
|
11
|
+
* @see [Web Map Specification | Link chart rooted layout settings](https://developers.arcgis.com/web-map-specification/objects/linkChartRootedLayoutSettings/)
|
|
12
|
+
*/
|
|
13
|
+
export default class RootedLayoutSettings extends RootedLayoutSettingsSuperclass {
|
|
14
|
+
constructor(properties?: RootedLayoutSettingsProperties);
|
|
15
|
+
/** An array of entity ID and type pairs to be used as root entities in the layout. Only applicable in tree, radial and hierachical layouts. */
|
|
16
|
+
accessor rootEntities: IdTypePair[] | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
declare const RootedLayoutSettingsSuperclass: typeof JSONSupport & typeof ClonableMixin
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{__decorate as o}from"tslib";import{ClonableMixin as t}from"../core/Clonable.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{property as e,subclass as s}from"../core/accessorSupport/decorators.js";let i=class extends(t(r)){constructor(o){super(o),this.rootEntities=[]}};o([e({type:[Object],json:{write:!0}})],i.prototype,"rootEntities",void 0),i=o([s("esri.linkChart.RootedLayoutSettings")],i);export{i as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.99",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@amcharts/amcharts5": "~5.17.2",
|
|
22
|
-
"@arcgis/toolkit": "^5.1.0-next.
|
|
22
|
+
"@arcgis/toolkit": "^5.1.0-next.101",
|
|
23
23
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
24
|
-
"@esri/calcite-components": "^5.1.0-next.
|
|
24
|
+
"@esri/calcite-components": "^5.1.0-next.47",
|
|
25
25
|
"@vaadin/grid": "~25.1.2",
|
|
26
26
|
"@zip.js/zip.js": "~2.8.26",
|
|
27
27
|
"luxon": "~3.7.2",
|
|
@@ -16,7 +16,44 @@ import type { PictureMarkerSymbolProperties } from "../../symbols/PictureMarkerS
|
|
|
16
16
|
import type { PictureFillSymbolProperties } from "../../symbols/PictureFillSymbol.js";
|
|
17
17
|
|
|
18
18
|
export interface ClassBreakInfoProperties extends Partial<Pick<ClassBreakInfo, "label" | "maxValue" | "minValue">> {
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Defines alternate CIM symbols used to represent features in this class break at different scales.
|
|
21
|
+
* Each CIMSymbol provided must have a `minScale` or `maxScale` defined.
|
|
22
|
+
*
|
|
23
|
+
* > Alternate symbols are only supported in 2D.
|
|
24
|
+
* > To properly support scale-based symbology, the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/ClassBreakInfo/#symbol) property should also be a [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) with a `minScale` or `maxScale` defined.
|
|
25
|
+
*
|
|
26
|
+
* @since 5.1
|
|
27
|
+
* @example
|
|
28
|
+
* ```js
|
|
29
|
+
* classBreaksRenderer.classBreakInfos = [
|
|
30
|
+
* {
|
|
31
|
+
* minValue: 0,
|
|
32
|
+
* maxValue: 100,
|
|
33
|
+
* label: "0-100",
|
|
34
|
+
* // this symbol will be used when the view's scale is less than 5,000,000
|
|
35
|
+
* symbol: new CIMSymbol({
|
|
36
|
+
* data: {
|
|
37
|
+
* type: "CIMSymbolReference",
|
|
38
|
+
* minScale: 5000000,
|
|
39
|
+
* maxScale: 0,
|
|
40
|
+
* symbol: { ... } // symbol definition
|
|
41
|
+
* }
|
|
42
|
+
* }),
|
|
43
|
+
* alternateSymbols: [
|
|
44
|
+
* // this symbol will be used when the view's scale is greater than 5,000,000
|
|
45
|
+
* new CIMSymbol({
|
|
46
|
+
* data: {
|
|
47
|
+
* type: "CIMSymbolReference",
|
|
48
|
+
* minScale: 0,
|
|
49
|
+
* maxScale: 5000000,
|
|
50
|
+
* symbol: { ... } // symbol definition
|
|
51
|
+
* }
|
|
52
|
+
* })
|
|
53
|
+
* }
|
|
54
|
+
* ]
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
20
57
|
alternateSymbols?: CIMSymbolProperties[] | null;
|
|
21
58
|
/**
|
|
22
59
|
* Defines the symbol used to render features with data values that are within the bounds
|
|
@@ -42,7 +79,44 @@ export interface ClassBreakInfoProperties extends Partial<Pick<ClassBreakInfo, "
|
|
|
42
79
|
*/
|
|
43
80
|
export default class ClassBreakInfo extends JSONSupport {
|
|
44
81
|
constructor(properties?: ClassBreakInfoProperties);
|
|
45
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Defines alternate CIM symbols used to represent features in this class break at different scales.
|
|
84
|
+
* Each CIMSymbol provided must have a `minScale` or `maxScale` defined.
|
|
85
|
+
*
|
|
86
|
+
* > Alternate symbols are only supported in 2D.
|
|
87
|
+
* > To properly support scale-based symbology, the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/ClassBreakInfo/#symbol) property should also be a [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) with a `minScale` or `maxScale` defined.
|
|
88
|
+
*
|
|
89
|
+
* @since 5.1
|
|
90
|
+
* @example
|
|
91
|
+
* ```js
|
|
92
|
+
* classBreaksRenderer.classBreakInfos = [
|
|
93
|
+
* {
|
|
94
|
+
* minValue: 0,
|
|
95
|
+
* maxValue: 100,
|
|
96
|
+
* label: "0-100",
|
|
97
|
+
* // this symbol will be used when the view's scale is less than 5,000,000
|
|
98
|
+
* symbol: new CIMSymbol({
|
|
99
|
+
* data: {
|
|
100
|
+
* type: "CIMSymbolReference",
|
|
101
|
+
* minScale: 5000000,
|
|
102
|
+
* maxScale: 0,
|
|
103
|
+
* symbol: { ... } // symbol definition
|
|
104
|
+
* }
|
|
105
|
+
* }),
|
|
106
|
+
* alternateSymbols: [
|
|
107
|
+
* // this symbol will be used when the view's scale is greater than 5,000,000
|
|
108
|
+
* new CIMSymbol({
|
|
109
|
+
* data: {
|
|
110
|
+
* type: "CIMSymbolReference",
|
|
111
|
+
* minScale: 0,
|
|
112
|
+
* maxScale: 5000000,
|
|
113
|
+
* symbol: { ... } // symbol definition
|
|
114
|
+
* }
|
|
115
|
+
* })
|
|
116
|
+
* }
|
|
117
|
+
* ]
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
46
120
|
get alternateSymbols(): CIMSymbol[] | null | undefined;
|
|
47
121
|
set alternateSymbols(value: CIMSymbolProperties[] | null | undefined);
|
|
48
122
|
/**
|
|
@@ -22,6 +22,12 @@ export interface UniqueValueClassProperties extends Partial<Pick<UniqueValueClas
|
|
|
22
22
|
/**
|
|
23
23
|
* Defines alternate CIM symbols used to represent features containing the given
|
|
24
24
|
* [values](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#values) at different scales.
|
|
25
|
+
* Each CIMSymbol provided must have a `minScale` or `maxScale` defined.
|
|
26
|
+
*
|
|
27
|
+
* > Alternate symbols are only supported in 2D.
|
|
28
|
+
* > To properly support scale-based symbology, the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#symbol) property should also be a [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) with a `minScale` or `maxScale` defined.
|
|
29
|
+
*
|
|
30
|
+
* @since 5.1
|
|
25
31
|
*/
|
|
26
32
|
alternateSymbols?: CIMSymbolProperties[] | null;
|
|
27
33
|
/**
|
|
@@ -105,6 +111,12 @@ export default class UniqueValueClass extends UniqueValueClassSuperclass {
|
|
|
105
111
|
/**
|
|
106
112
|
* Defines alternate CIM symbols used to represent features containing the given
|
|
107
113
|
* [values](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#values) at different scales.
|
|
114
|
+
* Each CIMSymbol provided must have a `minScale` or `maxScale` defined.
|
|
115
|
+
*
|
|
116
|
+
* > Alternate symbols are only supported in 2D.
|
|
117
|
+
* > To properly support scale-based symbology, the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#symbol) property should also be a [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) with a `minScale` or `maxScale` defined.
|
|
118
|
+
*
|
|
119
|
+
* @since 5.1
|
|
108
120
|
*/
|
|
109
121
|
get alternateSymbols(): CIMSymbol[] | null | undefined;
|
|
110
122
|
set alternateSymbols(value: CIMSymbolProperties[] | null | undefined);
|
|
@@ -17,8 +17,40 @@ import type { PictureFillSymbolProperties } from "../../symbols/PictureFillSymbo
|
|
|
17
17
|
|
|
18
18
|
export interface UniqueValueInfoProperties extends Partial<Pick<UniqueValueInfo, "label" | "value">> {
|
|
19
19
|
/**
|
|
20
|
-
* Defines alternate
|
|
21
|
-
* at different scales.
|
|
20
|
+
* Defines alternate [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/)s used to represent features with the provided [value](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#value)
|
|
21
|
+
* at different scales. The CIMSymbol provided must have a `minScale` or `maxScale` defined.
|
|
22
|
+
*
|
|
23
|
+
* > Alternate symbols are only supported in 2D.
|
|
24
|
+
* > To properly support scale-based symbology, the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#symbol) property should also be a [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) with a `minScale` or `maxScale` defined.
|
|
25
|
+
*
|
|
26
|
+
* @since 5.1
|
|
27
|
+
* @example
|
|
28
|
+
* ```js
|
|
29
|
+
* uniqueValueRenderer.uniqueValueInfos = [
|
|
30
|
+
* {
|
|
31
|
+
* value: "Interstate",
|
|
32
|
+
* // this symbol will be used when the view's scale is less than 5,000,000
|
|
33
|
+
* symbol: new CIMSymbol({
|
|
34
|
+
* data: {
|
|
35
|
+
* type: "CIMSymbolReference",
|
|
36
|
+
* minScale: 5000000,
|
|
37
|
+
* maxScale: 0,
|
|
38
|
+
* symbol: { ... } // symbol definition
|
|
39
|
+
* }
|
|
40
|
+
* }),
|
|
41
|
+
* alternateSymbols: [
|
|
42
|
+
* // this symbol will be used when the view's scale is greater than 5,000,000
|
|
43
|
+
* new CIMSymbol({
|
|
44
|
+
* data: {
|
|
45
|
+
* type: "CIMSymbolReference",
|
|
46
|
+
* minScale: 0,
|
|
47
|
+
* maxScale: 5000000,
|
|
48
|
+
* symbol: { ... } // symbol definition
|
|
49
|
+
* }
|
|
50
|
+
* })
|
|
51
|
+
* }
|
|
52
|
+
* ]
|
|
53
|
+
* ```
|
|
22
54
|
*/
|
|
23
55
|
alternateSymbols?: CIMSymbolProperties[] | null;
|
|
24
56
|
/**
|
|
@@ -48,8 +80,40 @@ export interface UniqueValueInfoProperties extends Partial<Pick<UniqueValueInfo,
|
|
|
48
80
|
export default class UniqueValueInfo extends JSONSupport {
|
|
49
81
|
constructor(properties?: UniqueValueInfoProperties);
|
|
50
82
|
/**
|
|
51
|
-
* Defines alternate
|
|
52
|
-
* at different scales.
|
|
83
|
+
* Defines alternate [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/)s used to represent features with the provided [value](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#value)
|
|
84
|
+
* at different scales. The CIMSymbol provided must have a `minScale` or `maxScale` defined.
|
|
85
|
+
*
|
|
86
|
+
* > Alternate symbols are only supported in 2D.
|
|
87
|
+
* > To properly support scale-based symbology, the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#symbol) property should also be a [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) with a `minScale` or `maxScale` defined.
|
|
88
|
+
*
|
|
89
|
+
* @since 5.1
|
|
90
|
+
* @example
|
|
91
|
+
* ```js
|
|
92
|
+
* uniqueValueRenderer.uniqueValueInfos = [
|
|
93
|
+
* {
|
|
94
|
+
* value: "Interstate",
|
|
95
|
+
* // this symbol will be used when the view's scale is less than 5,000,000
|
|
96
|
+
* symbol: new CIMSymbol({
|
|
97
|
+
* data: {
|
|
98
|
+
* type: "CIMSymbolReference",
|
|
99
|
+
* minScale: 5000000,
|
|
100
|
+
* maxScale: 0,
|
|
101
|
+
* symbol: { ... } // symbol definition
|
|
102
|
+
* }
|
|
103
|
+
* }),
|
|
104
|
+
* alternateSymbols: [
|
|
105
|
+
* // this symbol will be used when the view's scale is greater than 5,000,000
|
|
106
|
+
* new CIMSymbol({
|
|
107
|
+
* data: {
|
|
108
|
+
* type: "CIMSymbolReference",
|
|
109
|
+
* minScale: 0,
|
|
110
|
+
* maxScale: 5000000,
|
|
111
|
+
* symbol: { ... } // symbol definition
|
|
112
|
+
* }
|
|
113
|
+
* })
|
|
114
|
+
* }
|
|
115
|
+
* ]
|
|
116
|
+
* ```
|
|
53
117
|
*/
|
|
54
118
|
get alternateSymbols(): CIMSymbol[] | null | undefined;
|
|
55
119
|
set alternateSymbols(value: CIMSymbolProperties[] | null | undefined);
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const b="20260512",e="8370f586eda4a9f192e93a8db26eb805bb082cd1";export{b as buildDate,e as commitHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{loadFont as e}from"../../core/fontUtils.js";import{getImageData as t}from"../../core/imageUtils.js";class i{constructor(){this._resourceMap=new Map,this._inFlightResourceMap=new Map}destroy(){this._inFlightResourceMap.clear(),this._resourceMap.clear()}getResource(e){return this._resourceMap.get(e)??null}async fetchResource(e,i){const h=this._resourceMap.get(e);if(h)return{width:h.width,height:h.height};let r=this._inFlightResourceMap.get(e);return r?r.then(e=>({width:e.width,height:e.height})):(r=t(e,i),this._inFlightResourceMap.set(e,r),r.then(t=>(this._inFlightResourceMap.delete(e),this._resourceMap.set(e,t),{width:t.width,height:t.height}),()=>({width:0,height:0})))}deleteResource(e){this._inFlightResourceMap.delete(e),this._resourceMap.delete(e)}loadFont(t){return e(t)}}export{i as default};
|
|
2
|
+
import{loadFont as e}from"../../core/fontUtils.js";import{getImageData as t}from"../../core/imageUtils.js";class i{constructor(){this._resourceMap=new Map,this._inFlightResourceMap=new Map}destroy(){this._inFlightResourceMap.clear(),this._resourceMap.clear()}getResource(e){return this._resourceMap.get(e)??null}async fetchResource(e,i){const h=this._resourceMap.get(e);if(h)return{width:h.width,height:h.height};let r=this._inFlightResourceMap.get(e);return r?r.then(e=>({width:e.width,height:e.height})):(r=t(e,i),this._inFlightResourceMap.set(e,r),r.then(t=>(this._inFlightResourceMap.delete(e),this._resourceMap.set(e,t),{width:t.width,height:t.height}),()=>(this._inFlightResourceMap.delete(e),{width:0,height:0})))}deleteResource(e){this._inFlightResourceMap.delete(e),this._resourceMap.delete(e)}loadFont(t){return e(t)}}export{i as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{removeMaybe as t,abortMaybe as e}from"../../../../core/maybe.js";import{throwIfNotAbortError as s,throwIfAbortError as i,isAbortError as r,eachAlways as o}from"../../../../core/promiseUtils.js";import{addQueryParameters as n}from"../../../../core/urlUtils.js";import{open as a}from"../../../../core/workers.js";import l from"./SpriteMosaic.js";import c from"../webgl/GlyphMosaic.js";import h from"../webgl/GlyphSource.js";import u from"../../tiling/TileKey.js";class p{constructor(t,e,s,i){this._layer=t,this._styleRepository=e,this.devicePixelRatio=s,this._sourceDataMaxLOD=i,this._spriteMosaic=null,this._glyphMosaic=null,this._connection=null,this._spriteSourceAbortController=null,this._onClientConnectedHandle=null,this.type="TileHandler2D",this._startOptionsInputSignal=null,this._inputSignalEventListener=null}destroy(){this._onClientConnectedHandle=t(this._onClientConnectedHandle),this._connection?.close(),this._connection=null,this._styleRepository=null,this._layer=null,this._spriteMosaic?.destroy(),this._spriteMosaic=null,this._glyphMosaic=null,this._spriteSourceAbortController=e(this._spriteSourceAbortController),this._spriteSourcePromise=null,this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,this._inputSignalEventListener=null}get spriteMosaic(){return this._spriteSourcePromise.then(()=>this._spriteMosaic)}get glyphMosaic(){return this._glyphMosaic}async start(e){this._requestSprite(e);const i=this._layer.currentStyleInfo.glyphsUrl,r=new h(i?n(i,{...this._layer.customParameters,token:this._layer.apiKey}):"");this._onClientConnectedHandle=t(this._onClientConnectedHandle),this._glyphMosaic=new c(1024,1024,r,!0),this._broadcastPromise=a("WorkerTileHandler",{client:this,schedule:e.schedule,signal:e.signal}).then(t=>{if(this._layer&&(this._connection?.close(),this._connection=t,this._onClientConnectedHandle=t.onClientConnected(t=>{this._layer&&!this._connection.closed&&t.invoke("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD}).catch(t=>s(t))}),this._layer&&!this._connection.closed)){const e=t.broadcast("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD});Promise.all(e).catch(t=>s(t))}})}_requestSprite(t){this._spriteSourceAbortController?.abort();const e=new AbortController;this._spriteSourceAbortController=e;const s=t?.signal;this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,s&&(this._inputSignalEventListener=_(e),s.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:r}=e,o={...t,signal:r};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,o),this._spriteSourcePromise.then(t=>{i(r),this._spriteMosaic=new l(1024,1024,250),this._spriteMosaic.setSpriteSource(t)})}async updateStyle(t){const e=[];for(const s of t)4===s.type?e.push({type:4,data:{spriteSource:null}}):e.push(s);return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",e)),this._broadcastPromise}setSpriteSource(t){const e=new l(1024,1024,250);return e.setSpriteSource(t),this._spriteMosaic=e,this._spriteSourcePromise=Promise.resolve(t),this._spriteSourceAbortController=null,e}async setStyle(t,e,s){await this._broadcastPromise,this._styleRepository=t,this._sourceDataMaxLOD=s,this._requestSprite();const i=this._layer.currentStyleInfo.glyphsUrl,r=new h(i?n(i,{...this._layer.customParameters,token:this._layer.apiKey}):"");return this._glyphMosaic=new c(1024,1024,r,!0),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",{style:e,sourceDataMaxLOD:this._sourceDataMaxLOD})),this._broadcastPromise}async fetchTileData(t,e){const s=await this._getRefKeys(t,e);return this._getSourcesData(Object.keys(this._layer.sourceNameToSource),s,e)}async fetchTilePBFs(t){const e=Object.keys(this._layer.sourceNameToSource),s={},i=await this._getRefKeys(t,s),r=[],o=[];for(let n=0;n<i.length;n++)if(null==i[n].value||null==e[n])o.push(null);else{const t=i[n].value,a=this._getTilePayload(t,e[n],s);a.then(e=>{r.push({...e,key:t})}),o.push(a)}return Promise.all(o).then(()=>r)}async parseTileData(t,e){const s=t&&t.data;if(!s)return null;const{sourceName2DataAndRefKey:i,transferList:r}=s;return 0===Object.keys(i).length?null:this._broadcastPromise.then(()=>this._connection.invoke("createTileAndParse",{key:t.key.id,sourceName2DataAndRefKey:i,styleLayerUIDs:t.styleLayerUIDs},{...e,transferList:r}))}async getSprites(t){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(t)}async getGlyphs(t){return has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(t.font),this._glyphMosaic.getGlyphItemsVTL(t.font,t.codePoints)}async _getTilePayload(t,e,s){const i=u.pool.acquire(t.id),o=this._layer.sourceNameToSource[e],{level:n,row:a,col:l}=i;u.pool.release(i);try{return{protobuff:await o.requestTile(n,a,l,s),sourceName:e}}catch(c){if(r(c))throw c;return{protobuff:null,sourceName:e}}}async _getRefKeys(t,e){const s=this._layer.sourceNameToSource,i=new Array;for(const r in s){const o=s[r].getRefKey(t,e);i.push(o)}return o(i)}_getSourcesData(t,e,s){const i=[];for(let r=0;r<e.length;r++)if(null==e[r].value||null==t[r])i.push(null);else{const o=e[r].value,n=this._getTilePayload(o,t[r],s);i.push(n)}return o(i).then(t=>{const s={},i=[];for(let r=0;r<t.length;r++){const o=t[r].value;if(o&&(o.protobuff&&o.protobuff.byteLength>0)){const t=e[r].value.id;s[o.sourceName]={refKey:t,protobuff:o.protobuff},i.push(o.protobuff)}}return{sourceName2DataAndRefKey:s,transferList:i}})}}function _(t){return()=>t.abort()}export{p as TileHandler};
|
|
2
|
+
import has from"../../../../core/has.js";import{removeMaybe as t,abortMaybe as e}from"../../../../core/maybe.js";import{throwIfNotAbortError as s,throwIfAbortError as i,isAbortError as r,eachAlways as o}from"../../../../core/promiseUtils.js";import{addQueryParameters as n}from"../../../../core/urlUtils.js";import{open as a}from"../../../../core/workers.js";import l from"./SpriteMosaic.js";import c from"../webgl/GlyphMosaic.js";import h from"../webgl/GlyphSource.js";import u from"../../tiling/TileKey.js";class p{constructor(t,e,s,i){this._layer=t,this._styleRepository=e,this.devicePixelRatio=s,this._sourceDataMaxLOD=i,this._spriteMosaic=null,this._glyphMosaic=null,this._connection=null,this._spriteSourceAbortController=null,this._onClientConnectedHandle=null,this.type="TileHandler2D",this._startOptionsInputSignal=null,this._inputSignalEventListener=null}destroy(){this._onClientConnectedHandle=t(this._onClientConnectedHandle),this._connection?.close(),this._connection=null,this._styleRepository=null,this._layer=null,this._spriteMosaic?.destroy(),this._spriteMosaic=null,this._glyphMosaic=null,this._spriteSourceAbortController=e(this._spriteSourceAbortController),this._spriteSourcePromise=null,this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,this._inputSignalEventListener=null}get spriteMosaic(){return this._spriteSourcePromise.then(()=>this._spriteMosaic)}get glyphMosaic(){return this._glyphMosaic}async start(e){this._requestSprite(e);const i=this._layer.currentStyleInfo.glyphsUrl,r=new h(i?n(i,{...this._layer.customParameters,token:this._layer.apiKey}):"");this._onClientConnectedHandle=t(this._onClientConnectedHandle),this._glyphMosaic=new c(1024,1024,r,!0),this._broadcastPromise=a("WorkerTileHandler",{client:this,schedule:e.schedule,signal:e.signal}).then(t=>{if(this._layer&&(this._connection?.close(),this._connection=t,this._onClientConnectedHandle=t.onClientConnected(t=>{this._layer&&!this._connection.closed&&t.invoke("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD}).catch(t=>s(t))}),this._layer&&!this._connection.closed)){const e=t.broadcast("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD});Promise.all(e).catch(t=>s(t))}})}_requestSprite(t){this._spriteSourceAbortController?.abort();const e=new AbortController;this._spriteSourceAbortController=e;const s=t?.signal;this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,s&&(this._inputSignalEventListener=_(e),s.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:r}=e,o={...t,signal:r};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,o),this._spriteSourcePromise.then(t=>{i(r),this._spriteMosaic=new l(1024,1024,250),this._spriteMosaic.setSpriteSource(t)})}async updateStyle(t){const e=[];for(const s of t)4===s.type?e.push({type:4,data:{spriteSource:null}}):e.push(s);return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",e)),this._broadcastPromise}setSpriteSource(t){const e=new l(1024,1024,250);return e.setSpriteSource(t),this._spriteMosaic=e,this._spriteSourcePromise=Promise.resolve(t),this._spriteSourceAbortController=null,e}async setStyle(t,e,s){await this._broadcastPromise,this._styleRepository=t,this._sourceDataMaxLOD=s,this._requestSprite();const i=this._layer.currentStyleInfo.glyphsUrl,r=new h(i?n(i,{...this._layer.customParameters,token:this._layer.apiKey}):"");return this._glyphMosaic=new c(1024,1024,r,!0),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",{style:e,sourceDataMaxLOD:this._sourceDataMaxLOD})),this._broadcastPromise}async fetchTileData(t,e){const s=await this._getRefKeys(t,e);return this._getSourcesData(Object.keys(this._layer.sourceNameToSource),s,e)}async fetchTilePBFs(t){const e=Object.keys(this._layer.sourceNameToSource),s={},i=await this._getRefKeys(t,s),r=[],o=[];for(let n=0;n<i.length;n++)if(null==i[n].value||null==e[n])o.push(null);else{const t=i[n].value,a=this._getTilePayload(t,e[n],s);a.then(e=>{r.push({...e,key:t})}),o.push(a)}return Promise.all(o).then(()=>r)}async parseTileData(t,e){const s=t&&t.data;if(!s)return null;const{sourceName2DataAndRefKey:i,transferList:r}=s;return 0===Object.keys(i).length?null:this._broadcastPromise.then(()=>this._connection.invoke("createTileAndParse",{key:t.key.id,sourceName2DataAndRefKey:i,styleLayerUIDs:t.styleLayerUIDs},{...e,transferList:r}))}async getSprites(t){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(t)}async getGlyphs(t){return has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(t.font).catch(()=>{}),this._glyphMosaic.getGlyphItemsVTL(t.font,t.codePoints)}async _getTilePayload(t,e,s){const i=u.pool.acquire(t.id),o=this._layer.sourceNameToSource[e],{level:n,row:a,col:l}=i;u.pool.release(i);try{return{protobuff:await o.requestTile(n,a,l,s),sourceName:e}}catch(c){if(r(c))throw c;return{protobuff:null,sourceName:e}}}async _getRefKeys(t,e){const s=this._layer.sourceNameToSource,i=new Array;for(const r in s){const o=s[r].getRefKey(t,e);i.push(o)}return o(i)}_getSourcesData(t,e,s){const i=[];for(let r=0;r<e.length;r++)if(null==e[r].value||null==t[r])i.push(null);else{const o=e[r].value,n=this._getTilePayload(o,t[r],s);i.push(n)}return o(i).then(t=>{const s={},i=[];for(let r=0;r<t.length;r++){const o=t[r].value;if(o&&(o.protobuff&&o.protobuff.byteLength>0)){const t=e[r].value.id;s[o.sourceName]={refKey:t,protobuff:o.protobuff},i.push(o.protobuff)}}return{sourceName2DataAndRefKey:s,transferList:i}})}}function _(t){return()=>t.abort()}export{p as TileHandler};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import has from"../../../../core/has.js";import{throwIfNotAbortError as s}from"../../../../core/promiseUtils.js";import{loadTextModule as i}from"../../../../libs/text/loadTextModule.js";import{sdfRadiusComplex as h,sdfBufferGlyphSDFCreator as a,sdfSizeComplex as r,sdfBufferServer as n,sdfRadiusSimple as o,sdfSizeSimple as c}from"./definitions.js";import{GlyphSDFCreator as l}from"./GlyphSDFCreator.js";import g from"./Rect.js";import p from"./RectangleBinPack.js";import{charCodes as d}from"./Utils.js";import _ from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";const u=256,y=.25,m=t=>Math.floor(t/256);function w(t){const e=new Set;for(const s of t)e.add(m(s));return e}function x(t,e,i){return t.has(e)||t.set(e,i().then(()=>{t.delete(e)}).catch(i=>{t.delete(e),s(i)})),t.get(e)}const C=t=>({mosaicItem:{rect:new g(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:t});class I{constructor(t,e,s,i=!1){this._snapCoords=i,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._glyphCache={},this._glyphCacheById={},this._textures=[],this._rangePromises=new Map,this._facePromises=new Map,this._preloadCache={},this._glyphSDFCreator=new l({sdfSizePx:r,sdfBufferPx:a,radius:h,cutoff:y}),this._faces=new Map,this.width=t,this.height=e,this._glyphSource=s,this._binPack=new p(t,e),this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],s=[];for(let r=0;r<t.length;r++){const i=t[r];for(let t=0;t<11;t++){const h=r>=3&&r<5&&t>=3&&t<8?255:0;e.push(i),s.push(h)}}const i={width:5,height:2,left:0,top:0,advance:0},h=new Uint8Array(e),a=new Uint8Array(s);this._recordGlyph(i,h,n),this._recordGlyph(i,a,n)}getTexture(t,e){if(!this._textures[e]){const s=new f(this.width,this.height);s.pixelFormat=6406,s.wrapMode=33071,this._textures[e]=new _(t,s,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,s,i,l){const g=s?r:c,p=s?h:o,_=s?a:n;let f,u=[],y=!1;if(s){const s=this._getGlyphCacheById(i),h=await this.getFace(i);if(!h)return null;const a=this._glyphSDFCreator.sdfSizePx,[r,n,o]=e(t,!1);y=n;const c=new Uint32Array(Array.from(r).map((t,e)=>o.levels[o.targetToSource[e]]));f={baseline:h.baseline()/a,midline:h.midline()/a},u=h.shape(r,c,a).map(t=>this._getMosaicItemComplex(s,t,h))}else{const[s,h,a]=e(t);y=h;const r=this._getGlyphCache(i),n=d(s);try{await this._fetchRanges(i,n,l)}catch{return null}for(const t of n){const e=this._getMosaicItem(r,i,t);e&&u.push(e)}}return{type:"glyphs",isRightToLeft:y,glyphs:u,faceInfo:f,sdfSize:g,sdfRadius:p,sdfPadding:_}}async getGlyphItemsVTL(t,e){const s=this._getGlyphCache(t);await this._fetchRanges(t,e,null);const i=[];for(const h of e){const e=this._getMosaicItem(s,t,h,!0);e&&(i[h]=e)}return i}async getFace(e){if(this._faces.has(e))return this._faces.get(e);const s=this._glyphSource.woffURL(e);return await x(this._facePromises,e,async()=>{const h=await t(s,{responseType:"array-buffer"}),a=(await i()).Face.parseWoff2(new Uint8Array(h.data));this._faces.set(e,a)}),this._faces.get(e)}_getMosaicItem(t,e,s,i=!1){if(!t[s]){const h=this._glyphSource.getRange(e,s),a=h?.getRect(s),r=h?.getShaping(s),o=h?.getBitmap(s);if(i&&(!a||!r))return;if(!a||!r)return C(s);const c=o?this._recordGlyph(a,o,n):new g(0,0,0,0),l=this._currentPage;t[s]={mosaicItem:{rect:c,sdf:!0,page:l},rect:a,shaping:r,code:s},this._invalidate()}return t[s]}_getMosaicItemComplex(t,e,s){if(!t[e.glyphId]){const i=this._glyphSDFCreator.draw(s,e.glyphId),h=i??{width:0,height:0,top:0,left:0},r=i?this._recordGlyph(h,i.buffer,a):new g(0,0,0,0),n=e.isNewline?10:e.isWhitespace?32:NaN,o={rect:r,sdf:!0,page:this._currentPage};t[e.glyphId]={mosaicItem:o,rect:h,shaping:void 0,code:n},this._invalidate()}return{...t[e.glyphId],shaping:{xOffset:e.xOffset,yOffset:e.yOffset,xAdvance:e.xAdvance,yAdvance:e.yAdvance}}}bind(t,e,s,i){const h=this.getTexture(t,s);h.setSamplingMode(e),t.bindTexture(h,i)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const s=this._glyphSource.preloadASCIIRange(t).then(()=>{const e=this._getGlyphCache(t);for(let s=0;s<256;s++)this._getMosaicItem(e,t,s)});return this._preloadCache[t]=s,s}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getGlyphCacheById(t){return this._glyphCacheById[t]||(this._glyphCacheById[t]={}),this._glyphCacheById[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,s){const i=w(e),h=[];i.forEach(e=>{h.push(this._fetchRange(t,e,s))}),await Promise.all(h)}async _fetchRange(t,e,s){if(e>u)return;const i=t+e;return x(this._rangePromises,i,()=>this._glyphSource.fetchRange(t,e,s))}_allocNewPage(){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=this._pageData.length,this._pageData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new p(this.width,this.height)}_recordGlyph(t,e,s){let i;if(0===t.width)i=new g(0,0,0,0);else{const h=t.width+2*s,a=t.height+2*s;let r=h,n=a;if(this._snapCoords){r+=h%4?4-h%4:4,n+=a%4?4-a%4:4}i=this._binPack.allocate(r,n),i.isEmpty&&(this._allocNewPage(),i=this._binPack.allocate(r,n));const o=this._pageData[this._currentPage];for(let t=0;t<a;t++){const s=h*t,a=this.width*(i.y+t)+i.x;for(let t=0;t<h;t++)o[a+t]=e[s+t]}has("esri-glyph-debug")&&this._showDebugPage(o)}return i}_showDebugPage(t){const e=document.createElement("canvas"),s=e.getContext("2d"),i=new ImageData(this.width,this.height),h=i.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let a=0;a<t.length;++a)h[4*a]=t[a],h[4*a+1]=0,h[4*a+2]=0,h[4*a+3]=255;s.putImageData(i,0,0),document.body.appendChild(e)}}export{I as default};
|
|
2
|
+
import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import has from"../../../../core/has.js";import{throwIfNotAbortError as s}from"../../../../core/promiseUtils.js";import{loadTextModule as i}from"../../../../libs/text/loadTextModule.js";import{sdfRadiusComplex as h,sdfBufferGlyphSDFCreator as a,sdfSizeComplex as r,sdfBufferServer as n,sdfRadiusSimple as o,sdfSizeSimple as c}from"./definitions.js";import{GlyphSDFCreator as l}from"./GlyphSDFCreator.js";import g from"./Rect.js";import p from"./RectangleBinPack.js";import{charCodes as d}from"./Utils.js";import _ from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";const u=256,y=.25,m=t=>Math.floor(t/256);function w(t){const e=new Set;for(const s of t)e.add(m(s));return e}function x(t,e,i){return t.has(e)||t.set(e,i().then(()=>{t.delete(e)}).catch(i=>{t.delete(e),s(i)})),t.get(e)}const C=t=>({mosaicItem:{rect:new g(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:t});class I{constructor(t,e,s,i=!1){this._snapCoords=i,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._glyphCache={},this._glyphCacheById={},this._textures=[],this._rangePromises=new Map,this._facePromises=new Map,this._preloadCache={},this._glyphSDFCreator=new l({sdfSizePx:r,sdfBufferPx:a,radius:h,cutoff:y}),this._faces=new Map,this.width=t,this.height=e,this._glyphSource=s,this._binPack=new p(t,e),this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],s=[];for(let r=0;r<t.length;r++){const i=t[r];for(let t=0;t<11;t++){const h=r>=3&&r<5&&t>=3&&t<8?255:0;e.push(i),s.push(h)}}const i={width:5,height:2,left:0,top:0,advance:0},h=new Uint8Array(e),a=new Uint8Array(s);this._recordGlyph(i,h,n),this._recordGlyph(i,a,n)}getTexture(t,e){if(!this._textures[e]){const s=new f(this.width,this.height);s.pixelFormat=6406,s.wrapMode=33071,this._textures[e]=new _(t,s,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,s,i,l){const g=s?r:c,p=s?h:o,_=s?a:n;let f,u=[],y=!1;if(s){const s=this._getGlyphCacheById(i),h=await this.getFace(i);if(!h)return null;const a=this._glyphSDFCreator.sdfSizePx,[r,n,o]=e(t,!1);y=n;const c=new Uint32Array(Array.from(r).map((t,e)=>o.levels[o.targetToSource[e]]));f={baseline:h.baseline()/a,midline:h.midline()/a},u=h.shape(r,c,a).map(t=>this._getMosaicItemComplex(s,t,h))}else{const[s,h,a]=e(t);y=h;const r=this._getGlyphCache(i),n=d(s);try{await this._fetchRanges(i,n,l)}catch{return null}for(const t of n){const e=this._getMosaicItem(r,i,t);e&&u.push(e)}}return{type:"glyphs",isRightToLeft:y,glyphs:u,faceInfo:f,sdfSize:g,sdfRadius:p,sdfPadding:_}}async getGlyphItemsVTL(t,e){const s=this._getGlyphCache(t);await this._fetchRanges(t,e,null);const i=[];for(const h of e){const e=this._getMosaicItem(s,t,h,!0);e&&(i[h]=e)}return i}async getFace(e){if(this._faces.has(e))return this._faces.get(e);const s=this._glyphSource.woffURL(e);return await x(this._facePromises,e,async()=>{const h=await t(s,{responseType:"array-buffer"}),a=(await i()).Face.parseWoff2(new Uint8Array(h.data));this._faces.set(e,a)}),this._faces.get(e)}_getMosaicItem(t,e,s,i=!1){if(!t[s]){const h=this._glyphSource.getRange(e,s),a=h?.getRect(s),r=h?.getShaping(s),o=h?.getBitmap(s);if(i&&(!a||!r))return;if(!a||!r)return C(s);const c=o?this._recordGlyph(a,o,n):new g(0,0,0,0),l=this._currentPage;t[s]={mosaicItem:{rect:c,sdf:!0,page:l},rect:a,shaping:r,code:s},this._invalidate()}return t[s]}_getMosaicItemComplex(t,e,s){if(!t[e.glyphId]){const i=this._glyphSDFCreator.draw(s,e.glyphId),h=i??{width:0,height:0,top:0,left:0},r=i?this._recordGlyph(h,i.buffer,a):new g(0,0,0,0),n=e.isNewline?10:e.isWhitespace?32:NaN,o={rect:r,sdf:!0,page:this._currentPage};t[e.glyphId]={mosaicItem:o,rect:h,shaping:void 0,code:n},this._invalidate()}return{...t[e.glyphId],shaping:{xOffset:e.xOffset,yOffset:e.yOffset,xAdvance:e.xAdvance,yAdvance:e.yAdvance}}}bind(t,e,s,i){const h=this.getTexture(t,s);h.setSamplingMode(e),t.bindTexture(h,i)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const s=this._glyphSource.preloadASCIIRange(t).then(()=>{const e=this._getGlyphCache(t);for(let s=0;s<256;s++)this._getMosaicItem(e,t,s)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=s,s}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getGlyphCacheById(t){return this._glyphCacheById[t]||(this._glyphCacheById[t]={}),this._glyphCacheById[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,s){const i=w(e),h=[];i.forEach(e=>{h.push(this._fetchRange(t,e,s))}),await Promise.all(h)}async _fetchRange(t,e,s){if(e>u)return;const i=t+e;return x(this._rangePromises,i,()=>this._glyphSource.fetchRange(t,e,s))}_allocNewPage(){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=this._pageData.length,this._pageData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new p(this.width,this.height)}_recordGlyph(t,e,s){let i;if(0===t.width)i=new g(0,0,0,0);else{const h=t.width+2*s,a=t.height+2*s;let r=h,n=a;if(this._snapCoords){r+=h%4?4-h%4:4,n+=a%4?4-a%4:4}i=this._binPack.allocate(r,n),i.isEmpty&&(this._allocNewPage(),i=this._binPack.allocate(r,n));const o=this._pageData[this._currentPage];for(let t=0;t<a;t++){const s=h*t,a=this.width*(i.y+t)+i.x;for(let t=0;t<h;t++)o[a+t]=e[s+t]}has("esri-glyph-debug")&&this._showDebugPage(o)}return i}_showDebugPage(t){const e=document.createElement("canvas"),s=e.getContext("2d"),i=new ImageData(this.width,this.height),h=i.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let a=0;a<t.length;++a)h[4*a]=t[a],h[4*a+1]=0,h[4*a+2]=0,h[4*a+3]=255;s.putImageData(i,0,0),document.body.appendChild(e)}}export{I as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as d,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f}from"./definitions.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import _ from"./Rect.js";import I from"./SDFConverter.js";import w from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as S}from"./urlUtils.js";import{getCIMMarkerPlacementHash as z,isSVGImage as T}from"./Utils.js";import{AnimatableTextureResource as C}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as R}from"./animations/store/AnimationStore.js";const x="arial-unicode-ms-regular",b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),$=()=>s.getLogger("esri.views.MapView"),v=(e,t,r)=>$().error(new i(e,t,r)),j=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class A{constructor(r){this._requestRender=r,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new I(d),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{a(r);try{return await t(e,{responseType:"image",signal:r})}catch(s){if(!n(s))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new R,this._spriteMosaic=new w(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return v("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new _(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return v("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t.mosaicItem);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{texture:r.texture,unit:"sprite"===r.type?g:f}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return v("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:s}=e,a=r(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping"),c=!!has("esri-2d-complex-shaping")&&b.test(s),h=P.has(i.family),l=o||c||h,u=n?x:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(u);let p=await this._glyphMosaic.getGlyphItems(s,l,u,t);return p||(j(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),p=await this._glyphMosaic.getGlyphItems(s,l,x,t)),p}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${z(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(S(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},F(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[d,d],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},F(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new C(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(N(s)||O(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(T(s))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},F(e),u,!1)}catch(v){if(!n(v))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${v.message}`);throw v}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),N=e=>e&&(e.includes(".gif")||G(e)),B=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||B(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
|
|
2
|
+
import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as d,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f}from"./definitions.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import _ from"./Rect.js";import I from"./SDFConverter.js";import w from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as S}from"./urlUtils.js";import{getCIMMarkerPlacementHash as z,isSVGImage as T}from"./Utils.js";import{AnimatableTextureResource as C}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as R}from"./animations/store/AnimationStore.js";const x="arial-unicode-ms-regular",b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),$=()=>s.getLogger("esri.views.MapView"),v=(e,t,r)=>$().error(new i(e,t,r)),j=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class A{constructor(r){this._requestRender=r,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new I(d),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{a(r);try{return await t(e,{responseType:"image",signal:r})}catch(s){if(!n(s))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new R,this._spriteMosaic=new w(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return v("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new _(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return v("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t.mosaicItem);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{texture:r.texture,unit:"sprite"===r.type?g:f}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return v("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:s}=e,a=r(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping"),c=!!has("esri-2d-complex-shaping")&&b.test(s),h=P.has(i.family),l=o||c||h,u=n?x:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(u).catch(()=>{});let p=await this._glyphMosaic.getGlyphItems(s,l,u,t);return p||(j(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),p=await this._glyphMosaic.getGlyphItems(s,l,x,t)),p}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${z(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(S(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},F(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[d,d],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},F(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new C(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(N(s)||O(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(T(s))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},F(e),u,!1)}catch(v){if(!n(v))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${v.message}`);throw v}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),N=e=>e&&(e.includes(".gif")||G(e)),B=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||B(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
|