@arcgis/core 4.34.0-next.3 → 4.34.0-next.5

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.
Files changed (42) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/22e53cb1c8c575fa4d46.js +1 -0
  3. package/assets/esri/core/workers/chunks/{b70f65ccee01d48a610e.js → f840e1655c4f6b6630be.js} +19 -19
  4. package/config.js +1 -1
  5. package/kernel.js +1 -1
  6. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  7. package/package.json +1 -1
  8. package/support/revision.js +1 -1
  9. package/views/2d/engine/Bitmap.js +1 -1
  10. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  11. package/views/2d/engine/vectorTiles/GlyphMosaic.js +1 -1
  12. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  13. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  14. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  15. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  16. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  17. package/views/2d/engine/webgl/Overlay.js +1 -1
  18. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  19. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  20. package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
  21. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  22. package/views/2d/engine/webgl/effects/post-processing/Colorize.js +1 -1
  23. package/views/2d/engine/webgl/effects/post-processing/DropShadow.js +1 -1
  24. package/views/2d/engine/webgl/effects/post-processing/Opacity.js +1 -1
  25. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  26. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  27. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  28. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  29. package/views/3d/environment/LocalAtmosphere.js +1 -1
  30. package/views/3d/environment/MarsAtmosphere.js +1 -1
  31. package/views/3d/layers/DrapedSubView3D.js +1 -1
  32. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  33. package/views/3d/layers/SubView3D.js +1 -1
  34. package/views/3d/support/engineContent/marker.js +1 -1
  35. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  36. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  37. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  38. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  39. package/views/support/imageReprojection.js +1 -1
  40. package/views/webgl/Texture.js +1 -1
  41. package/views/webgl/rasterUtils.js +1 -1
  42. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +0 -1
