@arcgis/core 5.0.0-next.38 → 5.0.0-next.39
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/Color.js +1 -1
- package/analysis/DimensionSimpleStyle.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02a65563779b4c64b2cf.js +1 -0
- package/assets/esri/core/workers/chunks/{328106e181e5957ceaa5.js → 09ac2bbc7327e6e6b5a2.js} +1 -1
- package/assets/esri/core/workers/chunks/1a9ed3c59a9a8bafb251.js +1 -0
- package/assets/esri/core/workers/chunks/{b96af22ec1470905e4fb.js → 1c857191e5898aba50fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{3904f8732c9953cb177d.js → 28b235b56a83c498d73f.js} +1 -1
- package/assets/esri/core/workers/chunks/36d15c35fbbd4dedd5cb.js +1 -0
- package/assets/esri/core/workers/chunks/48f805929fe6241952f5.js +1 -0
- package/assets/esri/core/workers/chunks/4c278fb2d51ca6226050.js +1 -0
- package/assets/esri/core/workers/chunks/6052eccb9395c8efb295.js +1 -0
- package/assets/esri/core/workers/chunks/{50ffb22c48fadd36c748.js → 613cbac9cb925cd20b48.js} +1 -1
- package/assets/esri/core/workers/chunks/{febce0d80f019dc2a427.js → 646f58b69d2354f1ef27.js} +1 -1
- package/assets/esri/core/workers/chunks/7eab0bb42f9f062522ef.js +1 -0
- package/assets/esri/core/workers/chunks/{5e34a183420e7007a989.js → 8e8d5422f57269d8c8d2.js} +1 -1
- package/assets/esri/core/workers/chunks/9100330ed4b4437c819d.js +1 -0
- package/assets/esri/core/workers/chunks/95cb062cae4c31c07124.js +1 -0
- package/assets/esri/core/workers/chunks/{7ab237d19b84d89ff483.js → 96f798ee286b59396131.js} +50 -50
- package/assets/esri/core/workers/chunks/{e9bc3c6482ba778c9349.js → 9d95f38da21f97214f83.js} +1 -1
- package/assets/esri/core/workers/chunks/ad4fcb73cfe9a1e4b710.js +1 -0
- package/assets/esri/core/workers/chunks/{a8a017d7969562d21d2e.js → b48aceaeefa07214e430.js} +1 -1
- package/assets/esri/core/workers/chunks/c1a4d1ec0125617374b4.js +1 -0
- package/assets/esri/core/workers/chunks/{d2a6f035022a3f060ffa.js → c320a29df40e85fb4a8e.js} +1 -1
- package/assets/esri/core/workers/chunks/{27ec791318e81285c222.js → dca6a61fd239cf1ff90c.js} +1 -1
- package/assets/esri/core/workers/chunks/{2f9129003f77bfeab2f9.js → e66bcdfd75e0113d1cec.js} +1 -1
- package/assets/esri/core/workers/chunks/f1381c5a2a1de1ef9139.js +1 -0
- package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +1 -0
- package/chunks/ChapmanAtmosphere.glsl.js +20 -20
- package/chunks/HUDMaterial.glsl.js +38 -38
- package/chunks/Haze.glsl.js +23 -23
- package/config.js +1 -1
- package/core/Collection.js +1 -1
- package/core/CollectionFlattener.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/interfaces.d.ts +50 -0
- package/kernel.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/support/FeatureReductionCluster.js +1 -1
- package/layers/support/LabelClass.js +1 -1
- package/package.json +3 -3
- package/renderers/FlowRenderer.js +1 -1
- package/renderers/HeatmapRenderer.js +1 -1
- package/renderers/PieChartRenderer.js +1 -1
- package/rest/route/utils.js +1 -1
- package/rest/support/PointBarrier.js +1 -1
- package/rest/support/Stop.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/Font.js +1 -1
- package/symbols/IconSymbol3DLayer.js +1 -1
- package/symbols/LineSymbol.js +1 -1
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/symbols/MarkerSymbol.js +1 -1
- package/symbols/PictureFillSymbol.js +1 -1
- package/symbols/PictureMarkerSymbol.js +1 -1
- package/symbols/TextSymbol.js +1 -1
- package/symbols/TextSymbol3DLayer.js +1 -1
- package/symbols/callouts/LineCallout3D.js +1 -1
- package/symbols/edges/Edges3D.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/Symbol3DVerticalOffset.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
- package/views/2d/layers/support/util.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/ChapmanApproximation.glsl.js +8 -8
- package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
- package/views/3d/environment/ChapmanRaymarching.glsl.js +16 -15
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +12 -12
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferUtils.js +5 -0
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +5 -0
- package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1d877c3c96c40eab906c.js +0 -1
- package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +0 -1
- package/assets/esri/core/workers/chunks/42f3e83826b3a3dedaaa.js +0 -1
- package/assets/esri/core/workers/chunks/44471962c30344dfafdf.js +0 -1
- package/assets/esri/core/workers/chunks/8ca83a9af9d24b192128.js +0 -1
- package/assets/esri/core/workers/chunks/9527f1a611557a7af237.js +0 -1
- package/assets/esri/core/workers/chunks/ad3a4d139613b4c0e0b4.js +0 -1
- package/assets/esri/core/workers/chunks/c1c77a00f639eaee9c0d.js +0 -1
- package/assets/esri/core/workers/chunks/c8d2cce4a426c72ab173.js +0 -1
- package/assets/esri/core/workers/chunks/e3be67c762af672ec602.js +0 -1
- package/assets/esri/core/workers/chunks/eefad79be500667af96e.js +0 -1
- package/assets/esri/core/workers/chunks/f8caceeaa14d99c35526.js +0 -1
- package/assets/esri/core/workers/chunks/f919f0db9f9ec0c649b9.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import o from"./Collection.js";import{sync as e}from"./reactiveUtils.js";import{property as r}from"./accessorSupport/decorators/property.js";import{subclass as s}from"./accessorSupport/decorators/subclass.js";import{autorun as i}from"./accessorSupport/trackingUtils.js";let
|
|
5
|
+
import{__decorate as t}from"tslib";import o from"./Collection.js";import{sync as e}from"./reactiveUtils.js";import{property as r}from"./accessorSupport/decorators/property.js";import{subclass as s}from"./accessorSupport/decorators/subclass.js";import{autorun as i}from"./accessorSupport/trackingUtils.js";let n=class extends o{constructor(t){super(t),this.getCollections=null}initialize(){this.addHandles(i(()=>this._refresh(),e))}destroy(){this.getCollections=null}_refresh(){const t=this.getCollections?.();if(null==t)return void this.removeAll();let o=0;for(const e of t)null!=e&&(o=this._processCollection(o,e));this.splice(o)}_createNewInstance(t){return new o(t)}_processCollection(t,o){if(!o)return t;const e=this.itemFilterFunction??(t=>!!t);for(const r of o)if(r){if(e(r)){const o=this.indexOf(r,t);o>=0?o!==t&&this.reorder(r,t):this.add(r,t),++t}if(this.getChildrenFunction){const o=this.getChildrenFunction(r);if(Array.isArray(o))for(const e of o)t=this._processCollection(t,e);else t=this._processCollection(t,o)}}return t}};t([r()],n.prototype,"getCollections",void 0),t([r()],n.prototype,"getChildrenFunction",void 0),t([r()],n.prototype,"itemFilterFunction",void 0),n=t([s("esri.core.CollectionFlattener")],n);const l=n;export{l as default};
|
package/core/arrayUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{toConst as n}from"./compilerUtils.js";import t from"./RandomLCG.js";const e=1.5,r=1/e,l=.5;function
|
|
5
|
+
import{toConst as n}from"./compilerUtils.js";import t from"./RandomLCG.js";const e=1.5,r=1/e,l=.5;function u(n,t){if(!t)return n;for(const e of t)n.push(e);return n}function o(n){return n}function f(n,t=o){if(!n||0===n.length)return;let e=n[0],r=t(e);for(let l=1;l<n.length;++l){const u=n[l],o=Number(t(u));o>r&&(r=o,e=u)}return e}function i(n,t=o){return f(n,n=>-t(n))}function c(n,t){return t?n.filter((n,e,r)=>r.findIndex(t.bind(null,n))===e):Array.from(new Set(n))}function s(n,t,e,r,l,u,o){if(null==n&&null==r)return!0;t=Math.max(0,t),l=Math.max(0,l),e=Math.max(0,e<0?(n?.length??0)+e:e),u=Math.max(0,u<0?(r?.length??0)+u:u);const f=e-t;if(null==n||null==r||f!==u-l)return!1;if(o){for(let i=0;i<f;i++)if(!o(n[t+i],r[l+i]))return!1}else for(let i=0;i<f;i++)if(n[t+i]!==r[l+i])return!1;return!0}function h(n,t,e){return s(n,0,n?.length??0,t,0,t?.length??0,e)}function a(){return(n,t)=>{if(null==n&&null==t)return!0;if(null==n||null==t||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}}function g(n,t){let e=n.length!==t.length;e&&(n.length=t.length);for(let r=0;r<t.length;++r)n[r]!==t[r]&&(n[r]=t[r],e=!0);return e}function d(n,t,e){let r,l;return e?(r=t.filter(t=>!n.some(n=>e(n,t))),l=n.filter(n=>!t.some(t=>e(t,n)))):(r=t.filter(t=>!n.includes(t)),l=n.filter(n=>!t.includes(n))),{added:r,removed:l}}function m(n,t,e){return n&&t?e?n.filter(n=>t.findIndex(t=>e(n,t))>-1):n.filter(n=>t.includes(n)):[]}function p(n){return n&&"number"==typeof n.length}function M(n,t){const e=n.length;if(0===e)return[];const r=[];for(let l=0;l<e;l+=t)r.push(n.slice(l,l+t));return r}function x(n,t){void 0===t&&(t=n,n=0);const e=new Array(t-n);for(let r=n;r<t;r++)e[r-n]=r;return e}function w(n,t,e){const r=n.length;let l=0,u=r-1;for(;l<u;){const e=l+Math.floor((u-l)/2);t>n[e]?l=e+1:u=e}const o=n[l];return e?t>=n[r-1]?-1:o===t?l:l-1:o===t?l:-1}class y{constructor(){this.last=0}}const A=new y;function b(n,t,e,r){r=r||A;const l=Math.max(0,r.last-10);for(let o=l;o<e;++o)if(n[o]===t)return r.last=o,o;const u=Math.min(l,e);for(let o=0;o<u;++o)if(n[o]===t)return r.last=o,o;return-1}function S(t,e,r,l){const u=r??t.length,o=b(t,n(e),u,l);if(-1!==o)return t[o]=t[u-1],null==r&&t.pop(),e}const j=new Set;function v(n,t,e=n.length,r=t.length,l,u){if(0===r||0===e)return e;j.clear();for(let f=0;f<r;++f)j.add(t[f]);l=l||A;const o=Math.max(0,l.last-10);for(let f=o;f<e;++f)if(j.has(n[f])&&(u?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;for(let f=0;f<o;++f)if(j.has(n[f])&&(u?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;return j.clear(),e}function z(n,t){let e=0;for(let r=0;r<n.length;++r){const l=n[r];t(l,r)&&(n[e]=l,e++)}return n.length=e,n}function I(n,t,e){const r=n.length;if(t>=r)return n.slice();const l=C(e),u=new Set,o=[];for(;o.length<t;){const t=Math.floor(l()*r);u.has(t)||(u.add(t),o.push(n[t]))}return o}function C(n){return n?(F.seed=n,()=>F.getFloat()):Math.random}const F=new t;function G(n,t){if(!n)return n;const e=C(t);for(let r=n.length-1;r>0;r--){const t=Math.floor(e()*(r+1)),l=n[r];n[r]=n[t],n[t]=l}return n}function L(n,t){const e=n.indexOf(t);return-1!==e?(n.splice(e,1),t):null}function N(n,t){return null!=n}function O(n,...t){for(const e of t)null!=e&&n.push(e);return n.length}function R(n,t){return n.reduce((n,e)=>t(e)?n+1:n,0)}function U(n){return Array.isArray(n)}const k=[];export{y as PositionHint,u as addMany,w as binaryIndexOf,R as countIf,d as difference,k as emptyArray,h as equals,z as filterInPlace,C as getRandomNumberGenerator,b as indexOf,m as intersect,p as isArrayLike,U as isArrayWithReadonly,N as isSome,a as makeArrayEquals,f as max,i as min,I as pickRandom,O as pushIfSome,x as range,e as reallocGrowthFactor,r as reallocShrinkFactor,l as reallocShrinkThreshold,L as remove,S as removeUnordered,v as removeUnorderedMany,G as shuffle,s as sliceEquals,M as splitIntoChunks,c as unique,g as update};
|
package/interfaces.d.ts
CHANGED
|
@@ -1172,6 +1172,14 @@ declare namespace __esri {
|
|
|
1172
1172
|
*/
|
|
1173
1173
|
get viewOptions(): ElevationProfileViewOptions;
|
|
1174
1174
|
set viewOptions(value: ElevationProfileViewOptionsProperties);
|
|
1175
|
+
/**
|
|
1176
|
+
* Sets the analysis geometry and elevation info from the provided feature.
|
|
1177
|
+
*
|
|
1178
|
+
* @param feature The feature from which to set the analysis geometry and elevation info.
|
|
1179
|
+
*
|
|
1180
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html#setGeometryFromFeature Read more...}
|
|
1181
|
+
*/
|
|
1182
|
+
setGeometryFromFeature(feature: Graphic): void;
|
|
1175
1183
|
}
|
|
1176
1184
|
|
|
1177
1185
|
interface ElevationProfileAnalysisProperties extends AnalysisProperties {
|
|
@@ -84606,6 +84614,27 @@ declare namespace __esri {
|
|
|
84606
84614
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#sequence Read more...}
|
|
84607
84615
|
*/
|
|
84608
84616
|
sequence: number | nullish;
|
|
84617
|
+
/**
|
|
84618
|
+
* The x-coordinate of the position on the network dataset where the point was located, in the coordinate system of
|
|
84619
|
+
* the network dataset.
|
|
84620
|
+
*
|
|
84621
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#snapX Read more...}
|
|
84622
|
+
*/
|
|
84623
|
+
snapX: number | nullish;
|
|
84624
|
+
/**
|
|
84625
|
+
* The y-coordinate of the position on the network dataset where the point was located, in the coordinate system of
|
|
84626
|
+
* the network dataset.
|
|
84627
|
+
*
|
|
84628
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#snapY Read more...}
|
|
84629
|
+
*/
|
|
84630
|
+
snapY: number | nullish;
|
|
84631
|
+
/**
|
|
84632
|
+
* The z-coordinate of the position on the network dataset where the point was located, in the coordinate system of
|
|
84633
|
+
* the network dataset.
|
|
84634
|
+
*
|
|
84635
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#snapZ Read more...}
|
|
84636
|
+
*/
|
|
84637
|
+
snapZ: number | nullish;
|
|
84609
84638
|
/**
|
|
84610
84639
|
* Indicates the status of the point with respect to its location on the network and the outcome of the analysis.
|
|
84611
84640
|
*
|
|
@@ -84759,6 +84788,27 @@ declare namespace __esri {
|
|
|
84759
84788
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#sequence Read more...}
|
|
84760
84789
|
*/
|
|
84761
84790
|
sequence?: number | nullish;
|
|
84791
|
+
/**
|
|
84792
|
+
* The x-coordinate of the position on the network dataset where the point was located, in the coordinate system of
|
|
84793
|
+
* the network dataset.
|
|
84794
|
+
*
|
|
84795
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#snapX Read more...}
|
|
84796
|
+
*/
|
|
84797
|
+
snapX?: number | nullish;
|
|
84798
|
+
/**
|
|
84799
|
+
* The y-coordinate of the position on the network dataset where the point was located, in the coordinate system of
|
|
84800
|
+
* the network dataset.
|
|
84801
|
+
*
|
|
84802
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#snapY Read more...}
|
|
84803
|
+
*/
|
|
84804
|
+
snapY?: number | nullish;
|
|
84805
|
+
/**
|
|
84806
|
+
* The z-coordinate of the position on the network dataset where the point was located, in the coordinate system of
|
|
84807
|
+
* the network dataset.
|
|
84808
|
+
*
|
|
84809
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Stop.html#snapZ Read more...}
|
|
84810
|
+
*/
|
|
84811
|
+
snapZ?: number | nullish;
|
|
84762
84812
|
/**
|
|
84763
84813
|
* Indicates the status of the point with respect to its location on the network and the outcome of the analysis.
|
|
84764
84814
|
*
|
package/kernel.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.
|
|
5
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.39",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as S}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as F}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as x,getRasterAttributeTableFields as T,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import{isFunctionRaster as U,getPrimaryRasters as $}from"./support/rasterDatasets/datasetUtils.js";import D from"./support/rasterDatasets/FunctionRaster.js";import W from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as z,create as B}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as A,elevationModeUnsupportedMessage as k,featureExpressionUnsupportedMessage as G}from"../support/elevationInfoUtils.js";import{createPopupTemplate as V}from"../support/popupUtils.js";import H from"../symbols/support/ElevationInfo.js";let Y=class extends(y(j(v(w(S(f(g(R(_(d(F(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=T(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=V({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){const r=m(E,e);if(await this.load(),!r||"none"===r.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:e}=await this._openFunctionRaster(r,t);return e}catch(i){if(i instanceof s)throw i;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsWrite(){const e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){if(this.supportsWrite())return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=U(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=$(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&z(t.toJSON(),i);const o=await Promise.all(i.map(e=>W.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await W.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await W.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=B(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new D({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){A(i.getLogger(this),k("ImageryTile layers","relative-to-scene",e)),A(i.getLogger(this),G("ImageryTile layers",e))}};e([l({clonable:!1})],Y.prototype,"_primaryRasters",void 0),e([l({type:H,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Y.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([l(I)],Y.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([l({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],Y.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],Y.prototype,"rasterFunction",void 0),e([l()],Y.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Y.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],Y.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],Y.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Y.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([l(O)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"rasterFields",null),e([l({constructOnly:!0})],Y.prototype,"source",void 0),Y=e([c("esri.layers.ImageryTileLayer")],Y);const q=Y;export{q as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l,subclass as m}from"../core/accessorSupport/decorators.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as S}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as F}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{legendEnabled as _,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as T,getRasterAttributeTableFields as x,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import U from"./support/TileInfo.js";import{isFunctionRaster as $,getPrimaryRasters as D}from"./support/rasterDatasets/datasetUtils.js";import W from"./support/rasterDatasets/FunctionRaster.js";import z from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as B,create as A}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as k,elevationModeUnsupportedMessage as G,featureExpressionUnsupportedMessage as V}from"../support/elevationInfoUtils.js";import{createPopupTemplate as H}from"../support/popupUtils.js";import Y from"../symbols/support/ElevationInfo.js";let q=class extends(y(j(v(w(S(f(g(R(I(d(F(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),T("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=x(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=H({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){const r=c(E,e);if(await this.load(),!r||"none"===r.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:e}=await this._openFunctionRaster(r,t);return e}catch(i){if(i instanceof s)throw i;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsWrite(){const e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){if(this.supportsWrite())return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=$(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=D(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&B(t.toJSON(),i);const o=await Promise.all(i.map(e=>z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await z.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=A(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new W({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){k(i.getLogger(this),G("ImageryTile layers","relative-to-scene",e)),k(i.getLogger(this),V("ImageryTile layers",e))}};e([l({clonable:!1})],q.prototype,"_primaryRasters",void 0),e([l({type:Y,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],q.prototype,"elevationInfo",null),e([l({type:U})],q.prototype,"tileInfo",void 0),e([l({readOnly:!0,clonable:!1})],q.prototype,"graphicOrigin",void 0),e([l(_)],q.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],q.prototype,"isReference",void 0),e([l({type:["show","hide"]})],q.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],q.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],q.prototype,"rasterFunction",void 0),e([l()],q.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],q.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],q.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],q.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],q.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],q.prototype,"defaultPopupTemplate",null),e([l(O)],q.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],q.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],q.prototype,"rasterFields",null),e([l({constructOnly:!0})],q.prototype,"source",void 0),q=e([m("esri.layers.ImageryTileLayer")],q);const K=q;export{K as default};
|
package/layers/RouteLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/units.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y,subclass as f}from"../core/accessorSupport/decorators.js";import{updateOrigins as d}from"../core/accessorSupport/originUtils.js";import h from"../geometry/Extent.js";import w from"../geometry/Multipoint.js";import{initializeProjection as g,project as S}from"../geometry/projectionUtils.js";import b from"../geometry/SpatialReference.js";import{wgs84 as v}from"../geometry/support/spatialReferenceUtils.js";import B from"./Layer.js";import{BlendLayer as P}from"./mixins/BlendLayer.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as N}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as D}from"./support/arcgisLayerUrl.js";import C from"./support/RouteSymbols.js";import _ from"../portal/Portal.js";import L from"../portal/PortalItem.js";import{typeKeyword as O}from"../portal/support/portalItemUtils.js";import{read as R}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as T}from"../rest/networkService.js";import{solve as F}from"../rest/route.js";import A from"../rest/support/DirectionLine.js";import k from"../rest/support/DirectionPoint.js";import x from"../rest/support/PointBarrier.js";import G from"../rest/support/PolygonBarrier.js";import J from"../rest/support/PolylineBarrier.js";import M from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import U from"../rest/support/RouteSettings.js";import W from"../rest/support/Stop.js";import{writer as q}from"../core/accessorSupport/decorators/writer.js";import{reader as V}from"../core/accessorSupport/decorators/reader.js";function Y(e){if(!e.length)return;const t=e.toArray(),r=t.map(({objectId:e})=>e).filter(e=>null!=e);let o=Math.max(...r,0);for(const i of t)null==i.objectId&&(i.objectId=++o)}function Z(e,t){return!!e.length&&e.length===t.length&&z(e)&&z(t)}function z(e){return e.every(({objectId:e})=>null!=e)}function K(e){return e.length?e:null}function X(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:X("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:X("esriGeometryPolyline")}}}function H(e){return"layers"in e}function Q(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function $(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function ee(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.addedCost=r.addedCost,e.barrierType=r.barrierType,e.costs=r.costs,e.curbApproach=r.curbApproach,e.fullEdge=r.fullEdge,e.geometry=r.geometry,e.name=r.name,e.sideOfEdge=r.sideOfEdge,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol)}}function te(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function re(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function oe(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.arriveCurbApproach=r.arriveCurbApproach,e.arriveTime=r.arriveTime,e.arriveTimeOffset=r.arriveTimeOffset,e.cumulativeCosts=r.cumulativeCosts,e.cumulativeDistance=r.cumulativeDistance,e.cumulativeDuration=r.cumulativeDuration,e.curbApproach=r.curbApproach,e.departCurbApproach=r.departCurbApproach,e.departTime=r.departTime,e.departTimeOffset=r.departTimeOffset,e.distanceToNetworkInMeters=r.distanceToNetworkInMeters,e.geometry=r.geometry,e.lateDuration=r.lateDuration,e.name=r.name,e.navLatency=r.navLatency,e.posAlong=r.posAlong,e.routeName=r.routeName,e.serviceCosts=r.serviceCosts,e.serviceDistance=r.serviceDistance,e.serviceDuration=r.serviceDuration,e.sequence=r.sequence,e.sideOfEdge=r.sideOfEdge,e.snapX=r.snapX,e.snapY=r.snapY,e.snapZ=r.snapZ,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol,e.timeWindowEnd=r.timeWindowEnd,e.timeWindowStart=r.timeWindowStart,e.violations=r.violations,e.waitDuration=r.waitDuration,e.wait=r.wait)}}async function ie(e){const t=b.WGS84;return await g(e.spatialReference,t),S(e,t)}function se(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ne(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function ae(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const le=i.ofType(A),ue=i.ofType(k),pe=i.ofType(x),ce=i.ofType(G),me=i.ofType(J),ye=i.ofType(W);let fe=class extends(P(j(I(N(a(B)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new C,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new pe,this.polygonBarriers=new ce,this.polylineBarriers=new me,this.routeInfo=null,this.spatialReference=b.WGS84,this.stops=new ye,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(p(()=>this.stops,"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(e=>!!e),s=i.map((e,t)=>t),n="web-map"===o.origin?"featureCollection.layers":"layers";l(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",e=>A.fromGraphic(e))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",e=>k.fromGraphic(e))}get fullExtent(){const e=new h({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:b.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter(e=>null!=e.geometry);if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map(e=>{const t=e.geometry;return[t.x,t.y]});return new w({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find(e=>null!=e.layerDefinition.maxScale);return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=H(t)?t.layers:t.featureCollection?.layers,o=r?.find(e=>null!=e.layerDefinition.minScale);return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",e=>x.fromGraphic(e))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",e=>G.fromGraphic(e))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",e=>J.fromGraphic(e))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",e=>M.fromGraphic(e)).at(0)??null}readSpatialReference(e,t){const r=H(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return b.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??v;return b.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",e=>W.fromGraphic(e),e=>this._setStopSymbol(e))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",D(e,n.getLogger(this))):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(!this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},a=this.write(void 0,n);return t.extent=await ie(e),t.title=this.title,await t.update({data:a}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=L.from(e).clone();r.extent??=await ie(this.fullExtent),r.id=null,r.portal??=_.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",O.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,a=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:a}),this.portalItem=r,d(i),i.portalItem=r,r}async solve(e,t){Y(this.stops),Y(this.pointBarriers),Y(this.polylineBarriers),Y(this.polygonBarriers);const r=e?.stops??this.stops,o=e?.pointBarriers??K(this.pointBarriers),n=e?.polylineBarriers??K(this.polylineBarriers),a=e?.polygonBarriers??K(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((Q(r)||$(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const l=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,l,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:a,preserveObjectID:!0,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!a,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=E.from(e??{});let w;h.set(d);try{w=await F(c,h,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const g=this._toRouteLayerSolution(w);return this._isOverridden("title")||(this.title=g.routeInfo.name??"Route"),this._populatePortalFields(g,m,h),g}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:a,stops:l}=e;Z(l,this.stops)?oe(l,this.stops):this.set({stops:l}),Z(i,this.pointBarriers)?ee(i,this.pointBarriers):this.set({pointBarriers:i}),Z(n,this.polylineBarriers)?te(n,this.polylineBarriers):this.set({polylineBarriers:n}),Z(s,this.polygonBarriers)?re(s,this.polygonBarriers):this.set({polygonBarriers:s}),this.set({checksum:t}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",a),null!=a.geometry&&(this.spatialReference=a.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const a=H(e)?e.layers:e.featureCollection?.layers,l=a?.find(e=>e.layerDefinition.name===t);if(null==l)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=l,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??v,d=m&&R(m),h=b.fromJSON(f),w=y.map(e=>{const i=r.fromJSON(e);null!=i.geometry&&null!=e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n});return n&&w.some(({symbol:e})=>!e)&&n(w),new i(w)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await T(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||!e.length||!this.defaultSymbols.stops||e.every(({symbol:e})=>!!e))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops,a=e.map(({sequence:e})=>e).filter(e=>null!=e),l=e.length===a.length;if(!this.routeInfo&&!l||1===e.length)return void e.forEach((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}});const u=Math.min(...a),p=Math.max(...a);for(const c of e)c.sequence!==u?c.sequence!==p?this.routeInfo&&"ok"!==c.status&&"not-located-on-closest"!==c.status?c.symbol=i:"waypoint"!==c.locationType?"break"!==c.locationType?c.symbol=o:c.symbol=n:c.symbol=s:c.symbol=r:c.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map(e=>W.fromJSON(e.toJSON()));this._setStopSymbol(o);const i=new ye(o),s=new ce(e.polygonBarriers?.map(e=>{const t=G.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t})),n=new me(e.polylineBarriers?.map(e=>{const t=J.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t})),a=new pe(e.pointBarriers?.map(e=>{const t=x.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t})),l=r[0].route?.toJSON(),u=M.fromJSON(l);u.symbol=this.defaultSymbols.routeInfo;const p=new ue(r[0].directionPoints?.features.map(e=>{const t=k.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t}));return{checksum:t,directionLines:new le(r[0].directionLines?.features.map(e=>{const t=A.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t})),directionPoints:p,pointBarriers:a,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",A.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",k.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:a,maxScale:l,minScale:u}=this;return{featureSet:{features:e.toArray().map(e=>ae(e)),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:null!=t?t.toJSON():X(r)}},extent:a.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:l,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",x.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",G.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",J.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",M.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",W.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}_populatePortalFields(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter(({usageType:e})=>"cost"===e)??[],a=r.travelMode??t.defaultTravelMode;if(null==a)return void n.getLogger(this).warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:u}=a,p=i.find(({name:e})=>e===l),c=i.find(({name:e})=>e===u),m=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,y=p?.units,f=c?.units;if(!y||!f)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const d=r.directionsLanguage??t.directionsLanguage,h=r.accumulateAttributes??t.accumulateAttributeNames??[],w=new Set(i.filter(({name:e})=>e===l||e===u||e===m||null!=e&&h.includes(e)).map(({name:e})=>e)),g=e=>{for(const t in e)w.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[m]??0,g(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[m]??1,g(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[m]??1,g(s.costs));const{routeInfo:S}=e,{findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I}=r;S.analysisSettings=new U({accumulateAttributes:h,directionsLanguage:d,findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I,travelMode:a}),S.totalDuration=se(S.totalCosts?.[l]??0,y),S.totalDistance=ne(S.totalCosts?.[u]??0,f),S.totalLateDuration=se(S.totalViolations?.[l]??0,y),S.totalWaitDuration=se(S.totalWait?.[l]??0,y),null!=S.totalCosts&&g(S.totalCosts),null!=S.totalViolations&&g(S.totalViolations),null!=S.totalWait&&g(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=se(s.serviceCosts[l]??0,y),s.serviceDistance=ne(s.serviceCosts[u]??0,f),g(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=se(s.cumulativeCosts[l]??0,y),s.cumulativeDistance=ne(s.cumulativeCosts[u]??0,f),g(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=se(s.violations[l]??0,y),g(s.violations)),null!=s.wait&&(s.waitDuration=se(s.wait[l]??0,y),g(s.wait))}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],fe.prototype,"_featureCollection",void 0),e([q(["web-map","portal-item"],"_featureCollection")],fe.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],fe.prototype,"_type",void 0),e([y({type:String})],fe.prototype,"checksum",void 0),e([y({nonNullable:!0,type:C})],fe.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],fe.prototype,"directionLines",void 0),e([V(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],fe.prototype,"readDirectionLines",null),e([y({readOnly:!0})],fe.prototype,"directionPoints",void 0),e([V(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],fe.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],fe.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],fe.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],fe.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],fe.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],fe.prototype,"maxScale",void 0),e([V(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],fe.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],fe.prototype,"minScale",void 0),e([V(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],fe.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],fe.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(x)})],fe.prototype,"pointBarriers",void 0),e([V(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],fe.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(G)})],fe.prototype,"polygonBarriers",void 0),e([V(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],fe.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(J)})],fe.prototype,"polylineBarriers",void 0),e([V(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],fe.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],fe.prototype,"routeInfo",void 0),e([V(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],fe.prototype,"readRouteInfo",null),e([y({type:b})],fe.prototype,"spatialReference",void 0),e([V(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],fe.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(W)})],fe.prototype,"stops",void 0),e([V(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],fe.prototype,"readStops",null),e([y()],fe.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],fe.prototype,"type",void 0),e([y()],fe.prototype,"url",null),fe=e([f("esri.layers.RouteLayer")],fe);const de=fe;export{de as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{isAbortError as u}from"../core/promiseUtils.js";import{on as p}from"../core/reactiveUtils.js";import{convertUnit as c}from"../core/units.js";import{urlToObject as m}from"../core/urlUtils.js";import{property as y,subclass as f}from"../core/accessorSupport/decorators.js";import{updateOrigins as d}from"../core/accessorSupport/originUtils.js";import h from"../geometry/Extent.js";import g from"../geometry/Multipoint.js";import{initializeProjection as w,project as S}from"../geometry/projectionUtils.js";import b from"../geometry/SpatialReference.js";import{wgs84 as v}from"../geometry/support/spatialReferenceUtils.js";import B from"./Layer.js";import{BlendLayer as P}from"./mixins/BlendLayer.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as N}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{sanitizeUrl as D}from"./support/arcgisLayerUrl.js";import C from"./support/RouteSymbols.js";import _ from"../portal/Portal.js";import L from"../portal/PortalItem.js";import{typeKeyword as O}from"../portal/support/portalItemUtils.js";import{read as R}from"../renderers/support/jsonUtils.js";import{fetchServiceDescription as T}from"../rest/networkService.js";import{solve as A}from"../rest/route.js";import F from"../rest/support/DirectionLine.js";import k from"../rest/support/DirectionPoint.js";import x from"../rest/support/PointBarrier.js";import G from"../rest/support/PolygonBarrier.js";import J from"../rest/support/PolylineBarrier.js";import M from"../rest/support/RouteInfo.js";import E from"../rest/support/RouteParameters.js";import U from"../rest/support/RouteSettings.js";import W from"../rest/support/Stop.js";import{writer as q}from"../core/accessorSupport/decorators/writer.js";import{reader as V}from"../core/accessorSupport/decorators/reader.js";function Y(e){if(!e.length)return;const t=e.toArray(),r=t.map(({objectId:e})=>e).filter(e=>null!=e);let o=Math.max(...r,0);for(const i of t)i.objectId??=++o}function Z(e,t){return e.length===t.length&&z(e)&&z(t)}function z(e){return e.every(({objectId:e})=>null!=e)}function K(e,t){return!!e.length||!!t.length}function X(e){return e.length?e:null}function H(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:H("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:H("esriGeometryPolyline")}}}function Q(e){return"layers"in e}function $(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function ee(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function te(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.addedCost=r.addedCost,e.barrierType=r.barrierType,e.costs=r.costs,e.curbApproach=r.curbApproach,e.fullEdge=r.fullEdge,e.geometry=r.geometry,e.name=r.name,e.sideOfEdge=r.sideOfEdge,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol)}}function re(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function oe(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.barrierType=r.barrierType,e.costs=r.costs,e.geometry=r.geometry,e.name=r.name,e.scaleFactor=r.scaleFactor,e.symbol=r.symbol)}}function ie(e,t){for(const r of e){const e=t.find(e=>e.objectId===r.objectId);e&&(e.arriveCurbApproach=r.arriveCurbApproach,e.arriveTime=r.arriveTime,e.arriveTimeOffset=r.arriveTimeOffset,e.cumulativeCosts=r.cumulativeCosts,e.cumulativeDistance=r.cumulativeDistance,e.cumulativeDuration=r.cumulativeDuration,e.curbApproach=r.curbApproach,e.departCurbApproach=r.departCurbApproach,e.departTime=r.departTime,e.departTimeOffset=r.departTimeOffset,e.distanceToNetworkInMeters=r.distanceToNetworkInMeters,e.geometry=r.geometry,e.lateDuration=r.lateDuration,e.name=r.name,e.navLatency=r.navLatency,e.positionAlong=r.positionAlong,e.routeName=r.routeName,e.serviceCosts=r.serviceCosts,e.serviceDistance=r.serviceDistance,e.serviceDuration=r.serviceDuration,e.sequence=r.sequence,e.sideOfEdge=r.sideOfEdge,e.snapX=r.snapX,e.snapY=r.snapY,e.snapZ=r.snapZ,e.sourceId=r.sourceId,e.sourceOid=r.sourceOid,e.status=r.status,e.symbol=r.symbol,e.timeWindowEnd=r.timeWindowEnd,e.timeWindowStart=r.timeWindowStart,e.violations=r.violations,e.waitDuration=r.waitDuration,e.wait=r.wait)}}async function se(e){const t=b.WGS84;return await w(e.spatialReference,t),S(e,t)}function ne(e,t){if(t&&e?.length&&!e.every(({symbol:e})=>!!e))for(const r of e)r.symbol=t}function ae(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function le(e,t){return"decimal-degrees"===t||"points"===t||"unknown"===t?e:c(e,t,"meters")}function ue(e){const{attributes:t,geometry:r,popupTemplate:o,symbol:i}=e.toGraphic().toJSON();return{attributes:t,geometry:r,popupInfo:o,symbol:i}}const pe=i.ofType(F),ce=i.ofType(k),me=i.ofType(x),ye=i.ofType(G),fe=i.ofType(J),de=i.ofType(W);let he=class extends(P(j(I(N(a(B)))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.checksum=null,this.defaultSymbols=new C,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new me,this.polygonBarriers=new ye,this.polylineBarriers=new fe,this.routeInfo=null,this.spatialReference=b.WGS84,this.stops=new de,this.type="route";const t=()=>{this._setStopSymbol(this.stops)},r=()=>{ne(this.pointBarriers,this.defaultSymbols.pointBarriers)},o=()=>{ne(this.polylineBarriers,this.defaultSymbols.polylineBarriers)},i=()=>{ne(this.polygonBarriers,this.defaultSymbols.polygonBarriers)};this.addHandles([p(()=>this.stops,"change",t,{sync:!0,onListenerAdd:t}),p(()=>this.pointBarriers,"change",r,{sync:!0,onListenerAdd:r}),p(()=>this.polylineBarriers,"change",o,{sync:!0,onListenerAdd:o}),p(()=>this.polygonBarriers,"change",i,{sync:!0,onListenerAdd:i})])}writeFeatureCollectionWebmap(e,t,r,o){const i=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(e=>!!e),s=i.map((e,t)=>t),n="web-map"===o.origin?"featureCollection.layers":"layers";l(n,i,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=s}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",e=>F.fromGraphic(e))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",e=>k.fromGraphic(e))}get fullExtent(){const e=new h({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:b.WGS84});if(null!=this.routeInfo?.geometry)return this.routeInfo.geometry.extent??e;if(null==this.stops)return e;const t=this.stops.filter(e=>null!=e.geometry);if(t.length<2)return e;const{spatialReference:r}=t.at(0).geometry;if(null==r)return e;const o=t.toArray().map(e=>{const t=e.geometry;return[t.x,t.y]});return new g({points:o,spatialReference:r}).extent}readMaxScale(e,t){const r=Q(t)?t.layers:t.featureCollection?.layers,o=r?.find(e=>null!=e.layerDefinition.maxScale);return o?.layerDefinition.maxScale??0}readMinScale(e,t){const r=Q(t)?t.layers:t.featureCollection?.layers,o=r?.find(e=>null!=e.layerDefinition.minScale);return o?.layerDefinition.minScale??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",e=>x.fromGraphic(e))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",e=>G.fromGraphic(e))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",e=>J.fromGraphic(e))}readRouteInfo(e,t){return this._getNetworkFeatures(t,"RouteInfo",e=>M.fromGraphic(e)).at(0)??null}readSpatialReference(e,t){const r=Q(t)?t.layers:t.featureCollection?.layers;if(!r?.length)return b.WGS84;const{layerDefinition:o,featureSet:i}=r[0],s=i.features[0],n=s?.geometry?.spatialReference??i.spatialReference??o.spatialReference??o.extent.spatialReference??v;return b.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",e=>W.fromGraphic(e),e=>this._setStopSymbol(e))}get title(){return this.routeInfo?.name??"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return t.routeServiceUrl}set url(e){null!=e?this._set("url",D(e,n.getLogger(this))):this._set("url",t.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){null!=this.directionLines&&(this.directionLines.removeAll(),this._set("directionLines",null)),null!=this.directionPoints&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),null!=this.routeInfo&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new s("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new s("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if("Feature Collection"!==t.type)throw new s("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(!this.routeInfo)throw new s("routelayer:route-unsolved","save() requires a solved route");const{portal:r}=t;await r.signIn(),r.user||await t.reload();const{itemUrl:o,itemControl:i}=t;if("admin"!==i&&"update"!==i)throw new s("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const n={messages:[],origin:"portal-item",portal:r,url:o?m(o):void 0,writtenProperties:[]},a=this.write(void 0,n);return t.extent=await se(e),t.title=this.title,await t.update({data:a}),t}async saveAs(e,t={}){if(await this.load(),null==this.routeInfo)throw new s("routelayer:route-unsolved","saveAs() requires a solved route");const r=L.from(e).clone();r.extent??=await se(this.fullExtent),r.id=null,r.portal??=_.getDefault(),r.title??=this.title,r.type="Feature Collection",r.typeKeywords=["Data","Feature Collection",O.MULTI_LAYER,"Route Layer"];const{portal:o}=r,i={messages:[],origin:"portal-item",portal:o,url:null,writtenProperties:[]};await o.signIn();const n=t?.folder,a=this.write(void 0,i);return await o.user.addItem({item:r,folder:n,data:a}),this.portalItem=r,d(i),i.portalItem=r,r}async solve(e,t){Y(this.stops),Y(this.pointBarriers),Y(this.polylineBarriers),Y(this.polygonBarriers);const r=e?.stops??this.stops,o=e?.pointBarriers??X(this.pointBarriers),n=e?.polylineBarriers??X(this.polylineBarriers),a=e?.polygonBarriers??X(this.polygonBarriers);if(null==r)throw new s("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if(($(r)||ee(r))&&r.features.length<2||i.isCollection(r)&&r.length<2)throw new s("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(i.isCollection(r))for(const i of r)i.routeName=null;const l=e?.apiKey,{checksum:p,url:c}=this,m=await this._getServiceDescription(c,l,t),y=e?.travelMode??m.defaultTravelMode,f=e?.accumulateAttributes??[];y&&(f.push(y.distanceAttributeName),y.timeAttributeName&&f.push(y.timeAttributeName));const d={accumulateAttributes:f,checksum:p,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:o,polylineBarriers:n,polygonBarriers:a,preserveObjectID:!0,returnBarriers:!!o,returnDirections:!0,returnPolygonBarriers:!!a,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:r},h=E.from(e??{});let g;h.set(d);try{g=await A(c,h,t)}catch(S){throw u(S)?S:new s("routelayer:failed-route-request","the routing request failed",{error:S})}const w=this._toRouteLayerSolution(g);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),this._populatePortalFields(w,m,h),w}update(e){const{checksum:t,directionLines:r,directionPoints:o,pointBarriers:i,polygonBarriers:s,polylineBarriers:n,routeInfo:a,stops:l}=e;Z(l,this.stops)?ie(l,this.stops):this.set({stops:l}),K(i,this.pointBarriers)&&(Z(i,this.pointBarriers)?te(i,this.pointBarriers):this.set({pointBarriers:i})),K(n,this.polylineBarriers)&&(Z(n,this.polylineBarriers)?re(n,this.polylineBarriers):this.set({polylineBarriers:n})),K(s,this.polygonBarriers)&&(Z(s,this.polygonBarriers)?oe(s,this.polygonBarriers):this.set({polygonBarriers:s})),this.set({checksum:t}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",a),a.geometry&&(this.spatialReference=a.geometry.spatialReference)}_getNetworkFeatures(e,t,s,n){const a=Q(e)?e.layers:e.featureCollection?.layers,l=a?.find(e=>e.layerDefinition.name===t);if(null==l)return new i;const{layerDefinition:u,popupInfo:p,featureSet:c}=l,m=u.drawingInfo.renderer,{features:y}=c,f=c.spatialReference??u.spatialReference??u.extent.spatialReference??v,d=m&&R(m),h=b.fromJSON(f),g=y.map(e=>{const i=r.fromJSON(e);i.geometry&&e.geometry&&null==e.geometry.spatialReference&&(i.geometry.spatialReference=h);const n=s(i);return n.symbol??=d?.getSymbol(i)??this._getNetworkSymbol(t),n.popupTemplate??=p&&o.fromJSON(p),n});return n&&g.some(({symbol:e})=>!e)&&n(g),new i(g)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,r){if(null!=this._cachedServiceDescription&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const o=await T(e,t,r);return this._cachedServiceDescription={serviceDescription:o,url:e},o}_setStopSymbol(e){if(!e||!e.length||!this.defaultSymbols.stops||e.every(({symbol:e})=>!!e))return;const{first:t,last:r,middle:o,unlocated:i,waypoint:s,break:n}=this.defaultSymbols.stops,a=e.map(({sequence:e})=>e).filter(e=>null!=e),l=e.length===a.length;if(!this.routeInfo&&!l||1===e.length)return void e.forEach((i,s)=>{switch(s){case 0:i.symbol=t;break;case e.length-1:i.symbol=r;break;default:i.symbol=o}});const u=Math.min(...a),p=Math.max(...a);for(const c of e)c.sequence!==u?c.sequence!==p?this.routeInfo&&"ok"!==c.status&&"not-located-on-closest"!==c.status?c.symbol=i:"waypoint"!==c.locationType?"break"!==c.locationType?c.symbol=o:c.symbol=n:c.symbol=s:c.symbol=r:c.symbol=t}_toRouteLayerSolution(e){const{checksum:t,routeResults:r}=e,o=r[0].stops?.map(e=>W.fromJSON(e.toJSON()));this._setStopSymbol(o);const i=new de(o),s=new ye(e.polygonBarriers?.map(e=>G.fromJSON(e.toJSON())));ne(s,this.defaultSymbols.polygonBarriers);const n=new fe(e.polylineBarriers?.map(e=>J.fromJSON(e.toJSON())));ne(n,this.defaultSymbols.polylineBarriers);const a=new me(e.pointBarriers?.map(e=>x.fromJSON(e.toJSON())));ne(a,this.defaultSymbols.pointBarriers);const l=r[0].route?.toJSON(),u=M.fromJSON(l);u.symbol=this.defaultSymbols.routeInfo;const p=new ce(r[0].directionPoints?.features.map(e=>k.fromJSON(e.toJSON())));ne(p,this.defaultSymbols.directionPoints);const c=new pe(r[0].directionLines?.features.map(e=>F.fromJSON(e.toJSON())));return ne(c,this.defaultSymbols.directionLines),{checksum:t,directionLines:c,directionPoints:p,pointBarriers:a,polygonBarriers:s,polylineBarriers:n,routeInfo:u,stops:i}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",F.fields,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",k.fields,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,r,o,i,s){if(!e?.length)return null;const n=this.spatialReference.toJSON(),{fullExtent:a,maxScale:l,minScale:u}=this;return{featureSet:{features:e.toArray().map(e=>ue(e)),geometryType:r,spatialReference:n},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:t?.toJSON()??H(r)}},extent:a.toJSON(),fields:o,geometryType:r,hasM:!1,hasZ:!1,maxScale:l,minScale:u,name:i,objectIdField:"ObjectID",spatialReference:n,title:s,type:"Feature Layer",typeIdField:""}}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",x.fields,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",G.fields,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",J.fields,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(null!=this.routeInfo?new i([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",M.fields,"RouteInfo","Route Details")}_writeStops(){const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",W.fields,"Stops","Stops");if(null==e)return null;const{stops:t}=this.defaultSymbols,r=t?.first?.toJSON(),o=t?.middle?.toJSON(),i=t?.last?.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:o,uniqueValueInfos:[{value:"1",symbol:r,label:"First Stop"},{value:`${this.stops.length}`,symbol:i,label:"Last Stop"}]},e}_populatePortalFields(e,t,r){const o=t.networkDataset?.networkAttributes,i=o?.filter(({usageType:e})=>"cost"===e)??[],a=r.travelMode??t.defaultTravelMode;if(null==a)return void n.getLogger(this).warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:u}=a,p=i.find(({name:e})=>e===l),c=i.find(({name:e})=>e===u),m=r.travelMode?.impedanceAttributeName??r.impedanceAttribute??t.impedance,y=p?.units,f=c?.units;if(!y||!f)throw new s("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const d=r.directionsLanguage??t.directionsLanguage,h=r.accumulateAttributes??t.accumulateAttributeNames??[],g=new Set(i.filter(({name:e})=>e===l||e===u||e===m||null!=e&&h.includes(e)).map(({name:e})=>e)),w=e=>{for(const t in e)g.has(t)||delete e[t]};for(const s of e.pointBarriers)null!=s.costs&&(s.addedCost=s.costs[m]??0,w(s.costs));for(const s of e.polygonBarriers)null!=s.costs&&(s.scaleFactor=s.costs[m]??1,w(s.costs));for(const s of e.polylineBarriers)null!=s.costs&&(s.scaleFactor=s.costs[m]??1,w(s.costs));const{routeInfo:S}=e,{findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I}=r;S.analysisSettings=new U({accumulateAttributes:h,directionsLanguage:d,findBestSequence:b,preserveFirstStop:v,preserveLastStop:B,startTimeIsUTC:P,timeWindowsAreUTC:I,travelMode:a}),S.totalDuration=ae(S.totalCosts?.[l]??0,y),S.totalDistance=le(S.totalCosts?.[u]??0,f),S.totalLateDuration=ae(S.totalViolations?.[l]??0,y),S.totalWaitDuration=ae(S.totalWait?.[l]??0,y),null!=S.totalCosts&&w(S.totalCosts),null!=S.totalViolations&&w(S.totalViolations),null!=S.totalWait&&w(S.totalWait);for(const s of e.stops)null!=s.serviceCosts&&(s.serviceDuration=ae(s.serviceCosts[l]??0,y),s.serviceDistance=le(s.serviceCosts[u]??0,f),w(s.serviceCosts)),null!=s.cumulativeCosts&&(s.cumulativeDuration=ae(s.cumulativeCosts[l]??0,y),s.cumulativeDistance=le(s.cumulativeCosts[u]??0,f),w(s.cumulativeCosts)),null!=s.violations&&(s.lateDuration=ae(s.violations[l]??0,y),w(s.violations)),null!=s.wait&&(s.waitDuration=ae(s.wait[l]??0,y),w(s.wait))}};e([y({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],he.prototype,"_featureCollection",void 0),e([q(["web-map","portal-item"],"_featureCollection")],he.prototype,"writeFeatureCollectionWebmap",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],he.prototype,"_type",void 0),e([y({type:String})],he.prototype,"checksum",void 0),e([y({nonNullable:!0,type:C})],he.prototype,"defaultSymbols",void 0),e([y({readOnly:!0})],he.prototype,"directionLines",void 0),e([V(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],he.prototype,"readDirectionLines",null),e([y({readOnly:!0})],he.prototype,"directionPoints",void 0),e([V(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],he.prototype,"readDirectionPoints",null),e([y({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],he.prototype,"featureCollectionType",void 0),e([y({readOnly:!0})],he.prototype,"fullExtent",null),e([y({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],he.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],he.prototype,"listMode",void 0),e([y({type:Number,nonNullable:!0,json:{write:!1}})],he.prototype,"maxScale",void 0),e([V(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],he.prototype,"readMaxScale",null),e([y({type:Number,nonNullable:!0,json:{write:!1}})],he.prototype,"minScale",void 0),e([V(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],he.prototype,"readMinScale",null),e([y({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],he.prototype,"operationalLayerType",void 0),e([y({nonNullable:!0,type:i.ofType(x)})],he.prototype,"pointBarriers",void 0),e([V(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],he.prototype,"readPointBarriers",null),e([y({nonNullable:!0,type:i.ofType(G)})],he.prototype,"polygonBarriers",void 0),e([V(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],he.prototype,"readPolygonBarriers",null),e([y({nonNullable:!0,type:i.ofType(J)})],he.prototype,"polylineBarriers",void 0),e([V(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],he.prototype,"readPolylineBarriers",null),e([y({readOnly:!0})],he.prototype,"routeInfo",void 0),e([V(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],he.prototype,"readRouteInfo",null),e([y({type:b})],he.prototype,"spatialReference",void 0),e([V(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],he.prototype,"readSpatialReference",null),e([y({nonNullable:!0,type:i.ofType(W)})],he.prototype,"stops",void 0),e([V(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],he.prototype,"readStops",null),e([y()],he.prototype,"title",null),e([y({readOnly:!0,json:{read:!1}})],he.prototype,"type",void 0),e([y()],he.prototype,"url",null),he=e([f("esri.layers.RouteLayer")],he);const ge=he;export{ge as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../PopupTemplate.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{setDeepValue as s}from"../../core/object.js";import{toPt as i}from"../../core/screenUtils.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../PopupTemplate.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{setDeepValue as s}from"../../core/object.js";import{toPt as i}from"../../core/screenUtils.js";import{property as l,subclass as p}from"../../core/accessorSupport/decorators.js";import{ensureNumber as n}from"../../core/accessorSupport/ensureType.js";import a from"./AggregateField.js";import{popupEnabled as u,labelsVisible as d}from"./commonProperties.js";import{createDefaultRenderer as m}from"./featureLayerUtils.js";import c from"./LabelClass.js";import f from"../../renderers/SimpleRenderer.js";import{read as y}from"../../renderers/support/jsonUtils.js";import{rendererTypes as b}from"../../renderers/support/typeUtils.js";import{symbolTypesCluster as g}from"../../symbols/support/typeUtils.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";var j;function w(e){return"simple"===e.type&&!e.visualVariables?.length}let I=j=class extends t{constructor(e){super(e),this.type="cluster",this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.renderer=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=[]}get clusterRadius(){return this._get("clusterRadius")??i("80px")}set clusterRadius(e){this._set("clusterRadius",e)}get clusterMinSize(){return this._get("clusterMinSize")??i("12px")}set clusterMinSize(e){this._set("clusterMinSize",e)}get clusterMaxSize(){return this._get("clusterMaxSize")??i("50px")}set clusterMaxSize(e){this._set("clusterMaxSize",e)}readRenderer(e,r,t){const o=r.drawingInfo?.renderer;return o?.authoringInfo?.isAutoGenerated?null:o?w(o)?null:y(o,r,t)??void 0:m(r,t)}readSymbol(e,r,t){const o=r.drawingInfo?.renderer;if(o?.authoringInfo?.isAutoGenerated)return null;if(o&&w(o)){const e=y(o,r,t);return e?.symbol}return null}writeSymbol(e,r,t,o){const s=this.renderer?.authoringInfo?.isAutoGenerated;if(!this.renderer||s){const t=new f({symbol:e});r.drawingInfo={renderer:t.write({},o)}}}writeFields(e,r,t){const o=e.filter(e=>"avg_angle"!==e.statisticType).map(e=>e.toJSON());s(t,o,r)}readFields(e,r,t){return e.filter(e=>!e.isAutoGenerated).map(e=>a.fromJSON(e))}clone(){return new j({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:o(this.labelingInfo),labelsVisible:this.labelsVisible,fields:o(this.fields),maxScale:this.maxScale,renderer:o(this.renderer),symbol:o(this.symbol),popupEnabled:this.popupEnabled,popupTemplate:o(this.popupTemplate)})}};e([l({type:["cluster"],readOnly:!0,json:{write:!0}})],I.prototype,"type",void 0),e([l({cast:e=>"auto"===e?e:n(i(e)),json:{write:!0}})],I.prototype,"clusterRadius",null),e([l({type:Number,cast:i,json:{write:!0}})],I.prototype,"clusterMinSize",null),e([l({type:Number,cast:i,json:{write:!0}})],I.prototype,"clusterMaxSize",null),e([l({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],I.prototype,"maxScale",void 0),e([l(u)],I.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],I.prototype,"popupTemplate",void 0),e([l({types:b,json:{write:{target:"drawingInfo.renderer"}}})],I.prototype,"renderer",void 0),e([h("renderer",["drawingInfo.renderer"])],I.prototype,"readRenderer",null),e([l({types:g})],I.prototype,"symbol",void 0),e([h("symbol",["drawingInfo.renderer"])],I.prototype,"readSymbol",null),e([S("symbol")],I.prototype,"writeSymbol",null),e([l({type:[c],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],I.prototype,"labelingInfo",void 0),e([l(d)],I.prototype,"labelsVisible",void 0),e([l({type:[a],json:{write:!0}})],I.prototype,"fields",void 0),e([S("fields")],I.prototype,"writeFields",null),e([h("fields")],I.prototype,"readFields",null),I=j=e([p("esri.layers.support.FeatureReductionCluster")],I);export{I as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import"../../core/has.js";import{JSONMap as r}from"../../core/jsonMap.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{toPt as i}from"../../core/screenUtils.js";import{property as l,subclass as n}from"../../core/accessorSupport/decorators.js";import s from"./LabelExpressionInfo.js";import{templateStringToSql as a,getSingleFieldArcadeExpression as p,getLabelExpression as c,getLabelExpressionArcade as b,getLabelExpressionSingleField as m}from"./labelUtils.js";import{isSceneServiceLayer as u}from"./layerUtils.js";import{defaultTextSymbol2D as
|
|
5
|
+
import{__decorate as e}from"tslib";import"../../core/has.js";import{JSONMap as r}from"../../core/jsonMap.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{toPt as i}from"../../core/screenUtils.js";import{property as l,subclass as n}from"../../core/accessorSupport/decorators.js";import s from"./LabelExpressionInfo.js";import{templateStringToSql as a,getSingleFieldArcadeExpression as p,getLabelExpression as c,getLabelExpressionArcade as b,getLabelExpressionSingleField as m}from"./labelUtils.js";import{isSceneServiceLayer as u}from"./layerUtils.js";import{defaultTextSymbol2D as w}from"../../symbols/support/defaults.js";import{writeLabelSymbol as f}from"../../symbols/support/jsonUtils.js";import{symbolTypesLabel3D as v,symbolTypesLabel as y}from"../../symbols/support/typeUtils.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{writer as d}from"../../core/accessorSupport/decorators/writer.js";var S;const L=new r({esriServerPointLabelPlacementAboveCenter:"above-center",esriServerPointLabelPlacementAboveLeft:"above-left",esriServerPointLabelPlacementAboveRight:"above-right",esriServerPointLabelPlacementBelowCenter:"below-center",esriServerPointLabelPlacementBelowLeft:"below-left",esriServerPointLabelPlacementBelowRight:"below-right",esriServerPointLabelPlacementCenterCenter:"center-center",esriServerPointLabelPlacementCenterLeft:"center-left",esriServerPointLabelPlacementCenterRight:"center-right",esriServerLinePlacementAboveAfter:"above-after",esriServerLinePlacementAboveAlong:"above-along",esriServerLinePlacementAboveBefore:"above-before",esriServerLinePlacementAboveStart:"above-start",esriServerLinePlacementAboveEnd:"above-end",esriServerLinePlacementBelowAfter:"below-after",esriServerLinePlacementBelowAlong:"below-along",esriServerLinePlacementBelowBefore:"below-before",esriServerLinePlacementBelowStart:"below-start",esriServerLinePlacementBelowEnd:"below-end",esriServerLinePlacementCenterAfter:"center-after",esriServerLinePlacementCenterAlong:"center-along",esriServerLinePlacementCenterBefore:"center-before",esriServerLinePlacementCenterStart:"center-start",esriServerLinePlacementCenterEnd:"center-end",esriServerPolygonPlacementAlwaysHorizontal:"always-horizontal"},{ignoreUnknown:!0});function P(e,r,t){return{enabled:!u(t?.layer)}}function x(e){return!e||"service"!==e.origin&&!("map-image"===e.layer?.type)}function g(e){return"map-image"===e?.type}function E(e){return!!g(e)&&!!e.capabilities?.exportMap?.supportsArcadeExpressionForLabeling}function j(e){return x(e)||E(e?.layer)}let A=class extends t{static{S=this}static evaluateWhere(e,r){const t=(e,r,t)=>{switch(r){case"=":return e==t;case"<>":return e!=t;case">":return e>t;case">=":return e>=t;case"<":return e<t;case"<=":return e<=t}return!1};try{if(null==e)return!0;const o=e.split(" ");if(3===o.length)return t(r[o[0]],o[1],o[2]);if(7===o.length){const e=t(r[o[0]],o[1],o[2]),i=o[3],l=t(r[o[4]],o[5],o[6]);switch(i){case"AND":return e&&l;case"OR":return e||l}}return!1}catch(o){}}constructor(e){super(e),this.type="label",this.name=null,this.allowOverrun=!1,this.deconflictionStrategy="static",this.labelExpression=null,this.labelExpressionInfo=null,this.labelPlacement=null,this.labelPosition="curved",this.maxScale=0,this.minScale=0,this.repeatLabel=!0,this.symbol=w,this.useCodedValues=void 0,this.where=null}readLabelExpression(e,r){const t=r.labelExpressionInfo;if(!t||!t.value&&!t.expression)return e}writeLabelExpression(e,r,t){if(this.labelExpressionInfo)if(null!=this.labelExpressionInfo.value)e=a(this.labelExpressionInfo.value);else if(null!=this.labelExpressionInfo.expression){const r=p(this.labelExpressionInfo.expression);r&&(e="["+r+"]")}null!=e&&(r[t]=e)}writeLabelExpressionInfo(e,r,t,o){if(null==e&&null!=this.labelExpression&&x(o))e=new s({expression:this.getLabelExpressionArcade()});else if(!e)return;const i=e.toJSON(o);i.expression&&(r[t]=i)}writeMaxScale(e,r){(e||this.minScale)&&(r.maxScale=e)}writeMinScale(e,r){(e||this.maxScale)&&(r.minScale=e)}get repeatLabelDistance(){return this._get("repeatLabelDistance")}set repeatLabelDistance(e){this._set("repeatLabelDistance",e)}getLabelExpression(){return c(this)}getLabelExpressionArcade(){return b(this)}getLabelExpressionSingleField(){return m(this)}hash(){return JSON.stringify(this)}clone(){return new S({allowOverrun:this.allowOverrun,deconflictionStrategy:this.deconflictionStrategy,labelExpression:this.labelExpression,labelExpressionInfo:o(this.labelExpressionInfo),labelPosition:this.labelPosition,labelPlacement:this.labelPlacement,maxScale:this.maxScale,minScale:this.minScale,name:this.name,repeatLabel:this.repeatLabel,repeatLabelDistance:this.repeatLabelDistance,symbol:o(this.symbol),where:this.where,useCodedValues:this.useCodedValues})}};e([l({type:String,json:{write:!0}})],A.prototype,"name",void 0),e([l({type:Boolean,json:{write:!0,default:!1,origins:{"web-scene":{write:!1},"portal-item":{default:!1,write:{overridePolicy:P}}}}})],A.prototype,"allowOverrun",void 0),e([l({type:String,json:{write:!0,default:"static",origins:{"web-scene":{write:!1},"portal-item":{default:"static",write:{overridePolicy:P}}}}})],A.prototype,"deconflictionStrategy",void 0),e([l({type:String,json:{write:{overridePolicy(e,r,t){return this.labelExpressionInfo&&"service"===t?.origin&&E(t.layer)?{enabled:!1}:{allowNull:!0}}}}})],A.prototype,"labelExpression",void 0),e([h("labelExpression")],A.prototype,"readLabelExpression",null),e([d("labelExpression")],A.prototype,"writeLabelExpression",null),e([l({type:s,json:{write:{overridePolicy:(e,r,t)=>j(t)?{allowNull:!0}:{enabled:!1}}}})],A.prototype,"labelExpressionInfo",void 0),e([d("labelExpressionInfo")],A.prototype,"writeLabelExpressionInfo",null),e([l({type:L.apiValues,json:{type:L.jsonValues,read:L.read,write:L.write}})],A.prototype,"labelPlacement",void 0),e([l({type:["curved","parallel"],json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],A.prototype,"labelPosition",void 0),e([l({type:Number})],A.prototype,"maxScale",void 0),e([d("maxScale")],A.prototype,"writeMaxScale",null),e([l({type:Number})],A.prototype,"minScale",void 0),e([d("minScale")],A.prototype,"writeMinScale",null),e([l({type:Boolean,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:P}}}}})],A.prototype,"repeatLabel",void 0),e([l({type:Number,cast:i,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:P}}}}})],A.prototype,"repeatLabelDistance",null),e([l({types:y,json:{origins:{"web-scene":{types:v,write:f,default:null}},write:f,default:null}})],A.prototype,"symbol",void 0),e([l({type:Boolean,json:{write:!0}})],A.prototype,"useCodedValues",void 0),e([l({type:String,json:{write:!0}})],A.prototype,"where",void 0),A=S=e([n("esri.layers.support.LabelClass")],A);export{A as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.39",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"license": "SEE LICENSE IN copyright.txt",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@amcharts/amcharts5": "~5.14.4",
|
|
22
|
-
"@arcgis/toolkit": "^5.0.0-next.
|
|
22
|
+
"@arcgis/toolkit": "^5.0.0-next.53",
|
|
23
23
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
24
24
|
"@esri/calcite-components": "^3.3.2",
|
|
25
25
|
"@vaadin/grid": "~24.9.5",
|
|
26
|
-
"@zip.js/zip.js": "~2.8.
|
|
26
|
+
"@zip.js/zip.js": "~2.8.10",
|
|
27
27
|
"luxon": "~3.7.2",
|
|
28
28
|
"marked": "~17.0.0",
|
|
29
29
|
"tslib": "^2.8.1"
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../Color.js";import{JSONMap as o}from"../core/jsonMap.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{toPt as i}from"../core/screenUtils.js";import{property as s,subclass as n}from"../core/accessorSupport/decorators.js";import{Integer as p}from"../core/accessorSupport/ensureType.js";import{VisualVariablesMixin as a}from"./mixins/VisualVariablesMixin.js";import l from"./support/AuthoringInfo.js";import h from"./support/RendererLegendOptions.js";import{enumeration as d}from"../core/accessorSupport/decorators/enumeration.js";var m;const u=new o({flow_from:"flow-from",flow_to:"flow-to"});let c=m=class extends(a(r)){constructor(t){super(t),this.density=.8,this.color=new e([255,255,255,1]),this.flowSpeed=10,this.trailLength=100,this.smoothing=0,this.flowRepresentation="flow-from",this.type="flow",this.authoringInfo=null,this.legendOptions=null,this.trailCap="butt",this.background="none"}get maxPathLength(){return this._get("maxPathLength")??200}set maxPathLength(t){this._set("maxPathLength",t)}get trailWidth(){return this._get("trailWidth")??1.5}set trailWidth(t){this._set("trailWidth",t)}set visualVariables(t){super.visualVariables=t}clone(){const{density:t,maxPathLength:e,trailWidth:o,flowSpeed:r,trailLength:i,smoothing:s,flowRepresentation:n,trailCap:p,background:a}=this,l=this.color.clone(),h=(this.visualVariables||[]).map(t=>t.clone()),d=this.authoringInfo?.clone(),u=this.legendOptions?.clone();return new m({density:t,color:l,maxPathLength:e,trailWidth:o,flowSpeed:r,trailLength:i,trailCap:p,background:a,smoothing:s,flowRepresentation:n,visualVariables:h,authoringInfo:d,legendOptions:u})}getSymbol(t,e){}async getSymbolAsync(t,e){}getSymbols(){return[]}};t([s({type:Number,json:{write:!0}})],c.prototype,"density",void 0),t([s({type:e,json:{type:[p],write:{allowNull:!0}}})],c.prototype,"color",void 0),t([s({type:Number,cast:i,json:{write:!0}})],c.prototype,"maxPathLength",null),t([s({type:Number,cast:i,json:{write:!0}})],c.prototype,"trailWidth",null),t([s({type:Number,json:{write:!0}})],c.prototype,"flowSpeed",void 0),t([s({type:Number,json:{write:!0}})],c.prototype,"trailLength",void 0),t([s({type:Number,cast:i,json:{write:!1}})],c.prototype,"smoothing",void 0),t([s({type:u.apiValues,json:{type:u.jsonValues,read:{reader:u.read},write:{writer:u.write}}})],c.prototype,"flowRepresentation",void 0),t([d({flowRenderer:"flow"}),s({json:{write:{isRequired:!0}}})],c.prototype,"type",void 0),t([s({type:l,json:{write:!0}})],c.prototype,"authoringInfo",void 0),t([s({type:h,json:{write:!0}})],c.prototype,"legendOptions",void 0),t([s({type:["butt","round"],json:{write:!0}})],c.prototype,"trailCap",void 0),t([s({type:String,json:{origins:{"web-scene":{write:!1}},write:!0}})],c.prototype,"background",void 0),c=m=t([n("esri.renderers.FlowRenderer")],c);export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as i}from"../core/lang.js";import{toPt as s}from"../core/screenUtils.js";import{property as r,subclass as n}from"../core/accessorSupport/decorators.js";import{collectField as o,collectArcadeFieldNames as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as i}from"../core/lang.js";import{toPt as s}from"../core/screenUtils.js";import{property as r,subclass as n}from"../core/accessorSupport/decorators.js";import{collectField as o,collectArcadeFieldNames as l}from"../layers/support/fieldUtils.js";import p from"./Renderer.js";import a from"./support/AuthoringInfo.js";import u from"./support/HeatmapColorStop.js";import{HeatmapLegendOptions as y}from"./support/HeatmapLegendOptions.js";import{kernelDensityRadiusPtToGaussianBlurRadiusPx as m,gaussianBlurRadiusPxToKernelDensityRadiusPt as h,magicKernelDensityRadiusInflationFactor as d}from"./support/heatmapUtils.js";import c from"../symbols/SimpleMarkerSymbol.js";import{enumeration as x}from"../core/accessorSupport/decorators/enumeration.js";var g;function f(t){if(null!=t){const{maxDensity:e,minDensity:i,radius:s}=t;if(null!=e||null!=i||null!=s){const{blurRadius:e,maxPixelIntensity:i,minPixelIntensity:s,...r}=t;return r}}return t}let w=g=class extends p{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new u({ratio:0,color:new e("rgba(255, 140, 0, 0)")}),new u({ratio:.75,color:new e("rgba(255, 140, 0, 1)")}),new u({ratio:.9,color:new e("rgba(255, 0, 0, 1)")})],this.field=null,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null}normalizeCtorArgs(t){return f(t)}get blurRadius(){return m(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",h(t)),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity)}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity)}get radius(){return this._get("radius")??18}set radius(t){this._set("radius",t)}get _pixelIntensityToDensity(){return 24/(d**2*this.blurRadius**4)}read(t,e){t=f(t),super.read(t,e)}getSymbol(){return new c}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,s=this.valueExpression;i&&"string"==typeof i&&o(t,e,i),s&&"string"==typeof s&&await l(t,e,null,s)}getAttributeHash(){return""}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new g({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:i(this.colorStops),field:this.field,legendOptions:i(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};t([r({type:a,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],w.prototype,"authoringInfo",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"blurRadius",null),t([r({type:[u],json:{write:{isRequired:!0}}})],w.prototype,"colorStops",void 0),t([r({type:String,json:{write:!0}})],w.prototype,"field",void 0),t([r({type:y,json:{write:!0}})],w.prototype,"legendOptions",void 0),t([r({type:Number,json:{write:!0}})],w.prototype,"maxDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"maxPixelIntensity",null),t([r({type:Number,json:{write:!0}})],w.prototype,"minDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"minPixelIntensity",null),t([r({type:Number,cast:s,json:{write:!0}})],w.prototype,"radius",null),t([r({type:Number,range:{min:0},json:{default:0,write:!0}})],w.prototype,"referenceScale",void 0),t([x({heatmap:"heatmap"})],w.prototype,"type",void 0),t([r({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],w.prototype,"valueExpression",void 0),t([r({type:String})],w.prototype,"valueExpressionTitle",void 0),t([r({readOnly:!0})],w.prototype,"_pixelIntensityToDensity",null),w=g=t([n("esri.renderers.HeatmapRenderer")],w);export{w as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import{isSome as r}from"../core/arrayUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import{toPt as i}from"../core/screenUtils.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import{collectArcadeFieldNames as p}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import m from"./support/AttributeColorInfo.js";import{rendererBackgroundFillSymbolProperty as u}from"./support/commonProperties.js";import{OthersCategory as y}from"./support/OthersCategory.js";import d from"./support/RendererLegendOptions.js";import b from"./visualVariables/OpacityVariable.js";import c from"./visualVariables/SizeVariable.js";import h from"./visualVariables/VisualVariable.js";import f from"../symbols/SimpleLineSymbol.js";import j from"../symbols/SimpleMarkerSymbol.js";import{enumeration as g}from"../core/accessorSupport/decorators/enumeration.js";const v={base:h,key:"type",typeMap:{size:c,opacity:b}};let S=class extends(n(o(a))){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new t([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new y,this.legendOptions=null,this.outline=null,this.
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import{isSome as r}from"../core/arrayUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import{toPt as i}from"../core/screenUtils.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import{collectArcadeFieldNames as p}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import m from"./support/AttributeColorInfo.js";import{rendererBackgroundFillSymbolProperty as u}from"./support/commonProperties.js";import{OthersCategory as y}from"./support/OthersCategory.js";import d from"./support/RendererLegendOptions.js";import b from"./visualVariables/OpacityVariable.js";import c from"./visualVariables/SizeVariable.js";import h from"./visualVariables/VisualVariable.js";import f from"../symbols/SimpleLineSymbol.js";import j from"../symbols/SimpleMarkerSymbol.js";import{enumeration as g}from"../core/accessorSupport/decorators/enumeration.js";const v={base:h,key:"type",typeMap:{size:c,opacity:b}};let S=class extends(n(o(a))){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new t([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new y,this.legendOptions=null,this.outline=null,this.type="pie-chart",this.visualVariables=null}get size(){return this._get("size")??12}set size(e){this._set("size",e)}getSymbol(){return new j({size:this.size?this.size/2+(this.outline?.width||0):0})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol(),this.backgroundFillSymbol].filter(r)}getAttributeHash(){return this.visualVariables?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return this.symbols.reduce((e,t)=>e+JSON.stringify(t),"")}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const r of this.attributes)r.valueExpression&&await p(e,t,null,r.valueExpression),r.field&&e.add(r.field)}};e([s({type:[m],json:{write:!0}})],S.prototype,"attributes",void 0),e([s(u)],S.prototype,"backgroundFillSymbol",void 0),e([s({type:t,json:{write:!0}})],S.prototype,"defaultColor",void 0),e([s({type:String,json:{write:!0}})],S.prototype,"defaultLabel",void 0),e([s({type:Number,range:{min:0,max:1},json:{write:!0}})],S.prototype,"holePercentage",void 0),e([s({type:y,json:{write:!0}})],S.prototype,"othersCategory",void 0),e([s({type:d,json:{write:!0}})],S.prototype,"legendOptions",void 0),e([s({type:f,json:{default:null,write:!0}})],S.prototype,"outline",void 0),e([s({type:Number,cast:i,json:{write:!0}})],S.prototype,"size",null),e([g({pieChart:"pie-chart"})],S.prototype,"type",void 0),e([s({types:[v]})],S.prototype,"visualVariables",void 0),S=e([l("esri.renderers.PieChartRenderer")],S);export{S as default};
|
package/rest/route/utils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{impedanceAttributeNameJsonMap as
|
|
5
|
+
import{impedanceAttributeNameJsonMap as t}from"../support/networkEnums.js";function e(e,r){if(null==e)return null;const i={},s=new RegExp(`^${r}`,"i");for(const o of Object.keys(e))if(s.test(o)){const s=o.slice(r.length);i[t.fromJSON(s)]=e[o]}return i}function r(e,r,i){if(null!=e){r.attributes||(r.attributes={});for(const s in e){const o=t.toJSON(s);r.attributes[`${i}${o}`]=e[s]}}}function i(e){const r={};for(const i of Object.keys(e)){const s=i;r[t.fromJSON(s)]=e[i]}return r}function s(e){const r={};for(const i of Object.keys(e)){const s=i;r[t.toJSON(s)]=e[i]}return r}function o(t,e){return null==t||null==e?null:Math.round((t-e)/6e4)}function n(t){const e=t.toJSON(),r=e;return r.accumulateAttributeNames&&=e.accumulateAttributeNames?.join(),r.attributeParameterValues&&=JSON.stringify(e.attributeParameterValues),r.barriers&&=JSON.stringify(e.barriers),r.locateSettings&&=JSON.stringify(e.locateSettings),r.outSR&&=e.outSR?.wkid,r.overrides&&=JSON.stringify(e.overrides),r.polygonBarriers&&=JSON.stringify(e.polygonBarriers),r.polylineBarriers&&=JSON.stringify(e.polylineBarriers),r.restrictionAttributeNames&&=e.restrictionAttributeNames?.join(),r.stops&&=JSON.stringify(e.stops),r.travelMode&&=JSON.stringify(e.travelMode),r}function a(t){const e=t.toJSON(),r=e;return r.accumulateAttributeNames&&=e.accumulateAttributeNames?.join(),r.attributeParameterValues&&=JSON.stringify(e.attributeParameterValues),r.barriers&&=JSON.stringify(e.barriers),r.facilities&&=JSON.stringify(e.facilities),r.incidents&&=JSON.stringify(e.incidents),r.outSR&&=e.outSR?.wkid,r.overrides&&=JSON.stringify(e.overrides),r.polygonBarriers&&=JSON.stringify(e.polygonBarriers),r.polylineBarriers&&=JSON.stringify(e.polylineBarriers),r.restrictionAttributeNames&&=e.restrictionAttributeNames?.join(),r.travelMode&&=JSON.stringify(e.travelMode),r}function u(t){const e=t.toJSON(),r=e;return r.accumulateAttributeNames&&=e.accumulateAttributeNames?.join(),r.attributeParameterValues&&=JSON.stringify(e.attributeParameterValues),r.barriers&&=JSON.stringify(e.barriers),r.defaultBreaks&&=e.defaultBreaks?.join(),r.excludeSourcesFromPolygons&&=e.excludeSourcesFromPolygons?.join(),r.facilities&&=JSON.stringify(e.facilities),r.outSR&&=e.outSR?.wkid,r.overrides&&=JSON.stringify(e.overrides),r.polygonBarriers&&=JSON.stringify(e.polygonBarriers),r.polylineBarriers&&=JSON.stringify(e.polylineBarriers),r.restrictionAttributeNames&&=e.restrictionAttributeNames?.join(),r.travelMode&&=JSON.stringify(e.travelMode),r}function l(t){const e=t.toJSON(),r={depots:JSON.stringify(e.depots),orders:JSON.stringify(e.orders),routes:JSON.stringify(e.routes),token:e.token};return e.analysis_region&&(r.analysis_region=e.analysis_region),e.directions_language&&(r.directions_language=e.directions_language),e.distance_units&&(r.distance_units=e.distance_units),e.earliest_route_start_date&&(r.earliest_route_start_date=e.earliest_route_start_date),e.earliest_route_start_time&&(r.earliest_route_start_time=e.earliest_route_start_time),e.ignore_invalid_order_locations&&(r.ignore_invalid_order_locations=e.ignore_invalid_order_locations),e.line_barriers&&(r.line_barriers=JSON.stringify(e.line_barriers)),e.max_route_total_time&&(r.max_route_total_time=e.max_route_total_time),e.order_specialties&&(r.order_specialties=JSON.stringify(e.order_specialties)),e.overrides&&(r.overrides=JSON.stringify(e.overrides)),e.point_barriers&&(r.point_barriers=JSON.stringify(e.point_barriers)),e.polygon_barriers&&(r.polygon_barriers=JSON.stringify(e.polygon_barriers)),e.populate_directions&&(r.populate_directions=e.populate_directions),e.route_shape&&(r.route_shape=e.route_shape),e.route_specialties&&(r.route_specialties=JSON.stringify(e.route_specialties)),e.save_output_network_analysis_layer&&(r.save_output_network_analysis_layer=e.save_output_network_analysis_layer),e.save_route_data&&(r.save_route_data=e.save_route_data),e.sequence_gap&&(r.sequence_gap=e.sequence_gap),e.time_units&&(r.time_units=e.time_units),e.time_zone_usage_for_time_fields&&(r.time_zone_usage_for_time_fields=e.time_zone_usage_for_time_fields),e.travel_mode&&(r.travel_mode=JSON.stringify(e.travel_mode)),e.zones&&(r.zones=JSON.stringify(e.zones)),r}export{a as closestFacilityParametersToQueryParameters,s as fromKebabImpedanceAttributes,e as getPrefixedProperties,o as getTimezoneOffset,l as lastMileDeliveryParametersToQueryParameters,n as routeParametersToQueryParameters,u as serviceAreaParametersToQueryParameters,r as setPrefixedProperties,i as toKebabImpedanceAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../PopupTemplate.js";import{ClonableMixin as s}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import p from"../../geometry/Point.js";import{getPrefixedProperties as l,setPrefixedProperties as u,toKebabImpedanceAttributes as d,fromKebabImpedanceAttributes as n}from"../route/utils.js";import{statusJsonMap as m,fullEdgeJsonMap as y,curbApproachJsonMap as c,barrierTypeJsonMap as b,sideOfEdgeJsonMap as h}from"./networkEnums.js";import{symbolTypes as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../PopupTemplate.js";import{ClonableMixin as s}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import p from"../../geometry/Point.js";import{getPrefixedProperties as l,setPrefixedProperties as u,toKebabImpedanceAttributes as d,fromKebabImpedanceAttributes as n}from"../route/utils.js";import{statusJsonMap as m,fullEdgeJsonMap as y,curbApproachJsonMap as c,barrierTypeJsonMap as b,sideOfEdgeJsonMap as h}from"./networkEnums.js";import{symbolTypes as g}from"../../symbols/support/typeUtils.js";import{reader as j}from"../../core/accessorSupport/decorators/reader.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";var O;let T=class extends(s(o)){static{O=this}constructor(t){super(t),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.positionAlong=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(t,e){return l(e.attributes,"Attr_")}writeCosts(t,e){u(t,e,"Attr_")}set geometry(t){this._get("geometry")&&(this._set("positionAlong",null),this._set("sideOfEdge",null),this._set("sourceId",null),this._set("sourceOid",null),this._set("status",null)),this._set("geometry",t)}static{this.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID"},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble"},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger"},{name:"Costs",alias:"Costs",type:"esriFieldTypeString"},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger"},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger"},{name:"Name",alias:"Name",type:"esriFieldTypeString"},{name:"Status",alias:"Status",type:"esriFieldTypeInteger"}]}static fromGraphic(t){return new O({addedCost:t.attributes.AddedCost??null,barrierType:null!=t.attributes.BarrierType?b.fromJSON(t.attributes.BarrierType):null,costs:null!=t.attributes.Costs?d(JSON.parse(t.attributes.Costs)):null,curbApproach:null!=t.attributes.CurbApproach?c.fromJSON(t.attributes.CurbApproach):null,fullEdge:null!=t.attributes.FullEdge?y.fromJSON(t.attributes.FullEdge):null,geometry:t.geometry,name:t.attributes.Name??null,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,status:null!=t.attributes.Status?m.fromJSON(t.attributes.Status):null,symbol:t.symbol})}toGraphic(){const t={ObjectID:this.objectId,AddedCost:this.addedCost,BarrierType:this.barrierType?b.toJSON(this.barrierType):null,Costs:this.costs?JSON.stringify(n(this.costs)):null,CurbApproach:this.curbApproach?c.toJSON(this.curbApproach):null,FullEdge:this.fullEdge?y.toJSON(this.fullEdge):null,Name:this.name,Status:this.status?m.toJSON(this.status):null};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};t([i()],T.prototype,"addedCost",void 0),t([i({type:b.apiValues,json:{name:"attributes.BarrierType",read:{reader:b.read},write:{writer:b.write}}})],T.prototype,"barrierType",void 0),t([i()],T.prototype,"costs",void 0),t([j("costs",["attributes"])],T.prototype,"readCosts",null),t([f("costs")],T.prototype,"writeCosts",null),t([i({type:c.apiValues,json:{read:{source:"attributes.CurbApproach",reader:c.read}}})],T.prototype,"curbApproach",void 0),t([i({type:y.apiValues,json:{name:"attributes.FullEdge",read:{reader:y.read},write:{writer:y.write}}})],T.prototype,"fullEdge",void 0),t([i({type:p,json:{write:!0},value:null})],T.prototype,"geometry",null),t([i({json:{name:"attributes.Name"}})],T.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],T.prototype,"objectId",void 0),t([i({type:r})],T.prototype,"popupTemplate",void 0),t([i({json:{name:"attributes.PosAlong"}})],T.prototype,"positionAlong",void 0),t([i({type:h.apiValues,json:{name:"attributes.SideOfEdge",read:{reader:h.read},write:{writer:h.write}}})],T.prototype,"sideOfEdge",void 0),t([i({json:{name:"attributes.SourceID"}})],T.prototype,"sourceId",void 0),t([i({json:{name:"attributes.SourceOID"}})],T.prototype,"sourceOid",void 0),t([i({type:m.apiValues,json:{read:{source:"attributes.Status",reader:m.read}}})],T.prototype,"status",void 0),t([i({types:g})],T.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],T.prototype,"type",void 0),T=O=t([a("esri.rest.support.PointBarrier")],T);export{T as default};
|