@arcgis/core 5.2.2 → 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/{f88cbf9b1d1d7400c060.js → 20ee2f36f0fd0ae01e15.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7ec3b7f2eccd9c4c2e5.js → 26261b21d1edf476ea49.js} +1 -1
- package/assets/esri/core/workers/chunks/{7d2be06dfbd92c8b9484.js → 596891426621c403bdef.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/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/VectorTileLayer.d.ts +2 -2
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/APIKeyMixin.d.ts +1 -1
- package/layers/ogc/types.d.ts +1 -1
- package/package.json +2 -2
- package/support/timeUtils.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/widgets/Directions.d.ts +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ScaleRangeSlider/types.d.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"attachments":{"addFile":"新增檔案","attachmentNumberedLabel":"附件 {index}","attach":"附加","attachmentEditingDisabled":"已停用附件編輯。","attachmentLimitExceeded":"已超過附件限制","attachmentLimitReached":"已達到附件限制","attachmentMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentsMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentMustBeSmallerThan":"附件大小必須小於 {maxSize}","attachmentsMustBeSmallerThan":"附件大小必須小於 {maxSize}","durationInSecond":"{count} 秒","durationInSeconds":"{count} 秒","capture":"擷取","captureMethodNotSupported":"不支援的擷取方法","captureUnsupportedAdd":"此裝置不支援擷取。","captureUnsupportedDetail":"此裝置不支援擷取。","chooseFile":"選擇檔案","count":"計數: {count}","deleted":"已刪除","download":"下載","dragAndDropFile":"拖放檔案。","fileExceedsMaximumSize":"檔案超過大小上限","fileName":"檔案名稱","fileSelected":"選擇的檔案","fileToBeReplaced":"要取代的檔案","imageResizedToMeetRequirements":"圖像大小已調整為符合需求","maximumAudioLength":"音訊長度上限: {maxDuration}","maximumFileSize":"檔案大小上限: {maxSize}","maximumNumberOfFiles":"檔案數上限: {count}","maximumVideoLength":"視訊長度上限: {maxDuration}","maximize":"最大化","maximumNumberReachedRemoveToContinue":"已達到最大數量。 移除附件以繼續。","maxAttachmentsShort":"最大值: {count}","maxAttachments":"附件數上限: {count}","minimumNotMet":"未滿足最低附件需求","minimumNumberOfFiles":"檔案數下限: {count}","minAttachmentsShort":"最小值: {count}","minAttachments":"附件數下限: {count}","noAttachments":"無附件","noPreviewAvailable":"無法預覽","remove":"移除","replace":"取代","recordAudio":"錄音","takePhoto":"拍照","takeVideo":"錄影","searchAttachments":"搜尋附件","replaceFile":"取代檔案","selectFile":"選擇檔案","size":"大小","type":"類型","unableToAddAttachment":"無法新增附件","unableToAddAttachments":"無法新增附件","unsupportedDevice":"不支援的裝置","unsupportedDeviceCaptureMessage":"此裝置不支援必要的擷取方法。","viewAll":"檢視所有","youCanAddUpToOneAttachment":"最多可新增 1 個附件","youCanAddUpToAttachments":"最多可新增 {count} 個附件"},"addFeature":"新增圖徵","addRecord":"新增記錄","unsupportedDomainGroupTitle":"不支援的值","differentValues":"不同值","differentValuesPlaceholder":"(不同值)","empty":"沒有值","noDynamicChoices":"無可用選項","noDynamicChoicesWithNoValue":"無其他可用選項","otherOptionLabel":"其他","expressionEvaluationFailed":"表格無法執行計算","failedToCalculateValues":"無法計算值","footerButtons":{"add":"新增","delete":"刪除","discard":"放棄","done":"完成","replace":"取代","reset":"重設","update":"更新"},"footerNotices":{"deleteDisabledMinimumAttachments":"已停用刪除。 此功能需要的附件數下限。"},"formFailedToLoad":"無法載入表格。","formFailedToLoadTooManyComplexFeatures":"此表格使用將屬性編輯限制為 {num} 個圖徵的功能。","formFailedToLoadTooManyFeatures":"選擇最多 {num} 個圖徵以編輯屬性。","noVisibleFields":{"allElementsHidden":"所選圖徵沒有要顯示的欄位","elementsHiddenInSome":"所選圖徵具有分享的欄位,由於可見性表達式而未顯示","noElements":"所選圖徵沒有要顯示的欄位","noElementsInCommon":"所選圖徵沒有分享的欄位"},"other":"其他","recommended":"建議","relatedRecords":{"noOriginKeyFeature":"輸入 '{originKeyField}' 後才能將圖徵新增至 '{relatedLayerName}'。","noOriginKeyRecord":"輸入 '{originKeyField}' 後才能將記錄新增至 '{relatedLayerName}'。","noRecordsFound":"找不到記錄。","noRelatedRecordsFound":"找不到相關記錄。","relatedRecordsTitle":"相關記錄","untitledLayer":"未命名的圖層"},"requiredFieldBatchMode":"此欄位對於一或多個圖徵是必要的。","requiredFieldLabel":"{name} - 必要欄位","deselectAllLabel":"取消全選","selectAllLabel":"全選","showAll":"顯示全部","showAllOptions":"顯示所有選項","titles":{"addAttachments":"新增附件","attachments":"附件","editFeature":"編輯圖徵","editFeatures":"編輯圖徵","editAttachment":"編輯附件","replaceAttachment":"取代附件"},"totalCount":"總計: {count}","unsupported":"不支援","unsupportedContingentValues":"對於具有意外值的圖層,無法編輯多個圖徵的屬性。","validationErrors":{"cannotBeNull":"欄位為必填項。","invalidCodedValue":"值必須是其中一個列出值。","invalidType":"非有效值","invalidBatchFormType":"一或多個圖徵包含無效值。 檢查個別圖徵。","featuresInError":"一或多個圖徵發生錯誤。 檢查個別圖徵。","featuresWithInvalidValues":"一或多個圖徵具有無效值","nonVisibleError_changeValues":"所選圖徵具有包含無效值的隱藏欄位。 變更值以使欄位可見。","nonVisibleError_checkIndividualFeatures":"一或多個圖徵具有包含無效值的隱藏欄位。 檢查個別圖徵並更正問題。","outsideRange":"值應該介於 {min} 到 {max}","outsideRangeMax":"值必須小於或等於 {max}","outsideRangeMin":"值必須大於或等於 {min}","tooFewSelectedChoices":"
|
|
1
|
+
{"attachments":{"addFile":"新增檔案","attachmentNumberedLabel":"附件 {index}","attach":"附加","attachmentEditingDisabled":"已停用附件編輯。","attachmentLimitExceeded":"已超過附件限制","attachmentLimitReached":"已達到附件限制","attachmentMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentsMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentMustBeSmallerThan":"附件大小必須小於 {maxSize}","attachmentsMustBeSmallerThan":"附件大小必須小於 {maxSize}","durationInSecond":"{count} 秒","durationInSeconds":"{count} 秒","capture":"擷取","captureMethodNotSupported":"不支援的擷取方法","captureUnsupportedAdd":"此裝置不支援擷取。","captureUnsupportedDetail":"此裝置不支援擷取。","chooseFile":"選擇檔案","count":"計數: {count}","deleted":"已刪除","download":"下載","dragAndDropFile":"拖放檔案。","fileExceedsMaximumSize":"檔案超過大小上限","fileName":"檔案名稱","fileSelected":"選擇的檔案","fileToBeReplaced":"要取代的檔案","imageResizedToMeetRequirements":"圖像大小已調整為符合需求","maximumAudioLength":"音訊長度上限: {maxDuration}","maximumFileSize":"檔案大小上限: {maxSize}","maximumNumberOfFiles":"檔案數上限: {count}","maximumVideoLength":"視訊長度上限: {maxDuration}","maximize":"最大化","maximumNumberReachedRemoveToContinue":"已達到最大數量。 移除附件以繼續。","maxAttachmentsShort":"最大值: {count}","maxAttachments":"附件數上限: {count}","minimumNotMet":"未滿足最低附件需求","minimumNumberOfFiles":"檔案數下限: {count}","minAttachmentsShort":"最小值: {count}","minAttachments":"附件數下限: {count}","noAttachments":"無附件","noPreviewAvailable":"無法預覽","remove":"移除","replace":"取代","recordAudio":"錄音","takePhoto":"拍照","takeVideo":"錄影","searchAttachments":"搜尋附件","replaceFile":"取代檔案","selectFile":"選擇檔案","size":"大小","type":"類型","unableToAddAttachment":"無法新增附件","unableToAddAttachments":"無法新增附件","unsupportedDevice":"不支援的裝置","unsupportedDeviceCaptureMessage":"此裝置不支援必要的擷取方法。","viewAll":"檢視所有","youCanAddUpToOneAttachment":"最多可新增 1 個附件","youCanAddUpToAttachments":"最多可新增 {count} 個附件"},"addFeature":"新增圖徵","addRecord":"新增記錄","unsupportedDomainGroupTitle":"不支援的值","differentValues":"不同值","differentValuesPlaceholder":"(不同值)","empty":"沒有值","noDynamicChoices":"無可用選項","noDynamicChoicesWithNoValue":"無其他可用選項","otherOptionLabel":"其他","expressionEvaluationFailed":"表格無法執行計算","failedToCalculateValues":"無法計算值","footerButtons":{"add":"新增","delete":"刪除","discard":"放棄","done":"完成","replace":"取代","reset":"重設","update":"更新"},"footerNotices":{"deleteDisabledMinimumAttachments":"已停用刪除。 此功能需要的附件數下限。"},"formFailedToLoad":"無法載入表格。","formFailedToLoadTooManyComplexFeatures":"此表格使用將屬性編輯限制為 {num} 個圖徵的功能。","formFailedToLoadTooManyFeatures":"選擇最多 {num} 個圖徵以編輯屬性。","noVisibleFields":{"allElementsHidden":"所選圖徵沒有要顯示的欄位","elementsHiddenInSome":"所選圖徵具有分享的欄位,由於可見性表達式而未顯示","noElements":"所選圖徵沒有要顯示的欄位","noElementsInCommon":"所選圖徵沒有分享的欄位"},"other":"其他","recommended":"建議","relatedRecords":{"noOriginKeyFeature":"輸入 '{originKeyField}' 後才能將圖徵新增至 '{relatedLayerName}'。","noOriginKeyRecord":"輸入 '{originKeyField}' 後才能將記錄新增至 '{relatedLayerName}'。","noRecordsFound":"找不到記錄。","noRelatedRecordsFound":"找不到相關記錄。","relatedRecordsTitle":"相關記錄","untitledLayer":"未命名的圖層"},"requiredFieldBatchMode":"此欄位對於一或多個圖徵是必要的。","requiredFieldLabel":"{name} - 必要欄位","deselectAllLabel":"取消全選","selectAllLabel":"全選","showAll":"顯示全部","showAllOptions":"顯示所有選項","titles":{"addAttachments":"新增附件","attachments":"附件","editFeature":"編輯圖徵","editFeatures":"編輯圖徵","editAttachment":"編輯附件","replaceAttachment":"取代附件"},"totalCount":"總計: {count}","unsupported":"不支援","unsupportedContingentValues":"對於具有意外值的圖層,無法編輯多個圖徵的屬性。","validationErrors":{"cannotBeNull":"欄位為必填項。","invalidCodedValue":"值必須是其中一個列出值。","invalidType":"非有效值","invalidBatchFormType":"一或多個圖徵包含無效值。 檢查個別圖徵。","featuresInError":"一或多個圖徵發生錯誤。 檢查個別圖徵。","featuresWithInvalidValues":"一或多個圖徵具有無效值","nonVisibleError_changeValues":"所選圖徵具有包含無效值的隱藏欄位。 變更值以使欄位可見。","nonVisibleError_checkIndividualFeatures":"一或多個圖徵具有包含無效值的隱藏欄位。 檢查個別圖徵並更正問題。","outsideRange":"值應該介於 {min} 到 {max}","outsideRangeMax":"值必須小於或等於 {max}","outsideRangeMin":"值必須大於或等於 {min}","tooFewSelectedChoices":"所需的選擇數量下限: {min}","tooManySelectedChoices":"允許的選擇數量上限: {max}","tooShort":"此欄位至少需要 {min} 個字元","valuesIncompatible":"值與其他選定值不相容"},"valueExpressionError":"無法計算值。","viewAll":"檢視所有","subtypes":{"changeWarning":"子類型 {newType} 可能具有與 {originalType} 不同的預設值。 保留目前值可能會導致非預期的結果。","changeWarningTitle":"子類型已變更","useDefaultValuesOption":"使用預設值","keepCurrentValuesOption":"保留目前值","unsupportedDomainGroupTitle":"不支援","fieldOutOfSubtypeDomainWarning":"此欄位的值超出其網域的範圍。"}}
|
package/config.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface Config {
|
|
|
45
45
|
*
|
|
46
46
|
* @since 4.18
|
|
47
47
|
* @see [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/)
|
|
48
|
-
* @see [
|
|
48
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
49
49
|
* @see [API key authentication tutorials](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/tutorials/)
|
|
50
50
|
* @see [Display a map tutorial - get an API key](https://developers.arcgis.com/javascript/latest/display-a-map/#get-an-access-token)
|
|
51
51
|
*/
|
|
@@ -54,7 +54,7 @@ export interface Config {
|
|
|
54
54
|
* An object that contains global API keys for various services and scopes.
|
|
55
55
|
* This object can be used to configure API keys to access the [basemap style service](https://developers.arcgis.com/javascript/latest/references/core/support/BasemapStyle/) and/or secure ArcGIS Enterprise services/items.
|
|
56
56
|
* Alternatively, a fine-grained API key can be set on a specific class, which will override this global API key.
|
|
57
|
-
* See the [
|
|
57
|
+
* See the [Authentication and access tokens guide page](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys) for more information.
|
|
58
58
|
*
|
|
59
59
|
* > [!WARNING]
|
|
60
60
|
* >
|
|
@@ -64,7 +64,7 @@ export interface Config {
|
|
|
64
64
|
*
|
|
65
65
|
* @since 4.33
|
|
66
66
|
* @see [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/)
|
|
67
|
-
* @see [
|
|
67
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
68
68
|
* @see [API key authentication tutorials](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/tutorials/)
|
|
69
69
|
* @see [BasemapStyle](https://developers.arcgis.com/javascript/latest/references/core/support/BasemapStyle/)
|
|
70
70
|
* @example
|
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://js.arcgis.com/5.2.
|
|
2
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://js.arcgis.com/5.2.3/@arcgis/core/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
|
package/identity/Credential.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface CredentialEvents {
|
|
|
20
20
|
*
|
|
21
21
|
* @since 4.0
|
|
22
22
|
* @see [Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
|
|
23
|
-
* @see [
|
|
23
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
24
24
|
* @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
|
|
25
25
|
* @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
|
|
26
26
|
* @see [ArcGIS Organization portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* > The IdentityManager module is slightly different than other modules in the API. Instead of returning a class constructor, it returns a singleton instance that has already been created by this module.
|
|
19
19
|
*
|
|
20
20
|
* @since 4.0
|
|
21
|
-
* @see [
|
|
21
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
22
22
|
* @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
|
|
23
23
|
* @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
|
|
24
24
|
* @see [ArcGIS Organization portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
|
package/identity/OAuthInfo.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface OAuthInfoProperties extends Partial<Pick<OAuthInfo, "appId" | "
|
|
|
14
14
|
*
|
|
15
15
|
* @since 4.0
|
|
16
16
|
* @see [Sample - Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
|
|
17
|
-
* @see [Authentication and
|
|
17
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
18
18
|
* @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
|
|
19
19
|
* @see [Proxy pages with the API](https://developers.arcgis.com/javascript/latest/proxies/)
|
|
20
20
|
* @see [ArcGIS portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
|
package/identity/ServerInfo.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface ServerInfoProperties extends Partial<Pick<ServerInfo, "adminTok
|
|
|
7
7
|
*
|
|
8
8
|
* @since 4.0
|
|
9
9
|
* @see [IdentityManager](https://developers.arcgis.com/javascript/latest/references/core/identity/IdentityManager/)
|
|
10
|
-
* @see [
|
|
10
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
|
|
11
11
|
* @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
|
|
12
12
|
* @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
|
|
13
13
|
* @see [Guide topic - CORS](https://developers.arcgis.com/javascript/latest/cors/)
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.
|
|
2
|
+
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.3`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
|
|
@@ -34,7 +34,7 @@ export interface VectorTileLayerProperties extends LayerProperties, APIKeyMixinP
|
|
|
34
34
|
* apiKey: "YOUR_API_KEY"
|
|
35
35
|
* });
|
|
36
36
|
* @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
|
|
37
|
-
* @see [
|
|
37
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
38
38
|
* @example
|
|
39
39
|
* // set the api key to access a protected service
|
|
40
40
|
* const layer = new FeatureLayer({
|
|
@@ -427,7 +427,7 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
|
|
|
427
427
|
* apiKey: "YOUR_API_KEY"
|
|
428
428
|
* });
|
|
429
429
|
* @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
|
|
430
|
-
* @see [
|
|
430
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
431
431
|
* @example
|
|
432
432
|
* // set the api key to access a protected service
|
|
433
433
|
* const layer = new FeatureLayer({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await l(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await L()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,u=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import r from"../../../../core/Handles.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../../core/QueueProcessor.js";import{parseWhereClause as c}from"../../../../core/sql.js";import{getMetersPerUnitForSR as l}from"../../../../core/units.js";import{initializeProjection as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as h,negativeInfinity as g}from"../../../../geometry/support/aaBoundingBox.js";import{copy as _,create as v,expandWithRect as ee,negativeInfinity as te}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as y,isWGS84 as b}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as x,readParquetFileAttribute as ne}from"../../../parquet.js";import{convertToGeometry as S}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as re}from"../../data/attributeSupport.js";import{project as ie}from"../../data/projectionSupport.js";import{getQueryResultExtent as ae,getQueryBoundingRects as C,QueryEngine as w}from"../../data/QueryEngine.js";import{queryCapabilities as T}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as oe}from"./clientSideDefaults.js";import{getParquetFileId as se,getParquetRowId as ce,getParquetObjectId as A}from"./parquetIdUtils.js";import j from"../../../support/Field.js";import M from"../../../support/FieldsIndex.js";import{isNumericField as N}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as P}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as F,fromParquetJSONGeometryType as I,toParquetJSONGeometryType as L}from"../../../support/parquetUtils.js";import{loadParquetModule as R}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as z}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as B}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as H}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as U}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as W}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const G=new B,K=`__OBJECTID`,q=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){o(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new s({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new r}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new n(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let r=await this._provider.getMetadata(),a=await F(r,{fields:e.fields?.map(e=>j.fromJSON(e)),geometryEncoding:e.geometryEncoding?P(e.geometryEncoding):null,geometryType:e.geometryType?I(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!r?.hasZ,this._hasM=!!r?.hasM,!a.fields)throw new n(`parquet:unsupported`,`Fields must be defined`);let o;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new n(`parquet:unsupported`,`SpatialReference must be defined`);if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new n(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:a.spatialReference}),a.spatialReference=d.WGS84),o={geometry:a.geometryEncoding?{geometryType:L(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;a.file=c;let{fields:l}=a;if(l==null)throw new n(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new j({name:K,type:`oid`,alias:K}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=M.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=L(a.geometryType??`point`);return this._metadata=U.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:K},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:z}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:K},hasM:this._hasM,hasZ:this._hasZ,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:oe(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),Te(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,q):q,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!J(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),J(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new n(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);this._validateQuery(n);let r=n.outSR??this._queryEngineParams.spatialReference;if(this._fullExtent&&!J(n)){let e=this._fullExtent;return await u(e.spatialReference,n.outSR),{count:await this._getFeatureCount(),extent:n.outSR?ie(e,n.outSR):e}}n.returnGeometry=!0,n.outFields=void 0;let i=f(p(),g),a=p(),o=await this._enqueueQuery(n,t),s=0;for(let e of o.items)e.getBounds(a)&&(m(i,a),s+=1);let c=ae(i,r,r,r,!1);return{count:s,extent:c}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,q,n)}),i=this._streamIdCounter++,o=a(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:o}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await R()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new W(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=S(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?we(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await R();switch(t.type){case`xz`:return{type:`xz`,fieldName:x(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:x(t.xColumn),yFieldName:x(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),g),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];h(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await R()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(y(c)||b(c))){let t=_(v(),te);for(let n of C(e.geometry))ee(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await R()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new n(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new n(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new n(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,r,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,n){let i=a[n];if(i==null){if(o.get(n)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return A(r,t)}return null}let s=o.get(n);return ne(t,e.rowGroup,e.row,i,s.type)}},l=await c(i,this._fieldsIndex);if(!l.isStandardized)throw new n(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>l.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=l.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,q),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new W(this._metadata,this._indexMap,e,s.id);return X([new V(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??q,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=se(t),r=ce(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new n(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let r=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=r?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return r||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await c(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await R()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,q,r),s=await o.next(r),l=0,u=[];for(;s!=null;){let e=new W(this._metadata,this._indexMap,s,t),n=new V(e,null,l++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of re(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!y(t)&&!b(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=l(t)/l(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function J(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!J(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&N(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return Se(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function Se(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Ce(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Ce(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new H;for(let t of e)n.insert(t);return new w({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function we(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...T,maxRecordCount:q,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function Te(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
|
|
@@ -18,7 +18,7 @@ export abstract class APIKeyMixin {
|
|
|
18
18
|
*
|
|
19
19
|
* @since 4.20
|
|
20
20
|
* @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
|
|
21
|
-
* @see [
|
|
21
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
22
22
|
* @example
|
|
23
23
|
* // set the api key to access a protected service
|
|
24
24
|
* const layer = new FeatureLayer({
|
package/layers/ogc/types.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export interface QueryParameters {
|
|
|
87
87
|
*
|
|
88
88
|
* @since 5.0
|
|
89
89
|
* @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
|
|
90
|
-
* @see [
|
|
90
|
+
* @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
|
|
91
91
|
* @example
|
|
92
92
|
* // set the api key to access a protected service
|
|
93
93
|
* const layer = new FeatureLayer({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.3",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.20.8",
|
|
23
|
-
"@arcgis/toolkit": "5.2.
|
|
23
|
+
"@arcgis/toolkit": "5.2.3",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.2.0",
|
|
25
25
|
"@esri/calcite-components": "^5.2.1",
|
|
26
26
|
"@vaadin/grid": "~25.3.2",
|
package/support/timeUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isSome as e}from"../core/arrayUtils.js";import{clone as t}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import r from"../rest/support/StatisticDefinition.js";import i from"../time/TimeExtent.js";import{isWebMap as a}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function s(e){return e.timeInfo!==void 0}async function c(t,n){if(!t.timeInfo||!t.timeInfo.startField&&!t.timeInfo.endField)return null;let{startField:a,endField:o}=t.timeInfo,s=t.createQuery();s.outStatistics=[],a&&s.outStatistics.push(new r({onStatisticField:a,outStatisticFieldName:`minStart`,statisticType:`min`}),new r({onStatisticField:a,outStatisticFieldName:`maxStart`,statisticType:`max`})),o&&s.outStatistics.push(new r({onStatisticField:o,outStatisticFieldName:`minEnd`,statisticType:`min`}),new r({onStatisticField:o,outStatisticFieldName:`maxEnd`,statisticType:`max`}));let{features:c}=await t.queryFeatures(s,{signal:n}),l=c.at(0),u=[l?.getAttribute(`minStart`),l?.getAttribute(`maxStart`),l?.getAttribute(`minEnd`),l?.getAttribute(`maxEnd`)].filter(e).map(e=>typeof e==`string`?Date.parse(e):e);if(!u.length)return null;let d=new Date(Math.min(...u)),f=new Date(Math.max(...u)),p=new i({start:d,end:f}),{visibilityTimeExtent:m}=t;return p?.intersection(m)??m}async function l(e,t){return e.widgets?.timeSlider?.fullTimeExtent??f(e.allLayers,t)}function u(e){let t=e.numThumbs??2,n=e.currentTimeExtent;if(n){let{start:e,end:r}=n;return e!=null&&r!=null&&e.getTime()===r.getTime()?`instant`:t===2?`time-window`:e==null||e.getTime()===0?`cumulative-from-start`:`cumulative-from-end`}return t===2?`time-window`:`cumulative-from-start`}function d(e){let{numStops:n,stopInterval:r,stops:i}=e;return i?{dates:t(i)}:r?{interval:r.clone()}:{count:n??5}}async function f(t,n){if(t.length===0)return i.allTime;await Promise.all(t.map(e=>e.load({signal:n})));let r=t.filter(s),a=t.filter(e=>!s(e)&&e.visibilityTimeExtent!=null);if(r.length===0&&a.length===0)return i.allTime;let o=[],l=[],u=[];for(let e of r)e.type===`feature
|
|
2
|
+
import{isSome as e}from"../core/arrayUtils.js";import{clone as t}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import r from"../rest/support/StatisticDefinition.js";import i from"../time/TimeExtent.js";import{isWebMap as a}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function s(e){return e.timeInfo!==void 0}async function c(t,n){if(!t.timeInfo||!t.timeInfo.startField&&!t.timeInfo.endField)return null;let{startField:a,endField:o}=t.timeInfo,s=t.createQuery();s.outStatistics=[],a&&s.outStatistics.push(new r({onStatisticField:a,outStatisticFieldName:`minStart`,statisticType:`min`}),new r({onStatisticField:a,outStatisticFieldName:`maxStart`,statisticType:`max`})),o&&s.outStatistics.push(new r({onStatisticField:o,outStatisticFieldName:`minEnd`,statisticType:`min`}),new r({onStatisticField:o,outStatisticFieldName:`maxEnd`,statisticType:`max`}));let{features:c}=await t.queryFeatures(s,{signal:n}),l=c.at(0),u=[l?.getAttribute(`minStart`),l?.getAttribute(`maxStart`),l?.getAttribute(`minEnd`),l?.getAttribute(`maxEnd`)].filter(e).map(e=>typeof e==`string`?Date.parse(e):e);if(!u.length)return null;let d=new Date(Math.min(...u)),f=new Date(Math.max(...u)),p=new i({start:d,end:f}),{visibilityTimeExtent:m}=t;return p?.intersection(m)??m}async function l(e,t){return e.widgets?.timeSlider?.fullTimeExtent??f(e.allLayers,t)}function u(e){let t=e.numThumbs??2,n=e.currentTimeExtent;if(n){let{start:e,end:r}=n;return e!=null&&r!=null&&e.getTime()===r.getTime()?`instant`:t===2?`time-window`:e==null||e.getTime()===0?`cumulative-from-start`:`cumulative-from-end`}return t===2?`time-window`:`cumulative-from-start`}function d(e){let{numStops:n,stopInterval:r,stops:i}=e;return i?{dates:t(i)}:r?{interval:r.clone()}:{count:n??5}}async function f(t,n){if(t.length===0)return i.allTime;await Promise.all(t.map(e=>e.load({signal:n})));let r=t.filter(s),a=t.filter(e=>!s(e)&&e.visibilityTimeExtent!=null);if(r.length===0&&a.length===0)return i.allTime;let o=[],l=[],u=[];for(let e of r)(e.type===`feature`||e.type===`scene`)&&h(e)?o.push(e):(e.type===`feature`||e.type===`map-image`)&&e.timeInfo?.hasLiveData?l.push(e):u.push(e);let d=e=>e==null||e.isAllTime,f=[...u.map(e=>{let t=e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=e;return t?.intersection(n)??n}),...a.map(e=>e.visibilityTimeExtent)];if(f.some(d))return i.allTime;let p=l.map(async e=>{let t=(await e.fetchRecomputedExtents({signal:n}))?.timeExtent??e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:r}=e;return t?.intersection(r)??r}),m=(await Promise.allSettled(p)).map(e=>e.status===`fulfilled`?e.value:null);if(m.some(d))return i.allTime;let g=o.map(e=>c(e,n)),_=(await Promise.allSettled(g)).filter(e=>e.status===`fulfilled`).map(e=>e.value),v=[...m,...f,..._].filter(e);return v.length===0?i.allTime:v.reduce((e,t)=>e.union(t))}function p(e,t){let n=e.currentTimeExtent;if(!n)return null;let{start:r,end:a}=n,o=r??a??null;switch(t){case`time-window`:return new i({start:r,end:a});case`cumulative-from-start`:return new i({start:null,end:o});case`cumulative-from-end`:return new i({start:o,end:null});case`instant`:return new i({start:o,end:o})}}async function m(e,t){if(!(a(e)||o(e)))return null;await e.load({signal:t});let n=e?.widgets?.timeSlider;if(!n)return null;let r=await l(e,t),{loop:i}=n,s=u(n);return{fullTimeExtent:r,loop:i,mode:s,playRate:n.stopDelay??2e3,stops:d(n),timeExtent:p(n,s)}}function h(e){if(!e.url)return!1;let t=e.timeInfo,n=e.getAtOrigin(`timeInfo`,`service`);return n?!(!t||t===n||(t.startField===n.startField||!t.startField&&!n.startField)&&(t.endField===n.endField||!t.endField&&!n.endField)):!!t}function g(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,-t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,-r.getTimezoneOffset(),`minutes`)})}function _(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,r.getTimezoneOffset(),`minutes`)})}export{c as fetchTimeExtent,f as getTimeExtentFromLayers,m as getTimeSliderSettingsFromWebDocument,h as requireFetchTimeExtent,_ as toLocalTimeExtent,g as toUTCTimeExtent};
|
|
@@ -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{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};
|
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
|