package/config.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.34/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.34.0-next.3";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.34.0-next.5";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/kernel.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.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.3",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.5",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as i}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as p}from"../../core/accessorSupport/PropertyOrigin.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import u from"../../geometry/Polygon.js";import m from"../../geometry/Polyline.js";import{initializeProjection as d,project as h}from"../../geometry/projectionUtils.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as f}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import j from"../Layer.js";import b from"../graphics/data/FeatureStore.js";import{QueryEngine as w}from"../graphics/data/QueryEngine.js";import{createCapabilities as T,createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as S,systemAggregationCountFieldName as v,systemIsSpatialFieldName as O,systemLayoutGeometryFieldName as E,systemOriginIdFieldName as x,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as L}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as F,getLinkChartDefaultLabelingInfo as _,getMapDefaultLabelingInfo as R,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as C}from"./layerUtils.js";import{BlendLayer as M,blendModeProperty as k,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as D,displayFilterEnabledProperty as P,displayFilterInfoProperty as q}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as G,featureEffectProperty as U}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as A}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as B}from"../mixins/OrderedLayer.js";import{RefreshableLayer as V}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as K}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as W,useViewTimeProperty as Y}from"../mixins/TemporalLayer.js";import{legendEnabled as z,maxScale as H,minScale as X,opacity as $,popupEnabled as ee}from"../support/commonProperties.js";import{featureReductionProperty as te}from"../support/featureReductionUtils.js";import re from"../support/Field.js";import{fixRendererFields as oe,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import ne from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ae from"../support/TimeInfo.js";import pe from"../../renderers/SimpleRenderer.js";import{fromJSON as le}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ye}from"../../renderers/support/typeUtils.js";import ue from"../../rest/support/FeatureSet.js";import me from"../../rest/support/Query.js";import{createPopupTemplate as de}from"../../support/popupUtils.js";import{applyColorToSymbol as he}from"../../symbols/support/utils.js";import ce from"../../core/workers/RemoteClient.js";function fe(e){if(!e.json)return e;e.json.write=ge(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ge(e.write))}return e}function ge(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=je(e)),e):!0===e?be():e}function je(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=we.call(this,e,t);return r.enabled?{...i,...r}:r}}function be(){return{overridePolicy:we}}function we(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...Te.call(this,e,t)}),o}function Te(e,t){return{ignoreOrigin:this.originIdOf(t)>p.DEFAULTS}}let Ie=class extends(L(D(A(G(M(Z(W(K(V(i(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=T(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=S,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new ce(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=me.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(re.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(re.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),re.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),re.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return E;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");const e=this.objectType.properties?F(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?_(this.graphType,this.graphTypeName,e):R(this.graphTypeName,this.geometryType,e)}set renderer(e){oe(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map((e=>e.name)).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new pe({type:"simple",symbol:C(r)});const e=le(I(g.toJSON("point")).renderer);return he(e.symbol,r),e}const o=le(I(g.toJSON(this.geometryType)).renderer);return he(o.symbol,r),o}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return de(this,e)}createQuery(){return new me({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=ue.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new l(n.extent):new l,{count:n.count,extent:s}}async queryObjectIds(e,t){await this.load();const r=me.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return await o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new b({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new w({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new me({where:"1=1",outFields:[S]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then((()=>ie(this.timeInfo,this.fieldsIndex)))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=me.from(e),o=r.geometry;if(o&&!o.spatialReference?.isWGS84&&(await d(o.spatialReference,f),r.geometry=h(o instanceof u||o instanceof m||o instanceof y?o:o.extent,f)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const i=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(i)}}};function Se(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",E]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(n){o.getLogger(this).warn("Error updating labelingInfo",n)}return se(e,t,r)}e([n(fe(r(k)))],Ie.prototype,"blendMode",void 0),e([n()],Ie.prototype,"capabilities",void 0),e([n({json:{origins:{"web-scene":{write:!1}},write:be()}})],Ie.prototype,"charts",void 0),e([n({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ie.prototype,"definitionExpression",void 0),e([n()],Ie.prototype,"displayField",void 0),e([n(fe(r(P)))],Ie.prototype,"displayFilterEnabled",void 0),e([n(fe(r(q)))],Ie.prototype,"displayFilterInfo",void 0),e([n(fe(r(J)))],Ie.prototype,"effect",void 0),e([n()],Ie.prototype,"elevationInfo",void 0),e([n(fe(r(U)))],Ie.prototype,"featureEffect",void 0),e([n(fe(r(te)))],Ie.prototype,"featureReduction",null),e([n()],Ie.prototype,"fields",null),e([n()],Ie.prototype,"geometryType",null),e([n()],Ie.prototype,"geometryFieldName",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphTypeName",null),e([n()],Ie.prototype,"hasM",null),e([n()],Ie.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ie.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ie.prototype,"labelsVisible",void 0),e([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Se,write:be()}})],Ie.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"layerType",void 0),e([n(fe(r(z)))],Ie.prototype,"legendEnabled",void 0),e([n(fe(r(H)))],Ie.prototype,"maxScale",void 0),e([n(fe(r(X)))],Ie.prototype,"minScale",void 0),e([n()],Ie.prototype,"objectIdField",void 0),e([n()],Ie.prototype,"objectType",void 0),e([n(fe(r($)))],Ie.prototype,"opacity",void 0),e([n(fe(r(B)))],Ie.prototype,"orderBy",void 0),e([n({clonable:!1})],Ie.prototype,"parent",void 0),e([n()],Ie.prototype,"parentCompositeLayer",void 0),e([n(fe(r(ee)))],Ie.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ie.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Te}}})],Ie.prototype,"refreshInterval",void 0),e([n({types:ye,json:{name:"layerDefinition.drawingInfo.renderer",write:be()}})],Ie.prototype,"renderer",null),e([n()],Ie.prototype,"source",void 0),e([n()],Ie.prototype,"spatialReference",null),e([n({type:ae,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Ie.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"title",null),e([a("title")],Ie.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ie.prototype,"type",void 0),e([n(fe(r(Y)))],Ie.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:be()}})],Ie.prototype,"visible",void 0),Ie=e([s("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ie);export{Ie as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import i from"../../core/Logger.js";import{MultiOriginJSONMixin as o}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as p}from"../../core/accessorSupport/PropertyOrigin.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import u from"../../geometry/Polygon.js";import m from"../../geometry/Polyline.js";import{initializeProjection as d,project as h}from"../../geometry/projectionUtils.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as f}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import j from"../Layer.js";import b from"../graphics/data/FeatureStore.js";import{QueryEngine as w}from"../graphics/data/QueryEngine.js";import{createCapabilities as T,createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as S,systemAggregationCountFieldName as v,systemIsSpatialFieldName as O,systemLayoutGeometryFieldName as E,systemOriginIdFieldName as x,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as L}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as F,getLinkChartDefaultLabelingInfo as _,getMapDefaultLabelingInfo as R,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as C}from"./layerUtils.js";import{BlendLayer as M,blendModeProperty as k,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as D,displayFilterEnabledProperty as P,displayFilterInfoProperty as q}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as G,featureEffectProperty as U}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as A}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as B}from"../mixins/OrderedLayer.js";import{RefreshableLayer as V}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as K}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as W,useViewTimeProperty as Y}from"../mixins/TemporalLayer.js";import{legendEnabled as z,maxScale as H,minScale as X,opacity as $,popupEnabled as ee}from"../support/commonProperties.js";import{featureReductionProperty as te}from"../support/featureReductionUtils.js";import re from"../support/Field.js";import{fixRendererFields as ie,fixTimeInfoFields as oe}from"../support/fieldUtils.js";import se from"../support/LabelClass.js";import{reader as ne}from"../support/labelingInfo.js";import ae from"../support/TimeInfo.js";import pe from"../../renderers/SimpleRenderer.js";import{fromJSON as le}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ye}from"../../renderers/support/typeUtils.js";import ue from"../../rest/support/FeatureSet.js";import me from"../../rest/support/Query.js";import{createPopupTemplate as de}from"../../support/popupUtils.js";import{applyColorToSymbol as he}from"../../symbols/support/utils.js";import ce from"../../core/workers/RemoteClient.js";function fe(e){if(!e.json)return e;e.json.write=ge(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ge(e.write))}return e}function ge(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=je(e)),e):!0===e?be():e}function je(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=we.call(this,e,t);return r.enabled?{...o,...r}:r}}function be(){return{overridePolicy:we}}function we(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,...Te.call(this,e,t)}),i}function Te(e,t){return{ignoreOrigin:this.originIdOf(t)>p.DEFAULTS}}let Ie=class extends(L(D(A(G(M(Z(W(K(V(o(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=T(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=S,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new ce(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=me.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(re.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(re.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),re.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),re.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return E;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?F(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?_(this.graphType,this.graphTypeName,e):R(this.graphTypeName,this.geometryType,e)}set renderer(e){ie(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map((e=>e.name)).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new pe({type:"simple",symbol:C(r)});const e=le(I(g.toJSON("point")).renderer);return he(e.symbol,r),e}const i=le(I(g.toJSON(this.geometryType)).renderer);return he(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return de(this,e)}createQuery(){return new me({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=ue.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return o.features.forEach((e=>{e.sourceLayer=this})),o}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new l(s.extent):new l,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=me.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new b({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new w({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new me({where:"1=1",outFields:[S]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then((()=>oe(this.timeInfo,this.fieldsIndex)))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=me.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await d(i.spatialReference,f),r.geometry=h(i instanceof u||i instanceof m||i instanceof y?i:i.extent,f)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function Se(e,t,r){const o=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",E]];try{for(const t of e)for(const[e,r]of o)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){i.getLogger(this).warn("Error updating labelingInfo",s)}return ne(e,t,r)}e([s(fe(r(k)))],Ie.prototype,"blendMode",void 0),e([s()],Ie.prototype,"capabilities",void 0),e([s({json:{origins:{"web-scene":{write:!1}},write:be()}})],Ie.prototype,"charts",void 0),e([s({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ie.prototype,"definitionExpression",void 0),e([s()],Ie.prototype,"displayField",void 0),e([s(fe(r(P)))],Ie.prototype,"displayFilterEnabled",void 0),e([s(fe(r(q)))],Ie.prototype,"displayFilterInfo",void 0),e([s(fe(r(J)))],Ie.prototype,"effect",void 0),e([s()],Ie.prototype,"elevationInfo",void 0),e([s(fe(r(U)))],Ie.prototype,"featureEffect",void 0),e([s(fe(r(te)))],Ie.prototype,"featureReduction",null),e([s()],Ie.prototype,"fields",null),e([s()],Ie.prototype,"geometryType",null),e([s()],Ie.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphTypeName",null),e([s()],Ie.prototype,"hasM",null),e([s()],Ie.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ie.prototype,"id",void 0),e([s({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ie.prototype,"labelsVisible",void 0),e([s({type:[se],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:Se,write:be()}})],Ie.prototype,"labelingInfo",null),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"layerType",void 0),e([s(fe(r(z)))],Ie.prototype,"legendEnabled",void 0),e([s(fe(r(H)))],Ie.prototype,"maxScale",void 0),e([s(fe(r(X)))],Ie.prototype,"minScale",void 0),e([s()],Ie.prototype,"objectIdField",void 0),e([s()],Ie.prototype,"objectType",void 0),e([s(fe(r($)))],Ie.prototype,"opacity",void 0),e([s(fe(r(B)))],Ie.prototype,"orderBy",void 0),e([s({clonable:!1})],Ie.prototype,"parent",void 0),e([s()],Ie.prototype,"parentCompositeLayer",void 0),e([s(fe(r(ee)))],Ie.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ie.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:Te}}})],Ie.prototype,"refreshInterval",void 0),e([s({types:ye,json:{name:"layerDefinition.drawingInfo.renderer",write:be()}})],Ie.prototype,"renderer",null),e([s()],Ie.prototype,"source",void 0),e([s()],Ie.prototype,"spatialReference",null),e([s({type:ae,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Ie.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"title",null),e([a("title")],Ie.prototype,"writeTitle",null),e([s({json:{read:!1}})],Ie.prototype,"type",void 0),e([s(fe(r(Y)))],Ie.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:be()}})],Ie.prototype,"visible",void 0),Ie=e([n("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ie);export{Ie as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.3",
3
+ "version": "4.34.0-next.5",
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": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const c="20250524",f="3a941c093c98f1660c3cbf4dfdb8c15ff89f7795";export{c as buildDate,f as commitHash};
5
+ const c="20250529",d="f5bcc793179cdffd181db187dc16be953acd2511";export{c as buildDate,d as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{createResolver as t,onAbortOrThrow as e,throwIfNotAbortError as i}from"../../../core/promiseUtils.js";import{identity as s,translate as r,rotate as h,scaleByVec2 as o,multiply as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as l}from"./DisplayObject.js";import d from"./ImageryBitmapSource.js";import{SizedPixelFormat as c,PixelFormat as _,TextureWrapMode as p}from"../../webgl/enums.js";import{Texture as m}from"../../webgl/Texture.js";import{TextureDescriptor as x}from"../../webgl/TextureDescriptor.js";function g(t){return t&&"render"in t}function f(t){const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,t.render(e.getContext("2d")),e}function w(t){return g(t)?t instanceof d?t.getRenderedRasterPixels()?.renderedRasterPixels:f(t):t}class S extends l{constructor(t=null,e=!1){super(),this.blendFunction="standard",this._sourceWidth=0,this._sourceHeight=0,this._textureInvalidated=!1,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._texture=null,this._width=void 0,this.x=0,this.y=0,this.immutable=e,this.source=t,this.requestRender=this.requestRender.bind(this)}destroy(){this._texture&&(this._texture.dispose(),this._texture=null),null!=this._uploadStatus&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return void 0!==this._height?this._height:this._sourceHeight}set height(t){this._height=t}get source(){return this._source}set source(t){null==t&&null==this._source||(this._source=t,this.invalidateTexture(),this.requestRender())}get texture(){return this._texture}get width(){return void 0!==this._width?this._width:this._sourceWidth}set width(t){this._width=t}beforeRender(t){super.beforeRender(t),this.updateTexture(t)}async setSourceAsync(i,s){null!=this._uploadStatus&&this._uploadStatus.controller.abort();const r=new AbortController,h=t();return e(s,(()=>r.abort())),e(r,(t=>h.reject(t))),this._uploadStatus={controller:r,resolver:h},this.source=i,h.promise}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width))}transitionStep(t,e){t>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(t,e)}setTransform(t){const e=s(this.transforms.displayViewScreenMat3),[i,a]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,c=l*this.height,_=Math.PI*this.rotation/180;r(e,e,n(i,a)),r(e,e,n(d/2,c/2)),h(e,e,-_),r(e,e,n(-d/2,-c/2)),o(e,e,n(d,c)),u(this.transforms.displayViewScreenMat3,t.displayViewMat3,e)}setSamplingProfile(t){this._texture&&(t.mips&&!this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._texture.setSamplingMode(t.samplingMode))}bind(t,e){this._texture&&t.bindTexture(this._texture,e)}async updateTexture({context:t,painter:e}){if(!this._textureInvalidated)return;if(this._textureInvalidated=!1,this._texture||(this._texture=this._createTexture(t)),!this.source)return void this._texture.setData(null);this._texture.resize(this._sourceWidth,this._sourceHeight);const s=w(this.source);try{if(null!=this._uploadStatus){const{controller:t,resolver:i}=this._uploadStatus,r={signal:t.signal},{width:h,height:o}=this,u=this._texture,a=e.textureUploadManager;await a.enqueueTextureUpdate({data:s,texture:u,width:h,height:o},r),i.resolve(),this._uploadStatus=null}else this._texture.setData(s);this.ready()}catch(r){i(r)}}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:a()}}_createTexture(t){const e=this.immutable,i=new x;return i.internalFormat=e?c.RGBA8:_.RGBA,i.wrapMode=p.CLAMP_TO_EDGE,i.isImmutable=e,i.width=this._sourceWidth,i.height=this._sourceHeight,new m(t,i)}}export{S as Bitmap,g as isImageSource,f as rasterize};
5
+ import{createResolver as t,onAbortOrThrow as e,throwIfNotAbortError as i}from"../../../core/promiseUtils.js";import{identity as s,translate as r,rotate as h,scaleByVec2 as o,multiply as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as l}from"./DisplayObject.js";import d from"./ImageryBitmapSource.js";import{SizedPixelFormat as c,PixelFormat as _,TextureWrapMode as p}from"../../webgl/enums.js";import{Texture as m}from"../../webgl/Texture.js";import{TextureDescriptor as x}from"../../webgl/TextureDescriptor.js";function g(t){return t&&"render"in t}function f(t){const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,t.render(e.getContext("2d")),e}function w(t){return g(t)?t instanceof d?t.getRenderedRasterPixels()?.renderedRasterPixels:f(t):t}class S extends l{constructor(t=null,e=!1){super(),this.blendFunction="standard",this._sourceWidth=0,this._sourceHeight=0,this._textureInvalidated=!1,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._texture=null,this._width=void 0,this.x=0,this.y=0,this.immutable=e,this.source=t,this.requestRender=this.requestRender.bind(this)}destroy(){this._texture&&(this._texture.dispose(),this._texture=null),null!=this._uploadStatus&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return void 0!==this._height?this._height:this._sourceHeight}set height(t){this._height=t}get source(){return this._source}set source(t){null==t&&null==this._source||(this._source=t,this.invalidateTexture(),this.requestRender())}get texture(){return this._texture}get width(){return void 0!==this._width?this._width:this._sourceWidth}set width(t){this._width=t}beforeRender(t){super.beforeRender(t),this.updateTexture(t)}async setSourceAsync(i,s){null!=this._uploadStatus&&this._uploadStatus.controller.abort();const r=new AbortController,h=t();return e(s,(()=>r.abort())),e(r,(t=>h.reject(t))),this._uploadStatus={controller:r,resolver:h},this.source=i,h.promise}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width))}transitionStep(t,e){t>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(t,e)}setTransform(t){const e=s(this.transforms.displayViewScreenMat3),[i,a]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,c=l*this.height,_=Math.PI*this.rotation/180;r(e,e,n(i,a)),r(e,e,n(d/2,c/2)),h(e,e,-_),r(e,e,n(-d/2,-c/2)),o(e,e,n(d,c)),u(this.transforms.displayViewScreenMat3,t.displayViewMat3,e)}setSamplingProfile(t){this._texture&&(t.mips&&!this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._texture.setSamplingMode(t.samplingMode))}bind(t,e){this._texture&&t.bindTexture(this._texture,e)}async updateTexture({context:t,painter:e}){if(!this._textureInvalidated)return;if(this._textureInvalidated=!1,this._texture||(this._texture=this._createTexture(t)),!this.source)return void this._texture.setData(null);this._texture.resize(this._sourceWidth,this._sourceHeight);const s=w(this.source);try{if(null!=this._uploadStatus){const{controller:t,resolver:i}=this._uploadStatus,r={signal:t.signal},{width:h,height:o}=this,u=this._texture,a=e.textureUploadManager;await a.enqueueTextureUpdate({data:s,texture:u,width:h,height:o},r),i.resolve(),this._uploadStatus=null}else this._texture.setData(s);this.ready()}catch(r){i(r)}}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:a()}}_createTexture(t){const e=this.immutable,i=new x(this._sourceWidth,this._sourceHeight);return i.internalFormat=e?c.RGBA8:_.RGBA,i.wrapMode=p.CLAMP_TO_EDGE,i.isImmutable=e,new m(t,i)}}export{S as Bitmap,g as isImageSource,f as rasterize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{timeExtentsEqual as a,setUniforms as e}from"../utils.js";import{BufferObject as r}from"../../../../webgl/BufferObject.js";import{BlendFactor as s,PrimitiveType as o,Usage as i,PixelFormat as n,TextureWrapMode as m,DataType as l}from"../../../../webgl/enums.js";import{Texture as p}from"../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as h}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as _}from"../../../../webgl/VertexElementDescriptor.js";class f{constructor(t){this._params=t,this.animated=!1}isCompatible(t){if(!(t instanceof f))return!1;if(!a(this._params.timeExtent,t._params.timeExtent))return!1;let e=!0;return e=e&&this._params.loadImagery===t._params.loadImagery,e=e&&this._params.color.kind===t._params.color.kind,e=e&&this._params.opacity.kind===t._params.opacity.kind,e}async load(a,e){const{extent:r,size:s}=a;t(e);const o=await this._params.loadImagery(r,s[0],s[1],this._params.timeExtent,e);return new x(o,{color:this._params.color,opacity:this._params.opacity})}render(t,a,r){const{context:i}=t,{program:n}=r;i.setFaceCullingEnabled(!1),i.setBlendingEnabled(!0),i.setBlendFunction(s.ONE,s.ONE_MINUS_SRC_ALPHA),i.useProgram(n),n.setUniformMatrix3fv("u_dvsMat3",a.dvsMat3),i.bindTexture(r.texture,0),n.setUniform1i("u_texture",0),n.setUniform1f("u_Min",r.min),n.setUniform1f("u_Max",r.max),e(n,"color","vec4",this._params.color),e(n,"opacity","float",this._params.opacity),i.bindVAO(r.vertexArray),i.drawArrays(o.TRIANGLE_STRIP,0,4)}}const d=new Map;d.set("a_position",0),d.set("a_texcoord",1);const w=new Map([["geometry",[new _("a_position",2,l.UNSIGNED_SHORT,0,8),new _("a_texcoord",2,l.UNSIGNED_SHORT,4,8)]]]),u={vsPath:"raster/flow/imagery",fsPath:"raster/flow/imagery",attributes:d};class x{constructor(t,a){this._flowData=t,this._values=a}attach(t){const{context:a}=t,{width:e,height:s}=this._flowData,o=r.createVertex(a,i.STATIC_DRAW,new Uint16Array([0,0,0,1,e,0,1,1,0,s,0,0,e,s,1,0])),l=new Map([["geometry",o]]),_=new h(a,d,w,l),f=[];"ramp"===this._values.color.kind&&f.push("vvColor"),"ramp"===this._values.opacity.kind&&f.push("vvOpacity");const x=t.getProgram(u,f);let y=1e6,g=-1e6;for(let r=0;r<s;r++)for(let t=0;t<e;t++)if(0!==this._flowData.mask[r*e+t]){const a=this._flowData.data[2*(r*e+t)],s=this._flowData.data[2*(r*e+t)+1],o=Math.sqrt(a*a+s*s);y=Math.min(y,o),g=Math.max(g,o)}const A=new Uint8Array(4*e*s);for(let r=0;r<s;r++)for(let t=0;t<e;t++)if(0!==this._flowData.mask[r*e+t]){const a=this._flowData.data[2*(r*e+t)],s=this._flowData.data[2*(r*e+t)+1],o=(Math.sqrt(a*a+s*s)-y)/(g-y);A[4*(r*e+t)]=255*o,A[4*(r*e+t)+1]=0,A[4*(r*e+t)+2]=0,A[4*(r*e+t)+3]=255}else A[4*(r*e+t)]=0,A[4*(r*e+t)+1]=0,A[4*(r*e+t)+2]=0,A[4*(r*e+t)+3]=0;const b=new c;b.internalFormat=n.RGBA,b.wrapMode=m.CLAMP_TO_EDGE,b.flipped=!0,b.width=e,b.height=s;const v=new p(a,b,A);this.vertexArray=_,this.program=x,this.texture=v,this.min=y,this.max=g,this._flowData=null}detach(){this.vertexArray.dispose(),this.texture.dispose()}get ready(){return this.program.compiled}}export{f as Imagery,x as ImageryResources};
5
+ import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import{timeExtentsEqual as a,setUniforms as r}from"../utils.js";import{BufferObject as e}from"../../../../webgl/BufferObject.js";import{BlendFactor as s,PrimitiveType as o,Usage as i,PixelFormat as n,TextureWrapMode as m,DataType as l}from"../../../../webgl/enums.js";import{Texture as p}from"../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as h}from"../../../../webgl/VertexArrayObject.js";import{VertexElementDescriptor as _}from"../../../../webgl/VertexElementDescriptor.js";class f{constructor(t){this._params=t,this.animated=!1}isCompatible(t){if(!(t instanceof f))return!1;if(!a(this._params.timeExtent,t._params.timeExtent))return!1;let r=!0;return r=r&&this._params.loadImagery===t._params.loadImagery,r=r&&this._params.color.kind===t._params.color.kind,r=r&&this._params.opacity.kind===t._params.opacity.kind,r}async load(a,r){const{extent:e,size:s}=a;t(r);const o=await this._params.loadImagery(e,s[0],s[1],this._params.timeExtent,r);return new x(o,{color:this._params.color,opacity:this._params.opacity})}render(t,a,e){const{context:i}=t,{program:n}=e;i.setFaceCullingEnabled(!1),i.setBlendingEnabled(!0),i.setBlendFunction(s.ONE,s.ONE_MINUS_SRC_ALPHA),i.useProgram(n),n.setUniformMatrix3fv("u_dvsMat3",a.dvsMat3),i.bindTexture(e.texture,0),n.setUniform1i("u_texture",0),n.setUniform1f("u_Min",e.min),n.setUniform1f("u_Max",e.max),r(n,"color","vec4",this._params.color),r(n,"opacity","float",this._params.opacity),i.bindVAO(e.vertexArray),i.drawArrays(o.TRIANGLE_STRIP,0,4)}}const d=new Map;d.set("a_position",0),d.set("a_texcoord",1);const u=new Map([["geometry",[new _("a_position",2,l.UNSIGNED_SHORT,0,8),new _("a_texcoord",2,l.UNSIGNED_SHORT,4,8)]]]),w={vsPath:"raster/flow/imagery",fsPath:"raster/flow/imagery",attributes:d};class x{constructor(t,a){this._flowData=t,this._values=a}attach(t){const{context:a}=t,{width:r,height:s}=this._flowData,o=e.createVertex(a,i.STATIC_DRAW,new Uint16Array([0,0,0,1,r,0,1,1,0,s,0,0,r,s,1,0])),l=new Map([["geometry",o]]),_=new h(a,d,u,l),f=[];"ramp"===this._values.color.kind&&f.push("vvColor"),"ramp"===this._values.opacity.kind&&f.push("vvOpacity");const x=t.getProgram(w,f);let y=1e6,g=-1e6;for(let e=0;e<s;e++)for(let t=0;t<r;t++)if(0!==this._flowData.mask[e*r+t]){const a=this._flowData.data[2*(e*r+t)],s=this._flowData.data[2*(e*r+t)+1],o=Math.sqrt(a*a+s*s);y=Math.min(y,o),g=Math.max(g,o)}const A=new Uint8Array(4*r*s);for(let e=0;e<s;e++)for(let t=0;t<r;t++)if(0!==this._flowData.mask[e*r+t]){const a=this._flowData.data[2*(e*r+t)],s=this._flowData.data[2*(e*r+t)+1],o=(Math.sqrt(a*a+s*s)-y)/(g-y);A[4*(e*r+t)]=255*o,A[4*(e*r+t)+1]=0,A[4*(e*r+t)+2]=0,A[4*(e*r+t)+3]=255}else A[4*(e*r+t)]=0,A[4*(e*r+t)+1]=0,A[4*(e*r+t)+2]=0,A[4*(e*r+t)+3]=0;const b=new c(r,s);b.internalFormat=n.RGBA,b.wrapMode=m.CLAMP_TO_EDGE,b.flipped=!0;const v=new p(a,b,A);this.vertexArray=_,this.program=x,this.texture=v,this.min=y,this.max=g,this._flowData=null}detach(){this.vertexArray.dispose(),this.texture.dispose()}get ready(){return this.program.compiled}}export{f as Imagery,x as ImageryResources};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"./RectangleBinPack.js";import e from"../webgl/Rect.js";import{PixelFormat as s,TextureWrapMode as i}from"../../../webgl/enums.js";import{Texture as h}from"../../../webgl/Texture.js";import{TextureDescriptor as r}from"../../../webgl/TextureDescriptor.js";class n{constructor(e,s,i){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphIndex={},this._textures=[],this._rangePromises=new Map,this.width=e,this.height=s,this._glyphSource=i,this._binPack=new t(e-4,s-4),this._glyphData.push(new Uint8Array(e*s)),this._dirties.push(!0),this._textures.push(void 0)}getGlyphItems(s,i){const h=[],r=this._glyphSource,n=new Set,o=1/256;for(const t of i){const e=Math.floor(t*o);n.add(e)}const a=[];return n.forEach((t=>{const e=s+t;if(this._rangePromises.has(e))a.push(this._rangePromises.get(e));else{const i=r.getRange(s,t).then((()=>{this._rangePromises.delete(e)}),(()=>{this._rangePromises.delete(e)}));this._rangePromises.set(e,i),a.push(i)}})),Promise.all(a).then((()=>{let n=this._glyphIndex[s];n||(n={},this._glyphIndex[s]=n);for(const o of i){const i=n[o];if(i){h[o]={sdf:!0,rect:i.rect,metrics:i.metrics,page:i.page,code:o};continue}const a=r.getGlyph(s,o);if(!a?.metrics)continue;const l=a.metrics;let c;if(0===l.width)c=new e(0,0,0,0);else{const e=3,s=l.width+2*e,i=l.height+2*e;let h=s%4?4-s%4:4,r=i%4?4-i%4:4;1===h&&(h=5),1===r&&(r=5),c=this._binPack.allocate(s+h,i+r),c.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(void 0),this._binPack=new t(this.width-4,this.height-4),c=this._binPack.allocate(s+h,i+r));const n=this._glyphData[this._currentPage],o=a.bitmap;let g,_;if(o)for(let t=0;t<i;t++){g=s*t,_=this.width*(c.y+t+1)+c.x;for(let t=0;t<s;t++)n[_+t+1]=o.at(g+t)}}n[o]={rect:c,metrics:l,tileIDs:null,page:this._currentPage},h[o]={sdf:!0,rect:c,metrics:l,page:this._currentPage,code:o},this._dirties[this._currentPage]=!0}return h}))}removeGlyphs(t){for(const e in this._glyphIndex){const s=this._glyphIndex[e];if(!s)continue;let i;for(const e in s)if(i=s[e],i.tileIDs.delete(t),0===i.tileIDs.size){const t=this._glyphData[i.page],h=i.rect;let r,n;for(let e=0;e<h.height;e++)for(r=this.width*(h.y+e)+h.x,n=0;n<h.width;n++)t[r+n]=0;delete s[e],this._dirties[i.page]=!0}}}bind(t,e,n,o=0){if(!this._textures[n]){const e=new r;e.pixelFormat=s.ALPHA,e.wrapMode=i.CLAMP_TO_EDGE,e.width=this.width,e.height=this.height,this._textures[n]=new h(t,e,new Uint8Array(this.width*this.height))}const a=this._textures[n];a.setSamplingMode(e),this._dirties[n]&&a.setData(this._glyphData[n]),t.bindTexture(a,o),this._dirties[n]=!1}destroy(){this.dispose()}dispose(){this._glyphData.length=0,this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0}}export{n as default};
5
+ import t from"./RectangleBinPack.js";import e from"../webgl/Rect.js";import{PixelFormat as s,TextureWrapMode as i}from"../../../webgl/enums.js";import{Texture as h}from"../../../webgl/Texture.js";import{TextureDescriptor as r}from"../../../webgl/TextureDescriptor.js";class n{constructor(e,s,i){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphIndex={},this._textures=[],this._rangePromises=new Map,this.width=e,this.height=s,this._glyphSource=i,this._binPack=new t(e-4,s-4),this._glyphData.push(new Uint8Array(e*s)),this._dirties.push(!0),this._textures.push(void 0)}getGlyphItems(s,i){const h=[],r=this._glyphSource,n=new Set,o=1/256;for(const t of i){const e=Math.floor(t*o);n.add(e)}const a=[];return n.forEach((t=>{const e=s+t;if(this._rangePromises.has(e))a.push(this._rangePromises.get(e));else{const i=r.getRange(s,t).then((()=>{this._rangePromises.delete(e)}),(()=>{this._rangePromises.delete(e)}));this._rangePromises.set(e,i),a.push(i)}})),Promise.all(a).then((()=>{let n=this._glyphIndex[s];n||(n={},this._glyphIndex[s]=n);for(const o of i){const i=n[o];if(i){h[o]={sdf:!0,rect:i.rect,metrics:i.metrics,page:i.page,code:o};continue}const a=r.getGlyph(s,o);if(!a?.metrics)continue;const l=a.metrics;let c;if(0===l.width)c=new e(0,0,0,0);else{const e=3,s=l.width+2*e,i=l.height+2*e;let h=s%4?4-s%4:4,r=i%4?4-i%4:4;1===h&&(h=5),1===r&&(r=5),c=this._binPack.allocate(s+h,i+r),c.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(void 0),this._binPack=new t(this.width-4,this.height-4),c=this._binPack.allocate(s+h,i+r));const n=this._glyphData[this._currentPage],o=a.bitmap;let g,_;if(o)for(let t=0;t<i;t++){g=s*t,_=this.width*(c.y+t+1)+c.x;for(let t=0;t<s;t++)n[_+t+1]=o.at(g+t)}}n[o]={rect:c,metrics:l,tileIDs:null,page:this._currentPage},h[o]={sdf:!0,rect:c,metrics:l,page:this._currentPage,code:o},this._dirties[this._currentPage]=!0}return h}))}removeGlyphs(t){for(const e in this._glyphIndex){const s=this._glyphIndex[e];if(!s)continue;let i;for(const e in s)if(i=s[e],i.tileIDs.delete(t),0===i.tileIDs.size){const t=this._glyphData[i.page],h=i.rect;let r,n;for(let e=0;e<h.height;e++)for(r=this.width*(h.y+e)+h.x,n=0;n<h.width;n++)t[r+n]=0;delete s[e],this._dirties[i.page]=!0}}}bind(t,e,n,o=0){if(!this._textures[n]){const e=new r(this.width,this.height);e.pixelFormat=s.ALPHA,e.wrapMode=i.CLAMP_TO_EDGE,this._textures[n]=new h(t,e,new Uint8Array(this.width*this.height))}const a=this._textures[n];a.setSamplingMode(e),this._dirties[n]&&a.setData(this._glyphData[n]),t.bindTexture(a,o),this._dirties[n]=!1}destroy(){this.dispose()}dispose(){this._glyphData.length=0,this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0}}export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{rasterizeDash as t}from"../../../../symbols/cim/rasterizingUtils.js";import i from"./RectangleBinPack.js";import s from"../webgl/Rect.js";import{TextureWrapMode as e}from"../../../webgl/enums.js";import{Texture as h}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const r="dasharray-";class o{constructor(t,s,e=0){this._size=[],this._mosaicsData=[],this._textures=[],this._dirties=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects={},this.pixelRatio=1,s<=0&&console.error("Sprites mosaic defaultWidth and defaultHeight must be greater than zero!"),this._pageWidth=t,this._pageHeight=s,e>0&&(this._maxItemSize=e),this._binPack=new i(t-4,s-4)}destroy(){this.dispose()}dispose(){this._binPack=null,this._mosaicsData.length=0,this._mosaicRects={};for(const t of this._textures)t&&t.dispose();this._textures.length=0}getWidth(t){return t>=this._size.length?-1:this._size[t][0]}getHeight(t){return t>=this._size.length?-1:this._size[t][1]}getPageSize(t){return t>=this._size.length?null:this._size[t]}setSpriteSource(t){if(this.dispose(),this.pixelRatio=t.devicePixelRatio,0===this._mosaicsData.length){this._binPack=new i(this._pageWidth-4,this._pageHeight-4);const t=Math.floor(this._pageWidth),s=Math.floor(this._pageHeight),e=new Uint32Array(t*s);this._mosaicsData[0]=e,this._dirties.push(!0),this._size.push([this._pageWidth,this._pageHeight]),this._textures.push(void 0)}this._sprites=t}getSpriteItem(t,i=!1){let s,e,h=this._mosaicRects[t];if(h)return h;if(!this._sprites||"loaded"!==this._sprites.loadStatus)return null;if(t&&t.startsWith(r)?([s,e]=this._rasterizeDash(t),i=!0):s=this._sprites.getSpriteInfo(t),!s?.width||!s.height||s.width<0||s.height<0)return null;const a=s.width,o=s.height,[n,_,g]=this._allocateImage(a,o);return n.width<=0?null:(this._copy(n,s,_,g,i,e),h={type:"sprite",rect:n,width:a,height:o,sdf:s.sdf,simplePattern:!1,rasterizationScale:s.pixelRatio??1,samplingMode:"Linear",page:_},this._mosaicRects[t]=h,h)}getSpriteItems(t){const i={};for(const s of t)i[s.name]=this.getSpriteItem(s.name,s.repeat);return i}getMosaicItemPosition(t,i){const s=this.getSpriteItem(t,i),e=s?.rect;if(!e)return null;e.width=s.width,e.height=s.height;const h=s.width,a=s.height,r=2;return{tl:[e.x+r,e.y+r],br:[e.x+r+h,e.y+r+a],page:s.page}}bind(t,i,s=0,r=0){if(s>=this._size.length||s>=this._mosaicsData.length)return;if(!this._textures[s]){const i=new a;i.wrapMode=e.CLAMP_TO_EDGE,i.width=this._size[s][0],i.height=this._size[s][1],this._textures[s]=new h(t,i,new Uint8Array(this._mosaicsData[s].buffer))}const o=this._textures[s];o.setSamplingMode(i),this._dirties[s]&&o.setData(new Uint8Array(this._mosaicsData[s].buffer)),t.bindTexture(o,r),this._dirties[s]=!1}static _copyBits(t,i,s,e,h,a,r,o,n,_,g){let p=e*i+s,c=o*a+r;if(g){c-=a;for(let r=-1;r<=_;r++,p=((r+_)%_+e)*i+s,c+=a)for(let i=-1;i<=n;i++)h[c+i]=t[p+(i+n)%n]}else for(let l=0;l<_;l++){for(let i=0;i<n;i++)h[c+i]=t[p+i];p+=i,c+=a}}_copy(t,i,s,e,h,a){if(!this._sprites||"loaded"!==this._sprites.loadStatus||s>=this._mosaicsData.length)return;const r=new Uint32Array(a?a.buffer:this._sprites.image.buffer),n=this._mosaicsData[s],_=2,g=a?i.width:this._sprites.width;o._copyBits(r,g,i.x,i.y,n,e[0],t.x+_,t.y+_,i.width,i.height,h),this._dirties[s]=!0}_allocateImage(t,e){t+=2,e+=2;const h=Math.max(t,e);if(this._maxItemSize&&this._maxItemSize<h){const i=new s(0,0,t,e);return this._mosaicsData.push(new Uint32Array(t*e)),this._dirties.push(!0),this._size.push([t,e]),this._textures.push(void 0),[i,this._mosaicsData.length-1,[t,e]]}let a=t%4?4-t%4:4,r=e%4?4-e%4:4;1===a&&(a=5),1===r&&(r=5);const o=this._binPack.allocate(t+a,e+r);return o.width<=0?(this._dirties[this._currentPage]||(this._mosaicsData[this._currentPage]=null),this._currentPage=this._mosaicsData.length,this._mosaicsData.push(new Uint32Array(this._pageWidth*this._pageHeight)),this._dirties.push(!0),this._size.push([this._pageWidth,this._pageHeight]),this._textures.push(void 0),this._binPack=new i(this._pageWidth-4,this._pageHeight-4),this._allocateImage(t,e)):[o,this._currentPage,[this._pageWidth,this._pageHeight]]}_rasterizeDash(i){const s=/\[(.*?)\]/,e=i.match(s);if(!e)return null;const h=e[1].split(",").map(Number),a=i.slice(i.lastIndexOf("-")+1),[r,o,n]=t(h,a);return[{x:0,y:0,width:o,height:n,sdf:!0,pixelRatio:1},new Uint8Array(r.buffer)]}}export{o as default};
5
+ import"../../../../core/has.js";import{rasterizeDash as t}from"../../../../symbols/cim/rasterizingUtils.js";import i from"./RectangleBinPack.js";import s from"../webgl/Rect.js";import{TextureWrapMode as e}from"../../../webgl/enums.js";import{Texture as h}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const r="dasharray-";class o{constructor(t,s,e=0){this._size=[],this._mosaicsData=[],this._textures=[],this._dirties=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects={},this.pixelRatio=1,s<=0&&console.error("Sprites mosaic defaultWidth and defaultHeight must be greater than zero!"),this._pageWidth=t,this._pageHeight=s,e>0&&(this._maxItemSize=e),this._binPack=new i(t-4,s-4)}destroy(){this.dispose()}dispose(){this._binPack=null,this._mosaicsData.length=0,this._mosaicRects={};for(const t of this._textures)t&&t.dispose();this._textures.length=0}getWidth(t){return t>=this._size.length?-1:this._size[t][0]}getHeight(t){return t>=this._size.length?-1:this._size[t][1]}getPageSize(t){return t>=this._size.length?null:this._size[t]}setSpriteSource(t){if(this.dispose(),this.pixelRatio=t.devicePixelRatio,0===this._mosaicsData.length){this._binPack=new i(this._pageWidth-4,this._pageHeight-4);const t=Math.floor(this._pageWidth),s=Math.floor(this._pageHeight),e=new Uint32Array(t*s);this._mosaicsData[0]=e,this._dirties.push(!0),this._size.push([this._pageWidth,this._pageHeight]),this._textures.push(void 0)}this._sprites=t}getSpriteItem(t,i=!1){let s,e,h=this._mosaicRects[t];if(h)return h;if(!this._sprites||"loaded"!==this._sprites.loadStatus)return null;if(t&&t.startsWith(r)?([s,e]=this._rasterizeDash(t),i=!0):s=this._sprites.getSpriteInfo(t),!s?.width||!s.height||s.width<0||s.height<0)return null;const a=s.width,o=s.height,[n,_,g]=this._allocateImage(a,o);return n.width<=0?null:(this._copy(n,s,_,g,i,e),h={type:"sprite",rect:n,width:a,height:o,sdf:s.sdf,simplePattern:!1,rasterizationScale:s.pixelRatio??1,samplingMode:"Linear",page:_},this._mosaicRects[t]=h,h)}getSpriteItems(t){const i={};for(const s of t)i[s.name]=this.getSpriteItem(s.name,s.repeat);return i}getMosaicItemPosition(t,i){const s=this.getSpriteItem(t,i),e=s?.rect;if(!e)return null;e.width=s.width,e.height=s.height;const h=s.width,a=s.height,r=2;return{tl:[e.x+r,e.y+r],br:[e.x+r+h,e.y+r+a],page:s.page}}bind(t,i,s=0,r=0){if(s>=this._size.length||s>=this._mosaicsData.length)return;if(!this._textures[s]){const i=new a(this._size[s][0],this._size[s][1]);i.wrapMode=e.CLAMP_TO_EDGE,this._textures[s]=new h(t,i,new Uint8Array(this._mosaicsData[s].buffer))}const o=this._textures[s];o.setSamplingMode(i),this._dirties[s]&&o.setData(new Uint8Array(this._mosaicsData[s].buffer)),t.bindTexture(o,r),this._dirties[s]=!1}static _copyBits(t,i,s,e,h,a,r,o,n,_,g){let p=e*i+s,c=o*a+r;if(g){c-=a;for(let r=-1;r<=_;r++,p=((r+_)%_+e)*i+s,c+=a)for(let i=-1;i<=n;i++)h[c+i]=t[p+(i+n)%n]}else for(let l=0;l<_;l++){for(let i=0;i<n;i++)h[c+i]=t[p+i];p+=i,c+=a}}_copy(t,i,s,e,h,a){if(!this._sprites||"loaded"!==this._sprites.loadStatus||s>=this._mosaicsData.length)return;const r=new Uint32Array(a?a.buffer:this._sprites.image.buffer),n=this._mosaicsData[s],_=2,g=a?i.width:this._sprites.width;o._copyBits(r,g,i.x,i.y,n,e[0],t.x+_,t.y+_,i.width,i.height,h),this._dirties[s]=!0}_allocateImage(t,e){t+=2,e+=2;const h=Math.max(t,e);if(this._maxItemSize&&this._maxItemSize<h){const i=new s(0,0,t,e);return this._mosaicsData.push(new Uint32Array(t*e)),this._dirties.push(!0),this._size.push([t,e]),this._textures.push(void 0),[i,this._mosaicsData.length-1,[t,e]]}let a=t%4?4-t%4:4,r=e%4?4-e%4:4;1===a&&(a=5),1===r&&(r=5);const o=this._binPack.allocate(t+a,e+r);return o.width<=0?(this._dirties[this._currentPage]||(this._mosaicsData[this._currentPage]=null),this._currentPage=this._mosaicsData.length,this._mosaicsData.push(new Uint32Array(this._pageWidth*this._pageHeight)),this._dirties.push(!0),this._size.push([this._pageWidth,this._pageHeight]),this._textures.push(void 0),this._binPack=new i(this._pageWidth-4,this._pageHeight-4),this._allocateImage(t,e)):[o,this._currentPage,[this._pageWidth,this._pageHeight]]}_rasterizeDash(i){const s=/\[(.*?)\]/,e=i.match(s);if(!e)return null;const h=e[1].split(",").map(Number),a=i.slice(i.lastIndexOf("-")+1),[r,o,n]=t(h,a);return[{x:0,y:0,width:o,height:n,sdf:!0,pixelRatio:1},new Uint8Array(r.buffer)]}}export{o as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as i}from"../../../../geometry/support/aaBoundingRect.js";import{tilePixelSize as s}from"./constants.js";import{TileHandler as r}from"./TileHandler.js";import{VectorTile as n}from"./VectorTile.js";import l from"../../tiling/TileInfoViewPOT.js";import a from"../../tiling/TileKey.js";class g extends r{constructor(e,t,o,i){super(e,t,o,e.tileInfo.lods.length-1),this._memCache=i,this._ongoingTileRequests=new Map,this._ongoingRequestToController=new Map,this._tileInfoView=new l(e.tileInfo,e.fullExtent)}destroy(){super.destroy(),this._ongoingRequestToController.forEach((e=>e.abort())),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear()}async getVectorTile(r,l){const g=new a(r[0],r[1],r[2],0);let h=this._memCache.get(g.id);if(h)return h.retain(),h;const m=await this._getVectorTileData(g);if(t(l),!this._layer)return null;if(h=this._memCache.get(g.id),h)return h.retain(),h;const c=this._layer.tileInfo.getTileBounds(i(),g),u=this._tileInfoView.getTileResolution(r[0]);return h=new n(g,u,c[0],c[3],s,s,this._styleRepository,this._memCache),h.setData(m),m&&(h.retain(),this._memCache.put(g.id,h,e)),h.neededForCoverage=!0,h.transforms.tileUnitsToPixels=o(1/8,0,0,0,1/8,0,0,0,1),h}_getVectorTileData(e){const t=e.id;if(this._ongoingTileRequests.has(t))return this._ongoingTileRequests.get(t);const o=new AbortController,i={signal:o.signal},s=this._getParsedVectorTileData(e,i).then((e=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),e))).catch((()=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),null)));return this._ongoingTileRequests.set(t,s),this._ongoingRequestToController.set(t,o),s}_getParsedVectorTileData(e,t){return this.fetchTileData(e,t).then((o=>this.parseTileData({key:e,data:o},t)))}}export{g as default};
5
+ import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as o}from"../../../../geometry/support/aaBoundingRect.js";import{tilePixelSize as s}from"./constants.js";import{TileHandler as r}from"./TileHandler.js";import{VectorTile as n}from"./VectorTile.js";import l from"../../tiling/TileInfoViewPOT.js";import a from"../../tiling/TileKey.js";class g extends r{constructor(e,t,i,o){super(e,t,i,e.tileInfo.lods.length-1),this._memCache=o,this._vectorTiles=new Map,this._ongoingTileRequests=new Map,this._ongoingRequestToController=new Map,this._tileInfoView=new l(e.tileInfo,e.fullExtent)}destroy(){super.destroy(),this._ongoingRequestToController.forEach((e=>e.abort())),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear(),this._vectorTiles.clear()}async getVectorTile(r,l){const g=new a(r[0],r[1],r[2],0);let h=this._vectorTiles.get(g.id)??this._memCache.get(g.id);if(h)return h.retain(),h;const c=await this._getVectorTileData(g);if(t(l),!this._layer)return null;if(h=this._vectorTiles.get(g.id)??this._memCache.get(g.id),h)return h.retain(),h;const T=this._layer.tileInfo.getTileBounds(o(),g),m=this._tileInfoView.getTileResolution(r[0]);return h=new n(g,m,T[0],T[3],s,s,this._styleRepository,this),h.setData(c),c&&(h.retain(),this._memCache.put(g.id,h,e),this._vectorTiles.set(g.id,h)),h.neededForCoverage=!0,h.transforms.tileUnitsToPixels=i(1/8,0,0,0,1/8,0,0,0,1),h}updateTileSize(e){this._memCache.updateSize(e.id,e)}onDisposeTile(e){this._vectorTiles.delete(e.id)}_getVectorTileData(e){const t=e.id;if(this._ongoingTileRequests.has(t))return this._ongoingTileRequests.get(t);const i=new AbortController,o={signal:i.signal},s=this._getParsedVectorTileData(e,o).then((e=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),e))).catch((()=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),null)));return this._ongoingTileRequests.set(t,s),this._ongoingRequestToController.set(t,i),s}_getParsedVectorTileData(e,t){return this.fetchTileData(e,t).then((i=>this.parseTileData({key:e,data:i},t)))}}export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{identity as e,translate as t,rotate as s,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{tileCoordSize as i}from"./constants.js";import{BucketType as o}from"./enums.js";import{CircleRenderBucket as h,SymbolRenderBucket as n,LineRenderBucket as l,FillRenderBucket as c}from"./RenderBucket.js";import{fadeDuration as d}from"./decluttering/config.js";import{TiledDisplayObject as u}from"../webgl/TiledDisplayObject.js";const y=null;class m extends u{constructor(e,t,s,r,a,o,h,n=null){super(e,t,s,r,a,o,i,i),this.styleRepository=h,this._memCache=n,this.type="vector-tile",this._referenced=1,this._hasSymbolBuckets=!1,this._usedMemory=256,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this.featureIndex=null,this.triangleCount=0,this._processed=!1,this.id=e.id}get styleLayerUIDs(){return Array.from(this.layerData.keys())}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<d}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<d)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e){const e=this.layerData.get(s);e&&(this._usedMemory-=e.usedMemory,e.type===o.SYMBOL&&this.symbols.delete(s)&&(t=!0),e.destroy(),this.layerData.delete(s))}this._memCache?.updateSize(this.key.id,this),t&&(this.featureIndex?.clear(),this.emit("symbols-changed")),this.requestRender()}processed(){return this._processed}hasData(){return this.layerData.size>0}hasFeatures(){const e=this.layerData.values();for(const t of e)if(t.hasData())return!0;return!1}dispose(){"unloaded"!==this.status&&(m._destroyRenderBuckets(this.layerData),this.layerData.clear(),this.featureIndex=null,this._usedMemory=0,this.destroy(),this.status="unloaded")}release(){0===--this._referenced&&(this.dispose(),this.stage=null)}retain(){++this._referenced}get cachedMemory(){return this._usedMemory}get usedMemory(){return this._usedMemory}get usedMemoryPerReference(){return this._usedMemory/(this._referenced||1)}changeDataImpl(e){this.featureIndex?.clear();let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:r}=e,a=this._createRenderBuckets(s);if(r&&r.byteLength>0){const e=new Uint32Array(r);for(const t of e)this._deleteLayerData(t)}for(const[e,i]of a)this._deleteLayerData(e),i.type===o.SYMBOL&&(this.symbols.set(e,i.symbols),t=!0),this._usedMemory+=i.usedMemory,this.layerData.set(e,i);this._memCache?.updateSize(this.key.id,this)}this._hasSymbolBuckets=!1;for(const s of this.layerData.values())s.type===o.SYMBOL&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(a){super.setTransform(a);const i=this.resolution/(a.resolution*a.pixelRatio),o=this.width/this.rangeX*i,h=this.height/this.rangeY*i,n=[0,0];a.toScreen(n,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;e(l),t(l,l,n),s(l,l,Math.PI*a.rotation/180),r(l,l,[o,h,1])}_createTransforms(){return{displayViewScreenMat3:a(),tileMat3:a(),tileUnitsToPixels:a()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;for(const s of e.values())t.has(s)||(s.destroy(),t.add(s));e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const r of e){const e=this._deserializeBucket(r,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case o.FILL:s=new c(e,this.styleRepository);break;case o.LINE:s=new l(e,this.styleRepository);break;case o.SYMBOL:s=new n(e,this.styleRepository,this);break;case o.CIRCLE:s=new h(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._usedMemory-=t.usedMemory,t.destroy(),this.layerData.delete(e)}}export{m as VectorTile,y as tracer};
5
+ import"../../../../core/has.js";import{identity as e,translate as t,rotate as s,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{tileCoordSize as i}from"./constants.js";import{BucketType as o}from"./enums.js";import{CircleRenderBucket as h,SymbolRenderBucket as n,LineRenderBucket as l,FillRenderBucket as c}from"./RenderBucket.js";import{fadeDuration as d}from"./decluttering/config.js";import{TiledDisplayObject as u}from"../webgl/TiledDisplayObject.js";const y=null;class m extends u{constructor(e,t,s,r,a,o,h,n=null){super(e,t,s,r,a,o,i,i),this.styleRepository=h,this._owner=n,this.type="vector-tile",this._referenced=1,this._hasSymbolBuckets=!1,this._usedMemory=256,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this.featureIndex=null,this.triangleCount=0,this._processed=!1,this.id=e.id}get styleLayerUIDs(){return Array.from(this.layerData.keys())}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<d}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<d)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e){const e=this.layerData.get(s);e&&(this._usedMemory-=e.usedMemory,e.type===o.SYMBOL&&this.symbols.delete(s)&&(t=!0),e.destroy(),this.layerData.delete(s))}this._owner?.updateTileSize(this),t&&(this.featureIndex?.clear(),this.emit("symbols-changed")),this.requestRender()}processed(){return this._processed}hasData(){return this.layerData.size>0}hasFeatures(){const e=this.layerData.values();for(const t of e)if(t.hasData())return!0;return!1}dispose(){"unloaded"!==this.status&&(m._destroyRenderBuckets(this.layerData),this.layerData.clear(),this.featureIndex=null,this._usedMemory=0,this.destroy(),this.status="unloaded")}release(){0===--this._referenced&&(this._owner?.onDisposeTile(this),this.dispose(),this.stage=null)}retain(){++this._referenced}get cachedMemory(){return this._usedMemory}get usedMemory(){return this._usedMemory}get usedMemoryPerReference(){return this._usedMemory/(this._referenced||1)}changeDataImpl(e){this.featureIndex?.clear();let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:r}=e,a=this._createRenderBuckets(s);if(r&&r.byteLength>0){const e=new Uint32Array(r);for(const t of e)this._deleteLayerData(t)}for(const[e,i]of a)this._deleteLayerData(e),i.type===o.SYMBOL&&(this.symbols.set(e,i.symbols),t=!0),this._usedMemory+=i.usedMemory,this.layerData.set(e,i);this._owner?.updateTileSize(this)}this._hasSymbolBuckets=!1;for(const s of this.layerData.values())s.type===o.SYMBOL&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(a){super.setTransform(a);const i=this.resolution/(a.resolution*a.pixelRatio),o=this.width/this.rangeX*i,h=this.height/this.rangeY*i,n=[0,0];a.toScreen(n,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;e(l),t(l,l,n),s(l,l,Math.PI*a.rotation/180),r(l,l,[o,h,1])}_createTransforms(){return{displayViewScreenMat3:a(),tileMat3:a(),tileUnitsToPixels:a()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;for(const s of e.values())t.has(s)||(s.destroy(),t.add(s));e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const r of e){const e=this._deserializeBucket(r,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case o.FILL:s=new c(e,this.styleRepository);break;case o.LINE:s=new l(e,this.styleRepository);break;case o.SYMBOL:s=new n(e,this.styleRepository,this);break;case o.CIRCLE:s=new h(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._usedMemory-=t.usedMemory,t.destroy(),this.layerData.delete(e)}}export{m as VectorTile,y as tracer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,dataDrivenUnit2 as s,dataDrivenUnit1 as r,dataDrivenUnit0 as a,visualVariableUnit as n,localTimeOriginUnit as u,gpgpuUnit as h,animationUnit as o,filterFlagsUnit as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as p}from"./Utils.js";import{TextureWrapMode as _,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b;return t.wrapMode=_.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t.width=this.size,t.height=this.size,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,p=o,_=h*this.size*u,c=(d+p*this.size)*u-_,x=g(this.pixelType),f=new x(a,_*x.BYTES_PER_ELEMENT,c),b=this.size,m=p-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=p(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:_,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,_,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:l},animation:{texture:this._getTexture(t,i.Animation),unit:o},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:h},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:u},visualVariableData:{texture:this._getTexture(t,i.VV),unit:n},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:a},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:r},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:s},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b;e.wrapMode=_.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,e.width=1,e.height=1,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
5
+ import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,dataDrivenUnit2 as s,dataDrivenUnit1 as r,dataDrivenUnit0 as a,visualVariableUnit as n,localTimeOriginUnit as u,gpgpuUnit as h,animationUnit as o,filterFlagsUnit as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as p}from"./Utils.js";import{TextureWrapMode as _,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b(this.size);return t.wrapMode=_.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,p=o,_=h*this.size*u,c=(d+p*this.size)*u-_,x=g(this.pixelType),f=new x(a,_*x.BYTES_PER_ELEMENT,c),b=this.size,m=p-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=p(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:_,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,_,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:l},animation:{texture:this._getTexture(t,i.Animation),unit:o},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:h},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:u},visualVariableData:{texture:this._getTexture(t,i.VV),unit:n},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:a},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:r},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:s},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b(1);e.wrapMode=_.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{throwIfNotAbortError as t}from"../../../../core/promiseUtils.js";import e from"./Rect.js";import i from"./RectangleBinPack.js";import{PixelFormat as h,TextureWrapMode as s}from"../../../webgl/enums.js";import{Texture as r}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const n=256,o=t=>Math.floor(t/256);function c(t){const e=new Set;for(const i of t)e.add(o(i));return e}function l(e,i,h){return e.has(i)||e.set(i,h().then((()=>{e.delete(i)})).catch((h=>{e.delete(i),t(h)}))),e.get(i)}const g=t=>({rect:new e(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class p{constructor(t,e,h){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._textures=[],this._rangePromises=new Map,this._preloadCache={},this.width=t,this.height=e,this._glyphSource=h,this._binPack=new i(t-4,e-4),this._glyphData.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._glyphData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],i=[];for(let r=0;r<t.length;r++){const h=t[r];for(let t=0;t<11;t++){const s=r>=3&&r<5&&t>=3&&t<8?255:0;e.push(h),i.push(s)}}const h={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)},s={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(i)};this._recordGlyph(h),this._recordGlyph(s)}getTexture(t,e){if(!this._textures[e]){const i=new a;i.pixelFormat=h.ALPHA,i.wrapMode=s.CLAMP_TO_EDGE,i.width=this.width,i.height=this.height,this._textures[e]=new r(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._glyphData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,e,i){const h=this._getGlyphCache(t);return await this._fetchRanges(t,e,i),e.map((e=>this._getMosaicItem(h,t,e)))}bind(t,e,i,h){const s=this.getTexture(t,i);s.setSamplingMode(e),t.bindTexture(s,h)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const i=this._glyphSource.preloadASCIIRange(t).then((()=>{const e=this._getGlyphCache(t);for(let i=0;i<256;i++)this._getMosaicItem(e,t,i)}));return this._preloadCache[t]=i,i}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,i){const h=c(e),s=[];h.forEach((e=>{s.push(this._fetchRange(t,e,i))})),await Promise.all(s)}async _fetchRange(t,e,i){if(e>n)return;const h=t+e;return l(this._rangePromises,h,(()=>this._glyphSource.getRange(t,e,i)))}_getMosaicItem(t,e,i){if(!t[i]){const h=this._glyphSource.getGlyph(e,i);if(!h?.metrics)return g(i);const s=this._recordGlyph(h),r=this._currentPage,a=h.metrics;t[i]={rect:s,page:r,metrics:a,code:i,sdf:!0},this._invalidate()}return t[i]}_recordGlyph(t){const h=t.metrics;let s;if(0===h.width)s=new e(0,0,0,0);else{const e=3,r=h.width+2*e,a=h.height+2*e;s=this._binPack.allocate(r,a),s.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new i(this.width-4,this.height-4),s=this._binPack.allocate(r,a));const n=this._glyphData[this._currentPage],o=t.bitmap;let c,l;if(o)for(let t=0;t<a;t++){c=r*t,l=this.width*(s.y+t)+s.x;for(let t=0;t<r;t++)n[l+t]=o[c+t]}has("esri-glyph-debug")&&this._showDebugPage(n)}return s}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),h=new ImageData(this.width,this.height),s=h.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let r=0;r<t.length;++r)s[4*r]=t[r],s[4*r+1]=0,s[4*r+2]=0,s[4*r+3]=255;i.putImageData(h,0,0),document.body.appendChild(e)}}export{p as default};
5
+ import has from"../../../../core/has.js";import{throwIfNotAbortError as t}from"../../../../core/promiseUtils.js";import e from"./Rect.js";import i from"./RectangleBinPack.js";import{PixelFormat as h,TextureWrapMode as s}from"../../../webgl/enums.js";import{Texture as r}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const n=256,o=t=>Math.floor(t/256);function c(t){const e=new Set;for(const i of t)e.add(o(i));return e}function l(e,i,h){return e.has(i)||e.set(i,h().then((()=>{e.delete(i)})).catch((h=>{e.delete(i),t(h)}))),e.get(i)}const g=t=>({rect:new e(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class p{constructor(t,e,h){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._textures=[],this._rangePromises=new Map,this._preloadCache={},this.width=t,this.height=e,this._glyphSource=h,this._binPack=new i(t-4,e-4),this._glyphData.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._glyphData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],i=[];for(let r=0;r<t.length;r++){const h=t[r];for(let t=0;t<11;t++){const s=r>=3&&r<5&&t>=3&&t<8?255:0;e.push(h),i.push(s)}}const h={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)},s={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(i)};this._recordGlyph(h),this._recordGlyph(s)}getTexture(t,e){if(!this._textures[e]){const i=new a(this.width,this.height);i.pixelFormat=h.ALPHA,i.wrapMode=s.CLAMP_TO_EDGE,this._textures[e]=new r(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._glyphData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,e,i){const h=this._getGlyphCache(t);return await this._fetchRanges(t,e,i),e.map((e=>this._getMosaicItem(h,t,e)))}bind(t,e,i,h){const s=this.getTexture(t,i);s.setSamplingMode(e),t.bindTexture(s,h)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const i=this._glyphSource.preloadASCIIRange(t).then((()=>{const e=this._getGlyphCache(t);for(let i=0;i<256;i++)this._getMosaicItem(e,t,i)}));return this._preloadCache[t]=i,i}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,i){const h=c(e),s=[];h.forEach((e=>{s.push(this._fetchRange(t,e,i))})),await Promise.all(s)}async _fetchRange(t,e,i){if(e>n)return;const h=t+e;return l(this._rangePromises,h,(()=>this._glyphSource.getRange(t,e,i)))}_getMosaicItem(t,e,i){if(!t[i]){const h=this._glyphSource.getGlyph(e,i);if(!h?.metrics)return g(i);const s=this._recordGlyph(h),r=this._currentPage,a=h.metrics;t[i]={rect:s,page:r,metrics:a,code:i,sdf:!0},this._invalidate()}return t[i]}_recordGlyph(t){const h=t.metrics;let s;if(0===h.width)s=new e(0,0,0,0);else{const e=3,r=h.width+2*e,a=h.height+2*e;s=this._binPack.allocate(r,a),s.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new i(this.width-4,this.height-4),s=this._binPack.allocate(r,a));const n=this._glyphData[this._currentPage],o=t.bitmap;let c,l;if(o)for(let t=0;t<a;t++){c=r*t,l=this.width*(s.y+t)+s.x;for(let t=0;t<r;t++)n[l+t]=o[c+t]}has("esri-glyph-debug")&&this._showDebugPage(n)}return s}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),h=new ImageData(this.width,this.height),s=h.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let r=0;r<t.length;++r)s[4*r]=t[r],s[4*r+1]=0,s[4*r+2]=0,s[4*r+3]=255;i.putImageData(h,0,0),document.body.appendChild(e)}}export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as d}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{AnimatedSymbolRepeatType as u}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as f}from"./animatedFormats/utils.js";import{TextureWrapMode as w}from"../../../webgl/enums.js";import{Texture as y}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const v=[1,1],g=l(),R={none:u.None,loop:u.Loop,oscillate:u.Oscillate};function q(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?R[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class _ extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),d),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),d),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=i(this.texture),this.requestRender()}),d),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),p(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),d)]),n.element.load().catch((t=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=i(this.texture)}get textureSize(){return v}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,i=e?r.naturalWidth:s?r.videoWidth:r.width,n=e?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(i,n),this.texture){if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}}else{const e=new x;if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=i,e.height=n,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new y(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(f(r,q(this.elementView.element.animationOptions),null,s),"play")}else this.texture=new y(t,e,r);this.texture.generateMipmap(),s&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),"requestVideoFrameCallback"in e?e.requestVideoFrameCallback((()=>this.requestRender())):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:v,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,s){const{coords:i,bounds:n}=this.elementView;if(null==i||null==n)return;const[o,a,d,l]=i.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,d[0]-h,d[1]-p,l[0]-h,l[1]-p]);let u=t;if(s){const[e,,t]=n,{worldWidth:r,xBounds:i}=s,[o,a]=i;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(g,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,g[6]/g[8]*e,g[7]/g[8]*t)}}export{_ as default};
5
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,when as a,initial as d}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{AnimatedSymbolRepeatType as u}from"../../../../symbols/cim/enums.js";import{DisplayObject as c}from"../DisplayObject.js";import{play as f}from"./animatedFormats/utils.js";import{TextureWrapMode as w}from"../../../webgl/enums.js";import{Texture as y}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const v=[1,1],R=l(),g={none:u.None,loop:u.Loop,oscillate:u.Oscillate};function q(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?g[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class _ extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=h(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._handles.add([o((()=>this.elementView.element.opacity),(e=>this.opacity=e),d),o((()=>[this.elementView.coords]),(()=>{this.requestRender()}),d),o((()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions]),(()=>{this._handles.remove("play"),this.texture=i(this.texture),this.requestRender()}),d),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),p(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",(()=>this.requestRender())),t(e.content,"loadeddata",(()=>this.requestRender())),t(e.content,"loaded",(()=>this.requestRender()))]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback((()=>this.requestRender())):this._handles.add([t(e.content,"seeked",(()=>this.requestRender()))]),this.requestRender())}),d)]),n.element.load().catch((t=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))}))}getMesh(e){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=i(this.texture)}get textureSize(){return v}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,i=e?r.naturalWidth:s?r.videoWidth:r.width,n=e?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(i,n),this.texture){if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}}else{const e=new x(i,n);if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new y(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.add(f(r,q(this.elementView.element.animationOptions),null,s),"play")}else this.texture=new y(t,e,r);this.texture.generateMipmap(),s&&("requestVideoFrameCallback"in r?r.requestVideoFrameCallback((()=>this.requestRender())):r.paused||this.requestRender())}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),"requestVideoFrameCallback"in e?e.requestVideoFrameCallback((()=>this.requestRender())):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?t.render(e,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:v,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._indices}):this.requestRender()}updateDrawCoords(e,t,r,s){const{coords:i,bounds:n}=this.elementView;if(null==i||null==n)return;const[o,a,d,l]=i.rings[0],m=this._vertices,{x:h,y:p}=e;m.set([a[0]-h,a[1]-p,o[0]-h,o[1]-p,d[0]-h,d[1]-p,l[0]-h,l[1]-p]);let u=t;if(s){const[e,,t]=n,{worldWidth:r,xBounds:i}=s,[o,a]=i;e<o&&t>o?u=r:t>a&&e<a&&(u=-r)}this.wrapAroundShift=u,this.isWrapAround=0!==u}_updatePerspectiveTransform(e,t){const r=this._vertices;n(R,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,R[6]/R[8]*e,R[7]/R[8]*t)}}export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as s}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import h from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import{DisplayObject as u}from"../DisplayObject.js";import m from"../../../layers/support/Geometry.js";import{TextureWrapMode as d}from"../../../webgl/enums.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends u{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),s))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:s}=e;if(0!==i&&0!==s){if(this.texture)e.paused||this.texture.setData(e);else{const t=new p;t.wrapMode=d.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,t.width=i,t.height=s,this.texture=new c(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const s=this.element,o=this._getFrameInfo();if(!s||!o)return;this._initializeData(t,o,r);const{controlPoints:n,horizon:a}=o,u=Math.sqrt(n.length),d=u,{x:c,y:p}=t,x=this._vertices,y=n[0],g=n[u-1],P=n[(d-1)*u],w=n[(d-1)*u+u-1],_=l(a?a[0].mapPoint:y.mapPoint,r),v=l(a?a[1].mapPoint:g.mapPoint,r),j=l(P.mapPoint,r),A=l(w.mapPoint,r);this.clipGeometry=a?new m({geometry:h.fromJSON({rings:[[[j.x,j.y],[A.x,A.y],[v.x,v.y],[_.x,_.y],[j.x,j.y]]],spatialReference:r})}):null;for(let h=0;h<n.length;h++){const t=n[h],{sourcePoint:e,mapPoint:i}=t;if(null==e||null==i)continue;const s=l(i,r);x[h*f+0]=s.x-c,x[h*f+1]=s.y-p}let M=e;if(i){const t=Math.min(_.x,v.x,j.x,A.x),e=Math.max(_.x,v.x,j.x,A.x),{worldWidth:r,xBounds:s}=i,[o,n]=s;t<o&&e>o?M=r:e>n&&t<n&&(M=-r)}this.wrapAroundShift=M,this.isWrapAround=0!==M}draw(t,e){this.visible&&(this.isReady&&this._vertices&&this._indices&&this._texCoords?e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices}):this.requestRender())}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,s=Math.sqrt(i.length),o=s,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let m=0;m<i.length;m++){const e=i[m],{sourcePoint:s,mapPoint:o}=e;if(null==s||null==o)continue;const h=l(o,r);n[m*f+0]=h.x-t.x,n[m*f+1]=h.y-t.y,a[2*m+0]=s.x,a[2*m+1]=s.y}const h=new Uint16Array(o*s+(o-2)*(s+2));let u=0;for(let l=0;l<o;l++){for(let t=0;t<s;t++)h[u++]=l*s+t,h[u++]=(l+1)*s+t;l<o-2&&(h[u++]=(l+1)*s+(s-1),h[u++]=(l+1)*s)}this._vertices=n,this._texCoords=a,this._indices=h}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,s=e.endX,n=e.endY;r=[{sourcePoint:o(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)},{sourcePoint:o(s,n),mapPoint:new a(e.endLongitude,e.endLatitude)}]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map((({x:t})=>t))),s=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:h,lon:l}=t[n];r[n]={sourcePoint:o(e*s,-i*s),mapPoint:new a(l,h)}}return r}}export{x as default};
5
+ import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as s}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import h from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import{DisplayObject as u}from"../DisplayObject.js";import m from"../../../layers/support/Geometry.js";import{TextureWrapMode as d}from"../../../webgl/enums.js";import{Texture as c}from"../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends u{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i((()=>this.element),(()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",(()=>this.requestRender())))}),s))}getMesh(t){throw new Error("Method not implemented.")}destroy(){this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:s}=e;if(0!==i&&0!==s){if(this.texture)e.paused||this.texture.setData(e);else{const t=new p(i,s);t.wrapMode=d.CLAMP_TO_EDGE,t.preMultiplyAlpha=!0,this.texture=new c(r,t,e)}e.paused||(this.texture.generateMipmap(),this.requestRender()),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const s=this.element,o=this._getFrameInfo();if(!s||!o)return;this._initializeData(t,o,r);const{controlPoints:n,horizon:a}=o,u=Math.sqrt(n.length),d=u,{x:c,y:p}=t,x=this._vertices,y=n[0],g=n[u-1],P=n[(d-1)*u],w=n[(d-1)*u+u-1],_=l(a?a[0].mapPoint:y.mapPoint,r),v=l(a?a[1].mapPoint:g.mapPoint,r),j=l(P.mapPoint,r),A=l(w.mapPoint,r);this.clipGeometry=a?new m({geometry:h.fromJSON({rings:[[[j.x,j.y],[A.x,A.y],[v.x,v.y],[_.x,_.y],[j.x,j.y]]],spatialReference:r})}):null;for(let h=0;h<n.length;h++){const t=n[h],{sourcePoint:e,mapPoint:i}=t;if(null==e||null==i)continue;const s=l(i,r);x[h*f+0]=s.x-c,x[h*f+1]=s.y-p}let M=e;if(i){const t=Math.min(_.x,v.x,j.x,A.x),e=Math.max(_.x,v.x,j.x,A.x),{worldWidth:r,xBounds:s}=i,[o,n]=s;t<o&&e>o?M=r:e>n&&t<n&&(M=-r)}this.wrapAroundShift=M,this.isWrapAround=0!==M}draw(t,e){this.visible&&(this.isReady&&this._vertices&&this._indices&&this._texCoords?e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices}):this.requestRender())}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,s=Math.sqrt(i.length),o=s,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let m=0;m<i.length;m++){const e=i[m],{sourcePoint:s,mapPoint:o}=e;if(null==s||null==o)continue;const h=l(o,r);n[m*f+0]=h.x-t.x,n[m*f+1]=h.y-t.y,a[2*m+0]=s.x,a[2*m+1]=s.y}const h=new Uint16Array(o*s+(o-2)*(s+2));let u=0;for(let l=0;l<o;l++){for(let t=0;t<s;t++)h[u++]=l*s+t,h[u++]=(l+1)*s+t;l<o-2&&(h[u++]=(l+1)*s+(s-1),h[u++]=(l+1)*s)}this._vertices=n,this._texCoords=a,this._indices=h}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,s=e.endX,n=e.endY;r=[{sourcePoint:o(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)},{sourcePoint:o(s,n),mapPoint:new a(e.endLongitude,e.endLatitude)}]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map((({x:t})=>t))),s=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:h,lon:l}=t[n];r[n]={sourcePoint:o(e*s,-i*s),mapPoint:new a(l,h)}}return r}}export{x as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as e}from"./definitions.js";import{log2 as i}from"./GeometryUtils.js";import s from"./Rect.js";import a from"./RectangleBinPack.js";import{TextureWrapMode as r}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../webgl/TextureDescriptor.js";function c(t){return t&&"static"===t.type}class n{constructor(t,e,i=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new a(this._pageWidth,this._pageHeight);const s=Math.floor(this._pageWidth),r=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*r)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getWidth(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[0]}getHeight(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[1]}getPageTexture(t){return t<this._mosaicPages.length?this._mosaicPages[t].texture:null}has(t){return this._mosaicRects.has(t)}get itemCount(){return this._mosaicRects.size}getSpriteItem(t){return this._mosaicRects.get(t)}addSpriteItem(t,i,a,r,o,h,n=1,g="Linear",p=.5,m=1){if(this._mosaicRects.has(t))return this._mosaicRects.get(t);let d,u,l;if(c(a))[d,u,l]=this._allocateImage(i[0],i[1]);else{d=new s(0,0,i[0],i[1]),u=this._mosaicPages.length;const t=void 0;this._mosaicPages.push({mosaicsData:a,size:[i[0]+2*e,i[1]+2*e],dirty:!0,texture:t})}if(d.width<=0||d.height<=0)return null;const _={type:"sprite",rect:d,width:i[0],height:i[1],sdf:o,simplePattern:h,rasterizationScale:n,samplingMode:g,sdfPaddingRatio:p,sdfDecodeCoeff:m,page:u};return this._mosaicRects.set(t,_),c(a)&&(has("esri-mosaic-debug")&&this._showDebugSprite(i,a.data),this._copy({rect:d,spriteSize:i,spriteData:a.data,page:u,pageSize:l,repeat:r,sdf:o})),_}hasItemsToProcess(){return 0!==this._spriteCopyQueue.length}processNextItem(){const t=this._spriteCopyQueue.pop();t&&this._copy(t)}getMosaicItemPosition(t){const i=this.getSpriteItem(t),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,r=i.height,o=e,h=this._mosaicPages[i.page].size;return{size:[i.width,i.height],tl:[(s.x+o)/h[0],(s.y+o)/h[1]],br:[(s.x+o+a)/h[0],(s.y+o+r)/h[1]],page:i.page}}bind(t,e,i=0,s=0){const a=this._mosaicPages[i],r=a.mosaicsData;let o=a.texture;if(o||(o=p(t,a.size),a.texture=o),o.setSamplingMode(e),c(r))t.bindTexture(o,s),a.dirty&&(o.setData(new Uint8Array(r.data.buffer)),o.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(i));else{r.data.loadFrame(o),t.bindTexture(o,s),o.generateMipmap()}a.dirty=!1}getTexture(t,e=0){const i=this._mosaicPages[e],s=i.mosaicsData;let a=i.texture;if(a||(a=p(t,i.size),i.texture=a),c(s))i.dirty&&(a.setData(new Uint8Array(s.data.buffer)),a.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(e));else{s.data.loadFrame(a),a.generateMipmap()}return i.dirty=!1,a}dispose(){this._binPack=null;for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose();const i=t.mosaicsData;if(!c(i)){i.data.destroy()}}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(t,e,i,s,a,r,o,h,c,n,g){let p=s*e+i,m=h*r+o;if(g){m-=r;for(let o=-1;o<=n;o++,p=((o+n)%n+s)*e+i,m+=r)for(let e=-1;e<=c;e++)a[m+e]=t[p+(e+c)%c]}else for(let d=0;d<n;d++){for(let e=0;e<c;e++)a[m+e]=t[p+e];p+=e,m+=r}}_copy(i){if(i.page>=this._mosaicPages.length)return;const s=this._mosaicPages[i.page],a=s.mosaicsData;if(!c(s.mosaicsData))throw new t("mapview-invalid-resource","unsuitable data type!");const r=i.spriteData,o=a.data;n._copyBits(r,i.spriteSize[0],0,0,o,i.pageSize[0],i.rect.x+e,i.rect.y+e,i.spriteSize[0],i.spriteSize[1],i.repeat),s.dirty=!0}_allocateImage(t,r){t+=2*e,r+=2*e;const o=Math.max(t,r);if(this._maxItemSize&&this._maxItemSize<o){const e=2**Math.ceil(i(t)),a=2**Math.ceil(i(r)),o=new s(0,0,t,r);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(e*a)},size:[e,a],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[e,a]]}const h=this._binPack.allocate(t,r);if(h.width<=0){const e=this._mosaicPages[this._currentPage];return!e.dirty&&c(e.mosaicsData)&&(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new a(this._pageWidth,this._pageHeight),this._allocateImage(t,r)}return[h,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([t,e],i){const s=document.createElement("canvas");s.width=t,s.height=e,s.setAttribute("style",`position: absolute; top: ${4+204*g++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const a=s.getContext("2d"),r=new ImageData(t,e);r.data.set(new Uint8Array(i.buffer)),a.putImageData(r,0,0),document.body.appendChild(s)}_showDebugPage(t){const e=this._mosaicPages[t],{size:[i,s],mosaicsData:a}=e;if(!c(a))return;const r=`mosaicDebugPage${t}`,o=document.getElementById(r)??document.createElement("canvas");o.id=r,o.width=i,o.height=s,o.setAttribute("style",`position: absolute; top: ${4+204*t}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const h=o.getContext("2d"),n=new ImageData(i,s);n.data.set(new Uint8Array(a.data.buffer)),h.putImageData(n,0,0),document.body.appendChild(o)}}let g=0;function p(t,e){const i=new h;return i.width=e[0],i.height=e[1],i.wrapMode=r.CLAMP_TO_EDGE,new o(t,i,null)}export{n as default};
5
+ import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as e}from"./definitions.js";import{log2 as i}from"./GeometryUtils.js";import s from"./Rect.js";import a from"./RectangleBinPack.js";import{TextureWrapMode as r}from"../../../webgl/enums.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../webgl/TextureDescriptor.js";function c(t){return t&&"static"===t.type}class n{constructor(t,e,i=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._spriteCopyQueue=[],this.pixelRatio=1,this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this.pixelRatio=window.devicePixelRatio||1,this._binPack=new a(this._pageWidth,this._pageHeight);const s=Math.floor(this._pageWidth),r=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*r)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getWidth(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[0]}getHeight(t){return t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[1]}getPageTexture(t){return t<this._mosaicPages.length?this._mosaicPages[t].texture:null}has(t){return this._mosaicRects.has(t)}get itemCount(){return this._mosaicRects.size}getSpriteItem(t){return this._mosaicRects.get(t)}addSpriteItem(t,i,a,r,o,h,n=1,g="Linear",p=.5,m=1){if(this._mosaicRects.has(t))return this._mosaicRects.get(t);let d,u,l;if(c(a))[d,u,l]=this._allocateImage(i[0],i[1]);else{d=new s(0,0,i[0],i[1]),u=this._mosaicPages.length;const t=void 0;this._mosaicPages.push({mosaicsData:a,size:[i[0]+2*e,i[1]+2*e],dirty:!0,texture:t})}if(d.width<=0||d.height<=0)return null;const _={type:"sprite",rect:d,width:i[0],height:i[1],sdf:o,simplePattern:h,rasterizationScale:n,samplingMode:g,sdfPaddingRatio:p,sdfDecodeCoeff:m,page:u};return this._mosaicRects.set(t,_),c(a)&&(has("esri-mosaic-debug")&&this._showDebugSprite(i,a.data),this._copy({rect:d,spriteSize:i,spriteData:a.data,page:u,pageSize:l,repeat:r,sdf:o})),_}hasItemsToProcess(){return 0!==this._spriteCopyQueue.length}processNextItem(){const t=this._spriteCopyQueue.pop();t&&this._copy(t)}getMosaicItemPosition(t){const i=this.getSpriteItem(t),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,r=i.height,o=e,h=this._mosaicPages[i.page].size;return{size:[i.width,i.height],tl:[(s.x+o)/h[0],(s.y+o)/h[1]],br:[(s.x+o+a)/h[0],(s.y+o+r)/h[1]],page:i.page}}bind(t,e,i=0,s=0){const a=this._mosaicPages[i],r=a.mosaicsData;let o=a.texture;if(o||(o=p(t,a.size),a.texture=o),o.setSamplingMode(e),c(r))t.bindTexture(o,s),a.dirty&&(o.setData(new Uint8Array(r.data.buffer)),o.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(i));else{r.data.loadFrame(o),t.bindTexture(o,s),o.generateMipmap()}a.dirty=!1}getTexture(t,e=0){const i=this._mosaicPages[e],s=i.mosaicsData;let a=i.texture;if(a||(a=p(t,i.size),i.texture=a),c(s))i.dirty&&(a.setData(new Uint8Array(s.data.buffer)),a.generateMipmap(),has("esri-mosaic-debug")&&this._showDebugPage(e));else{s.data.loadFrame(a),a.generateMipmap()}return i.dirty=!1,a}dispose(){this._binPack=null;for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose();const i=t.mosaicsData;if(!c(i)){i.data.destroy()}}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(t,e,i,s,a,r,o,h,c,n,g){let p=s*e+i,m=h*r+o;if(g){m-=r;for(let o=-1;o<=n;o++,p=((o+n)%n+s)*e+i,m+=r)for(let e=-1;e<=c;e++)a[m+e]=t[p+(e+c)%c]}else for(let d=0;d<n;d++){for(let e=0;e<c;e++)a[m+e]=t[p+e];p+=e,m+=r}}_copy(i){if(i.page>=this._mosaicPages.length)return;const s=this._mosaicPages[i.page],a=s.mosaicsData;if(!c(s.mosaicsData))throw new t("mapview-invalid-resource","unsuitable data type!");const r=i.spriteData,o=a.data;n._copyBits(r,i.spriteSize[0],0,0,o,i.pageSize[0],i.rect.x+e,i.rect.y+e,i.spriteSize[0],i.spriteSize[1],i.repeat),s.dirty=!0}_allocateImage(t,r){t+=2*e,r+=2*e;const o=Math.max(t,r);if(this._maxItemSize&&this._maxItemSize<o){const e=2**Math.ceil(i(t)),a=2**Math.ceil(i(r)),o=new s(0,0,t,r);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(e*a)},size:[e,a],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[e,a]]}const h=this._binPack.allocate(t,r);if(h.width<=0){const e=this._mosaicPages[this._currentPage];return!e.dirty&&c(e.mosaicsData)&&(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new a(this._pageWidth,this._pageHeight),this._allocateImage(t,r)}return[h,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([t,e],i){const s=document.createElement("canvas");s.width=t,s.height=e,s.setAttribute("style",`position: absolute; top: ${4+204*g++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);const a=s.getContext("2d"),r=new ImageData(t,e);r.data.set(new Uint8Array(i.buffer)),a.putImageData(r,0,0),document.body.appendChild(s)}_showDebugPage(t){const e=this._mosaicPages[t],{size:[i,s],mosaicsData:a}=e;if(!c(a))return;const r=`mosaicDebugPage${t}`,o=document.getElementById(r)??document.createElement("canvas");o.id=r,o.width=i,o.height=s,o.setAttribute("style",`position: absolute; top: ${4+204*t}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);const h=o.getContext("2d"),n=new ImageData(i,s);n.data.set(new Uint8Array(a.data.buffer)),h.putImageData(n,0,0),document.body.appendChild(o)}}let g=0;function p(t,e){const i=new h(e[0],e[1]);return i.wrapMode=r.CLAMP_TO_EDGE,new o(t,i,null)}export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as t}from"../DefaultVertexAttributeLayouts.js";import{FeatureTile as r}from"../FeatureTile.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as a,PrimitiveType as l,Usage as f,TextureWrapMode as m,TextureSamplingMode as u}from"../../../../webgl/enums.js";import{createProgram as c}from"../../../../webgl/ProgramTemplate.js";import{Texture as d}from"../../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as g}from"../../../../webgl/VertexArrayObject.js";const _=512,x=512,b=16,p=8,T=(x-2*p)/5;class y extends o{constructor(){super(...arguments),this._color=e(1,0,0,1)}dispose(){this._outlineProgram?.dispose(),this._outlineProgram=null,this._tileInfoProgram?.dispose(),this._tileInfoProgram=null,this._outlineVertexArrayObject?.dispose(),this._outlineVertexArrayObject=null,this._tileInfoVertexArrayObject?.dispose(),this._tileInfoVertexArrayObject=null,this._ctx=null}prepareState({context:e}){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!1)}draw(e,t){const{context:o,requestRender:i,allowDelayedRender:s}=e;if(!t.isReady&&t instanceof r&&t.hasData)return;if(this._loadWGLResources(o),s&&null!=i&&(!this._outlineProgram.compiled||!this._tileInfoProgram.compiled))return void i();o.bindVAO(this._outlineVertexArrayObject),o.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._outlineProgram.setUniform2f("u_coord_range",t.rangeX,t.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),o.drawArrays(l.LINE_STRIP,0,4);const n=this._getTexture(o,t);n?(o.bindVAO(this._tileInfoVertexArrayObject),o.useProgram(this._tileInfoProgram),o.bindTexture(n,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",t.rangeX/t.width,t.rangeY/t.height),this._tileInfoProgram.setUniform2f("u_delta",0,0),this._tileInfoProgram.setUniform2f("u_dimensions",n.descriptor.width,n.descriptor.height),o.drawArrays(l.TRIANGLE_STRIP,0,4),o.bindVAO()):o.bindVAO()}_loadWGLResources(e){if(this._outlineProgram&&this._tileInfoProgram)return;const r=c(e,i),o=c(e,s),a=new Int8Array([0,0,1,0,1,1,0,1]),l=n.createVertex(e,f.STATIC_DRAW,a),m=new g(e,i.attributes,t,new Map([["geometry",l]])),u=new Int8Array([0,0,1,0,0,1,1,1]),d=n.createVertex(e,f.STATIC_DRAW,u),h=new g(e,s.attributes,t,new Map([["geometry",d]]));this._outlineProgram=r,this._tileInfoProgram=o,this._outlineVertexArrayObject=m,this._tileInfoVertexArrayObject=h}_getTexture(e,t){if(!this._ctx){const e=document.createElement("canvas");e.width=_,e.height=x,this._ctx=e.getContext("2d")}if(!t.tileDebugInfoTexture){const r=new h;r.wrapMode=m.CLAMP_TO_EDGE,r.samplingMode=u.LINEAR,r.isImmutable=!0,r.width=_,r.height=x,t.tileDebugInfoTexture=new d(e,r)}const r=this._ctx;r.clearRect(0,0,r.canvas.width,r.canvas.height),r.textAlign="left",r.textBaseline="top",r.font=b-2+"px sans-serif",r.lineWidth=2,r.fillStyle="white",r.strokeStyle="black";const{debugSlot:o}=t;let i=p+T*o;const s=`${o}) ${t.key.id} (${t.constructor.name})`;r.strokeText(s,p,i),r.fillText(s,p,i),i+=b;const{debugInfo:n}=t;if(n){const{length:e,minOrderedLength:t,minUnorderedLength:o,triangleCount:s}=n.display;if(e>0){const t=`Length: ${e}`;r.strokeText(t,p,i),r.fillText(t,p,i),i+=b}if(t){const e=`Min ordered length: ${t}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(o){const e=`Min unordered length: ${o}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(s>0){s>1e5&&(r.fillStyle="red",r.strokeStyle="white");const e=`Triangle count: ${s}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}const{bytesUsed:a,bytesReserved:l}=n.memory;if(r.fillStyle="white",r.strokeStyle="black",a>0||l>0){const e=`Memory usage: ${a} of ${l} bytes`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}}return t.tileDebugInfoTexture.setData(r.canvas),t.tileDebugInfoTexture}}export{y as default};
5
+ import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{Pos2b as t}from"../DefaultVertexAttributeLayouts.js";import{FeatureTile as r}from"../FeatureTile.js";import o from"./WGLBrush.js";import{background as i}from"../shaders/BackgroundPrograms.js";import{tileInfo as s}from"../shaders/TileInfoPrograms.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{BlendFactor as a,PrimitiveType as l,Usage as f,TextureWrapMode as m,TextureSamplingMode as u}from"../../../../webgl/enums.js";import{createProgram as c}from"../../../../webgl/ProgramTemplate.js";import{Texture as d}from"../../../../webgl/Texture.js";import{TextureDescriptor as g}from"../../../../webgl/TextureDescriptor.js";import{VertexArrayObject as h}from"../../../../webgl/VertexArrayObject.js";const _=512,x=512,b=16,p=8,T=(x-2*p)/5;class y extends o{constructor(){super(...arguments),this._color=e(1,0,0,1)}dispose(){this._outlineProgram?.dispose(),this._outlineProgram=null,this._tileInfoProgram?.dispose(),this._tileInfoProgram=null,this._outlineVertexArrayObject?.dispose(),this._outlineVertexArrayObject=null,this._tileInfoVertexArrayObject?.dispose(),this._tileInfoVertexArrayObject=null,this._ctx=null}prepareState({context:e}){e.setBlendingEnabled(!0),e.setBlendFunctionSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA),e.setColorMask(!0,!0,!0,!0),e.setStencilWriteMask(0),e.setStencilTestEnabled(!1)}draw(e,t){const{context:o,requestRender:i,allowDelayedRender:s}=e;if(!t.isReady&&t instanceof r&&t.hasData)return;if(this._loadWGLResources(o),s&&null!=i&&(!this._outlineProgram.compiled||!this._tileInfoProgram.compiled))return void i();o.bindVAO(this._outlineVertexArrayObject),o.useProgram(this._outlineProgram),this._outlineProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._outlineProgram.setUniform2f("u_coord_range",t.rangeX,t.rangeY),this._outlineProgram.setUniform1f("u_depth",0),this._outlineProgram.setUniform4fv("u_color",this._color),o.drawArrays(l.LINE_STRIP,0,4);const n=this._getTexture(o,t);n?(o.bindVAO(this._tileInfoVertexArrayObject),o.useProgram(this._tileInfoProgram),o.bindTexture(n,0),this._tileInfoProgram.setUniformMatrix3fv("u_dvsMat3",t.transforms.displayViewScreenMat3),this._tileInfoProgram.setUniform1f("u_depth",0),this._tileInfoProgram.setUniform2f("u_coord_ratio",t.rangeX/t.width,t.rangeY/t.height),this._tileInfoProgram.setUniform2f("u_delta",0,0),this._tileInfoProgram.setUniform2f("u_dimensions",n.descriptor.width,n.descriptor.height),o.drawArrays(l.TRIANGLE_STRIP,0,4),o.bindVAO()):o.bindVAO()}_loadWGLResources(e){if(this._outlineProgram&&this._tileInfoProgram)return;const r=c(e,i),o=c(e,s),a=new Int8Array([0,0,1,0,1,1,0,1]),l=n.createVertex(e,f.STATIC_DRAW,a),m=new h(e,i.attributes,t,new Map([["geometry",l]])),u=new Int8Array([0,0,1,0,0,1,1,1]),d=n.createVertex(e,f.STATIC_DRAW,u),g=new h(e,s.attributes,t,new Map([["geometry",d]]));this._outlineProgram=r,this._tileInfoProgram=o,this._outlineVertexArrayObject=m,this._tileInfoVertexArrayObject=g}_getTexture(e,t){if(!this._ctx){const e=document.createElement("canvas");e.width=_,e.height=x,this._ctx=e.getContext("2d")}if(!t.tileDebugInfoTexture){const r=new g(_,x);r.wrapMode=m.CLAMP_TO_EDGE,r.samplingMode=u.LINEAR,r.isImmutable=!0,t.tileDebugInfoTexture=new d(e,r)}const r=this._ctx;r.clearRect(0,0,r.canvas.width,r.canvas.height),r.textAlign="left",r.textBaseline="top",r.font=b-2+"px sans-serif",r.lineWidth=2,r.fillStyle="white",r.strokeStyle="black";const{debugSlot:o}=t;let i=p+T*o;const s=`${o}) ${t.key.id} (${t.constructor.name})`;r.strokeText(s,p,i),r.fillText(s,p,i),i+=b;const{debugInfo:n}=t;if(n){const{length:e,minOrderedLength:t,minUnorderedLength:o,triangleCount:s}=n.display;if(e>0){const t=`Length: ${e}`;r.strokeText(t,p,i),r.fillText(t,p,i),i+=b}if(t){const e=`Min ordered length: ${t}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(o){const e=`Min unordered length: ${o}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}if(s>0){s>1e5&&(r.fillStyle="red",r.strokeStyle="white");const e=`Triangle count: ${s}`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}const{bytesUsed:a,bytesReserved:l}=n.memory;if(r.fillStyle="white",r.strokeStyle="black",a>0||l>0){const e=`Memory usage: ${a} of ${l} bytes`;r.strokeText(e,p,i),r.fillText(e,p,i),i+=b}}return t.tileDebugInfoTexture.setData(r.canvas),t.tileDebugInfoTexture}}export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../../../../../core/Logger.js";import{textureBindingHighlight1 as i,maxHighlightReasons as t}from"../../definitions.js";import{shadeTextureSize as e,sigma as l}from"./parameters.js";import r from"../../../../../support/HighlightOptions.js";import{TextureWrapMode as h}from"../../../../../webgl/enums.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../webgl/TextureDescriptor.js";const a=()=>o.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient");function u(o,i){i.fillColor[0]=o.color.r/255,i.fillColor[1]=o.color.g/255,i.fillColor[2]=o.color.b/255,i.fillColor[3]=o.color.a,o.haloColor?(i.outlineColor[0]=o.haloColor.r/255,i.outlineColor[1]=o.haloColor.g/255,i.outlineColor[2]=o.haloColor.b/255,i.outlineColor[3]=o.haloColor.a):(i.outlineColor[0]=i.fillColor[0],i.outlineColor[1]=i.fillColor[1],i.outlineColor[2]=i.fillColor[2],i.outlineColor[3]=i.fillColor[3]),i.fillColor[3]*=o.fillOpacity,i.outlineColor[3]*=o.haloOpacity,i.fillColor[0]*=i.fillColor[3],i.fillColor[1]*=i.fillColor[3],i.fillColor[2]*=i.fillColor[3],i.outlineColor[0]*=i.outlineColor[3],i.outlineColor[1]*=i.outlineColor[3],i.outlineColor[2]*=i.outlineColor[3],i.outlineWidth=(1-o.haloBlur)*o.haloWidth,i.outerHaloWidth=o.haloBlur*o.haloWidth/2,i.innerHaloWidth=o.haloBlur*o.haloWidth/2,i.outlinePosition=0}const d=[0,0,0,0];class g{constructor(){this.type="single",this._highlightOptions=new r,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey="",this._texelData=new Uint8Array(4*e),this._minMaxDistance=[0,0]}setHighlightOptions(o){this._highlightOptions=o}applyHighlightOptions(o,t){this._updateGradientTexture(o),o.bindTexture(this._shadeTex,i),t.setUniform2fv("u_minMaxDistance",this._minMaxDistance)}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getReasonsWithGradients(){return[{activeReasons:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(o){const i=f(this._highlightOptions);if(i===this._optionsShadeTexKey)return;this._optionsShadeTexKey=i,u(this._highlightOptions,this._convertedHighlightOptions);const t=this._convertedHighlightOptions,r=t.outlinePosition-t.outlineWidth/2-t.outerHaloWidth,g=t.outlinePosition-t.outlineWidth/2,p=t.outlinePosition+t.outlineWidth/2,C=t.outlinePosition+t.outlineWidth/2+t.innerHaloWidth,c=Math.sqrt(Math.PI/2)*l,m=Math.abs(r)>c?Math.round(10*(Math.abs(r)-c))/10:0,x=Math.abs(C)>c?Math.round(10*(Math.abs(C)-c))/10:0;let _;m&&!x?a().error("The outer rim of the highlight is "+m+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards)."):!m&&x?a().error("The inner rim of the highlight is "+x+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards)."):m&&x&&a().error("The highlight is "+Math.max(m,x)+"px away from the edge of the feature; consider reducing some width values.");const w=[void 0,void 0,void 0,void 0];function T(o,i,t){w[0]=(1-t)*o[0]+t*i[0],w[1]=(1-t)*o[1]+t*i[1],w[2]=(1-t)*o[2]+t*i[2],w[3]=(1-t)*o[3]+t*i[3]}const{_texelData:v}=this;for(let l=0;l<e;++l)_=r+l/(e-1)*(C-r),_<r?(w[0]=0,w[1]=0,w[2]=0,w[3]=0):_<g?T(d,t.outlineColor,(_-r)/(g-r)):_<p?[w[0],w[1],w[2],w[3]]=t.outlineColor:_<C?T(t.outlineColor,t.fillColor,(_-p)/(C-p)):[w[0],w[1],w[2],w[3]]=t.fillColor,v[4*l]=255*w[0],v[4*l+1]=255*w[1],v[4*l+2]=255*w[2],v[4*l+3]=255*w[3];if(this._minMaxDistance[0]=r,this._minMaxDistance[1]=C,!this._shadeTex){const i=new s;i.wrapMode=h.CLAMP_TO_EDGE,i.width=e,i.height=1,this._shadeTex=new n(o,i)}this._shadeTex.updateData(0,0,0,e,1,this._texelData)}}function f(o){return`${o.color};${o.haloColor};${o.haloOpacity};${o.fillOpacity};${o.haloWidth};${o.haloBlur}`}export{g as default};
5
+ import o from"../../../../../../core/Logger.js";import{textureBindingHighlight1 as i,maxHighlightReasons as t}from"../../definitions.js";import{shadeTextureSize as e,sigma as l}from"./parameters.js";import r from"../../../../../support/HighlightOptions.js";import{TextureWrapMode as h}from"../../../../../webgl/enums.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../webgl/TextureDescriptor.js";const a=()=>o.getLogger("esri.views.2d.engine.webgl.painter.highlight.HighlightGradient");function u(o,i){i.fillColor[0]=o.color.r/255,i.fillColor[1]=o.color.g/255,i.fillColor[2]=o.color.b/255,i.fillColor[3]=o.color.a,o.haloColor?(i.outlineColor[0]=o.haloColor.r/255,i.outlineColor[1]=o.haloColor.g/255,i.outlineColor[2]=o.haloColor.b/255,i.outlineColor[3]=o.haloColor.a):(i.outlineColor[0]=i.fillColor[0],i.outlineColor[1]=i.fillColor[1],i.outlineColor[2]=i.fillColor[2],i.outlineColor[3]=i.fillColor[3]),i.fillColor[3]*=o.fillOpacity,i.outlineColor[3]*=o.haloOpacity,i.fillColor[0]*=i.fillColor[3],i.fillColor[1]*=i.fillColor[3],i.fillColor[2]*=i.fillColor[3],i.outlineColor[0]*=i.outlineColor[3],i.outlineColor[1]*=i.outlineColor[3],i.outlineColor[2]*=i.outlineColor[3],i.outlineWidth=(1-o.haloBlur)*o.haloWidth,i.outerHaloWidth=o.haloBlur*o.haloWidth/2,i.innerHaloWidth=o.haloBlur*o.haloWidth/2,i.outlinePosition=0}const d=[0,0,0,0];class g{constructor(){this.type="single",this._highlightOptions=new r,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey="",this._texelData=new Uint8Array(4*e),this._minMaxDistance=[0,0]}setHighlightOptions(o){this._highlightOptions=o}applyHighlightOptions(o,t){this._updateGradientTexture(o),o.bindTexture(this._shadeTex,i),t.setUniform2fv("u_minMaxDistance",this._minMaxDistance)}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getReasonsWithGradients(){return[{activeReasons:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(o){const i=f(this._highlightOptions);if(i===this._optionsShadeTexKey)return;this._optionsShadeTexKey=i,u(this._highlightOptions,this._convertedHighlightOptions);const t=this._convertedHighlightOptions,r=t.outlinePosition-t.outlineWidth/2-t.outerHaloWidth,g=t.outlinePosition-t.outlineWidth/2,p=t.outlinePosition+t.outlineWidth/2,C=t.outlinePosition+t.outlineWidth/2+t.innerHaloWidth,c=Math.sqrt(Math.PI/2)*l,m=Math.abs(r)>c?Math.round(10*(Math.abs(r)-c))/10:0,x=Math.abs(C)>c?Math.round(10*(Math.abs(C)-c))/10:0;let _;m&&!x?a().error("The outer rim of the highlight is "+m+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards)."):!m&&x?a().error("The inner rim of the highlight is "+x+"px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards)."):m&&x&&a().error("The highlight is "+Math.max(m,x)+"px away from the edge of the feature; consider reducing some width values.");const w=[void 0,void 0,void 0,void 0];function T(o,i,t){w[0]=(1-t)*o[0]+t*i[0],w[1]=(1-t)*o[1]+t*i[1],w[2]=(1-t)*o[2]+t*i[2],w[3]=(1-t)*o[3]+t*i[3]}const{_texelData:v}=this;for(let l=0;l<e;++l)_=r+l/(e-1)*(C-r),_<r?(w[0]=0,w[1]=0,w[2]=0,w[3]=0):_<g?T(d,t.outlineColor,(_-r)/(g-r)):_<p?[w[0],w[1],w[2],w[3]]=t.outlineColor:_<C?T(t.outlineColor,t.fillColor,(_-p)/(C-p)):[w[0],w[1],w[2],w[3]]=t.fillColor,v[4*l]=255*w[0],v[4*l+1]=255*w[1],v[4*l+2]=255*w[2],v[4*l+3]=255*w[3];if(this._minMaxDistance[0]=r,this._minMaxDistance[1]=C,!this._shadeTex){const i=new s(e,1);i.wrapMode=h.CLAMP_TO_EDGE,this._shadeTex=new n(o,i)}this._shadeTex.updateData(0,0,0,e,1,this._texelData)}}function f(o){return`${o.color};${o.haloColor};${o.haloOpacity};${o.fillOpacity};${o.haloWidth};${o.haloBlur}`}export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e}from"../../../../../../core/maybe.js";import t from"../../VertexStream.js";import{BlendFactor as r,PixelFormat as s,TextureWrapMode as i}from"../../../../../webgl/enums.js";import{Texture as o}from"../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../webgl/TextureDescriptor.js";class n{constructor(){this._layerFBOTexture=null,this._size=[0,0],this._programDesc={vsPath:"post-processing/pp",fsPath:"post-processing/filterEffect",attributes:new Map([["a_position",0]])}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,t,s){const{width:i,height:o}=t;this._createOrResizeResources(e,i,o);const{context:a,painter:n}=e,{materialManager:c}=n,l=this._programDesc,u=this._quad,_=s.colorMatrix;u.bind();const h=this._layerFBOTexture;a.bindFramebuffer(t),t.copyToTexture(0,0,i,o,0,0,h),a.setBlendingEnabled(!1),a.setStencilTestEnabled(!1);const m=c.getProgram(l);a.useProgram(m),a.bindTexture(h,2),m.setUniformMatrix4fv("u_coefficients",_),m.setUniform1i("u_colorTexture",2),u.draw(),a.setBlendingEnabled(!0),a.setBlendFunction(r.ONE,r.ONE_MINUS_SRC_ALPHA),a.setStencilTestEnabled(!0),u.unbind()}_createOrResizeResources(e,r,n){const{context:c}=e;if(!this._layerFBOTexture||this._size[0]!==r||this._size[1]!==n){if(this._size[0]=r,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(r,n);else{const e=new a;e.internalFormat=s.RGBA,e.wrapMode=i.CLAMP_TO_EDGE,e.width=r,e.height=n,this._layerFBOTexture=new o(c,e)}this._quad||(this._quad=new t(c,[-1,-1,1,-1,-1,1,1,1]))}}}export{n as Colorize};
5
+ import{disposeMaybe as e}from"../../../../../../core/maybe.js";import t from"../../VertexStream.js";import{BlendFactor as r,PixelFormat as s,TextureWrapMode as i}from"../../../../../webgl/enums.js";import{Texture as o}from"../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../webgl/TextureDescriptor.js";class n{constructor(){this._layerFBOTexture=null,this._size=[0,0],this._programDesc={vsPath:"post-processing/pp",fsPath:"post-processing/filterEffect",attributes:new Map([["a_position",0]])}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,t,s){const{width:i,height:o}=t;this._createOrResizeResources(e,i,o);const{context:a,painter:n}=e,{materialManager:c}=n,l=this._programDesc,u=this._quad,_=s.colorMatrix;u.bind();const h=this._layerFBOTexture;a.bindFramebuffer(t),t.copyToTexture(0,0,i,o,0,0,h),a.setBlendingEnabled(!1),a.setStencilTestEnabled(!1);const m=c.getProgram(l);a.useProgram(m),a.bindTexture(h,2),m.setUniformMatrix4fv("u_coefficients",_),m.setUniform1i("u_colorTexture",2),u.draw(),a.setBlendingEnabled(!0),a.setBlendFunction(r.ONE,r.ONE_MINUS_SRC_ALPHA),a.setStencilTestEnabled(!0),u.unbind()}_createOrResizeResources(e,r,n){const{context:c}=e;if(!this._layerFBOTexture||this._size[0]!==r||this._size[1]!==n){if(this._size[0]=r,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(r,n);else{const e=new a(r,n);e.internalFormat=s.RGBA,e.wrapMode=i.CLAMP_TO_EDGE,this._layerFBOTexture=new o(c,e)}this._quad||(this._quad=new t(c,[-1,-1,1,-1,-1,1,1,1]))}}}export{n as Colorize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{pt2px as t}from"../../../../../../core/screenUtils.js";import r from"../../VertexStream.js";import{BlendFactor as s,PixelFormat as i,TextureWrapMode as o}from"../../../../../webgl/enums.js";import{FramebufferObject as a}from"../../../../../webgl/FramebufferObject.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as l}from"../../../../../webgl/TextureDescriptor.js";const u=[1,0],h=[0,1];class _{constructor(){this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this._quad=null,this._programDesc={blur:{vsPath:"post-processing/pp",fsPath:"post-processing/blur/gaussianBlur",attributes:new Map([["a_position",0]])},composite:{vsPath:"post-processing/pp",fsPath:"post-processing/drop-shadow/composite",attributes:new Map([["a_position",0]])},blit:{vsPath:"post-processing/pp",fsPath:"post-processing/blit",attributes:new Map([["a_position",0]])}}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture),this._horizontalBlurFBO=e(this._horizontalBlurFBO),this._verticalBlurFBO=e(this._verticalBlurFBO)}draw(e,i,o){const{context:a,state:n,painter:l}=e,{materialManager:_}=l,c=this._programDesc,p=i.width,m=i.height,f=[Math.round(p),Math.round(m)],{blurRadius:B,offsetX:d,offsetY:b,color:O}=o,F=[t(d),t(b)];this._createOrResizeResources(e,p,m,f);const w=this._horizontalBlurFBO,T=this._verticalBlurFBO;a.setStencilWriteMask(0),a.setStencilTestEnabled(!1),a.setDepthWriteEnabled(!1),a.setDepthTestEnabled(!1);const x=this._layerFBOTexture;i.copyToTexture(0,0,p,m,0,0,x),this._quad||(this._quad=new r(a,[-1,-1,1,-1,-1,1,1,1])),a.setViewport(0,0,f[0],f[1]);const g=this._quad;g.bind(),a.setBlendingEnabled(!1);const z=_.getProgram(c.blur,[{name:"radius",value:Math.ceil(B)}]);a.useProgram(z),a.bindFramebuffer(w),a.bindTexture(i.colorTexture,4),z.setUniform1i("u_colorTexture",4),z.setUniform2fv("u_texSize",f),z.setUniform2fv("u_direction",u),z.setUniform1f("u_sigma",B),g.draw(),a.bindFramebuffer(T),a.bindTexture(w?.colorTexture,5),z.setUniform1i("u_colorTexture",5),z.setUniform2fv("u_direction",h),g.draw(),a.bindFramebuffer(i),a.setViewport(0,0,p,m);const M=_.getProgram(c.composite);a.useProgram(M),a.bindTexture(T?.colorTexture,2),M.setUniform1i("u_blurTexture",2),a.bindTexture(x,3),M.setUniform1i("u_layerFBOTexture",3),M.setUniform4fv("u_shadowColor",[O[3]*(O[0]/255),O[3]*(O[1]/255),O[3]*(O[2]/255),O[3]]),M.setUniformMatrix3fv("u_displayViewMat3",n.displayMat3),M.setUniform2fv("u_shadowOffset",F),g.draw(),a.setBlendingEnabled(!0),a.setStencilTestEnabled(!0),a.setBlendFunction(s.ONE,s.ONE_MINUS_SRC_ALPHA),g.unbind()}_createOrResizeResources(e,t,r,s){const{context:u}=e;if(!this._horizontalBlurFBO||this._size[0]!==t||this._size[1]!==r){if(this._size[0]=t,this._size[1]=r,this._horizontalBlurFBO)this._horizontalBlurFBO.resize(s[0],s[1]);else{const e=new l(s[0],s[1]);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._horizontalBlurFBO=new a(u,e)}if(this._verticalBlurFBO)this._verticalBlurFBO.resize(s[0],s[1]);else{const e=new l(s[0],s[1]);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._verticalBlurFBO=new a(u,e)}if(this._layerFBOTexture)this._layerFBOTexture.resize(t,r);else{const e=new l;e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,e.width=t,e.height=r,this._layerFBOTexture=new n(u,e)}}}}export{_ as DropShadow};
5
+ import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{pt2px as t}from"../../../../../../core/screenUtils.js";import r from"../../VertexStream.js";import{BlendFactor as s,PixelFormat as i,TextureWrapMode as o}from"../../../../../webgl/enums.js";import{FramebufferObject as a}from"../../../../../webgl/FramebufferObject.js";import{Texture as n}from"../../../../../webgl/Texture.js";import{TextureDescriptor as l}from"../../../../../webgl/TextureDescriptor.js";const u=[1,0],h=[0,1];class _{constructor(){this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this._quad=null,this._programDesc={blur:{vsPath:"post-processing/pp",fsPath:"post-processing/blur/gaussianBlur",attributes:new Map([["a_position",0]])},composite:{vsPath:"post-processing/pp",fsPath:"post-processing/drop-shadow/composite",attributes:new Map([["a_position",0]])},blit:{vsPath:"post-processing/pp",fsPath:"post-processing/blit",attributes:new Map([["a_position",0]])}}}dispose(){this._layerFBOTexture=e(this._layerFBOTexture),this._horizontalBlurFBO=e(this._horizontalBlurFBO),this._verticalBlurFBO=e(this._verticalBlurFBO)}draw(e,i,o){const{context:a,state:n,painter:l}=e,{materialManager:_}=l,c=this._programDesc,p=i.width,m=i.height,f=[Math.round(p),Math.round(m)],{blurRadius:B,offsetX:d,offsetY:b,color:O}=o,F=[t(d),t(b)];this._createOrResizeResources(e,p,m,f);const T=this._horizontalBlurFBO,w=this._verticalBlurFBO;a.setStencilWriteMask(0),a.setStencilTestEnabled(!1),a.setDepthWriteEnabled(!1),a.setDepthTestEnabled(!1);const x=this._layerFBOTexture;i.copyToTexture(0,0,p,m,0,0,x),this._quad||(this._quad=new r(a,[-1,-1,1,-1,-1,1,1,1])),a.setViewport(0,0,f[0],f[1]);const g=this._quad;g.bind(),a.setBlendingEnabled(!1);const z=_.getProgram(c.blur,[{name:"radius",value:Math.ceil(B)}]);a.useProgram(z),a.bindFramebuffer(T),a.bindTexture(i.colorTexture,4),z.setUniform1i("u_colorTexture",4),z.setUniform2fv("u_texSize",f),z.setUniform2fv("u_direction",u),z.setUniform1f("u_sigma",B),g.draw(),a.bindFramebuffer(w),a.bindTexture(T?.colorTexture,5),z.setUniform1i("u_colorTexture",5),z.setUniform2fv("u_direction",h),g.draw(),a.bindFramebuffer(i),a.setViewport(0,0,p,m);const M=_.getProgram(c.composite);a.useProgram(M),a.bindTexture(w?.colorTexture,2),M.setUniform1i("u_blurTexture",2),a.bindTexture(x,3),M.setUniform1i("u_layerFBOTexture",3),M.setUniform4fv("u_shadowColor",[O[3]*(O[0]/255),O[3]*(O[1]/255),O[3]*(O[2]/255),O[3]]),M.setUniformMatrix3fv("u_displayViewMat3",n.displayMat3),M.setUniform2fv("u_shadowOffset",F),g.draw(),a.setBlendingEnabled(!0),a.setStencilTestEnabled(!0),a.setBlendFunction(s.ONE,s.ONE_MINUS_SRC_ALPHA),g.unbind()}_createOrResizeResources(e,t,r,s){const{context:u}=e;if(!this._horizontalBlurFBO||this._size[0]!==t||this._size[1]!==r){if(this._size[0]=t,this._size[1]=r,this._horizontalBlurFBO)this._horizontalBlurFBO.resize(s[0],s[1]);else{const e=new l(s[0],s[1]);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._horizontalBlurFBO=new a(u,e)}if(this._verticalBlurFBO)this._verticalBlurFBO.resize(s[0],s[1]);else{const e=new l(s[0],s[1]);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._verticalBlurFBO=new a(u,e)}if(this._layerFBOTexture)this._layerFBOTexture.resize(t,r);else{const e=new l(t,r);e.internalFormat=i.RGBA,e.wrapMode=o.CLAMP_TO_EDGE,this._layerFBOTexture=new n(u,e)}}}}export{_ as DropShadow};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{TextureSamplingMode as t,PixelFormat as r,TextureWrapMode as s}from"../../../../../webgl/enums.js";import{Texture as i}from"../../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../../webgl/TextureDescriptor.js";class l{constructor(){this._size=[0,0],this._layerFBOTexture=null}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,r,s){const{width:i,height:o}=r;this._createOrResizeResources(e,i,o);const{context:l,painter:a}=e,{amount:n}=s,h=l.gl,u=this._layerFBOTexture;l.bindFramebuffer(r),r.copyToTexture(0,0,i,o,0,0,u),l.setBlendingEnabled(!0),l.setStencilTestEnabled(!1),l.setDepthTestEnabled(!1),l.setClearColor(0,0,0,0),l.clear(h.COLOR_BUFFER_BIT),a.blitTexture(l,u,t.NEAREST,n)}_createOrResizeResources(e,l,a){const{context:n}=e;if(!this._layerFBOTexture||this._size[0]!==l||this._size[1]!==a)if(this._size[0]=l,this._size[1]=a,this._layerFBOTexture)this._layerFBOTexture.resize(l,a);else{const e=new o;e.internalFormat=r.RGBA,e.wrapMode=s.CLAMP_TO_EDGE,e.samplingMode=t.NEAREST,e.width=l,e.height=a,this._layerFBOTexture=new i(n,e)}}}export{l as Opacity};
5
+ import{disposeMaybe as e}from"../../../../../../core/maybe.js";import{TextureSamplingMode as t,PixelFormat as r,TextureWrapMode as s}from"../../../../../webgl/enums.js";import{Texture as i}from"../../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../../webgl/TextureDescriptor.js";class l{constructor(){this._size=[0,0],this._layerFBOTexture=null}dispose(){this._layerFBOTexture=e(this._layerFBOTexture)}draw(e,r,s){const{width:i,height:o}=r;this._createOrResizeResources(e,i,o);const{context:l,painter:a}=e,{amount:n}=s,u=l.gl,T=this._layerFBOTexture;l.bindFramebuffer(r),r.copyToTexture(0,0,i,o,0,0,T),l.setBlendingEnabled(!0),l.setStencilTestEnabled(!1),l.setDepthTestEnabled(!1),l.setClearColor(0,0,0,0),l.clear(u.COLOR_BUFFER_BIT),a.blitTexture(l,T,t.NEAREST,n)}_createOrResizeResources(e,l,a){const{context:n}=e;if(!this._layerFBOTexture||this._size[0]!==l||this._size[1]!==a)if(this._size[0]=l,this._size[1]=a,this._layerFBOTexture)this._layerFBOTexture.resize(l,a);else{const e=new o(l,a);e.internalFormat=r.RGBA,e.wrapMode=s.CLAMP_TO_EDGE,e.samplingMode=t.NEAREST,this._layerFBOTexture=new i(n,e)}}}export{l as Opacity};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{simplePipelineState as e}from"../../utils.js";import{Technique as t}from"../Technique.js";import{TechniqueType as r}from"../TechniqueType.js";import{BlendShader as s}from"../shaders/BlendShader.js";import{OpacityShader as i}from"../shaders/OpacityShader.js";import{BlendFactor as u,PixelFormat as o,TextureWrapMode as n}from"../../../../../../webgl/enums.js";import{Texture as a}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";class f extends t{constructor(){super(...arguments),this.type=r.Blend,this._backBufferTexture=null,this.shaders={blend:new s,opacity:new i}}shutdown(){super.shutdown(),null!==this._backBufferTexture&&(this._backBufferTexture.dispose(),this._backBufferTexture=null)}render(t,r){const{context:s,state:i,pixelRatio:o,inFadeTransition:n,painter:a}=t,{size:c}=i,f=s.getBoundFramebufferObject();let h,l;null!=f?(h=f.width,l=f.height):(h=Math.round(o*c[0]),l=Math.round(o*c[1]));const{blendMode:d}=r;if("normal"===d){const t={shader:this.shaders.opacity,uniforms:{config:{layerTexture:{texture:r.colorTexture,unit:0},opacity:r.config.opacity}},defines:null,optionalAttributes:null,useComputeBuffer:!1};return a.setPipelineState(e),void a.submitDrawMesh(s,t,a.quadMesh)}const p=this._createOrResizeTexture(t,h,l);f.copyToTexture(0,0,h,l,0,0,p);const x={color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:u.ONE,dstRGB:u.ZERO,srcAlpha:u.ONE,dstAlpha:u.ZERO}},depth:!1,stencil:!1};a.setPipelineState(x);const b={backbufferTexture:{texture:p,unit:0},layerTexture:{texture:r.colorTexture,unit:1},inFadeOpacity:n?1:0,...r.config},T={shader:this.shaders.blend,uniforms:{config:b},defines:{blendMode:d},optionalAttributes:null,useComputeBuffer:!1};a.submitDrawMesh(s,T,a.quadMesh)}_createOrResizeTexture(e,t,r){const{context:s}=e;if(null!==this._backBufferTexture&&this._backBufferTexture.descriptor?.width===t&&this._backBufferTexture.descriptor?.height===r)return this._backBufferTexture;if(null===this._backBufferTexture){const e=new c;e.internalFormat=o.RGBA,e.wrapMode=n.CLAMP_TO_EDGE,e.width=t,e.height=r,this._backBufferTexture=new a(s,e)}else this._backBufferTexture.resize(t,r);return this._backBufferTexture}}export{f as BlendTechnique};
5
+ import{simplePipelineState as e}from"../../utils.js";import{Technique as t}from"../Technique.js";import{TechniqueType as r}from"../TechniqueType.js";import{BlendShader as s}from"../shaders/BlendShader.js";import{OpacityShader as u}from"../shaders/OpacityShader.js";import{BlendFactor as i,PixelFormat as o,TextureWrapMode as n}from"../../../../../../webgl/enums.js";import{Texture as a}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";class f extends t{constructor(){super(...arguments),this.type=r.Blend,this._backBufferTexture=null,this.shaders={blend:new s,opacity:new u}}shutdown(){super.shutdown(),null!==this._backBufferTexture&&(this._backBufferTexture.dispose(),this._backBufferTexture=null)}render(t,r){const{context:s,state:u,pixelRatio:o,inFadeTransition:n,painter:a}=t,{size:c}=u,f=s.getBoundFramebufferObject();let l,h;null!=f?(l=f.width,h=f.height):(l=Math.round(o*c[0]),h=Math.round(o*c[1]));const{blendMode:d}=r;if("normal"===d){const t={shader:this.shaders.opacity,uniforms:{config:{layerTexture:{texture:r.colorTexture,unit:0},opacity:r.config.opacity}},defines:null,optionalAttributes:null,useComputeBuffer:!1};return a.setPipelineState(e),void a.submitDrawMesh(s,t,a.quadMesh)}const p=this._createOrResizeTexture(t,l,h);f.copyToTexture(0,0,l,h,0,0,p);const x={color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:i.ONE,dstRGB:i.ZERO,srcAlpha:i.ONE,dstAlpha:i.ZERO}},depth:!1,stencil:!1};a.setPipelineState(x);const b={backbufferTexture:{texture:p,unit:0},layerTexture:{texture:r.colorTexture,unit:1},inFadeOpacity:n?1:0,...r.config},T={shader:this.shaders.blend,uniforms:{config:b},defines:{blendMode:d},optionalAttributes:null,useComputeBuffer:!1};a.submitDrawMesh(s,T,a.quadMesh)}_createOrResizeTexture(e,t,r){const{context:s}=e;if(null!==this._backBufferTexture&&this._backBufferTexture.descriptor?.width===t&&this._backBufferTexture.descriptor?.height===r)return this._backBufferTexture;if(null===this._backBufferTexture){const e=new c(t,r);e.internalFormat=o.RGBA,e.wrapMode=n.CLAMP_TO_EDGE,this._backBufferTexture=new a(s,e)}else this._backBufferTexture.resize(t,r);return this._backBufferTexture}}export{f as BlendTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../../../core/RandomLCG.js";import{tileSize as e}from"../../../definitions.js";import{SimpleMesh as s}from"../../../meshing/SimpleMesh.js";import{TextureSamplingMode as o,TextureWrapMode as r,SizedDepthStencilFormat as i,DataType as n,PrimitiveType as h,PixelType as d}from"../../../../../../webgl/enums.js";import{FramebufferObject as u}from"../../../../../../webgl/FramebufferObject.js";import{Renderbuffer as l}from"../../../../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as _}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as T}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../../../../webgl/TextureDescriptor.js";const p={pos:{count:2,type:n.UNSIGNED_SHORT}};class f{constructor(){this._dotTextureSize=0,this._dotTextures=null,this._dotMesh=null}destroy(){this._disposeTextures(),this._dotFBO&&this._dotFBO.dispose(),this._dotMesh&&this._dotMesh.destroy()}getFBO(t){if(null==this._dotFBO){const s=e,n=e,h=new m(s,n);h.samplingMode=o.NEAREST,h.wrapMode=r.CLAMP_TO_EDGE;const d=new l(t,new _(i.DEPTH24_STENCIL8,s,n));this._dotFBO=new u(t,h,d)}return this._dotFBO}getDotDensityMesh(t){if(null==this._dotMesh){const o=e,r=o*o,i=2,n=new Int16Array(r*i);for(let t=0;t<o;t++)for(let e=0;e<o;e++)n[i*(e+t*o)]=e,n[i*(e+t*o)+1]=t;this._dotMesh=s.create(t,{primitive:h.POINTS,vertex:n,count:r,layout:p})}return this._dotMesh}getDotDensityTextures(e,s,o){if(this._dotTextureSize===s&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=s,this._seed=o),null===this._dotTextures){const r=new t(o);this._dotTextures=[this._allocDotDensityTexture(e,s,r),this._allocDotDensityTexture(e,s,r)]}return this._dotTextures}_disposeTextures(){if(this._dotTextures){for(let t=0;t<this._dotTextures.length;t++)this._dotTextures[t].dispose();this._dotTextures=null}}_allocDotDensityTexture(t,e,s){const r=new Float32Array(e*e*4);for(let o=0;o<r.length;o++)r[o]=s.getFloat();const i=new m;return i.dataType=d.FLOAT,i.samplingMode=o.NEAREST,i.width=e,i.height=e,new T(t,i,r)}}export{f as DotDensityResources};
5
+ import t from"../../../../../../../core/RandomLCG.js";import{tileSize as e}from"../../../definitions.js";import{SimpleMesh as s}from"../../../meshing/SimpleMesh.js";import{TextureSamplingMode as o,TextureWrapMode as r,SizedDepthStencilFormat as i,DataType as n,PrimitiveType as d,PixelType as h}from"../../../../../../webgl/enums.js";import{FramebufferObject as u}from"../../../../../../webgl/FramebufferObject.js";import{Renderbuffer as l}from"../../../../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as _}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as T}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../../../../webgl/TextureDescriptor.js";const p={pos:{count:2,type:n.UNSIGNED_SHORT}};class f{constructor(){this._dotTextureSize=0,this._dotTextures=null,this._dotMesh=null}destroy(){this._disposeTextures(),this._dotFBO&&this._dotFBO.dispose(),this._dotMesh&&this._dotMesh.destroy()}getFBO(t){if(null==this._dotFBO){const s=e,n=e,d=new m(s,n);d.samplingMode=o.NEAREST,d.wrapMode=r.CLAMP_TO_EDGE;const h=new l(t,new _(i.DEPTH24_STENCIL8,s,n));this._dotFBO=new u(t,d,h)}return this._dotFBO}getDotDensityMesh(t){if(null==this._dotMesh){const o=e,r=o*o,i=2,n=new Int16Array(r*i);for(let t=0;t<o;t++)for(let e=0;e<o;e++)n[i*(e+t*o)]=e,n[i*(e+t*o)+1]=t;this._dotMesh=s.create(t,{primitive:d.POINTS,vertex:n,count:r,layout:p})}return this._dotMesh}getDotDensityTextures(e,s,o){if(this._dotTextureSize===s&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=s,this._seed=o),null===this._dotTextures){const r=new t(o);this._dotTextures=[this._allocDotDensityTexture(e,s,r),this._allocDotDensityTexture(e,s,r)]}return this._dotTextures}_disposeTextures(){if(this._dotTextures){for(let t=0;t<this._dotTextures.length;t++)this._dotTextures[t].dispose();this._dotTextures=null}}_allocDotDensityTexture(t,e,s){const r=new Float32Array(e*e*4);for(let o=0;o<r.length;o++)r[o]=s.getFloat();const i=new m(e);return i.dataType=h.FLOAT,i.samplingMode=o.NEAREST,new T(t,i,r)}}export{f as DotDensityResources};