@arcgis/core 4.23.0-next.20220322 → 4.23.2

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 (40) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{678c94b331fde96e6998.js → 52c972e98d60a0c62a6b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{e8e775758b79c5a084c8.js → 86ec93705546377103b0.js} +1 -1
  4. package/assets/esri/core/workers/chunks/9f458f10dc65b185f66e.js +1 -0
  5. package/assets/esri/core/workers/chunks/{d209d82484aa725c5aa9.js → d006b4a239e93eeb9619.js} +1 -1
  6. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +2 -2
  7. package/assets/esri/themes/base/widgets/_LayerList.scss +2 -2
  8. package/assets/esri/themes/dark/main.css +1 -1
  9. package/assets/esri/themes/dark-blue/main.css +1 -1
  10. package/assets/esri/themes/dark-green/main.css +1 -1
  11. package/assets/esri/themes/dark-purple/main.css +1 -1
  12. package/assets/esri/themes/dark-red/main.css +1 -1
  13. package/assets/esri/themes/light/main.css +1 -1
  14. package/assets/esri/themes/light/view.css +1 -1
  15. package/assets/esri/themes/light-blue/main.css +1 -1
  16. package/assets/esri/themes/light-green/main.css +1 -1
  17. package/assets/esri/themes/light-purple/main.css +1 -1
  18. package/assets/esri/themes/light-red/main.css +1 -1
  19. package/config.js +1 -1
  20. package/core/reactiveUtils.js +1 -1
  21. package/interfaces.d.ts +5 -5
  22. package/layers/support/FeatureReductionCluster.js +1 -1
  23. package/package.json +1 -1
  24. package/support/basemapUtils.js +1 -1
  25. package/support/revision.js +1 -1
  26. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  27. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  28. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  29. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  30. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  31. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  32. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  33. package/views/2d/layers/LayerView2D.js +1 -1
  34. package/views/MapView.js +1 -1
  35. package/views/layers/GroupLayerView.js +1 -1
  36. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  37. package/widgets/Feature/FeatureMedia.js +1 -1
  38. package/widgets/FeatureForm/InputField.js +1 -1
  39. package/widgets/FeatureForm.js +1 -1
  40. package/assets/esri/core/workers/chunks/70b0b6d9559960307059.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.23/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";import{buildDate as r}from"./support/revision.js";var s;const t={apiKey:void 0,applicationUrl:null==(s=globalThis.location)?void 0:s.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",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath){const e="4.23.0";t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}-next.${r}/assets`}t.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(t,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),t.request.corsEnabledServers=[],t.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{t as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";var r;const s={apiKey:void 0,applicationUrl:null==(r=globalThis.location)?void 0:r.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",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){const e="4.23.2";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(s,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),s.request.corsEnabledServers=[],s.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0};export{s 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{isEventTarget as n,on as t}from"./events.js";import{makeHandle as o,handlesGroup as r}from"./handleUtils.js";import{removeMaybe as e}from"./maybe.js";import{isAborted as i,onAbort as u,createAbortError as l}from"./promiseUtils.js";import{watchTracked as s}from"./accessorSupport/watch.js";export{autorun}from"./accessorSupport/trackingUtils.js";function c(n,t,o={}){return m(n,t,o,v)}function f(n,t,o={}){return m(n,t,o,d)}function m(n,t,o={},r){let i=null;const u=o.once?(n,o)=>{r(n)&&(e(i),t(n,o))}:(n,o)=>{r(n)&&t(n,o)};if(i=s(n,u,o.sync,o.equals),o.initial){const t=n();u(t,t)}return i}function a(r,i,u,l={}){let s=null,f=null,m=null;function a(){s&&f&&(f.remove(),null==l.onListenerRemove||l.onListenerRemove(s),s=null,f=null)}function p(n){l.once&&l.once&&e(m),u(n)}const j=c(r,((o,r)=>{a(),n(o)&&(s=o,f=t(o,i,p),null==l.onListenerAdd||l.onListenerAdd(o))}),{sync:l.sync,initial:!0});return m=o((()=>{j.remove(),a()})),m}function p(n,t){return y(n,null,t)}function j(n,t){return y(n,d,t)}function y(n,t,o){if(i(o))return Promise.reject();const s=n();if(null!=t&&t(s))return Promise.resolve(s);let c=null;function f(){c=e(c)}return new Promise(((e,i)=>{c=r([u(o,(()=>{f(),i(l())})),m(n,(n=>{f(),e(n)}),{sync:!1,once:!0},null!=t?t:v)])}))}function v(n){return!0}function d(n){return!!n}const L={sync:!0},P={initial:!0},U={sync:!0,initial:!0};export{P as initial,a as on,p as once,L as sync,U as syncAndInitial,c as watch,f as when,j as whenOnce};
5
+ import{isEventTarget as n,on as t}from"./events.js";import{makeHandle as o,handlesGroup as r}from"./handleUtils.js";import{removeMaybe as e}from"./maybe.js";import{isAborted as i,createAbortError as u,onAbort as l}from"./promiseUtils.js";import{watchTracked as s}from"./accessorSupport/watch.js";export{autorun}from"./accessorSupport/trackingUtils.js";function c(n,t,o={}){return m(n,t,o,v)}function f(n,t,o={}){return m(n,t,o,d)}function m(n,t,o={},r){let i=null;const u=o.once?(n,o)=>{r(n)&&(e(i),t(n,o))}:(n,o)=>{r(n)&&t(n,o)};if(i=s(n,u,o.sync,o.equals),o.initial){const t=n();u(t,t)}return i}function a(r,i,u,l={}){let s=null,f=null,m=null;function a(){s&&f&&(f.remove(),null==l.onListenerRemove||l.onListenerRemove(s),s=null,f=null)}function p(n){l.once&&l.once&&e(m),u(n)}const j=c(r,((o,r)=>{a(),n(o)&&(s=o,f=t(o,i,p),null==l.onListenerAdd||l.onListenerAdd(o))}),{sync:l.sync,initial:!0});return m=o((()=>{j.remove(),a()})),m}function p(n,t){return y(n,null,t)}function j(n,t){return y(n,d,t)}function y(n,t,o){if(i(o))return Promise.reject(u());const s=n();if(null!=t&&t(s))return Promise.resolve(s);let c=null;function f(){c=e(c)}return new Promise(((e,i)=>{c=r([l(o,(()=>{f(),i(u())})),m(n,(n=>{f(),e(n)}),{sync:!1,once:!0},null!=t?t:v)])}))}function v(n){return!0}function d(n){return!!n}const L={sync:!0},P={initial:!0},U={sync:!0,initial:!0};export{P as initial,a as on,p as once,L as sync,U as syncAndInitial,c as watch,f as when,j as whenOnce};
package/interfaces.d.ts CHANGED
@@ -28231,7 +28231,7 @@ declare namespace __esri {
28231
28231
  /**
28232
28232
  * A helper function that returns an instance of the portal's [ClosestFacilityTask](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-ClosestFacilityTask.html) [helper service](https://enterprise.arcgis.com/en/portal/latest/administer/windows/about-utility-services.htm).
28233
28233
  *
28234
- * @deprecated since version 4.21.
28234
+ * @deprecated since version 4.21. Use {@link module:esri/rest/closestFacility} with [helperServices](#helperServices) instead.
28235
28235
  *
28236
28236
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#createClosestFacilityTask)
28237
28237
  */
@@ -28245,7 +28245,7 @@ declare namespace __esri {
28245
28245
  /**
28246
28246
  * A helper function that returns an instance of the portal's [GeometryService](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-GeometryService.html) [helper service](https://enterprise.arcgis.com/en/portal/latest/administer/windows/about-utility-services.htm).
28247
28247
  *
28248
- * @deprecated since version 4.21.
28248
+ * @deprecated since version 4.21. Use {@link module:esri/rest/geometryService} with [helperServices](#helperServices) instead.
28249
28249
  *
28250
28250
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#createGeometryService)
28251
28251
  */
@@ -28253,7 +28253,7 @@ declare namespace __esri {
28253
28253
  /**
28254
28254
  * A helper function that returns an instance of the portal's [PrintTask](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-PrintTask.html) [helper service](https://enterprise.arcgis.com/en/portal/latest/administer/windows/about-utility-services.htm).
28255
28255
  *
28256
- * @deprecated since version 4.21.
28256
+ * @deprecated since version 4.21. Use {@link module:esri/rest/print} with [helperServices](#helperServices) instead.
28257
28257
  *
28258
28258
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#createPrintTask)
28259
28259
  */
@@ -28261,7 +28261,7 @@ declare namespace __esri {
28261
28261
  /**
28262
28262
  * A helper function that returns an instance of the portal's [RouteTask](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-RouteTask.html) [helper service](https://enterprise.arcgis.com/en/portal/latest/administer/windows/about-utility-services.htm).
28263
28263
  *
28264
- * @deprecated since version 4.21.
28264
+ * @deprecated since version 4.21. Use {@link module:esri/rest/route} with [helperServices](#helperServices) instead.
28265
28265
  *
28266
28266
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#createRouteTask)
28267
28267
  */
@@ -28269,7 +28269,7 @@ declare namespace __esri {
28269
28269
  /**
28270
28270
  * A helper function that returns an instance of the portal's [ServiceAreaTask](https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-ServiceAreaTask.html) [helper service](https://enterprise.arcgis.com/en/portal/latest/administer/windows/about-utility-services.htm).
28271
28271
  *
28272
- * @deprecated since version 4.21.
28272
+ * @deprecated since version 4.21. Use {@link module:esri/rest/serviceArea} with [helperServices](#helperServices) instead.
28273
28273
  *
28274
28274
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html#createServiceAreaTask)
28275
28275
  */
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{symbolTypesCluster as o}from"../../symbols.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{toPt as p}from"../../core/screenUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import a from"./AggregateField.js";import{popupEnabled as u,labelsVisible as n}from"./commonProperties.js";import c from"./LabelClass.js";var m;let d=m=class extends s{constructor(e){super(e),this.type="cluster",this.clusterRadius=p("80px"),this.clusterMinSize=p("12px"),this.clusterMaxSize=p("50px"),this.popupEnabled=!0,this.popupTemplate=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=null}clone(){return new m({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:r(this.labelingInfo),labelsVisible:this.labelsVisible,fields:r(this.fields),popupEnabled:this.popupEnabled,popupTemplate:r(this.popupTemplate)})}};e([i({type:["cluster"],readOnly:!0,json:{write:!0}})],d.prototype,"type",void 0),e([i({type:Number,cast:e=>"auto"===e?e:p(e),json:{write:!0}})],d.prototype,"clusterRadius",void 0),e([i({type:Number,cast:p,json:{write:!0}})],d.prototype,"clusterMinSize",void 0),e([i({type:Number,cast:p,json:{write:!0}})],d.prototype,"clusterMaxSize",void 0),e([i(u)],d.prototype,"popupEnabled",void 0),e([i({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],d.prototype,"popupTemplate",void 0),e([i({types:o})],d.prototype,"symbol",void 0),e([i({type:[c],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],d.prototype,"labelingInfo",void 0),e([i(n)],d.prototype,"labelsVisible",void 0),e([i({type:[a],json:{write:!0}})],d.prototype,"fields",void 0),d=m=e([l("esri.layers.support.FeatureReductionCluster")],d);const b=d;export{b as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{symbolTypesCluster as o}from"../../symbols.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{toPt as p}from"../../core/screenUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import a from"./AggregateField.js";import{popupEnabled as u,labelsVisible as n}from"./commonProperties.js";import c from"./LabelClass.js";var m;let d=m=class extends s{constructor(e){super(e),this.type="cluster",this.clusterRadius=p("80px"),this.clusterMinSize=p("12px"),this.clusterMaxSize=p("50px"),this.popupEnabled=!0,this.popupTemplate=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=null}clone(){return new m({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:r(this.labelingInfo),labelsVisible:this.labelsVisible,fields:r(this.fields),popupEnabled:this.popupEnabled,popupTemplate:r(this.popupTemplate)})}};e([i({type:["cluster"],readOnly:!0,json:{write:!0}})],d.prototype,"type",void 0),e([i({type:Number,cast:e=>"auto"===e?e:p(e),json:{write:!0}})],d.prototype,"clusterRadius",void 0),e([i({type:Number,cast:p,json:{write:!0}})],d.prototype,"clusterMinSize",void 0),e([i({type:Number,cast:p,json:{write:!0}})],d.prototype,"clusterMaxSize",void 0),e([i(u)],d.prototype,"popupEnabled",void 0),e([i({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],d.prototype,"popupTemplate",void 0),e([i({types:o})],d.prototype,"symbol",void 0),e([i({type:[c],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],d.prototype,"labelingInfo",void 0),e([i(n)],d.prototype,"labelsVisible",void 0),e([i({type:[a],json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],d.prototype,"fields",void 0),d=m=e([l("esri.layers.support.FeatureReductionCluster")],d);const b=d;export{b as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.23.0-next.20220322",
3
+ "version": "4.23.2",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API 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.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../Basemap.js";import r from"../config.js";import n from"../core/Collection.js";import a from"../core/Logger.js";import{isNone as t}from"../core/maybe.js";import{normalize as l,Url as i,makeAbsolute as s}from"../core/urlUtils.js";import{ensureType as o}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as c}from"./basemapDefinitions.js";const u=a.getLogger("esri.support.basemapUtils");function f(){return{}}function p(e){for(const r in e){const n=e[r];!1===(null==n?void 0:n.destroyed)&&n.destroy(),delete e[r]}}function y(n,a){var t;let l;if("string"==typeof n){if(!(n in c)){const e=Object.entries(c).filter((([e,n])=>r.apiKey&&!n.classic||!r.apiKey&&n.classic&&!n.deprecated)).map((([e])=>`"${e}"`)).join(", ");return u.warn(`Unable to find basemap definition for: ${n}. Try one of these: ${e}`),null}a&&(l=a[n]),l||(l=e.fromId(n),a&&(a[n]=l))}else l=o(e,n);return null!=(t=l)&&t.destroyed&&(u.warn("The provided basemap is already destroyed",{basemap:l}),l=null),l}function m(r,n=null){const a=y(r);if(!a)return null;const t=new e({id:a.id,title:a.title,baseLayers:a.baseLayers.slice(),referenceLayers:a.referenceLayers.slice()});return n&&(t.baseLayers=L(t.baseLayers,n.baseLayers),t.referenceLayers=L(t.referenceLayers,n.referenceLayers)),t.load().catch((()=>{})),t.portalItem=a.portalItem,t}function d(e){let r=null;const n=T(e),a=!n.baseLayers.length;for(const t in c){const e=U(n,x(c[t]),{mustMatchReferences:a});if("equal"===e){r=t;break}"base-layers-equal"===e&&(r=t)}return r}function b(e,r){if(e===r)return!0;return"equal"===U(T(e),T(r),{mustMatchReferences:!0})}function L(e,r){const a=new n;return e.forEach((e=>{const n=r.find((r=>k(q(e),q(r))))||e;a.some((e=>e===n))?a.push(e):a.push(n)})),a}function S(e){return!(null==e||!e.baseLayers.concat(e.referenceLayers).some(g))}function g(e){if(v(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const n=e.sourceNameToSource[r];if(v(null==n?void 0:n.sourceUrl))return!0}return!1}function R(e,r){var n,a,l;if(t(r)||t(e))return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const i=r.baseLayers.getItemAt(0);switch(i.loadStatus){case"not-loaded":i.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const s=(("supportedSpatialReferences"in i?i.supportedSpatialReferences:null)||["tileInfo"in i?null==(n=i.tileInfo)?void 0:n.spatialReference:i.spatialReference]).filter(Boolean);return e.spatialReference?{spatialReference:null!=(a=null!=(l=s.find((r=>e.spatialReference.equals(r))))?l:s[0])?a:null,updating:!1}:{spatialReference:s[0],updating:!1}}const h=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function v(e){if(!e)return!1;const r=new i(s(e));return h.test(r.authority)}function T(e){return e?!e.loaded&&e.resourceInfo?x(e.resourceInfo.data):{baseLayers:j(e.baseLayers),referenceLayers:j(e.referenceLayers)}:null}function j(e){return(n.isCollection(e)?e.toArray():e).map(q)}function q(e){return{type:e.type,url:$("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible}}function x(e){return e?{baseLayers:w(e.baseMapLayers.filter((e=>!e.isReference))),referenceLayers:w(e.baseMapLayers.filter((e=>e.isReference)))}:null}function w(e){return e.map((e=>I(e)))}function I(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;default:r="unknown"}return{type:r,url:$(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:null!=e.minScale?e.minScale:0,maxScale:null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visibility||!!e.visibility}}function U(e,r,n){if(null!=e!=(null!=r))return"not-equal";if(!e)return"equal";if(!M(e.baseLayers,r.baseLayers))return"not-equal";return M(e.referenceLayers,r.referenceLayers)?"equal":n.mustMatchReferences?"not-equal":"base-layers-equal"}function M(e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!k(e[n],r[n]))return!1;return!0}function k(e,r){return e.type===r.type&&e.url===r.url&&e.minScale===r.minScale&&e.maxScale===r.maxScale&&e.visible===r.visible&&e.opacity===r.opacity}function $(e){return e?l(e).replace(/^\s*https?:/i,"").toLowerCase():""}export{m as clonePreservingTiledLayers,b as contentEquals,f as createCache,p as destroyCache,y as ensureType,R as findSpatialReference,d as getWellKnownBasemapId,S as hasDeveloperBasemapLayer,g as isDeveloperBasemapLayer};
5
+ import e from"../Basemap.js";import r from"../config.js";import a from"../core/Collection.js";import n from"../core/Logger.js";import{isSome as t,isNone as l}from"../core/maybe.js";import{normalize as i,Url as s,makeAbsolute as u}from"../core/urlUtils.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as o}from"./basemapDefinitions.js";const f=n.getLogger("esri.support.basemapUtils");function p(){return{}}function y(e){for(const r in e){const a=e[r];!1===(null==a?void 0:a.destroyed)&&a.destroy(),delete e[r]}}function m(a,n){var t;let l;if("string"==typeof a){if(!(a in o)){const e=Object.entries(o).filter((([e,a])=>r.apiKey&&!a.classic||!r.apiKey&&a.classic&&!a.deprecated)).map((([e])=>`"${e}"`)).join(", ");return f.warn(`Unable to find basemap definition for: ${a}. Try one of these: ${e}`),null}n&&(l=n[a]),l||(l=e.fromId(a),n&&(n[a]=l))}else l=c(e,a);return null!=(t=l)&&t.destroyed&&(f.warn("The provided basemap is already destroyed",{basemap:l}),l=null),l}function d(r,a=null){const n=m(r);if(!n)return null;const t=new e({id:n.id,title:n.title,baseLayers:n.baseLayers.slice(),referenceLayers:n.referenceLayers.slice()});return a&&(t.baseLayers=v(t.baseLayers,a.baseLayers),t.referenceLayers=v(t.referenceLayers,a.referenceLayers)),t.load().catch((()=>{})),t.portalItem=n.portalItem,t}function b(e){let r=null;const a=T(e),n=!a.baseLayers.length;for(const t in o){const e=M(a,q(o[t]),{mustMatchReferences:n});if("equal"===e){r=t;break}"base-layers-equal"===e&&(r=t)}return r}function L(e,r){if(e===r)return!0;return"equal"===M(T(e),T(r),{mustMatchReferences:!0})}function v(e,r){const n=new a;return e.forEach((e=>{const a=r.find((r=>$(j(e),j(r))))||e;n.some((e=>e===a))?n.push(e):n.push(a)})),n}function g(e){return!(null==e||!e.baseLayers.concat(e.referenceLayers).some(S))}function S(e){if(I(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const a=e.sourceNameToSource[r];if(I(null==a?void 0:a.sourceUrl))return!0}return!1}function h(e,r){var a,n,t;if(l(r)||l(e))return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const i=r.baseLayers.getItemAt(0);switch(i.loadStatus){case"not-loaded":i.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const s=(("supportedSpatialReferences"in i?i.supportedSpatialReferences:null)||["tileInfo"in i?null==(a=i.tileInfo)?void 0:a.spatialReference:i.spatialReference]).filter(Boolean);return e.spatialReference?{spatialReference:null!=(n=null!=(t=s.find((r=>e.spatialReference.equals(r))))?t:s[0])?n:null,updating:!1}:{spatialReference:s[0],updating:!1}}const R=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function I(e){if(!e)return!1;const r=new s(u(e));return R.test(r.authority)}function T(e){return e?!e.loaded&&e.resourceInfo?q(e.resourceInfo.data):{baseLayers:w(e.baseLayers),referenceLayers:w(e.referenceLayers)}:null}function w(e){return(a.isCollection(e)?e.toArray():e).map(j)}function j(e){var r,a;return{type:e.type,url:A("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||!t(e.sublayers)||null==(r=e.sublayers)?void 0:r.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?null==(a=e.activeLayer)?void 0:a.id:void 0}}function q(e){return e?{baseLayers:x(e.baseMapLayers.filter((e=>!e.isReference))),referenceLayers:x(e.baseMapLayers.filter((e=>e.isReference)))}:null}function x(e){return e.map((e=>U(e)))}function U(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;default:r="unknown"}return{type:r,url:A(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:null!=e.minScale?e.minScale:0,maxScale:null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function M(e,r,a){if(null!=e!=(null!=r))return"not-equal";if(!e)return"equal";if(!k(e.baseLayers,r.baseLayers))return"not-equal";return k(e.referenceLayers,r.referenceLayers)?"equal":a.mustMatchReferences?"not-equal":"base-layers-equal"}function k(e,r){if(e.length!==r.length)return!1;for(let a=0;a<e.length;a++)if(!$(e[a],r[a]))return!1;return!0}function $(e,r){if(e.type!==r.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(t(e.activeLayerId)||t(r.activeLayerId))return e.activeLayerId===r.activeLayerId;if(t(e.sublayers)||t(r.sublayers)){if(l(e.sublayers)||l(r.sublayers)||e.sublayers.length!==r.sublayers.length)return!1;for(let a=0;a<e.sublayers.length;a++){const n=e.sublayers.at(a),t=r.sublayers.at(a);if(n.id!==t.id||n.visible!==t.visible)return!1}}return!0}function A(e){return e?i(e).replace(/^\s*https?:/i,"").toLowerCase():""}export{d as clonePreservingTiledLayers,L as contentEquals,p as createCache,y as destroyCache,m as ensureType,h as findSpatialReference,b as getWellKnownBasemapId,g as hasDeveloperBasemapLayer,S as isDeveloperBasemapLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- const c="20220322",e="dec012ea4e0c744c265cb910604dec5c0e010a93";export{c as buildDate,e as commitHash};
5
+ const c="20220325",d="bd365f30c3ec9889ec50c6d6f51a1c6ac3877d35";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.23/esri/copyright.txt for details.
4
4
  */
5
- import{bidiText as t}from"../../core/BidiText.js";import e from"../../core/Logger.js";import{isNone as s,isSome as i}from"../../core/maybe.js";import r from"../../core/ObjectPool.js";import{pt2px as n}from"../../core/screenUtils.js";import{create as o,fromValues as a}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as h}from"../../geometry/support/boundsUtils.js";import{isPoint as l,isPolygon as c,isPolyline as m,isExtent as f,isMultipoint as u}from"../../geometry/support/jsonUtils.js";import{SimpleGeometryCursor as _}from"./CIMEffects.js";import{getEffectOperator as d,getPlacementOperator as p}from"./CIMOperators.js";import{Placement as y}from"./CIMPlacements.js";import g from"./CIMResourceManager.js";import{LineCapStyle as x,LineJoinStyle as P}from"./enums.js";import w from"./Rect.js";import{TextRasterizer as M}from"./TextRasterizer.js";import{HAlign as b,VAlign as S}from"../../views/2d/engine/webgl/alignmentUtils.js";import{GLYPH_SIZE as k,MAGIC_LABEL_LINE_HEIGHT as C}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as R}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";const T=Math.PI/180,I=10,v=e.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class L{constructor(t){this._t=t}static createIdentity(){return new L([1,0,0,0,1,0])}clone(){const t=this._t;return new L(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new L([t,0,0,0,e,0])}scale(t,e){const s=this._t;return s[0]*=t,s[1]*=t,s[2]*=t,s[3]*=e,s[4]*=e,s[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new L([0,0,t,0,0,e])}translate(t,e){const s=this._t;return s[2]+=t,s[5]+=e,this}static createRotate(t){const e=Math.cos(t),s=Math.sin(t);return new L([e,-s,0,s,e,0])}rotate(t){return L.multiply(this,L.createRotate(t),this)}static multiply(t,e,s){const i=t._t,r=e._t,n=i[0]*r[0]+i[3]*r[1],o=i[1]*r[0]+i[4]*r[1],a=i[2]*r[0]+i[5]*r[1]+r[2],h=i[0]*r[3]+i[3]*r[4],l=i[1]*r[3]+i[4]*r[4],c=i[2]*r[3]+i[5]*r[4]+r[5],m=s._t;return m[0]=n,m[1]=o,m[2]=a,m[3]=h,m[4]=l,m[5]=c,s}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new L([0,0,0,0,0,0]);e=1/e;const s=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,r=t[4]*e,n=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new L([r,n,s,o,a,i])}}class z{constructor(t,e){this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new r(y,null,null,100),this._earlyReturn=!1,this._mapRotation=0,this._resourceManager=t||new g,this._transfos.push(e||L.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||L.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const s=e?t.scaleRatio():1;L.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*s)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e)}}drawMultiLayerSymbol(t,e){if(!t)return;const s=t.symbolLayers;if(!s)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(s,e),e=t.next()}}else this.drawSymbolLayers(s,e)}executeEffects(t,e){const s=this._resourceManager.geometryEngine;let i=new _(e);for(const r of t){const t=d(r);t&&(i=t.execute(i,r,this.geomUnitsPerPoint(),s))}return i}drawSymbolLayers(t,e){let s=t.length;for(;s--;){const i=t[s];if(!i||!1===i.enable)continue;const r=i.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const s=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());s&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,s),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const s=t.markerPlacement;if(s){const i=p(s);if(i){const r="CIMMarkerPlacementInsidePolygon"===s.type;r&&this.pushClipPath(e);const n=i.execute(e,s,this.geomUnitsPerPoint(),this._resourceManager.geometryEngine);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}r&&this.popClipPath()}}else{const s=this._placementPool.acquire();if(l(e))s.tx=e.x,s.ty=e.y,this.drawMarker(t,s);else for(const i of e.points)if(s.tx=i[0],s.ty=i[1],this.drawMarker(t,s),this._earlyReturn)break;this._placementPool.release(s)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){var i,r,n,o,a;if(!t)return;const h=this._resourceManager.getResource(t.url),l=null!=(i=t.size)?i:10;if(s(h)||l<=0)return;const c=h.width,m=h.height;if(!c||!m)return;const f=c/m,u=null!=(r=t.scaleX)?r:1,_=L.createIdentity(),d=t.anchorPoint;if(d){let e=d.x,s=d.y;"Absolute"!==t.anchorPointUnits&&(e*=l*f*u,s*=l),_.translate(-e,-s)}let p=null!=(n=t.rotation)?n:0;t.rotateClockwise&&(p=-p),this._mapRotation&&(p+=this._mapRotation),p&&_.rotate(p*T);let y=null!=(o=t.offsetX)?o:0,g=null!=(a=t.offsetY)?a:0;if(y||g){if(this._mapRotation){const t=T*this._mapRotation,e=Math.cos(t),s=Math.sin(t),i=y*s+g*e;y=y*e-g*s,g=i}_.translate(y,g)}const x=this.geomUnitsPerPoint();1!==x&&_.scale(x,x);const P=e.getAngle();P&&_.rotate(P),_.translate(e.tx,e.ty),this.push(_,!1),this.drawImage(t.url,l,t.scaleX),this.pop()}drawVectorMarker(t,e){var s,i,r,n;if(!t)return;const o=t.markerGraphics;if(!o)return;const a=null!=(s=t.size)?s:10,h=t.frame,l=h?h.ymax-h.ymin:0,c=a&&l?a/l:1,m=L.createIdentity();h&&m.translate(.5*-(h.xmax+h.xmin),.5*-(h.ymax+h.ymin));const f=t.anchorPoint;if(f){let e=f.x,s=f.y;"Absolute"!==t.anchorPointUnits?h&&(e*=h.xmax-h.xmin,s*=h.ymax-h.ymin):(e/=c,s/=c),m.translate(-e,-s)}1!==c&&m.scale(c,c);let u=null!=(i=t.rotation)?i:0;t.rotateClockwise&&(u=-u),this._mapRotation&&(u+=this._mapRotation),u&&m.rotate(u*T);let _=null!=(r=t.offsetX)?r:0,d=null!=(n=t.offsetY)?n:0;if(_||d){if(this._mapRotation){const t=T*this._mapRotation,e=Math.cos(t),s=Math.sin(t),i=_*s+d*e;_=_*e-d*s,d=i}m.translate(_,d)}const p=this.geomUnitsPerPoint();1!==p&&m.scale(p,p);const y=e.getAngle();y&&m.rotate(y),m.translate(e.tx,e.ty),this.push(m,t.scaleSymbolsProportionally);for(const g of o)if(g&&g.symbol&&g.geometry||v.error("Invalid marker graphic",g),this.drawSymbol(g.symbol,g.geometry),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e){var s,i,r,n;if(!t)return;if(!l(e))return;if((null!=(s=t.height)?s:10)<=0)return;const o=L.createIdentity();let a=null!=(i=t.angle)?i:0;a=-a,a&&o.rotate(a*T);const h=null!=(r=t.offsetX)?r:0,c=null!=(n=t.offsetY)?n:0;(h||c)&&o.translate(h,c);const m=this.geomUnitsPerPoint();1!==m&&o.scale(m,m),o.translate(e.x,e.y),this.push(o,!1),this.drawText(t),this.pop()}_buildHatchPolyline(t,e,s){let i=(void 0!==t.separation?t.separation:4)*s,r=void 0!==t.rotation?t.rotation:0;if(0===i)return null;i<0&&(i=-i);let n=0;const a=.5*i;for(;n>a;)n-=i;for(;n<-a;)n+=i;const l=o();h(l,e),l[0]-=a,l[1]-=a,l[2]+=a,l[3]+=a;const c=[[l[0],l[1]],[l[0],l[3]],[l[2],l[3]],[l[2],l[1]]];for(;r>180;)r-=180;for(;r<0;)r+=180;const m=Math.cos(r*T),f=Math.sin(r*T),u=-i*f,_=i*m;let d,p,y,g;n=(void 0!==t.offsetX?t.offsetX*s:0)*f-(void 0!==t.offsetY?t.offsetY*s:0)*m,d=y=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const o of c){const t=o[0],e=o[1],s=m*t+f*e,i=-f*t+m*e;d=Math.min(d,s),y=Math.min(y,i),p=Math.max(p,s),g=Math.max(g,i)}y=Math.floor(y/i)*i;let x=m*d-f*y-u*n/i,P=f*d+m*y-_*n/i,w=m*p-f*y-u*n/i,M=f*p+m*y-_*n/i;const b=1+Math.round((g-y)/i),S=[];for(let o=0;o<b;o++)x+=u,P+=_,w+=u,M+=_,S.push([[x,P],[w,M]]);return{paths:S}}}class U extends z{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new w(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return a(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(c(t))this._processPath(t.rings,0);else if(m(t))this._processPath(t.paths,0);else if(f(t)){const e=A(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,s){if(!t||this._clipCount>0)return;const i=.5*this.transformSize(s);if(c(t))this._processPath(t.rings,i);else if(m(t))this._processPath(t.paths,i);else if(f(t)){const e=A(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}pushClipPath(t){this.drawSolidFill(t),++this._clipCount}popClipPath(){--this._clipCount}drawImage(t,e,s){let r=s*e,n=e;const o=this._resourceManager.getResource(t);!e&&i(o)&&(r=s*o.width,n=o.height),this._merge(this.transformPt([-r/2,-n/2]),0),this._merge(this.transformPt([-r/2,n/2]),0),this._merge(this.transformPt([r/2,-n/2]),0),this._merge(this.transformPt([r/2,n/2]),0)}drawText(t){this._textRasterizer||(this._textRasterizer=new M)}_processPath(t,e){if(t)for(const s of t){const t=s?s.length:0;if(t>1){this._merge(this.transformPt(s[0]),e);for(let i=1;i<t;++i)this._merge(this.transformPt(s[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class F extends z{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0}hitTest(t,e,s,i,r,o){const a=o*n(1);this.setTransform(),this.setGeomUnitsPerPoint(a),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/a,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);return this._mapRotation=h?r:0,this._earlyReturn=!1,this.drawSymbol(e,s),this._earlyReturn}drawSolidFill(t,e){this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,s,i,r,n){this._hitTestStroke(t,s)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}pushClipPath(t){}popClipPath(){}drawImage(t,e,i){const r=this._resourceManager.getResource(t);if(s(r)||0===r.height||0===e)return;const n=e*this.geomUnitsPerPoint(),o=n*i*(r.width/r.height),a=this.reverseTransformPt(this._searchPoint),h=this._searchDistPoint;Math.abs(a[0])<o/2+h&&Math.abs(a[1])<n/2+h&&(this._earlyReturn=!0)}drawText(e){var s,i;const r=this._textInfo;if(!r)return;const n=r.get(e);if(!n)return;const{text:o,mosaicItem:a}=n;if(!a||0===a.glyphMosaicItems.length)return;const h=null!=(s=e.height)?s:I,l=B(e.lineGapType,null!=(i=e.lineGap)?i:0,h),c=t(o)[1],m=a.glyphMosaicItems,f=R(m,c,{scale:h/k,angle:0,xOffset:0,yOffset:0,hAlign:G(e.horizontalAlignment),vAlign:E(e.verticalAlignment),maxLineWidth:512,lineHeight:C*Math.max(.25,Math.min(l||1,4)),decoration:e.font.decoration||"none",isCIM:!0}),u=this.reverseTransformPt(this._searchPoint),_=u[0],d=u[1];for(const t of f.glyphs)if(_>t.xTopLeft&&_<t.xBottomRight&&d>-t.yBottomRight&&d<-t.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(f(t)){const s=t;e=[[[s.xmin,s.ymin],[s.xmin,s.ymax],[s.xmax,s.ymax],[s.xmax,s.ymin],[s.xmin,s.ymin]]]}else if(c(t))e=t.rings;else{if(!m(t))return;e=t.paths}const s=this.reverseTransformPt(this._searchPoint);this._pointInPolygon(s,e)&&(this._earlyReturn=!0);const i=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(s,e,i)&&(this._earlyReturn=!0)}_hitTestStroke(t,e){let s=null;if(f(t)){const e=t;s=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(c(t))s=t.rings;else{if(!m(t))return;s=t.paths}const i=this.reverseTransformPt(this._searchPoint),r=e*this.geomUnitsPerPoint(),n=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(i,s,r/2+n)&&(this._earlyReturn=!0)}_pointInPolygon(t,e){let s=0;for(const i of e){const e=i.length;for(let r=1;r<e;++r){const e=i[r-1],n=i[r];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?s++:s--}}return 0!==s}_nearLine(t,e,s){for(const i of e){const e=i.length;for(let r=1;r<e;++r){const e=i[r-1],n=i[r];let o=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===o)continue;o=Math.sqrt(o);const a=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/o;if(Math.abs(a)<s){const i=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/o;if(i>-s&&i<o+s)return!0}}}return!1}}class j extends z{constructor(t,e,s){super(e,s),this._ctx=t}drawSolidFill(t,e){if(!t)return;if(c(t))this._buildPath(t.rings,!0);else if(m(t))this._buildPath(t.paths,!0);else if(f(t))this._buildPath(A(t).rings,!0);else{if(!u(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const s=this._ctx;s.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",s.fill("evenodd")}drawSolidStroke(t,e,s,i,r,n){if(!t||!e||0===s)return;if(c(t))this._buildPath(t.rings,!0);else if(m(t))this._buildPath(t.paths,!1);else{if(!f(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(A(t).rings,!0)}const o=this._ctx;o.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",o.lineWidth=this.transformSize(s)+.5,this._setCapStyle(i),this._setJoinStyle(r),o.miterLimit=n,o.stroke()}pushClipPath(t){if(this._ctx.save(),c(t))this._buildPath(t.rings,!0);else if(m(t))this._buildPath(t.paths,!0);else{if(!f(t))return;this._buildPath(A(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e,i){const r=this._resourceManager.getResource(t);if(s(r))return;const n=this._ctx,o=n.canvas.width,a=n.canvas.height;let h=e*i*(r.width/r.height),l=i*e;e||(h=i*r.width,l=i*r.height),this._ctx.drawImage(r,0,0,r.width,r.height,0,0,Math.min(this.transformSize(h),o),Math.min(this.transformSize(l),a))}drawText(t){this._textRasterizer||(this._textRasterizer=new M)}_buildPath(t,e){const s=this._ctx;if(s.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let r=this.transformPt(i[0]);s.moveTo(r[0],r[1]);for(let e=1;e<t;++e)r=this.transformPt(i[e]),s.lineTo(r[0],r[1]);e&&s.closePath()}}}_setCapStyle(t){switch(t){case x.Butt:this._ctx.lineCap="butt";break;case x.Round:this._ctx.lineCap="round";break;case x.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case P.Bevel:this._ctx.lineJoin="bevel";break;case P.Round:this._ctx.lineJoin="round";break;case P.Miter:this._ctx.lineJoin="miter"}}}const A=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,G=t=>{switch(t){case"Left":return b.Left;case"Right":return b.Right;case"Center":case"Justify":return b.Center}},E=t=>{switch(t){case"Top":return S.Top;case"Center":return S.Center;case"Bottom":return S.Bottom;case"Baseline":return S.Baseline}},B=(t,e,s)=>{switch(t){case"ExtraLeading":return 1+e/s;case"Multiple":return e;case"Exact":return e/s}};export{z as CIMSymbolDrawHelper,T as C_DEG_TO_RAD,j as CanvasDrawHelper,U as EnvDrawHelper,F as HittestDrawHelper,L as Transformation,G as horizontalAlignment2HAlign,B as lineGapType2LineHeight,E as verticalAlignment2VAlign};
5
+ import{bidiText as t}from"../../core/BidiText.js";import e from"../../core/Logger.js";import{isNone as s,isSome as i}from"../../core/maybe.js";import r from"../../core/ObjectPool.js";import{pt2px as n}from"../../core/screenUtils.js";import{create as o,fromValues as a}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as h}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as l}from"../../geometry/support/centroid.js";import{isPoint as c,isPolygon as m,isPolyline as f,isExtent as u,isMultipoint as _}from"../../geometry/support/jsonUtils.js";import{SimpleGeometryCursor as d}from"./CIMEffects.js";import{getEffectOperator as p,getPlacementOperator as y}from"./CIMOperators.js";import{Placement as g}from"./CIMPlacements.js";import x from"./CIMResourceManager.js";import{LineCapStyle as P,LineJoinStyle as w}from"./enums.js";import M from"./Rect.js";import{TextRasterizer as b}from"./TextRasterizer.js";import{HAlign as S,VAlign as k}from"../../views/2d/engine/webgl/alignmentUtils.js";import{GLYPH_SIZE as C,MAGIC_LABEL_LINE_HEIGHT as R}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as T}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";const I=Math.PI/180,v=10,L=e.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class z{constructor(t){this._t=t}static createIdentity(){return new z([1,0,0,0,1,0])}clone(){const t=this._t;return new z(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new z([t,0,0,0,e,0])}scale(t,e){const s=this._t;return s[0]*=t,s[1]*=t,s[2]*=t,s[3]*=e,s[4]*=e,s[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new z([0,0,t,0,0,e])}translate(t,e){const s=this._t;return s[2]+=t,s[5]+=e,this}static createRotate(t){const e=Math.cos(t),s=Math.sin(t);return new z([e,-s,0,s,e,0])}rotate(t){return z.multiply(this,z.createRotate(t),this)}static multiply(t,e,s){const i=t._t,r=e._t,n=i[0]*r[0]+i[3]*r[1],o=i[1]*r[0]+i[4]*r[1],a=i[2]*r[0]+i[5]*r[1]+r[2],h=i[0]*r[3]+i[3]*r[4],l=i[1]*r[3]+i[4]*r[4],c=i[2]*r[3]+i[5]*r[4]+r[5],m=s._t;return m[0]=n,m[1]=o,m[2]=a,m[3]=h,m[4]=l,m[5]=c,s}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new z([0,0,0,0,0,0]);e=1/e;const s=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,r=t[4]*e,n=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new z([r,n,s,o,a,i])}}class U{constructor(t,e){this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new r(g,null,null,100),this._earlyReturn=!1,this._mapRotation=0,this._resourceManager=t||new x,this._transfos.push(e||z.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||z.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const s=e?t.scaleRatio():1;z.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*s)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e)}}drawMultiLayerSymbol(t,e){if(!t)return;const s=t.symbolLayers;if(!s)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(s,e),e=t.next()}}else this.drawSymbolLayers(s,e)}executeEffects(t,e){const s=this._resourceManager.geometryEngine;let i=new d(e);for(const r of t){const t=p(r);t&&(i=t.execute(i,r,this.geomUnitsPerPoint(),s))}return i}drawSymbolLayers(t,e){let s=t.length;for(;s--;){const i=t[s];if(!i||!1===i.enable)continue;const r=i.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const s=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());s&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,s),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const s=t.markerPlacement;if(s){const i=y(s);if(i){const r="CIMMarkerPlacementInsidePolygon"===s.type;r&&this.pushClipPath(e);const n=i.execute(e,s,this.geomUnitsPerPoint(),this._resourceManager.geometryEngine);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}r&&this.popClipPath()}}else{const s=this._placementPool.acquire();if(c(e))s.tx=e.x,s.ty=e.y,this.drawMarker(t,s);else if(m(e))[s.tx,s.ty]=l(e),this.drawMarker(t,s);else for(const i of e.points)if(s.tx=i[0],s.ty=i[1],this.drawMarker(t,s),this._earlyReturn)break;this._placementPool.release(s)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){var i,r,n,o,a;if(!t)return;const h=this._resourceManager.getResource(t.url),l=null!=(i=t.size)?i:10;if(s(h)||l<=0)return;const c=h.width,m=h.height;if(!c||!m)return;const f=c/m,u=null!=(r=t.scaleX)?r:1,_=z.createIdentity(),d=t.anchorPoint;if(d){let e=d.x,s=d.y;"Absolute"!==t.anchorPointUnits&&(e*=l*f*u,s*=l),_.translate(-e,-s)}let p=null!=(n=t.rotation)?n:0;t.rotateClockwise&&(p=-p),this._mapRotation&&(p+=this._mapRotation),p&&_.rotate(p*I);let y=null!=(o=t.offsetX)?o:0,g=null!=(a=t.offsetY)?a:0;if(y||g){if(this._mapRotation){const t=I*this._mapRotation,e=Math.cos(t),s=Math.sin(t),i=y*s+g*e;y=y*e-g*s,g=i}_.translate(y,g)}const x=this.geomUnitsPerPoint();1!==x&&_.scale(x,x);const P=e.getAngle();P&&_.rotate(P),_.translate(e.tx,e.ty),this.push(_,!1),this.drawImage(t.url,l,t.scaleX),this.pop()}drawVectorMarker(t,e){var s,i,r,n;if(!t)return;const o=t.markerGraphics;if(!o)return;const a=null!=(s=t.size)?s:10,h=t.frame,l=h?h.ymax-h.ymin:0,c=a&&l?a/l:1,m=z.createIdentity();h&&m.translate(.5*-(h.xmax+h.xmin),.5*-(h.ymax+h.ymin));const f=t.anchorPoint;if(f){let e=f.x,s=f.y;"Absolute"!==t.anchorPointUnits?h&&(e*=h.xmax-h.xmin,s*=h.ymax-h.ymin):(e/=c,s/=c),m.translate(-e,-s)}1!==c&&m.scale(c,c);let u=null!=(i=t.rotation)?i:0;t.rotateClockwise&&(u=-u),this._mapRotation&&(u+=this._mapRotation),u&&m.rotate(u*I);let _=null!=(r=t.offsetX)?r:0,d=null!=(n=t.offsetY)?n:0;if(_||d){if(this._mapRotation){const t=I*this._mapRotation,e=Math.cos(t),s=Math.sin(t),i=_*s+d*e;_=_*e-d*s,d=i}m.translate(_,d)}const p=this.geomUnitsPerPoint();1!==p&&m.scale(p,p);const y=e.getAngle();y&&m.rotate(y),m.translate(e.tx,e.ty),this.push(m,t.scaleSymbolsProportionally);for(const g of o)if(g&&g.symbol&&g.geometry||L.error("Invalid marker graphic",g),this.drawSymbol(g.symbol,g.geometry),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e){var s,i,r,n;if(!t)return;if(!c(e))return;if((null!=(s=t.height)?s:10)<=0)return;const o=z.createIdentity();let a=null!=(i=t.angle)?i:0;a=-a,a&&o.rotate(a*I);const h=null!=(r=t.offsetX)?r:0,l=null!=(n=t.offsetY)?n:0;(h||l)&&o.translate(h,l);const m=this.geomUnitsPerPoint();1!==m&&o.scale(m,m),o.translate(e.x,e.y),this.push(o,!1),this.drawText(t),this.pop()}_buildHatchPolyline(t,e,s){let i=(void 0!==t.separation?t.separation:4)*s,r=void 0!==t.rotation?t.rotation:0;if(0===i)return null;i<0&&(i=-i);let n=0;const a=.5*i;for(;n>a;)n-=i;for(;n<-a;)n+=i;const l=o();h(l,e),l[0]-=a,l[1]-=a,l[2]+=a,l[3]+=a;const c=[[l[0],l[1]],[l[0],l[3]],[l[2],l[3]],[l[2],l[1]]];for(;r>180;)r-=180;for(;r<0;)r+=180;const m=Math.cos(r*I),f=Math.sin(r*I),u=-i*f,_=i*m;let d,p,y,g;n=(void 0!==t.offsetX?t.offsetX*s:0)*f-(void 0!==t.offsetY?t.offsetY*s:0)*m,d=y=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const o of c){const t=o[0],e=o[1],s=m*t+f*e,i=-f*t+m*e;d=Math.min(d,s),y=Math.min(y,i),p=Math.max(p,s),g=Math.max(g,i)}y=Math.floor(y/i)*i;let x=m*d-f*y-u*n/i,P=f*d+m*y-_*n/i,w=m*p-f*y-u*n/i,M=f*p+m*y-_*n/i;const b=1+Math.round((g-y)/i),S=[];for(let o=0;o<b;o++)x+=u,P+=_,w+=u,M+=_,S.push([[x,P],[w,M]]);return{paths:S}}}class F extends U{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new M(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return a(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(m(t))this._processPath(t.rings,0);else if(f(t))this._processPath(t.paths,0);else if(u(t)){const e=G(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,s){if(!t||this._clipCount>0)return;const i=.5*this.transformSize(s);if(m(t))this._processPath(t.rings,i);else if(f(t))this._processPath(t.paths,i);else if(u(t)){const e=G(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}pushClipPath(t){this.drawSolidFill(t),++this._clipCount}popClipPath(){--this._clipCount}drawImage(t,e,s){let r=s*e,n=e;const o=this._resourceManager.getResource(t);!e&&i(o)&&(r=s*o.width,n=o.height),this._merge(this.transformPt([-r/2,-n/2]),0),this._merge(this.transformPt([-r/2,n/2]),0),this._merge(this.transformPt([r/2,-n/2]),0),this._merge(this.transformPt([r/2,n/2]),0)}drawText(t){this._textRasterizer||(this._textRasterizer=new b)}_processPath(t,e){if(t)for(const s of t){const t=s?s.length:0;if(t>1){this._merge(this.transformPt(s[0]),e);for(let i=1;i<t;++i)this._merge(this.transformPt(s[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class j extends U{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0}hitTest(t,e,s,i,r,o){const a=o*n(1);this.setTransform(),this.setGeomUnitsPerPoint(a),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/a,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);return this._mapRotation=h?r:0,this._earlyReturn=!1,this.drawSymbol(e,s),this._earlyReturn}drawSolidFill(t,e){this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,s,i,r,n){this._hitTestStroke(t,s)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}pushClipPath(t){}popClipPath(){}drawImage(t,e,i){const r=this._resourceManager.getResource(t);if(s(r)||0===r.height||0===e)return;const n=e*this.geomUnitsPerPoint(),o=n*i*(r.width/r.height),a=this.reverseTransformPt(this._searchPoint),h=this._searchDistPoint;Math.abs(a[0])<o/2+h&&Math.abs(a[1])<n/2+h&&(this._earlyReturn=!0)}drawText(e){var s,i;const r=this._textInfo;if(!r)return;const n=r.get(e);if(!n)return;const{text:o,mosaicItem:a}=n;if(!a||0===a.glyphMosaicItems.length)return;const h=null!=(s=e.height)?s:v,l=H(e.lineGapType,null!=(i=e.lineGap)?i:0,h),c=t(o)[1],m=a.glyphMosaicItems,f=T(m,c,{scale:h/C,angle:0,xOffset:0,yOffset:0,hAlign:E(e.horizontalAlignment),vAlign:B(e.verticalAlignment),maxLineWidth:512,lineHeight:R*Math.max(.25,Math.min(l||1,4)),decoration:e.font.decoration||"none",isCIM:!0}),u=this.reverseTransformPt(this._searchPoint),_=u[0],d=u[1];for(const t of f.glyphs)if(_>t.xTopLeft&&_<t.xBottomRight&&d>-t.yBottomRight&&d<-t.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(u(t)){const s=t;e=[[[s.xmin,s.ymin],[s.xmin,s.ymax],[s.xmax,s.ymax],[s.xmax,s.ymin],[s.xmin,s.ymin]]]}else if(m(t))e=t.rings;else{if(!f(t))return;e=t.paths}const s=this.reverseTransformPt(this._searchPoint);this._pointInPolygon(s,e)&&(this._earlyReturn=!0);const i=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(s,e,i)&&(this._earlyReturn=!0)}_hitTestStroke(t,e){let s=null;if(u(t)){const e=t;s=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(m(t))s=t.rings;else{if(!f(t))return;s=t.paths}const i=this.reverseTransformPt(this._searchPoint),r=e*this.geomUnitsPerPoint(),n=this.reverseTransformSize(this._searchDistPoint)*this.geomUnitsPerPoint();this._nearLine(i,s,r/2+n)&&(this._earlyReturn=!0)}_pointInPolygon(t,e){let s=0;for(const i of e){const e=i.length;for(let r=1;r<e;++r){const e=i[r-1],n=i[r];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?s++:s--}}return 0!==s}_nearLine(t,e,s){for(const i of e){const e=i.length;for(let r=1;r<e;++r){const e=i[r-1],n=i[r];let o=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===o)continue;o=Math.sqrt(o);const a=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/o;if(Math.abs(a)<s){const i=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/o;if(i>-s&&i<o+s)return!0}}}return!1}}class A extends U{constructor(t,e,s){super(e,s),this._ctx=t}drawSolidFill(t,e){if(!t)return;if(m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!0);else if(u(t))this._buildPath(G(t).rings,!0);else{if(!_(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const s=this._ctx;s.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",s.fill("evenodd")}drawSolidStroke(t,e,s,i,r,n){if(!t||!e||0===s)return;if(m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!1);else{if(!u(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(G(t).rings,!0)}const o=this._ctx;o.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+e[3]/255+")",o.lineWidth=this.transformSize(s)+.5,this._setCapStyle(i),this._setJoinStyle(r),o.miterLimit=n,o.stroke()}pushClipPath(t){if(this._ctx.save(),m(t))this._buildPath(t.rings,!0);else if(f(t))this._buildPath(t.paths,!0);else{if(!u(t))return;this._buildPath(G(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e,i){const r=this._resourceManager.getResource(t);if(s(r))return;const n=this._ctx,o=n.canvas.width,a=n.canvas.height;let h=e*i*(r.width/r.height),l=i*e;e||(h=i*r.width,l=i*r.height),this._ctx.drawImage(r,0,0,r.width,r.height,0,0,Math.min(this.transformSize(h),o),Math.min(this.transformSize(l),a))}drawText(t){this._textRasterizer||(this._textRasterizer=new b)}_buildPath(t,e){const s=this._ctx;if(s.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let r=this.transformPt(i[0]);s.moveTo(r[0],r[1]);for(let e=1;e<t;++e)r=this.transformPt(i[e]),s.lineTo(r[0],r[1]);e&&s.closePath()}}}_setCapStyle(t){switch(t){case P.Butt:this._ctx.lineCap="butt";break;case P.Round:this._ctx.lineCap="round";break;case P.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case w.Bevel:this._ctx.lineJoin="bevel";break;case w.Round:this._ctx.lineJoin="round";break;case w.Miter:this._ctx.lineJoin="miter"}}}const G=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,E=t=>{switch(t){case"Left":return S.Left;case"Right":return S.Right;case"Center":case"Justify":return S.Center}},B=t=>{switch(t){case"Top":return k.Top;case"Center":return k.Center;case"Bottom":return k.Bottom;case"Baseline":return k.Baseline}},H=(t,e,s)=>{switch(t){case"ExtraLeading":return 1+e/s;case"Multiple":return e;case"Exact":return e/s}};export{U as CIMSymbolDrawHelper,I as C_DEG_TO_RAD,A as CanvasDrawHelper,F as EnvDrawHelper,j as HittestDrawHelper,z as Transformation,E as horizontalAlignment2HAlign,H as lineGapType2LineHeight,B as verticalAlignment2VAlign};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{MIN_MAX_ZOOM_PRECISION_FACTOR as i,TEXTURE_BINDING_ATTRIBUTE_DATA_0 as s,TEXTURE_BINDING_ATTRIBUTE_DATA_1 as o,TEXTURE_BINDING_ATTRIBUTE_DATA_2 as a,TEXTURE_BINDING_ATTRIBUTE_DATA_3 as r}from"../definitions.js";import n from"./WGLBrush.js";import{BlendFactor as v,CompareFunction as u,DataType as f}from"../../../../webgl/enums.js";class m extends n{constructor(){super(...arguments),this._computeDesc=null}prepareState({context:t},e,i){const s=i&&-1!==i.indexOf("hittest");t.setBlendingEnabled(!s),t.setBlendFunctionSeparate(v.ONE,v.ONE_MINUS_SRC_ALPHA,v.ONE,v.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!0),t.setStencilFunction(u.EQUAL,e.stencilRef,255)}draw(e,i,s){const o=this.getGeometryType();i.commit(e);const a=i.getGeometry(o);t(a)||(e.timeline.begin(this.name),e.attributeView.bindTextures(e.context),a.forEachCommand((t=>this.drawGeometry(e,i,t,s))))}_setSharedUniforms(t,n,v){const{displayLevel:u,pixelRatio:f,state:m,passOptions:l}=n;e(l)&&"hittest"===l.type&&(t.setUniform2fv("u_hittestPos",l.position),t.setUniform1f("u_hittestDist",l.distance)),t.setUniform1f("u_pixelRatio",f),t.setUniformMatrix3fv("u_tileMat3",v.transforms.tileMat3),t.setUniformMatrix3fv("u_viewMat3",m.viewMat3),t.setUniformMatrix3fv("u_dvsMat3",v.transforms.dvs),t.setUniformMatrix3fv("u_displayViewMat3",m.displayViewMat3),t.setUniform1f("u_currentZoom",Math.round(u*i)),t.setUniform1i("u_attributeTextureSize",n.attributeView.size),t.setUniform1i("u_attributeData0",s),t.setUniform1i("u_attributeData1",o),t.setUniform1i("u_attributeData2",a),t.setUniform1i("u_attributeData3",r)}_setSizeVVUniforms(t,e,i,s){if(t.vvSizeMinMaxValue&&e.setUniform4fv("u_vvSizeMinMaxValue",i.vvSizeMinMaxValue),t.vvSizeScaleStops&&e.setUniform1f("u_vvSizeScaleStopsValue",i.vvSizeScaleStopsValue),t.vvSizeFieldStops){const t=i.getSizeVVFieldStops(s.key.level);e.setUniform1fv("u_vvSizeFieldStopsValues",t.values),e.setUniform1fv("u_vvSizeFieldStopsSizes",t.sizes)}t.vvSizeUnitValue&&e.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio",i.vvSizeUnitValueToPixelsRatio)}_setColorAndOpacityVVUniforms(t,e,i){t.vvColor&&(e.setUniform1fv("u_vvColorValues",i.vvColorValues),e.setUniform4fv("u_vvColors",i.vvColors)),t.vvOpacity&&(e.setUniform1fv("u_vvOpacityValues",i.vvOpacityValues),e.setUniform1fv("u_vvOpacities",i.vvOpacities))}_setRotationVVUniforms(t,e,i){t.vvRotation&&e.setUniform1f("u_vvRotationType","geographic"===i.vvMaterialParameters.vvRotationType?0:1)}_getTriangleDesc(t){if(!this._computeDesc){const e=t.strides,i=t.strides.geometry,s=new Map(t.attributes),o=t.bufferLayouts.geometry.map((t=>({...t}))),a=Math.max(...t.attributes.values()),r={geometry:o};r.geometry.push({count:2,name:"a_pos1",divisor:0,normalized:!1,offset:i,stride:i,type:f.SHORT}),r.geometry.push({count:2,name:"a_pos2",divisor:0,normalized:!1,offset:2*i,stride:i,type:f.SHORT}),s.set("a_pos1",a+1),s.set("a_pos2",a+2),this._computeDesc={bufferLayouts:r,attributes:s,strides:e}}return this._computeDesc}}export{m as default};
5
+ import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{MIN_MAX_ZOOM_PRECISION_FACTOR as i,TEXTURE_BINDING_ATTRIBUTE_DATA_0 as s,TEXTURE_BINDING_ATTRIBUTE_DATA_1 as o,TEXTURE_BINDING_ATTRIBUTE_DATA_2 as a,TEXTURE_BINDING_ATTRIBUTE_DATA_3 as r}from"../definitions.js";import n from"./WGLBrush.js";import{BlendFactor as v,CompareFunction as u,DataType as f}from"../../../../webgl/enums.js";class m extends n{constructor(){super(...arguments),this._computeDesc=new Map}prepareState({context:t},e,i){const s=i&&-1!==i.indexOf("hittest");t.setBlendingEnabled(!s),t.setBlendFunctionSeparate(v.ONE,v.ONE_MINUS_SRC_ALPHA,v.ONE,v.ONE_MINUS_SRC_ALPHA),t.setColorMask(!0,!0,!0,!0),t.setStencilWriteMask(0),t.setStencilTestEnabled(!0),t.setStencilFunction(u.EQUAL,e.stencilRef,255)}draw(e,i,s){const o=this.getGeometryType();i.commit(e);const a=i.getGeometry(o);t(a)||(e.timeline.begin(this.name),e.attributeView.bindTextures(e.context),a.forEachCommand((t=>this.drawGeometry(e,i,t,s))))}_setSharedUniforms(t,n,v){const{displayLevel:u,pixelRatio:f,state:m,passOptions:l}=n;e(l)&&"hittest"===l.type&&(t.setUniform2fv("u_hittestPos",l.position),t.setUniform1f("u_hittestDist",l.distance)),t.setUniform1f("u_pixelRatio",f),t.setUniformMatrix3fv("u_tileMat3",v.transforms.tileMat3),t.setUniformMatrix3fv("u_viewMat3",m.viewMat3),t.setUniformMatrix3fv("u_dvsMat3",v.transforms.dvs),t.setUniformMatrix3fv("u_displayViewMat3",m.displayViewMat3),t.setUniform1f("u_currentZoom",Math.round(u*i)),t.setUniform1i("u_attributeTextureSize",n.attributeView.size),t.setUniform1i("u_attributeData0",s),t.setUniform1i("u_attributeData1",o),t.setUniform1i("u_attributeData2",a),t.setUniform1i("u_attributeData3",r)}_setSizeVVUniforms(t,e,i,s){if(t.vvSizeMinMaxValue&&e.setUniform4fv("u_vvSizeMinMaxValue",i.vvSizeMinMaxValue),t.vvSizeScaleStops&&e.setUniform1f("u_vvSizeScaleStopsValue",i.vvSizeScaleStopsValue),t.vvSizeFieldStops){const t=i.getSizeVVFieldStops(s.key.level);e.setUniform1fv("u_vvSizeFieldStopsValues",t.values),e.setUniform1fv("u_vvSizeFieldStopsSizes",t.sizes)}t.vvSizeUnitValue&&e.setUniform1f("u_vvSizeUnitValueWorldToPixelsRatio",i.vvSizeUnitValueToPixelsRatio)}_setColorAndOpacityVVUniforms(t,e,i){t.vvColor&&(e.setUniform1fv("u_vvColorValues",i.vvColorValues),e.setUniform4fv("u_vvColors",i.vvColors)),t.vvOpacity&&(e.setUniform1fv("u_vvOpacityValues",i.vvOpacityValues),e.setUniform1fv("u_vvOpacities",i.vvOpacities))}_setRotationVVUniforms(t,e,i){t.vvRotation&&e.setUniform1f("u_vvRotationType","geographic"===i.vvMaterialParameters.vvRotationType?0:1)}_getTriangleDesc(t,e){let i=this._computeDesc.get(t);if(!i){const s=e.strides,o=e.strides.geometry,a=new Map(e.attributes),r=e.bufferLayouts.geometry.map((t=>({...t}))),n=Math.max(...e.attributes.values()),v={geometry:r};v.geometry.push({count:2,name:"a_pos1",divisor:0,normalized:!1,offset:o,stride:o,type:f.SHORT}),v.geometry.push({count:2,name:"a_pos2",divisor:0,normalized:!1,offset:2*o,stride:o,type:f.SHORT}),a.set("a_pos1",n+1),a.set("a_pos2",n+2),i={bufferLayouts:v,attributes:a,strides:s},this._computeDesc.set(t,i)}return i}}export{m 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as t,isSome as e,isNone as o}from"../../../../../core/maybe.js";import r from"../../../../../core/RandomLCG.js";import{TEXTURE_BINDING_RENDERER_0 as i,TEXTURE_BINDING_RENDERER_1 as s,TILE_SIZE as n}from"../definitions.js";import{WGLGeometryType as a}from"../enums.js";import{createProgramDescriptor as d}from"../Utils.js";import l from"./WGLGeometryBrush.js";import{FillMaterialKey as m}from"../materialKey/MaterialKey.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PrimitiveType as u,DataType as c,TextureType as f,PixelFormat as h,PixelType as T,TextureSamplingMode as p,TextureWrapMode as x,TargetType as y,DepthStencilTargetType as D,RenderbufferFormat as g,Usage as E}from"../../../../webgl/enums.js";import{FramebufferObject as S}from"../../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../../webgl/Renderbuffer.js";import{Texture as U}from"../../../../webgl/Texture.js";import{VertexArrayObject as O}from"../../../../webgl/VertexArrayObject.js";const b=t=>{const e={geometry:[{location:0,name:"a_pos",count:2,type:c.SHORT},{location:1,name:"a_id",count:3,type:c.UNSIGNED_BYTE},{location:2,name:"a_bitset",count:1,type:c.UNSIGNED_BYTE}]};return t.dotDensity?(e.geometry.push({location:3,name:"a_inverseArea",count:1,type:c.FLOAT}),d(t.data,e)):(e.geometry.push({location:3,name:"a_color",count:4,type:c.UNSIGNED_BYTE,normalized:!0}),t.simple||e.geometry.push({location:4,name:"a_aux1",count:4,type:c.UNSIGNED_SHORT}),e.geometry.push({location:5,name:"a_aux2",count:4,type:c.UNSIGNED_BYTE},{location:6,name:"a_aux3",count:4,type:c.UNSIGNED_BYTE}),t.simple||e.geometry.push({location:7,name:"a_zoomRange",count:2,type:c.UNSIGNED_SHORT}),d(t.data,e))};class N extends l{constructor(){super(...arguments),this._dotTextureSize=0,this._dotTextures=null,this._dotSamplers=new Int32Array([i,s]),this._dotVAO=null,this._dotDesc={vsPath:"dot/dot",fsPath:"dot/dot",attributes:new Map([["a_pos",0]])}}dispose(){this._disposeTextures(),this._dotFBO=t(this._dotFBO),this._dotVAO=t(this._dotVAO)}getGeometryType(){return a.FILL}drawGeometry(t,o,r,i){const{context:s,painter:n,rendererInfo:a,requiredLevel:d,passOptions:l}=t,_=m.load(r.materialKey),f=n.materialManager;let h=u.TRIANGLES,T=b(_);e(l)&&"hittest"===l.type&&(T=this._getTriangleDesc(T),h=u.POINTS);const{attributes:p,bufferLayouts:x}=T,y=f.getMaterialProgram(t,_,"materials/fill",p,i);if(s.useProgram(y),this._setSharedUniforms(y,t,o),y.setUniform2f("u_tileOffset",512*o.key.col,512*o.key.row),_.textureBinding){n.textureManager.bindTextures(s,y,_);const e=1/2**(d-o.key.level)/t.pixelRatio;y.setUniform1f("u_zoomFactor",e)}const D=1/t.pixelRatio;y.setUniform1f("u_blur",D),y.setUniform1f("u_antialiasing",D),this._setSizeVVUniforms(_,y,a,o),this._setColorAndOpacityVVUniforms(_,y,a);const g=e(l)&&"hittest"===l.type,E=r.target.getVAO(s,x,p,g);let S=r.indexCount,w=r.indexFrom*Uint32Array.BYTES_PER_ELEMENT;if(g&&(S/=3,w/=3),s.bindVAO(E),!_.dotDensity||g)s.drawElements(h,S,c.UNSIGNED_INT,w);else{const e=this._drawDotLocations(t,o,y,S,w);this._drawDotDensity(t,o,e)}}_drawDotDensity(t,e,o){const{context:r,painter:i,rendererInfo:s}=t,n=i.materialManager.getProgram(t,this._dotDesc),a=this._createDotDensityMesh(r,this._dotDesc.attributes,{geometry:[{name:"a_pos",count:2,type:c.SHORT,divisor:0,normalized:!1,offset:0,stride:4}]});r.setStencilTestEnabled(!0),r.useProgram(n),n.setUniform1f("u_tileZoomFactor",1),n.setUniform1i("u_texture",this._dotSamplers[0]),n.setUniform1f("u_dotSize",Math.max(s.ddDotSize,1)),n.setUniform1f("u_pixelRatio",window.devicePixelRatio),this._setSharedUniforms(n,t,e),r.bindTexture(o,this._dotSamplers[0]),r.bindVAO(a),r.drawArrays(u.POINTS,0,262144)}_drawDotLocations(t,e,o,r,i){const{context:s,rendererInfo:a,requiredLevel:d}=t,l=s.getViewport();s.setViewport(0,0,512,512);const m=s.getBoundFramebufferObject(),_=this._createFBO(s);s.bindFramebuffer(_),s.setClearColor(0,0,0,0),s.clear(s.gl.COLOR_BUFFER_BIT|s.gl.STENCIL_BUFFER_BIT),s.setStencilTestEnabled(!1);const f=1/2**(d-e.key.level),h=n,T=h*window.devicePixelRatio*h*window.devicePixelRatio,p=1/f*(1/f),x=a.ddDotScale?t.state.scale/a.ddDotScale:1;return o.setUniform1f("u_tileZoomFactor",f),o.setUniform1f("u_tileDotsOverArea",T/(n*window.devicePixelRatio*n*window.devicePixelRatio)),o.setUniformMatrix4fv("u_dotColors",a.ddColors),o.setUniform4fv("u_isActive",a.ddActiveDots),o.setUniform4fv("u_dotBackgroundColor",a.ddBackgroundColor),o.setUniform1f("u_dotValue",Math.max(1,a.ddDotValue*x*p)),this._bindDotDensityTextures(s,o,a,h),s.drawElements(u.TRIANGLES,r,c.UNSIGNED_INT,i),s.setViewport(l.x,l.y,l.width,l.height),s.bindFramebuffer(m),_.colorTexture}_createFBO(t){if(o(this._dotFBO)){const e=512,o=512,r={target:f.TEXTURE_2D,pixelFormat:h.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:x.CLAMP_TO_EDGE,width:e,height:o},i={colorTarget:y.TEXTURE,depthStencilTarget:D.DEPTH_STENCIL_RENDER_BUFFER},s=new w(t,{width:e,height:o,internalFormat:g.DEPTH_STENCIL});this._dotFBO=new S(t,i,r,s)}return this._dotFBO}_disposeTextures(){if(this._dotTextures){for(let t=0;t<this._dotTextures.length;t++)this._dotTextures[t].dispose();this._dotTextures=null}}_bindDotDensityTextures(t,e,o,r){const i=this._createDotDensityTextures(t,r,o.ddSeed);e.setUniform1iv("u_dotTextures",this._dotSamplers);for(let s=0;s<i.length;s++)t.bindTexture(i[s],this._dotSamplers[s])}_createDotDensityMesh(t,e,r){if(o(this._dotVAO)){const o=2,i=new Int16Array(262144*o);for(let t=0;t<512;t++)for(let e=0;e<512;e++)i[o*(e+512*t)]=e,i[o*(e+512*t)+1]=t;const s=_.createVertex(t,E.STATIC_DRAW,i);this._dotVAO=new O(t,e,r,{geometry:s},null)}return this._dotVAO}_createDotDensityTextures(t,e,o){if(this._dotTextureSize===e&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=e,this._seed=o),null===this._dotTextures){const i=new r(o);this._dotTextures=[this._allocDotDensityTexture(t,e,i),this._allocDotDensityTexture(t,e,i)]}return this._dotTextures}_allocDotDensityTexture(t,e,o){const r=new Float32Array(e*e*4);for(let i=0;i<r.length;i++)r[i]=o.getFloat();return new U(t,{wrapMode:x.REPEAT,pixelFormat:h.RGBA,dataType:T.FLOAT,samplingMode:p.NEAREST,width:e,height:e},r)}}export{N as default};
5
+ import{disposeMaybe as t,isSome as e,isNone as o}from"../../../../../core/maybe.js";import r from"../../../../../core/RandomLCG.js";import{TEXTURE_BINDING_RENDERER_0 as i,TEXTURE_BINDING_RENDERER_1 as s,TILE_SIZE as a}from"../definitions.js";import{WGLGeometryType as n}from"../enums.js";import{createProgramDescriptor as d}from"../Utils.js";import l from"./WGLGeometryBrush.js";import{FillMaterialKey as m}from"../materialKey/MaterialKey.js";import{BufferObject as _}from"../../../../webgl/BufferObject.js";import{PrimitiveType as u,DataType as c,TextureType as f,PixelFormat as h,PixelType as T,TextureSamplingMode as p,TextureWrapMode as y,TargetType as x,DepthStencilTargetType as D,RenderbufferFormat as g,Usage as E}from"../../../../webgl/enums.js";import{FramebufferObject as S}from"../../../../webgl/FramebufferObject.js";import{Renderbuffer as w}from"../../../../webgl/Renderbuffer.js";import{Texture as U}from"../../../../webgl/Texture.js";import{VertexArrayObject as O}from"../../../../webgl/VertexArrayObject.js";const b=t=>{const e={geometry:[{location:0,name:"a_pos",count:2,type:c.SHORT},{location:1,name:"a_id",count:3,type:c.UNSIGNED_BYTE},{location:2,name:"a_bitset",count:1,type:c.UNSIGNED_BYTE}]};return t.dotDensity?(e.geometry.push({location:3,name:"a_inverseArea",count:1,type:c.FLOAT}),d(t.data,e)):(e.geometry.push({location:3,name:"a_color",count:4,type:c.UNSIGNED_BYTE,normalized:!0}),t.simple||e.geometry.push({location:4,name:"a_aux1",count:4,type:c.UNSIGNED_SHORT}),e.geometry.push({location:5,name:"a_aux2",count:4,type:c.UNSIGNED_BYTE},{location:6,name:"a_aux3",count:4,type:c.UNSIGNED_BYTE}),t.simple||e.geometry.push({location:7,name:"a_zoomRange",count:2,type:c.UNSIGNED_SHORT}),d(t.data,e))};class N extends l{constructor(){super(...arguments),this._dotTextureSize=0,this._dotTextures=null,this._dotSamplers=new Int32Array([i,s]),this._dotVAO=null,this._dotDesc={vsPath:"dot/dot",fsPath:"dot/dot",attributes:new Map([["a_pos",0]])}}dispose(){this._disposeTextures(),this._dotFBO=t(this._dotFBO),this._dotVAO=t(this._dotVAO)}getGeometryType(){return n.FILL}drawGeometry(t,o,r,i){const{context:s,painter:a,rendererInfo:n,requiredLevel:d,passOptions:l}=t,_=m.load(r.materialKey),f=a.materialManager;let h=u.TRIANGLES,T=b(_);e(l)&&"hittest"===l.type&&(T=this._getTriangleDesc(r.materialKey,T),h=u.POINTS);const{attributes:p,bufferLayouts:y}=T,x=f.getMaterialProgram(t,_,"materials/fill",p,i);if(s.useProgram(x),this._setSharedUniforms(x,t,o),x.setUniform2f("u_tileOffset",512*o.key.col,512*o.key.row),_.textureBinding){a.textureManager.bindTextures(s,x,_);const e=1/2**(d-o.key.level)/t.pixelRatio;x.setUniform1f("u_zoomFactor",e)}const D=1/t.pixelRatio;x.setUniform1f("u_blur",D),x.setUniform1f("u_antialiasing",D),this._setSizeVVUniforms(_,x,n,o),this._setColorAndOpacityVVUniforms(_,x,n);const g=e(l)&&"hittest"===l.type,E=r.target.getVAO(s,y,p,g);let S=r.indexCount,w=r.indexFrom*Uint32Array.BYTES_PER_ELEMENT;if(g&&(S/=3,w/=3),s.bindVAO(E),!_.dotDensity||g)s.drawElements(h,S,c.UNSIGNED_INT,w);else{const e=this._drawDotLocations(t,o,x,S,w);this._drawDotDensity(t,o,e)}}_drawDotDensity(t,e,o){const{context:r,painter:i,rendererInfo:s}=t,a=i.materialManager.getProgram(t,this._dotDesc),n=this._createDotDensityMesh(r,this._dotDesc.attributes,{geometry:[{name:"a_pos",count:2,type:c.SHORT,divisor:0,normalized:!1,offset:0,stride:4}]});r.setStencilTestEnabled(!0),r.useProgram(a),a.setUniform1f("u_tileZoomFactor",1),a.setUniform1i("u_texture",this._dotSamplers[0]),a.setUniform1f("u_dotSize",Math.max(s.ddDotSize,1)),a.setUniform1f("u_pixelRatio",window.devicePixelRatio),this._setSharedUniforms(a,t,e),r.bindTexture(o,this._dotSamplers[0]),r.bindVAO(n),r.drawArrays(u.POINTS,0,262144)}_drawDotLocations(t,e,o,r,i){const{context:s,rendererInfo:n,requiredLevel:d}=t,l=s.getViewport();s.setViewport(0,0,512,512);const m=s.getBoundFramebufferObject(),_=this._createFBO(s);s.bindFramebuffer(_),s.setClearColor(0,0,0,0),s.clear(s.gl.COLOR_BUFFER_BIT|s.gl.STENCIL_BUFFER_BIT),s.setStencilTestEnabled(!1);const f=1/2**(d-e.key.level),h=a,T=h*window.devicePixelRatio*h*window.devicePixelRatio,p=1/f*(1/f),y=n.ddDotScale?t.state.scale/n.ddDotScale:1;return o.setUniform1f("u_tileZoomFactor",f),o.setUniform1f("u_tileDotsOverArea",T/(a*window.devicePixelRatio*a*window.devicePixelRatio)),o.setUniformMatrix4fv("u_dotColors",n.ddColors),o.setUniform4fv("u_isActive",n.ddActiveDots),o.setUniform4fv("u_dotBackgroundColor",n.ddBackgroundColor),o.setUniform1f("u_dotValue",Math.max(1,n.ddDotValue*y*p)),this._bindDotDensityTextures(s,o,n,h),s.drawElements(u.TRIANGLES,r,c.UNSIGNED_INT,i),s.setViewport(l.x,l.y,l.width,l.height),s.bindFramebuffer(m),_.colorTexture}_createFBO(t){if(o(this._dotFBO)){const e=512,o=512,r={target:f.TEXTURE_2D,pixelFormat:h.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:p.NEAREST,wrapMode:y.CLAMP_TO_EDGE,width:e,height:o},i={colorTarget:x.TEXTURE,depthStencilTarget:D.DEPTH_STENCIL_RENDER_BUFFER},s=new w(t,{width:e,height:o,internalFormat:g.DEPTH_STENCIL});this._dotFBO=new S(t,i,r,s)}return this._dotFBO}_disposeTextures(){if(this._dotTextures){for(let t=0;t<this._dotTextures.length;t++)this._dotTextures[t].dispose();this._dotTextures=null}}_bindDotDensityTextures(t,e,o,r){const i=this._createDotDensityTextures(t,r,o.ddSeed);e.setUniform1iv("u_dotTextures",this._dotSamplers);for(let s=0;s<i.length;s++)t.bindTexture(i[s],this._dotSamplers[s])}_createDotDensityMesh(t,e,r){if(o(this._dotVAO)){const o=2,i=new Int16Array(262144*o);for(let t=0;t<512;t++)for(let e=0;e<512;e++)i[o*(e+512*t)]=e,i[o*(e+512*t)+1]=t;const s=_.createVertex(t,E.STATIC_DRAW,i);this._dotVAO=new O(t,e,r,{geometry:s},null)}return this._dotVAO}_createDotDensityTextures(t,e,o){if(this._dotTextureSize===e&&this._seed===o||(this._disposeTextures(),this._dotTextureSize=e,this._seed=o),null===this._dotTextures){const i=new r(o);this._dotTextures=[this._allocDotDensityTexture(t,e,i),this._allocDotDensityTexture(t,e,i)]}return this._dotTextures}_allocDotDensityTexture(t,e,o){const r=new Float32Array(e*e*4);for(let i=0;i<r.length;i++)r[i]=o.getFloat();return new U(t,{wrapMode:y.REPEAT,pixelFormat:h.RGBA,dataType:T.FLOAT,samplingMode:p.NEAREST,width:e,height:e},r)}}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.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as o}from"../Utils.js";import a from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as i,PrimitiveType as r}from"../../../../webgl/enums.js";const s=t=>o(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:i.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:i.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:i.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:i.BYTE},{location:7,name:"a_aux",count:2,type:i.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends a{dispose(){}getGeometryType(){return e.LINE}drawGeometry(e,o,a,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:y}=e,_=n.load(a.materialKey);let d=s(_),f=r.TRIANGLES;t(y)&&"hittest"===y.type&&(d=this._getTriangleDesc(d),f=r.POINTS);const{attributes:E,bufferLayouts:N}=d,g=c.materialManager.getMaterialProgram(e,_,"materials/line",E,m),S=1/e.pixelRatio,T=0;l.useProgram(g),this._setSharedUniforms(g,e,o),_.textureBinding&&c.textureManager.bindTextures(l,g,_);const U=2**(p-o.key.level)/e.pixelRatio;g.setUniform1f("u_zoomFactor",U),g.setUniform1f("u_blur",T+S),g.setUniform1f("u_antialiasing",S),this._setSizeVVUniforms(_,g,u,o),this._setColorAndOpacityVVUniforms(_,g,u),l.setFaceCullingEnabled(!1);const G=t(y)&&"hittest"===y.type,I=a.target.getVAO(l,N,E,G);let x=a.indexCount,D=a.indexFrom*Uint32Array.BYTES_PER_ELEMENT;G&&(x/=3,D/=3),l.bindVAO(I),l.drawElements(f,x,i.UNSIGNED_INT,D)}}export{m as default};
5
+ import{isSome as t}from"../../../../../core/maybe.js";import{WGLGeometryType as e}from"../enums.js";import{createProgramDescriptor as a}from"../Utils.js";import o from"./WGLGeometryBrush.js";import{LineMaterialKey as n}from"../materialKey/MaterialKey.js";import{DataType as i,PrimitiveType as r}from"../../../../webgl/enums.js";const s=t=>a(t.data,{geometry:[{location:0,name:"a_pos",count:2,type:i.SHORT},{location:1,name:"a_id",count:4,type:i.UNSIGNED_BYTE},{location:2,name:"a_color",count:4,type:i.UNSIGNED_BYTE,normalized:!0},{location:3,name:"a_offsetAndNormal",count:4,type:i.BYTE},{location:4,name:"a_accumulatedDistanceAndHalfWidth",count:2,type:i.UNSIGNED_SHORT},{location:5,name:"a_tlbr",count:4,type:i.UNSIGNED_SHORT},{location:6,name:"a_segmentDirection",count:4,type:i.BYTE},{location:7,name:"a_aux",count:2,type:i.UNSIGNED_SHORT},{location:8,name:"a_zoomRange",count:2,type:i.UNSIGNED_SHORT}]});class m extends o{dispose(){}getGeometryType(){return e.LINE}drawGeometry(e,a,o,m){const{context:l,painter:c,rendererInfo:u,displayLevel:p,passOptions:y}=e,_=n.load(o.materialKey);let d=s(_),f=r.TRIANGLES;t(y)&&"hittest"===y.type&&(d=this._getTriangleDesc(o.materialKey,d),f=r.POINTS);const{attributes:E,bufferLayouts:N}=d,g=c.materialManager.getMaterialProgram(e,_,"materials/line",E,m),S=1/e.pixelRatio,T=0;l.useProgram(g),this._setSharedUniforms(g,e,a),_.textureBinding&&c.textureManager.bindTextures(l,g,_);const U=2**(p-a.key.level)/e.pixelRatio;g.setUniform1f("u_zoomFactor",U),g.setUniform1f("u_blur",T+S),g.setUniform1f("u_antialiasing",S),this._setSizeVVUniforms(_,g,u,a),this._setColorAndOpacityVVUniforms(_,g,u),l.setFaceCullingEnabled(!1);const G=t(y)&&"hittest"===y.type,I=o.target.getVAO(l,N,E,G);let x=o.indexCount,D=o.indexFrom*Uint32Array.BYTES_PER_ELEMENT;G&&(x/=3,D/=3),l.bindVAO(I),l.drawElements(f,x,i.UNSIGNED_INT,D)}}export{m 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.23/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t,isNone as e}from"../../../../../core/maybe.js";import{HITTEST_SEARCH_SIZE as i,ATTRIBUTE_DATA_GPGPU as s}from"../definitions.js";import{Effect as o}from"./Effect.js";import{PixelFormat as n,PixelType as r}from"../../../../webgl/enums.js";class c extends o{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){t(this._fbo)&&this._fbo.dispose()}createOptions({pixelRatio:t},e,s=i){if(!e.length)return null;const o=e.shift(),n=o.point.x,r=o.point.y;return this._outstanding=o,{type:"hittest",distance:s*t,position:[n,r]}}bind(t){const{context:i,attributeView:o}=t;if(!o.size)return;const n=o.getBlock(s);if(e(n))return;const r=n.getFBO(i);i.setViewport(0,0,o.size,o.size),i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.clear(i.gl.COLOR_BUFFER_BIT|i.gl.DEPTH_BUFFER_BIT)}unbind(t){}draw(t){const{context:i,attributeView:o}=t,c=o.getBlock(s);if(e(c)||e(this._outstanding))return;const h=c.getFBO(i),l=this._outstanding.resolver,a=new Uint8Array(h.width*h.height*4);h.readPixels(0,0,h.width,h.height,n.RGBA,r.UNSIGNED_BYTE,a);const u=[];for(let e=0;e<a.length;e+=4)a[e]&&u.push(e/4);this._outstanding=null,l.resolve(u)}}export{c as HittestEffect};
5
+ import{isSome as t,isNone as e}from"../../../../../core/maybe.js";import{HITTEST_SEARCH_SIZE as i,ATTRIBUTE_DATA_GPGPU as s}from"../definitions.js";import{Effect as o}from"./Effect.js";import{PixelFormat as n,PixelType as r}from"../../../../webgl/enums.js";class l extends o{constructor(){super(...arguments),this.name=this.constructor.name,this.defines=["hittest"]}dispose(){t(this._fbo)&&this._fbo.dispose()}createOptions({pixelRatio:t},e,s=i){if(!e.length)return null;const o=e.shift(),n=o.point.x,r=o.point.y;return this._outstanding=o,{type:"hittest",distance:s*t,position:[n,r]}}bind(t){const{context:i,attributeView:o}=t;if(!o.size)return;const n=o.getBlock(s);if(e(n))return;const r=n.getFBO(i);i.setViewport(0,0,o.size,o.size),i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.clear(i.gl.COLOR_BUFFER_BIT|i.gl.DEPTH_BUFFER_BIT)}unbind(t){}draw(t){const{context:i,attributeView:o}=t,l=o.getBlock(s);if(e(this._outstanding))return;const u=this._outstanding.resolver;if(e(l))return u.resolve([]),void(this._outstanding=null);const c=l.getFBO(i),h=new Uint8Array(c.width*c.height*4);c.readPixels(0,0,c.width,c.height,n.RGBA,r.UNSIGNED_BYTE,h);const a=[];for(let e=0;e<h.length;e+=4)h[e]&&a.push(e/4);this._outstanding=null,u.resolve(a)}}export{l as HittestEffect};