@arcgis/core 4.33.0-next.20250211 → 4.33.0-next.20250212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3c23e567cfb7372c44ba.js → 0a5689348d544090006d.js} +1 -1
- package/assets/esri/core/workers/chunks/0b8bf1966653c326e95a.js +1 -0
- package/assets/esri/core/workers/chunks/{baee20c14763bef80b09.js → 1249fd2f83caeaefd8ce.js} +1 -1
- package/assets/esri/core/workers/chunks/135fb580d8afd8d60811.js +1 -0
- package/assets/esri/core/workers/chunks/{946a9890f3621d1dfbc5.js → 144e534d4ac1aafab60d.js} +1 -1
- package/assets/esri/core/workers/chunks/{cee3a38b92a48a58c4d0.js → 152becae48572299b07f.js} +1 -1
- package/assets/esri/core/workers/chunks/{f200dca22f9f9bbb8670.js → 17213c3fc63f580e5b73.js} +1 -1
- package/assets/esri/core/workers/chunks/24e6476f32ad2014d39d.js +1 -0
- package/assets/esri/core/workers/chunks/272662e4e28341419b4f.js +1 -0
- package/assets/esri/core/workers/chunks/{5fbdb5fea7d6676fcf19.js → 2c1a85a801cb4d9d737e.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f87cf3d6a365d987f69.js → 30bd5b3204e09f516ea2.js} +1 -1
- package/assets/esri/core/workers/chunks/{c04091eea7089dc2e864.js → 35bcb0622234b38d85b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{92984981afcbb95828cd.js → 37cfd102b6ab5b959f9d.js} +1 -1
- package/assets/esri/core/workers/chunks/3835c2884c55e73dc202.js +1 -0
- package/assets/esri/core/workers/chunks/{6c9bb00f33649ab59dab.js → 3ba85f1d660b8887f963.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d51c064045e9c47bd2e.js → 3bad184751fcb26c003c.js} +1 -1
- package/assets/esri/core/workers/chunks/{e468bf4ec7402942ad8c.js → 3ebdd0701e77bb28c75d.js} +1 -1
- package/assets/esri/core/workers/chunks/{a559db8654b4f83fd79b.js → 3f6516af411256d90a03.js} +1 -1
- package/assets/esri/core/workers/chunks/{c83b26ff96e39266adc2.js → 4300c80fa10c5d9141e8.js} +1 -1
- package/assets/esri/core/workers/chunks/4848a3e31632d15dc4ce.js +1 -0
- package/assets/esri/core/workers/chunks/{77764ca90bdd13ee2167.js → 486df1e042204b90b0dd.js} +2 -2
- package/assets/esri/core/workers/chunks/{77764ca90bdd13ee2167.js.LICENSE.txt → 486df1e042204b90b0dd.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/52f61e1f5972a72b6b54.js +1 -0
- package/assets/esri/core/workers/chunks/{354531dc2f0dea2ad96f.js → 5693d9ce4472a4c5959f.js} +2 -2
- package/assets/esri/core/workers/chunks/{354531dc2f0dea2ad96f.js.LICENSE.txt → 5693d9ce4472a4c5959f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e56647e61296643c5f84.js → 5719471414810b6a9aec.js} +1 -1
- package/assets/esri/core/workers/chunks/{1accbc048b74857269e4.js → 57924f4909f2cbe5d64c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b21b152fa15896577242.js → 5b56b271afb0fadf48b4.js} +2 -2
- package/assets/esri/core/workers/chunks/{b21b152fa15896577242.js.LICENSE.txt → 5b56b271afb0fadf48b4.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{b3aeda290470dcb2bdd2.js → 5cf08ee5114273163e09.js} +1 -1
- package/assets/esri/core/workers/chunks/{76794184ba8c2e66745e.js → 629f4621ba6ffdcaa2f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{32d3657dcae89b740f8b.js → 6518954889df2e781c47.js} +2 -2
- package/assets/esri/core/workers/chunks/{32d3657dcae89b740f8b.js.LICENSE.txt → 6518954889df2e781c47.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{220b12654b94c94f8d8a.js → 6fa1f1e431aae1794ce3.js} +1 -1
- package/assets/esri/core/workers/chunks/82facb23dfaba2819bc7.js +1 -0
- package/assets/esri/core/workers/chunks/8722d05ae9b0aa5162a4.js +1 -0
- package/assets/esri/core/workers/chunks/8de4280080296adb1757.js +1 -0
- package/assets/esri/core/workers/chunks/{1f443b99653708470f31.js → 96d7f47ea8fbf345101c.js} +1 -1
- package/assets/esri/core/workers/chunks/{e6087eda5e3b7e5ad3e1.js → a12afed58acff17708ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{95ad76e58452b60fb79f.js → a864ef9b584c83ebf6ae.js} +1 -1
- package/assets/esri/core/workers/chunks/{df3d1a8d3f11d52eb30d.js → afdbdc1569b56489c14d.js} +1 -1
- package/assets/esri/core/workers/chunks/{308ec51ff4a66f7fcb0d.js → b0952b81d5be214262dd.js} +2 -2
- package/assets/esri/core/workers/chunks/{308ec51ff4a66f7fcb0d.js.LICENSE.txt → b0952b81d5be214262dd.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{89e3f7880abd014a62c0.js → b42d26123784997c66e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{4040158835f9036967cd.js → b83151b03bbeba466f82.js} +2 -2
- package/assets/esri/core/workers/chunks/{4040158835f9036967cd.js.LICENSE.txt → b83151b03bbeba466f82.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/bf0bf2b912d668575a9b.js +1 -0
- package/assets/esri/core/workers/chunks/{94490937dca566fe2640.js → c061cad8323f0469e7e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{fef135e55706d84d1947.js → c4ce3c35b52b7999e877.js} +1 -1
- package/assets/esri/core/workers/chunks/cc8eb975a543556f88ae.js +1 -0
- package/assets/esri/core/workers/chunks/{6e6422eda398774acbc7.js → d60da671aba70485050e.js} +1 -1
- package/assets/esri/core/workers/chunks/{88a34690480d3658bad8.js → d7b260d6187f29e0c136.js} +1 -1
- package/assets/esri/core/workers/chunks/de638753a30c9aa41bad.js +1 -0
- package/assets/esri/core/workers/chunks/de87009542886fad9a2f.js +2 -0
- package/assets/esri/core/workers/chunks/{b765670b47d209d7655a.js.LICENSE.txt → de87009542886fad9a2f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{bb73cd34fbae935ccbcc.js → dff4a9d656b84fe3e052.js} +1 -1
- package/assets/esri/core/workers/chunks/{12199e8abf377ffc27cd.js → e490f70f192780d7ad50.js} +1 -1
- package/assets/esri/core/workers/chunks/f088e7db4e7ac85aaff1.js +1 -0
- package/assets/esri/core/workers/chunks/{a38cb1fff519bad8abe3.js → f0d28fe4deb7cd894765.js} +1 -1
- package/assets/esri/core/workers/chunks/f52ed527b46c316eb369.js +1 -0
- package/assets/esri/core/workers/chunks/{140d0c4285c6978103ea.js → f5ce6af342c02a4b0d15.js} +7 -7
- package/assets/esri/core/workers/chunks/{1cbeac3301b6943bb28a.js → fc07d47d44c04f123650.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +4 -0
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +0 -5
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +80 -0
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationList.scss +14 -0
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +41 -0
- package/assets/esri/themes/base/widgets/_FilterBuilder.scss +1 -6
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Bufferer-B-V7yYm-.js +5 -0
- package/chunks/Distance2DCalculator-Coa0qAFt.js +5 -0
- package/chunks/Envelope.js +1 -1
- package/chunks/{GeodeticDistanceCalculator-BsWHOuqE.js → GeodeticDistanceCalculator-D4iQ-_NX.js} +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +2 -4
- package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
- package/chunks/disjointOperator.js +1 -1
- package/chunks/distanceOperator.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/core/sql.js +1 -1
- package/editing/sharedTemplates/SharedTemplate.d.ts +4 -0
- package/editing/sharedTemplates/SharedTemplate.js +1 -1
- package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
- package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferLineToPolygon.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferPointToPolygon.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/editing/sharedTemplates/executor/builders/offsetLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/offsetPrimaryLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtAllVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtBeginningOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtBeginningOfRadial.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtEndOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtInteriorVertices.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtNotBeginningOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtNotEndOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonCentroid.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonNotStart.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonStart.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointPrimaryIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundaryTwoPoint.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonPrimaryIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonVertices.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/twoPointLines.js +1 -1
- package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
- package/editing/sharedTemplates/executor/support/createServiceEdit.js +1 -1
- package/editing/sharedTemplates/executor/support/executorUtils.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/PresetTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/builders/builderUtils.js +1 -1
- package/editing/templateUtils.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/shapePreservingProjectOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/DoubleArray.js +1 -1
- package/geometry/support/UCharArray.js +5 -0
- package/geometry/support/UShortArray.js +5 -0
- package/interfaces.d.ts +117 -67
- package/layers/VectorTileLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/utils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/commonProperties.js +1 -1
- package/layers/support/rasterFunctions/stretchUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/RulesTable.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +3 -3
- package/portal/Portal.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/support/HighlightCounter.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsCorePerformanceInfo.js +1 -1
- package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/textureUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/webgl/Parameters.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
- package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/GroupInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/InputBase.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +5 -0
- package/widgets/Editor/AddAssociationWorkflowData.js +5 -0
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflowData.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +5 -0
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +5 -0
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +5 -0
- package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +5 -0
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch/support/sketchUtils.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.d.ts +2 -2
- package/widgets/support/FilterBuilder/FilterBuilderViewModel.js +1 -1
- package/widgets/support/FilterBuilder.js +1 -1
- package/widgets/support/FilterCondition/FilterConditionViewModel.js +1 -1
- package/widgets/support/FilterCondition.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +5 -0
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
- package/assets/esri/core/workers/chunks/08c4b585290efc98ca5d.js +0 -1
- package/assets/esri/core/workers/chunks/117e7a12af77c761efb5.js +0 -1
- package/assets/esri/core/workers/chunks/324a5547c64a3bae670d.js +0 -1
- package/assets/esri/core/workers/chunks/4be5e453fe54f5631659.js +0 -1
- package/assets/esri/core/workers/chunks/5be7cf1564e756c24066.js +0 -1
- package/assets/esri/core/workers/chunks/6d79ec15d1858839f576.js +0 -1
- package/assets/esri/core/workers/chunks/7966c245a073c85f04b1.js +0 -1
- package/assets/esri/core/workers/chunks/8bd51b5b392dfacc922f.js +0 -1
- package/assets/esri/core/workers/chunks/9c6380af3bc3130658e1.js +0 -1
- package/assets/esri/core/workers/chunks/b18620fc15707e4413a1.js +0 -1
- package/assets/esri/core/workers/chunks/b765670b47d209d7655a.js +0 -2
- package/assets/esri/core/workers/chunks/c249ad935f54d3b49ae3.js +0 -1
- package/assets/esri/core/workers/chunks/c7927c2d5414f19defd5.js +0 -1
- package/assets/esri/core/workers/chunks/d27a199fd8e2ade69254.js +0 -1
- package/assets/esri/core/workers/chunks/f9070edd8e0b2a57af79.js +0 -1
- package/assets/esri/core/workers/chunks/faf9063420262ea40fd8.js +0 -1
- package/chunks/Bufferer-DjC-SKTJ.js +0 -5
- package/chunks/Distance2DCalculator-8-JrFGHH.js +0 -5
- package/editing/sharedTemplates/support/sharedTemplateUtils.js +0 -5
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationSettings.js +0 -5
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.d.ts +0 -4
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import m from"./support/TerminalConfiguration.js";import d from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>m.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((t=>{e.add(t.layerId)})),t?.junctionSources?.map((t=>{e.add(t.layerId)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?m.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new d({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),m=s.get("TONETWORKSOURCEID"),d=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),T=s.get("VIAASSETTYPE"),I=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[m.name],assetGroupId:r.attributes[d.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[T.name],terminalId:r.attributes[I.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const T=f;export{T as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import o from"../layers/FeatureLayer.js";import{queryAllJSON as a}from"../layers/support/featureQueryAll.js";import i from"./Network.js";import n from"./RulesTable.js";import l from"./support/NamedTraceConfiguration.js";import u from"./support/NetworkSystemLayers.js";import d from"./support/TerminalConfiguration.js";import m from"./support/TraceJobInfo.js";import{AssociationTypeEnum as c,RuleType as p}from"./support/typeUtils.js";import y from"../rest/support/Query.js";let f=class extends i{constructor(e){super(e),this.sharedNamedTraceConfigurations=[],this.type="utility",this._terminalById=new Map}get serviceTerritoryFeatureLayerId(){return this.dataElement?.serviceTerritoryFeatureLayerId??null}get networkSystemLayers(){return new u({rulesTableId:this.sourceJSON?.systemLayers.rulesTableId,rulesTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.rulesTableId}`:null,subnetworksTableId:this.sourceJSON?.systemLayers.subnetworksTableId,subnetworksTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.subnetworksTableId}`:null,dirtyAreasLayerId:this.sourceJSON?.systemLayers.dirtyAreasLayerId,dirtyAreasLayerUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.dirtyAreasLayerId}`:null,associationsTableId:this.sourceJSON?.systemLayers.associationsTableId,associationsTableUrl:this.sourceJSON?`${this.featureServiceUrl}/${this.sourceJSON?.systemLayers.associationsTableId}`:null})}get terminalConfigurations(){return this.dataElement?.terminalConfigurations.map((e=>d.fromJSON(e)))||[]}get domainNetworkNames(){return this.dataElement?.domainNetworks.map((e=>e.domainNetworkName))||[]}get _utilityLayerList(){const e=new Set;return this.dataElement?.domainNetworks?.map((t=>{t?.edgeSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)})),t?.junctionSources?.map((({layerId:t,sourceId:r})=>{this._layerIdBySourceId.set(r,t),this._sourceIdByLayerId.set(t,r),e.add(t)}))})),e}async load(e){return this.addResolvingPromise(super.load(e)),this.addResolvingPromise(this._loadNamedTraceConfigurationsFromNetwork(e)),this}getTerminalConfiguration(e){let t=null,r=null;const s=e.layer;let o=null;if("feature"===s?.type){if(o=s.layerId,null===o)return null}else{if("subtype-sublayer"!==s?.type)return null;if(o=s?.parent?.layerId??null,null===o)return null}const a=e.attributes;if(null==a)return null;for(const l of Object.keys(a))"ASSETGROUP"===l.toUpperCase()&&(t=e.getAttribute(l)),"ASSETTYPE"===l.toUpperCase()&&(r=e.getAttribute(l));if(!this.dataElement)return null;let i=null;const n=this.dataElement.domainNetworks;for(const l of n){const e=l.junctionSources?.find((e=>e.layerId===o));if(e){const s=e.assetGroups?.find((e=>e.assetGroupCode===t));if(s){const e=s.assetTypes?.find((e=>e.assetTypeCode===r));if(e&&e.isTerminalConfigurationSupported){i=e.terminalConfigurationId;break}}}}if(null!=i){const e=this.dataElement.terminalConfigurations,t=e?.find((e=>e.terminalConfigurationId===i));return t?d.fromJSON(t):null}return null}getTierNames(e){const t=this.dataElement?.domainNetworks.find((t=>t.domainNetworkName===e));return t?.tiers.map((e=>e.name))||[]}async getRulesTable(){return this._sharedRulesTable||(this._sharedRulesTable=this._createRulesTable()),await this._sharedRulesTable}getTerminalById(e){if(!this.dataElement||null==e)return null;const t=this._terminalById.get(e);return null!=t?t:(this.terminalConfigurations.forEach((e=>{e.terminals.forEach((e=>{this._terminalById.set(e.id,e)}))})),this._terminalById.get(e))}isUtilityLayer(e){return"layerId"in e?this._utilityLayerList.has(e?.layerId)&&(e.url?.startsWith(this.featureServiceUrl)??!1):!("subtype-sublayer"!==e.type||!e.parent)&&(this._utilityLayerList.has(e.parent.layerId)&&(e.parent.url?.startsWith(this.featureServiceUrl)??!1))}async queryAssociations(e,t){const[{queryAssociations:r},{default:s}]=await Promise.all([import("../rest/networks/queryAssociations.js"),import("../rest/networks/support/QueryAssociationsParameters.js")]),o=s.from(e);o.gdbVersion=this.gdbVersion,o.moment=this.historicMoment;return(await r(this.networkServiceUrl,o,t)).associations}async synthesizeAssociationGeometries(e){const[{synthesizeAssociationGeometries:t},{default:r}]=await Promise.all([import("../rest/networks/synthesizeAssociationGeometries.js"),import("../rest/networks/support/SynthesizeAssociationGeometriesParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async trace(e){const[{trace:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);return s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment,t(this.networkServiceUrl,s)}async submitTraceJob(e){const[{submitTraceJob:t},{default:r}]=await Promise.all([import("../rest/networks/trace.js"),import("../rest/networks/support/TraceParameters.js")]),s=r.from(e);s.gdbVersion=this.gdbVersion,s.moment=this.historicMoment;const o=await t(this.networkServiceUrl,s);return new m({statusUrl:o})}async canAddAssociation(e){const t=await this.getRulesTable();if(!t)return!1;await t.load();const r=(e,t)=>e?1===e.terminalId?!t?.terminalId||t?.terminalId===e.terminalId:e.terminalId===t?.terminalId:!t?.terminalId,s=(e,t)=>e.fromNetworkSource?.sourceId===t.fromNetworkElement?.networkSourceId&&e.toNetworkSource?.sourceId===t.toNetworkElement?.networkSourceId&&e.fromAssetGroup?.assetGroupCode===t.fromNetworkElement?.assetGroupCode&&e.fromAssetType?.assetTypeCode===t.fromNetworkElement?.assetTypeCode&&e.toAssetGroup?.assetGroupCode===t.toNetworkElement?.assetGroupCode&&e.toAssetType?.assetTypeCode===t.toNetworkElement?.assetTypeCode&&r(e.fromTerminal,t.fromNetworkElement)&&r(e.toTerminal,t.toNetworkElement);if("containment"===e.associationType){return t.rulesCategorized.containment.some((t=>s(t,e)))}if("attachment"===e.associationType){return t.rulesCategorized.attachment.some((t=>s(t,e)))}return t.rulesCategorized.connectivity.some((t=>t.viaNetworkSource?t.fromNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.viaNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.fromAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.fromAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.viaAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.fromTerminal,e.fromNetworkElement)&&r(t.viaTerminal,e.toNetworkElement)||t.viaNetworkSource?.sourceId===e.fromNetworkElement?.networkSourceId&&t.toNetworkSource?.sourceId===e.toNetworkElement?.networkSourceId&&t.viaAssetGroup?.assetGroupCode===e.fromNetworkElement?.assetGroupCode&&t.viaAssetType?.assetTypeCode===e.fromNetworkElement?.assetTypeCode&&t.toAssetGroup?.assetGroupCode===e.toNetworkElement?.assetGroupCode&&t.toAssetType?.assetTypeCode===e.toNetworkElement?.assetTypeCode&&r(t.viaTerminal,e.fromNetworkElement)&&r(t.toTerminal,e.toNetworkElement):s(t,e)))}generateAddAssociations(e){return{addFeatures:e.map((e=>new t({attributes:{fromnetworksourceid:e.fromNetworkElement?.networkSourceId,fromglobalid:e.fromNetworkElement?.globalId,fromterminalid:e.fromNetworkElement?.terminalId,tonetworksourceid:e.toNetworkElement?.networkSourceId,toglobalid:e.toNetworkElement?.globalId,toterminalid:e.toNetworkElement?.terminalId,associationtype:c[e.associationType],iscontentvisible:null==e.isContentVisible?void 0:e.isContentVisible?1:0,percentalong:e.percentAlong,globalid:e.globalId}}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}generateDeleteAssociations(e){return{deleteFeatures:e.map((e=>({globalId:e.globalId}))),id:this.networkSystemLayers.associationsTableId,identifierFields:{globalIdField:"globalid",objectIdField:"objectid"}}}async _loadNamedTraceConfigurationsFromNetwork(e){if(0===this.sharedNamedTraceConfigurations?.length)return;const t=this.sharedNamedTraceConfigurations.map((e=>e.globalId)),r=await this.queryNamedTraceConfigurations({globalIds:t},e);for(const s of this.sharedNamedTraceConfigurations){const e=r?.find((e=>e.globalId===s.globalId));if(e){const t=e.write({},{origin:"service"});s.read(t,{origin:"service"})}}}async _createRulesTable(){const e=this.networkSystemLayers.rulesTableUrl,t=new o({url:e});await t.load();const r=this.dataElement?.domainNetworks;if(!r)return null;const s=r.flatMap((e=>[...e.edgeSources||[],...e.junctionSources||[]])),a=(await w(t)).map((e=>this._hydrateRuleInfo(t,s,e)));return new n({rulesLayer:t,rules:a})}_hydrateRuleInfo(e,t,r){const s=e.fieldsIndex,o=s.get("RULETYPE"),a=s.get("CREATIONDATE"),i=s.get("FROMNETWORKSOURCEID"),n=s.get("FROMASSETGROUP"),l=s.get("FROMASSETTYPE"),u=s.get("FROMTERMINALID"),d=s.get("TONETWORKSOURCEID"),m=s.get("TOASSETGROUP"),c=s.get("TOASSETTYPE"),y=s.get("TOTERMINALID"),f=s.get("VIANETWORKSOURCEID"),w=s.get("VIAASSETGROUP"),I=s.get("VIAASSETTYPE"),T=s.get("VIATERMINALID"),h=r.attributes[o.name],g=new Date(r.attributes[a.name]),k=[{networkSourceId:r.attributes[i.name],assetGroupId:r.attributes[n.name],assetTypeId:r.attributes[l.name],terminalId:r.attributes[u.name]},{networkSourceId:r.attributes[d.name],assetGroupId:r.attributes[m.name],assetTypeId:r.attributes[c.name],terminalId:r.attributes[y.name]},{networkSourceId:r.attributes[f.name],assetGroupId:r.attributes[w.name],assetTypeId:r.attributes[I.name],terminalId:r.attributes[T.name]}];let b;!function(e){e[e.from=0]="from",e[e.to=1]="to",e[e.via=2]="via"}(b||(b={}));const N={ruleType:h,creationDate:g};for(const S of[b.from,b.to,b.via]){if(h!==p.RTEdgeJunctionEdgeConnectivity&&S===b.via)continue;const e=k[S],r=t.find((t=>t.sourceId===e.networkSourceId)),s=r?.assetGroups.find((t=>t.assetGroupCode===e.assetGroupId)),o=s?.assetTypes.find((t=>t.assetTypeCode===e.assetTypeId)),a=this._getTerminal(o,e);let i="";switch(S){case b.from:i="from";break;case b.to:i="to";break;case b.via:i="via"}N[`${i}NetworkSource`]=r,N[`${i}AssetGroup`]=s,N[`${i}AssetType`]=o,N[`${i}Terminal`]=a?.toJSON()}return N}_getTerminal(e,t){const r=e?.terminalConfigurationId,s=this.terminalConfigurations?.find((e=>e.id===r));return s?.terminals?.find((e=>e.id===t.terminalId))??null}};async function w(e){const t=new y({where:"1=1",outFields:["*"]});return(await a(e,t)).features}e([r({type:[l],json:{origins:{"web-map":{read:{source:"traceConfigurations"},write:{target:"traceConfigurations"}},service:{read:{source:"traceConfigurations"}}},read:!1}})],f.prototype,"sharedNamedTraceConfigurations",void 0),e([r({type:["utility"],readOnly:!0,json:{read:!1,write:!1}})],f.prototype,"type",void 0),e([r({readOnly:!0})],f.prototype,"serviceTerritoryFeatureLayerId",null),e([r({readOnly:!0})],f.prototype,"networkSystemLayers",null),e([r({readOnly:!0})],f.prototype,"terminalConfigurations",null),e([r({readOnly:!0})],f.prototype,"domainNetworkNames",null),f=e([s("esri.networks.UtilityNetwork")],f);const I=f;export{I as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{JSONMap as n}from"../../core/jsonMap.js";var t;!function(n){n[n.RTJunctionJunctionConnectivity=1]="RTJunctionJunctionConnectivity",n[n.RTContainment=2]="RTContainment",n[n.RTAttachment=3]="RTAttachment",n[n.RTJunctionEdgeConnectivity=4]="RTJunctionEdgeConnectivity",n[n.RTEdgeJunctionEdgeConnectivity=5]="RTEdgeJunctionEdgeConnectivity"}(t||(t={}));const o=new n({connected:"connected",upstream:"upstream",downstream:"downstream",shortestPath:"shortest-path",subnetwork:"subnetwork",subnetworkController:"subnetwork-controller",loops:"loops",isolation:"isolation"}),i=new n({junctionJunctionConnectivity:"junction-junction-connectivity",connectivity:"connectivity",attachment:"attachment",containment:"containment",junctionEdgeFromConnectivity:"junction-edge-from-connectivity",junctionEdgeMidspanConnectivity:"junction-edge-midspan-connectivity",junctionEdgeToConnectivity:"junction-edge-to-connectivity"}),e={connectivity:1,"junction-junction-connectivity":1,
|
|
5
|
+
import{JSONMap as n}from"../../core/jsonMap.js";var t;!function(n){n[n.RTJunctionJunctionConnectivity=1]="RTJunctionJunctionConnectivity",n[n.RTContainment=2]="RTContainment",n[n.RTAttachment=3]="RTAttachment",n[n.RTJunctionEdgeConnectivity=4]="RTJunctionEdgeConnectivity",n[n.RTEdgeJunctionEdgeConnectivity=5]="RTEdgeJunctionEdgeConnectivity"}(t||(t={}));const o=new n({connected:"connected",upstream:"upstream",downstream:"downstream",shortestPath:"shortest-path",subnetwork:"subnetwork",subnetworkController:"subnetwork-controller",loops:"loops",isolation:"isolation"}),i=new n({junctionJunctionConnectivity:"junction-junction-connectivity",connectivity:"connectivity",attachment:"attachment",containment:"containment",junctionEdgeFromConnectivity:"junction-edge-from-connectivity",junctionEdgeMidspanConnectivity:"junction-edge-midspan-connectivity",junctionEdgeToConnectivity:"junction-edge-to-connectivity"}),e={connectivity:1,"junction-junction-connectivity":1,containment:2,attachment:3,"junction-edge-from-connectivity":4,"junction-edge-midspan-connectivity":5,"junction-edge-to-connectivity":6},c=new n({normal:"normal",rebuild:"rebuild",forceRebuild:"force-rebuild"});export{e as AssociationTypeEnum,t as RuleType,i as associationTypeKebabDict,o as traceTypeKebabDict,c as validationTypeKebabDict};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.33.0-next.
|
|
3
|
+
"version": "4.33.0-next.20250212",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
29
|
-
"@esri/calcite-components": "
|
|
30
|
-
"@vaadin/grid": "~24.6.
|
|
29
|
+
"@esri/calcite-components": "^3.0.0",
|
|
30
|
+
"@vaadin/grid": "~24.6.4",
|
|
31
31
|
"@zip.js/zip.js": "~2.7.57",
|
|
32
32
|
"luxon": "~3.5.0",
|
|
33
33
|
"marked": "~15.0.6"
|
package/portal/Portal.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import i from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as h,throwIfAbortError as d}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import B from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as G}from"../support/apiKeyUtils.js";var _;let M;const Q={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let U=class extends(i.JSONSupportMixin(a)){static{_=this}static{this.AUTH_MODE_ANONYMOUS="anonymous"}static{this.AUTH_MODE_AUTO="auto"}static{this.AUTH_MODE_IMMEDIATE="immediate"}static{this.AUTH_MODE_NO_PROMPT="no-prompt"}constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.default3DBasemapQuery=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.hasClassificationSchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.recycleBinEnabled=!1,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useDefault3dBasemap=!1,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){C.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get hasAPIKey(){return G(this.url)}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.slice(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=D.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(!this.hasAPIKey&&r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),C.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}async fetchDefault3DBasemap(e){if(!this.useDefault3dBasemap||!this.default3DBasemapQuery||"none"===this.default3DBasemapQuery)return null;const t=new O;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find((e=>"Web Scene"===e.type));return r?new M({portalItem:r}):null}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(h()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t?.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(h()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new B({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(d(t),e)))));return r&&Q[r]?Q[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.hasAPIKey)return this.load().then((()=>{if(!this.user)throw new s("portal:not-authenticated","Unable to authenticate user. Portal.user is missing")}));if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,t){const r=new O;r.query=e||(this.hasAPIKey?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),r.disableExtraQuery=!0;const o=await this.queryGroups(r,t);if(!o.total)return[];const s=o.results[0];r.num=100,r.query='type:"Web Map" -type:"Web Application"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const i=await s.queryItems(r,t);if(!i.total)return[];return i.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s;if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};e([y()],U.prototype,"access",void 0),e([y()],U.prototype,"allSSL",void 0),e([y()],U.prototype,"authMode",void 0),e([y()],U.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],U.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],U.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],U.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],U.prototype,"bingKey",void 0),e([y()],U.prototype,"canListApps",void 0),e([y()],U.prototype,"canListData",void 0),e([y()],U.prototype,"canListPreProvisionedItems",void 0),e([y()],U.prototype,"canProvisionDirectPurchase",void 0),e([y()],U.prototype,"canSearchPublic",void 0),e([y()],U.prototype,"canShareBingPublic",void 0),e([y()],U.prototype,"canSharePublic",void 0),e([y()],U.prototype,"canSignInArcGIS",void 0),e([y()],U.prototype,"canSignInIDP",void 0),e([y()],U.prototype,"colorSetsGroupQuery",void 0),e([y()],U.prototype,"commentsEnabled",void 0),e([y({type:Date})],U.prototype,"created",void 0),e([y()],U.prototype,"credential",void 0),e([y()],U.prototype,"culture",void 0),e([y()],U.prototype,"currentVersion",void 0),e([y()],U.prototype,"customBaseUrl",void 0),e([y()],U.prototype,"default3DBasemapQuery",void 0),e([y()],U.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],U.prototype,"readDefaultBasemap",null),e([y()],U.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],U.prototype,"readDefaultDevBasemap",null),e([y({type:v})],U.prototype,"defaultExtent",void 0),e([y()],U.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],U.prototype,"readDefaultVectorBasemap",null),e([y()],U.prototype,"description",void 0),e([y()],U.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],U.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],U.prototype,"extraQuery",null),e([y()],U.prototype,"featuredGroups",void 0),e([y()],U.prototype,"featuredItemsGroupQuery",void 0),e([y()],U.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],U.prototype,"layoutGroupQuery",void 0),e([y()],U.prototype,"livingAtlasGroupQuery",void 0),e([y({readOnly:!0})],U.prototype,"hasAPIKey",null),e([y()],U.prototype,"hasCategorySchema",void 0),e([y()],U.prototype,"hasClassificationSchema",void 0),e([y()],U.prototype,"helpBase",void 0),e([y()],U.prototype,"helperServices",void 0),e([y()],U.prototype,"helpMap",void 0),e([y()],U.prototype,"homePageFeaturedContent",void 0),e([y()],U.prototype,"homePageFeaturedContentCount",void 0),e([y()],U.prototype,"httpPort",void 0),e([y()],U.prototype,"httpsPort",void 0),e([y()],U.prototype,"id",void 0),e([y()],U.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],U.prototype,"isOrganization",null),e([y()],U.prototype,"isPortal",void 0),e([y()],U.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],U.prototype,"itemPageUrl",null),e([y()],U.prototype,"layerTemplatesGroupQuery",void 0),e([y()],U.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],U.prototype,"modified",void 0),e([y()],U.prototype,"name",void 0),e([y()],U.prototype,"portalHostname",void 0),e([y()],U.prototype,"portalMode",void 0),e([y()],U.prototype,"portalProperties",void 0),e([y()],U.prototype,"region",void 0),e([y()],U.prototype,"recycleBinEnabled",void 0),e([y({readOnly:!0})],U.prototype,"restUrl",null),e([y()],U.prototype,"rotatorPanels",void 0),e([y()],U.prototype,"showHomePageDescription",void 0),e([y()],U.prototype,"sourceJSON",void 0),e([y()],U.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],U.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],U.prototype,"stylesGroupQuery3d",void 0),e([y()],U.prototype,"supportsHostedServices",void 0),e([y()],U.prototype,"symbolSetsGroupQuery",void 0),e([y()],U.prototype,"templatesGroupQuery",void 0),e([y()],U.prototype,"thumbnail",void 0),e([y({readOnly:!0})],U.prototype,"thumbnailUrl",null),e([y()],U.prototype,"units",void 0),e([y()],U.prototype,"url",void 0),e([y()],U.prototype,"urlKey",void 0),e([m("urlKey")],U.prototype,"readUrlKey",null),e([y()],U.prototype,"user",void 0),e([m("user")],U.prototype,"readUser",null),e([y()],U.prototype,"use3dBasemaps",void 0),e([y()],U.prototype,"useDefault3dBasemap",void 0),e([y()],U.prototype,"useStandardizedQuery",void 0),e([y()],U.prototype,"useVectorBasemaps",void 0),e([y()],U.prototype,"vectorBasemapGalleryGroupQuery",void 0),U=_=e([f("esri.portal.Portal")],U);const b=U,C=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{b as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import i from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as h,throwIfAbortError as d}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import B from"./PortalQueryResult.js";import D from"./PortalUser.js";import{isApiKeyApplicable as G}from"../support/apiKeyUtils.js";var _;let M;const Q={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:D})};let U=class extends(i.JSONSupportMixin(a)){static{_=this}static{this.AUTH_MODE_ANONYMOUS="anonymous"}static{this.AUTH_MODE_AUTO="auto"}static{this.AUTH_MODE_IMMEDIATE="immediate"}static{this.AUTH_MODE_NO_PROMPT="no-prompt"}constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.default3DBasemapQuery=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.hasClassificationSchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.recycleBinEnabled=!1,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useDefault3dBasemap=!1,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){C.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get hasAPIKey(){return G(this.url)}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.slice(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=D.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(!this.hasAPIKey&&r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),C.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}async fetchDefault3DBasemap(e){if(!this.useDefault3dBasemap||!this.default3DBasemapQuery||"none"===this.default3DBasemapQuery)return null;const t=new O;t.query=this.default3DBasemapQuery,t.disableExtraQuery=!0;const r=(await this.queryItems(t,e)).results.find((e=>"Web Scene"===e.type));return r?new M({portalItem:r}):null}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(h()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t?.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(h()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new B({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(d(t),e)))));return r&&Q[r]?Q[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.hasAPIKey)return this.load().then((()=>{if(!this.user)throw new s("portal:not-authenticated","Unable to authenticate user. Portal.user is missing")}));if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,t){const r=new O;r.query=e||(this.hasAPIKey?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),r.disableExtraQuery=!0;const o=await this.queryGroups(r,t);if(!o.total)return[];const s=o.results[0];r.num=100,r.query='type:"Web Map" -type:"Web Application"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const i=await s.queryItems(r,t);if(!i.total)return[];return i.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];if(this.hasAPIKey)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s;if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};e([y()],U.prototype,"access",void 0),e([y()],U.prototype,"allSSL",void 0),e([y()],U.prototype,"authMode",void 0),e([y()],U.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],U.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],U.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],U.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],U.prototype,"bingKey",void 0),e([y()],U.prototype,"canListApps",void 0),e([y()],U.prototype,"canListData",void 0),e([y()],U.prototype,"canListPreProvisionedItems",void 0),e([y()],U.prototype,"canProvisionDirectPurchase",void 0),e([y()],U.prototype,"canSearchPublic",void 0),e([y()],U.prototype,"canShareBingPublic",void 0),e([y()],U.prototype,"canSharePublic",void 0),e([y()],U.prototype,"canSignInArcGIS",void 0),e([y()],U.prototype,"canSignInIDP",void 0),e([y()],U.prototype,"colorSetsGroupQuery",void 0),e([y()],U.prototype,"commentsEnabled",void 0),e([y({type:Date})],U.prototype,"created",void 0),e([y()],U.prototype,"credential",void 0),e([y()],U.prototype,"culture",void 0),e([y()],U.prototype,"currentVersion",void 0),e([y()],U.prototype,"customBaseUrl",void 0),e([y()],U.prototype,"default3DBasemapQuery",void 0),e([y()],U.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],U.prototype,"readDefaultBasemap",null),e([y()],U.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],U.prototype,"readDefaultDevBasemap",null),e([y({type:v})],U.prototype,"defaultExtent",void 0),e([y()],U.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],U.prototype,"readDefaultVectorBasemap",null),e([y()],U.prototype,"description",void 0),e([y()],U.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],U.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],U.prototype,"extraQuery",null),e([y()],U.prototype,"featuredGroups",void 0),e([y()],U.prototype,"featuredItemsGroupQuery",void 0),e([y()],U.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],U.prototype,"layoutGroupQuery",void 0),e([y()],U.prototype,"livingAtlasGroupQuery",void 0),e([y({readOnly:!0})],U.prototype,"hasAPIKey",null),e([y()],U.prototype,"hasCategorySchema",void 0),e([y()],U.prototype,"hasClassificationSchema",void 0),e([y()],U.prototype,"helpBase",void 0),e([y()],U.prototype,"helperServices",void 0),e([y()],U.prototype,"helpMap",void 0),e([y()],U.prototype,"homePageFeaturedContent",void 0),e([y()],U.prototype,"homePageFeaturedContentCount",void 0),e([y()],U.prototype,"httpPort",void 0),e([y()],U.prototype,"httpsPort",void 0),e([y()],U.prototype,"id",void 0),e([y()],U.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],U.prototype,"isOrganization",null),e([y()],U.prototype,"isPortal",void 0),e([y()],U.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],U.prototype,"itemPageUrl",null),e([y()],U.prototype,"layerTemplatesGroupQuery",void 0),e([y()],U.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],U.prototype,"modified",void 0),e([y()],U.prototype,"name",void 0),e([y()],U.prototype,"portalHostname",void 0),e([y()],U.prototype,"portalMode",void 0),e([y()],U.prototype,"portalProperties",void 0),e([y()],U.prototype,"region",void 0),e([y()],U.prototype,"recycleBinEnabled",void 0),e([y({readOnly:!0})],U.prototype,"restUrl",null),e([y()],U.prototype,"rotatorPanels",void 0),e([y()],U.prototype,"showHomePageDescription",void 0),e([y()],U.prototype,"sourceJSON",void 0),e([y()],U.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],U.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],U.prototype,"stylesGroupQuery3d",void 0),e([y()],U.prototype,"supportsHostedServices",void 0),e([y()],U.prototype,"symbolSetsGroupQuery",void 0),e([y()],U.prototype,"templatesGroupQuery",void 0),e([y()],U.prototype,"thumbnail",void 0),e([y({readOnly:!0})],U.prototype,"thumbnailUrl",null),e([y()],U.prototype,"units",void 0),e([y()],U.prototype,"url",void 0),e([y()],U.prototype,"urlKey",void 0),e([m("urlKey")],U.prototype,"readUrlKey",null),e([y()],U.prototype,"user",void 0),e([m("user")],U.prototype,"readUser",null),e([y()],U.prototype,"use3dBasemaps",void 0),e([y()],U.prototype,"useDefault3dBasemap",void 0),e([y()],U.prototype,"useStandardizedQuery",void 0),e([y()],U.prototype,"useVectorBasemaps",void 0),e([y()],U.prototype,"vectorBasemapGalleryGroupQuery",void 0),U=_=e([f("esri.portal.Portal")],U);const b=U,C=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{b 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,createStretchLUT as h,computeGammaValues as m,createHistogramEqualizationLUT as f}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as y,tintHillshade as b,calculateHillshadeParams as g}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as S,createHsvMap as k}from"./colorRampUtils.js";import{isUVRendererSupported as x,isColormapSupportedByWebGL as I,isColormapRendererSupported as R,isShadedReliefRendererSupported as C}from"./rasterRendererChecks.js";let L=class extends t{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!v(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(s){return r.getLogger(this).error("symbolize",s.message),t}}simpleStretch(e,t){if(!v(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...t,isRenderer:!0})}catch(s){return r.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup.colormapLut||{};return{colormap:e,colormapOffset:t,isClassBreaks:"classBreaks"===this.rendererJSON.type,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:a}=e,{rendererJSON:o}=this;return"rasterStretch"===o.type?this._generateStretchWebGLParams(t,o,a):"rasterShadedRelief"===o.type?this._generateShadedReliefWebGLParams(o,r,s??void 0):"vectorField"===o.type?this._generateVectorFieldWebGLParams(o):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:a}=r,o=this.rendererJSON,i=["u8","u16","s8","s16"].includes(s);let u,c;const{dra:m}=o,{gamma:f}=this.lookup;if("histogramEqualization"===o.stretchType){const s=m?null:this.lookup?.histogramLut,a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),n=p(e,{...a,gamma:f,isRenderer:!0});c=l(n,{lut:m?a.histogramLut:s,offset:0})}else if(i){if(m){const a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});u=h({pixelType:s,...a,gamma:f,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;u=this.lookup?this.lookup.stretchLut:null}else u=this.lookup?this.lookup.stretchLut:null;if(!u)return e;a>1&&null!=t&&t.length===e?.pixels.length&&u?.lut.length===a&&(u={lut:t.map((e=>u.lut[e])),offset:u.offset}),c=l(e,u)}else{const s=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});c=p(e,{...s,gamma:f,isRenderer:!0})}if(o.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,this.lookup?.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},a=y(e,s);if(!r.colorRamp)return a;let o;if(this._isLUTChanged(!0)){if(!this.bind().success)return a;o=this.lookup?this.lookup.hsvMap:null}else o=this.lookup?this.lookup.hsvMap:null;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return b(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!x(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[a]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):o&&i.push([r.attributes[t.name]].concat(o.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=I(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!R(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=u({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=I(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=S(e.colorRamp,{interpolateAlpha:!0}),r=u({colormap:t}),s=k(r.indexedColormap);this.lookup={rendererJSON:e,colormapLut:r,hsvMap:s}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=null!=t?t.fields.find((e=>"value"===e.name.toLowerCase())):null,a=null!=t?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=t&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===u?i:s<l?null:n.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=I(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||V(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!O(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=m(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>f(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=d(e,{rasterInfo:this.rasterInfo}),r=h({pixelType:l,...t,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}if(n&&!T(n)){const t=S(n,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=u({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL=!0,{success:!0}}_generateStretchWebGLParams(e,t,r){let s=null,a=null;const o=this.lookup?.colormapLut;t.colorRamp&&o&&(s=o.indexedColormap,a=o.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!t.useGamma||!n?.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let h=0;null!=e&&(h=e.getPlaneCount(),2===h&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:m}=this.rasterInfo,f=Math.min(3,r?.length||h||m,m),y=s||i?1:255,b=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?b[d]=6.5+(n[d]-2)**2.5:b[d]=6.5+100*(2-n[d])**4:b[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const g=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[b[0],b[1]??b[0],b[2]??b[0]]:[1,1,1],k=u.map(((e,t)=>u[t]===l[t]?0:(p-c)/(u[t]-l[t])/y));return{bandCount:f,minOutput:c/y,maxOutput:p/y,minCutOff:l,maxCutOff:u,factor:k,useGamma:i,gamma:g,gammaCorrection:S,colormap:s,colormapOffset:a,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){let s=null,a=null;const o=this.lookup?.colormapLut;e.colorRamp&&o&&(s=o.indexedColormap,a=o.offset);const n={...e,isGCS:t,resolution:r},i=g(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:a}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e;let i;const l=this.rasterInfo.statistics?.[0].min??0,u=this.rasterInfo.statistics?.[0].max??50,c=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:u,maxSize:.8*o,minDataValue:l,minSize:.2*o},p=c.minDataValue??l,d=c.maxDataValue??u,h=null!=c.maxSize&&null!=c.minSize?[c.minSize/o,c.maxSize/o]:[.2,.8];if("wind_speed"===t){const e=(h[0]+h[1])/2;h[0]=h[1]=e}const m=null!=p&&null!=d?[p,d]:null;if("classified_arrow"===t)if(null!=p&&null!=d&&null!=c){i=[];const e=(c.maxDataValue-c.minDataValue)/5;for(let t=0;t<6;t++)i.push(c.minDataValue+e*t)}else i=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=a?.find((e=>"rotationInfo"===e.type));return{breakValues:i,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:o,symbolPercentRange:h,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};e([s({json:{write:!0}})],L.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],L.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],L.prototype,"lookup",void 0),e([s()],L.prototype,"canRenderInWebGL",void 0),L=e([a("esri.renderers.support.RasterSymbolizer")],L);const _=L;function O(e){return"percentClip"===e||"histogramEqualization"===e}function V(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function v(e){return c(e)&&0!==e.validPixelCount}function T(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}export{_ as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import o from"../../layers/support/RasterInfo.js";import{colorize as n,remapColor as i,lookupPixels as l,createColormapLUT as u,isValidPixelBlock as c}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as p,getStretchCutoff as d,isStandardU8Histogram as h,createStretchLUT as m,computeGammaValues as f,createHistogramEqualizationLUT as y}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as b,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as k,createHsvMap as x}from"./colorRampUtils.js";import{isUVRendererSupported as I,isColormapSupportedByWebGL as R,isColormapRendererSupported as C,isShadedReliefRendererSupported as L}from"./rasterRendererChecks.js";let _=class extends t{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!T(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands(e.bandIds??[0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,a=s.spatialReference.isGeographic,o={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:a,resolution:o});break}}return r}catch(s){return r.getLogger(this).error("symbolize",s.message),t}}simpleStretch(e,t){if(!T(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),p(e,{...t,isRenderer:!0})}catch(s){return r.getLogger(this).error("symbolize",s.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup.colormapLut||{};return{colormap:e,colormapOffset:t,isClassBreaks:"classBreaks"===this.rendererJSON.type,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:a}=e,{rendererJSON:o}=this;return"rasterStretch"===o.type?this._generateStretchWebGLParams(t,o,a):"rasterShadedRelief"===o.type?this._generateShadedReliefWebGLParams(o,r,s??void 0):"vectorField"===o.type?this._generateVectorFieldWebGLParams(o):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return n(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?n(e,this.lookup.colormapLut):i(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:a}=r,o=this.rendererJSON,i=["u8","u16","s8","s16"].includes(s);let u,c;const{dra:f}=o,{gamma:y}=this.lookup;if("histogramEqualization"===o.stretchType){const s=f?null:this.lookup?.histogramLut,a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),n="u8"===r.pixelType&&!f&&h(r.histograms?.[0])?e:p(e,{...a,gamma:y,isRenderer:!0});c=l(n,{lut:f?a.histogramLut:t?.length?t.map((e=>s[e])):s,offset:0})}else if(i){if(f){const a=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});u=m({pixelType:s,...a,gamma:y,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;u=this.lookup?this.lookup.stretchLut:null}else u=this.lookup?this.lookup.stretchLut:null;if(!u)return e;a>1&&null!=t&&t.length===e?.pixels.length&&u?.lut.length===a&&(u={lut:t.map((e=>u.lut[e])),offset:u.offset}),c=l(e,u)}else{const s=d(o,{rasterInfo:r,pixelBlock:e,bandIds:t});c=p(e,{...s,gamma:y,isRenderer:!0})}if(o.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=n(c,this.lookup?.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},a=g(e,s);if(!r.colorRamp)return a;let o;if(this._isLUTChanged(!0)){if(!this.bind().success)return a;o=this.lookup?this.lookup.hsvMap:null}else o=this.lookup?this.lookup.hsvMap:null;if(!o)return a;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return b(a,e,o,n),a}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,a=e.field1;if(!a)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const o=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!I(this.rasterInfo,a)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[a]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):o&&i.push([r.attributes[t.name]].concat(o.color))}))}else{if("value"!==a.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not available.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):o&&i.push([parseInt(""+e.value,10)].concat(o?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=u({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=R(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!C(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=u({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=R(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!L(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const t=k(e.colorRamp,{interpolateAlpha:!0}),r=u({colormap:t}),s=x(r.indexedColormap);this.lookup={rendererJSON:e,colormapLut:r,hsvMap:s}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=null!=t?t.fields.find((e=>"value"===e.name.toLowerCase())):null,a=null!=t?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,o=null!=s&&null!==a;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||o,tableValueField:s,tableBreakField:a}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:a}=this._analyzeClassBreaks(e),o=e.classBreakInfos;if(!o?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=o.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const c=[];if(null!=t&&null!=s&&null!==a&&s!==a){const r=s.name,o=a.name,i=n[n.length-1],{classMaxValue:u}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[o],a=s===u?i:s<l?null:n.find((({classMaxValue:e})=>e>s));a&&c.push([t].concat(a.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)c.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&c.push([i.classMaxValue].concat(i.symbol.color))}const p=u({colormap:c,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=R(p?.indexedColormap),{success:!0}}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||v(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!V(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:a,useGamma:o,colorRamp:n}=e;let{gamma:i}=e;if(o&&a&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,c=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>y(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(c){const t=d(e,{rasterInfo:this.rasterInfo}),r=m({pixelType:l,...t,gamma:o?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}if(n&&!U(n)){const t=k(n,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=u({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=o&&i?.length?i:null,this.canRenderInWebGL="histogramEqualization"!==t,{success:!0}}_generateStretchWebGLParams(e,t,r){let s=null,a=null;const o=this.lookup?.colormapLut;t.colorRamp&&o&&(s=o.indexedColormap,a=o.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!(!t.useGamma||!n?.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,minOutput:c,maxOutput:p}=d(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let h=0;null!=e&&(h=e.getPlaneCount(),2===h&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:m}=this.rasterInfo,f=Math.min(3,r?.length||h||m,m),y=s||i?1:255,g=new Float32Array(f);if(i&&n)for(let d=0;d<f;d++)n[d]>1?n[d]>2?g[d]=6.5+(n[d]-2)**2.5:g[d]=6.5+100*(2-n[d])**4:g[d]=1;1===l.length&&(l[2]=l[1]=l[0]),1===u.length&&(u[2]=u[1]=u[0]);const b=i&&n?[n[0],n[1]??n[0],n[2]??n[0]]:[1,1,1],S=i?[g[0],g[1]??g[0],g[2]??g[0]]:[1,1,1],k=u.map(((e,t)=>u[t]===l[t]?0:(p-c)/(u[t]-l[t])/y));return{bandCount:f,minOutput:c/y,maxOutput:p/y,minCutOff:l,maxCutOff:u,factor:k,useGamma:i,gamma:b,gammaCorrection:S,colormap:s,colormapOffset:a,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){let s=null,a=null;const o=this.lookup?.colormapLut;e.colorRamp&&o&&(s=o.indexedColormap,a=o.offset);const n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:a}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:a,symbolTileSize:o,flowRepresentation:n}=e;let i;const l=this.rasterInfo.statistics?.[0].min??0,u=this.rasterInfo.statistics?.[0].max??50,c=a?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:u,maxSize:.8*o,minDataValue:l,minSize:.2*o},p=c.minDataValue??l,d=c.maxDataValue??u,h=null!=c.maxSize&&null!=c.minSize?[c.minSize/o,c.maxSize/o]:[.2,.8];if("wind_speed"===t){const e=(h[0]+h[1])/2;h[0]=h[1]=e}const m=null!=p&&null!=d?[p,d]:null;if("classified_arrow"===t)if(null!=p&&null!=d&&null!=c){i=[];const e=(c.maxDataValue-c.minDataValue)/5;for(let t=0;t<6;t++)i.push(c.minDataValue+e*t)}else i=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=a?.find((e=>"rotationInfo"===e.type));return{breakValues:i,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:o,symbolPercentRange:h,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};e([s({json:{write:!0}})],_.prototype,"rendererJSON",void 0),e([s({type:o,json:{write:!0}})],_.prototype,"rasterInfo",void 0),e([s({json:{write:!0}})],_.prototype,"lookup",void 0),e([s()],_.prototype,"canRenderInWebGL",void 0),_=e([a("esri.renderers.support.RasterSymbolizer")],_);const O=_;function V(e){return"percentClip"===e||"histogramEqualization"===e}function v(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}function T(e){return c(e)&&0!==e.validPixelCount}function U(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}export{O as default};
|
package/rest/print.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as i}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{normalize as o,dataComponents as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,getToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as x,getCopyright as I,getSelectionSymbol as D,getContextBoundingBox as v,createPolygonLayer as T,createPolylineLayer as L,createPointLayer as O,createMultipointLayer as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as V}from"./support/reportTemplate.js";const M={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},F=new i({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new i({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),R=new Map;async function U(e,t,i){const a=await J(e,i),r=await A(t,a);if("sync"===await j(e,i)){const{results:t}=await d(e,r,void 0,i);return t?.[0]?.value}const n=await m(e,r,void 0,i);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,i);return o}async function J(e,i){const a=_(e),r=R.get(a)??{gpServerUrl:a,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(a,p({f:"json"},i))).data,r.cimVersion=r.gpMetadata.cimVersion,R.set(a,r),r}async function j(e,t){return he(await J(e,t))}async function k(e,t){return(await J(e,t)).gpMetadata.tasks}async function A(t,i){i=i||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new P;null==a.showLabels&&(a.showLabels=!0);const r=a.exportOptions;let n;const o=h(a.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=a.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:{metricUnit:F.toJSON(e),metricLabel:e?M[e]:void 0,nonMetricUnit:F.toJSON(t),nonMetricLabel:t?M[t]:void 0}}}let c=null;s?.legendLayers&&(c=s.legendLayers.map((e=>{const t=e.layerId;i.legendLayerNameMap[t]=e.title;const a={id:t};return e.subLayerIds&&(a.subLayerIds=e.subLayerIds),a})));const u=await C(t,a,i);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,i=i=>{const a=i.text,r=i.font,n=r?.family?.toLowerCase();a&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(a)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(a)&&(r.family="Arial Unicode MS"))};for(const a of u.operationalLayers)if(a.featureCollection?.layers)for(const e of a.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&i(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&i(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:i.legendLayers.slice()}}),i.legendLayers.length=0,R.set(i.gpServerUrl,i);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:V(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete y.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete y.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function C(e,t,i){const a=e.view;let r=a.spatialReference;const n={operationalLayers:await z(a,t,i)};t.includeTables&&(n.tables=await ne(a));let o=e.extent||i.ssExtent||a.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,a.background&&(n.background=a.background.toJSON()),a.rotation&&(n.mapOptions.rotation=-a.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||a.scale),null!=a.timeExtent){const e=null!=a.timeExtent.start?a.timeExtent.start.getTime():null,t=null!=a.timeExtent.end?a.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function _(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function z(e,t,i){const a=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await ie(e,r,i):S(e)?$(e):"csv"===e?.type?await B(e,r,i):"catalog-footprint"===e?.type?await q(e,r,i):"feature"===e?.type?await W(e,r,i):"geojson"===e?.type?await G(e,r,i):"graphics"===e?.type?await H(e,r,i):"imagery"===e?.type?Q(e,i):"imagery-tile"===e?.type?await X(e,r,i):"kml"===e?.type?await Y(e,r,i):"map-image"===e?.type?Z(e,r,i):"map-notes"===e?.type?await ee(r,i):"open-street-map"===e?.type?te():"stream"===e?.type?await ae(e,r,i):"subtype-group"===e?.type?await re(e,i):"tile"===e?.type?oe(e,i):"vector-tile"===e?.type?await se(e,r,i):"web-tile"===e?.type?le(e):"wfs"===e?.type?await ce(e,r,i):"wms"===e?.type?ue(e,i):"wmts"===e?.type?ye(e):await ie(e,r,i),t&&(Array.isArray(t)?a.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,x(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),a.push(t)))}if(n)for(const s of a)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await K(null,e.graphics,t,i);r&&a.push(r)}return a}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function q(e,{layerView:t,printTemplate:i},a){if(parseFloat(a.cimVersion)<3.1){return K(e,await me(t),i,a)}const r=e.parent,n={id:(o=ge(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return pe(n,r),n}async function B(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const a=t.layerView,r=t.printTemplate;if(!(a.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=ge(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return K(e,await me(a),r,i)}async function K(e,t,i,a){let r;const n=T(),o=L(),s=O(),u=E(),y=O();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=a.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=ge(e,"web-map"),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const a=s.layerDefinition.drawingInfo;a&&(a.labelingInfo=i);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=i)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,o.layerDefinition.fields=i,s.layerDefinition.fields=i,u.layerDefinition.fields=i}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,be(g.symbol)?g.symbol=await fe(g.symbol,a):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter((e=>e.featureSet.features.length>0));for(const l of h){const e=l.featureSet.features.every((e=>e.symbol));if(e&&(!i||!i.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await de(l.layerDefinition.drawingInfo.renderer,a)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function W(e,t,i){let a;const r=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&n<2.9||"pie-chart"===r?.type||"dot-density"===r?.type&&n<2.6)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await me(o);a=await K(e,t,s,i)}else{if(a={id:(p=ge(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},s.attributionVisible&&(a.credits=I(e)),a.showLabels=s.showLabels&&e.labelsVisible,pe(a,e),delete a.layerDefinition?.featureReduction?.disablePopup,delete a.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete a.layerDefinition?.displayFilterInfo,a.layerDefinition?.drawingInfo?.renderer&&(delete a.layerDefinition.minScale,delete a.layerDefinition.maxScale,await de(a.layerDefinition.drawingInfo.renderer,i),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);a.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,a.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(a.layerDefinition??={},a.layerDefinition.definitionExpression=a.layerDefinition.definitionExpression?`(${a.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(a.layerDefinition??={},a.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight?.()&&"getHighlightIds"in o){const t=o;a.selectionObjectIds=t.getHighlightIds(),a.selectionSymbol=D(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return a}async function G(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return K(e,await me(t.layerView),t.printTemplate,i)}async function H(e,{printTemplate:t},i){return K(e,null,t,i)}function Q(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=ge(e)).layerType,customParameters:a.customParameters};var a;return i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition??={},i.layerDefinition.drawingInfo??={},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),pe(i,e),i}async function X(e,t,i){if("flow"===e.renderer?.type)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const a={bandIds:(r=ge(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return a.layerType="ArcGISImageServiceLayer",pe(a,e),a}async function Y(e,t,i){const a=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=ge(e,"web-map");return t.type="kml",delete t.layerType,t.url=o(e.url),t}const r=[],n=t.layerView,s="data:image/png;base64,";n.allVisibleMapImages.forEach(((t,i)=>{const a={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(s)?a.imageData=t.href.slice(s.length):a.url=t.href,r.push(a)}));const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],c={id:e.id,...await K(null,l,a,i)};return r.push(c),r}function Z(e,{printTemplate:t,view:i},a){let r;const n={id:e.id,subLayerIds:[]};let o=[];const s=i.scale,l=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,a=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&a))if(e.sublayers)e.sublayers.forEach(l);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};o.unshift(i),n.subLayerIds.push(e.id)}};var c;return e.sublayers&&e.sublayers.forEach(l),o.length&&(o=o.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),r={layerType:(c=ge(e)).layerType,customParameters:c.customParameters},r.layers=o,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:n.subLayerIds,t.attributionVisible&&(r.credits=I(e)),e.gdbVersion&&(r.gdbVersion=e.gdbVersion),pe(r,e),e.legendEnabled&&a.legendLayers.push(n)),r}async function ee({layerView:e,printTemplate:t},i){const a=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await K(n,n.source,t,i);e&&a.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await K(null,n.graphics,t,i);e&&a.push(...e.featureCollection.layers)}return{featureCollection:{layers:a}}}function te(){return{type:"OpenStreetMap"}}async function ie(e,{printTemplate:t,view:i},r){const n={type:"image"},o={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==i.rotation&&(o.rotation=0);const l=r.ssExtent||i.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&i.state.extent.equals(i.extent)&&(o.area={x:0,y:0,width:i.width,height:i.height},u||(o.area.width-=1),y||(o.area.height-=1),!r.ssExtent)){const e=i.toMap(a(o.area.width,o.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(o);return n.imageData=s(p.dataUrl)?.data,n}async function ae(e,{layerView:t,printTemplate:i},a){e.legendEnabled&&a.legendLayers.push({id:e.id});return K(e,await me(t),i,a)}async function re(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const i={customParameters:(a=ge(e)).customParameters,effect:a.effect,layerDefinition:a.layerDefinition,layerType:a.layerType,layers:a.layers,url:a.url};var a;if(Array.isArray(i.layers))for(const r of i.layers)delete r.popupInfo;return pe(i,e),i}async function ne(e){const t=[],i=[];for(const r of e.map.allTables)"feature"!==r.type||r.loaded||i.push(r.load());i.length&&await Promise.allSettled(i);for(const r of e.map.allTables)if("feature"===r.type&&r.loaded&&r.isTable&&"feature-layer"===r.source?.type){const e={id:(a=ge(r)).id,title:a.title,customParameters:a.customParameters,layerDefinition:{definitionExpression:a.layerDefinition?.definitionExpression},url:a.url};pe(e,r),t.push(e)}var a;return t.length?t:void 0}function oe(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=ge(e)).layerType,customParameters:a.customParameters};var a;return pe(i,e),i}async function se(e,t,i){const a=t.layerView;if(e.serviceUrl&&e.styleUrl&&!a.spriteSourceChanged&&!a.styleChanged){const t=f(e.styleUrl,e.apiKey),a=f(e.serviceUrl,e.apiKey);if(!t&&!a||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=o(e.styleUrl),i.token=t,a!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:a}]),i}}return ie(e,t,i)}function le(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}async function ce(e,t,i){return parseFloat(i.cimVersion)<3.5?ie(e,t,i):(e.legendEnabled&&i.legendLayers.push({id:e.id}),{layerType:(a=ge(e,"web-map")).layerType,layerDefinition:a.layerDefinition,url:a.url,wfsInfo:a.wfsInfo});var a}function ue(e,t){let i;const a=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&a.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),a.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:a}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:a,url:o(e.url),version:e.version}),i}function ye(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function pe(e,t){t.url&&(e.url=o(e.url||t.url),e.token=f(e.url,t.apiKey))}async function fe(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const a=1024;i.canvas.width=a,i.canvas.height=a;const o=i.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const i=v(o);if(!i)return null;o.clearRect(0,0,a,a);const n=r(e.size)/Math.max(i.width,i.height);o.scale(n,n);const c=a/n,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const a=e.outline;o.lineWidth=r(a.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${a.color[0]},${a.color[1]},${a.color[2]},${a.color[3]/255})`,o.stroke(t),i.width+=o.lineWidth,i.height+=o.lineWidth}i.width*=n,i.height*=n;const p=o.getImageData(a/2-i.width/2,a/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,a=(await t(i,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(a,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function de(e,t){const i=e.type;if("simple"===i&&be(e.symbol))e.symbol=await fe(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){be(e.defaultSymbol)&&(e.defaultSymbol=await fe(e.defaultSymbol,t));const a=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(a)for(const e of a)be(e.symbol)&&(e.symbol=await fe(e.symbol,t))}}async function me(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function ge(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function he(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function be(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{U as execute,A as getGpPrintParams,_ as getGpServerUrl,j as getMode,k as getTasks,R as printCacheMap};
|
|
5
|
+
import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as i}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{normalize as o,dataComponents as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,getToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{formatJsonMap as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isBlendLayer as x,getCopyright as I,getSelectionSymbol as D,getContextBoundingBox as v,createPolygonLayer as T,createPolylineLayer as L,createPointLayer as O,createMultipointLayer as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as V}from"./support/reportTemplate.js";const M={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},F=new i({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new i({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),R=new Map;async function U(e,t,i){const a=await J(e,i),r=await A(t,a);if("sync"===await j(e,i)){const{results:t}=await d(e,r,void 0,i);return t?.[0]?.value}const n=await m(e,r,void 0,i);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,i);return o}async function J(e,i){const a=_(e),r=R.get(a)??{gpServerUrl:a,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(a,p({f:"json"},i))).data,r.cimVersion=r.gpMetadata.cimVersion,R.set(a,r),r}async function j(e,t){return he(await J(e,t))}async function k(e,t){return(await J(e,t)).gpMetadata.tasks}async function A(t,i){i=i||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new P;null==a.showLabels&&(a.showLabels=!0);const r=a.exportOptions;let n;const o=h(a.layout);if(r){if(n={dpi:r.dpi},"map_only"===o?.toLowerCase()||""===o){const{width:e,height:t}=r;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=a.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:{metricUnit:F.toJSON(e),metricLabel:e?M[e]:void 0,nonMetricUnit:F.toJSON(t),nonMetricLabel:t?M[t]:void 0}}}let c=null;s?.legendLayers&&(c=s.legendLayers.map((e=>{const t=e.layerId;i.legendLayerNameMap[t]=e.title;const a={id:t};return e.subLayerIds&&(a.subLayerIds=e.subLayerIds),a})));const u=await C(t,a,i);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,i=i=>{const a=i.text,r=i.font,n=r?.family?.toLowerCase();a&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(a)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(a)&&(r.family="Arial Unicode MS"))};for(const a of u.operationalLayers)if(a.featureCollection?.layers)for(const e of a.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&i(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&i(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:i.legendLayers.slice()}}),i.legendLayers.length=0,R.set(i.gpServerUrl,i);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g.toJSON(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:V(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete y.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete y.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function C(e,t,i){const a=e.view;let r=a.spatialReference;const n={operationalLayers:await z(a,t,i)};t.includeTables&&(n.tables=await ne(a));let o=e.extent||i.ssExtent||a.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,a.background&&(n.background=a.background.toJSON()),a.rotation&&(n.mapOptions.rotation=-a.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||a.scale),null!=a.timeExtent){const e=null!=a.timeExtent.start?a.timeExtent.start.getTime():null,t=null!=a.timeExtent.end?a.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function _(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function z(e,t,i){const a=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await ie(e,r,i):S(e)?$(e):"csv"===e?.type?await B(e,r,i):"catalog-footprint"===e?.type?await q(e,r,i):"feature"===e?.type?await W(e,r,i):"geojson"===e?.type?await G(e,r,i):"graphics"===e?.type?await Q(e,r,i):"imagery"===e?.type?H(e,i):"imagery-tile"===e?.type?await X(e,r,i):"kml"===e?.type?await Y(e,r,i):"map-image"===e?.type?Z(e,r,i):"map-notes"===e?.type?await ee(r,i):"open-street-map"===e?.type?te():"stream"===e?.type?await ae(e,r,i):"subtype-group"===e?.type?await re(e,i):"tile"===e?.type?oe(e,i):"vector-tile"===e?.type?await se(e,r,i):"web-tile"===e?.type?le(e):"wfs"===e?.type?await ce(e,r,i):"wms"===e?.type?ue(e,i):"wmts"===e?.type?ye(e):await ie(e,r,i),t&&(Array.isArray(t)?a.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,x(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),a.push(t)))}if(n)for(const s of a)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await K(null,e.graphics,t,i);r&&a.push(r)}return a}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function q(e,{layerView:t,printTemplate:i},a){if(parseFloat(a.cimVersion)<3.1){return K(e,await me(t),i,a)}const r=e.parent,n={id:(o=ge(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return pe(n,r),n}async function B(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const a=t.layerView,r=t.printTemplate;if(!(a.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=ge(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return K(e,await me(a),r,i)}async function K(e,t,i,a){let r;const n=T(),o=L(),s=O(),u=E(),y=O();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=a.legendLayerNameMap[e.id]||e.arcgisProps?.title||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=ge(e,"web-map"),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const a=s.layerDefinition.drawingInfo;a&&(a.labelingInfo=i);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=i)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,o.layerDefinition.fields=i,s.layerDefinition.fields=i,u.layerDefinition.fields=i}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,be(g.symbol)?g.symbol=await fe(g.symbol,a):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter((e=>e.featureSet.features.length>0));for(const l of h){const e=l.featureSet.features.every((e=>e.symbol));if(e&&(!i||!i.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await de(l.layerDefinition.drawingInfo.renderer,a)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function W(e,t,i){let a;const r=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&n<2.9||"pie-chart"===r?.type||"dot-density"===r?.type&&n<2.6)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await me(o);a=await K(e,t,s,i)}else{if(a={id:(p=ge(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},s.attributionVisible&&(a.credits=I(e)),a.showLabels=s.showLabels&&e.labelsVisible,pe(a,e),delete a.layerDefinition?.featureReduction?.disablePopup,delete a.layerDefinition?.featureReduction?.popupInfo,o.displayFilterEnabled||delete a.layerDefinition?.displayFilterInfo,a.layerDefinition?.drawingInfo?.renderer&&(delete a.layerDefinition.minScale,delete a.layerDefinition.maxScale,await de(a.layerDefinition.drawingInfo.renderer,i),"visualVariables"in r&&r.visualVariables?.[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);a.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,a.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(a.layerDefinition??={},a.layerDefinition.definitionExpression=a.layerDefinition.definitionExpression?`(${a.layerDefinition.definitionExpression}) AND (${t})`:t),e.gdbVersion&&(a.layerDefinition??={},a.layerDefinition.gdbVersion=e.gdbVersion),o.hasHighlight&&"highlightIds"in o){const t=o;a.selectionObjectIds=t.highlightIds,a.selectionSymbol=D(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return a}async function G(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return K(e,await me(t.layerView),t.printTemplate,i)}async function Q(e,{printTemplate:t},i){return K(e,null,t,i)}function H(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=ge(e)).layerType,customParameters:a.customParameters};var a;return i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition??={},i.layerDefinition.drawingInfo??={},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),pe(i,e),i}async function X(e,t,i){if("flow"===e.renderer?.type)return ie(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const a={bandIds:(r=ge(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return a.layerType="ArcGISImageServiceLayer",pe(a,e),a}async function Y(e,t,i){const a=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=ge(e,"web-map");return t.type="kml",delete t.layerType,t.url=o(e.url),t}const r=[],n=t.layerView,s="data:image/png;base64,";n.allVisibleMapImages.forEach(((t,i)=>{const a={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};t.href.startsWith(s)?a.imageData=t.href.slice(s.length):a.url=t.href,r.push(a)}));const l=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],c={id:e.id,...await K(null,l,a,i)};return r.push(c),r}function Z(e,{printTemplate:t,view:i},a){let r;const n={id:e.id,subLayerIds:[]};let o=[];const s=i.scale,l=e=>{const t=0===s,i=0===e.minScale||s<=e.minScale,a=0===e.maxScale||s>=e.maxScale;if(e.visible&&(t||i&&a))if(e.sublayers)e.sublayers.forEach(l);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{definitionExpression:t.definitionExpression,drawingInfo:t.drawingInfo,orderBy:t.orderBy,source:t.source}};o.unshift(i),n.subLayerIds.push(e.id)}};var c;return e.sublayers&&e.sublayers.forEach(l),o.length&&(o=o.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),r={layerType:(c=ge(e)).layerType,customParameters:c.customParameters},r.layers=o,r.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:n.subLayerIds,t.attributionVisible&&(r.credits=I(e)),e.gdbVersion&&(r.gdbVersion=e.gdbVersion),pe(r,e),e.legendEnabled&&a.legendLayers.push(n)),r}async function ee({layerView:e,printTemplate:t},i){const a=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await K(n,n.source,t,i);e&&a.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await K(null,n.graphics,t,i);e&&a.push(...e.featureCollection.layers)}return{featureCollection:{layers:a}}}function te(){return{type:"OpenStreetMap"}}async function ie(e,{printTemplate:t,view:i},r){const n={type:"image"},o={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==i.rotation&&(o.rotation=0);const l=r.ssExtent||i.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&i.state.extent.equals(i.extent)&&(o.area={x:0,y:0,width:i.width,height:i.height},u||(o.area.width-=1),y||(o.area.height-=1),!r.ssExtent)){const e=i.toMap(a(o.area.width,o.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(o);return n.imageData=s(p.dataUrl)?.data,n}async function ae(e,{layerView:t,printTemplate:i},a){e.legendEnabled&&a.legendLayers.push({id:e.id});return K(e,await me(t),i,a)}async function re(e,t){if(e.legendEnabled)for(const r of e.sublayers)r.legendEnabled&&t.legendLayers.push({id:r.id});const i={customParameters:(a=ge(e)).customParameters,effect:a.effect,layerDefinition:a.layerDefinition,layerType:a.layerType,layers:a.layers,url:a.url};var a;if(Array.isArray(i.layers))for(const r of i.layers)delete r.popupInfo;return pe(i,e),i}async function ne(e){const t=[],i=[];for(const r of e.map.allTables)"feature"!==r.type||r.loaded||i.push(r.load());i.length&&await Promise.allSettled(i);for(const r of e.map.allTables)if("feature"===r.type&&r.loaded&&r.isTable&&"feature-layer"===r.source?.type){const e={id:(a=ge(r)).id,title:a.title,customParameters:a.customParameters,layerDefinition:{definitionExpression:a.layerDefinition?.definitionExpression},url:a.url};pe(e,r),t.push(e)}var a;return t.length?t:void 0}function oe(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=ge(e)).layerType,customParameters:a.customParameters};var a;return pe(i,e),i}async function se(e,t,i){const a=t.layerView;if(e.serviceUrl&&e.styleUrl&&!a.spriteSourceChanged&&!a.styleChanged){const t=f(e.styleUrl,e.apiKey),a=f(e.serviceUrl,e.apiKey);if(!t&&!a||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=o(e.styleUrl),i.token=t,a!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:a}]),i}}return ie(e,t,i)}function le(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}async function ce(e,t,i){return parseFloat(i.cimVersion)<3.5?ie(e,t,i):(e.legendEnabled&&i.legendLayers.push({id:e.id}),{layerType:(a=ge(e,"web-map")).layerType,layerDefinition:a.layerDefinition,url:a.url,wfsInfo:a.wfsInfo});var a}function ue(e,t){let i;const a=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&a.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),a.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:a}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:a,url:o(e.url),version:e.version}),i}function ye(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function pe(e,t){t.url&&(e.url=o(e.url||t.url),e.token=f(e.url,t.apiKey))}async function fe(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const a=1024;i.canvas.width=a,i.canvas.height=a;const o=i.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const i=v(o);if(!i)return null;o.clearRect(0,0,a,a);const n=r(e.size)/Math.max(i.width,i.height);o.scale(n,n);const c=a/n,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const a=e.outline;o.lineWidth=r(a.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${a.color[0]},${a.color[1]},${a.color[2]},${a.color[3]/255})`,o.stroke(t),i.width+=o.lineWidth,i.height+=o.lineWidth}i.width*=n,i.height*=n;const p=o.getImageData(a/2-i.width/2,a/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,a=(await t(i,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(a,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").slice(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function de(e,t){const i=e.type;if("simple"===i&&be(e.symbol))e.symbol=await fe(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){be(e.defaultSymbol)&&(e.defaultSymbol=await fe(e.defaultSymbol,t));const a=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(a)for(const e of a)be(e.symbol)&&(e.symbol=await fe(e.symbol,t))}}async function me(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function ge(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function he(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function be(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{U as execute,A as getGpPrintParams,_ as getGpServerUrl,j as getMode,k as getTasks,R as printCacheMap};
|
package/support/revision.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const a="20250212",d="6abe58272ad20e4931dc719097d0466046ba3a17";export{a as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,filterFlagsUnit as s,animationUnit as r,gpgpuUnit as a,localTimeOriginUnit as n,visualVariableUnit as u,dataDrivenUnit0 as h,dataDrivenUnit1 as o,dataDrivenUnit2 as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as _}from"./Utils.js";import{TextureWrapMode as p,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b;return t.wrapMode=p.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t.width=this.size,t.height=this.size,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,_=o,p=h*this.size*u,c=(d+_*this.size)*u-p,x=g(this.pixelType),f=new x(a,p*x.BYTES_PER_ELEMENT,c),b=this.size,m=_-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=_(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:p,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,p,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:s},animation:{texture:this._getTexture(t,i.Animation),unit:r},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:a},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:n},visualVariableData:{texture:this._getTexture(t,i.VV),unit:u},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:h},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:o},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:l},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b;e.wrapMode=p.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,e.width=1,e.height=1,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
|
|
5
|
+
import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{AttributeDataType as i,filterFlagsUnit as s,animationUnit as r,gpgpuUnit as a,localTimeOriginUnit as n,visualVariableUnit as u,dataDrivenUnit0 as h,dataDrivenUnit1 as o,dataDrivenUnit2 as l}from"./definitions.js";import{getDisplayIdTexel as d}from"./DisplayId.js";import{getPixelArrayCtor as g,getPixelBytes as _}from"./Utils.js";import{TextureWrapMode as p,TextureSamplingMode as c}from"../../../webgl/enums.js";import{FramebufferObject as x}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const T=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class m{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=g(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b;return t.wrapMode=p.CLAMP_TO_EDGE,t.samplingMode=c.NEAREST,t.dataType=this.pixelType,t.width=this.size,t.height=this.size,t}setData(t,e,i){const s=d(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=d(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,l=h,d=this.size,_=o,p=h*this.size*u,c=(d+_*this.size)*u-p,x=g(this.pixelType),f=new x(a,p*x.BYTES_PER_ELEMENT,c),b=this.size,m=_-l+1;if(m>this.size)return void T().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,l,b,m,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=g(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=_(r),h=new(g(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.getBoundFramebufferObject(),{x:l,y:d,width:p,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(l,d,p,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._locked=!1}get locked(){return this._locked}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map(((t,e)=>null!=t?new m(t,this.size,e):null));else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new m(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,i.FilterFlags,1,e)}setLocalTimeOrigin(t,e){this.setData(t,i.LocalTimeOrigin,0,e)}getLabelMinZoom(t){return this.getData(t,i.FilterFlags,1,255)}getFilterFlags(t){return this.getData(t,i.FilterFlags,0,0)}getVisualVariableData(t,e){return this.getData(t,i.VV,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}update(){if(this._locked)return;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];for(const e of t){const{blockData:t,initArgs:i,sendUpdateEpoch:s,version:r}=e;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=i&&this._initialize(i);const a=this._data;for(let e=0;e<t.length;e++){const i=t[e],s=a[e];null!=s&&null!=i&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${e}] AttributeStoreView.update`,{block:i}),s.update(i))}}}getUniforms(t){return{filterFlags:{texture:this._getTexture(t,i.FilterFlags),unit:s},animation:{texture:this._getTexture(t,i.Animation),unit:r},gpgpu:{texture:this._getTexture(t,i.GPGPU),unit:a},localTimeOrigin:{texture:this._getTexture(t,i.LocalTimeOrigin),unit:n},visualVariableData:{texture:this._getTexture(t,i.VV),unit:u},dataDriven0:{texture:this._getTexture(t,i.DD0),unit:h},dataDriven1:{texture:this._getTexture(t,i.DD1),unit:o},dataDriven2:{texture:this._getTexture(t,i.DD2),unit:l},size:this.size}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b;e.wrapMode=p.CLAMP_TO_EDGE,e.samplingMode=c.NEAREST,e.width=1,e.height=1,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BufferObject as e}from"../../../../webgl/BufferObject.js";import"../../../../webgl/FramebufferObject.js";import"../../../../../core/has.js";import"../../../../webgl/checkWebGLError.js";import{Usage as r}from"../../../../webgl/enums.js";import"../../../../webgl/GLObjectType.js";import"../../../../webgl/Texture.js";import{VertexArrayObject as t}from"../../../../webgl/VertexArrayObject.js";import{dataSizeInBytes as s}from"./definitions.js";class o{constructor(t,s){this._boundPart=null,this.vertexBuffers=new Map,this.indexBuffers=new Map,this.groups=[];for(const o in s.vertex){const{data:i,attributes:n}=s.vertex[o],f=e.createVertex(t,r.STATIC_DRAW,i);this.vertexBuffers.set(o,{buffer:f,attributes:n})}for(const
|
|
5
|
+
import{BufferObject as e}from"../../../../webgl/BufferObject.js";import"../../../../webgl/FramebufferObject.js";import"../../../../../core/has.js";import"../../../../webgl/checkWebGLError.js";import{Usage as r}from"../../../../webgl/enums.js";import"../../../../webgl/GLObjectType.js";import"../../../../webgl/Texture.js";import{VertexArrayObject as t}from"../../../../webgl/VertexArrayObject.js";import{dataSizeInBytes as s}from"./definitions.js";class o{constructor(t,s){this._boundPart=null,this.vertexBuffers=new Map,this.indexBuffers=new Map,this.groups=[];for(const o in s.vertex){const{data:i,attributes:n}=s.vertex[o],f=e.createVertex(t,r.STATIC_DRAW,i);this.vertexBuffers.set(o,{buffer:f,attributes:n})}for(const o in s.index){const{data:i}=s.index[o],n=e.createIndex(t,r.STATIC_DRAW,i);this.indexBuffers.set(o,{buffer:n})}for(const e of s.groups)this.groups.push({...e,vertexArrays:new Map});this.parts=s.parts}bind(e,r,s){this._boundPart=s;const{group:o}=this.parts[this._boundPart],i=this.groups[o];if(!i)throw new Error(`Missing group ${o}.`);let n=i.vertexArrays.get(r.stringHash);if(!n){const s=new Set(r.locations.keys()),o=i.index?this.indexBuffers.get(i.index)?.buffer:null,f=new Map,u=new Map;for(const[e,{buffer:r,attributes:t}]of this.vertexBuffers){const o=t.filter((e=>s.has(e.name)));o.length>0&&(f.set(e,o),u.set(e,r))}n=new t(e,r.locations,f,u,o),i.vertexArrays.set(r.stringHash,n)}e.bindVAO(n)}draw(e){if(null==this._boundPart)throw new Error("Mesh.bind() has not been called.");const{start:r,count:t}=this.parts[this._boundPart],{group:o}=this.parts[this._boundPart],{primitive:i,index:n}=this.groups[o];if(n){const o=this.indexBuffers.get(n);if(!o)throw new Error(`Missing index buffer "${n}".`);const{indexType:f}=o.buffer;if(!f)throw new Error("Buffer type error.");e.drawElements(i,t,f,r*s[f])}else e.drawArrays(i,r,t)}unbind(e){this._boundPart=null,e.bindVAO(null)}destroy(){for(const{vertexArrays:e}of this.groups)for(const[r,t]of e)t.disposeVAOOnly();for(const{buffer:e}of this.vertexBuffers.values())e.dispose();for(const{buffer:e}of this.indexBuffers.values())e.dispose()}}export{o as Mesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{
|
|
5
|
+
import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{resolveDynamicUniforms as s,getFeatureUniforms as r,getSelectionDefines as i,isHittest as o,isHighlight as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TechniqueType as p}from"../TechniqueType.js";import{getAntialiasingControls as m}from"./utils.js";import{GradientStrokeShader as c}from"../shaders/GradientStrokeShader.js";import{FramebufferBit as l,CompareFunction as h,StencilOperation as u}from"../../../../../../webgl/enums.js";class d extends t{constructor(){super(...arguments),this.type=p.GradientStroke,this.shaders={geometry:new c},this.symbologyPlane=e.LINE}_getShaderOptions(e,t,a){const{context:n,painter:p,pixelRatio:c}=e,l=t.instance.getInput();return{shader:this.shaders.geometry,uniforms:{...s(e,t.target,l.uniforms),...r(e,t.target),antialiasingControls:m(c),mosaicInfo:p.textureManager.getMosaicInfo(n,t.textureKey),technique:{isColorPass:a}},defines:{...i(e)},optionalAttributes:l.optionalAttributes,useComputeBuffer:o(e)}}render(e,t){const{painter:s}=e;if(o(e)||a(e)){const r=n(e);return s.setPipelineState(r),s.setShader(this._getShaderOptions(e,t,1)),void s.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(l.DEPTH);const r={color:!1,depth:{write:{zNear:0,zFar:1},test:h.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:h.EQUAL,mask:255,op:{fail:u.KEEP,zFail:u.KEEP,zPass:u.KEEP}}}};s.setShader(this._getShaderOptions(e,t,0)),s.setPipelineState(r),s.submitDraw(e,t);const i={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:h.LEQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:h.EQUAL,mask:255,op:{fail:u.KEEP,zFail:u.KEEP,zPass:u.KEEP}}}};s.setShader(this._getShaderOptions(e,t,1)),s.setPipelineState(i),s.submitDraw(e,t)}}export{d as GradientStrokeTechnique};
|