@arcgis/core 4.32.0-next.20250107 → 4.32.0-next.20250108
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/WebLinkChart.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
- package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
- package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
- package/assets/esri/core/workers/chunks/{f6d6bc43ac1c13892d44.js → 58485909e1cfeb52c01e.js} +1 -1
- package/assets/esri/core/workers/chunks/{c49707b577f3805f0142.js → 5b61a1e7ac60a02a906d.js} +1 -1
- package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
- package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
- package/assets/esri/core/workers/chunks/{dca0eb66116e4b5403fc.js → 7df076d15b7b7a66dcee.js} +1 -1
- package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
- package/assets/esri/core/workers/chunks/{4423aac6e44c3dbf184e.js → 89286d8f59844724cd16.js} +1 -1
- package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
- package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
- package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/interfaces.d.ts +175 -91
- package/layers/LinkChartLayer.js +1 -1
- package/layers/MapNotesLayer.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/support/ImageElement.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/linkChart/OrganicLayoutSettings.js +1 -1
- package/package.json +3 -3
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/support/mediaLayerUtils.js +5 -0
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/views/2d/AnimationManager.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/2d/support/HighlightGroup.js +1 -1
- package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/placementUtils.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/HighlightGroup.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TilePerLayerInfo.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/layers/MediaLayerView.js +1 -1
- package/views/support/HighlightGroup.d.ts +4 -0
- package/views/support/HighlightGroup.js +5 -0
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/FeatureTable/support/exportUtils.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
- package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
- package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
- package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +0 -1
- package/assets/esri/core/workers/chunks/c05e0bd145a1c27d6857.js +0 -2
- package/views/2d/support/HighlightGroup.d.ts +0 -4
- /package/assets/esri/core/workers/chunks/{c05e0bd145a1c27d6857.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +0 -0
package/layers/LinkChartLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import o from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import y from"./Layer.js";import{convertFromGeometry as m}from"./graphics/featureConversionUtils.js";import{IdealEdgeLengthTypeOptions as f}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as L}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as w,systemOriginIdFieldName as M,systemDestinationIdFieldName as k,systemLayoutGeometryFieldName as C,systemAggregationCountFieldName as T,initializeLayersFromClientData as N}from"./knowledgeGraph/layerUtils.js";import v from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as D,getRelationshipEndNodeIds as x}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{OperationalLayer as E}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as _,LCSimpleLayout as A,LCSmartTreeLayout as j,LCRadialTreeLayout as R,LCHierarchicalLayout as G,LCCommunityLayout as P,LCForceDirectedLayout as F,NodeFlag as U,load as B,CallStatus as O,LinkType as z}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as W}from"../rest/knowledgeGraphService.js";import Q from"../geometry/Extent.js";import $ from"../geometry/Point.js";import H from"../geometry/Polyline.js";let K=class extends(E(S(I(r(y))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"radial-root-centric"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(b)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(b)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.inclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.inclusionModeDefinition)throw new i("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),c))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],n=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),n.push(s)):"entity"===s.type?t.has(r)||(t.add(r),a.push(s)):(o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new L({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=n,this.dataManager=r}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await N(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((i=>{W(this.url).then((async o=>{o.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),o.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.parent?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===g.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(o.dataModel),this.defaultLinkChartConfig={layoutSettings:r?.layoutSettings??void 0,layoutMode:D(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:o,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=v.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){n(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await a()})))}i(null)}))}))),Promise.resolve(this)}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):o.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await x(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let o=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&o.push(r);if(t){const e=new Set,t=[];for(const a of o)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});o=o.concat(t)}this.dataManager.removeFromLayer(o);for(const r of o)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),o.length>0&&(this.membershipModified=!0);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),o}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(i){throw l(i)&&a.length>0&&this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===g.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===g.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="radial-root-centric",t){const a=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,c=new Map,p=new Map,u=new Map,g=new Uint8Array(a.length),y=new Float64Array(a.length),f=new Float64Array(a.length),L=new Float64Array(a.length),b=new Float64Array(a.length),N=new Uint32Array(r.length),v=new Uint32Array(r.length),D=new Float64Array(r.length),x=new Float64Array(r.length),S=[],E="organic-standard",I=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let W,K="organic-standard",q=0,J=0;const V=_.apply;switch(K="geographic-organic-standard"===e?E:e,K){case"organic-standard":W=F.apply;break;case"organic-community":W=P.apply;break;case"hierarchical-bottom-to-top":W=G.apply;break;case"radial-root-centric":W=R.apply;break;case"tree-left-to-right":W=j.apply;break;default:W=A.apply}let X=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[w])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?g[q]=U.IsGeographic:g[q]=U.None;const o=t.lockedNodeLocations.get(i.attributes[w]);y[q]=o.x,f[q]=o.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){g[q]=U.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],o=this.dataManager.geographicLookup.get(a)?.geometryType;switch(o){case"esriGeometryPoint":y[q]=t?.x,f[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=U.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=U.IsMovable;break;default:g[q]=U.IsMovable}(null==y[q]||null==f[q]||Number.isNaN(y[q])||Number.isNaN(f[q]))&&(g[q]=U.IsMovable,y[q]=0,f[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(i.attributes[w])&&(X=!0);const e=t?.timeInfoByTypeName?.get(a),o=e?.startField,n=o&&e?.startField?i.attributes[o]:null;L[q]=n?new Date(n).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;b[q]=s?new Date(s).getTime():NaN,y[q]=0,f[q]=0,g[q]=U.IsMovable}else g[q]=U.IsMovable,y[q]=0,f[q]=0;u.set(i.attributes[w],q),S[q]={feature:i,typeName:a},q++})),X&&o.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=new Map;r.forEach((a=>{const i=a.feature.attributes[M],o=a.feature.attributes[k],n=u.get(i),r=u.get(o),s=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?a.feature.attributes[h]:null,c=s?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==n&&void 0!==r){let t=i+"-"+o;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+p);const s=Z.get(t),h=s?.has(a.typeName);h||(N[J]=n,v[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(D[J]=d?new Date(d).getTime():NaN,x[J]=p?new Date(p).getTime():NaN),void 0===s?Z.set(t,new Map([[a.typeName,J]])):s.set(a.typeName,J),J++),l.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&o.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const ee=this._validateLayoutSettings(e,t?.layoutSettings),te=this._convertLayoutSettingsToCalculationSettings(ee);await B();let ae=O.Error,ie=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ae,links:ie,graphics:a}=V((()=>t?.signal?.aborted??!1),g,y,f,L,b,N.subarray(0,J),v.subarray(0,J),D.subarray(0,J),x.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings??{})),ae===O.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ae,links:ie}=W((()=>t?.signal?.aborted??!1),g,y,f,N.subarray(0,J),v.subarray(0,J),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ae===O.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ae===O.Canceled)throw h();for(let i=0;i<S.length;i++){if(f[i]>84.9999?f[i]=84.9999:f[i]<-84.9999&&(f[i]=-84.9999),y[i]>179.9999?y[i]=179.9999:y[i]<-179.9999&&(y[i]=-179.9999),S[i].feature.attributes[C]=new $(y[i],f[i]),d.has(S[i].typeName)){const e=d.get(S[i].typeName);e?.set(S[i].feature.attributes[w],S[i].feature)}else{const e=new Map;e.set(S[i].feature.attributes[w],S[i].feature),d.set(S[i].typeName,e)}p.set(S[i].feature.attributes[w],S[i].feature);const e=m(S[i].feature.attributes[C]);this.entityLinkChartDiagramLookup.set(S[i].feature.attributes[w],S[i].feature.attributes[C]?e:null);const t=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,S[i].typeName,(()=>({useAllData:!1,members:new Map})));n(t.members,S[i].feature.attributes[w],(()=>({id:S[i].feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=S[i].feature.attributes[C],S[i].feature.attributes[C].x<I.xmin&&(I.xmin=S[i].feature.attributes[C].x),S[i].feature.attributes[C].x>I.xmax&&(I.xmax=S[i].feature.attributes[C].x),S[i].feature.attributes[C].y<I.ymin&&(I.ymin=S[i].feature.attributes[C].y),S[i].feature.attributes[C].y>I.ymax&&(I.ymax=S[i].feature.attributes[C].y)}if(this.linkChartExtent.xmin=I.xmin,this.linkChartExtent.xmax=I.xmax,this.linkChartExtent.ymin=I.ymin,this.linkChartExtent.ymax=I.ymax,!ie)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const oe=new Map,ne=new Map,re=new Map,se=new Set;for(let i=0;i<l.length;i++){const a=[],r=l[i],s=r.feature.attributes[M],h=r.feature.attributes[k];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?r.feature.attributes[a]:null,o=e?.endField;d+="-"+i+"-"+(o?r.feature.attributes[o]:null)}const g=Z.get(d).get(r.typeName),y=0===g?0:ie?.vertexEndIndex[g-1];if(!se.has(g)){if(se.add(g),ie.types[g]===z.Recursive){const e=[ie.vertices[2*y],ie.vertices[2*y+1]],t=[ie.vertices[2*(y+1)],ie.vertices[2*(y+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],o=[i[0]-e[0],i[1]-e[1]],n=[i[0]+o[1],i[1]-o[0]],r=[i[0]-o[1],i[1]+o[0]];a.push(e),a.push(n),a.push(t),a.push(r),a.push(e)}else{if(ie.types[g]!==z.Regular){o.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=y;e<ie.vertexEndIndex[g];e++)a.push([ie.vertices[2*e],ie.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=S[u.get(s)]?.feature.attributes[C],t=S[u.get(h)]?.feature.attributes[C];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);oe.has(d)?oe.get(d).push(a):oe.set(d,[a])}const f=oe.get(d);ne.has(d)||(ne.set(d,new Map),re.set(d,new Map));const L=ne.get(d),b=re.get(d);L.has(r.typeName)||(L.set(r.typeName,f.shift()),b.set(r.typeName,0));const T=L.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const N=new H({paths:[T]});if(r.feature.attributes[C]=N,c.has(r.typeName)){const e=c.get(r.typeName);e?.set(r.feature.attributes[w],r.feature)}else{const e=new Map;e.set(r.feature.attributes[w],r.feature),c.set(r.typeName,e)}p.set(r.feature.attributes[w],r.feature);const v=m(r.feature.attributes[C]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[w],r.feature.attributes[C]?v:null);const D=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));n(D.members,r.feature.attributes[w],(()=>({id:r.feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=r.feature.attributes[C]}for(const i of l)i.feature.attributes[T]=re.get(i.feature.attributes[M]+"-"+i.feature.attributes[k])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:ee},{nodes:d,links:c,idMap:p}}async applyNewLinkChartLayout(e="radial-root-centric",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const o=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(o,new $({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let o=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(o=o.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,o,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="radial-root-centric",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e,t){const a=[];this.dataManager.addToLayer(e);for(const o of e)this.sublayerIdsCache.has(o.typeName)||(this.sublayerIdsCache.set(o.typeName,new Set),a.push(o.typeName)),this.sublayerIdsCache.get(o.typeName).add(o.id);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(o,new Map)}}await N(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const i=Object.assign({},this._currentLinkChartConfig.layoutSettings);i.lockedNodeLocations=new Map;for(const[o,n]of this.entityLinkChartDiagramLookup.entries())n&&i.lockedNodeLocations.set(o,new $(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{layoutSettings:i})}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const o=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const n=m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(o,n):this.entityLinkChartDiagramLookup.set(o,n),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[M]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]);if(t&&a){const i=m(new H({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[w],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[w],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("radial-root-centric",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,n=e=>a(e)&&e>=1,r=e=>Object.values(f).includes(e),s=e=>a(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:p,idealEdgeLengthType:u}=t.organicLayoutSettings;n(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&o.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),i(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&o.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("geographic-organic-standard"===e&&(void 0!==c||void 0!==p||void 0!==u)&&(r(u)?l.organicLayoutSettings.idealEdgeLengthType=u:void 0!==u&&o.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===u&&s(c)?l.organicLayoutSettings.absoluteIdealEdgeLength=c:"absolute-value"===u&&void 0!==c?o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===u&&s(p)?l.organicLayoutSettings.multiplicativeIdealEdgeLength=p:"multiplier"===u&&void 0!==p&&o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("chronological-multi-timeline"===e||"chronological-mono-timeline"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&o.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE?e.organicLayoutSettings.absoluteIdealEdgeLength:e.organicLayoutSettings.multiplicativeIdealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier??void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),i=new Set((e.entityTypes??[]).map((e=>e.name))),n=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=i.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):n.has(e.graphTypeName))))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const o of a)e.has(o)||this._originalInclusionList.namedTypeDefinitions.set(o,{useAllData:!1,members:new Map});const i=[];for(const n of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(n)||(o.getLogger(this).warn(`A named type, ${n}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(n));for(const o of i)this._originalInclusionList.namedTypeDefinitions.delete(o)}}};e([p()],K.prototype,"dataPreloadedInLocalCache",void 0),e([p()],K.prototype,"defaultLinkChartConfig",void 0),e([p()],K.prototype,"membershipModified",void 0),e([p()],K.prototype,"dataManager",void 0),e([p()],K.prototype,"inclusionModeDefinition",null),e([p()],K.prototype,"knowledgeGraph",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([p()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([p()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([p()],K.prototype,"linkChartExtent",void 0),e([p()],K.prototype,"memberEntityTypes",void 0),e([p()],K.prototype,"memberRelationshipTypes",void 0),e([p({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([p()],K.prototype,"sublayerIdsCache",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([p({json:{read:!1}})],K.prototype,"type",void 0),e([p({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const q=K;export{q as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import i from"../core/Collection.js";import a from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import y from"./Layer.js";import{convertFromGeometry as m}from"./graphics/featureConversionUtils.js";import{IdealEdgeLengthTypeOptions as f}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as L}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as w,systemOriginIdFieldName as M,systemDestinationIdFieldName as k,systemLayoutGeometryFieldName as C,systemAggregationCountFieldName as T,initializeLayersFromClientData as N}from"./knowledgeGraph/layerUtils.js";import v from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as D,getRelationshipEndNodeIds as x}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as _,LCSimpleLayout as A,LCSmartTreeLayout as R,LCRadialTreeLayout as j,LCHierarchicalLayout as G,LCCommunityLayout as z,LCForceDirectedLayout as P,NodeFlag as F,load as U,CallStatus as B,LinkType as O}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as W}from"../rest/knowledgeGraphService.js";import Q from"../geometry/Extent.js";import $ from"../geometry/Point.js";import H from"../geometry/Polyline.js";let K=class extends(I(S(E(r(y))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"radial-root-centric"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(i.ofType(b)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(i.ofType(b)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),c))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:i,dataPreloadedInLocalCache:a,initializationLinkChartConfig:n}=e;return{url:t,title:i,dataPreloadedInLocalCache:a,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let i=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(i=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return n.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),o.push(s)):"entity"===s.type?t.has(r)||(t.add(r),i.push(s)):(n.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(i=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new L({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=i,this.memberRelationshipTypes=o,this.dataManager=r}load(e){const i=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await N(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((i=>{t.push(i.refreshCachedQueryEngine()),e.push(new Promise((e=>{i.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((a=>{W(this.url).then((async n=>{n.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),n.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.parent?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===g.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(n.dataModel),this.initializationLinkChartConfig={layoutSettings:r?.layoutSettings??void 0,layoutMode:D(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:n,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=v.getInstance();for(const[t,i]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const a of i.members?.values()??[]){const i=e.readFromStoreById(`${t}__${a.id}`);if(i){o(this.dataManager.sublayerCaches,t,(()=>new Map)).set(a.id,i)}}await i()}else{const t="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await i()})))}a(null)}))}))),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):n.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}async addRecords(e,t){let i=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(i=await x(e,this.dataManager.knowledgeGraph));const a=e.concat(i).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));a.length>0&&(this.membershipModified=!0),await this._handleNewRecords(a,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:i=!1,overrideMembershipCheck:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const r of e)(a||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&n.push(r);if(t){const e=new Set,t=[];for(const i of n)if(this.dataManager.nodeConnectionsLookup.has(i.id))for(const t of this.dataManager.nodeConnectionsLookup.get(i.id))e.add(t);for(const i of e)if(this.dataManager.memberIdTypeLookup.has(i))for(const e of this.dataManager.memberIdTypeLookup.get(i))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:i,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const r of n)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);i&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),n.length>0&&(this.membershipModified=!0);const o=[];return this.layers.forEach((e=>{o.push(e.refreshCachedQueryEngine())})),await Promise.all(o),this._refreshNamedTypes(),n}async expand(e,t){let i=[];try{const a=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(a){throw l(a)&&i.length>0&&this.removeRecords(i,{overrideMembershipCheck:!0}),a}return{records:i}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===g.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===g.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const i=o(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:a})=>{if(i.add(e),a){const i="coords"in a&&"lengths"in a?a:m(a);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,i):this.entityLinkChartDiagramLookup.set(e,i)}}))}))}async calculateLinkChartLayout(e="radial-root-centric",t){const i=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{i.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,c=new Map,p=new Map,u=new Map,g=new Uint8Array(i.length),y=new Float64Array(i.length),f=new Float64Array(i.length),L=new Float64Array(i.length),b=new Float64Array(i.length),N=new Uint32Array(r.length),v=new Uint32Array(r.length),D=new Float64Array(r.length),x=new Float64Array(r.length),S=[],I="organic-standard",E=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let W,K="organic-standard",q=0,J=0;const V=_.apply;switch(K="geographic-organic-standard"===e?I:e,K){case"organic-standard":W=P.apply;break;case"organic-community":W=z.apply;break;case"hierarchical-bottom-to-top":W=G.apply;break;case"radial-root-centric":W=j.apply;break;case"tree-left-to-right":W=R.apply;break;default:W=A.apply}let X=!1;i.forEach((({typeName:i,feature:a})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(a.attributes[w])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(i)?g[q]=F.IsGeographic:g[q]=F.None;const n=t.lockedNodeLocations.get(a.attributes[w]);y[q]=n.x,f[q]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(i)){g[q]=F.IsGeographic;let e=null;const t=a.attributes[this.dataManager.geographicLookup.get(i).name],n=this.dataManager.geographicLookup.get(i)?.geometryType;switch(n){case"esriGeometryPoint":y[q]=t?.x,f[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=F.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=F.IsMovable;break;default:g[q]=F.IsMovable}(null==y[q]||null==f[q]||Number.isNaN(y[q])||Number.isNaN(f[q]))&&(g[q]=F.IsMovable,y[q]=0,f[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(a.attributes[w])&&(X=!0);const e=t?.timeInfoByTypeName?.get(i),n=e?.startField,o=n&&e?.startField?a.attributes[n]:null;L[q]=o?new Date(o).getTime():NaN;const r=e?.endField,s=r&&e?.endField?a.attributes[r]:null;b[q]=s?new Date(s).getTime():NaN,y[q]=0,f[q]=0,g[q]=F.IsMovable}else g[q]=F.IsMovable,y[q]=0,f[q]=0;u.set(a.attributes[w],q),S[q]={feature:a,typeName:i},q++})),X&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=new Map;r.forEach((i=>{const a=i.feature.attributes[M],n=i.feature.attributes[k],o=u.get(a),r=u.get(n),s=t?.timeInfoByTypeName?.get(i.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?i.feature.attributes[h]:null,c=s?.endField,p=c?i.feature.attributes[c]:null;if(void 0!==o&&void 0!==r){let t=a+"-"+n;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+p);const s=Z.get(t),h=s?.has(i.typeName);h||(N[J]=o,v[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(D[J]=d?new Date(d).getTime():NaN,x[J]=p?new Date(p).getTime():NaN),void 0===s?Z.set(t,new Map([[i.typeName,J]])):s.set(i.typeName,J),J++),l.push(i)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(a,null)})),Y&&n.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const ee=this._validateLayoutSettings(e,t?.layoutSettings),te=this._convertLayoutSettingsToCalculationSettings(ee);await U();let ie=B.Error,ae=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let i;({status:ie,links:ae,graphics:i}=V((()=>t?.signal?.aborted??!1),g,y,f,L,b,N.subarray(0,J),v.subarray(0,J),D.subarray(0,J),x.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings??{})),ie===B.Success&&(this.chronologicalAuxiliaryGraphics=i)}else({status:ie,links:ae}=W((()=>t?.signal?.aborted??!1),g,y,f,N.subarray(0,J),v.subarray(0,J),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ie===B.Error)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ie===B.Canceled)throw h();for(let a=0;a<S.length;a++){if(f[a]>84.9999?f[a]=84.9999:f[a]<-84.9999&&(f[a]=-84.9999),y[a]>179.9999?y[a]=179.9999:y[a]<-179.9999&&(y[a]=-179.9999),S[a].feature.attributes[C]=new $(y[a],f[a]),d.has(S[a].typeName)){const e=d.get(S[a].typeName);e?.set(S[a].feature.attributes[w],S[a].feature)}else{const e=new Map;e.set(S[a].feature.attributes[w],S[a].feature),d.set(S[a].typeName,e)}p.set(S[a].feature.attributes[w],S[a].feature);const e=m(S[a].feature.attributes[C]);this.entityLinkChartDiagramLookup.set(S[a].feature.attributes[w],S[a].feature.attributes[C]?e:null);const t=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,S[a].typeName,(()=>({useAllData:!1,members:new Map})));o(t.members,S[a].feature.attributes[w],(()=>({id:S[a].feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=S[a].feature.attributes[C],S[a].feature.attributes[C].x<E.xmin&&(E.xmin=S[a].feature.attributes[C].x),S[a].feature.attributes[C].x>E.xmax&&(E.xmax=S[a].feature.attributes[C].x),S[a].feature.attributes[C].y<E.ymin&&(E.ymin=S[a].feature.attributes[C].y),S[a].feature.attributes[C].y>E.ymax&&(E.ymax=S[a].feature.attributes[C].y)}if(this.linkChartExtent.xmin=E.xmin,this.linkChartExtent.xmax=E.xmax,this.linkChartExtent.ymin=E.ymin,this.linkChartExtent.ymax=E.ymax,!ae)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ne=new Map,oe=new Map,re=new Map,se=new Set;for(let a=0;a<l.length;a++){const i=[],r=l[a],s=r.feature.attributes[M],h=r.feature.attributes[k];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),i=t?.timeInfoByTypeName?e?.startField:null,a=i?r.feature.attributes[i]:null,n=e?.endField;d+="-"+a+"-"+(n?r.feature.attributes[n]:null)}const g=Z.get(d).get(r.typeName),y=0===g?0:ae?.vertexEndIndex[g-1];if(!se.has(g)){if(se.add(g),ae.types[g]===O.Recursive){const e=[ae.vertices[2*y],ae.vertices[2*y+1]],t=[ae.vertices[2*(y+1)],ae.vertices[2*(y+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[a[0]-e[0],a[1]-e[1]],o=[a[0]+n[1],a[1]-n[0]],r=[a[0]-n[1],a[1]+n[0]];i.push(e),i.push(o),i.push(t),i.push(r),i.push(e)}else{if(ae.types[g]!==O.Regular){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=y;e<ae.vertexEndIndex[g];e++)i.push([ae.vertices[2*e],ae.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=S[u.get(s)]?.feature.attributes[C],t=S[u.get(h)]?.feature.attributes[C];i[0][0]===e.x&&i[0][1]===e.y||(i[0]=[e.x,e.y]),i[i.length-1][0]===t.x&&i[i.length-1][1]===t.y||(i[i.length-1]=[t.x,t.y])}for(let e=1;e<i.length-1;e++)i[e][1]>85.5?i[e][1]=85.5:i[e][1]<-85.5&&(i[e][1]=-85.5),i[e][0]>179.9999?i[e][0]=179.9999:i[e][0]<-179.9999&&(i[e][0]=-179.9999);ne.has(d)?ne.get(d).push(i):ne.set(d,[i])}const f=ne.get(d);oe.has(d)||(oe.set(d,new Map),re.set(d,new Map));const L=oe.get(d),b=re.get(d);L.has(r.typeName)||(L.set(r.typeName,f.shift()),b.set(r.typeName,0));const T=L.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const N=new H({paths:[T]});if(r.feature.attributes[C]=N,c.has(r.typeName)){const e=c.get(r.typeName);e?.set(r.feature.attributes[w],r.feature)}else{const e=new Map;e.set(r.feature.attributes[w],r.feature),c.set(r.typeName,e)}p.set(r.feature.attributes[w],r.feature);const v=m(r.feature.attributes[C]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[w],r.feature.attributes[C]?v:null);const D=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));o(D.members,r.feature.attributes[w],(()=>({id:r.feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=r.feature.attributes[C]}for(const a of l)a.feature.attributes[T]=re.get(a.feature.attributes[M]+"-"+a.feature.attributes[k])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:ee},{nodes:d,links:c,idMap:p}}async applyNewLinkChartLayout(e="radial-root-centric",t){const i=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{i.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(i),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,i]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||i?.members?.forEach((t=>{const i=t.linkChartLocation;let a;const n=t.id;i&&(a="x"in i?{x:i.x,y:i.y}:{x:i.coords[0],y:i.coords[1]},e.set(n,new $({x:a.x,y:a.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let i=[];try{let a=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(a=a.concat(Array.from(t.keys())))}i=await this.dataManager.getRelationshipsBetweenNodes(e,a,t),await this._handleNewRecords(i,t),s(t)}catch(a){throw l(a)&&this.removeRecords(i),a}return{records:i}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let i=[];try{let a=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(a=a.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}i=await this.dataManager.getRelationshipsFromNodes(e,n,a,t),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t)}catch(a){throw l(a)&&this.removeRecords(i),a}return{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="radial-root-centric",t){const i=new Map;this.layers.forEach((e=>{i.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:i,...t})}async _handleNewRecords(e,t){const i=[];this.dataManager.addToLayer(e);for(const n of e)this.sublayerIdsCache.has(n.typeName)||(this.sublayerIdsCache.set(n.typeName,new Set),i.push(n.typeName)),this.sublayerIdsCache.get(n.typeName).add(n.id);for(const n of i){const e=this._graphTypeLookup.get(n);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(n):this.dataManager.relationshipTypeNames.add(n),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(n,new Map)}}await N(this,i,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const a=Object.assign({},this._currentLinkChartConfig.layoutSettings);a.lockedNodeLocations=new Map;for(const[n,o]of this.entityLinkChartDiagramLookup.entries())o&&a.lockedNodeLocations.set(n,new $(o.coords[0],o.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{layoutSettings:a})}_createSublayers(e,t,i){e.forEach((e=>{const a=this._createSublayer(e);i(a)&&t.push(a),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const i=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));i&&(t.objectType=i,t.read({title:i.name},{origin:"service"}),this._updateSublayerCaches(i))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const i=e.linkChartLocation;let a;const n=e.id;if(!i)return;a="x"in i?{x:i.x,y:i.y}:{x:i.coords[0],y:i.coords[1]};const o=m(a);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>a.x&&(this.linkChartExtent.xmin=a.x),this.linkChartExtent.xmax<a.x&&(this.linkChartExtent.xmax=a.x),this.linkChartExtent.ymin>a.y&&(this.linkChartExtent.ymin=a.y),this.linkChartExtent.ymax<a.y&&(this.linkChartExtent.ymax=a.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[M]),i=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]);if(t&&i){const a=m(new H({paths:[[[t.coords[0],t.coords[1]],[i.coords[0],i.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[w],a)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[w],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("radial-root-centric",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const i=e=>"number"==typeof e&&!isNaN(e),a=e=>i(e)&&e>=1,o=e=>i(e)&&e>=1,r=e=>Object.values(f).includes(e),s=e=>i(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:p,idealEdgeLengthType:u}=t.organicLayoutSettings;o(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&n.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),a(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&n.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("geographic-organic-standard"===e&&(void 0!==c||void 0!==p||void 0!==u)&&(r(u)?l.organicLayoutSettings.idealEdgeLengthType=u:void 0!==u&&n.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===u&&s(c)?l.organicLayoutSettings.absoluteIdealEdgeLength=c:"absolute-value"===u&&void 0!==c?n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===u&&s(p)?l.organicLayoutSettings.multiplicativeIdealEdgeLength=p:"multiplier"===u&&void 0!==p&&n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("chronological-multi-timeline"===e||"chronological-mono-timeline"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&n.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE?e.organicLayoutSettings.absoluteIdealEdgeLength:e.organicLayoutSettings.multiplicativeIdealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier&&!e.organicLayoutSettings.autoRepulsionRadius?e.organicLayoutSettings.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),a=new Set((e.entityTypes??[]).map((e=>e.name))),o=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=a.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?a.has(e.graphTypeName):o.has(e.graphTypeName))))}else this.layers=new i;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],i=this.layers.map((e=>e.graphTypeName)).concat(t);for(const n of i)e.has(n)||this._originalInclusionList.namedTypeDefinitions.set(n,{useAllData:!1,members:new Map});const a=[];for(const o of this._originalInclusionList.namedTypeDefinitions.keys())i.includes(o)||(n.getLogger(this).warn(`A named type, ${o}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),a.push(o));for(const n of a)this._originalInclusionList.namedTypeDefinitions.delete(n)}}};e([p()],K.prototype,"dataPreloadedInLocalCache",void 0),e([p()],K.prototype,"initializationLinkChartConfig",void 0),e([p()],K.prototype,"membershipModified",void 0),e([p()],K.prototype,"dataManager",void 0),e([p()],K.prototype,"initializationInclusionModeDefinition",null),e([p()],K.prototype,"knowledgeGraph",void 0),e([p({type:i.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([p()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([p()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([p()],K.prototype,"linkChartExtent",void 0),e([p()],K.prototype,"memberEntityTypes",void 0),e([p()],K.prototype,"memberRelationshipTypes",void 0),e([p({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([p()],K.prototype,"sublayerIdsCache",void 0),e([p({type:i.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([p({json:{read:!1}})],K.prototype,"type",void 0),e([p({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const q=K;export{q as default};
|
package/layers/MapNotesLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../Graphic.js";import"../symbols.js";import r from"../core/Collection.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import n from"../core/Warning.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import{projectOrLoad as u,canProjectWithoutEngine as c,isLoaded as f,load as d,project as g}from"../geometry/projection.js";import{empty as b,expand as S,equals as h,toExtent as O,negativeInfinity as w}from"../geometry/support/aaBoundingRect.js";import{normalizeCentralMeridian as j}from"../geometry/support/normalizeUtils.js";import{equals as N}from"../geometry/support/spatialReferenceUtils.js";import L from"./FeatureLayer.js";import x from"./GraphicsLayer.js";import J from"./Layer.js";import{findLastObjectIdFromFeatures as v}from"./graphics/objectIdUtils.js";import{BlendLayer as T}from"./mixins/BlendLayer.js";import{OperationalLayer as C}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import R from"./support/Field.js";import E from"../symbols/SimpleFillSymbol.js";import D from"../symbols/SimpleLineSymbol.js";import _ from"../symbols/SimpleMarkerSymbol.js";import G from"../symbols/TextSymbol.js";import P from"../geometry/SpatialReference.js";import F from"../geometry/Extent.js";function B(e){return"markup"===e.featureCollectionType||e.layers.some((e=>null!=e.layerDefinition.visibilityField||!k(e)))}function k({layerDefinition:e,featureSet:t}){const r=e.geometryType??t.geometryType;return $.find((t=>r===t.geometryTypeJSON&&e.drawingInfo?.renderer?.symbol?.type===t.identifyingSymbol.type))}function z(){return new F({xmin:-180,ymin:-90,xmax:180,ymax:90})}const U=new R({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),W=new R({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255});let A=class extends x{constructor(e){super(e),this.visibilityMode="inherited"}initialize(){for(const e of this.graphics)e.sourceLayer=this.layer;this.graphics.on("after-add",(e=>{e.item.sourceLayer=this.layer})),this.graphics.on("after-remove",(e=>{e.item.sourceLayer=null}))}get fullExtent(){const e=this.layer?.spatialReference,t=this.fullBounds;return e?null==t?u(z(),e).geometry:O(t,e):null}get fullBounds(){const e=this.layer?.spatialReference;if(!e)return null;const t=b();return this.graphics.forEach((r=>{const o=null!=r.geometry?u(r.geometry,e).geometry:null;null!=o&&S(t,"point"===o.type?o:o.extent,t)})),h(t,w)?null:t}get sublayers(){return this.graphics}};e([s({readOnly:!0})],A.prototype,"fullExtent",null),e([s({readOnly:!0})],A.prototype,"fullBounds",null),e([s({readOnly:!0})],A.prototype,"sublayers",null),e([s()],A.prototype,"layer",void 0),e([s()],A.prototype,"layerId",void 0),e([s({readOnly:!0})],A.prototype,"visibilityMode",void 0),A=e([y("esri.layers.MapNotesLayer.MapNotesSublayer")],A);const $=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:(new E).toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:(new D).toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:(new G).toJSON()}];let q=class extends(T(I(C(M(l(J)))))){constructor(e){super(e),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=P.WGS84,this.sublayers=new r($.map((e=>new A({id:e.id,layerId:e.layerId,title:e.title,layer:this})))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(e,t,r){return{operations:{supportsMapNotesEditing:!B(t)&&"portal-item"!==r?.origin}}}readFeatureCollections(e,t,o){if(!B(t))return null;const i=t.layers.map((e=>{const t=new L;return t.read(e,o),t}));return new r({items:i})}readLegacyfeatureCollectionJSON(e,t){return B(t)?i(t.featureCollection):null}get fullExtent(){const e=this.spatialReference,t=b();if(null!=this.sublayers)this.sublayers.forEach((({fullBounds:e})=>null!=e?S(t,e,t):t),t);else if(this.featureCollectionJSON?.layers.some((e=>e.layerDefinition.extent))){this.featureCollectionJSON.layers.forEach((r=>{const o=u(r.layerDefinition.extent,e).geometry;null!=o&&S(t,o,t)}))}return h(t,w)?u(z(),e).geometry:O(t,e)}readMinScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.minScale)return r.layerDefinition.minScale;return 0}readMaxScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.maxScale)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(e,t){return t.layers.length?P.fromJSON(t.layers[0].layerDefinition.spatialReference):P.WGS84}readSublayers(e,o,i){if(B(o))return null;const l=[];let a=o.layers.reduce(((e,t)=>Math.max(e,t.layerDefinition.id??-1)),-1)+1;for(const r of o.layers){const{layerDefinition:e,featureSet:o}=r,i=e.id??a++,n=k(r);if(null!=n){const r=new A({id:n.id,title:e.name,layerId:i,layer:this,graphics:o.features.map((({geometry:e,symbol:r,attributes:o,popupInfo:i})=>t.fromJSON({attributes:o,geometry:e,symbol:r,popupTemplate:i})))});l.push(r)}}return new r(l)}writeSublayers(e,t,r,i){const{minScale:l,maxScale:n}=this;if(null==e)return;const s=e.some((e=>e.graphics.length>0));if(!this.capabilities.operations.supportsMapNotesEditing)return void(s&&i?.messages?.push(new o("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer")));const p=[];let y=this.spatialReference.toJSON();e:for(const o of e)for(const e of o.graphics)if(null!=e.geometry){y=e.geometry.spatialReference.toJSON();break e}for(const o of $){const t=e.find((e=>o.id===e.id));this._writeMapNoteSublayer(p,t,o,l,n,y,i)}a("featureCollection.layers",p,t)}get textLayer(){return this._findSublayer("textLayer")}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}read(e,t){"featureCollection"in e&&(e=i(e),Object.assign(e,e.featureCollection)),super.read(e,t)}async beforeSave(){if(null==this.sublayers)return;let e=null;const t=[];for(const o of this.sublayers)for(const r of o.graphics)if(null!=r.geometry){const o=r.geometry;e?N(o.spatialReference,e)||(c(o.spatialReference,e)||f()||await d(),r.geometry=g(o,e)):e=o.spatialReference,t.push(r)}const r=await j(t.map((e=>e.geometry)));t.forEach(((e,t)=>e.geometry=r[t]))}_findSublayer(e){return null==this.sublayers?null:this.sublayers?.find((t=>t.id===e))??null}_writeMapNoteSublayer(e,t,r,o,l,a,n){const s=[];if(null!=t){for(const e of t.graphics)this._writeMapNote(s,e,r.geometryType,n);this._normalizeObjectIds(s,U),e.push({layerDefinition:{name:t.title,drawingInfo:{renderer:{type:"simple",symbol:i(r.identifyingSymbol)}},id:t.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[U.toJSON(),W.toJSON()],spatialReference:a},featureSet:{features:s,geometryType:r.geometryTypeJSON}})}}_writeMapNote(e,t,r,o){if(null==t)return;const{geometry:i,symbol:l,popupTemplate:a}=t;if(null==i)return;if(i.type!==r)return void o?.messages?.push(new n("map-notes-layer:invalid-geometry-type",`Geometry "${i.type}" cannot be saved in "${r}" layer`,{graphic:t}));if(null==l)return void o?.messages?.push(new n("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:t}));const s={attributes:{...t.attributes},geometry:i.toJSON(),symbol:l.toJSON()};null!=a&&(s.popupInfo=a.toJSON()),e.push(s)}_normalizeObjectIds(e,t){const r=t.name;let o=v(r,e)+1;const i=new Set;for(const l of e){l.attributes||(l.attributes={});const{attributes:e}=l;(null==e[r]||i.has(e[r]))&&(e[r]=o++),i.add(e[r])}}};e([s({readOnly:!0})],q.prototype,"capabilities",void 0),e([p(["portal-item","web-map"],"capabilities",["layers"])],q.prototype,"readCapabilities",null),e([s({readOnly:!0})],q.prototype,"featureCollections",void 0),e([p(["web-map","portal-item"],"featureCollections",["layers"])],q.prototype,"readFeatureCollections",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],q.prototype,"featureCollectionJSON",void 0),e([p(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],q.prototype,"readLegacyfeatureCollectionJSON",null),e([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],q.prototype,"featureCollectionType",void 0),e([s({readOnly:!0})],q.prototype,"fullExtent",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:null!=this.featureCollectionJSON}}}}}}})],q.prototype,"legendEnabled",void 0),e([s({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"minScale",void 0),e([p(["web-map","portal-item"],"minScale",["layers"])],q.prototype,"readMinScale",null),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"maxScale",void 0),e([p(["web-map","portal-item"],"maxScale",["layers"])],q.prototype,"readMaxScale",null),e([s({readOnly:!0})],q.prototype,"multipointLayer",null),e([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],q.prototype,"operationalLayerType",void 0),e([s({readOnly:!0})],q.prototype,"pointLayer",null),e([s({readOnly:!0})],q.prototype,"polygonLayer",null),e([s({readOnly:!0})],q.prototype,"polylineLayer",null),e([s({type:P})],q.prototype,"spatialReference",void 0),e([p(["web-map","portal-item"],"spatialReference",["layers"])],q.prototype,"readSpatialReference",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],q.prototype,"sublayers",void 0),e([p("web-map","sublayers",["layers"])],q.prototype,"readSublayers",null),e([m("web-map","sublayers")],q.prototype,"writeSublayers",null),e([s({readOnly:!0})],q.prototype,"textLayer",null),e([s()],q.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=e([y("esri.layers.MapNotesLayer")],q);const H=q;export{H as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../Graphic.js";import"../symbols.js";import r from"../core/Collection.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import n from"../core/Warning.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import{projectOrLoad as u,canProjectWithoutEngine as c,load as f,project as d,isLoaded as g}from"../geometry/projection.js";import{empty as b,expand as S,equals as h,toExtent as O,negativeInfinity as w}from"../geometry/support/aaBoundingRect.js";import{normalizeCentralMeridian as j}from"../geometry/support/normalizeUtils.js";import{equals as N}from"../geometry/support/spatialReferenceUtils.js";import L from"./FeatureLayer.js";import x from"./GraphicsLayer.js";import J from"./Layer.js";import{findLastObjectIdFromFeatures as v}from"./graphics/objectIdUtils.js";import{BlendLayer as T}from"./mixins/BlendLayer.js";import{OperationalLayer as C}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import R from"./support/Field.js";import E from"../symbols/SimpleFillSymbol.js";import D from"../symbols/SimpleLineSymbol.js";import _ from"../symbols/SimpleMarkerSymbol.js";import G from"../symbols/TextSymbol.js";import P from"../geometry/SpatialReference.js";import F from"../geometry/Extent.js";function B(e){return"markup"===e.featureCollectionType||e.layers.some((e=>null!=e.layerDefinition.visibilityField||!k(e)))}function k({layerDefinition:e,featureSet:t}){const r=e.geometryType??t.geometryType;return $.find((t=>r===t.geometryTypeJSON&&e.drawingInfo?.renderer?.symbol?.type===t.identifyingSymbol.type))}function z(){return new F({xmin:-180,ymin:-90,xmax:180,ymax:90})}const U=new R({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),W=new R({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255});let A=class extends x{constructor(e){super(e),this.visibilityMode="inherited"}initialize(){for(const e of this.graphics)e.sourceLayer=this.layer;this.graphics.on("after-add",(e=>{e.item.sourceLayer=this.layer})),this.graphics.on("after-remove",(e=>{e.item.sourceLayer=null}))}get fullExtent(){const e=this.layer?.spatialReference,t=this.fullBounds;return e?null==t?u(z(),e).geometry:O(t,e):null}get fullBounds(){const e=this.layer?.spatialReference;if(!e)return null;const t=b();return this.graphics.forEach((r=>{const o=null!=r.geometry?u(r.geometry,e).geometry:null;null!=o&&S(t,"point"===o.type?o:o.extent,t)})),h(t,w)?null:t}get sublayers(){return this.graphics}};e([s({readOnly:!0})],A.prototype,"fullExtent",null),e([s({readOnly:!0})],A.prototype,"fullBounds",null),e([s({readOnly:!0})],A.prototype,"sublayers",null),e([s()],A.prototype,"layer",void 0),e([s()],A.prototype,"layerId",void 0),e([s({readOnly:!0})],A.prototype,"visibilityMode",void 0),A=e([y("esri.layers.MapNotesLayer.MapNotesSublayer")],A);const $=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:(new E).toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:(new D).toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:(new G).toJSON()}];let q=class extends(T(I(C(M(l(J)))))){constructor(e){super(e),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=P.WGS84,this.sublayers=new r($.map((e=>new A({id:e.id,layerId:e.layerId,title:e.title,layer:this})))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(e,t,r){return{operations:{supportsMapNotesEditing:!B(t)&&"portal-item"!==r?.origin}}}readFeatureCollections(e,t,o){if(!B(t))return null;const i=t.layers.map((e=>{const t=new L;return t.read(e,o),t}));return new r({items:i})}readLegacyfeatureCollectionJSON(e,t){return B(t)?i(t.featureCollection):null}get fullExtent(){const e=this.spatialReference,t=b();if(null!=this.sublayers)this.sublayers.forEach((({fullBounds:e})=>null!=e?S(t,e,t):t),t);else if(this.featureCollectionJSON?.layers.some((e=>e.layerDefinition.extent))){this.featureCollectionJSON.layers.forEach((r=>{const o=u(r.layerDefinition.extent,e).geometry;null!=o&&S(t,o,t)}))}return h(t,w)?u(z(),e).geometry:O(t,e)}readMinScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.minScale)return r.layerDefinition.minScale;return 0}readMaxScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.maxScale)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(e,t){return t.layers.length?P.fromJSON(t.layers[0].layerDefinition.spatialReference):P.WGS84}readSublayers(e,o,i){if(B(o))return null;const l=[];let a=o.layers.reduce(((e,t)=>Math.max(e,t.layerDefinition.id??-1)),-1)+1;for(const r of o.layers){const{layerDefinition:e,featureSet:o}=r,i=e.id??a++,n=k(r);if(null!=n){const r=new A({id:n.id,title:e.name,layerId:i,layer:this,graphics:o.features.map((({geometry:e,symbol:r,attributes:o,popupInfo:i})=>t.fromJSON({attributes:o,geometry:e,symbol:r,popupTemplate:i})))});l.push(r)}}return new r(l)}writeSublayers(e,t,r,i){const{minScale:l,maxScale:n}=this;if(null==e)return;const s=e.some((e=>e.graphics.length>0));if(!this.capabilities.operations.supportsMapNotesEditing)return void(s&&i?.messages?.push(new o("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer")));const p=[];let y=this.spatialReference.toJSON();e:for(const o of e)for(const e of o.graphics)if(null!=e.geometry){y=e.geometry.spatialReference.toJSON();break e}for(const o of $){const t=e.find((e=>o.id===e.id));this._writeMapNoteSublayer(p,t,o,l,n,y,i)}a("featureCollection.layers",p,t)}get textLayer(){return this._findSublayer("textLayer")}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}read(e,t){"featureCollection"in e&&(e=i(e),Object.assign(e,e.featureCollection)),super.read(e,t)}async beforeSave(){if(null==this.sublayers)return;let e=null;const t=[];for(const o of this.sublayers)for(const r of o.graphics)if(null!=r.geometry){const o=r.geometry;e?N(o.spatialReference,e)||(c(o.spatialReference,e)||g()||await f(),r.geometry=d(o,e)):e=o.spatialReference,t.push(r)}const r=await j(t.map((e=>e.geometry)));t.forEach(((e,t)=>e.geometry=r[t]))}_findSublayer(e){return null==this.sublayers?null:this.sublayers?.find((t=>t.id===e))??null}_writeMapNoteSublayer(e,t,r,o,l,a,n){const s=[];if(null!=t){for(const e of t.graphics)this._writeMapNote(s,e,r.geometryType,n);this._normalizeObjectIds(s,U),e.push({layerDefinition:{name:t.title,drawingInfo:{renderer:{type:"simple",symbol:i(r.identifyingSymbol)}},id:t.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[U.toJSON(),W.toJSON()],spatialReference:a},featureSet:{features:s,geometryType:r.geometryTypeJSON}})}}_writeMapNote(e,t,r,o){if(null==t)return;const{geometry:i,symbol:l,popupTemplate:a}=t;if(null==i)return;if(i.type!==r)return void o?.messages?.push(new n("map-notes-layer:invalid-geometry-type",`Geometry "${i.type}" cannot be saved in "${r}" layer`,{graphic:t}));if(null==l)return void o?.messages?.push(new n("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:t}));const s={attributes:{...t.attributes},geometry:i.toJSON(),symbol:l.toJSON()};null!=a&&(s.popupInfo=a.toJSON()),e.push(s)}_normalizeObjectIds(e,t){const r=t.name;let o=v(r,e)+1;const i=new Set;for(const l of e){l.attributes||(l.attributes={});const{attributes:e}=l;(null==e[r]||i.has(e[r]))&&(e[r]=o++),i.add(e[r])}}};e([s({readOnly:!0})],q.prototype,"capabilities",void 0),e([p(["portal-item","web-map"],"capabilities",["layers"])],q.prototype,"readCapabilities",null),e([s({readOnly:!0})],q.prototype,"featureCollections",void 0),e([p(["web-map","portal-item"],"featureCollections",["layers"])],q.prototype,"readFeatureCollections",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],q.prototype,"featureCollectionJSON",void 0),e([p(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],q.prototype,"readLegacyfeatureCollectionJSON",null),e([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],q.prototype,"featureCollectionType",void 0),e([s({readOnly:!0})],q.prototype,"fullExtent",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:null!=this.featureCollectionJSON}}}}}}})],q.prototype,"legendEnabled",void 0),e([s({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"minScale",void 0),e([p(["web-map","portal-item"],"minScale",["layers"])],q.prototype,"readMinScale",null),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"maxScale",void 0),e([p(["web-map","portal-item"],"maxScale",["layers"])],q.prototype,"readMaxScale",null),e([s({readOnly:!0})],q.prototype,"multipointLayer",null),e([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],q.prototype,"operationalLayerType",void 0),e([s({readOnly:!0})],q.prototype,"pointLayer",null),e([s({readOnly:!0})],q.prototype,"polygonLayer",null),e([s({readOnly:!0})],q.prototype,"polylineLayer",null),e([s({type:P})],q.prototype,"spatialReference",void 0),e([p(["web-map","portal-item"],"spatialReference",["layers"])],q.prototype,"readSpatialReference",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],q.prototype,"sublayers",void 0),e([p("web-map","sublayers",["layers"])],q.prototype,"readSublayers",null),e([m("web-map","sublayers")],q.prototype,"writeSublayers",null),e([s({readOnly:!0})],q.prototype,"textLayer",null),e([s()],q.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=e([y("esri.layers.MapNotesLayer")],q);const H=q;export{H as default};
|
package/layers/MediaLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import o from"../core/Error.js";import t from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i}from"../core/promiseUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{OriginId as u}from"../core/accessorSupport/PropertyOrigin.js";import d from"./Layer.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as h}from"./mixins/ScaleRangeLayer.js";import g from"./support/ControlPointsGeoreference.js";import S from"./support/ImageElement.js";import w from"./support/LocalMediaElementSource.js";import{isWritingLayerFromItemToWebDocument as v}from"./support/mediaUtils.js";import j from"./support/VideoElement.js";import{
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import o from"../core/Error.js";import t from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i}from"../core/promiseUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{OriginId as u}from"../core/accessorSupport/PropertyOrigin.js";import d from"./Layer.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as h}from"./mixins/ScaleRangeLayer.js";import g from"./support/ControlPointsGeoreference.js";import S from"./support/ImageElement.js";import w from"./support/LocalMediaElementSource.js";import{isWritingLayerFromItemToWebDocument as v}from"./support/mediaUtils.js";import j from"./support/VideoElement.js";import{isMediaElement as O}from"../support/mediaLayerUtils.js";import{SaveOperationType as L}from"../webdoc/interfaces.js";let b=class extends(m(h(f(y(s(d)))))){constructor(e){super(e),this.effectiveSource=null,this.georeference=null,this.copyright=null,this.operationalLayerType="MediaLayer",this.spatialReference=null,this.type="media",this._debouncedSaveOperations=i((async(e,r,o)=>{const{save:t,saveAs:s}=await import("./save/mediaLayerUtils.js");switch(e){case L.SAVE:return t(this,r);case L.SAVE_AS:return s(this,o,r)}})),this.source=new w}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){await this.loadFromPortal({supportedTypes:["Media Layer"]},e);let t=this.source;if(!t)throw new o("media-layer:source-missing","Set 'MediaLayer.source' before loading the layer.");const s=this._getSourceOverride(t,this.georeference);s&&(this.setAtOrigin("source",s,"web-map"),this.setAtOrigin("source",s,"web-scene"),t=s);const i=O(t)?new w({elements:new r([t])}):t;this._set("effectiveSource",i),this.spatialReference&&(i.spatialReference=this.spatialReference),await i.load(e),this.spatialReference=i.spatialReference}destroy(){this.effectiveSource?.destroy(),this.effectiveSource!==this.source&&this.source?.destroy()}readGeoreference(e,r){return e&&"itemId"in r&&r.itemId?e:void 0}get fullExtent(){return this.loaded?this.effectiveSource.fullExtent:null}get source(){return this._get("source")}set source(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("source",e):t.getLogger(this).error("#source","source cannot be changed after the layer is loaded.")}castSource(e){return e?Array.isArray(e)?new w({elements:new r(e)}):e instanceof r?new w({elements:e}):e:null}readSource(e,r,o){if("itemId"in r&&r.itemId)return;const t=this._createSource(r);return t?.read(r,o),t}writeSource(e,r,t,s){if(e&&e instanceof w){const r=e.elements.length;if(1!==r)return void(s?.messages&&s.messages.push(new o("media-layer:unsupported-source",`local media element source can only be persisted if it contains exactly one ImageElement, but it has ${r}.`)));e=e.elements.at(0)}O(e)?e.write(r,s):s?.messages&&(e?s.messages.push(new o("media-layer:unsupported-source","only media elements of type 'ImageElement' or 'VideoElement' can be persisted")):s.messages.push(new o("media-layer:unsupported-source","the media layer is missing a source")))}async save(e){return this._debouncedSaveOperations(L.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(L.SAVE_AS,r,e)}_createSource(e){if("mediaType"in e)switch(e.mediaType){case"image":return new S;case"video":return new j}return null}_getSourceOverride(e,r){if(O(e)&&this.originIdOf("source")===u.PORTAL_ITEM&&r&&(this.originIdOf("georeference")===u.WEB_MAP||this.originIdOf("georeference")===u.WEB_SCENE)){const o=e.toJSON(),t=this._createSource(o);return t.read({...o},{origin:"portal-item"}),t.read({georeference:r},{origin:"web-map"}),t.read({georeference:r},{origin:"web-scene"}),t}return null}};e([a({readOnly:!0})],b.prototype,"effectiveSource",void 0),e([a({readOnly:!0,json:{read:!1,write:!1,origins:{"web-document":{read:!0}}}})],b.prototype,"georeference",void 0),e([c("web-document","georeference")],b.prototype,"readGeoreference",null),e([a({type:String})],b.prototype,"copyright",void 0),e([a({readOnly:!0})],b.prototype,"fullExtent",null),e([a({type:["MediaLayer"]})],b.prototype,"operationalLayerType",void 0),e([a({type:["show","hide"]})],b.prototype,"listMode",void 0),e([a({nonNullable:!0,json:{write:{enabled:!0,allowNull:!1,target:{url:{type:String},mediaType:{type:["image","video"]},georeference:{type:g}},overridePolicy(e,r,o){return{enabled:!0,allowNull:!1,ignoreOrigin:v(this,o?.origin)&&O(e)&&!!e.georeference&&e.originIdOf("georeference")>u.PORTAL_ITEM}}}}})],b.prototype,"source",null),e([n("source")],b.prototype,"castSource",null),e([c("source",["url"])],b.prototype,"readSource",null),e([l("source")],b.prototype,"writeSource",null),e([a()],b.prototype,"spatialReference",void 0),e([a({readOnly:!0})],b.prototype,"type",void 0),b=e([p("esri.layers.MediaLayer")],b);const E=b;export{E as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import o from"../../core/Error.js";import{getImageData as r}from"../../core/imageUtils.js";import{isAbsolute as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import o from"../../core/Error.js";import{getImageData as r}from"../../core/imageUtils.js";import{isAbsolute as i,isDataProtocol as n,isBlobProtocol as s,dataToBlob as a,join as m}from"../../core/urlUtils.js";import{generateUUID as l}from"../../core/uuid.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../../core/accessorSupport/decorators/writer.js";import d from"./MediaElementBase.js";import{mediaElementUrlProperty as g,mediaTypeProperty as f}from"./mediaUtils.js";import{getResourceContentExtension as y}from"../../portal/support/resourceExtension.js";import{ImageElementSymbol as v}from"../../support/mediaLayerUtils.js";import{f as j,t as I,i as b,M as w}from"../../chunks/persistableUrlUtils.js";var E;let U=class extends d{constructor(t){super(t),this.animationOptions=null,this.content=null,this.image=null,this.type="image",this[E]=!0,this.image=null}load(){const t=this.image;if("string"==typeof t){const e=r(t).then((t=>{this._set("content",t)}));this.addResolvingPromise(e)}else if(t instanceof HTMLImageElement){const e=t.decode().then((()=>{this._set("content",t)}));this.addResolvingPromise(e)}else t?this._set("content",t):this.addResolvingPromise(Promise.reject(new o("image-element:invalid-image-type","Invalid image type",{image:t})));return Promise.resolve(this)}get contentWidth(){return null==this.content?0:this.content instanceof HTMLImageElement?this.content.naturalWidth:this.content.width}get contentHeight(){return null==this.content?0:this.content instanceof HTMLImageElement?this.content.naturalHeight:this.content.height}readImage(t,e,o){return j(e.url,o)}writeImage(t,e,o,r){if(null==t)return;const n=r?.portalItem,s=r?.resources;if(!n||!s)return void("string"==typeof t&&(e[o]=I(t,r)));const a=L(t)?t:null;if(a){if(null==b(a))return void(e[o]=a);const t=I(a,{...r,verifyItemRelativeUrls:r?.verifyItemRelativeUrls?{writtenUrls:r.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},w.NO);if(n&&t&&!i(t))return s.toKeep.push({resource:n.resourceFromPath(t),compress:!1}),void(e[o]=t)}e[o]="<pending>",s.pendingOperations.push(M(t).then((t=>{const r=R(t,n);e[o]=r.itemRelativeUrl,s.toAdd.push({resource:r,content:{type:"blob",blob:t},compress:!1,finish:t=>{this.image=t.url}})})))}};E=v,t([c()],U.prototype,"animationOptions",void 0),t([c({readOnly:!0})],U.prototype,"content",void 0),t([c({readOnly:!0})],U.prototype,"contentWidth",null),t([c({readOnly:!0})],U.prototype,"contentHeight",null),t([c(g)],U.prototype,"image",void 0),t([p("image",["url"])],U.prototype,"readImage",null),t([h("image")],U.prototype,"writeImage",null),t([c(f)],U.prototype,"type",void 0),U=t([u("esri.layers.support.ImageElement")],U);const H=U;function L(t){return"string"==typeof t&&!n(t)&&!s(t)}async function M(t){if("string"==typeof t){if(n(t))return a(t);return(await e(t,{responseType:"blob"})).data}return new Promise((e=>P(t).toBlob(e)))}function P(t){if(t instanceof HTMLCanvasElement)return t;const e=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height,r=document.createElement("canvas"),i=r.getContext("2d");return r.width=e,r.height=o,t instanceof HTMLImageElement?i.drawImage(t,0,0,t.width,t.height):t instanceof ImageData&&i.putImageData(t,0,0),r}function R(t,e){const o=l(),r=`${m("media",o)}.${y({type:"blob",blob:t})}`;return e.resourceFromPath(r)}export{H as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{isAbsolute as l,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{isAbsolute as l,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as m}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../../core/accessorSupport/decorators/writer.js";import y from"./MediaElementBase.js";import{mediaElementUrlProperty as g,mediaTypeProperty as f}from"./mediaUtils.js";import{VideoElementSymbol as j}from"../../support/mediaLayerUtils.js";import{i as w}from"../../chunks/persistableUrlUtils.js";var U;let b=class extends y{constructor(e){super(e),this.autoplay=!0,this.content=null,this.controller=null,this.type="video",this[U]=!0}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(Promise.all([this._preProcessVideoUrl(e),import("../video/VideoController.js")]).then((async([e,{default:t}])=>{this.controller=new t,this.controller.playerUrl=e,await n((()=>this.controller?.element)),this.controller.loop=!0,this.controller.muted=!0,this.controller.playsInline=!0,this.controller.crossOrigin="anonymous",await n((()=>"can-play"===this.controller?.state)),await this.controller.play(),this.autoplay||this.controller.pause(),this._set("content",this.controller.element)}))):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then((()=>{this._set("content",e)}))):this.addResolvingPromise(Promise.reject(new o("video-element:invalid-video-type","Invalid video type",{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.controller?.currentTime}set currentTime(e){if(!this.controller)return;const t=i(e,0,this.controller.duration);this.controller?.setCurrentTime(t)}get duration(){return this.controller?.duration}set video(e){"not-loaded"===this.loadStatus?this._set("video",e):s.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const i=V(e)?e:null;if(!i)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!l(i)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(i);const n=a(i);!w(n)?t[r]=n:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(c(e))return d(e);try{return await t(e,{method:"head"}),e}catch{return d(e,!0)}}_loadVideo(e){return new Promise(((t,o)=>{const s=r(e,"canplay",(()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()}));this.addHandles(s,"canplay"),"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",p(e.src)||(e.src=e.src))}))}};U=j,e([u()],b.prototype,"autoplay",void 0),e([u({readOnly:!0})],b.prototype,"content",void 0),e([u({readOnly:!0})],b.prototype,"contentWidth",null),e([u({readOnly:!0})],b.prototype,"contentHeight",null),e([u()],b.prototype,"controller",void 0),e([u({type:Number})],b.prototype,"currentTime",null),e([u({type:Number})],b.prototype,"duration",null),e([u(g)],b.prototype,"video",null),e([v("video")],b.prototype,"writeVideo",null),e([u(f)],b.prototype,"type",void 0),b=e([h("esri.layers.support.VideoElement")],b);const P=b;function V(e){return"string"==typeof e&&!m(e)&&!p(e)}export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{P as i,a as o,g as r,h as s,j as a}from"../../../chunks/pe.js";import{canProjectWithoutEngine as l,isLoaded as c,load as f,getTransformation as u,project as m}from"../../../geometry/projection.js";import{getInfo as x}from"../../../geometry/support/spatialReferenceUtils.js";import h from"../../../geometry/Extent.js";import p from"../../../geometry/Polygon.js";import g from"../../../geometry/Point.js";import y from"../../../geometry/SpatialReference.js";var d;function w(e,t,n){return!l(e,t,n)}function M(e,n,i){const o=w(e,n,i);if(o&&!c())throw new t("rasterprojectionhelper-project","projection engine is not loaded");return o}!function(e){e[e.None=0]="None",e[e.North=1]="North",e[e.South=2]="South",e[e.Both=3]="Both"}(d||(d={}));const R=(e,t,n,i=0)=>{if(1===n[0])return[0,0];let o=1,r=-1,s=1,a=-1;for(let g=0;g<e.length;g+=2)isNaN(e[g])||(o=o>e[g]?e[g]:o,r=r>e[g]?r:e[g],s=s>e[g+1]?e[g+1]:s,a=a>e[g+1]?a:e[g+1]);const{cols:l,rows:c}=t,f=(r-o)/l/n[0],u=(a-s)/c/n[1],m=2*i;let x=0,h=!1,p=[0,0];for(let g=0;g<l-3;g++){for(let t=0;t<c-3;t++){const n=g*c*2+2*t,i=(e[n]+e[n+4]+e[n+4*c]+e[n+4*c+4])/4,o=(e[n+1]+e[n+5]+e[n+4*c+1]+e[n+4*c+5])/4,r=Math.abs((i-e[n+2*c+2])/f),s=Math.abs((o-e[n+2*c+3])/u);if(r+s>x&&(x=r+s,p=[r,s]),m&&x>m){h=!0;break}}if(h)break}return p},S={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},P=32,b=4,G=b,k=new Map,E=new Map,N=500,T=39.37,v=96;let j=null;async function C(){j&&c()||(c()||await f(),j=await import("../../../geometry/geometryEngine.js"))}function _(e,t,n){M(e.spatialReference,t);return n?u(t,e.spatialReference,e):u(e.spatialReference,t,e)}function z(e,t,n,i=null){const o=e.spatialReference;if(!o||!t||o.equals(t))return e;M(o,t,i);const r=n.center,s=new h({xmin:r.x-e.x/2,xmax:r.x+e.x/2,ymin:r.y-e.y/2,ymax:r.y+e.y/2,spatialReference:o}),a=m(s,t,i),l=te(t);return null==a||null!=l&&a.width>=l?L(e,o,t):{x:a.width,y:a.height}}function L(e,t,i){const o=n(t)/n(i);return{x:e.x*o,y:e.y*o}}function I(e,i,o){const{spatialReference:r}=o;if(!r||!i||r.equals(i))return e;if(r.isGeographic&&i.isGeographic)return L(e,r,i);if(M(r,i),!j)throw new t("raster-projection-helper:project-dataset-resolution","geometry engine is not loaded");let{x:s,y:a}=e;const l=(s+a)/2*n(r);let c=1;l>30&&(c=30/l,s*=c,a*=c);const f=256,u=s*f/2,x=a*f/2,{x:h,y:g}=o.center,y=[];for(let t=0;t<=f;t++)y.push([h-u,g-x+t*a]);for(let t=1;t<=f;t++)y.push([h-u+t*s,g+x]);for(let t=1;t<=f;t++)y.push([h+u,g+x-t*a]);for(let t=1;t<f;t++)y.push([h+u-t*s,g-x]);y.push(y[0]);const d=new p({rings:[y],spatialReference:r}),w=m(d,i);if(!w)return L(e,r,i);const R=w.extent,S=te(i);if(null==R||null!=S&&R.width>=S)return L(e,r,i);const P=j.planarArea(w),b=s*a*f*f,G=Math.sqrt(P/b)/c,k={x:R.width/c/f,y:R.height/c/f},E={x:s*G,y:a*G},N=k.x*k.y;return Math.abs(N-E.x*E.y)/N<.1?k:E}function W(e,t){return("number"==typeof e?e:(e.x+e.y)/2)*n(t)*v*T}function O(e,t){const{pixelSize:n,extent:i}=e;return W(I(n,t,i),t)}function A(e,t=.01){return n(e)?t/n(e):0}function B(e,t,n=null,i=!0){const o=e.spatialReference;if(o.equals(t))return e;M(o,t,n);const r=m(e,t,n);return i&&r?(F([e],[r],o,t),r):r}function F(e,t,n,i){const o=ne(n,!0),r=ne(i,!0),s=A(n,N),a=A(i,N);if(s&&null!=o&&null!=r)for(let l=0;l<e.length;l++){const n=t[l];if(!n)continue;const{x:i}=e[l],{x:c}=n;c>=r[1]-a&&Math.abs(i-o[0])<s?n.x-=r[1]-r[0]:c<=r[0]+a&&Math.abs(i-o[1])<s&&(n.x+=r[1]-r[0])}}function q(e){const{inSR:t,outSR:n,datumTransformation:i,preferPE:o}=e;if(t.equals(n)){const{points:t}=D(e,null);return t}if(t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator)return U(e);if(M(t,n,i)&&o){if(t.isGeographic)return J(e);if(null!=X(t))return J(e)}return Y(e)}function Y(e){const{points:t}=D(e,null),{inSR:n,outSR:i,datumTransformation:o}=e,r=t.map((e=>new g(e[0],e[1],n))),s=m(r,i,o);return o&&F(r,s,n,i),s.map((e=>e?[e.x,e.y]:[NaN,NaN]))}function J(e){const{inSR:t,outSR:n,datumTransformation:a}=e,l=X(t),{points:c,mask:f}=D(e,l);if(!t.isGeographic){const e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?o.PE_TYPE_GEOGCS:o.PE_TYPE_PROJCS,t.wkt2||t.wkt);r.projToGeog(e,c.length,c)}if(null!=a&&a.steps.length){let e;const t=179.9955;if(n.isGeographic&&(e=c.map((([e])=>e>t?1:e<-t?-1:0))),a.steps.forEach((e=>{const t=e.wkid?i.geogtran(e.wkid):i.fromString(o.PE_TYPE_GEOGTRAN,e.wkt);s.geogToGeog(t,c.length,c,null,e.isInverse?o.PE_TRANSFORM_2_TO_1:o.PE_TRANSFORM_1_TO_2)})),e)for(let n=0;n<c.length;n++){const i=e[n],o=c[n][0],r=o>t?1:o<-t?-1:0;i&&r&&i!==r&&(c[n][0]=i>0?o+360:o-360)}}if(!n.isGeographic){const e=X(n,!0),t=null!=e&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];H(c,t);const s=n.wkid?i.coordsys(n.wkid):i.fromString(n.isGeographic?o.PE_TYPE_GEOGCS:o.PE_TYPE_PROJCS,n.wkt2||n.wkt);r.geogToProj(s,c.length,c)}let u=c;if(f&&c.length!==f.length){u=[];for(let e=0,t=0;e<f.length;e++)f[e]?u.push(c[t++]):u.push([NaN,NaN])}return u}function U(e){const{cols:t,rows:n,xres:i,yres:o,usePixelCenter:r,inSR:s,outSR:a}=e;let{xmin:l,ymax:c}=e;r&&(l+=i/2,c-=o/2);const f=[],u=[],x=Math.max(t,n);for(let p=0;p<x;p++){const e=l+i*Math.min(t,p),r=c-o*Math.min(n,p),x=m(new g({x:e,y:r,spatialReference:s}),a);p<=t&&f.push(x.x),p<=n&&u.push(x.y)}const h=[];for(let m=0;m<t;m++)for(let e=0;e<n;e++)h.push([f[m],u[e]]);return h}function X(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),k.has(n)){const e=k.get(n);return t?e?.gcs:e?.pcs}const r=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?o.PE_TYPE_GEOGCS:o.PE_TYPE_PROJCS,e.wkt2||e.wkt),s=K(r,A(e,1e-4)),a=K(r,0,!0);return k.set(n,{pcs:s,gcs:a}),t?a:s}function K(e,t=0,n=!1){const i=a.generate(e),o=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!i||!o?.length)return null;let r=!1,s=o.find((e=>1===e.getInclusive()&&1===e.getKind()));if(!s){if(s=o.find((e=>1===e.getInclusive()&&0===e.getKind())),!s)return null;r=!0}const l=n?0:(2===i.getNorthPoleLocation()?1:0)|(2===i.getSouthPoleLocation()?2:0),c=i.isPannableRectangle(),f=s.getCoord();if(r)return{isEnvelope:r,isPannable:c,vertices:f,coef:null,bbox:[f[0][0]-t,f[0][1]-t,f[1][0]+t,f[1][1]+t],poleLocation:l};let u=0;const m=[];let[x,h]=f[0],[p,g]=f[0];for(let a=0,y=f.length;a<y;a++){u++,u===y&&(u=0);const[e,t]=f[a],[n,i]=f[u];if(i===t)m.push([e,n,t,i,2]);else{const o=(n-e)/(i-t||1e-4),r=e-o*t;t<i?m.push([o,r,t,i,0]):m.push([o,r,i,t,1])}x=x<e?x:e,h=h<t?h:t,p=p>e?p:e,g=g>t?g:t}return{isEnvelope:!1,isPannable:c,vertices:f,coef:m,bbox:[x,h,p,g],poleLocation:l}}function D(e,t){const n=[],{cols:i,rows:o,xres:r,yres:s,usePixelCenter:a}=e;let{xmin:l,ymax:c}=e;if(a&&(l+=r/2,c-=s/2),null==t){for(let e=0;e<i;e++)for(let t=0;t<o;t++)n.push([l+r*e,c-s*t]);return{points:n}}const f=new Uint8Array(i*o);if(t.isEnvelope){const{bbox:[e,a,u,m]}=t;for(let x=0,h=0;x<i;x++){const i=l+r*x,p=t.isPannable||i>=e&&i<=u;for(let e=0;e<o;e++,h++){const t=c-s*e;p&&t>=a&&t<=m&&(n.push([i,t]),f[h]=1)}}return{points:n,mask:f}}const u=t.coef,m=[];for(let x=0;x<o;x++){const e=c-s*x,t=[],n=[];for(let o=0;o<u.length;o++){const[i,r,s,a,l]=u[o];if(e===s&&s===a)t.push(i),t.push(r),n.push(2),n.push(2);else if(e>=s&&e<=a){const o=i*e+r;t.push(o),n.push(l)}}let i=t;if(t.length>2){let e=2===n[0]?0:n[0],o=t[0];i=[];for(let r=1;r<n.length;r++)2===n[r]&&r!==n.length-1||(n[r]!==e&&(i.push(0===e?Math.min(o,t[r-1]):Math.max(o,t[r-1])),e=n[r],o=t[r]),r===n.length-1&&i.push(0===n[r]?Math.min(o,t[r]):Math.max(o,t[r])));i.sort(((e,t)=>e-t))}else t[0]>t[1]&&(i=[t[1],t[0]]);m.push(i)}for(let x=0,h=0;x<i;x++){const e=l+r*x;for(let t=0;t<o;t++,h++){const i=c-s*t,o=m[t];if(2===o.length)e>=o[0]&&e<=o[1]&&(n.push([e,i]),f[h]=1);else if(o.length>2){let t=!1;for(let n=0;n<o.length;n+=2)if(e>=o[n]&&e<=o[n+1]){t=!0;break}t&&(n.push([e,i]),f[h]=1)}}}return{points:n,mask:f}}function H(e,t){const[n,i]=t;for(let o=0;o<e.length;o++){const t=e[o][1];(t<n||t>i)&&(e[o]=[NaN,NaN])}}function Q(e,t){const n=te(e[0].spatialReference);if(e.length<2||null==n)return e[0];if(t=t??A(e[0].spatialReference),1===(e=e.filter((e=>e.width>t))).length)return e[0];let{xmin:i,xmax:o,ymin:r,ymax:s}=e[0];for(let a=1;a<e.length;a++){const t=e[a];o=t.xmax+n*a,r=Math.min(r,t.ymin),s=Math.max(s,t.ymax)}return new h({xmin:i,xmax:o,ymin:r,ymax:s,spatialReference:e[0].spatialReference})}function V(t,n,i=null,o=!0){const r=t.spatialReference;if(r.equals(n))return t;const s=oe(t),a=te(r,!0),l=te(n);if(0===s||null==a||null==l){const e=ee(t,n,i,o);if(null==a&&null!=l&&Math.abs(e.width-l)<A(n)&&c()){const i=X(r);if(null!=i&&i.poleLocation===d.None&&t.width<(i.bbox[2]-i.bbox[0])/2)return $(t,n)||e}return e}const f=t.clone().normalize();if(1===f.length&&t.xmax<a&&t.xmax-a/2>A(r)){const{xmin:e,xmax:n}=t;for(let i=0;i<=s;i++){const o=0===i?e:-a/2,l=i===s?n-a*i:a/2;f[i]=new h({xmin:o,xmax:l,ymin:t.ymin,ymax:t.ymax,spatialReference:r})}}return Q(f.map((e=>ee(e,n,i,o))).filter(e))}function Z(e,t,n){if("extent"===e.type){const{xmin:t,ymin:n,xmax:i,ymax:o,spatialReference:r}=e;e=new p({rings:[[[t,o],[i,o],[i,n],[t,n],[t,o]]],spatialReference:r})}return e.spatialReference.equals(t)?e:(M(e.spatialReference,t,n),m(e,t,n))}function $(e,t){const n=te(t);if(null==n)return null;let{xmin:i,ymin:o,xmax:r,ymax:s}=e;const a=e.spatialReference,l=new p({spatialReference:a,rings:[[[i,o],[r,o],[r,s],[i,s],[i,o]]]}),c=m(l,t);if(2!==c.rings.length||!c.rings[0].length||!c.rings[1].length)return null;const{rings:f}=c,u=A(a),x=new h({spatialReference:t});for(let m=0;m<2;m++){i=r=f[m][0][0],o=s=f[m][0][1];for(let e=0;e<f[m].length;e++)i=i>f[m][e][0]?f[m][e][0]:i,r=r<f[m][e][0]?f[m][e][0]:r,o=o>f[m][e][1]?f[m][e][1]:o,s=s<f[m][e][1]?f[m][e][1]:s;if(0===m)x.ymin=o,x.ymax=s,x.xmin=i,x.xmax=r;else if(x.ymin=Math.min(x.ymin,o),x.ymax=Math.max(x.ymax,s),Math.abs(r-n/2)<u)x.xmin=i,x.xmax=x.xmax+n;else{if(!(Math.abs(i+n/2)<u))return null;x.xmax=r+n}}return x}function ee(e,t,n=null,i=!0,o=!0){const r=e.spatialReference;if(r.equals(t)||!t)return e;M(r,t,n);const s=m(e,t,n);if(o&&t.isWebMercator&&s&&(s.ymax=Math.min(20037508.342787,s.ymax),s.ymin=Math.max(-20037508.342787,s.ymin),s.ymin>=s.ymax))return null;if(!i||!s)return s;const a=ne(r,!0),l=ne(t,!0);if(null==a||null==l)return s;const c=A(r,.001),f=A(r,N),u=A(t,.001);if(Math.abs(s.xmin-l[0])<u&&Math.abs(s.xmax-l[1])<u){const i=Math.abs(e.xmin-a[0]),o=Math.abs(a[1]-e.xmax);if(i<c&&o>f){s.xmin=l[0];const i=[];i.push(new g(e.xmax,e.ymin,r)),i.push(new g(e.xmax,(e.ymin+e.ymax)/2,r)),i.push(new g(e.xmax,e.ymax,r));const o=i.map((e=>B(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmax=Math.max.apply(null,o)}if(o<c&&i>f){s.xmax=l[1];const i=[];i.push(new g(e.xmin,e.ymin,r)),i.push(new g(e.xmin,(e.ymin+e.ymax)/2,r)),i.push(new g(e.xmin,e.ymax,r));const o=i.map((e=>B(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmin=Math.min.apply(null,o)}}else{const e=A(t,.001);Math.abs(s.xmin-l[0])<e&&(s.xmin=l[0]),Math.abs(s.xmax-l[1])<e&&(s.xmax=l[1])}return s}function te(e,t=!1){if(!e)return null;const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*S[e.wkid]||null}function ne(e,t=!1){if(e.isGeographic)return[-180,180];const n=te(e,t);return null!=n?[-n/2,n/2]:null}function ie(e,t,n,i){let o=(e-t)/n;return o-Math.floor(o)!=0?o=Math.floor(o):i&&(o-=1),o}function oe(e,t=!1){const n=te(e.spatialReference);if(null==n)return 0;const i=t?0:-(n/2),o=A(e.spatialReference),r=!t&&Math.abs(e.xmax-n/2)<o?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<o?-n/2:e.xmin;return ie(r,i,n,!0)-ie(s,i,n,!1)}function re(e){const t=e.storageInfo.origin.x,n=te(e.spatialReference,!0);if(null==n)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};const i=n/2,{nativePixelSize:o,storageInfo:r,extent:s}=e,{maximumPyramidLevel:a,blockWidth:l,pyramidScalingFactor:c}=r;let f=o.x;const u=[],m=null!=e.transform&&"gcs-shift"===e.transform.type,x=t+(m?0:i),h=m?n-t:i-t;for(let p=0;p<=a;p++){const e=(s.xmax-t)/f/l,n=e-Math.floor(e)==0?e:Math.ceil(e),i=h/f/l,o=i-Math.floor(i)==0?i:Math.ceil(i),r=Math.floor(x/f/l),a=Math.round(x/f)%l,m=(l-Math.round(h/f)%l)%l;u.push({resolutionX:f,blockWidth:l,datasetColumnCount:n,worldColumnCountFromOrigin:o,leftMargin:a,rightPadding:m,originColumnOffset:r}),f*=c}return{originX:t,halfWorldWidth:i,pyramidsInfo:u,hasGCSSShiftTransform:m}}function se(e){if(!e||e.isGeographic)return e;const t=String(e.wkid||e.wkt2||e.wkt);let n;if(E.has(t))n=E.get(t);else{n=(e.wkid?i.coordsys(e.wkid):i.fromString(o.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),E.set(t,n)}return new y({wkid:n})}function ae(e){const t=e.isAdaptive&&null==e.spacing;let n=e.spacing||[P,P],i=le(e),o={cols:i.size[0]+1,rows:i.size[1]+1};const r=i.outofBoundPointCount>0&&i.outofBoundPointCount<i.offsets.length/2;let s=i.outofBoundPointCount===i.offsets.length/2||t&&r?[0,0]:R(i.offsets,o,n,G);const a=(s[0]+s[1])/2,l=e.projectedExtent.spatialReference,c=e.srcBufferExtent.spatialReference;if(t&&(r||a>G)){w(l,c,e.datumTransformation)&&(l.isGeographic||X(l)),n=[b,b],i=le({...e,spacing:n}),o={cols:i.size[0]+1,rows:i.size[1]+1},s=R(i.offsets,o,n,G)}if(i.error=s,n[0]>1&&(i.coefficients=ce(i.offsets,o,r)),e.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)i.gcsGrid={offsets:i.offsets,coefficients:i.coefficients,spacing:n};else{const t=X(l);if(null!=t&&!t.isEnvelope){const t=se(l),s=V(e.projectedExtent,t),{offsets:a}=le({...e,srcBufferExtent:s,spacing:n}),c=ce(a,o,r);i.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return i}function le(e){const{projectedExtent:t,srcBufferExtent:n,pixelSize:i,datumTransformation:o,rasterTransform:r}=e,s=t.spatialReference,a=n.spatialReference,l=M(s,a),{xmin:c,ymin:f,xmax:u,ymax:m}=t,x=te(a),h=null!=x&&(e.hasWrapAround||"gcs-shift"===r?.type),p=e.spacing||[P,P],y=p[0]*i.x,d=p[1]*i.y,w=1===p[0],R=Math.ceil((u-c)/y-.1/p[0])+(w?0:1),S=Math.ceil((m-f)/d-.1/p[1])+(w?0:1),G=q({cols:R,rows:S,xmin:c,ymax:m,xres:y,yres:d,inSR:s,outSR:a,datumTransformation:o,preferPE:p[0]<=b,usePixelCenter:w}),k=[];let E,T=0;const v=w?-1:NaN,{xmin:j,xmax:C,ymax:_,width:z,height:L}=n,I=A(a,N),W=null!=x&&j>0&&C>x/2;let O=!1;if(l){const e=X(s);O=null!=e&&e.poleLocation>0}for(let M=0;M<R;M++){const e=[];for(let t=0;t<S;t++){let n=G[M*S+t];if(h&&n[0]>C&&n[0]>x/2-I?n[0]-=x:h&&0===M&&n[0]<0&&W&&!r&&(n[0]+=x),!n||isNaN(n[0])||isNaN(n[1]))k.push(v),k.push(v),e.push(null),T++;else{if(r){const e=r.inverseTransform(new g({x:n[0],y:n[1],spatialReference:a}));n=[e.x,e.y]}e.push(n),M>0&&h&&E[t]&&n[0]<E[t][0]&&(n[0]+=x,O&&n[0]>C&&n[0]>x&&(n[0]-=x)),k.push((n[0]-j)/z),k.push((_-n[1])/L)}}E=e}return{offsets:k,error:null,coefficients:null,outofBoundPointCount:T,spacing:p,size:w?[R,S]:[R-1,S-1]}}function ce(e,t,n){const{cols:i,rows:o}=t,r=new Float32Array((i-1)*(o-1)*2*6),s=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let l=0;l<i-1;l++){for(let t=0;t<o-1;t++){let n=l*o*2+2*t;const c=e[n],f=e[n+1],u=e[n+2],m=e[n+3];n+=2*o;const x=e[n],h=e[n+1],p=e[n+2],g=e[n+3];let y=0,d=12*(t*(i-1)+l);for(let e=0;e<3;e++)r[d++]=s[y++]*c+s[y++]*u+s[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=s[y++]*f+s[y++]*m+s[y++]*g;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*c+a[y++]*x+a[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*f+a[y++]*h+a[y++]*g}if(n)for(let e=0;e<r.length;e++)isNaN(r[e])&&(r[e]=-1)}return r}function fe(e,t){const n=e.clone().normalize();return 1===n.length?n[0]:Q(n,t)}function ue(e){const{spatialReference:t}=e,n=x(t);if(!n)return e;const[i,o]=n.valid,r=o-i;let s=0;if(e.xmin<i){const t=i-e.xmin;s=Math.ceil(t/r)}else if(e.xmin>o){const t=e.xmin-o;s=-Math.ceil(t/r)}return new h({spatialReference:e.spatialReference,xmin:e.xmin+s*r,ymin:e.ymin,xmax:e.xmax+s*r,ymax:e.ymax})}function me(e,t,i){const{storageInfo:o,pixelSize:r}=t;let s=0,a=!1;const{pyramidResolutions:l}=o,c="mixed"===o.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,o.tileInfo.dpi/96)):1,f=(e.x+e.y)/2/c;if(null!=l&&l.length){const e=l[l.length-1],o=(e.x+e.y)/2,c=(r.x+r.y)/2;if(f<=c)s=0;else if(f>=o)s=l.length,a=f/o>8;else{let e,t=c;for(let n=1;n<=l.length;n++){if(e=(l[n-1].x+l[n-1].y)/2,f<=e){f===e?s=n:"down"===i?(s=n-1,a=f/t>8):s="up"===i||f-t>e-f||f/t>2?n:n-1;break}t=e}}const u=0===s?r:l[s-1];if(a){Math.min(u.x,u.y)*n(t.spatialReference)>19567&&(a=!1)}return{pyramidLevel:s,pyramidResolution:new g({x:u.x,y:u.y,spatialReference:t.spatialReference}),excessiveReading:a}}const u=Math.log(e.x/r.x)/Math.LN2,m=Math.log(e.y/r.y)/Math.LN2,x=t.storageInfo.maximumPyramidLevel||0;s="down"===i?Math.floor(Math.min(u,m)):"up"===i?Math.ceil(Math.max(u,m)):Math.round((u+m)/2),s<0?s=0:s>x&&(a=s>x+3,s=x);const h=2**s;return{pyramidLevel:s,pyramidResolution:new g({x:h*t.nativePixelSize.x,y:h*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:a}}function xe(e,t){const{pixelSize:n,extent:i}=e,o=_(i,t,!1);return V(fe(i,(n.x+n.y)/16),t,o)}function he(e,t,n){const i=n?.tileSize??512,o=n?.alignGlobalDatasetWithAGOL??!0,r=!!n?.limitToSrcResolution,{extent:s,spatialReference:a,pixelSize:l}=e,c=I(l,t,s);if(null==c)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const f=(c.x+c.y)/2,u=W(f,t),m=t.isGeographic?256/i*295828763.7958547:256/i*591657527.591555;let x="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const h=xe(e,t),p=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(m/2/u)/Math.LN2));if(!x&&o&&(t.isGeographic||t.isWebMercator)){const n=te(t);if(x=oe(h)>0||null!=n&&h.width>n/4,!x&&null!=n){let t=-1;if(p<3)t=2**p*f*i;else if(e.storageInfo){const{maximumPyramidLevel:n=0,pyramidScalingFactor:o=2}=e.storageInfo;t=o**n*f*i}const o=Math.ceil(n/t);x=1===o||2===o&&n/2-h.xmax<t}}let g,d=u;const w=1.001,M=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(x){d=m;const n=t.isGeographic?1341104507446289e-21:.29858214164761665,i=W(n,t),o=t.isGeographic?4326:3857;g=I({x:n,y:n},a,xe(e,new y({wkid:o}))),g.x*=d/i,g.y*=d/i}else{g={x:l.x,y:l.y};let e=0;for(;d<m*(w/2)&&e<p;)e++,d*=M,g.x*=M,g.y*=M;Math.max(d,m)/Math.min(d,m)<=w&&(d=m)}const R=[d],S=[{x:g.x,y:g.y}],P=70.5310735,b=Math.min(P,u)/w;for(;d>=b;)d/=M,g.x/=M,g.y/=M,R.push(d),S.push({x:g.x,y:g.y});if(r){const e=.001*l.x;let t=S.findIndex((t=>t.x>=l.x-e&&t.x<=l.x+e));t>-1?(S.length=t+1,R.length=t+1):(t=S.findIndex((t=>t.x<=l.x+e)),t>0&&(S.length=t,R.length=t))}return{projectedPixelSize:c,scales:R,srcResolutions:S,isCustomTilingScheme:!x}}export{he as computeProjectedScales,P as defaultGridSpacing,G as defaultProjectionToleranceInPixels,_ as getDefaultDatumTransformationForDataset,q as getProjectedGridPoints,ae as getProjectionOffsetGrid,re as getRasterDatasetAlignmentInfo,O as getSourceScale,te as getWorldWidth,oe as getWorldWrapCount,C as load,b as minimumGridSpacing,xe as projectDatasetExtent,I as projectDatasetResolution,V as projectExtent,B as projectPoint,Z as projectPolygon,z as projectResolution,w as requirePE,ue as shiftExtent,fe as snapExtent,me as snapPyramid};
|
|
5
|
+
import"../../../geometry.js";import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{P as i,a as o,g as r,h as s,j as a}from"../../../chunks/pe.js";import{canProjectWithoutEngine as l,isLoaded as c,load as f,getTransformation as u,project as m}from"../../../geometry/projection.js";import{getInfo as x}from"../../../geometry/support/spatialReferenceUtils.js";import h from"../../../geometry/Extent.js";import p from"../../../geometry/Polygon.js";import g from"../../../geometry/Point.js";import y from"../../../geometry/SpatialReference.js";var d;function w(e,t,n){return!l(e,t,n)}function M(e,n,i){const o=w(e,n,i);if(o&&!c())throw new t("rasterprojectionhelper-project","projection engine is not loaded");return o}!function(e){e[e.None=0]="None",e[e.North=1]="North",e[e.South=2]="South",e[e.Both=3]="Both"}(d||(d={}));const R=(e,t,n,i=0)=>{if(1===n[0])return[0,0];let o=1,r=-1,s=1,a=-1;for(let g=0;g<e.length;g+=2)isNaN(e[g])||(o=o>e[g]?e[g]:o,r=r>e[g]?r:e[g],s=s>e[g+1]?e[g+1]:s,a=a>e[g+1]?a:e[g+1]);const{cols:l,rows:c}=t,f=(r-o)/l/n[0],u=(a-s)/c/n[1],m=2*i;let x=0,h=!1,p=[0,0];for(let g=0;g<l-3;g++){for(let t=0;t<c-3;t++){const n=g*c*2+2*t,i=(e[n]+e[n+4]+e[n+4*c]+e[n+4*c+4])/4,o=(e[n+1]+e[n+5]+e[n+4*c+1]+e[n+4*c+5])/4,r=Math.abs((i-e[n+2*c+2])/f),s=Math.abs((o-e[n+2*c+3])/u);if(r+s>x&&(x=r+s,p=[r,s]),m&&x>m){h=!0;break}}if(h)break}return p},S={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},P=32,b=4,G=b,k=new Map,E=new Map,N=500,T=39.37,v=96;let j=null;async function C(){j&&c()||(c()||await f(),j=await import("../../../geometry/geometryEngine.js"))}function _(e,t,n){M(e.spatialReference,t);return n?u(t,e.spatialReference,e):u(e.spatialReference,t,e)}function z(e,t,n,i=null){const o=e.spatialReference;if(!o||!t||o.equals(t))return e;M(o,t,i);const r=n.center,s=new h({xmin:r.x-e.x/2,xmax:r.x+e.x/2,ymin:r.y-e.y/2,ymax:r.y+e.y/2,spatialReference:o}),a=m(s,t,i),l=te(t);return null==a||null!=l&&a.width>=l?L(e,o,t):{x:a.width,y:a.height}}function L(e,t,i){const o=n(t)/n(i);return{x:e.x*o,y:e.y*o}}function I(e,i,o){const{spatialReference:r}=o;if(!r||!i||r.equals(i))return e;if(r.isGeographic&&i.isGeographic)return L(e,r,i);if(M(r,i),!j)throw new t("raster-projection-helper:project-dataset-resolution","geometry engine is not loaded");let{x:s,y:a}=e;const l=(s+a)/2*n(r);let c=1;l>30&&(c=30/l,s*=c,a*=c);const f=256,u=s*f/2,x=a*f/2,{x:h,y:g}=o.center,y=[];for(let t=0;t<=f;t++)y.push([h-u,g-x+t*a]);for(let t=1;t<=f;t++)y.push([h-u+t*s,g+x]);for(let t=1;t<=f;t++)y.push([h+u,g+x-t*a]);for(let t=1;t<f;t++)y.push([h+u-t*s,g-x]);y.push(y[0]);const d=new p({rings:[y],spatialReference:r}),w=m(d,i);if(!w)return L(e,r,i);const R=w.extent,S=te(i);if(null==R||null!=S&&R.width>=S)return L(e,r,i);const P=j.planarArea(w),b=s*a*f*f,G=Math.sqrt(P/b)/c,k={x:R.width/c/f,y:R.height/c/f},E={x:s*G,y:a*G},N=k.x*k.y;return Math.abs(N-E.x*E.y)/N<.1?k:E}function W(e,t){return("number"==typeof e?e:(e.x+e.y)/2)*n(t)*v*T}function O(e,t){const{pixelSize:n,extent:i}=e;return W(I(n,t,i),t)}function A(e,t=.01){return n(e)?t/n(e):0}function B(e,t,n=null,i=!0){const o=e.spatialReference;if(o.equals(t))return e;M(o,t,n);const r=m(e,t,n);return i&&r?(F([e],[r],o,t),r):r}function F(e,t,n,i){const o=ne(n,!0),r=ne(i,!0),s=A(n,N),a=A(i,N);if(s&&null!=o&&null!=r)for(let l=0;l<e.length;l++){const n=t[l];if(!n)continue;const{x:i}=e[l],{x:c}=n;c>=r[1]-a&&Math.abs(i-o[0])<s?n.x-=r[1]-r[0]:c<=r[0]+a&&Math.abs(i-o[1])<s&&(n.x+=r[1]-r[0])}}function q(e){const{inSR:t,outSR:n,datumTransformation:i,preferPE:o}=e;if(t.equals(n)){const{points:t}=D(e,null);return t}if(t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator)return U(e);if(M(t,n,i)&&o){if(t.isGeographic)return J(e);if(null!=X(t))return J(e)}return Y(e)}function Y(e){const{points:t}=D(e,null),{inSR:n,outSR:i,datumTransformation:o}=e,r=t.map((e=>new g(e[0],e[1],n))),s=m(r,i,o);return o&&F(r,s,n,i),s.map((e=>e?[e.x,e.y]:[NaN,NaN]))}function J(e){const{inSR:t,outSR:n,datumTransformation:a}=e,l=X(t),{points:c,mask:f}=D(e,l);if(!t.isGeographic){const e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?o.PE_TYPE_GEOGCS:o.PE_TYPE_PROJCS,t.wkt2||t.wkt);r.projToGeog(e,c.length,c)}if(null!=a&&a.steps.length){let e;const t=179.9955;if(n.isGeographic&&(e=c.map((([e])=>e>t?1:e<-179.9955?-1:0))),a.steps.forEach((e=>{const t=e.wkid?i.geogtran(e.wkid):i.fromString(o.PE_TYPE_GEOGTRAN,e.wkt);s.geogToGeog(t,c.length,c,null,e.isInverse?o.PE_TRANSFORM_2_TO_1:o.PE_TRANSFORM_1_TO_2)})),e)for(let n=0;n<c.length;n++){const i=e[n],o=c[n][0],r=o>t?1:o<-179.9955?-1:0;i&&r&&i!==r&&(c[n][0]=i>0?o+360:o-360)}}if(!n.isGeographic){const e=X(n,!0),t=null!=e&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90];H(c,t);const s=n.wkid?i.coordsys(n.wkid):i.fromString(n.isGeographic?o.PE_TYPE_GEOGCS:o.PE_TYPE_PROJCS,n.wkt2||n.wkt);r.geogToProj(s,c.length,c)}let u=c;if(f&&c.length!==f.length){u=[];for(let e=0,t=0;e<f.length;e++)f[e]?u.push(c[t++]):u.push([NaN,NaN])}return u}function U(e){const{cols:t,rows:n,xres:i,yres:o,usePixelCenter:r,inSR:s,outSR:a}=e;let{xmin:l,ymax:c}=e;r&&(l+=i/2,c-=o/2);const f=[],u=[],x=Math.max(t,n);for(let p=0;p<x;p++){const e=l+i*Math.min(t,p),r=c-o*Math.min(n,p),x=m(new g({x:e,y:r,spatialReference:s}),a);p<=t&&f.push(x.x),p<=n&&u.push(x.y)}const h=[];for(let m=0;m<t;m++)for(let e=0;e<n;e++)h.push([f[m],u[e]]);return h}function X(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),k.has(n)){const e=k.get(n);return t?e?.gcs:e?.pcs}const r=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?o.PE_TYPE_GEOGCS:o.PE_TYPE_PROJCS,e.wkt2||e.wkt),s=K(r,A(e,1e-4)),a=K(r,0,!0);return k.set(n,{pcs:s,gcs:a}),t?a:s}function K(e,t=0,n=!1){const i=a.generate(e),o=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!i||!o?.length)return null;let r=!1,s=o.find((e=>1===e.getInclusive()&&1===e.getKind()));if(!s){if(s=o.find((e=>1===e.getInclusive()&&0===e.getKind())),!s)return null;r=!0}const l=n?0:(2===i.getNorthPoleLocation()?1:0)|(2===i.getSouthPoleLocation()?2:0),c=i.isPannableRectangle(),f=s.getCoord();if(r)return{isEnvelope:r,isPannable:c,vertices:f,coef:null,bbox:[f[0][0]-t,f[0][1]-t,f[1][0]+t,f[1][1]+t],poleLocation:l};let u=0;const m=[];let[x,h]=f[0],[p,g]=f[0];for(let a=0,y=f.length;a<y;a++){u++,u===y&&(u=0);const[e,t]=f[a],[n,i]=f[u];if(i===t)m.push([e,n,t,i,2]);else{const o=(n-e)/(i-t||1e-4),r=e-o*t;t<i?m.push([o,r,t,i,0]):m.push([o,r,i,t,1])}x=x<e?x:e,h=h<t?h:t,p=p>e?p:e,g=g>t?g:t}return{isEnvelope:!1,isPannable:c,vertices:f,coef:m,bbox:[x,h,p,g],poleLocation:l}}function D(e,t){const n=[],{cols:i,rows:o,xres:r,yres:s,usePixelCenter:a}=e;let{xmin:l,ymax:c}=e;if(a&&(l+=r/2,c-=s/2),null==t){for(let e=0;e<i;e++)for(let t=0;t<o;t++)n.push([l+r*e,c-s*t]);return{points:n}}const f=new Uint8Array(i*o);if(t.isEnvelope){const{bbox:[e,a,u,m]}=t;for(let x=0,h=0;x<i;x++){const i=l+r*x,p=t.isPannable||i>=e&&i<=u;for(let e=0;e<o;e++,h++){const t=c-s*e;p&&t>=a&&t<=m&&(n.push([i,t]),f[h]=1)}}return{points:n,mask:f}}const u=t.coef,m=[];for(let x=0;x<o;x++){const e=c-s*x,t=[],n=[];for(let o=0;o<u.length;o++){const[i,r,s,a,l]=u[o];if(e===s&&s===a)t.push(i),t.push(r),n.push(2),n.push(2);else if(e>=s&&e<=a){const o=i*e+r;t.push(o),n.push(l)}}let i=t;if(t.length>2){let e=2===n[0]?0:n[0],o=t[0];i=[];for(let r=1;r<n.length;r++)2===n[r]&&r!==n.length-1||(n[r]!==e&&(i.push(0===e?Math.min(o,t[r-1]):Math.max(o,t[r-1])),e=n[r],o=t[r]),r===n.length-1&&i.push(0===n[r]?Math.min(o,t[r]):Math.max(o,t[r])));i.sort(((e,t)=>e-t))}else t[0]>t[1]&&(i=[t[1],t[0]]);m.push(i)}for(let x=0,h=0;x<i;x++){const e=l+r*x;for(let t=0;t<o;t++,h++){const i=c-s*t,o=m[t];if(2===o.length)e>=o[0]&&e<=o[1]&&(n.push([e,i]),f[h]=1);else if(o.length>2){let t=!1;for(let n=0;n<o.length;n+=2)if(e>=o[n]&&e<=o[n+1]){t=!0;break}t&&(n.push([e,i]),f[h]=1)}}}return{points:n,mask:f}}function H(e,t){const[n,i]=t;for(let o=0;o<e.length;o++){const t=e[o][1];(t<n||t>i)&&(e[o]=[NaN,NaN])}}function Q(e,t){const n=te(e[0].spatialReference);if(e.length<2||null==n)return e[0];if(t=t??A(e[0].spatialReference),1===(e=e.filter((e=>e.width>t))).length)return e[0];let{xmin:i,xmax:o,ymin:r,ymax:s}=e[0];for(let a=1;a<e.length;a++){const t=e[a];o=t.xmax+n*a,r=Math.min(r,t.ymin),s=Math.max(s,t.ymax)}return new h({xmin:i,xmax:o,ymin:r,ymax:s,spatialReference:e[0].spatialReference})}function V(t,n,i=null,o=!0){const r=t.spatialReference;if(r.equals(n))return t;const s=oe(t),a=te(r,!0),l=te(n);if(0===s||null==a||null==l){const e=ee(t,n,i,o);if(null==a&&null!=l&&Math.abs(e.width-l)<A(n)&&c()){const i=X(r);if(null!=i&&i.poleLocation===d.None&&t.width<(i.bbox[2]-i.bbox[0])/2)return $(t,n)||e}return e}const f=t.clone().normalize();if(1===f.length&&t.xmax<a&&t.xmax-a/2>A(r)){const{xmin:e,xmax:n}=t;for(let i=0;i<=s;i++){const o=0===i?e:-a/2,l=i===s?n-a*i:a/2;f[i]=new h({xmin:o,xmax:l,ymin:t.ymin,ymax:t.ymax,spatialReference:r})}}return Q(f.map((e=>ee(e,n,i,o))).filter(e))}function Z(e,t,n){if("extent"===e.type){const{xmin:t,ymin:n,xmax:i,ymax:o,spatialReference:r}=e;e=new p({rings:[[[t,o],[i,o],[i,n],[t,n],[t,o]]],spatialReference:r})}return e.spatialReference.equals(t)?e:(M(e.spatialReference,t,n),m(e,t,n))}function $(e,t){const n=te(t);if(null==n)return null;let{xmin:i,ymin:o,xmax:r,ymax:s}=e;const a=e.spatialReference,l=new p({spatialReference:a,rings:[[[i,o],[r,o],[r,s],[i,s],[i,o]]]}),c=m(l,t);if(2!==c.rings.length||!c.rings[0].length||!c.rings[1].length)return null;const{rings:f}=c,u=A(a),x=new h({spatialReference:t});for(let m=0;m<2;m++){i=r=f[m][0][0],o=s=f[m][0][1];for(let e=0;e<f[m].length;e++)i=i>f[m][e][0]?f[m][e][0]:i,r=r<f[m][e][0]?f[m][e][0]:r,o=o>f[m][e][1]?f[m][e][1]:o,s=s<f[m][e][1]?f[m][e][1]:s;if(0===m)x.ymin=o,x.ymax=s,x.xmin=i,x.xmax=r;else if(x.ymin=Math.min(x.ymin,o),x.ymax=Math.max(x.ymax,s),Math.abs(r-n/2)<u)x.xmin=i,x.xmax=x.xmax+n;else{if(!(Math.abs(i+n/2)<u))return null;x.xmax=r+n}}return x}function ee(e,t,n=null,i=!0,o=!0){const r=e.spatialReference;if(r.equals(t)||!t)return e;M(r,t,n);const s=m(e,t,n);if(o&&t.isWebMercator&&s&&(s.ymax=Math.min(20037508.342787,s.ymax),s.ymin=Math.max(-20037508.342787,s.ymin),s.ymin>=s.ymax))return null;if(!i||!s)return s;const a=ne(r,!0),l=ne(t,!0);if(null==a||null==l)return s;const c=A(r,.001),f=A(r,N),u=A(t,.001);if(Math.abs(s.xmin-l[0])<u&&Math.abs(s.xmax-l[1])<u){const i=Math.abs(e.xmin-a[0]),o=Math.abs(a[1]-e.xmax);if(i<c&&o>f){s.xmin=l[0];const i=[];i.push(new g(e.xmax,e.ymin,r)),i.push(new g(e.xmax,(e.ymin+e.ymax)/2,r)),i.push(new g(e.xmax,e.ymax,r));const o=i.map((e=>B(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmax=Math.max.apply(null,o)}if(o<c&&i>f){s.xmax=l[1];const i=[];i.push(new g(e.xmin,e.ymin,r)),i.push(new g(e.xmin,(e.ymin+e.ymax)/2,r)),i.push(new g(e.xmin,e.ymax,r));const o=i.map((e=>B(e,t,n))).filter((e=>!isNaN(e?.x))).map((e=>e.x));s.xmin=Math.min.apply(null,o)}}else{const e=A(t,.001);Math.abs(s.xmin-l[0])<e&&(s.xmin=l[0]),Math.abs(s.xmax-l[1])<e&&(s.xmax=l[1])}return s}function te(e,t=!1){if(!e)return null;const n=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*n:e.wkid&&e.isGeographic?360:2*S[e.wkid]||null}function ne(e,t=!1){if(e.isGeographic)return[-180,180];const n=te(e,t);return null!=n?[-n/2,n/2]:null}function ie(e,t,n,i){let o=(e-t)/n;return o-Math.floor(o)!=0?o=Math.floor(o):i&&(o-=1),o}function oe(e,t=!1){const n=te(e.spatialReference);if(null==n)return 0;const i=t?0:-(n/2),o=A(e.spatialReference),r=!t&&Math.abs(e.xmax-n/2)<o?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<o?-n/2:e.xmin;return ie(r,i,n,!0)-ie(s,i,n,!1)}function re(e){const t=e.storageInfo.origin.x,n=te(e.spatialReference,!0);if(null==n)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};const i=n/2,{nativePixelSize:o,storageInfo:r,extent:s}=e,{maximumPyramidLevel:a,blockWidth:l,pyramidScalingFactor:c}=r;let f=o.x;const u=[],m=null!=e.transform&&"gcs-shift"===e.transform.type,x=t+(m?0:i),h=m?n-t:i-t;for(let p=0;p<=a;p++){const e=(s.xmax-t)/f/l,n=e-Math.floor(e)==0?e:Math.ceil(e),i=h/f/l,o=i-Math.floor(i)==0?i:Math.ceil(i),r=Math.floor(x/f/l),a=Math.round(x/f)%l,m=(l-Math.round(h/f)%l)%l;u.push({resolutionX:f,blockWidth:l,datasetColumnCount:n,worldColumnCountFromOrigin:o,leftMargin:a,rightPadding:m,originColumnOffset:r}),f*=c}return{originX:t,halfWorldWidth:i,pyramidsInfo:u,hasGCSSShiftTransform:m}}function se(e){if(!e||e.isGeographic)return e;const t=String(e.wkid||e.wkt2||e.wkt);let n;if(E.has(t))n=E.get(t);else{n=(e.wkid?i.coordsys(e.wkid):i.fromString(o.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),E.set(t,n)}return new y({wkid:n})}function ae(e){const t=e.isAdaptive&&null==e.spacing;let n=e.spacing||[P,P],i=le(e),o={cols:i.size[0]+1,rows:i.size[1]+1};const r=i.outofBoundPointCount>0&&i.outofBoundPointCount<i.offsets.length/2;let s=i.outofBoundPointCount===i.offsets.length/2||t&&r?[0,0]:R(i.offsets,o,n,G);const a=(s[0]+s[1])/2,l=e.projectedExtent.spatialReference,c=e.srcBufferExtent.spatialReference;if(t&&(r||a>G)){w(l,c,e.datumTransformation)&&(l.isGeographic||X(l)),n=[b,b],i=le({...e,spacing:n}),o={cols:i.size[0]+1,rows:i.size[1]+1},s=R(i.offsets,o,n,G)}if(i.error=s,n[0]>1&&(i.coefficients=ce(i.offsets,o,r)),e.includeGCSGrid&&!l.isGeographic&&!l.isWebMercator)if(c.isGeographic)i.gcsGrid={offsets:i.offsets,coefficients:i.coefficients,spacing:n};else{const t=X(l);if(null!=t&&!t.isEnvelope){const t=se(l),s=V(e.projectedExtent,t),{offsets:a}=le({...e,srcBufferExtent:s,spacing:n}),c=ce(a,o,r);i.gcsGrid={offsets:a,coefficients:c,spacing:n}}}return i}function le(e){const{projectedExtent:t,srcBufferExtent:n,pixelSize:i,datumTransformation:o,rasterTransform:r}=e,s=t.spatialReference,a=n.spatialReference,l=M(s,a),{xmin:c,ymin:f,xmax:u,ymax:m}=t,x=te(a),h=null!=x&&(e.hasWrapAround||"gcs-shift"===r?.type),p=e.spacing||[P,P],y=p[0]*i.x,d=p[1]*i.y,w=1===p[0],R=Math.ceil((u-c)/y-.1/p[0])+(w?0:1),S=Math.ceil((m-f)/d-.1/p[1])+(w?0:1),G=q({cols:R,rows:S,xmin:c,ymax:m,xres:y,yres:d,inSR:s,outSR:a,datumTransformation:o,preferPE:p[0]<=b,usePixelCenter:w}),k=[];let E,T=0;const v=w?-1:NaN,{xmin:j,xmax:C,ymax:_,width:z,height:L}=n,I=A(a,N),W=null!=x&&j>0&&C>x/2;let O=!1;if(l){const e=X(s);O=null!=e&&e.poleLocation>0}for(let M=0;M<R;M++){const e=[];for(let t=0;t<S;t++){let n=G[M*S+t];if(h&&n[0]>C&&n[0]>x/2-I?n[0]-=x:h&&0===M&&n[0]<0&&W&&!r&&(n[0]+=x),!n||isNaN(n[0])||isNaN(n[1]))k.push(v),k.push(v),e.push(null),T++;else{if(r){const e=r.inverseTransform(new g({x:n[0],y:n[1],spatialReference:a}));n=[e.x,e.y]}e.push(n),M>0&&h&&E[t]&&n[0]<E[t][0]&&(n[0]+=x,O&&n[0]>C&&n[0]>x&&(n[0]-=x)),k.push((n[0]-j)/z),k.push((_-n[1])/L)}}E=e}return{offsets:k,error:null,coefficients:null,outofBoundPointCount:T,spacing:p,size:w?[R,S]:[R-1,S-1]}}function ce(e,t,n){const{cols:i,rows:o}=t,r=new Float32Array((i-1)*(o-1)*2*6),s=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),a=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let l=0;l<i-1;l++){for(let t=0;t<o-1;t++){let n=l*o*2+2*t;const c=e[n],f=e[n+1],u=e[n+2],m=e[n+3];n+=2*o;const x=e[n],h=e[n+1],p=e[n+2],g=e[n+3];let y=0,d=12*(t*(i-1)+l);for(let e=0;e<3;e++)r[d++]=s[y++]*c+s[y++]*u+s[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=s[y++]*f+s[y++]*m+s[y++]*g;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*c+a[y++]*x+a[y++]*p;y=0;for(let e=0;e<3;e++)r[d++]=a[y++]*f+a[y++]*h+a[y++]*g}if(n)for(let e=0;e<r.length;e++)isNaN(r[e])&&(r[e]=-1)}return r}function fe(e,t){const n=e.clone().normalize();return 1===n.length?n[0]:Q(n,t)}function ue(e){const{spatialReference:t}=e,n=x(t);if(!n)return e;const[i,o]=n.valid,r=o-i;let s=0;if(e.xmin<i){const t=i-e.xmin;s=Math.ceil(t/r)}else if(e.xmin>o){const t=e.xmin-o;s=-Math.ceil(t/r)}return new h({spatialReference:e.spatialReference,xmin:e.xmin+s*r,ymin:e.ymin,xmax:e.xmax+s*r,ymax:e.ymax})}function me(e,t,i){const{storageInfo:o,pixelSize:r}=t;let s=0,a=!1;const{pyramidResolutions:l}=o,c="mixed"===o.tileInfo.format?.toLowerCase()?Math.max(1,Math.min(3,o.tileInfo.dpi/96)):1,f=(e.x+e.y)/2/c;if(null!=l&&l.length){const e=l[l.length-1],o=(e.x+e.y)/2,c=(r.x+r.y)/2;if(f<=c)s=0;else if(f>=o)s=l.length,a=f/o>8;else{let e,t=c;for(let n=1;n<=l.length;n++){if(e=(l[n-1].x+l[n-1].y)/2,f<=e){f===e?s=n:"down"===i?(s=n-1,a=f/t>8):s="up"===i||f-t>e-f||f/t>2?n:n-1;break}t=e}}const u=0===s?r:l[s-1];if(a){Math.min(u.x,u.y)*n(t.spatialReference)>19567&&(a=!1)}return{pyramidLevel:s,pyramidResolution:new g({x:u.x,y:u.y,spatialReference:t.spatialReference}),excessiveReading:a}}const u=Math.log(e.x/r.x)/Math.LN2,m=Math.log(e.y/r.y)/Math.LN2,x=t.storageInfo.maximumPyramidLevel||0;s="down"===i?Math.floor(Math.min(u,m)):"up"===i?Math.ceil(Math.max(u,m)):Math.round((u+m)/2),s<0?s=0:s>x&&(a=s>x+3,s=x);const h=2**s;return{pyramidLevel:s,pyramidResolution:new g({x:h*t.nativePixelSize.x,y:h*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:a}}function xe(e,t){const{pixelSize:n,extent:i}=e,o=_(i,t,!1);return V(fe(i,(n.x+n.y)/16),t,o)}function he(e,t,n){const i=n?.tileSize??512,o=n?.alignGlobalDatasetWithAGOL??!0,r=!!n?.limitToSrcResolution,{extent:s,spatialReference:a,pixelSize:l}=e,c=I(l,t,s);if(null==c)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};const f=(c.x+c.y)/2,u=W(f,t),m=t.isGeographic?256/i*295828763.7958547:256/i*591657527.591555;let x="vector-magdir"===e.dataType||"vector-uv"===e.dataType;const h=xe(e,t),p=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(m/2/u)/Math.LN2));if(!x&&o&&(t.isGeographic||t.isWebMercator)){const n=te(t);if(x=oe(h)>0||null!=n&&h.width>n/4,!x&&null!=n){let t=-1;if(p<3)t=2**p*f*i;else if(e.storageInfo){const{maximumPyramidLevel:n=0,pyramidScalingFactor:o=2}=e.storageInfo;t=o**n*f*i}const o=Math.ceil(n/t);x=1===o||2===o&&n/2-h.xmax<t}}let g,d=u;const w=1.001,M=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(x){d=m;const n=t.isGeographic?1341104507446289e-21:.29858214164761665,i=W(n,t),o=t.isGeographic?4326:3857;g=I({x:n,y:n},a,xe(e,new y({wkid:o}))),g.x*=d/i,g.y*=d/i}else{g={x:l.x,y:l.y};let e=0;for(;d<m*(w/2)&&e<p;)e++,d*=M,g.x*=M,g.y*=M;Math.max(d,m)/Math.min(d,m)<=w&&(d=m)}const R=[d],S=[{x:g.x,y:g.y}],P=70.5310735,b=Math.min(P,u)/w;for(;d>=b;)d/=M,g.x/=M,g.y/=M,R.push(d),S.push({x:g.x,y:g.y});if(r){const e=.001*l.x;let t=S.findIndex((t=>t.x>=l.x-e&&t.x<=l.x+e));t>-1?(S.length=t+1,R.length=t+1):(t=S.findIndex((t=>t.x<=l.x+e)),t>0&&(S.length=t,R.length=t))}return{projectedPixelSize:c,scales:R,srcResolutions:S,isCustomTilingScheme:!x}}export{he as computeProjectedScales,P as defaultGridSpacing,G as defaultProjectionToleranceInPixels,_ as getDefaultDatumTransformationForDataset,q as getProjectedGridPoints,ae as getProjectionOffsetGrid,re as getRasterDatasetAlignmentInfo,O as getSourceScale,te as getWorldWidth,oe as getWorldWrapCount,C as load,b as minimumGridSpacing,xe as projectDatasetExtent,I as projectDatasetResolution,V as projectExtent,B as projectPoint,Z as projectPolygon,z as projectResolution,w as requirePE,ue as shiftExtent,fe as snapExtent,me as snapPyramid};
|