@arcgis/core 5.2.0-next.157 → 5.2.0-next.159
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{820c8aaf3632edb0150c.js → 0a5a9885ee6f5b5f99f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{7bcedf479b07a4b4a234.js → 1419bf346978b81b08cc.js} +1 -1
- package/assets/esri/core/workers/chunks/2cb209bc51a19487692d.js +2 -0
- package/assets/esri/core/workers/chunks/2e66c969bf4209c957b5.js +2 -0
- package/assets/esri/core/workers/chunks/31640b41e0ecdff892fa.js +2 -0
- package/assets/esri/core/workers/chunks/{2ef5237e4c876d6a4ee0.js → 340256866f524cb069f6.js} +1 -1
- package/assets/esri/core/workers/chunks/{6079d27f4ab319fb8f0c.js → 377595b23379b0c8fe95.js} +1 -1
- package/assets/esri/core/workers/chunks/{c5ed67fdf261cbb1624b.js → 4be559c53fe5ac0d0d2e.js} +1 -1
- package/assets/esri/core/workers/chunks/4e6656a5f29e31902fca.js +2 -0
- package/assets/esri/core/workers/chunks/{67ebc5a3d46b254b725c.js → 612345f17f5eeb99ea8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{44918ff37818a7d36d76.js → 6a0ec102962d2c7b4368.js} +1 -1
- package/assets/esri/core/workers/chunks/6a2562cc00727155fc01.js +1 -0
- package/assets/esri/core/workers/chunks/784d6c6949284ed6e10b.js +1 -0
- package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js → 844eedda8f749972f707.js} +2 -2
- package/assets/esri/core/workers/chunks/{d2347d6aa1c57fd57029.js → 8ff23ac0abeea0073b47.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec8b7476eac4718eb0ac.js → a504a5e06cb89a620799.js} +1 -1
- package/assets/esri/core/workers/chunks/a53823cf03dbdce1aecd.js +1 -0
- package/assets/esri/core/workers/chunks/{a556dd4e9e6d35e33a2c.js → a546ec82ba149e12f7bf.js} +1 -1
- package/assets/esri/core/workers/chunks/{4a640548032355e57acd.js → ab6506a3c16f8717fc00.js} +1 -1
- package/assets/esri/core/workers/chunks/{d65383f4058dc813f40d.js → ade5fdcd08dcbac74740.js} +1 -1
- package/assets/esri/core/workers/chunks/ba38231193919e093917.js +1 -0
- package/assets/esri/core/workers/chunks/{3f776d9fd2ab68b21fca.js → bbd44ac63d2a317d8ed9.js} +1 -1
- package/assets/esri/core/workers/chunks/{35e5762642d1a3a2e375.js → be308db5b61a7246edfe.js} +1 -1
- package/assets/esri/core/workers/chunks/{10445313d0d57b34511b.js → d53cc574a21031436c45.js} +1 -1
- package/assets/esri/core/workers/chunks/dc51dcaa4e2f9a90f5bd.js +2 -0
- package/assets/esri/core/workers/chunks/f63686735e4e52f5b54e.js +1 -0
- package/assets/esri/core/workers/chunks/{b573df59391ca41ee5a7.js → fc73737b41e086f0ce0b.js} +1 -1
- package/assets/esri/core/workers/chunks/{3914d96147642a9d4b01.js → ffbcb816b611049a6276.js} +1 -1
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/config.js +1 -1
- package/form/elements.d.ts +46 -8
- package/form/elements.js +1 -1
- package/kernel.js +1 -1
- package/layers/GeoJSONLayer.d.ts +1 -1
- package/layers/support/layerOriginUtils.js +1 -1
- package/package.json +3 -3
- package/popup/FeaturesModel.js +1 -1
- package/time/TimeExtent.d.ts +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/snapping/allLayerSnapping.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +2 -0
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -1
- package/widgets/Expand/ExpandViewModel.d.ts +2 -0
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.d.ts +3 -1
- package/widgets/Home/HomeViewModel.d.ts +2 -0
- package/widgets/ScaleRangeSlider/ScaleRanges.d.ts +3 -0
- package/widgets/ScaleRangeSlider/types.d.ts +3 -3
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Swipe/SwipeViewModel.d.ts +2 -0
- package/widgets/Swipe/types.d.ts +9 -2
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +9 -5
- package/widgets/TimeSlider/types.d.ts +7 -0
- package/widgets/TimeSlider.d.ts +2 -3
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track/TrackViewModel.d.ts +4 -0
- package/widgets/Track/types.d.ts +1 -0
- package/widgets/support/Selector3D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/1b946714ca4a1a7359d4.js +0 -2
- package/assets/esri/core/workers/chunks/22b01fe31bbf0bdc48db.js +0 -1
- package/assets/esri/core/workers/chunks/27c2da2e779def2ee08b.js +0 -1
- package/assets/esri/core/workers/chunks/2a1ec30f9ad305763f81.js +0 -2
- package/assets/esri/core/workers/chunks/34570e6bbf559f18c1a5.js +0 -1
- package/assets/esri/core/workers/chunks/5566f14afb63065e438f.js +0 -1
- package/assets/esri/core/workers/chunks/68d8ae42ab71d01a70a5.js +0 -2
- package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +0 -1
- package/assets/esri/core/workers/chunks/8dc1c3042267618fd710.js +0 -2
- package/assets/esri/core/workers/chunks/96c50a0dda0f1503ef92.js +0 -2
- /package/assets/esri/core/workers/chunks/{1b946714ca4a1a7359d4.js.LICENSE.txt → 2cb209bc51a19487692d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{8dc1c3042267618fd710.js.LICENSE.txt → 2e66c969bf4209c957b5.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{96c50a0dda0f1503ef92.js.LICENSE.txt → 31640b41e0ecdff892fa.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{2a1ec30f9ad305763f81.js.LICENSE.txt → 4e6656a5f29e31902fca.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js.LICENSE.txt → 844eedda8f749972f707.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{68d8ae42ab71d01a70a5.js.LICENSE.txt → dc51dcaa4e2f9a90f5bd.js.LICENSE.txt} +0 -0
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://cdn.jsdelivr.net/npm/@arcgis/core@5.2.0-next.
|
|
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://cdn.jsdelivr.net/npm/@arcgis/core@5.2.0-next.159/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
|
package/form/elements.d.ts
CHANGED
|
@@ -50,39 +50,68 @@ import type RelationshipElementClass from "./elements/RelationshipElement.js";
|
|
|
50
50
|
import type TextElementClass from "./elements/TextElement.js";
|
|
51
51
|
import type UtilityNetworkAssociationsElementClass from "./elements/UtilityNetworkAssociationsElement.js";
|
|
52
52
|
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* `FieldElement` defines how a feature layer's field participates in the form.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated since 5.2. Import [FieldElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/FieldElement/) directly instead.
|
|
57
|
+
*/
|
|
54
58
|
export const FieldElement: typeof FieldElementClass;
|
|
55
59
|
|
|
56
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* `FieldElement` defines how a feature layer's field participates in the form.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated since 5.2. Import [FieldElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/FieldElement/) directly instead.
|
|
64
|
+
*/
|
|
57
65
|
export type FieldElement = FieldElementClass;
|
|
58
66
|
|
|
59
67
|
/**
|
|
60
68
|
* `GroupElement` defines a container that holds a set of form elements
|
|
61
69
|
* that can be expanded, collapsed, or displayed together.
|
|
70
|
+
*
|
|
71
|
+
* @deprecated since 5.2. Import [GroupElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/GroupElement/) directly instead.
|
|
62
72
|
*/
|
|
63
73
|
export const GroupElement: typeof GroupElementClass;
|
|
64
74
|
|
|
65
75
|
/**
|
|
66
76
|
* `GroupElement` defines a container that holds a set of form elements
|
|
67
77
|
* that can be expanded, collapsed, or displayed together.
|
|
78
|
+
*
|
|
79
|
+
* @deprecated since 5.2. Import [GroupElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/GroupElement/) directly instead.
|
|
68
80
|
*/
|
|
69
81
|
export type GroupElement = GroupElementClass;
|
|
70
82
|
|
|
71
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* `RelationshipElement` defines how a relationship between [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) and [Map.tables](https://developers.arcgis.com/javascript/latest/references/core/Map/#tables) participates in the [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/).
|
|
85
|
+
*
|
|
86
|
+
* @deprecated since 5.2. Import [RelationshipElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/RelationshipElement/) directly instead.
|
|
87
|
+
*/
|
|
72
88
|
export const RelationshipElement: typeof RelationshipElementClass;
|
|
73
89
|
|
|
74
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* `RelationshipElement` defines how a relationship between [feature layers](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) and [Map.tables](https://developers.arcgis.com/javascript/latest/references/core/Map/#tables) participates in the [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/).
|
|
92
|
+
*
|
|
93
|
+
* @deprecated since 5.2. Import [RelationshipElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/RelationshipElement/) directly instead.
|
|
94
|
+
*/
|
|
75
95
|
export type RelationshipElement = RelationshipElementClass;
|
|
76
96
|
|
|
77
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* `TextElement` form element is used to define descriptive text as an element within a layer or [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/) [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/) and can be used to aid those entering or updating information.
|
|
99
|
+
*
|
|
100
|
+
* @deprecated since 5.2. Import [TextElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/TextElement/) directly instead.
|
|
101
|
+
*/
|
|
78
102
|
export const TextElement: typeof TextElementClass;
|
|
79
103
|
|
|
80
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* `TextElement` form element is used to define descriptive text as an element within a layer or [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/) [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/) and can be used to aid those entering or updating information.
|
|
106
|
+
*
|
|
107
|
+
* @deprecated since 5.2. Import [TextElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/TextElement/) directly instead.
|
|
108
|
+
*/
|
|
81
109
|
export type TextElement = TextElementClass;
|
|
82
110
|
|
|
83
111
|
/**
|
|
84
112
|
* `AttachmentElement` defines how one or more attachments can participate in the form. When present in the form, the user has the ability to upload an attachment specific to the form element.
|
|
85
113
|
*
|
|
114
|
+
* @deprecated since 5.2. Import [AttachmentElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) directly instead.
|
|
86
115
|
* @since 5.1
|
|
87
116
|
*/
|
|
88
117
|
export const AttachmentElement: typeof AttachmentElementClass;
|
|
@@ -90,12 +119,21 @@ export const AttachmentElement: typeof AttachmentElementClass;
|
|
|
90
119
|
/**
|
|
91
120
|
* `AttachmentElement` defines how one or more attachments can participate in the form. When present in the form, the user has the ability to upload an attachment specific to the form element.
|
|
92
121
|
*
|
|
122
|
+
* @deprecated since 5.2. Import [AttachmentElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) directly instead.
|
|
93
123
|
* @since 5.1
|
|
94
124
|
*/
|
|
95
125
|
export type AttachmentElement = AttachmentElementClass;
|
|
96
126
|
|
|
97
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* `UtilityNetworkAssociationsElement` defines how utility network associations can participate in the form.
|
|
129
|
+
*
|
|
130
|
+
* @deprecated since 5.2. Import [UtilityNetworkAssociationsElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/UtilityNetworkAssociationsElement/) directly instead.
|
|
131
|
+
*/
|
|
98
132
|
export const UtilityNetworkAssociationsElement: typeof UtilityNetworkAssociationsElementClass;
|
|
99
133
|
|
|
100
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* `UtilityNetworkAssociationsElement` defines how utility network associations can participate in the form.
|
|
136
|
+
*
|
|
137
|
+
* @deprecated since 5.2. Import [UtilityNetworkAssociationsElement](https://developers.arcgis.com/javascript/latest/references/core/form/elements/UtilityNetworkAssociationsElement/) directly instead.
|
|
138
|
+
*/
|
|
101
139
|
export type UtilityNetworkAssociationsElement = UtilityNetworkAssociationsElementClass;
|
package/form/elements.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./elements/AttachmentElement.js";import
|
|
2
|
+
import{deprecatedModule as e}from"../core/deprecate.js";import t from"../core/Logger.js";import n from"./elements/AttachmentElement.js";import r from"./elements/FieldElement.js";import i from"./elements/GroupElement.js";import a from"./elements/RelationshipElement.js";import o from"./elements/TextElement.js";import s from"./elements/UtilityNetworkAssociationsElement.js";e(t.getLogger(`esri.form.elements`),`esri.form.elements`,{replacement:`Individual element module imports`,version:`5.2`,warnOnce:!0});const c=r,l=i,u=a,d=o,f=n,p=s;export{f as AttachmentElement,c as FieldElement,l as GroupElement,u as RelationshipElement,d as TextElement,p as UtilityNetworkAssociationsElement};
|
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.0-next.
|
|
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.0-next.159`;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};
|
package/layers/GeoJSONLayer.d.ts
CHANGED
|
@@ -648,7 +648,7 @@ export interface GeoJSONLayerEvents extends EditBusLayerEvents, RefreshableLayer
|
|
|
648
648
|
*
|
|
649
649
|
* @since 4.11
|
|
650
650
|
* @see [Sample - Add GeoJSONLayer to your Map](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson/)
|
|
651
|
-
* @see [Sample - Filter features with
|
|
651
|
+
* @see [Sample - Filter features with Time Bar component](https://developers.arcgis.com/javascript/latest/sample-code/time-bar-filter/)
|
|
652
652
|
* @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/)
|
|
653
653
|
* @see [Query and filter guide](https://developers.arcgis.com/javascript/latest/query-filter/)
|
|
654
654
|
* @see [GeoJSONLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/GeoJSONLayerView/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{idToReadableName as e,idToWritableName as t,writableNameToId as n}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as r}from"../../core/accessorSupport/utils.js";import{isFeatureServiceLayer as i}from"./layerUtils.js";const a=e=>e.type===`feature`&&!e.isTable,o={feature:{predicate:i,propertyGroups:[{id:`attribute-table-template`,properties:[`attributeTableTemplate`]},{id:`blend-mode`,properties:[`blendMode`],predicate:a},{id:`charts`,properties:[`charts`]},{id:`custom-parameters`,properties:[`customParameters`]},{id:`definition-expression`,properties:[`definitionExpression`]},{id:`display-filter`,properties:[`displayFilterInfo`,`displayFilterEnabled`],predicate:a},{id:`effect`,properties:[`effect`,`featureEffect`],predicate:a},{id:`feature-reduction`,properties:[`featureReduction`],predicate:a},{id:`field-configurations`,property:`fieldConfigurations`,dependency:`popupTemplate`},{id:`floor-info`,properties:[`floorInfo`],predicate:a},{id:`form-template`,properties:[`formTemplate`]},{id:`labels`,properties:[`labelingInfo`,`labelsVisible`],predicate:a},{id:`legend-enabled`,properties:[`legendEnabled`],predicate:a},{id:`opacity`,properties:[`opacity`],predicate:a},{id:`order-by`,properties:[`orderBy`],predicate:a},{id:`popup`,properties:[`popupTemplate`,`popupEnabled`]},{id:`refresh-interval`,properties:[`refreshInterval`]},{id:`renderer`,properties:[`renderer`],predicate:a},{id:`scale-range`,properties:[`minScale`,`maxScale`],predicate:a},{id:`use-view-time`,properties:[`useViewTime`]},{id:`visibility-time-extent`,properties:[`visibilityTimeExtent`],predicate:a}]}};function s(e){return o[e.type]?.propertyGroups.filter(t=>!t.predicate||t.predicate(e))??[]}function c(e){return`dependency`in e}function l(e){let t=s(e),n=[];for(let e of t)c(e)?n.push(e.property):n.push(...e.properties);return n}function u(e,t,n){return e.originIdOf(t)<n?`source`:`overridden`}function d(e,t,n,r){return u(e,e.originIdOf(t)===1?r:t,n)}function f(e,t,r){let i=n(r),a=[],o=[];if(c(t)){let{property:n,dependency:r}=t;o.push(d(e,n,i,r)),a.push(n)}else{let{properties:n}=t;o.push(...n.map(t=>u(e,t,i))),a.push(...n)}return{id:t.id,properties:a,status:o.reduce((e,t)=>e===t?e:`overridden`)}}function p(t,r,i){let a=n(i);t.revertToOrigin(r,e(a-1))}function m(e,t,n){let i=e.originIdOf(t);i!==1&&(p(e,t,n),i=e.originIdOf(t),i<2&&r(e)?.clearOverride(t))}function h(e,r,i){let a=n(i),o=e.originIdOf(r);o<a&&o!==1&&e.updateOrigin(r,t(a))}function g(e){let t=o[e.type];return!(!t||t.predicate&&!t.predicate(e))}function _(e,t){if(!g(e))return;let n=s(e).map(n=>f(e,n,t));return{propertyGroupOriginInfos:n,status:n.map(e=>e.status).reduce((e,t)=>e===t?e:`mixed`)}}function v(e,t){if(g(e))for(let n of s(e))if(c(n))m(e,n.property,t);else for(let r of n.properties)p(e,r,t)}function y(e,t){if(!g(e))return;let n=l(e);for(let r of n)h(e,r,t)}export{v as clearOverrides,y as disconnectFromSource,_ as getLayerOriginInfo,g as isSupportedLayer};
|
|
2
|
+
import{idToReadableName as e,idToWritableName as t,writableNameToId as n}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as r}from"../../core/accessorSupport/utils.js";import{isFeatureServiceLayer as i}from"./layerUtils.js";const a=e=>e.type===`feature`&&!e.isTable,o={feature:{predicate:i,propertyGroups:[{id:`attribute-table-template`,properties:[`attributeTableTemplate`]},{id:`blend-mode`,properties:[`blendMode`],predicate:a},{id:`charts`,properties:[`charts`]},{id:`custom-parameters`,properties:[`customParameters`]},{id:`data-series`,properties:[`dataSeriesInfos`],predicate:a},{id:`definition-expression`,properties:[`definitionExpression`]},{id:`display-filter`,properties:[`displayFilterInfo`,`displayFilterEnabled`],predicate:a},{id:`effect`,properties:[`effect`,`featureEffect`],predicate:a},{id:`feature-reduction`,properties:[`featureReduction`],predicate:a},{id:`field-configurations`,property:`fieldConfigurations`,dependency:`popupTemplate`},{id:`floor-info`,properties:[`floorInfo`],predicate:a},{id:`form-template`,properties:[`formTemplate`]},{id:`labels`,properties:[`labelingInfo`,`labelsVisible`],predicate:a},{id:`legend-enabled`,properties:[`legendEnabled`],predicate:a},{id:`opacity`,properties:[`opacity`],predicate:a},{id:`order-by`,properties:[`orderBy`],predicate:a},{id:`popup`,properties:[`popupTemplate`,`popupEnabled`]},{id:`refresh-interval`,properties:[`refreshInterval`]},{id:`renderer`,properties:[`renderer`,`symbolLayerDrawing`],predicate:a},{id:`scale-range`,properties:[`minScale`,`maxScale`],predicate:a},{id:`use-view-time`,properties:[`useViewTime`,`timeInfo`]},{id:`visibility-time-extent`,properties:[`visibilityTimeExtent`],predicate:a}]}};function s(e){return o[e.type]?.propertyGroups.filter(t=>!t.predicate||t.predicate(e))??[]}function c(e){return`dependency`in e}function l(e){let t=s(e),n=[];for(let e of t)c(e)?n.push(e.property):n.push(...e.properties);return n}function u(e,t,n){return e.originIdOf(t)<n?`source`:`overridden`}function d(e,t,n,r){return u(e,e.originIdOf(t)===1?r:t,n)}function f(e,t,r){let i=n(r),a=[],o=[];if(c(t)){let{property:n,dependency:r}=t;o.push(d(e,n,i,r)),a.push(n)}else{let{properties:n}=t;o.push(...n.map(t=>u(e,t,i))),a.push(...n)}return{id:t.id,properties:a,status:o.reduce((e,t)=>e===t?e:`overridden`)}}function p(t,r,i){let a=n(i);t.revertToOrigin(r,e(a-1))}function m(e,t,n){let i=e.originIdOf(t);i!==1&&(p(e,t,n),i=e.originIdOf(t),i<2&&r(e)?.clearOverride(t))}function h(e,r,i){let a=n(i),o=e.originIdOf(r);o<a&&o!==1&&e.updateOrigin(r,t(a))}function g(e){let t=o[e.type];return!(!t||t.predicate&&!t.predicate(e))}function _(e,t){if(!g(e))return;let n=s(e).map(n=>f(e,n,t));return{propertyGroupOriginInfos:n,status:n.map(e=>e.status).reduce((e,t)=>e===t?e:`mixed`)}}function v(e,t){if(g(e))for(let n of s(e))if(c(n))m(e,n.property,t);else for(let r of n.properties)p(e,r,t)}function y(e,t){if(!g(e))return;let n=l(e);for(let r of n)h(e,r,t)}export{v as clearOverrides,y as disconnectFromSource,_ as getLayerOriginInfo,g as isSupportedLayer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.159",
|
|
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,9 +20,9 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.20.8",
|
|
23
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
23
|
+
"@arcgis/toolkit": "5.2.0-next.159",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
|
|
25
|
-
"@esri/calcite-components": "^5.2.0
|
|
25
|
+
"@esri/calcite-components": "^5.2.0",
|
|
26
26
|
"@vaadin/grid": "~25.3.2",
|
|
27
27
|
"@zip.js/zip.js": "~2.23.0",
|
|
28
28
|
"luxon": "~3.7.2",
|
package/popup/FeaturesModel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],(e,t)=>this._updateFeatureModels(t?.[1]??-1),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=x(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e,t){let n=[],r=new Map;if(this.featureModels.forEach((t,i)=>{let a=t?.graphic;if(!a||t.destroyed)t.destroy();else if(e[i]===a)n[i]=t;else{let e=r.get(a);e?e.push(t):r.set(a,[t])}}),!r.size)return n;for(let e of r.values())e.reverse();for(let t=0;t<e.length&&r.size;t++){if(n[t])continue;let i=e[t],a=r.get(i);a&&(n[t]=a.pop(),a.length||r.delete(i))}let i=this.selectedFeatureIndex,a=e[i],o=this.featureModels[t],s=null;for(let e of r.values())for(let t of e)t===o?s=t:t.destroy();return s&&(a&&!n[i]?(s.graphic=a,n[i]=s):s.destroy()),n}_updateFeatureModels(e){let{selectedFeature:t,features:n}=this;if(!n.length){this._destroyFeatureModels();return}let r={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},i=this._reconcileFeatureModels(n,e);i.forEach(e=>e.set(r));let a=e=>{let t=n[e];t&&!i[e]&&(i[e]=new S({...r,graphic:t}))};if(t&&a(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,n.length);for(let t=0;t<e;t++)a(t)}this._set(`featureModels`,i)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=_(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(A(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||v:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!E(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>!!this.view?.focusRegionVisible,()=>{this._initialDisplayMode===void 0&&this._syncSelectedFeatureIndex(this.features)}),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],(e,t)=>this._updateFeatureModels(t?.[1]??-1),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=x(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e,t){let n=[],r=new Map;if(this.featureModels.forEach((t,i)=>{let a=t?.graphic;if(!a||t.destroyed)t.destroy();else if(e[i]===a)n[i]=t;else{let e=r.get(a);e?e.push(t):r.set(a,[t])}}),!r.size)return n;for(let e of r.values())e.reverse();for(let t=0;t<e.length&&r.size;t++){if(n[t])continue;let i=e[t],a=r.get(i);a&&(n[t]=a.pop(),a.length||r.delete(i))}let i=this.selectedFeatureIndex,a=e[i],o=this.featureModels[t],s=null;for(let e of r.values())for(let t of e)t===o?s=t:t.destroy();return s&&(a&&!n[i]?(s.graphic=a,n[i]=s):s.destroy()),n}_updateFeatureModels(e){let{selectedFeature:t,features:n}=this;if(!n.length){this._destroyFeatureModels();return}let r={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},i=this._reconcileFeatureModels(n,e);i.forEach(e=>e.set(r));let a=e=>{let t=n[e];t&&!i[e]&&(i[e]=new S({...r,graphic:t}))};if(t&&a(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,n.length);for(let t=0;t<e;t++)a(t)}this._set(`featureModels`,i)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=_(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(A(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||v:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!E(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
|
package/time/TimeExtent.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export default class TimeExtent extends JSONSupport {
|
|
|
87
87
|
* @param unit - The time unit to align the start and end dates.
|
|
88
88
|
* @param timeZone - The time zone in which progressing will occur. The default is "system".
|
|
89
89
|
* @returns A new expanded TimeExtent.
|
|
90
|
-
* @see [Sample - Time
|
|
90
|
+
* @see [Sample - Time Bar component](https://developers.arcgis.com/javascript/latest/sample-code/time-bar/)
|
|
91
91
|
* @example
|
|
92
92
|
* // Expand a time extent to a decade.
|
|
93
93
|
* const extent = new TimeExtent({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{nextPowerOfTwo as e}from"../../../../../../../core/mathUtils.js";import{create as t}from"../../../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getDefinesKey as r}from"../../../../vectorTiles/shaders/vtlMaterialUtils.js";import{vtlTextureBindingUnitSprites as i,vtlHighResCutoff as a}from"../../../definitions.js";import{Mesh as o}from"../../../meshing/Mesh.js";import{simplePipelineState as s}from"../../utils.js";import{Technique as c}from"../Technique.js";import{VTLShaderBackground as l}from"../shaders/vector-tiles/VTLShaderBackground.js";import{PrimitiveType as u}from"../../../../../../webgl/enums.js";function d(e,t){return{color:e.getPaintValue(`background-color`,t),opacity:e.getPaintValue(`background-opacity`,t),pattern:e.getPaintValue(`background-pattern`,Math.floor(t))}}class f extends c{constructor(){super(...arguments),this.type=38,this._color=n(1,0,0,1),this._patternMatrix=t(),this._mesh=null,this.shaders={background:new l}}render(n,o){if(o.tiles.length===0)return;this._loadResources(n);let{context:c,displayLevel:l,painter:u,spriteMosaic:f,styleLayer:p}=n,m=p,h=m.backgroundMaterial,{color:g,opacity:_,pattern:v}=d(m,l),y=v!==void 0,b=window.devicePixelRatio|1,x,S,C=h.key+r({hasPattern:y}),w=b>a?2:1,T={layerInfo:{depth:m.z,coordRange:o.tiles[0].rangeX},solidColor:null,pattern:null,patternMat:{mat:t()}},E=null;if(y){let e=f.getMosaicItemPosition(v,!0);if(e!=null){let{tl:t,br:n,page:r}=e;x=n[0]-t[0],S=n[1]-t[1];let a=f.getPageSize(r);a!=null&&(f.bind(c,9729,r,i),T.pattern={tlbr:[t[0],t[1],n[0],n[1]],mosaicSize:a,opacity:_},E={patternTexture:{texture:f.getTexture(r),unit:i}})}else return}else{let e=g[3]*_;this._color[0]=e*g[0],this._color[1]=e*g[1],this._color[2]=e*g[2],this._color[3]=e,T.solidColor={color:this._color}}u.setPipelineState(s);for(let t of o.tiles){if(T.layerInfo.coordRange=t.rangeX,y){let
|
|
2
|
+
import{nextPowerOfTwo as e}from"../../../../../../../core/mathUtils.js";import{create as t}from"../../../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{getDefinesKey as r}from"../../../../vectorTiles/shaders/vtlMaterialUtils.js";import{vtlTextureBindingUnitSprites as i,vtlHighResCutoff as a}from"../../../definitions.js";import{Mesh as o}from"../../../meshing/Mesh.js";import{simplePipelineState as s}from"../../utils.js";import{Technique as c}from"../Technique.js";import{VTLShaderBackground as l}from"../shaders/vector-tiles/VTLShaderBackground.js";import{PrimitiveType as u}from"../../../../../../webgl/enums.js";function d(e,t){return{color:e.getPaintValue(`background-color`,t),opacity:e.getPaintValue(`background-opacity`,t),pattern:e.getPaintValue(`background-pattern`,Math.floor(t))}}class f extends c{constructor(){super(...arguments),this.type=38,this._color=n(1,0,0,1),this._patternMatrix=t(),this._mesh=null,this.shaders={background:new l}}render(n,o){if(o.tiles.length===0)return;this._loadResources(n);let{context:c,displayLevel:l,painter:u,spriteMosaic:f,styleLayer:p}=n,m=p,h=m.backgroundMaterial,{color:g,opacity:_,pattern:v}=d(m,l),y=v!==void 0,b=window.devicePixelRatio|1,x,S,C=h.key+r({hasPattern:y}),w=b>a?2:1,T={layerInfo:{depth:m.z,coordRange:o.tiles[0].rangeX},solidColor:null,pattern:null,patternMat:{mat:t()}},E=null;if(y){let e=f.getMosaicItemPosition(v,!0);if(e!=null){let{tl:t,br:n,page:r}=e;x=n[0]-t[0],S=n[1]-t[1];let a=f.getPageSize(r);a!=null&&(f.bind(c,9729,r,i),T.pattern={tlbr:[t[0],t[1],n[0],n[1]],mosaicSize:a,opacity:_},E={patternTexture:{texture:f.getTexture(r),unit:i}})}else return}else{let e=g[3]*_;this._color[0]=e*g[0],this._color[1]=e*g[1],this._color[2]=e*g[2],this._color[3]=e,T.solidColor={color:this._color}}u.setPipelineState(s);for(let t of o.tiles){if(T.layerInfo.coordRange=t.rangeX,y){let n=Math.max(2**(Math.floor(l)-t.key.level),1),r=w*t.width*n,i=r/e(x),a=r/e(S);this._patternMatrix[0]=i,this._patternMatrix[4]=a,T.patternMat={mat:this._patternMatrix}}t.bind(c);let n={shader:this.shaders.background,uniforms:T,textures:E,defines:{renderMode:+!!y},optionalAttributes:h.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:h.getPrecisionFactors(),materialKey:C};u.submitDrawMeshUntyped(c,n,this._mesh,{stencilRef:t.stencilRef})}}shutdown(){this._mesh&&=(this._mesh.destroy(),null)}_loadResources(e){if(this._mesh)return;let{context:t,styleLayer:n}=e,r=n,i=new Int16Array([0,0,1,0,0,1,1,1]),a=r.backgroundMaterial.geometryLayout;if(!a)return;let s={vertex:{geometryVB:{data:i,layout:a}},groups:[{primitive:u.TRIANGLE_STRIP}],parts:[{group:0,start:0,count:4}]};this._mesh=new o(t,s)}}export{f as VTLTechniqueBackground,d as getBackgroundPaintValues};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{getDefinesKey as e}from"../../../../vectorTiles/shaders/vtlMaterialUtils.js";import{vtlTextureBindingUnitSprites as t,vtlHighResCutoff as n}from"../../../definitions.js";import{Technique as r}from"../Technique.js";import{VTLShaderFill as i}from"../shaders/vector-tiles/VTLShaderFill.js";import{VTLShaderOutline as a}from"../shaders/vector-tiles/VTLShaderOutline.js";const o=1/65536;class s extends r{constructor(){super(...arguments),this.type=40,this._fillMesh=null,this._outlineMesh=null,this.shaders={fill:new i,outline:new a}}shutdown(){this._fillMesh=null,this._outlineMesh=null}render(e,t){let{displayLevel:n,is3D:r,renderPass:i,spriteMosaic:a,styleLayer:o,styleLayerUID:s}=e,{tiles:c}=t,l=!1;for(let e of c)if(e.layerData.has(s)){let t=e.layerData.get(s);if(t.fillIndexCount>0||t.outlineIndexCount>0){l=!0;break}}if(!l)return;let u=o,d=u.getPaintProperty(`fill-pattern`),f=d!==void 0,p=f&&d.isDataDriven,m;if(f&&!p){let e=d.getValue(n);m=a.getMosaicItemPosition(e,!0)}let h=!f&&u.getPaintValue(`fill-antialias`,n),g=!r||f,_=1;if(!f){let e=u.getPaintProperty(`fill-color`),t=u.getPaintProperty(`fill-opacity`);if(!e?.isDataDriven&&!t?.isDataDriven){let e=u.getPaintValue(`fill-color`,n);_=u.getPaintValue(`fill-opacity`,n)*e[3],_<1&&(g=!0)}}if((u.hasDataDrivenColor||u.hasDataDrivenOpacity)&&(g=!0),g&&i===`opaque`)return;let v=u.getPaintValue(`fill-translate`,n),y=u.getPaintValue(`fill-translate-anchor`,n);(i===`opaque`&&!g||i===`translucent`&&g)&&this._drawFill(e,s,u,c,v,y,f,m,p);let b=!u.hasDataDrivenOutlineColor&&u.outlineUsesFillColor&&_<1;h&&i===`translucent`&&!b&&this._drawOutline(e,s,u,c,v,y)}_drawFill(r,i,a,s,c,l,u,d,f){if(u&&!f&&d==null)return;let{context:p,displayLevel:m,drawPhase:h,painter:g,pixelRatio:_,spriteMosaic:v}=r,y=_>n?2:1,b=a.fillMaterial,x=l===1,S={config:{depth:a.z+o,fillTranslation:c,tileOpacity:1},patternOptions:f||u&&d!=null?{mosaicSize:[0,0],patternFactor:1,tlbr:[0,0,0,0]}:null,color:null,opacity:null,colorMix:null,opacityMix:null},C={patternTexture:null},w={fillType:+!!u,translateAnchorViewport:x},T=b.key+e(w);if(d!=null){let{page:e,tl:n,br:r}=d,i=n[0],a=r[1],o=r[0],s=n[1],c=v.getPageSize(e);c!=null&&(v.bind(p,9729,e,t),S.patternOptions={mosaicSize:[c[0],c[1]],patternFactor:1,tlbr:[i,a,o,s]},C.patternTexture={texture:v.getTexture(e),unit:t})}let E=-1;for(let e of s){if(!e.layerData.has(i))continue;if(e.key.level!==E){E=e.key.level;let t=b.getUniforms();for(let e of t){let t=e.getValue(a,m,E,v);S[e.name]={value:t}}if(u&&S.patternOptions!=null){let t=Math.
|
|
2
|
+
import{getDefinesKey as e}from"../../../../vectorTiles/shaders/vtlMaterialUtils.js";import{vtlTextureBindingUnitSprites as t,vtlHighResCutoff as n}from"../../../definitions.js";import{Technique as r}from"../Technique.js";import{VTLShaderFill as i}from"../shaders/vector-tiles/VTLShaderFill.js";import{VTLShaderOutline as a}from"../shaders/vector-tiles/VTLShaderOutline.js";const o=1/65536;class s extends r{constructor(){super(...arguments),this.type=40,this._fillMesh=null,this._outlineMesh=null,this.shaders={fill:new i,outline:new a}}shutdown(){this._fillMesh=null,this._outlineMesh=null}render(e,t){let{displayLevel:n,is3D:r,renderPass:i,spriteMosaic:a,styleLayer:o,styleLayerUID:s}=e,{tiles:c}=t,l=!1;for(let e of c)if(e.layerData.has(s)){let t=e.layerData.get(s);if(t.fillIndexCount>0||t.outlineIndexCount>0){l=!0;break}}if(!l)return;let u=o,d=u.getPaintProperty(`fill-pattern`),f=d!==void 0,p=f&&d.isDataDriven,m;if(f&&!p){let e=d.getValue(n);m=a.getMosaicItemPosition(e,!0)}let h=!f&&u.getPaintValue(`fill-antialias`,n),g=!r||f,_=1;if(!f){let e=u.getPaintProperty(`fill-color`),t=u.getPaintProperty(`fill-opacity`);if(!e?.isDataDriven&&!t?.isDataDriven){let e=u.getPaintValue(`fill-color`,n);_=u.getPaintValue(`fill-opacity`,n)*e[3],_<1&&(g=!0)}}if((u.hasDataDrivenColor||u.hasDataDrivenOpacity)&&(g=!0),g&&i===`opaque`)return;let v=u.getPaintValue(`fill-translate`,n),y=u.getPaintValue(`fill-translate-anchor`,n);(i===`opaque`&&!g||i===`translucent`&&g)&&this._drawFill(e,s,u,c,v,y,f,m,p);let b=!u.hasDataDrivenOutlineColor&&u.outlineUsesFillColor&&_<1;h&&i===`translucent`&&!b&&this._drawOutline(e,s,u,c,v,y)}_drawFill(r,i,a,s,c,l,u,d,f){if(u&&!f&&d==null)return;let{context:p,displayLevel:m,drawPhase:h,painter:g,pixelRatio:_,spriteMosaic:v}=r,y=_>n?2:1,b=a.fillMaterial,x=l===1,S={config:{depth:a.z+o,fillTranslation:c,tileOpacity:1},patternOptions:f||u&&d!=null?{mosaicSize:[0,0],patternFactor:1,tlbr:[0,0,0,0]}:null,color:null,opacity:null,colorMix:null,opacityMix:null},C={patternTexture:null},w={fillType:+!!u,translateAnchorViewport:x},T=b.key+e(w);if(d!=null){let{page:e,tl:n,br:r}=d,i=n[0],a=r[1],o=r[0],s=n[1],c=v.getPageSize(e);c!=null&&(v.bind(p,9729,e,t),S.patternOptions={mosaicSize:[c[0],c[1]],patternFactor:1,tlbr:[i,a,o,s]},C.patternTexture={texture:v.getTexture(e),unit:t})}let E=-1;for(let e of s){if(!e.layerData.has(i))continue;if(e.key.level!==E){E=e.key.level;let t=b.getUniforms();for(let e of t){let t=e.getValue(a,m,E,v);S[e.name]={value:t}}if(u&&S.patternOptions!=null){let t=Math.max(2**(Math.floor(m)-e.key.level),1),n=e.rangeX/(y*e.width*t);S.patternOptions.patternFactor=n}}let n=e.layerData.get(i);if(n.isDestroyed||n.fillIndexCount===0||(this._fillMesh=n.getMesh(p,{value:0}),!this._fillMesh))continue;let{config:r}=S;r.tileOpacity=h===1?e.fader.value():1,e.bind(p);let o={shader:this.shaders.fill,uniforms:S,textures:C,defines:w,optionalAttributes:b.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:b.getPrecisionFactors(),materialKey:T};if(f){let r=S.patternOptions,i=n.patternMap;if(!i||r==null)continue;let a=0;for(let[n,s]of i){let i=v.getPageSize(n);i!=null&&(v.bind(p,9729,n,t),r.mosaicSize=i,C.patternTexture={texture:v.getTexture(n),unit:t},g.submitDrawMeshUntyped(p,o,this._fillMesh,{stencilRef:e.stencilRef,parts:[a++]}))}}else g.submitDrawMeshUntyped(p,o,this._fillMesh,{stencilRef:e.stencilRef});e.triangleCount+=n.fillIndexCount/3}}_drawOutline(t,n,r,i,a,s){let{context:c,displayLevel:l,spriteMosaic:u,painter:d,pixelRatio:f}=t,p=r.outlineMaterial,m={translateAnchorViewport:s===1},h=p.key+e(m),g=.75/f,_={config:{depth:r.z+o,fillTranslation:a,outlineWidth:g},color:null,opacity:null,colorMix:null,opacityMix:null},v=-1;for(let e of i){if(!e.layerData.has(n))continue;if(e.key.level!==v){v=e.key.level;let t=p.getUniforms();for(let e of t){let t=e.getValue(r,l,v,u);e.name in _&&(_[e.name]={value:t})}}let t=e.layerData.get(n);if(t.isDestroyed||t.outlineIndexCount===0||(this._outlineMesh=t.getMesh(c,{value:1}),this._outlineMesh==null))continue;e.bind(c);let i={shader:this.shaders.outline,uniforms:_,textures:{},defines:m,optionalAttributes:p.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:p.getPrecisionFactors(),materialKey:h};d.submitDrawMeshUntyped(c,i,this._outlineMesh,{stencilRef:e.stencilRef}),e.triangleCount+=t.outlineIndexCount/3}}}export{s as VTLTechniqueFill};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Handles.js";import{destroyHandle as i,handlesGroup as a}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as o}from"../../../../core/lang.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as c,destroyMaybe as l}from"../../../../core/maybe.js";import{memoize as u}from"../../../../core/memoize.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as f,watch as p,sync as m,syncAndInitial as h,when as g}from"../../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../../core/accessorSupport/decorators.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Point.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,applyConstraint as ee,computeConstraint as te,constraintDependencies as ne}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as re,LengthDimensionPointManipulator as w,pointManipulatorHandles as T,createOffsetManipulator as E,offsetManipulatorHandles as D,LineOfSightOrientationManipulator as O,headingManipulatorHandles as k,rotationManipulatorHandles as A,createMeasureTypeManipulator as j,measureTypeManipulatorHandles as M,updateOffsetManipulatorTransform as N,updateHeadingManipulatorTransform as P,updateRotationManipulatorTransform as F,updateMeasureTypeManipulatorTransform as I,unfocusedOffsetWidth as L,focusedOffsetWidth as R}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as z,arePointsVerticallyAligned as B,computationToGeometryDependencies as V,computeGeometryFromDimension as H}from"./lengthDimensionUtils.js";import{disabledPointColor as U,pointRadius as ie,getTransparentAccentColor as W,getContrastColor as G,initialOffsetPx as K}from"./settings.js";import{getRotateHeadingTexture as q}from"../images/Factory.js";import{SnappingVisualizer3D as J}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as ae}from"../../interactive/visualElements/VerticesVisualElement.js";import{Parameters as oe,ImageMaterial as se}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as X}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as ce}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as Z}from"../../../interactive/coordinateHelper.js";import{EditGeometry as le}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as ue}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as de}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as fe}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as pe}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as me}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as he}from"../../../interactive/snapping/snappingUtils.js";let Q=class extends n{constructor(e){super(e),this._stagedDimension=null,this._snappingManagerResult=null,this._computationManipulators=new Map,this._computationHandles=new r,this._updatingHandles=new b,this._getSnappingContext=u(e=>new de({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new ue(new le(`point`,Z(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new J}));let{view:t}=e;this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:X(2)}),this._constraintSnappingIndicator=new Y({view:t,attached:!0,width:1,renderOccluded:4,stipplePattern:X(5),isDecoration:!0});let n=U.toUnitRGBA();this._stagedStartIndicator=new ae({view:t,attached:!1,elevationInfo:{mode:`absolute-height`,offset:0},spatialReference:e.view.renderCoordsHelper.spatialReference,color:n,size:ie*2,outlineSize:0,renderOccluded:4,isDecoration:!0})}initialize(){let{view:e}=this;this._snappingOperation=new me({view:e});let t=W(e.effectiveTheme),n=G(e.effectiveTheme),r=!e.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r});let a=new oe(this._textureHandle.managedTexture,!1);a.renderOccluded=16,a.isDecoration=!0,this._orientationManipulatorMaterial=new se(a);let o=s(()=>this.analysisViewData.computations,({computation:e})=>this._createManipulators(e));this.addHandles([this._updatingHandles.add(()=>({accentColor:W(e.effectiveTheme),contrastColor:G(e.effectiveTheme)}),({accentColor:t,contrastColor:n})=>{let i=this._textureHandle;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r}),this._orientationManipulatorMaterial.setParameters({managedTexture:this._textureHandle.managedTexture}),i?.release();let a=t.toUnitRGBA();this._unfocusedOffsetManipulatorMaterial.setParameters({color:a}),this._focusedOffsetManipulatorMaterial.setParameters({color:a}),this._thinOffsetManipulatorMaterial.setParameters({color:a}),this._constraintSnappingIndicator.color=a},f),i(o),p(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:e,stagedComputation:t})=>{if(t==null||e==null)return;let n=S(e,new x);this._applyPointUpdate(t,{endPoint:n})},m),p(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(e,t)=>{let{stagedDimension:n,selectedComputation:r,firstGrabbedManipulator:i}=e;if(n!==t?.stagedDimension||i!==t?.firstGrabbedManipulator){for(let[t,n]of this._computationManipulators)this._updateManipulators(t,n,e);return}for(let n of[r,t?.selectedComputation])if(n!=null){let t=this._computationManipulators.get(n);t!=null&&this._updateManipulators(n,t,e)}},h),this._updatingHandles.add(()=>this.analysis.style.lineSize,e=>this._updateManipulatorStyle(e),f),this._updatingHandles.add(()=>this.view.state.camera,()=>{this._stagedComputation!=null&&this._updateStagedDimensionOffset(this._stagedComputation)}),this._updatingHandles.add(()=>{let e=this._stagedComputation;if(!e)return null;let t=e.elevationAlignedStartPoint,n=y();return t!=null&&this.view.renderCoordsHelper.toRenderCoords(t,n)?n:null},e=>{e==null?this._stagedStartIndicator.attached=!1:(this._stagedStartIndicator.vertices=[e],this._stagedStartIndicator.attached=!0)})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),he(this,()=>{let e=this._activeComputation,t=this._stagedComputation;if(e==null||t!=null){let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(d(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}if(e!=null){let{start:t,end:n}=this._computationManipulators.get(e);if(t.grabbing||n.grabbing){let n=t.grabbing?`start`:`end`,r=this._computeConstraint(e);C(e,n,{constraint:r,view:this.view})}}})}destroy(){this._textureHandle=c(this._textureHandle),this._snappingOperation=l(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy()}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager?.options}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){return this._snappingManagerResult||(this._snappingManagerResult=pe(this.view),this.addHandles(this._snappingManagerResult)),this._snappingManagerResult.snappingManager}get _activeComputation(){if(this._stagedComputation!=null)return this._stagedComputation;let{selectedComputation:e}=this.analysisViewData;return this.hasGrabbedManipulators&&e!=null?e:null}get _stagedComputation(){let e=this._stagedDimension,t=this.analysisViewData.computations.at(-1)?.computation;return e==null||t==null||t.dimension!==e?null:t}get _constraintHandles(){return[g(()=>this.analysisViewData.selectedComputation,e=>{e.previousConstraint=this._computeConstraint(e)},{...h,equals:o}),p(()=>{let e=this._activeComputation;if(e==null)return null;let{measureType:t,orientation:n}=e.dimension;return{measureType:t,orientation:n,computation:e}},(e,t)=>{if(e!=null&&t==null){let{measureType:t,orientation:n,computation:r}=e;switch(r.previousConstraint){case 0:r.preConstraintProperties={measureType:`horizontal`,orientation:0};break;case 1:r.preConstraintProperties={measureType:`vertical`,orientation:0};break;case 2:r.preConstraintProperties={measureType:`direct`,orientation:n};break;default:r.preConstraintProperties={measureType:t,orientation:n}}}e==null&&t!=null&&(t.computation.preConstraintProperties=null)},m)]}get _snappingIndicatorHandles(){let e=`snapping-indicator-event-handles`;return[this._updatingHandles.add(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:t,activeComputation:n})=>{let r=this._constraintSnappingIndicator;if(this.removeHandles(e),n==null){r.attached=!1;return}if(n===t)r.attached=!0;else{let{start:t,end:i}=this._computationManipulators.get(n),a=()=>{r.attached=t.grabbing||i.grabbing};a(),this.addHandles([t.events.on(`grab-changed`,a),i.events.on(`grab-changed`,a)],e)}}),this._updatingHandles.add(()=>{let e=this._activeComputation;return e==null?{}:{geometry:e.geometry,constraint:e.previousConstraint}},({geometry:e,constraint:t})=>{let n=this._constraintSnappingIndicator;e!=null&&t!=null&&t!==2?(n.visible=!0,n.setGeometryFromSegment(e.directSegment)):n.visible=!1})]}removeStaged(){return this._stagedDimension!=null&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(e){let{_stagedDimension:t}=this;if(t==null){let t=this._onUnstagedClick(e);return this.analysis.dimensions.add(t),null}return this._onStagedClick(e),t}onPointerMove({mapPoint:e,pointerType:t}){if(t===`touch`)return;let n=this._getSnappingContext(t);this._updatingHandles.consumePromise(d(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}onManipulatorSelectionChanged(){this.analysisViewData.selectedComputation!=null&&(this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null))}_onUnstagedClick({mapPoint:e,pointerType:n}){let r=e;if(n===`mouse`){let t=this._getSnappingContext(n);r=this._ensureSnappingManager().update({point:e,context:t})}let i=new t({startPoint:S(r,new x),endPoint:null,measureType:`horizontal`});return this._stagedDimension=i,this._resetSnappingState(),i}_onStagedClick({mapPoint:e,pointerType:t}){let n=this._stagedComputation;if(n==null)return;let r=e;if(t===`mouse`){let n=this._getSnappingContext(t);r=this._ensureSnappingManager().update({point:e,context:n})}let i=S(r,new x);this._applyPointUpdate(n,{endPoint:i}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(e){let t=this._setupPointManipulator(e,{isStart:!0}),n=this._setupPointManipulator(e,{isStart:!1}),r=this._setupOffsetManipulator(e),i=this._setupHeadingManipulator(e),o=this._setupRotationManipulator(e),s=this._setupMeasureTypeManipulator(e,`direct`),c=this._setupMeasureTypeManipulator(e,`horizontal`),l=this._setupMeasureTypeManipulator(e,`vertical`),u=new re({start:t,end:n,offset:r,heading:i,rotation:o,direct:s,horizontal:c,vertical:l});this._setupComputationToManipulatorsSync(e,u),this._computationManipulators.set(e,u),this.manipulators.addMany(u.values());let d=a(u.values().map(e=>e.events.on(`focus-changed`,()=>{u.values().some(e=>e.focused)&&this._resetSnappingState()})));return{manipulators:u,remove:()=>{d.remove(),this._computationHandles.remove(e),this._computationManipulators.delete(e);for(let e of u.values())this.manipulators.remove(e)}}}_setupComputationToManipulatorsSync(e,t){this._computationHandles.add([p(()=>e.geometry,()=>this._updateManipulators(e,t),{...h,equals:o})],e)}_setupPointManipulator(e,t){let{view:n}=this,{dimension:r}=e,i=new w(n,{metadata:r}),a=T(i,{isStart:t.isStart,createSnappingPipelineStep:e=>fe({snappingContext:this._getSnappingContext(e),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:r,onUpdate:t=>this._applyPointUpdate(e,t),view:n});return this._computationHandles.add(a,e),i}_setupOffsetManipulator(e){let{view:t}=this,n=E(t,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:e.dimension}),r=D(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupHeadingManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=k(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupRotationManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=A(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupMeasureTypeManipulator(e,t){let{view:n}=this,r=j(n,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:e.dimension}),i=M(r,{computation:e,manipulatorMeasureType:t,view:n});return this._computationHandles.add(i,e),r}_updateManipulators(e,t,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){let{stagedDimension:r,selectedComputation:i,firstGrabbedManipulator:a}=n,{start:o,end:s,offset:c,heading:l,rotation:u}=t,d=i===e,f=z(e),{dimension:p}=e;for(let e of t.values()){let t=f&&r==null&&(a==null||e===a);e===c?(e.available=t,e.selected=d):e.available=t&&d}if(!f)return;this._computeConstraint(e)==null?t.manipulatorForMeasureType(p.measureType).available=!1:t.forEachMeasureTypeManipulator(e=>e.available=!1);for(let e of[l,u])(p.measureType!==`direct`||p.offset===0)&&(e.available=!1);B(e)?u.available=!1:l.available=!1;let{geometry:m}=e;o.renderLocation=m.directSegment.startRenderSpace,s.renderLocation=m.directSegment.endRenderSpace;let{renderCoordsHelper:h}=this.view;N(c,m,h),l.available&&P(l,e,h),u.available&&F(u,e,h),t.forEachMeasureTypeManipulator((t,n)=>{t.available&&I(t,e,n,h)})}_updateManipulatorStyle(e){let t=L(e),n=R(e),r={lineSizePt:e,material:this._orientationManipulatorMaterial};for(let{offset:e,heading:t,rotation:i}of this._computationManipulators.values())e.radius=n/2,t.update(r),i.update(r);this._unfocusedOffsetManipulatorMaterial.setParameters({width:t}),this._focusedOffsetManipulatorMaterial.setParameters({width:n})}_applyPointUpdate(e,t){let{view:n}=this,r=V(e);`startPoint`in t&&(r.elevationAlignedStartPoint=t.startPoint),`endPoint`in t&&(r.elevationAlignedEndPoint=t.endPoint);let i=H(r,n.renderCoordsHelper);if(i==null)return;let a=this._computeConstraint({...r,geometry:i});ee(e,t,{...r,constraint:a,unconstrainedGeometry:i,view:n}),e===this._stagedComputation&&this._updateStagedDimensionOffset(e)}_updateStagedDimensionOffset(e){if(e.geometry==null)return;e.geometry.directSegment.eval(.5,$);let{state:t,renderCoordsHelper:n}=this.view,r=t.camera.computeScreenPixelSizeAt($);e.dimension.offset=K*r*n.unitInMeters}_computeConstraint(e){return te(ne(e,this._ensureSnappingManager().options),this.view)}_createOffsetManipulatorMaterial(e){return new ce({width:1,renderOccluded:4,writeDepth:!1,polygonOffset:3,isDecoration:!0},e.state.isGlobal)}get test(){}};e([_({constructOnly:!0})],Q.prototype,`analysis`,void 0),e([_({constructOnly:!0})],Q.prototype,`analysisViewData`,void 0),e([_({constructOnly:!0})],Q.prototype,`manipulators`,void 0),e([_({constructOnly:!0})],Q.prototype,`parentTool`,void 0),e([_({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([_({readOnly:!0})],Q.prototype,`updating`,null),e([_()],Q.prototype,`firstGrabbedManipulator`,null),e([_()],Q.prototype,`hasGrabbedManipulators`,null),e([_()],Q.prototype,`snappingOptions`,null),e([_()],Q.prototype,`_stagedDimension`,void 0),e([_()],Q.prototype,`_snappingManager`,null),e([_()],Q.prototype,`_activeComputation`,null),e([_()],Q.prototype,`_stagedComputation`,null),e([_()],Q.prototype,`_snappingManagerResult`,void 0),Q=e([v(`esri.views.3d.analysis.Dimension.LengthDimensionSubTool`)],Q);const $=y();export{Q as LengthDimensionSubTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Handles.js";import{destroyHandle as i,handlesGroup as a}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as o}from"../../../../core/lang.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as c,destroyMaybe as l}from"../../../../core/maybe.js";import{memoize as u}from"../../../../core/memoize.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as f,watch as p,sync as m,syncAndInitial as h,when as g}from"../../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../../core/accessorSupport/decorators.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Point.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,applyConstraint as ee,computeConstraint as te,constraintDependencies as ne}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as re,LengthDimensionPointManipulator as w,pointManipulatorHandles as T,createOffsetManipulator as E,offsetManipulatorHandles as D,LineOfSightOrientationManipulator as O,headingManipulatorHandles as k,rotationManipulatorHandles as A,createMeasureTypeManipulator as j,measureTypeManipulatorHandles as M,updateOffsetManipulatorTransform as N,updateHeadingManipulatorTransform as P,updateRotationManipulatorTransform as F,updateMeasureTypeManipulatorTransform as I,unfocusedOffsetWidth as L,focusedOffsetWidth as R}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as z,arePointsVerticallyAligned as B,computationToGeometryDependencies as V,computeGeometryFromDimension as H}from"./lengthDimensionUtils.js";import{disabledPointColor as U,pointRadius as ie,getTransparentAccentColor as W,getContrastColor as G,initialOffsetPx as K}from"./settings.js";import{getRotateHeadingTexture as q}from"../images/Factory.js";import{SnappingVisualizer3D as J}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as ae}from"../../interactive/visualElements/VerticesVisualElement.js";import{Parameters as oe,ImageMaterial as se}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as X}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as ce}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as Z}from"../../../interactive/coordinateHelper.js";import{EditGeometry as le}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as ue}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as de}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as fe}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquireForFeaturePlacement as pe}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as me}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as he}from"../../../interactive/snapping/snappingUtils.js";let Q=class extends n{constructor(e){super(e),this._stagedDimension=null,this._snappingManagerResult=null,this._computationManipulators=new Map,this._computationHandles=new r,this._updatingHandles=new b,this._getSnappingContext=u(e=>new de({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new ue(new le(`point`,Z(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new J}));let{view:t}=e;this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:X(2)}),this._constraintSnappingIndicator=new Y({view:t,attached:!0,width:1,renderOccluded:4,stipplePattern:X(5),isDecoration:!0});let n=U.toUnitRGBA();this._stagedStartIndicator=new ae({view:t,attached:!1,elevationInfo:{mode:`absolute-height`,offset:0},spatialReference:e.view.renderCoordsHelper.spatialReference,color:n,size:ie*2,outlineSize:0,renderOccluded:4,isDecoration:!0})}initialize(){let{view:e}=this;this._snappingOperation=new me({view:e});let t=W(e.effectiveTheme),n=G(e.effectiveTheme),r=!e.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r});let a=new oe(this._textureHandle.managedTexture,!1);a.renderOccluded=16,a.isDecoration=!0,this._orientationManipulatorMaterial=new se(a);let o=s(()=>this.analysisViewData.computations,({computation:e})=>this._createManipulators(e));this.addHandles([this._updatingHandles.add(()=>({accentColor:W(e.effectiveTheme),contrastColor:G(e.effectiveTheme)}),({accentColor:t,contrastColor:n})=>{let i=this._textureHandle;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r}),this._orientationManipulatorMaterial.setParameters({managedTexture:this._textureHandle.managedTexture}),i?.release();let a=t.toUnitRGBA();this._unfocusedOffsetManipulatorMaterial.setParameters({color:a}),this._focusedOffsetManipulatorMaterial.setParameters({color:a}),this._thinOffsetManipulatorMaterial.setParameters({color:a}),this._constraintSnappingIndicator.color=a},f),i(o),p(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:e,stagedComputation:t})=>{if(t==null||e==null)return;let n=S(e,new x);this._applyPointUpdate(t,{endPoint:n})},m),p(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(e,t)=>{let{stagedDimension:n,selectedComputation:r,firstGrabbedManipulator:i}=e;if(n!==t?.stagedDimension||i!==t?.firstGrabbedManipulator){for(let[t,n]of this._computationManipulators)this._updateManipulators(t,n,e);return}for(let n of[r,t?.selectedComputation])if(n!=null){let t=this._computationManipulators.get(n);t!=null&&this._updateManipulators(n,t,e)}},h),this._updatingHandles.add(()=>this.analysis.style.lineSize,e=>this._updateManipulatorStyle(e),f),this._updatingHandles.add(()=>this.view.state.camera,()=>{this._stagedComputation!=null&&this._updateStagedDimensionOffset(this._stagedComputation)}),this._updatingHandles.add(()=>{let e=this._stagedComputation;if(!e)return null;let t=e.elevationAlignedStartPoint,n=y();return t!=null&&this.view.renderCoordsHelper.toRenderCoords(t,n)?n:null},e=>{e==null?this._stagedStartIndicator.attached=!1:(this._stagedStartIndicator.vertices=[e],this._stagedStartIndicator.attached=!0)})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),he(this,()=>{let e=this._activeComputation,t=this._stagedComputation;if(e==null||t!=null){let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(d(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}if(e!=null){let{start:t,end:n}=this._computationManipulators.get(e);if(t.grabbing||n.grabbing){let n=t.grabbing?`start`:`end`,r=this._computeConstraint(e);C(e,n,{constraint:r,view:this.view})}}})}destroy(){this._textureHandle=c(this._textureHandle),this._snappingOperation=l(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy()}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager?.options}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){return this._snappingManagerResult||(this._snappingManagerResult=pe(this.view),this.addHandles(this._snappingManagerResult)),this._snappingManagerResult.snappingManager}get _activeComputation(){if(this._stagedComputation!=null)return this._stagedComputation;let{selectedComputation:e}=this.analysisViewData;return this.hasGrabbedManipulators&&e!=null?e:null}get _stagedComputation(){let e=this._stagedDimension,t=this.analysisViewData.computations.at(-1)?.computation;return e==null||t==null||t.dimension!==e?null:t}get _constraintHandles(){return[g(()=>this.analysisViewData.selectedComputation,e=>{e.previousConstraint=this._computeConstraint(e)},{...h,equals:o}),p(()=>{let e=this._activeComputation;if(e==null)return null;let{measureType:t,orientation:n}=e.dimension;return{measureType:t,orientation:n,computation:e}},(e,t)=>{if(e!=null&&t==null){let{measureType:t,orientation:n,computation:r}=e;switch(r.previousConstraint){case 0:r.preConstraintProperties={measureType:`horizontal`,orientation:0};break;case 1:r.preConstraintProperties={measureType:`vertical`,orientation:0};break;case 2:r.preConstraintProperties={measureType:`direct`,orientation:n};break;default:r.preConstraintProperties={measureType:t,orientation:n}}}e==null&&t!=null&&(t.computation.preConstraintProperties=null)},m)]}get _snappingIndicatorHandles(){let e=`snapping-indicator-event-handles`;return[this._updatingHandles.add(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:t,activeComputation:n})=>{let r=this._constraintSnappingIndicator;if(this.removeHandles(e),n==null){r.attached=!1;return}if(n===t)r.attached=!0;else{let{start:t,end:i}=this._computationManipulators.get(n),a=()=>{r.attached=t.grabbing||i.grabbing};a(),this.addHandles([t.events.on(`grab-changed`,a),i.events.on(`grab-changed`,a)],e)}}),this._updatingHandles.add(()=>{let e=this._activeComputation;return e==null?{}:{geometry:e.geometry,constraint:e.previousConstraint}},({geometry:e,constraint:t})=>{let n=this._constraintSnappingIndicator;e!=null&&t!=null&&t!==2?(n.visible=!0,n.setGeometryFromSegment(e.directSegment)):n.visible=!1})]}removeStaged(){return this._stagedDimension!=null&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(e){let{_stagedDimension:t}=this;if(t==null){let t=this._onUnstagedClick(e);return this.analysis.dimensions.add(t),null}return this._onStagedClick(e),t}onPointerMove({mapPoint:e,pointerType:t}){if(t===`touch`)return;let n=this._getSnappingContext(t);this._updatingHandles.consumePromise(d(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}onManipulatorSelectionChanged(){this.analysisViewData.selectedComputation!=null&&(this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null))}_onUnstagedClick({mapPoint:e,pointerType:n}){let r=e;if(n===`mouse`){let t=this._getSnappingContext(n);r=this._ensureSnappingManager().update({point:e,context:t})}let i=new t({startPoint:S(r,new x),endPoint:null,measureType:`horizontal`});return this._stagedDimension=i,this._resetSnappingState(),i}_onStagedClick({mapPoint:e,pointerType:t}){let n=this._stagedComputation;if(n==null)return;let r=e;if(t===`mouse`){let n=this._getSnappingContext(t);r=this._ensureSnappingManager().update({point:e,context:n})}let i=S(r,new x);this._applyPointUpdate(n,{endPoint:i}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(e){let t=this._setupPointManipulator(e,{isStart:!0}),n=this._setupPointManipulator(e,{isStart:!1}),r=this._setupOffsetManipulator(e),i=this._setupHeadingManipulator(e),o=this._setupRotationManipulator(e),s=this._setupMeasureTypeManipulator(e,`direct`),c=this._setupMeasureTypeManipulator(e,`horizontal`),l=this._setupMeasureTypeManipulator(e,`vertical`),u=new re({start:t,end:n,offset:r,heading:i,rotation:o,direct:s,horizontal:c,vertical:l});this._setupComputationToManipulatorsSync(e,u),this._computationManipulators.set(e,u),this.manipulators.addMany(u.values());let d=a(u.values().map(e=>e.events.on(`focus-changed`,()=>{u.values().some(e=>e.focused)&&this._resetSnappingState()})));return{manipulators:u,remove:()=>{d.remove(),this._computationHandles.remove(e),this._computationManipulators.delete(e);for(let e of u.values())this.manipulators.remove(e)}}}_setupComputationToManipulatorsSync(e,t){this._computationHandles.add([p(()=>e.geometry,()=>this._updateManipulators(e,t),{...h,equals:o})],e)}_setupPointManipulator(e,t){let{view:n}=this,{dimension:r}=e,i=new w(n,{metadata:r}),a=T(i,{isStart:t.isStart,createSnappingPipelineStep:e=>fe({snappingContext:this._getSnappingContext(e),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:r,onUpdate:t=>this._applyPointUpdate(e,t),view:n});return this._computationHandles.add(a,e),i}_setupOffsetManipulator(e){let{view:t}=this,n=E(t,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:e.dimension}),r=D(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupHeadingManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=k(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupRotationManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=A(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupMeasureTypeManipulator(e,t){let{view:n}=this,r=j(n,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:e.dimension}),i=M(r,{computation:e,manipulatorMeasureType:t,view:n});return this._computationHandles.add(i,e),r}_updateManipulators(e,t,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){let{stagedDimension:r,selectedComputation:i,firstGrabbedManipulator:a}=n,{start:o,end:s,offset:c,heading:l,rotation:u}=t,d=i===e,f=z(e),{dimension:p}=e;for(let e of t.values()){let t=f&&r==null&&(a==null||e===a);e===c?(e.available=t,e.selected=d):e.available=t&&d}if(!f)return;this._computeConstraint(e)==null?t.manipulatorForMeasureType(p.measureType).available=!1:t.forEachMeasureTypeManipulator(e=>e.available=!1);for(let e of[l,u])(p.measureType!==`direct`||p.offset===0)&&(e.available=!1);B(e)?u.available=!1:l.available=!1;let{geometry:m}=e;o.renderLocation=m.directSegment.startRenderSpace,s.renderLocation=m.directSegment.endRenderSpace;let{renderCoordsHelper:h}=this.view;N(c,m,h),l.available&&P(l,e,h),u.available&&F(u,e,h),t.forEachMeasureTypeManipulator((t,n)=>{t.available&&I(t,e,n,h)})}_updateManipulatorStyle(e){let t=L(e),n=R(e),r={lineSizePt:e,material:this._orientationManipulatorMaterial};for(let{offset:e,heading:t,rotation:i}of this._computationManipulators.values())e.radius=n/2,t.update(r),i.update(r);this._unfocusedOffsetManipulatorMaterial.setParameters({width:t}),this._focusedOffsetManipulatorMaterial.setParameters({width:n})}_applyPointUpdate(e,t){let{view:n}=this,r=V(e);`startPoint`in t&&(r.elevationAlignedStartPoint=t.startPoint),`endPoint`in t&&(r.elevationAlignedEndPoint=t.endPoint);let i=H(r,n.renderCoordsHelper);if(i==null)return;let a=this._computeConstraint({...r,geometry:i});ee(e,t,{...r,constraint:a,unconstrainedGeometry:i,view:n}),e===this._stagedComputation&&this._updateStagedDimensionOffset(e)}_updateStagedDimensionOffset(e){if(e.geometry==null)return;e.geometry.directSegment.eval(.5,$);let{state:t,renderCoordsHelper:n}=this.view,r=t.camera.computeScreenPixelSizeAt($);e.dimension.offset=K*r*n.unitInMeters}_computeConstraint(e){return te(ne(e,this._ensureSnappingManager().options),this.view)}_createOffsetManipulatorMaterial(e){return new ce({width:1,renderOccluded:4,writeDepth:!1,polygonOffset:3,isDecoration:!0},e.state.isGlobal)}get test(){}};e([_({constructOnly:!0})],Q.prototype,`analysis`,void 0),e([_({constructOnly:!0})],Q.prototype,`analysisViewData`,void 0),e([_({constructOnly:!0})],Q.prototype,`manipulators`,void 0),e([_({constructOnly:!0})],Q.prototype,`parentTool`,void 0),e([_({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([_({readOnly:!0})],Q.prototype,`updating`,null),e([_()],Q.prototype,`firstGrabbedManipulator`,null),e([_()],Q.prototype,`hasGrabbedManipulators`,null),e([_()],Q.prototype,`snappingOptions`,null),e([_()],Q.prototype,`_stagedDimension`,void 0),e([_()],Q.prototype,`_snappingManager`,null),e([_()],Q.prototype,`_activeComputation`,null),e([_()],Q.prototype,`_stagedComputation`,null),e([_()],Q.prototype,`_snappingManagerResult`,void 0),Q=e([v(`esri.views.3d.analysis.Dimension.LengthDimensionSubTool`)],Q);const $=y();export{Q as LengthDimensionSubTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import o from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as s}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as c}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as u}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as d}from"../../../input/InputManager.js";import{AnalysisToolBase as f}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as p}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as m}from"../../../interactive/keybindings.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import o from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as s}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as c}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as u}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as d}from"../../../input/InputManager.js";import{AnalysisToolBase as f}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as p}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as m}from"../../../interactive/keybindings.js";import{acquireForFeaturePlacement as h}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as g}from"../../../interactive/snapping/snappingUtils.js";const _={ready:`ready`,creating:`creating`,created:`created`};let v=class extends f{constructor(e){super(e),this._operationManager=new u,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;let{snappingManager:t}=this._snappingManagerResult=h(e.view);this._editIntersector=new l({view:e.view}),this._editTool=new s({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:this._editIntersector,snappingManager:t,view:e.view}),this._placementController=new c({...e,snappingManager:t,shouldPreventVertexAdd:(e,t)=>this._editTool.hasManipulatorAt(e,t)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get selectedItem(){return this._editTool.selectedItem}get state(){return this._placementController.active?_.creating:this.analysis.observer?.position==null?_.ready:_.created}get cursor(){return this._placementController.active?`crosshair`:null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){g(this),this.addHandles([this._snappingManagerResult,this.view.on(`key-down`,e=>this._onKeyDown(e),d.WIDGET),n(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),r),n(()=>this.state===_.created,e=>{e?this.finishToolCreation():this._set(`created`,!1)},r),n(()=>this.analysisViewData.visible,e=>{this.visible=e},r),n(()=>this.editable,e=>{this.analysisViewData.editable=e},r)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(e){return this.analysisViewData.interactive=!0,this._operationManager.start(`place`,async(i,a)=>{let{elevationInfo:o}=e??{},s=o&&`observer`in o?o.observer:o,c=o&&`targets`in o?o.targets:o;this._placementController.observerPlacementElevationInfo=y(s),this._placementController.targetPlacementElevationInfo=y(c);let l=this.analysis.clone(),u=!1,d=!1,f=()=>{if(d)return;if(d=!0,this.stop(),!this.analysis.valid){this.analysis.clear(),i.reject();return}if(a.aborted||this.analysis.equals(l)){i.reject();return}let e=this.analysis.targets.at(-1);e!=null&&this._editTool.selectItem(e),i.resolve({})};i.handles.push(t(()=>this.stop()),n(()=>this._placementController.active,e=>{if(e){u=!0;return}u&&f()},r)),this.continue()},e)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),!this.analysis.valid&&!this._placementController.active&&this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(e){let t=e.key;t===m.undo&&this.canUndo?(e.stopPropagation(),this.undo()):t===m.redo&&this.canRedo?(e.stopPropagation(),this.redo()):m.delete.includes(t)&&!this.active?this._editTool.deleteSelectedItem()&&e.stopPropagation():t===m.cancel&&!this.active&&this._editTool.clearSelection()&&e.stopPropagation()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active?this._placementController:this._canActivateEditTool?this._editTool:null:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&this.analysis.observer?.position!=null}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{let e=this.analysisViewData.interactive,t=this._canActivateEditTool;if(this._placementController.visible=this.visible&&e,this._editTool.manipulatorsInteractive=e&&!this._placementController.active,!e){this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,p(this.view,this);return}if(!this.visible){this._editTool.stop(),this._editTool.visible=!0,p(this.view,this);return}if(this._placementController.active){this._editTool.stop(),this._editTool.visible=this.visible,p(this.view,this);return}if(!t){this._hideEditTool(),p(this.view,this);return}this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,p(this.view,this)}finally{this._syncingActiveTool=!1}}}};e([i({constructOnly:!0})],v.prototype,`view`,void 0),e([i({constructOnly:!0})],v.prototype,`analysis`,void 0),e([i({constructOnly:!0})],v.prototype,`analysisViewData`,void 0),e([i()],v.prototype,`active`,null),e([i()],v.prototype,`canRedo`,null),e([i()],v.prototype,`canUndo`,null),e([i()],v.prototype,`selectedItem`,null),e([i()],v.prototype,`state`,null),e([i()],v.prototype,`cursor`,null),e([i()],v.prototype,`updating`,null),e([i()],v.prototype,`removeIncompleteOnCancel`,void 0),e([i()],v.prototype,`snappingOptions`,null),e([i()],v.prototype,`_canActivateEditTool`,null),v=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightTool`)],v);function y(e){if(e==null)return null;let{featureExpressionInfo:t,mode:n,offset:r,unit:i}=e;return new o({featureExpressionInfo:t,mode:n,offset:r,unit:i})}export{v as LineOfSightTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{detachToolFromView as c}from"./toolLifecycleUtils.js";import{ViewshedEditTool as l}from"./ViewshedEditTool.js";import{ViewshedPlacementController as u}from"./ViewshedPlacementController.js";import{newToolIntersector as d}from"../../../interactive/ToolIntersector.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as s}from"../../../../core/support/UpdatingHandles.js";import{detachToolFromView as c}from"./toolLifecycleUtils.js";import{ViewshedEditTool as l}from"./ViewshedEditTool.js";import{ViewshedPlacementController as u}from"./ViewshedPlacementController.js";import{newToolIntersector as d}from"../../../interactive/ToolIntersector.js";import{acquireForFeaturePlacement as f}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as p}from"../../../interactive/snapping/snappingUtils.js";let m=class extends t{constructor(e){super(e),this._editTool=null,this._updatingHandles=new s}initialize(){let{view:e}=this,t=d(e.state.viewingMode);this._snappingManagerResult=f(e),this.addHandles(this._snappingManagerResult),this._placementController=new u({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e,callbacks:{cancelTool:()=>{e.activeTool!=null&&(e.activeTool=null)},findViewshedComputedData:e=>this._findViewshedComputedData(e),setSelectedViewshed:e=>{this.analysisViewData.selectedViewshed=e}}}),p(this),this.addHandles([r(()=>({creationState:this._placementController.creationState,interactive:this.analysisViewData.interactive}),({creationState:n,interactive:r})=>{if(!r){this._placementController.cancelPlaceOperation(),this._destroyEditTool();return}if(n!=null){this._destroyEditTool();return}this._editTool||(this._editTool=new l({analysis:this.analysis,analysisViewData:this.analysisViewData,intersector:t,snappingManager:this._snappingManager,view:e}),e.tools.add(this._editTool))},i),this._updatingHandles.add(()=>e.activeTool,e=>{e!=null&&e!==this._editTool&&this._placementController.creationState==null&&(this.analysisViewData.selectedViewshed=null)})])}destroy(){this._destroyEditTool(),n(this._placementController),this._updatingHandles.destroy()}get selectedViewshedComputedData(){return this._editTool?.selectedViewshedComputedData}get stagedViewshed(){return this._placementController.stagedViewshed}get active(){return this._placementController.active||(this._editTool?.active??!1)}get updating(){return this._updatingHandles.updating||this._placementController.updating||!!this._editTool?.updating}get creating(){return this._placementController.creationState!=null}get snappingOptions(){return this._snappingManager.options}set snappingOptions(e){this._snappingManager.options=e}get _snappingManager(){return this._snappingManagerResult.snappingManager}async place(e,t){if(this.analysisViewData.interactive=!0,this._destroyEditTool(),await this._placementController.startPlaceOperation(e,t),e===`single`)return{}}_findViewshedComputedData(e){return this.analysisViewData.viewshedComputedDataHandles?.find(t=>t.viewshedComputedData.viewshed===e)?.viewshedComputedData}_destroyEditTool(){let e=this._editTool;this._editTool=null,e!=null&&(c(this.view,e),n(e))}get test(){}};e([a({constructOnly:!0})],m.prototype,`view`,void 0),e([a({constructOnly:!0})],m.prototype,`analysis`,void 0),e([a({constructOnly:!0})],m.prototype,`analysisViewData`,void 0),e([a()],m.prototype,`_placementController`,void 0),e([a()],m.prototype,`_editTool`,void 0),e([a()],m.prototype,`_snappingManagerResult`,void 0),e([a()],m.prototype,`selectedViewshedComputedData`,null),e([a()],m.prototype,`stagedViewshed`,null),e([a()],m.prototype,`active`,null),e([a()],m.prototype,`updating`,null),e([a()],m.prototype,`creating`,null),e([a()],m.prototype,`snappingOptions`,null),m=e([o(`esri.views.3d.analysis.Viewshed.ViewshedTool`)],m);const h=m;export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import n from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{ignoreAbortErrors as i,isAborted as a}from"../../../../core/promiseUtils.js";import{pausable as o,sync as s,watch as c,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/SimpleFillSymbol.js";import{isPolygon as h,isPolygonGraphic as g}from"./volumeMeasurementGeometryUtils.js";import{VolumeMeasurementShiftTool as _}from"./VolumeMeasurementShiftTool.js";import{ExclusiveOperationManager as v}from"../../../analysis/ExclusiveOperationManager.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import n from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{ignoreAbortErrors as i,isAborted as a}from"../../../../core/promiseUtils.js";import{pausable as o,sync as s,watch as c,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/SimpleFillSymbol.js";import{isPolygon as h,isPolygonGraphic as g}from"./volumeMeasurementGeometryUtils.js";import{VolumeMeasurementShiftTool as _}from"./VolumeMeasurementShiftTool.js";import{ExclusiveOperationManager as v}from"../../../analysis/ExclusiveOperationManager.js";import{makeGeometryAnalysisSnappingOptions as y}from"../../../interactive/snapping/allLayerSnapping.js";import b from"../../../../widgets/Sketch/SketchViewModel.js";let x=class extends n{constructor(e){super(e),this._updatingHandles=new f,this._operationManager=new v,this._onUndoRedo=()=>{this._updateGeometryFromSketchGraphic()}}initialize(){let{analysis:e,viewData:t,view:n}=this;this._graphicsLayer=new p({listMode:`hide`,internal:!0,elevationInfo:{mode:`on-the-ground`}});let r=y(n);this._externalGeometryChangeHandle=o(()=>this.analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),s),this._sketchViewModel=new b({layer:this._graphicsLayer,view:n,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:`move`},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:`reshape`},polygonSymbol:this._polygonSymbol,snappingOptions:r.options}),this.addHandles([this._sketchViewModel.on([`undo`,`redo`],this._onUndoRedo),c(()=>({map:n.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:e,internalGraphicsLayer:t,state:n})=>{switch(C(e,t),n){case`idle`:case`reshaping-disabled`:this._operationManager.stop(),this._graphicsLayer.removeAll(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:i(this._startReshape());break;case`awaiting-sketch`:this.viewData.interactive=!0}},l),r,this._externalGeometryChangeHandle]),this._shiftTool=new _({analysis:e,view:n,analysisViewData:t}),this.addHandles(this._shiftTool.on(`record-undo`,e=>{let t=this._sketchViewModel.activeComponent;t?.type===`reshape-3d`&&t.recordUndo(e.apply,e.undo)})),n.tools.add(this._shiftTool),this.addHandles({remove:()=>n.tools.remove(this._shiftTool)})}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();let e=this._graphicsLayer;this.view.map.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateGeometryFromSketchGraphic())}get state(){let{geometry:e}=this.analysis,{interactive:t,visible:n}=this.viewData;return n?this._sketchViewModel.createGraphic?this._sketchViewModel.createGraphic===this.sketchGraphic?`sketching`:`awaiting-sketch`:e?t?`reshaping`:`reshaping-disabled`:`idle`:`idle`}get updating(){return this._sketchViewModel.updating||this._shiftTool.updating||this._updatingHandles.updating}get _polygonSymbol(){return new m({color:[0,0,0,0],outline:{color:[0,0,0,0]}})}place(e){return this._operationManager.start(`place`,async t=>{let n=this.analysis.clone();this._ensureUpdatedSketchGraphic();let i=this._sketchViewModel.on(`create`,e=>{switch(e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic;break;case`active`:this._updateGeometryFromSketchGraphic();break;case`complete`:this._updateGeometryFromSketchGraphic(),t.stop();break;case`cancel`:t.stop()}});t.handles.push(i,r(()=>{if(i.remove(),this._sketchViewModel.cancel(),this._updateGeometryFromSketchGraphic(),!this.analysis.valid)return this._clearGeometry(),t.reject();if(a(e)||n.equals(this.analysis))return t.reject();t.resolve({})})),await this._updatingHandles.addPromise(this._sketchViewModel.create(`polygon`))},e)}_startReshape(){return this._operationManager.start(`reshape`,async e=>{let t=()=>{let e=this._ensureUpdatedSketchGraphic();return e?(this._graphicsLayer.removeAll(),this._graphicsLayer.add(e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:`reshape`}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let n=this._sketchViewModel.on(`update`,n=>{this._updateGeometryFromSketchGraphic(),n.state===`complete`&&(this.state===`reshaping`?i(t()):e.resolve())});e.handles.push(n,r(()=>{n.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this.analysis;return h(e)?(this.sketchGraphic??=new t({geometry:e,symbol:this._polygonSymbol}),this.sketchGraphic.geometry=e,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearGeometry(){this.sketchGraphic=null,this.analysis.geometry=null}_updateGeometryFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic;this.analysis.geometry=g(e)?e.geometry:null,this._externalGeometryChangeHandle.resume()}get test(){}};e([u({constructOnly:!0})],x.prototype,`viewData`,void 0),e([u({constructOnly:!0})],x.prototype,`view`,void 0),e([u({constructOnly:!0})],x.prototype,`analysis`,void 0),e([u()],x.prototype,`sketchGraphic`,null),e([u({nonNullable:!0})],x.prototype,`state`,null),e([u()],x.prototype,`updating`,null),e([u()],x.prototype,`_polygonSymbol`,null),x=e([d(`esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementTool`)],x);const S=x;function C(e,t){t&&(t.removeFromParent(),e?.add(t))}export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{memoize as n}from"../../../../../core/memoize.js";import{ignoreAbortErrors as r}from"../../../../../core/promiseUtils.js";import{syncAndInitial as i,when as a}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as d}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{screenToMap3D as p,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import h from"./AreaMeasurement3DView.js";import{PickRequest as g}from"../support/PickRequest.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as v}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as y}from"../../../../interactive/dragEventPipeline.js";import{sketchKeys as b}from"../../../../interactive/keybindings.js";import{ManipulatorCollection as x}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as S}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as w}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as T}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{memoize as n}from"../../../../../core/memoize.js";import{ignoreAbortErrors as r}from"../../../../../core/promiseUtils.js";import{syncAndInitial as i,when as a}from"../../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as u}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as d}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{screenToMap3D as p,hideManipulatorWhileDragging as m}from"../../editingTools/dragEventPipeline3D.js";import h from"./AreaMeasurement3DView.js";import{PickRequest as g}from"../support/PickRequest.js";import{AnalysisToolBase as _}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as v}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as y}from"../../../../interactive/dragEventPipeline.js";import{sketchKeys as b}from"../../../../interactive/keybindings.js";import{ManipulatorCollection as x}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as S}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as C}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as w}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as T}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquireForFeaturePlacement as E}from"../../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as D}from"../../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as O}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as k}from"../../../../support/screenUtils.js";let A=class extends _{constructor(e){super(e),this._updatingHandles=new c,this._snappingManagerResult=null,this.polygonState=`initial`,this.removeIncompleteOnCancel=!1,this.manipulators=new x,this._getSnappingContext=n(e=>new w({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new C(new S(`point`,v(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new f}))}initialize(){let{view:e,analysisViewData:t,manipulators:n,visible:o}=this;this.measurementView=new h({view:e,analysisViewData:t,toolState:this,manipulators:n,visible:o}),this._snappingOperation=new D({view:e}),this._updatingHandles.add(()=>this.stagedPoint,e=>{this.analysisViewData.stagedPoint=e==null?null:u(e,new l)},i),O(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(r(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}),this._setupManipulators(),this.addHandles([a(()=>this.state===`measured`,()=>this.finishToolCreation(),i),this.analysisViewData.path.on(`change`,()=>{let e=this.analysisViewData.path;this.polygonState===`initial`&&!e.isEmptyPolygon&&(this.polygonState=e.isValidPolygon?`measured`:`drawing`)})])}destroy(){this.measurementView.destroy(),this._set(`measurementView`,null),this._updatingHandles=t(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){if(this._snappingManagerResult==null){let e=E(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}get state(){return this.analysisViewData.path.numVertices===0?`ready`:this.analysisViewData.path.isValidPolygon&&this.polygonState!==`editing`?`measured`:`measuring`}get cursor(){return this.active?`crosshair`:null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(e){this._snappingOperation.stagedPoint=e}get snappingOptions(){return this._snappingManager?.options}finishMeasurement(){let{path:e}=this.analysisViewData;e.numVertices<=2||(e.close(),this.polygonState=`measured`,this._resetSnappingState(),this.active&&(this.view.activeTool=null))}resetCreated(){super.resetCreated(),this._resetSnappingState(),this.polygonState=`initial`,this.state===`measured`&&(this.polygonState=`measured`,this.finishToolCreation())}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(e){switch(e.type){case`immediate-double-click`:this._handleImmediateDoubleClick(e);break;case`immediate-click`:this._handleImmediateClick(e);break;case`pointer-move`:this._handlePointerMove(e);break;case`drag`:this._handleDrag(e);break;case`key-down`:this._handleKeyDown(e)}}_setupManipulators(){let e=e=>e.events.on(`grab-changed`,()=>{if(this.analysisViewData.path.isValidPolygon){let e=this.manipulators.some(e=>e.manipulator.grabbing);this.polygonState=e?`editing`:`measured`}}),t=t=>{this.addHandles([y(t,(e,t,n,r)=>{let i=m(e),a=e.metadata,o=this._snappingManager,s=this._getSnappingContext(r),c=this._updatingHandles,{snappingStep:l,cancelSnapping:d}=T({snappingManager:o,snappingContext:s,updatingHandles:c});n.next(i).next(t=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(a,f),e.location=f,t)).next(d),t.next(i).next(p(this.view)).next(...l).next(t=>{e.location=t.mapEnd,this.analysisViewData.lastDraggedVertex=t.action===`end`?null:a,this.analysisViewData.path.setVertexPosition(a,u(t.mapEnd))});let f=u(this.analysisViewData.path.getVertexPositionAsPoint(a))}),e(t)],t)};this.manipulators.forEach(({manipulator:e})=>{t(e)}),this.addHandles([this.manipulators.on(`after-add`,({item:{manipulator:e}})=>{t(e)}),this.manipulators.on(`after-remove`,({item:{manipulator:e}})=>this.removeHandles(e))])}_handleImmediateDoubleClick(e){d(e)&&(this.polygonState===`drawing`&&this.finishMeasurement(),e.stopPropagation())}_handleDrag(e){this.polygonState===`editing`&&e.stopPropagation()}_handleImmediateClick(e){if(!d(e))return;let t=k(e),{pointerType:n}=e;if(this.active)switch(this.polygonState){case`initial`:case`measured`:if(this._addVertexAt(t,n)){this.stagedPoint=null,this.polygonState=`drawing`,e.stopPropagation();return}break;case`drawing`:{let r=this.measurementView.vertexHandleAt(t,n);if(r==null){if(this._addVertexAt(t,n)){this.stagedPoint=null,e.stopPropagation();return}}else r.index===0&&(this.finishMeasurement(),e.stopPropagation());break}}e.pointerType===`mouse`&&this._hoverAt(t)}_handlePointerMove(e){if(e.pointerType===`mouse`){let t=k(e);this._hoverAt(t)}}_handleKeyDown(e){let{path:t}=this.analysisViewData;(e.key===b.cancel||e.key===b.complete)&&this.polygonState===`drawing`&&t.numVertices>=3&&(this.stagedPoint=null,this.finishMeasurement(),e.stopPropagation())}_hoverAt(e){let{polygonState:t}=this;if(this.active&&j.has(t)){let t=this._pick(e);if(t?.mapPoint!=null){let e=this._getSnappingContext(`mouse`);this._updatingHandles.consumePromise(r(this._snappingOperation.snap({point:t.mapPoint},this._ensureSnappingManager(),e)))}}else this.stagedPoint=null}_addVertexAt(e,t){let n=this._pick(e)?.mapPoint;if(n==null)return!1;this.analysis.valid&&this.polygonState===`measured`&&(this.analysis.clear(),this._set(`created`,!1),this.polygonState=`initial`);let r=this._getSnappingContext(t),i=this._snappingOperation.update({point:n},this._ensureSnappingManager(),r),a=u(i,new l);return this.analysisViewData.path.add(a),!0}_pick(e){let t=new g(e);return this.measurementView.pick(t)}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){}};e([o()],A.prototype,`_snappingManagerResult`,void 0),e([o()],A.prototype,`_snappingManager`,null),e([o({readOnly:!0})],A.prototype,`state`,null),e([o()],A.prototype,`polygonState`,void 0),e([o({readOnly:!0})],A.prototype,`cursor`,null),e([o()],A.prototype,`measurementView`,void 0),e([o()],A.prototype,`removeIncompleteOnCancel`,void 0),e([o({constructOnly:!0})],A.prototype,`view`,void 0),e([o({constructOnly:!0})],A.prototype,`analysis`,void 0),e([o({constructOnly:!0})],A.prototype,`analysisViewData`,void 0),e([o({readOnly:!0})],A.prototype,`manipulators`,void 0),e([o()],A.prototype,`updating`,null),e([o()],A.prototype,`stagedPoint`,null),e([o()],A.prototype,`snappingOptions`,null),A=e([s(`esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool`)],A);const j=new Set([`initial`,`drawing`,`measured`]),M=A;export{M as default};
|