@arcgis/core 5.2.1 → 5.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basemap.d.ts +2 -2
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
- package/assets/esri/core/workers/chunks/0fa29352f2ecf0c515e8.js +1 -0
- package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
- package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
- package/assets/esri/core/workers/chunks/{10878932826ddb60fac4.js → 1fcc998421c7c16de2ca.js} +1 -1
- package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
- package/assets/esri/core/workers/chunks/251f706d226b1d47ba99.js +1 -0
- package/assets/esri/core/workers/chunks/{ba38231193919e093917.js → 2529f12fc16e98c014ca.js} +1 -1
- package/assets/esri/core/workers/chunks/2b4dd42920d37b1ff0a9.js +2 -0
- package/assets/esri/core/workers/chunks/2b804b5d7ce10f0f0cf0.js +1 -0
- package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
- package/assets/esri/core/workers/chunks/36f31416132de434ec00.js +1 -0
- package/assets/esri/core/workers/chunks/3e29ab5ec136e669b633.js +1 -0
- package/assets/esri/core/workers/chunks/{36c780a9527c75b36725.js → 40d7e54529d13fdd2bf1.js} +1 -1
- package/assets/esri/core/workers/chunks/{2cb209bc51a19487692d.js → 43aef67452fa6ff8d8f9.js} +2 -2
- package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
- package/assets/esri/core/workers/chunks/{5d42f0898bf30ae940ea.js → 46071e59290bf06bb614.js} +1 -1
- package/assets/esri/core/workers/chunks/46d91cd99558304da0c7.js +1 -0
- package/assets/esri/core/workers/chunks/4cf72dcccf2be353a701.js +1 -0
- package/assets/esri/core/workers/chunks/{e3a742dc0c291b47ba56.js → 510c2eb78f5e12f77bbc.js} +1 -1
- package/assets/esri/core/workers/chunks/{7d2be06dfbd92c8b9484.js → 596891426621c403bdef.js} +1 -1
- package/assets/esri/core/workers/chunks/{98d1efb6f2439c6344cf.js → 5b2d1c8763a1716677c0.js} +1 -1
- package/assets/esri/core/workers/chunks/5bf7de2e2faa55e53629.js +1 -0
- package/assets/esri/core/workers/chunks/{042614bf65b7d63025cb.js → 5f49233d5b67a9ad71d7.js} +1 -1
- package/assets/esri/core/workers/chunks/604433b02a165d187953.js +1 -0
- package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
- package/assets/esri/core/workers/chunks/{094eb9677cdebfaa9e1b.js → 648d5cdfc3e92be3db55.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc6fdd9faf8ed54be0cb.js → 6694e2b27fd6ddf44e21.js} +1 -1
- package/assets/esri/core/workers/chunks/70268d790c2f1cb83d43.js +1 -0
- package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
- package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
- package/assets/esri/core/workers/chunks/{d56fdf5ce5ff53dc0e69.js → 84495695313b01832369.js} +1 -1
- package/assets/esri/core/workers/chunks/{31640b41e0ecdff892fa.js → 85b63811ae7bcb6f74b6.js} +2 -2
- package/assets/esri/core/workers/chunks/{c4bbe4707e90b7cd0379.js → 8ac4a043a4f185db271f.js} +1 -1
- package/assets/esri/core/workers/chunks/8d01dd92f5c897193ab5.js +1 -0
- package/assets/esri/core/workers/chunks/900c8569596609183f19.js +2 -0
- package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
- package/assets/esri/core/workers/chunks/95c9c5677bbe7fd0420a.js +1 -0
- package/assets/esri/core/workers/chunks/{b70885deebc6106597ad.js → 983b85727e09c54bede0.js} +1 -1
- package/assets/esri/core/workers/chunks/{d20dcd4ce4b0111d924f.js → 9bbc8e5d42921a8050bb.js} +1 -1
- package/assets/esri/core/workers/chunks/a07070de96e143a329a4.js +1 -0
- package/assets/esri/core/workers/chunks/a17fb26d6ac4895e51a3.js +2 -0
- package/assets/esri/core/workers/chunks/{0d52e1b6d38f2670658c.js → a6f74bd1a9c87b9836ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{a85cdafbaf1848bb924b.js → a846c94d49df8d4cd5be.js} +1 -1
- package/assets/esri/core/workers/chunks/aa4f12fcb9f4ed3dba18.js +1 -0
- package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
- package/assets/esri/core/workers/chunks/{509a74e9334f31b931d4.js → b54ba2bd6b1b90dcc0cc.js} +1 -1
- package/assets/esri/core/workers/chunks/bde8f3b3ce5b1d3ee774.js +1 -0
- package/assets/esri/core/workers/chunks/c25ae83fd790f181bb42.js +1 -0
- package/assets/esri/core/workers/chunks/{dc51dcaa4e2f9a90f5bd.js → c2cbe0f5e8958cf18e58.js} +2 -2
- package/assets/esri/core/workers/chunks/c4c55d8a98ba3f51f63c.js +1 -0
- package/assets/esri/core/workers/chunks/c5bf19da62a3d31009fe.js +2 -0
- package/assets/esri/core/workers/chunks/{2226c20c38e20713bcb5.js.LICENSE.txt → c5bf19da62a3d31009fe.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{2a2a4650dd9b953d317c.js → c93343a91161c4e40c28.js} +1 -1
- package/assets/esri/core/workers/chunks/cb4c5544382eb8c4a87f.js +1 -0
- package/assets/esri/core/workers/chunks/{2d83ba260dd6bbe38206.js → d05665ddc8d31403aed3.js} +1 -1
- package/assets/esri/core/workers/chunks/d24dea0bdb17db07e2b3.js +1 -0
- package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
- package/assets/esri/core/workers/chunks/d4bc6d65dff5d0cc93ba.js +1 -0
- package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
- package/assets/esri/core/workers/chunks/{aea44253c80493ef5755.js → e7b168ba31142c00f765.js} +1 -1
- package/assets/esri/core/workers/chunks/{a504a5e06cb89a620799.js → ec8b7476eac4718eb0ac.js} +1 -1
- package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
- package/assets/esri/core/workers/chunks/{d53cc574a21031436c45.js → f79494829a5b65b5b4c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{bf4d913e523eae2fda28.js → fa7b189e9b2cc8d4a77f.js} +1 -1
- package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
- package/assets/esri/core/workers/chunks/{735c1dffc3439bdba3cc.js → fd172c96d2b36032a1d9.js} +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
- package/config.d.ts +3 -3
- package/config.js +1 -1
- package/core/workers.d.ts +1 -0
- package/identity/Credential.d.ts +1 -1
- package/identity/IdentityManager.d.ts +1 -1
- package/identity/OAuthInfo.d.ts +1 -1
- package/identity/ServerInfo.d.ts +1 -1
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/VectorTileLayer.d.ts +2 -2
- package/layers/graphics/sources/CSVSource.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/graphics/sources/MemorySource.js +2 -2
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
- package/layers/mixins/APIKeyMixin.d.ts +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/types.d.ts +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/TimeInformation.js +1 -1
- package/layers/support/timeInfoUtils.js +2 -0
- package/package.json +4 -4
- package/rest/query/executeAttributeBinsQuery.js +1 -1
- package/rest/query/executeForExtent.js +1 -1
- package/rest/query/executeForTopCount.js +1 -1
- package/rest/query/executeForTopExtents.js +1 -1
- package/rest/query/executeForTopIds.js +1 -1
- package/rest/query/executeTopFeaturesQuery.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/timeUtils.js +1 -1
- package/support/timeUtils.js +1 -1
- package/symbols/TextSymbol.d.ts +0 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +10 -8
- package/views/3d/environment/VirtualLighting.d.ts +10 -8
- package/views/draw/DrawTool.js +1 -1
- package/widgets/Directions.d.ts +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +2 -2
- package/widgets/ScaleRangeSlider/types.d.ts +3 -3
- package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
- package/assets/esri/core/workers/chunks/2226c20c38e20713bcb5.js +0 -2
- package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
- package/assets/esri/core/workers/chunks/2b6684d057d9ad17ac13.js +0 -1
- package/assets/esri/core/workers/chunks/2e66c969bf4209c957b5.js +0 -2
- package/assets/esri/core/workers/chunks/377595b23379b0c8fe95.js +0 -1
- package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
- package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
- package/assets/esri/core/workers/chunks/3c881b1adc8a5dea9a90.js +0 -1
- package/assets/esri/core/workers/chunks/4e6656a5f29e31902fca.js +0 -2
- package/assets/esri/core/workers/chunks/50e8943d2c0b96fab2c1.js +0 -1
- package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
- package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
- package/assets/esri/core/workers/chunks/60c79934799927114074.js +0 -1
- package/assets/esri/core/workers/chunks/63b5418a1c3fe0a97a86.js +0 -1
- package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
- package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +0 -1
- package/assets/esri/core/workers/chunks/7dfbc31f3b56728485a4.js +0 -1
- package/assets/esri/core/workers/chunks/822f83d7c09ef0a9bbdf.js +0 -1
- package/assets/esri/core/workers/chunks/844eedda8f749972f707.js +0 -2
- package/assets/esri/core/workers/chunks/8b8118ab56cc808b5a71.js +0 -1
- package/assets/esri/core/workers/chunks/8d86b0cb0e004ad72040.js +0 -1
- package/assets/esri/core/workers/chunks/98760040f0c9d47c718d.js +0 -1
- package/assets/esri/core/workers/chunks/a2f0894218e665780a21.js +0 -1
- package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
- package/assets/esri/core/workers/chunks/ab6506a3c16f8717fc00.js +0 -1
- package/assets/esri/core/workers/chunks/c45edd0a7d57263bb7d6.js +0 -1
- package/assets/esri/core/workers/chunks/c52466eb1f3c33ae1f5a.js +0 -1
- package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
- package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
- package/assets/esri/core/workers/chunks/c80a3b039e510c118399.js +0 -1
- package/assets/esri/core/workers/chunks/c88a70f68c8ce8c30e9b.js +0 -1
- package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
- package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
- package/assets/esri/core/workers/chunks/e9cdb0b0f074583edebd.js +0 -1
- package/assets/esri/core/workers/chunks/f5cc78291b53931b91e8.js +0 -1
- /package/assets/esri/core/workers/chunks/{844eedda8f749972f707.js.LICENSE.txt → 2b4dd42920d37b1ff0a9.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2cb209bc51a19487692d.js.LICENSE.txt → 43aef67452fa6ff8d8f9.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{31640b41e0ecdff892fa.js.LICENSE.txt → 85b63811ae7bcb6f74b6.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4e6656a5f29e31902fca.js.LICENSE.txt → 900c8569596609183f19.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2e66c969bf4209c957b5.js.LICENSE.txt → a17fb26d6ac4895e51a3.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{dc51dcaa4e2f9a90f5bd.js.LICENSE.txt → c2cbe0f5e8958cf18e58.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{estimateNumberMemory as e}from"../../../../core/memoryEstimations.js";import{List as t}from"./cpuMapped/FreeList.js";import{isHittest as n}from"./shaderGraph/techniques/featureTechniqueUtils.js";import{PrimitiveType as r,DataType as i}from"../../../webgl/enums.js";function a(e,t){return e<<16|t&
|
|
2
|
+
import"../../../../core/has.js";import{estimateNumberMemory as e}from"../../../../core/memoryEstimations.js";import{List as t}from"./cpuMapped/FreeList.js";import{isHittest as n}from"./shaderGraph/techniques/featureTechniqueUtils.js";import{PrimitiveType as r,DataType as i}from"../../../webgl/enums.js";function a(e,t){return e<<16|t&65535}function o(e){return e&65535}function s(e,t){return t?t.get(e.instanceId)??e.techniqueRef.symbologyPlane:e.techniqueRef.symbologyPlane}class c{constructor(e,t,n,r,i){this.instance=e,this.materialKey=t,this.target=n,this.start=r,this.count=i}get textureKey(){return o(this.materialKey)}get indexEnd(){return this.start+this.count}extend(e){this.count+=e}render(e){let t=this.instance.techniqueRef;this.target.bind(e.context),t.render(e,this)}getStencilReference(){return this.instance.stencilReferenceOverride??this.target.stencilRef}getAttributePrecisionPackFactors(){let e=this.instance.instanceId;return this.target.getMesh(e).getAttributePrecisionPackFactors()}draw(e,t){if(n(e)){this.drawCompute(e.context,t);return}this.drawGeometry(e.context,t)}drawCompute(e,t){let n=this.instance.instanceId,a=this.target.getMesh(n).getComputeVAO(e,t),o=this.start*Uint32Array.BYTES_PER_ELEMENT/3;e.bindVAO(a,t.locations),e.drawElements(r.POINTS,this.count/3,i.UNSIGNED_INT,o),e.bindVAO(null)}drawGeometry(e,t){let n=this.instance.instanceId,a=this.target.getMesh(n).getGeometryVAO(e,t),o=this.start*Uint32Array.BYTES_PER_ELEMENT;e.bindVAO(a,t.locations),e.drawElements(r.TRIANGLES,this.count,i.UNSIGNED_INT,o),e.bindVAO(null)}}class l{constructor(){this._length=0,this._minOrderedLength=0,this._materialKeys=new Set}static fromDisplayEntities(e,t,n,r){let i=new l,o=n.getInstanceOrder();for(let s of e.values())for(let e of s.records){let s=n.getInstance(e.instanceId),c=a(s.instanceId,e.textureKey);i.addRecord(s,c,e.indexStart,e.indexCount,e.vertexStart,e.vertexCount,t,r,o)}return i}get length(){return this._length}get minOrderedLength(){return this._minOrderedLength}get minUnorderedLength(){return this._materialKeys.size}get usedMemory(){return this._length?this._length*5*e:0}render(e,t){let{drawPhase:n}=e,r=!1;for(let i of this.infos()){let a=i.instance.techniqueRef;i.instance.drawPhase&n&&(t==null||a.type===t)&&(i.render(e),r=!0)}return r}addRecord(e,n,r,i,a,o,l,u,d){let f=r,p=i;if(p||=(f=a,o),!p)return;if(this._head==null){let r=new c(e,n,l,f,p);this._head=new t(r),this._tail=this._head,this._length++,this._minOrderedLength++;return}if(u===1)return this._insert(e,n,l,f,p,this._tail,null);let m=null,h=this._head,g=e.instanceId,_=s(e,d);if(u===2&&(_===2||_===3))return this._insert(e,n,l,f,p,this._tail,null);for(;h;){let t=h.data.instance,r=t.instanceId,i=s(t,d),a=m?.data.instance.instanceId;if(_<i||g===a&&g!==r)return this._insert(e,n,l,f,p,m,h);m=h,h=h.next}this._insert(e,n,l,f,p,m,null)}*infos(){if(this._head!=null)for(let e of this._head.values())yield e}_insert(e,n,r,i,a,o,s){if(o==null&&s==null){let o=new c(e,n,r,i,a);this._head=new t(o),this._tail=this._head,this._length++,this._minOrderedLength++;return}if(n!==this._tail.data.materialKey&&this._minOrderedLength++,this._materialKeys.add(n),o==null&&s!=null)return this._insertAtHead(e,n,r,i,a,s);if(o!=null&&s==null)return this._insertAtEnd(e,n,r,i,a,o);if(o!=null&&s!=null)return this._insertAtMiddle(e,n,r,i,a,o,s)}_insertAtHead(e,n,r,i,a,o){let s=i+a;if(n===o.data.materialKey&&r===o.data.target&&s===o.data.start)o.data.start=i,o.data.count+=a;else{let s=new c(e,n,r,i,a);this._head=new t(s),this._head.next=o,this._length++}}_insertAtEnd(e,n,r,i,a,o){if(o.data.materialKey===n&&o.data.indexEnd===i)o.data.count+=a;else{let s=new c(e,n,r,i,a);this._tail=new t(s),o.next=this._tail,this._length++}}_insertAtMiddle(e,n,r,i,a,o,s){let l=i+a;if(o.data.materialKey===n&&o.data.target===r&&o.data.indexEnd===i)o.data.count+=a,o.data.materialKey===s.data.materialKey&&o.data.target===s.data.target&&o.data.indexEnd===s.data.start&&(o.data.count+=s.data.count,o.next=s.next,this._length--);else if(n===s.data.materialKey&&r===s.data.target&&l===s.data.start)s.data.start=i,s.data.count+=a;else{let l=new c(e,n,r,i,a),u=new t(l);o.next=u,u.next=s,this._length++}}}export{l as DisplayList,c as DisplayListInfo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as i}from"../../../core/handleUtils.js";import"../../../core/has.js";import{QueueProcessor as a}from"../../../core/QueueProcessor.js";import{watch as o,sync as s}from"../../../core/reactiveUtils.js";import{isScreenRect as c}from"../../../core/screenUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as d}from"../../../layers/raster/functions/clipUtils.js";import f from"../../../layers/support/FeatureFilter.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import m from"../engine/flow/FlowView2D.js";import{LayerView2D as h}from"./LayerView2D.js";import g from"./graphics/GraphicsView2D.js";import _ from"./graphics/HighlightGraphicContainer.js";import v from"./imagery/ImageryView2D.js";import y from"./imagery/VectorFieldView2D.js";import b from"../../layers/ImageryLayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";import{isPixelHighlightTarget as S,isEmptyPixelRanges as C}from"../../layers/support/highlightUtils.js";import{defaultColor as w}from"../../support/HighlightDefaults.js";import{getHighlightName as T}from"../../support/highlightOptionsUtils.js";let E=class extends x(h(b)){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new p,this._highlightView=void 0,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){let{subview:e}=this;return this.updating||!e?null:`getPixelData`in e?e.getPixelData():null}update(e){this.subview?.update(e)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new g({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new _(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([o(()=>this.layer.exportImageServiceParameters.version,e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())},s),o(()=>this.timeExtent,e=>{let{subview:t}=this;t&&(t.timeExtent=e,`redraw`in t?this.requestUpdate():t.redrawOrRefetch())},s),this.layer.on(`redraw`,()=>{let{subview:e}=this;e&&(`redraw`in e?e.redraw():e.redrawOrRefetch())}),o(()=>this.layer.renderer,()=>this._setSubView()),o(()=>this.view?.highlights.items.map(({name:e,color:t})=>({name:e,color:t})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}async hitTest(e,t){let{layer:n,subview:r}=this;if(!n.loaded||!this.attached||!r?.attached)return null;c(t)&&(e=this.view.toMap({x:t.x+t.width/2,y:t.y+t.height/2}));let i=await r.hitTest(e);return i==null?null:[{type:`raster`,layer:n,mapPoint:e,...i}]}highlight(e,a){if(S(e))return C(e)?i():this._highlightPixels(e,a);if(typeof e==`number`||typeof e==`string`)return this._highlightByImageIds([e],a);let o=Array.isArray(e)||r.isCollection(e)?e.at(0):e;if(typeof o==`number`||typeof o==`string`)return this._highlightByImageIds(e,a);if(!(o instanceof t))return i();let s=[];if(Array.isArray(e)||r.isCollection(e)?s=e.map(e=>e.clone()):e instanceof t&&(s=[e.clone()]),!s?.filter(n)?.length)return i();let c=T(a),l=this._addHighlightGraphics(s,c);return i(()=>!this.destroyed&&this._removeHighlightGraphics(s,l))}_highlightByImageIds(e,t){let n=T(t),r=new AbortController,{signal:o}=r,s=this.layer.sourceJSON.maxRecordCount??1e3,c=Math.ceil(e.length/s),l=[],u=[],d=new a({concurrency:4,process:e=>this.layer.queryFeatures({objectIds:e.ids,returnGeometry:!0,outSpatialReference:this.view.spatialReference},{signal:o}).then(e=>u.push(...e.features)).catch(()=>{})});for(let t=0;t<c;t++)l.push(d.push({ids:e.slice(t*s,(t+1)*s)}));return Promise.allSettled(l).then(()=>{if(u.length&&!o.aborted){let e=this._addHighlightGraphics(u,n);o.addEventListener(`abort`,()=>{this._removeHighlightGraphics(u,e)})}}),i(()=>r.abort())}_highlightPixels(e,t){let n={target:e,options:t};return this._pixelHighlights.push(n),this._updateHighlightOptions(this.subview),i(()=>{let e=this._pixelHighlights.indexOf(n);e>-1&&(this._pixelHighlights.splice(e,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(e,t){return this._highlightGraphics.addMany(e),this._addHighlightFilter(new f({objectIds:e.map(e=>e.uid)}),t)}_removeHighlightGraphics(e,t){this._highlightGraphics.removeMany(e),this._removeHighlight(t)}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||this.subview.updating||!!this._highlightView?.updating}_onHighlightChange(){let e=this._getHighlightFilterGroups();this._highlightView?.setHighlightFilters(e)}_setSubView(){if(!this.view)return;let e=this.layer.renderer?.type,t=`imagery`;if(e===`vector-field`?t=`imageryVF`:e===`flow`&&(t=`flow`),this.subview){let{type:e}=this.subview;if(e===t){this._attachSubview(this.subview),e===`flow`?this.subview.redrawOrRefetch():e===`imagery`&&this.layer.format===`lerc`?this.subview.redraw():this.requestUpdate();return}this._detachSubview(this.subview),this.subview?.destroy()}t===`imagery`?(this.subview=new v({layer:this.layer,view:this.view,timeExtent:this.timeExtent,updatingHandles:this._updatingHandles}),this._updateHighlightOptions(this.subview)):this.subview=t===`imageryVF`?new y({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new m({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}_updateHighlightOptions(e){let t=this.view.highlights;this._pixelHighlights.sort((e,n)=>t.findIndex(({name:e})=>e===T(n.options))-t.findIndex(({name:t})=>t===T(e.options)));let r=this._pixelHighlights.map(({target:e,options:n})=>D(e,t,n)).filter(n);e?.type===`imagery`&&(e.pixelHighlights=r,e.attached&&(this.layer.format===`lerc`?e.redraw():this.requestUpdate()))}};e([l()],E.prototype,`pixelData`,null),e([l()],E.prototype,`subview`,void 0),E=e([u(`esri.views.2d.layers.ImageryLayerView2D`)],E);function D(e,t,n){let r=T(n),i=(t.find(e=>e.name===r)?.color??w).toArray(),{pixelRanges:a}=e;if(Array.isArray(a))return{ranges:a,bandId:e.bandId??0,color:i};let o=a.type===`extent`?a:a.extent;if(!o)return;let s=[o.xmin,o.xmax],c=[o.ymin,o.ymax],{xBandId:l,yBandId:u}=e,f=1024,p=1024;return{xBandId:l,yBandId:u,xBandRange:s,yBandRange:c,color:i,width:f,height:p,xyMask:a.type===`polygon`?d({srcExtent:o,geometry:a,size:[f,p]}):void 0}}const O=E;export{O as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as i}from"../../../core/handleUtils.js";import"../../../core/has.js";import{QueueProcessor as a}from"../../../core/QueueProcessor.js";import{watch as o,sync as s}from"../../../core/reactiveUtils.js";import{isScreenRect as c}from"../../../core/screenUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as d}from"../../../layers/raster/functions/clipUtils.js";import f from"../../../layers/support/FeatureFilter.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import m from"../engine/flow/FlowView2D.js";import{LayerView2D as h}from"./LayerView2D.js";import g from"./graphics/GraphicsView2D.js";import _ from"./graphics/HighlightGraphicContainer.js";import v from"./imagery/ImageryView2D.js";import y from"./imagery/VectorFieldView2D.js";import b from"../../layers/ImageryLayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";import{isPixelHighlightTarget as S,isEmptyPixelRanges as C}from"../../layers/support/highlightUtils.js";import{defaultColor as w}from"../../support/HighlightDefaults.js";import{getHighlightName as T}from"../../support/highlightOptionsUtils.js";let E=class extends x(h(b)){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new p,this._highlightView=void 0,this._maxPixelSizePromise=null,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){let{subview:e}=this;return this.updating||!e?null:`getPixelData`in e?e.getPixelData():null}update(e){this.subview?.update(e),this._highlightView?.processUpdate(e),this._updatingHandles.consumePromise(this._updateHighlightVisibility())}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new g({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new _(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([o(()=>this.layer.exportImageServiceParameters.version,e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())},s),o(()=>this.timeExtent,e=>{let{subview:t}=this;t&&(t.timeExtent=e,`redraw`in t?this.requestUpdate():t.redrawOrRefetch())},s),this.layer.on(`redraw`,()=>{let{subview:e}=this;e&&(`redraw`in e?e.redraw():e.redrawOrRefetch())}),o(()=>this.layer.renderer,()=>this._setSubView()),o(()=>this.view?.highlights.items.map(({name:e,color:t})=>({name:e,color:t})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}async hitTest(e,t){let{layer:n,subview:r}=this;if(!n.loaded||!this.attached||!r?.attached)return null;c(t)&&(e=this.view.toMap({x:t.x+t.width/2,y:t.y+t.height/2}));let i=await r.hitTest(e);return i==null?null:[{type:`raster`,layer:n,mapPoint:e,...i}]}highlight(e,a){if(S(e))return C(e)?i():this._highlightPixels(e,a);if(this.layer.sourceType===`mosaic-dataset`&&(this._maxPixelSizePromise??=this.layer.fetchMaxPixelSize(this.view.spatialReference).catch(()=>null)),typeof e==`number`||typeof e==`string`)return this._highlightByImageIds([e],a);let o=Array.isArray(e)||r.isCollection(e)?e.at(0):e;if(typeof o==`number`||typeof o==`string`)return this._highlightByImageIds(e,a);if(!(o instanceof t))return i();let s=[];if(Array.isArray(e)||r.isCollection(e)?s=e.map(e=>e.clone()):e instanceof t&&(s=[e.clone()]),!s?.filter(n)?.length)return i();let c=T(a),l=this._addHighlightGraphics(s,c);return i(()=>!this.destroyed&&this._removeHighlightGraphics(s,l))}_highlightByImageIds(e,t){let n=T(t),r=new AbortController,{signal:o}=r,s=this.layer.sourceJSON.maxRecordCount??1e3,c=Math.ceil(e.length/s),l=[],u=[],d=new a({concurrency:4,process:e=>this.layer.queryFeatures({objectIds:e.ids,returnGeometry:!0,outSpatialReference:this.view.spatialReference},{signal:o}).then(e=>u.push(...e.features)).catch(()=>{})});for(let t=0;t<c;t++)l.push(d.push({ids:e.slice(t*s,(t+1)*s)}));return Promise.allSettled(l).then(()=>{if(u.length&&!o.aborted){let e=this._addHighlightGraphics(u,n);o.addEventListener(`abort`,()=>{this._removeHighlightGraphics(u,e)})}}),i(()=>r.abort())}_highlightPixels(e,t){let n={target:e,options:t};return this._pixelHighlights.push(n),this._updateHighlightOptions(this.subview),i(()=>{let e=this._pixelHighlights.indexOf(n);e>-1&&(this._pixelHighlights.splice(e,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(e,t){return this._highlightGraphics.addMany(e),this._addHighlightFilter(new f({objectIds:e.map(e=>e.uid)}),t)}_removeHighlightGraphics(e,t){this._highlightGraphics.removeMany(e),this._removeHighlight(t)}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||this.subview.updating||!!this._highlightView?.updating}_onHighlightChange(){let e=this._getHighlightFilterGroups();this._highlightView?.setHighlightFilters(e)}_setSubView(){if(!this.view)return;let e=this.layer.renderer?.type,t=`imagery`;if(e===`vector-field`?t=`imageryVF`:e===`flow`&&(t=`flow`),this.subview){let{type:e}=this.subview;if(e===t){this._attachSubview(this.subview),e===`flow`?this.subview.redrawOrRefetch():e===`imagery`&&this.layer.format===`lerc`?this.subview.redraw():this.requestUpdate();return}this._detachSubview(this.subview),this.subview?.destroy()}t===`imagery`?(this.subview=new v({layer:this.layer,view:this.view,timeExtent:this.timeExtent,updatingHandles:this._updatingHandles}),this._updateHighlightOptions(this.subview)):this.subview=t===`imageryVF`?new y({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new m({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}async _updateHighlightVisibility(){let e=this._highlightView?.container;if(!e||this.suspended)return;if(this.layer.mosaicRule?.method===`lock-raster`){e.visible=!0;return}let t=await this._maxPixelSizePromise;t!=null&&(e.visible=(t.x+t.y)/2>this.view.resolution)}_updateHighlightOptions(e){let t=this.view.highlights;this._pixelHighlights.sort((e,n)=>t.findIndex(({name:e})=>e===T(n.options))-t.findIndex(({name:t})=>t===T(e.options)));let r=this._pixelHighlights.map(({target:e,options:n})=>D(e,t,n)).filter(n);e?.type===`imagery`&&(e.pixelHighlights=r,e.attached&&(this.layer.format===`lerc`?e.redraw():this.requestUpdate()))}};e([l()],E.prototype,`pixelData`,null),e([l()],E.prototype,`subview`,void 0),E=e([u(`esri.views.2d.layers.ImageryLayerView2D`)],E);function D(e,t,n){let r=T(n),i=(t.find(e=>e.name===r)?.color??w).toArray(),{pixelRanges:a}=e;if(Array.isArray(a))return{ranges:a,bandId:e.bandId??0,color:i};let o=a.type===`extent`?a:a.extent;if(!o)return;let s=[o.xmin,o.xmax],c=[o.ymin,o.ymax],{xBandId:l,yBandId:u}=e,f=1024,p=1024;return{xBandId:l,yBandId:u,xBandRange:s,yBandRange:c,color:i,width:f,height:p,xyMask:a.type===`polygon`?d({srcExtent:o,geometry:a,size:[f,p]}):void 0}}const O=E;export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as r}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as a}from"./LineOfSightRayIntersector.js";import{DrawTool as o}from"../../../draw/DrawTool.js";import{bindViewToolOptions as s}from"../../../interactive/options/bindViewToolOptions.js";import c from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function u(u){let{analysis:d,analysisViewData:f,snappingManager:p,view:m,getVisible:h,getSourceElevationInfo:g,onCancel:_,onComplete:v,onManipulatorCountChange:y,shouldPreventVertexAdd:b}=u,x=g(),S=new r({analysis:d,analysisViewData:f,view:m}),C=new a({view:m}),w=new c,T=new o({elevationInfo:x,enableVertexVisuals:!1,hasZ:!0,renderer:S,toolOptions:w,snappingManager:p,view:m});return S.elevationInfo=x,T.addHandles([e(S),e(C),s(w,()=>m.options),T.on(`cancel`,()=>_(T)),T.on(`complete`,()=>v(T)),t(()=>[h(),f.visible,g()],([e,t,n])=>{T.visible=e&&t,S.analysisVisible=T.visible,T.elevationInfo=n,S.elevationInfo=n,S.refresh()},n),t(()=>T.manipulators.length,()=>y(T),n),t(()=>T.mostDownstreamPlugin,()=>{T.defaultZ=0},n),T.on([`before-vertex-add`,`before-vertex-add-at-point`],e=>{let t=e.detail.originalEvent;if(t?.type!==`immediate-click`)return;let n=l(t);if(b(n,t.pointerType)){e.preventDefault();return}let r=C.getScreenPointIntersection(n);if(r?.mapPoint==null)e.preventDefault();else{let e=T.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=r)}})]),{drawTool:T,renderer:S}}export{u as createDrawTool};
|
|
2
|
+
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as r}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as a}from"./LineOfSightRayIntersector.js";import{DrawTool as o}from"../../../draw/DrawTool.js";import{bindViewToolOptions as s}from"../../../interactive/options/bindViewToolOptions.js";import c from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function u(u){let{analysis:d,analysisViewData:f,snappingManager:p,view:m,getVisible:h,getSourceElevationInfo:g,onCancel:_,onComplete:v,onManipulatorCountChange:y,shouldPreventVertexAdd:b}=u,x=g(),S=new r({analysis:d,analysisViewData:f,view:m}),C=new a({view:m}),w=new c,T=new o({disableTouchDrag:!0,elevationInfo:x,enableVertexVisuals:!1,hasZ:!0,renderer:S,toolOptions:w,snappingManager:p,view:m});return S.elevationInfo=x,T.addHandles([e(S),e(C),s(w,()=>m.options),T.on(`cancel`,()=>_(T)),T.on(`complete`,()=>v(T)),t(()=>[h(),f.visible,g()],([e,t,n])=>{T.visible=e&&t,S.analysisVisible=T.visible,T.elevationInfo=n,S.elevationInfo=n,S.refresh()},n),t(()=>T.manipulators.length,()=>y(T),n),t(()=>T.mostDownstreamPlugin,()=>{T.defaultZ=0},n),T.on([`before-vertex-add`,`before-vertex-add-at-point`],e=>{let t=e.detail.originalEvent;if(t?.type!==`immediate-click`)return;let n=l(t);if(b(n,t.pointerType)){e.preventDefault();return}let r=C.getScreenPointIntersection(n);if(r?.mapPoint==null)e.preventDefault();else{let e=T.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=r)}})]),{drawTool:T,renderer:S}}export{u as createDrawTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,onCancel:p,onComplete:m,onManipulatorCountChange:h,isPlacingObserver:g}=a,_=new o({view:u,isPlacingObserver:g}),v=new l({elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:_,toolOptions:d,snappingManager:c,view:u});return v.addHandles([e(_),v.on(`cancel`,()=>p(v)),v.on(`complete`,()=>m(v)),t(()=>v.mostDownstreamPlugin,()=>v.defaultZ=0,n),t(()=>v.manipulators.length,()=>h(v),r),t(()=>s.visible,e=>_.analysisVisible=e,i)]),{drawTool:v,renderer:_}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
|
|
2
|
+
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,onCancel:p,onComplete:m,onManipulatorCountChange:h,isPlacingObserver:g}=a,_=new o({view:u,isPlacingObserver:g}),v=new l({disableTouchDrag:!0,elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:_,toolOptions:d,snappingManager:c,view:u});return v.addHandles([e(_),v.on(`cancel`,()=>p(v)),v.on(`complete`,()=>m(v)),t(()=>v.mostDownstreamPlugin,()=>v.defaultZ=0,n),t(()=>v.manipulators.length,()=>h(v),r),t(()=>s.visible,e=>_.analysisVisible=e,i)]),{drawTool:v,renderer:_}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
|
|
@@ -66,24 +66,26 @@ export default class SunLighting extends SunLightingSuperclass {
|
|
|
66
66
|
/**
|
|
67
67
|
* Enables global illumination for more realistic lighting in the scene through ambient occlusion and emissive lighting.
|
|
68
68
|
* * **Ambient occlusion** darkens areas where surrounding geometry blocks ambient light, adding definition to corners, crevices, and spaces between buildings.
|
|
69
|
-
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate.
|
|
69
|
+
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate. See the [Visualizations with light-emitting symbols sample](/sample-code/light-emitting-symbols/) for more details on configuring emissive symbols.
|
|
70
70
|
*
|
|
71
71
|
* <figure>
|
|
72
72
|
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/views/3d/gi-onoff.avif"
|
|
73
73
|
* alt="Comparison of scene lighting with global illumination enabled and disabled" />
|
|
74
|
-
* <figcaption>Global illumination, enabled on the right,
|
|
74
|
+
* <figcaption>Global illumination, enabled on the right, provides more detailed ambient occlusion shading and emissive lighting.</figcaption>
|
|
75
75
|
* </figure>
|
|
76
76
|
*
|
|
77
|
-
* Global illumination
|
|
77
|
+
* Global illumination is a camera-dependent, screen-space approximation based on visible depth, surface normals, and recent frame data. It is not a physically exact lighting simulation or a scene-wide path tracer. Off-screen or hidden geometry cannot reliably provide indirect light.
|
|
78
|
+
* It is meant to be used mainly for visual context, not illumination measurements or lighting-compliance analysis.
|
|
79
|
+
*
|
|
80
|
+
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. After camera or scene changes, lighting settles over successive rendered frames. During navigation, reduced resolution trades detail for rendering cost.
|
|
78
81
|
*
|
|
79
|
-
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. Camera movements and animated objects may cause temporary noise or other visual artifacts.
|
|
80
82
|
*
|
|
81
83
|
* **Known limitations**
|
|
82
84
|
*
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* -
|
|
86
|
-
* -
|
|
85
|
+
* - Global illumination is not supported with [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/): neither ambient occlusion nor emissive lighting will be computed for this layer.
|
|
86
|
+
* - [SceneView.takeScreenshot()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#takeScreenshot) uses a dedicated accumulation path to compute global illumination. Captures with global illumination enabled can therefore take substantially longer to finish.
|
|
87
|
+
* - Small emitters, or emitters that appear small on screen due to distance may produce only weak illumination. Increasing size, [emissive strength](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/Symbol3DEmissive/#strength) and enabling [glow](https://developers.arcgis.com/javascript/latest/references/core/webscene/Glow/) can help improve visibility, but cannot guarantee a particular light footprint or replace missing screen-space samples from arbitrary distances and angles.
|
|
88
|
+
* - Global illumination is disabled at high camera altitudes.
|
|
87
89
|
*
|
|
88
90
|
* @default false
|
|
89
91
|
* @beta
|
|
@@ -44,24 +44,26 @@ export default class VirtualLighting extends VirtualLightingSuperclass {
|
|
|
44
44
|
/**
|
|
45
45
|
* Enables global illumination for more realistic lighting in the scene through ambient occlusion and emissive lighting.
|
|
46
46
|
* * **Ambient occlusion** darkens areas where surrounding geometry blocks ambient light, adding definition to corners, crevices, and spaces between buildings.
|
|
47
|
-
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate.
|
|
47
|
+
* * **Emissive lighting** illuminates surfaces near emissive materials. The illumination depends on the emitters’ strength and color, as well as their distance from the surfaces they illuminate. See the [Visualizations with light-emitting symbols sample](/sample-code/light-emitting-symbols/) for more details on configuring emissive symbols.
|
|
48
48
|
*
|
|
49
49
|
* <figure>
|
|
50
50
|
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/views/3d/gi-onoff.avif"
|
|
51
51
|
* alt="Comparison of scene lighting with global illumination enabled and disabled" />
|
|
52
|
-
* <figcaption>Global illumination, enabled on the right,
|
|
52
|
+
* <figcaption>Global illumination, enabled on the right, provides more detailed ambient occlusion shading and emissive lighting.</figcaption>
|
|
53
53
|
* </figure>
|
|
54
54
|
*
|
|
55
|
-
* Global illumination
|
|
55
|
+
* Global illumination is a camera-dependent, screen-space approximation based on visible depth, surface normals, and recent frame data. It is not a physically exact lighting simulation or a scene-wide path tracer. Off-screen or hidden geometry cannot reliably provide indirect light.
|
|
56
|
+
* It is meant to be used mainly for visual context, not illumination measurements or lighting-compliance analysis.
|
|
57
|
+
*
|
|
58
|
+
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. After camera or scene changes, lighting settles over successive rendered frames. During navigation, reduced resolution trades detail for rendering cost.
|
|
56
59
|
*
|
|
57
|
-
* Global illumination progressively accumulates lighting over multiple frames, reducing noise and improving visual quality. Camera movements and animated objects may cause temporary noise or other visual artifacts.
|
|
58
60
|
*
|
|
59
61
|
* **Known limitations**
|
|
60
62
|
*
|
|
61
|
-
* -
|
|
62
|
-
* -
|
|
63
|
-
* -
|
|
64
|
-
* -
|
|
63
|
+
* - Global illumination is not supported with [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/): neither ambient occlusion nor emissive lighting will be computed for this layer.
|
|
64
|
+
* - [SceneView.takeScreenshot()](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#takeScreenshot) uses a dedicated accumulation path to compute global illumination. Captures with global illumination enabled can therefore take substantially longer to finish.
|
|
65
|
+
* - Small emitters, or emitters that appear small on screen due to distance may produce only weak illumination. Increasing size, [emissive strength](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/Symbol3DEmissive/#strength) and enabling [glow](https://developers.arcgis.com/javascript/latest/references/core/webscene/Glow/) can help improve visibility, but cannot guarantee a particular light footprint or replace missing screen-space samples from arbitrary distances and angles.
|
|
66
|
+
* - Global illumination is disabled at high camera altitudes.
|
|
65
67
|
*
|
|
66
68
|
* @default false
|
|
67
69
|
* @beta
|
package/views/draw/DrawTool.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import{createTask as r}from"../../core/asyncUtils.js";import{makeHandle as i,disposable as a}from"../../core/handleUtils.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l}from"../../core/maybe.js";import{ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{when as d,initial as f,watch as p,syncAndInitial as ee,on as m,sync as h}from"../../core/reactiveUtils.js";import{screenPointEqual as g,createScreenPoint as _}from"../../core/screenUtils.js";import{diff as v}from"../../core/accessorSupport/diffUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as x}from"../../core/support/UpdatingHandles.js";import te from"../../geometry/Polygon.js";import{simplifyIsSimple as S,simplifyExecute as C}from"../../geometry/operators/simplifyOperator.js";import{isPolygon as w}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as T}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as E}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as D}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as O,getMinSegmentsPerCurve as k}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as A}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as j,markHandled as M,getPointerType as N,getPointerId as P}from"./support/drawToolUtils.js";import{PluginContext as F}from"./support/PluginContext.js";import{viewEventToCommand as I}from"./support/input/drawToolInput.js";import{EditSessionManager as L}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as R}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as z}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as B}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as V}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as H}from"./support/managers/SurfaceManager.js";import{TooltipManager as U}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as W}from"../input/InputManager.js";import{createCoordinateHelper as G}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as K}from"../interactive/InteractiveToolBase.js";import{KeyBindings as q,mediaKeys as J,sketchKeys as Y,advancedSketchKeys as X,tooltipKeys as Z}from"../interactive/keybindings.js";import{isInputModeAvailable as ne}from"../interactive/tooltip/tooltipCommonUtils.js";const Q=Symbol();let $=class extends K{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new x,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type=`draw-2.0`,this.automaticManipulatorSelection=!0,this.snappingManager=null,this.toolOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new B,this.globalStateManager=new R({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new L({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new V({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.readPluginSetting=null,this.enableVertexVisuals=!0}initialize(){let{view:e}=this;this.interactiveHandleManager=new z({view:e,renderer:this.renderer}),this._override(`manipulators`,this.interactiveHandleManager.manipulators),this.tooltipManager=new U({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(d(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:`outputGeometry`}),t.addOrUpdateVisual(this._vertexVisualId,{role:`vertex`}),this._updatingHandles.addPromise(A(e,t).then(e=>this._snappingVisualizer=e))},f)),this.addHandles([p(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,n,r,i])=>{this.surfaceManager?.destroy(),this.surfaceManager=new H({spatialReference:t,excludedGraphicsLayer:null,defaultZ:n,hasZ:r,view:e,elevationInfo:i,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},ee),d(()=>this.toolOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),p(()=>[this.editGeometryOperations,this.toolOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},f),m(()=>this.editSessionManager,`cancelPlugin`,({plugin:e})=>{this._suspendPlugin(e)},h),m(()=>this.editSessionManager,`restartPlugin`,({restartInfo:e})=>{this._resumePlugin(e)},h),p(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},h),m(()=>this.editGeometryOperations,[`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates);switch(e.type){case`vertex-add`:this._emitWhenReady(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this._emitWhenReady(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this._emitWhenReady(e.type,{...e,removed:n,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(let e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=c(this.surfaceManager),this.interactiveHandleManager=c(this.interactiveHandleManager),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this.tooltipManager=c(this.tooltipManager)}get _zOfLastUserInput(){let e=(this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin))?.firstPointAddedBySession?.point;return e?.hasZ?e.z:null}get _tooltipDependencies(){let{defaultZ:e,editGeometryOperations:t,toolOptions:n,directionOptions:r,elevationInfo:i,view:a}=this;return!t||!n||!a?null:{defaultZ:e,directionOptions:r,elevationInfo:i,editGeometryOperations:t,toolOptions:n,view:a,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{let{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}}get _editSessionManagerContext(){let{coordinateHelper:e,view:t}=this;return t?{coordinateHelper:e,viewingMode:t.type===`3d`&&t.viewingMode===`global`?1:2}:null}get _densificationParameters(){let{view:e,coordinateHelper:t}=this,n=t.spatialReference,r=e?.spatialReference,i=e.resolution;if(!n||!r||!i||!Number.isFinite(i))return null;let a=r.metersPerUnit/n.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(i))*O()*a,minSegmentsPerCurve:k()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.snappingManager?.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return G(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){let e=this.editSessionManager.outputGeometry;if(e&&w(e))try{let t=this._densificationParameters,n=T(e)&&t?new te({...E(e,t)}):e;if(!S(n))return C(n)}catch{return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return this.view.type===`3d`&&this.unprocessedGeometry?.type===`point`&&!!this.interactiveHandleManager?.allhandles?.find(e=>e.role===`primary`)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){let e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){let{editGeometryOperations:e,tooltipManager:t,surfaceManager:n,snappingManager:r,interactiveHandleManager:i,_snappingVisualizer:a,defaultZ:o,hasZ:s,globalStateManager:{drawAtFixedElevation:c},view:l}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:n,interactiveHandleManager:i,snappingManager:r,snappingVisualizer:a,pointerType:`mouse`,hasZ:s,defaultZ:o,view:l,drawAtFixedElevation:c}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??`noTool`}begin(e){if(!this.active){this._pendingBeginRequest=e;return}this.lifecycleManager.begin(e),this._pendingBeginRequest=null}complete(e){let t=this.lifecycleManager;if(e&&t.complete(e),t.pluginStack.length===0){let e=this.unprocessedGeometry,t=!e||e.type===`mesh`||S(e);this.emit(`complete`,{geometry:e,isSimple:t,aborted:!1,type:`complete`,vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){let e=this.pluginStack.toArray().findLast(e=>e.configuration?.hidden!==!0);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return this.interactiveHandleManager?.capturingHandle?.role===`secondary`?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){let t=this.lifecycleManager;if(t.updating){o.getLogger(this).info(`Ignoring command; arrived while updating:`,`replaceLeaf`);return}t.replaceLeaf(e)}finishPart(){let e=this.mostUpstreamPlugin?.configuration;if(this.editGeometryOperations&&e&&e.kind?.includes(`multipart`)){let e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:`undo`})}redo(){this._handleCommand({action:`redo`})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,i(()=>{this._commandsSuspended=!1;let e=this.view?.inputManager.latestPointerInfo;if(e){let{x:t,y:n}=e.location;this._handleCommand({action:`manipulator-move-to`,x:t,y:n})}})}addPromise(e){return this._updatingHandles.addPromise(e)}readPluginSettingValue(e,t){return this.readPluginSetting?.(e,t)}getGeometryIfCompleted(){let e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();let{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&=(this.begin(this._pendingBeginRequest),null),this.enableVertexVisuals&&this.addHandles(p(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?j(e):null})},f)),this.addHandles([p(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},f),d(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:g}),p(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{let n=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&n&&this._emitWhenReady(`cursor-update`,{updated:n.pos,type:`vertex-update`,operation:`apply`,vertices:[{componentIndex:n.part.index,vertexIndex:n.index,coordinates:n.pos}]})},h),this._keybindings.register(e,W.TOOL),p(()=>e.viewpoint,(e,t)=>{e&&t&&v(e,t)&&this._handleCommand({action:`viewpoint-moved`})})],Q)}onDeactivate(){super.onDeactivate(),this.removeHandles(Q),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){e.type===`pointer-down`?this.interactiveHandleManager?.notePointerDown(e.pointerId,e.pointerType):(e.type===`pointer-up`||e.type===`pointer-leave`)&&this.interactiveHandleManager?.notePointerUp(e.pointerId,e.pointerType);let t=I(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;let n=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(n):n()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||this._queuedFeedbackEvents.length===0)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended){if(this.lifecycleManager.updating){o.getLogger(this).info(`Ignoring command; arrived while updating:`,e.action);return}switch(e.action){case`view-drag`:return await this._handleViewDragCommand(e);case`vertex-add`:return this._guardCommand(e,()=>{M(e),this._commitNext()});case`vertex-add-and-finish-part`:return this._handleVertexAddAndFinishPartCommand(e);case`cancel`:return this._guardCommand(e,()=>this.cancel());case`complete`:return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(M(e),this.complete(this.mostUpstreamPlugin))});case`finish-part`:return this._guardCommand(e,()=>this.finishPart());case`undo`:return this._guardCommand(e,()=>this.editSessionManager.undo());case`redo`:return this._guardCommand(e,()=>this.editSessionManager.redo());case`next-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`forward`));case`previous-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`backward`));case`toggle-manipulator-follow`:this.interactiveHandleManager?.toggleFollow()&&M(e);break;case`viewpoint-moved`:return await this._handleViewpointMovedCommand(e);case`manipulator-move-to`:return await this._handleManipulatorMoveToCommand(e);case`manipulator-drag-to`:return await this._handleManipulatorDragToCommand(e);case`vertex-add-at-point`:return await this._handleVertexAddAtPointCommand(e);case`show-tooltip`:return this._guardCommand(e,async()=>{let t=this.tooltipManager?.tooltip;t&&ne(t.info)&&(await t.enterInputMode(),M(e))});case`constraint-center`:this.globalStateManager.setCentered(e.enabled);break;case`constraint-aspect`:this.globalStateManager.setPreserveAspectRatio(e.enabled)}}}async _handleViewDragCommand(e){if(!this.editable)return;let t=e.originalEvent,n=this.interactiveHandleManager?.capturingHandle;if(t&&`pointerType`in t&&t.pointerType===`touch`&&(n?.captureMode===`capture-always`||n?.captureMode===`capture-when-engaged`)){M(e);return}if(this.interactiveHandleManager?.capturingHandle?.captureMode===`capture-when-engaged`){M(e);return}if(this._before(e)){M(e);return}}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(M(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){if(!this.editable)return;let t=N(e.originalEvent),n=P(e.originalEvent);await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:t,pointerId:n})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager)}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;let t=N(e.originalEvent),n=P(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&M(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;let t=N(e.originalEvent),n=P(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.findHandleByManipulator(r,t);t===`touch`&&i&&e.state===`start`&&this.interactiveHandleManager?.releaseHandle();let a=this.interactiveHandleManager?.findHandleDragging(),o=this.interactiveHandleManager?.capturingHandle,s=a??o??i;s&&!i&&M(e),s?.captureMode===`capture-when-engaged`||s?.captureMode===`capture-always`&&t===`touch`?e.state===`end`?await this._updatingHandles.addPromise(s.noteDragEnd(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&N(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&s.role===`primary`&&(this.interactiveHandleManager?.handleCount===1?this._handleCommand({action:`vertex-add`}):this.interactiveHandleManager?.releaseHandle())})):e.state===`start`?await this._updatingHandles.addPromise(s.noteDragStart(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&N(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&!s.editSession?.lastPointAddedBySession&&this._handleCommand({action:`vertex-add`})})):await this._updatingHandles.addPromise(s?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})):s?.captureMode===`grabbable-object`&&(this.interactiveHandleManager?.releaseHandle(o),await this._updatingHandles.addPromise(s.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})))}async _handleVertexAddAtPointCommand(e){let t=this._updateLastScreenPosition(e),n=N(e.originalEvent),r=P(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(r,n))return;let i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,n);this.editable&&i&&(this._before(e)||(M(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:n,pointerId:r}).finally(()=>this._commitNext()))))}_makeKeyBindings(){let e=new q,t=(t,n)=>{e.addToggle(t,e=>this._handleCommand({action:n,originalEvent:e,enabled:e.type===`key-down`}))},n=(t,n)=>{e.add(t,e=>this._handleCommand({action:n,originalEvent:e}))};return t(J.preserveAspectRatio,`constraint-aspect`),t(Y.center,`constraint-center`),n(X.toggleFollowManipulator,`toggle-manipulator-follow`),n(Y.undo,`undo`),n(Y.redo,`redo`),n(Y.complete,`complete`),n(Y.vertexAdd,`vertex-add`),n({key:Z.enterInputMode,continuePropagation:!0,repeats:!0},`show-tooltip`),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);let t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){let n={stack:[],error:void 0,hasError:!1};try{let t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let r=this.tooltipManager?.getFieldsToUnlockOnVertexPlacement()??[],i=!1,o=this.editGeometryOperations;e(n,o?a(o.on(`vertex-add`,()=>i=!0)):null,!1),t.completeStep?t.completeStep():this.complete(t),i&&this.tooltipManager?.unlockOnVertexPlacement(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){let t=_(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){let n=s(this._pluginContexts,e,()=>new F({drawTool:this,plugin:e,session:t}));return n.session=t,n}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;let t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,n){return this._before(e)?n?.():t()}async _setupSegmentLabels(){let e=this.editGeometryOperations,t=this.toolOptions?.labels,n=!!t?.enabled,r=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!n){this._segmentLabels=c(this._segmentLabels);return}if(r){this._segmentLabels&&(this._segmentLabels.visible=!1);return}if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t){this._segmentLabels.visible=!0;return}let i=await this._createSegmentLabels(e,t);i&&(this._segmentLabels=c(this._segmentLabels),this._segmentLabels=i)}async _createSegmentLabels(e,t){this._segmentLabelsImportTask?.abort();let n=this._segmentLabelsImportTask=r(async n=>{if(this.view.type===`3d`){let r=import(`../3d/interactive/SegmentLabels3D.js`),{SegmentLabels3D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}let r=import(`../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})});return u(n.promise)}_isSegmentLabelsSetupStale(e,t,n){return e.aborted||this.editGeometryOperations!==t||this.toolOptions?.labels!==n||!n.enabled||this.globalStateManager.segmentLabelsDisabled}};n([y()],$.prototype,`_commandsSuspended`,void 0),n([y()],$.prototype,`_zOfLastUserInput`,null),n([y()],$.prototype,`_snappingVisualizer`,void 0),n([y()],$.prototype,`_segmentLabels`,void 0),n([y()],$.prototype,`_segmentLabelsImportTask`,void 0),n([y()],$.prototype,`_tooltipDependencies`,null),n([y()],$.prototype,`_editSessionManagerContext`,null),n([y()],$.prototype,`_densificationParameters`,null),n([y({constructOnly:!0,nonNullable:!0})],$.prototype,`view`,void 0),n([y()],$.prototype,`automaticManipulatorSelection`,void 0),n([y()],$.prototype,`updating`,null),n([y()],$.prototype,`coordinateHelper`,null),n([y()],$.prototype,`editGeometry`,null),n([y()],$.prototype,`editGeometryOperations`,null),n([y()],$.prototype,`unprocessedGeometry`,null),n([y()],$.prototype,`simplifiedGeometryPreview`,null),n([y()],$.prototype,`_suppressCoincidentPointOverlaysIn3D`,null),n([y()],$.prototype,`_shapeVisualGeometry`,null),n([y()],$.prototype,`_vertexVisualGeometry`,null),n([y()],$.prototype,`snappingManager`,void 0),n([y()],$.prototype,`toolOptions`,void 0),n([y()],$.prototype,`elevationInfo`,void 0),n([y()],$.prototype,`hasZ`,void 0),n([y()],$.prototype,`defaultZ`,void 0),n([y()],$.prototype,`directionOptions`,void 0),n([y()],$.prototype,`canUndo`,null),n([y()],$.prototype,`canRedo`,null),n([y()],$.prototype,`pluginStack`,null),n([y()],$.prototype,`mostDownstreamPlugin`,null),n([y()],$.prototype,`mostUpstreamPlugin`,null),n([y()],$.prototype,`lastScreenPosition`,void 0),n([y()],$.prototype,`positionOfLastUserInput`,null),n([y()],$.prototype,`tooltipManager`,void 0),n([y()],$.prototype,`measurementManager`,void 0),n([y()],$.prototype,`globalStateManager`,void 0),n([y()],$.prototype,`editSessionManager`,void 0),n([y()],$.prototype,`lifecycleManager`,void 0),n([y()],$.prototype,`surfaceManager`,void 0),n([y()],$.prototype,`interactiveHandleManager`,void 0),n([y()],$.prototype,`renderer`,void 0),n([y()],$.prototype,`readPluginSetting`,void 0),n([y()],$.prototype,`movementCommandContext`,null),n([y()],$.prototype,`tooltip`,null),n([y()],$.prototype,`activeTooltipInfo`,null),n([y()],$.prototype,`helpMessageKey`,null),n([y({constructOnly:!0})],$.prototype,`enableVertexVisuals`,void 0),$=n([b(`esri.views.draw.DrawTool`)],$);export{$ as DrawTool};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import{createTask as r}from"../../core/asyncUtils.js";import{makeHandle as i,disposable as a}from"../../core/handleUtils.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l}from"../../core/maybe.js";import{ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{when as d,initial as f,watch as p,syncAndInitial as ee,on as m,sync as h}from"../../core/reactiveUtils.js";import{screenPointEqual as g,createScreenPoint as _}from"../../core/screenUtils.js";import{diff as v}from"../../core/accessorSupport/diffUtils.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as x}from"../../core/support/UpdatingHandles.js";import te from"../../geometry/Polygon.js";import{simplifyIsSimple as S,simplifyExecute as C}from"../../geometry/operators/simplifyOperator.js";import{isPolygon as w}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as T}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as E}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as D}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as O,getMinSegmentsPerCurve as k}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as A}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as j,markHandled as M,getPointerType as N,getPointerId as P}from"./support/drawToolUtils.js";import{PluginContext as F}from"./support/PluginContext.js";import{viewEventToCommand as I}from"./support/input/drawToolInput.js";import{EditSessionManager as L}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as R}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as z}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as B}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as V}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as H}from"./support/managers/SurfaceManager.js";import{TooltipManager as U}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as W}from"../input/InputManager.js";import{createCoordinateHelper as G}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as K}from"../interactive/InteractiveToolBase.js";import{KeyBindings as q,mediaKeys as J,sketchKeys as Y,advancedSketchKeys as X,tooltipKeys as Z}from"../interactive/keybindings.js";import{isInputModeAvailable as ne}from"../interactive/tooltip/tooltipCommonUtils.js";const Q=Symbol();let $=class extends K{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new x,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type=`draw-2.0`,this.automaticManipulatorSelection=!0,this.snappingManager=null,this.toolOptions=null,this.disableTouchDrag=!1,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new B,this.globalStateManager=new R({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new L({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new V({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.readPluginSetting=null,this.enableVertexVisuals=!0}initialize(){let{view:e}=this;this.interactiveHandleManager=new z({view:e,renderer:this.renderer}),this._override(`manipulators`,this.interactiveHandleManager.manipulators),this.tooltipManager=new U({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(d(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:`outputGeometry`}),t.addOrUpdateVisual(this._vertexVisualId,{role:`vertex`}),this._updatingHandles.addPromise(A(e,t).then(e=>this._snappingVisualizer=e))},f)),this.addHandles([p(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,n,r,i])=>{this.surfaceManager?.destroy(),this.surfaceManager=new H({spatialReference:t,excludedGraphicsLayer:null,defaultZ:n,hasZ:r,view:e,elevationInfo:i,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},ee),d(()=>this.toolOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),p(()=>[this.editGeometryOperations,this.toolOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},f),m(()=>this.editSessionManager,`cancelPlugin`,({plugin:e})=>{this._suspendPlugin(e)},h),m(()=>this.editSessionManager,`restartPlugin`,({restartInfo:e})=>{this._resumePlugin(e)},h),p(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},h),m(()=>this.editGeometryOperations,[`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates);switch(e.type){case`vertex-add`:this._emitWhenReady(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this._emitWhenReady(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this._emitWhenReady(e.type,{...e,removed:n,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(let e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=c(this.surfaceManager),this.interactiveHandleManager=c(this.interactiveHandleManager),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this.tooltipManager=c(this.tooltipManager)}get _zOfLastUserInput(){let e=(this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin))?.firstPointAddedBySession?.point;return e?.hasZ?e.z:null}get _tooltipDependencies(){let{defaultZ:e,editGeometryOperations:t,toolOptions:n,directionOptions:r,elevationInfo:i,view:a}=this;return!t||!n||!a?null:{defaultZ:e,directionOptions:r,elevationInfo:i,editGeometryOperations:t,toolOptions:n,view:a,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{let{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}}get _editSessionManagerContext(){let{coordinateHelper:e,view:t}=this;return t?{coordinateHelper:e,viewingMode:t.type===`3d`&&t.viewingMode===`global`?1:2}:null}get _densificationParameters(){let{view:e,coordinateHelper:t}=this,n=t.spatialReference,r=e?.spatialReference,i=e.resolution;if(!n||!r||!i||!Number.isFinite(i))return null;let a=r.metersPerUnit/n.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(i))*O()*a,minSegmentsPerCurve:k()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.snappingManager?.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return G(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){let e=this.editSessionManager.outputGeometry;if(e&&w(e))try{let t=this._densificationParameters,n=T(e)&&t?new te({...E(e,t)}):e;if(!S(n))return C(n)}catch{return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return this.view.type===`3d`&&this.unprocessedGeometry?.type===`point`&&!!this.interactiveHandleManager?.allhandles?.find(e=>e.role===`primary`)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){let e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){let{editGeometryOperations:e,tooltipManager:t,surfaceManager:n,snappingManager:r,interactiveHandleManager:i,_snappingVisualizer:a,defaultZ:o,hasZ:s,globalStateManager:{drawAtFixedElevation:c},view:l}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:n,interactiveHandleManager:i,snappingManager:r,snappingVisualizer:a,pointerType:`mouse`,hasZ:s,defaultZ:o,view:l,drawAtFixedElevation:c}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??`noTool`}begin(e){if(!this.active){this._pendingBeginRequest=e;return}this.lifecycleManager.begin(e),this._pendingBeginRequest=null}complete(e){let t=this.lifecycleManager;if(e&&t.complete(e),t.pluginStack.length===0){let e=this.unprocessedGeometry,t=!e||e.type===`mesh`||S(e);this.emit(`complete`,{geometry:e,isSimple:t,aborted:!1,type:`complete`,vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){let e=this.pluginStack.toArray().findLast(e=>e.configuration?.hidden!==!0);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return this.interactiveHandleManager?.capturingHandle?.role===`secondary`?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){let t=this.lifecycleManager;if(t.updating){o.getLogger(this).info(`Ignoring command; arrived while updating:`,`replaceLeaf`);return}t.replaceLeaf(e)}finishPart(){let e=this.mostUpstreamPlugin?.configuration;if(this.editGeometryOperations&&e&&e.kind?.includes(`multipart`)){let e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:`undo`})}redo(){this._handleCommand({action:`redo`})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,i(()=>{this._commandsSuspended=!1;let e=this.view?.inputManager.latestPointerInfo;if(e){let{x:t,y:n}=e.location;this._handleCommand({action:`manipulator-move-to`,x:t,y:n})}})}addPromise(e){return this._updatingHandles.addPromise(e)}readPluginSettingValue(e,t){return this.readPluginSetting?.(e,t)}getGeometryIfCompleted(){let e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();let{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&=(this.begin(this._pendingBeginRequest),null),this.enableVertexVisuals&&this.addHandles(p(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?j(e):null})},f)),this.addHandles([p(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},f),d(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:g}),p(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{let n=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&n&&this._emitWhenReady(`cursor-update`,{updated:n.pos,type:`vertex-update`,operation:`apply`,vertices:[{componentIndex:n.part.index,vertexIndex:n.index,coordinates:n.pos}]})},h),this._keybindings.register(e,W.TOOL),p(()=>e.viewpoint,(e,t)=>{e&&t&&v(e,t)&&this._handleCommand({action:`viewpoint-moved`})})],Q)}onDeactivate(){super.onDeactivate(),this.removeHandles(Q),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){if(this.disableTouchDrag&&(e.type===`drag`||e.type===`pointer-drag`)&&e.pointerType===`touch`)return;e.type===`pointer-down`?this.interactiveHandleManager?.notePointerDown(e.pointerId,e.pointerType):(e.type===`pointer-up`||e.type===`pointer-leave`)&&this.interactiveHandleManager?.notePointerUp(e.pointerId,e.pointerType);let t=I(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;let n=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(n):n()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||this._queuedFeedbackEvents.length===0)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended){if(this.lifecycleManager.updating){o.getLogger(this).info(`Ignoring command; arrived while updating:`,e.action);return}switch(e.action){case`view-drag`:return await this._handleViewDragCommand(e);case`vertex-add`:return this._guardCommand(e,()=>{M(e),this._commitNext()});case`vertex-add-and-finish-part`:return this._handleVertexAddAndFinishPartCommand(e);case`cancel`:return this._guardCommand(e,()=>this.cancel());case`complete`:return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(M(e),this.complete(this.mostUpstreamPlugin))});case`finish-part`:return this._guardCommand(e,()=>this.finishPart());case`undo`:return this._guardCommand(e,()=>this.editSessionManager.undo());case`redo`:return this._guardCommand(e,()=>this.editSessionManager.redo());case`next-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`forward`));case`previous-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`backward`));case`toggle-manipulator-follow`:this.interactiveHandleManager?.toggleFollow()&&M(e);break;case`viewpoint-moved`:return await this._handleViewpointMovedCommand(e);case`manipulator-move-to`:return await this._handleManipulatorMoveToCommand(e);case`manipulator-drag-to`:return await this._handleManipulatorDragToCommand(e);case`vertex-add-at-point`:return await this._handleVertexAddAtPointCommand(e);case`show-tooltip`:return this._guardCommand(e,async()=>{let t=this.tooltipManager?.tooltip;t&&ne(t.info)&&(await t.enterInputMode(),M(e))});case`constraint-center`:this.globalStateManager.setCentered(e.enabled);break;case`constraint-aspect`:this.globalStateManager.setPreserveAspectRatio(e.enabled)}}}async _handleViewDragCommand(e){if(!this.editable)return;let t=e.originalEvent,n=this.interactiveHandleManager?.capturingHandle;if(t&&`pointerType`in t&&t.pointerType===`touch`&&(n?.captureMode===`capture-always`||n?.captureMode===`capture-when-engaged`)){M(e);return}if(this.interactiveHandleManager?.capturingHandle?.captureMode===`capture-when-engaged`){M(e);return}if(this._before(e)){M(e);return}}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(M(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){if(!this.editable)return;let t=N(e.originalEvent),n=P(e.originalEvent);await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:t,pointerId:n})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager)}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;let t=N(e.originalEvent),n=P(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&M(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;let t=N(e.originalEvent),n=P(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.findHandleByManipulator(r,t);t===`touch`&&i&&e.state===`start`&&this.interactiveHandleManager?.releaseHandle();let a=this.interactiveHandleManager?.findHandleDragging(),o=this.interactiveHandleManager?.capturingHandle,s=a??o??i;s&&!i&&M(e),s?.captureMode===`capture-when-engaged`||s?.captureMode===`capture-always`&&t===`touch`?e.state===`end`?await this._updatingHandles.addPromise(s.noteDragEnd(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&N(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&s.role===`primary`&&(this.interactiveHandleManager?.handleCount===1?this._handleCommand({action:`vertex-add`}):this.interactiveHandleManager?.releaseHandle())})):e.state===`start`?await this._updatingHandles.addPromise(s.noteDragStart(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&N(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&!s.editSession?.lastPointAddedBySession&&this._handleCommand({action:`vertex-add`})})):await this._updatingHandles.addPromise(s?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})):s?.captureMode===`grabbable-object`&&(this.interactiveHandleManager?.releaseHandle(o),await this._updatingHandles.addPromise(s.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})))}async _handleVertexAddAtPointCommand(e){let t=this._updateLastScreenPosition(e),n=N(e.originalEvent),r=P(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(r,n))return;let i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,n);this.editable&&i&&(this._before(e)||(M(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:n,pointerId:r}).finally(()=>this._commitNext()))))}_makeKeyBindings(){let e=new q,t=(t,n)=>{e.addToggle(t,e=>this._handleCommand({action:n,originalEvent:e,enabled:e.type===`key-down`}))},n=(t,n)=>{e.add(t,e=>this._handleCommand({action:n,originalEvent:e}))};return t(J.preserveAspectRatio,`constraint-aspect`),t(Y.center,`constraint-center`),n(X.toggleFollowManipulator,`toggle-manipulator-follow`),n(Y.undo,`undo`),n(Y.redo,`redo`),n(Y.complete,`complete`),n(Y.vertexAdd,`vertex-add`),n({key:Z.enterInputMode,continuePropagation:!0,repeats:!0},`show-tooltip`),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);let t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){let n={stack:[],error:void 0,hasError:!1};try{let t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let r=this.tooltipManager?.getFieldsToUnlockOnVertexPlacement()??[],i=!1,o=this.editGeometryOperations;e(n,o?a(o.on(`vertex-add`,()=>i=!0)):null,!1),t.completeStep?t.completeStep():this.complete(t),i&&this.tooltipManager?.unlockOnVertexPlacement(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){let t=_(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){let n=s(this._pluginContexts,e,()=>new F({drawTool:this,plugin:e,session:t}));return n.session=t,n}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;let t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,n){return this._before(e)?n?.():t()}async _setupSegmentLabels(){let e=this.editGeometryOperations,t=this.toolOptions?.labels,n=!!t?.enabled,r=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!n){this._segmentLabels=c(this._segmentLabels);return}if(r){this._segmentLabels&&(this._segmentLabels.visible=!1);return}if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t){this._segmentLabels.visible=!0;return}let i=await this._createSegmentLabels(e,t);i&&(this._segmentLabels=c(this._segmentLabels),this._segmentLabels=i)}async _createSegmentLabels(e,t){this._segmentLabelsImportTask?.abort();let n=this._segmentLabelsImportTask=r(async n=>{if(this.view.type===`3d`){let r=import(`../3d/interactive/SegmentLabels3D.js`),{SegmentLabels3D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}let r=import(`../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})});return u(n.promise)}_isSegmentLabelsSetupStale(e,t,n){return e.aborted||this.editGeometryOperations!==t||this.toolOptions?.labels!==n||!n.enabled||this.globalStateManager.segmentLabelsDisabled}};n([y()],$.prototype,`_commandsSuspended`,void 0),n([y()],$.prototype,`_zOfLastUserInput`,null),n([y()],$.prototype,`_snappingVisualizer`,void 0),n([y()],$.prototype,`_segmentLabels`,void 0),n([y()],$.prototype,`_segmentLabelsImportTask`,void 0),n([y()],$.prototype,`_tooltipDependencies`,null),n([y()],$.prototype,`_editSessionManagerContext`,null),n([y()],$.prototype,`_densificationParameters`,null),n([y({constructOnly:!0,nonNullable:!0})],$.prototype,`view`,void 0),n([y()],$.prototype,`automaticManipulatorSelection`,void 0),n([y()],$.prototype,`updating`,null),n([y()],$.prototype,`coordinateHelper`,null),n([y()],$.prototype,`editGeometry`,null),n([y()],$.prototype,`editGeometryOperations`,null),n([y()],$.prototype,`unprocessedGeometry`,null),n([y()],$.prototype,`simplifiedGeometryPreview`,null),n([y()],$.prototype,`_suppressCoincidentPointOverlaysIn3D`,null),n([y()],$.prototype,`_shapeVisualGeometry`,null),n([y()],$.prototype,`_vertexVisualGeometry`,null),n([y()],$.prototype,`snappingManager`,void 0),n([y()],$.prototype,`toolOptions`,void 0),n([y()],$.prototype,`disableTouchDrag`,void 0),n([y()],$.prototype,`elevationInfo`,void 0),n([y()],$.prototype,`hasZ`,void 0),n([y()],$.prototype,`defaultZ`,void 0),n([y()],$.prototype,`directionOptions`,void 0),n([y()],$.prototype,`canUndo`,null),n([y()],$.prototype,`canRedo`,null),n([y()],$.prototype,`pluginStack`,null),n([y()],$.prototype,`mostDownstreamPlugin`,null),n([y()],$.prototype,`mostUpstreamPlugin`,null),n([y()],$.prototype,`lastScreenPosition`,void 0),n([y()],$.prototype,`positionOfLastUserInput`,null),n([y()],$.prototype,`tooltipManager`,void 0),n([y()],$.prototype,`measurementManager`,void 0),n([y()],$.prototype,`globalStateManager`,void 0),n([y()],$.prototype,`editSessionManager`,void 0),n([y()],$.prototype,`lifecycleManager`,void 0),n([y()],$.prototype,`surfaceManager`,void 0),n([y()],$.prototype,`interactiveHandleManager`,void 0),n([y()],$.prototype,`renderer`,void 0),n([y()],$.prototype,`readPluginSetting`,void 0),n([y()],$.prototype,`movementCommandContext`,null),n([y()],$.prototype,`tooltip`,null),n([y()],$.prototype,`activeTooltipInfo`,null),n([y()],$.prototype,`helpMessageKey`,null),n([y({constructOnly:!0})],$.prototype,`enableVertexVisuals`,void 0),$=n([b(`esri.views.draw.DrawTool`)],$);export{$ as DrawTool};
|
package/widgets/Directions.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export interface DirectionsProperties extends WidgetProperties, Partial<Pick<Dir
|
|
|
137
137
|
* @since 4.6
|
|
138
138
|
* @see [DirectionsViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Directions/DirectionsViewModel/)
|
|
139
139
|
* @see [RouteLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/)
|
|
140
|
-
* @see [Guide topic -
|
|
140
|
+
* @see [Guide topic - Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
141
141
|
* @see [Sample - Directions widget](https://developers.arcgis.com/javascript/latest/sample-code/widgets-directions/)
|
|
142
142
|
* @example
|
|
143
143
|
* // 1. Add empty RouteLayer to Directions widget
|