@arcgis/core 5.2.0-next.164 → 5.2.0-next.165
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/Graphic.d.ts +47 -14
- package/PopupTemplate.js +1 -1
- package/WebScene.d.ts +3 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{97d6ef9e34a43ad2e556.js → 02e10f44edf911832c2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{97b5f4302fb867c829f4.js → 07f7177bfaf9de73bc25.js} +1 -1
- package/assets/esri/core/workers/chunks/{612345f17f5eeb99ea8f.js → 0d9c4c6c571ce26d356b.js} +1 -1
- package/assets/esri/core/workers/chunks/{12a7997a40c77f5c9160.js → 151e5799ede763a03ee2.js} +1 -1
- package/assets/esri/core/workers/chunks/196979cc6a765be3c5cd.js +1 -0
- package/assets/esri/core/workers/chunks/1ab59a97ffa49e9e1659.js +1 -0
- package/assets/esri/core/workers/chunks/{8715661a838361d4211a.js → 1b24a40c0fa197014873.js} +1 -1
- package/assets/esri/core/workers/chunks/{83f29a159b8b5197e76a.js → 266c90d8d56a2da42fcf.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1d989b72203113a06fe.js → 2a36fe3f3f257a779a1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcaf9450642fcef83286.js → 3048e74e6246324ce6fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{95b82cbbe355266c65d7.js → 30af63b3b750142faadb.js} +1 -1
- package/assets/esri/core/workers/chunks/{74137ffec5265628c33b.js → 36c780a9527c75b36725.js} +1 -1
- package/assets/esri/core/workers/chunks/{6a0ec102962d2c7b4368.js → 40d803584eeade4df433.js} +1 -1
- package/assets/esri/core/workers/chunks/{a546ec82ba149e12f7bf.js → 41773d858e212468db88.js} +1 -1
- package/assets/esri/core/workers/chunks/{129e04d24ced77c9bb6d.js → 49b967d89d2841cea675.js} +1 -1
- package/assets/esri/core/workers/chunks/{b59aaf30c7fe2c8d1aaa.js → 4b99b4cf729881e616bc.js} +1 -1
- package/assets/esri/core/workers/chunks/{a09d2e1e2540921e4717.js → 4d3d7ec407ee5cd5f036.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c626f525f3483c03477.js → 548b8f74a6883e364931.js} +1 -1
- package/assets/esri/core/workers/chunks/{25a3bd8bede2d07d3a54.js → 5af8fb4ec2c72697e35b.js} +1 -1
- package/assets/esri/core/workers/chunks/{340256866f524cb069f6.js → 5d2f043ebe1051326c56.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f46acfda693c70abbdd.js → 61552b4b8111a8624d84.js} +1 -1
- package/assets/esri/core/workers/chunks/{e653c81ffb3d818645dd.js → 632fdf1d95ad69109427.js} +1 -1
- package/assets/esri/core/workers/chunks/{434a8ba841a59e0deab9.js → 67e533748435253aaba6.js} +1 -1
- package/assets/esri/core/workers/chunks/69d5f8ef78b9b8b3d33d.js +1 -0
- package/assets/esri/core/workers/chunks/{feb41abc03d677df6f73.js → 6b9961261241fdce0e94.js} +1 -1
- package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +1 -0
- package/assets/esri/core/workers/chunks/{e251921bc5367258c4d2.js → 710b8251a59884aee31e.js} +1 -1
- package/assets/esri/core/workers/chunks/{af349c7bc8ef41a0e1bd.js → 7748c2886d0122b40eeb.js} +1 -1
- package/assets/esri/core/workers/chunks/{8a7b02037151767542f1.js → 7dbf4c7480bf9c72820d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 7dfbc31f3b56728485a4.js} +1 -1
- package/assets/esri/core/workers/chunks/{c19f238b55ff2893f7c2.js → 82a022cc21364c9a8539.js} +1 -1
- package/assets/esri/core/workers/chunks/{5cb26bbaa08114aec5ce.js → 89cc1a5539b82fb46216.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ab57cb1bfd3dc8d3c2a.js → 8b8118ab56cc808b5a71.js} +1 -1
- package/assets/esri/core/workers/chunks/{542e5640ea1b80ef801a.js → 9189dfe19a2a2ccd5173.js} +1 -1
- package/assets/esri/core/workers/chunks/{f74ae0eff3f08978e607.js → 9f358c7b052cdc0ac06f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ee08ae5b73439a1ff666.js → a163c6005aba3378edaa.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec9a2425b4a498054a19.js → a17673e691ced46a90d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{72bd866df89b8d92e247.js → a43b33955aa78a2a8deb.js} +1 -1
- package/assets/esri/core/workers/chunks/{46c5371c7a627537098c.js → a88f346786b04bd194dc.js} +6 -6
- package/assets/esri/core/workers/chunks/{092e311cb7aea92a6a26.js → acb265a22be5e12f38e5.js} +1 -1
- package/assets/esri/core/workers/chunks/{9e8f012a56237fc8285f.js → aea44253c80493ef5755.js} +1 -1
- package/assets/esri/core/workers/chunks/b5b9d42e1f84ee82429c.js +1 -0
- package/assets/esri/core/workers/chunks/c046c4fc934bc6f54c69.js +1 -0
- package/assets/esri/core/workers/chunks/{c72a904e01dc8c17d992.js → c47d095434d09b5f10c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{226f862bbeb33fc7c597.js → c4b7111dcedd9d6e1c2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{81cad8d2f62a5f671c55.js → cb4db5489388559d6bd9.js} +1 -1
- package/assets/esri/core/workers/chunks/{bbd44ac63d2a317d8ed9.js → cc794bb94ebc1cb66024.js} +1 -1
- package/assets/esri/core/workers/chunks/{be308db5b61a7246edfe.js → cc94bf05b235e65291fc.js} +1 -1
- package/assets/esri/core/workers/chunks/d4af9faa5d901274fad2.js +1 -0
- package/assets/esri/core/workers/chunks/{fc5a36e54929e03efa86.js → dba5f44c4e4a3f075df2.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f43e06dcfe56229bb0f.js → debe45e792212682b304.js} +1 -1
- package/assets/esri/core/workers/chunks/{8414ffd937c1099e0bbc.js → e6d10136bc08aef255ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{45fd2b456a6997584ca1.js → f8379cd45f750f28a3d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{709e019885822b1f6f3e.js → f905f1a1aa4c123cbe83.js} +1 -1
- package/assets/esri/core/workers/chunks/{a2fcbc494333376192aa.js → f9c80e9fc349db4873e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{c070d2ddf290b4f92916.js → feb4f8c807bb0dca488f.js} +1 -1
- package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
- package/chunks/GlobalIllumination.glsl.js +15 -30
- package/config.js +1 -1
- package/core/workers/WorkerFallback.js +4 -2
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +4 -2
- package/form/elements/inputs.d.ts +126 -25
- package/form/elements/inputs.js +1 -1
- package/form/elements.d.ts +1 -0
- package/graphic/AnnotationFeatureGraphicOrigin.d.ts +49 -9
- package/graphic/BuildingGraphicOrigin.d.ts +49 -0
- package/graphic/CSVGraphicOrigin.d.ts +42 -9
- package/graphic/CatalogGraphicOrigin.d.ts +42 -9
- package/graphic/DimensionFeatureGraphicOrigin.d.ts +42 -9
- package/graphic/FeatureGraphicOrigin.d.ts +42 -9
- package/graphic/GeoJSONGraphicOrigin.d.ts +42 -9
- package/graphic/GeoRSSGraphicOrigin.d.ts +42 -9
- package/graphic/GraphicOrigin.d.ts +52 -12
- package/graphic/ImageryGraphicOrigin.d.ts +42 -9
- package/graphic/ImageryTileGraphicOrigin.d.ts +42 -9
- package/graphic/KMLGraphicOrigin.d.ts +47 -10
- package/graphic/KnowledgeGraphGraphicOrigin.d.ts +49 -1
- package/graphic/LinkChartGraphicOrigin.d.ts +49 -1
- package/graphic/MapImageGraphicOrigin.d.ts +49 -1
- package/graphic/MapNotesGraphicOrigin.d.ts +48 -1
- package/graphic/OGCFeatureGraphicOrigin.d.ts +42 -9
- package/graphic/OrientedImageryGraphicOrigin.d.ts +42 -9
- package/graphic/ParquetGraphicOrigin.d.ts +42 -9
- package/graphic/PointCloudGraphicOrigin.d.ts +43 -0
- package/graphic/SceneGraphicOrigin.d.ts +43 -0
- package/graphic/SketchGraphicOrigin.d.ts +43 -0
- package/graphic/StreamGraphicOrigin.d.ts +43 -0
- package/graphic/SubtypeGroupGraphicOrigin.d.ts +49 -1
- package/graphic/TileGraphicOrigin.d.ts +49 -1
- package/graphic/VectorTileGraphicOrigin.d.ts +43 -14
- package/graphic/VoxelGraphicOrigin.d.ts +43 -0
- package/graphic/WCSGraphicOrigin.d.ts +43 -0
- package/graphic/WFSGraphicOrigin.d.ts +42 -9
- package/graphic/getGraphicOriginTitle.d.ts +21 -3
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.d.ts +2 -1
- package/layers/ParquetLayer.d.ts +24 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/mixins/ReloadableLayer.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/save/mapImageLayerUtils.js +1 -1
- package/layers/save/mediaLayerUtils.js +1 -1
- package/layers/save/parquetLayerUtils.js +2 -0
- package/layers/save/streamLayerUtils.js +1 -1
- package/layers/support/LabelClass.d.ts +8 -2
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/layersMapping.js +1 -1
- package/package.json +2 -2
- package/popup/content.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/webScene.js +1 -1
- package/tables/elements.d.ts +1 -0
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +5 -5
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/worldSizedRibbonLineIntersectionUtils.js +1 -1
- package/views/selection/SelectionOperation.js +1 -1
- package/views/selection/types.d.ts +43 -3
- package/views/support/layerViewUtils.js +1 -1
- package/views/support/selectionUtils.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +6 -0
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/ItemBase.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +6 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar.d.ts +8 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/1fe24ffcd88280d84fbe.js +0 -1
- package/assets/esri/core/workers/chunks/72071ea5de89720fbe42.js +0 -1
- package/assets/esri/core/workers/chunks/9de5ad77bc37ec142218.js +0 -1
- package/assets/esri/core/workers/chunks/b736046c6b4ede73ea46.js +0 -1
- package/assets/esri/core/workers/chunks/c19cd5a03b6d480fe53b.js +0 -1
- package/assets/esri/core/workers/chunks/d1f98c5249c487eb96f1.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e,scale as t,add as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as a,fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as s,scale as c}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as l}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as u,isDepth as d,is2DGeometryOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import p from"../lib/GLMaterial.js";import{intersectTriangleGeometry as m}from"../lib/RayIntersections.js";import{
|
|
2
|
+
import{set as e,scale as t,add as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as a,fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as s,scale as c}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as l}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as u,isDepth as d,is2DGeometryOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import p from"../lib/GLMaterial.js";import{intersectTriangleGeometry as m}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as h}from"../lib/screenPolygonTriangleIntersections.js";import{assert as g}from"../lib/Util.js";import{applyPolygonOffsetToHit as _,intersectWithPolygonOffset as v}from"./intersectWithPolygonOffset.js";import{TriangleMaterial as y}from"./TriangleMaterial.js";import{VisualVariablePassParameters as b}from"./VisualVariablePassParameters.js";import{writeAttributes as x,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as C,ColorMaterialTechnique as w}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as T}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as E}from"../../../../webscene/support/AlphaCutoff.js";class D extends y{constructor(e){super(e,k),this._configuration=new T,this.supportsEdges=!0,this._pp0=r(0,0,1),this._pp1=r(0,0,0),this.produces=new Map([[2,e=>this._isOpaqueMaterialPass(e)],[3,e=>!this.parameters.shadingEnabled&&this._isOpaqueNoSSAODepthPass(e)],[4,e=>u(e)&&this.transparent&&this.parameters.writeDepth],[5,e=>!this.parameters.shadingEnabled&&d(e)&&this.transparent&&this.parameters.writeDepth],[8,e=>u(e)&&this.transparent&&!this.parameters.writeDepth],[18,e=>f(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.emissionSource=+!!this.emissions}get visible(){return this.parameters.color[3]>=E}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}intersectRay(e,t,n,r,i,a){if(!this.parameters.screenSizeEnabled)return super.intersectRay(e,t,n,r,i,a);this._intersectScreenSizeRay(e,n,r,i,a)}intersectRayDraped(e,t,n,r){if(!this.parameters.screenSizeEnabled)return super.intersectRayDraped(e,t,n,r);this._pp0[0]=this._pp1[0]=n[0],this._pp0[1]=this._pp1[1]=n[1],this._intersectScreenSizeRay(e,t,this._pp0,this._pp1,r)}intersectScreenPolygon(e,t,n,r){return this.parameters.screenSizeEnabled?_(h(e,n,t,r,this._createScreenSizeVertexDisplacement(e,n)),this._configuration,n.camera.eye):super.intersectScreenPolygon(e,t,n,r)}_intersectScreenSizeRay(e,t,n,r,i){m(e,t,n,r,this._createScreenSizeVertexDisplacement(e,t),v(i,this._configuration,n,r))}_createScreenSizeVertexDisplacement(r,i){let a=r.attributes.get(`offset`).data;return{applyToVertex:(r,o,s,c,l)=>{let u=e(j,a[l*3],a[l*3+1],a[l*3+2]);e(r,o,s,c);let d=this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(u)??1);return t(u,u,d),n(r,r,u),r},applyToAabb:e=>{let t=s(e,j);return c(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}}}_isOpaqueMaterialPass(e){return e===10||u(e)&&!this.transparent}_isOpaqueNoSSAODepthPass(e){return d(e)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(e){return new O(e)}createBufferWriter(){return new A(C(this.parameters))}}class O extends p{beginSlot(e){return this.getTechnique(w,e)}}class k extends b{constructor(){super(...arguments),this.color=a,this.shadingTint=o(0,0,0,.25),this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.shadingEnabled=!1,this.screenSizeEnabled=!1,this.screenSizeScale=14,this.useIndexing=!1}}class A{constructor(e){this.layout=e}elementCount(e){return e.get(`position`).indices.length}write(e,t,n,r){if(r==null)return;x(n,this.layout,e,t,r);let i=r.buffer.getField(`offset`,l);if(i&&n.has(`offset`)){let e=n.get(`offset`);g(e.size===3),S(e,t,i,r.offset)}}}const j=i();export{D as ColorMaterial,k as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{exactEquals as e,subtract as t,add as n,set as r,copy as i,normalize as a,length as o,scale as s,dot as c,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as m,setMax as h,getMax as g}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as _,isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{
|
|
2
|
+
import{exactEquals as e,subtract as t,add as n,set as r,copy as i,normalize as a,length as o,scale as s,dot as c,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as d,fromValues as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as m,setMax as h,getMax as g}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as _,isColor as v}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as y}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as S}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as C}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as T,applyPolygonOffsetToHit as E}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as D}from"./internal/MaterialUtil.js";import{getLayout as O,DefaultMaterialPassParameters as k,DefaultMaterialTechnique as A}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as j}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as M}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as N}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class F extends b{constructor(e,t){super(e,L),this.materialType=`default`,this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>_(e)&&!this.transparent],[4,e=>_(e)&&this.transparent]]),this._layout=O(this.parameters),this._configuration=new j(t.spherical)}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){let{layerOpacity:e,colorMixMode:t,opacity:n,externalColor:r}=this.parameters,i=t===`replace`?1:n,a=t===`ignore`||isNaN(r[3])?1:r[3];return e*i*a>=P}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===0&&this._hasEmissiveBase||this.parameters.emissiveSource===1)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this;n.hasNormalTexture=t.hasNormalTexture,n.hasColorTexture=t.hasColorTexture,n.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,n.hasOcclusionTexture=t.hasOcclusionTexture;let{treeRendering:r,doubleSided:i,doubleSidedType:a}=t;n.hasVertexTangents=!r&&t.hasVertexTangents,n.instanced=t.instanced,n.instancedDoublePrecision=t.instancedDoublePrecision,n.hasVVColor=!!t.vvColor,n.hasVVSize=!!t.vvSize,n.hasVerticalOffset=t.verticalOffset!=null,n.hasScreenSizePerspective=t.screenSizePerspective!=null,n.hasSlicePlane=t.hasSlicePlane,n.alphaDiscardMode=t.textureAlphaMode,n.normalType=r?0:t.normalType,n.transparent=this.transparent,n.enableOITOffset=e.enableOITOffset,n.customDepthTest=t.customDepthTest??0,n.hasOccludees=e.hasOccludees,n.cullFace=t.hasSlicePlane?0:t.cullFace,n.hasModelTransformation=!r&&t.modelTransformation!=null,n.hasVertexColors=t.hasVertexColors,n.hasSymbolColors=t.hasSymbolColors,n.doubleSidedMode=r?2:i&&a===`normal`?1:i&&a===`winding-order`?2:0,n.instancedFeatureAttribute=t.instancedFeatureAttribute,n.instancedColor=t.instancedColor,v(e.output)?(n.receiveShadows=t.receiveShadows,n.hasShadowHighlights=N(n,e),n.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&e.ssao!=null,n.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):n.receiveShadows=n.hasShadowHighlights=n.receiveAmbientOcclusion=n.receiveGlobalIllumination=!1,n.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,n.pbrMode=t.usePBR?t.unlit?7:t.isSchematic?2:1:0,n.emissionSource=t.emissionSource,n.offsetBackfaces=!!(this.transparent&&t.offsetTransparentBackfaces),n.snowCover=e.snowCover>0,n.hasColorTextureTransform=!!t.colorTextureTransformMatrix,n.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,n.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,n.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,n.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,n,r,i,a,o){let s=this._getMaterialVerticalOffset(n,r);s!=null&&(i=t(R,i,s),a=t(z,a,s)),o=T(o,this._configuration,i,a),x(e,r,i,a,C(r.verticalOffset),o)}intersectScreenPolygon(e,t,n,r){return E(S(e,n,t,r,this._createScreenPolygonVertexDisplacement(t,n)),this._configuration,n.camera.eye)}createGLMaterial(e){return new I(e)}createBufferWriter(){return new w(this._layout)}get transparent(){let{drivenOpacity:e,opacity:t,externalColor:n,layerOpacity:r,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:s}=this.parameters,c=n[3];return e||t<1&&s!==`replace`||c<1&&s!==`ignore`||r<1||(i!=null||a!=null)&&o!==1&&o!==2&&s!==`replace`}_createScreenPolygonVertexDisplacement(e,t){let r=this._getMaterialVerticalOffset(e,t);return r==null?null:{applyToVertex:(e,t,n,i)=>(e[0]=t+r[0],e[1]=n+r[1],e[2]=i+r[2],e),applyToAabb:e=>(p(e,n(G,m(e,G),r)),h(e,n(G,g(e,G),r)),e)}}_getMaterialVerticalOffset(e,n){if(this.parameters.verticalOffset==null)return null;let u=n.camera;r(H,e[12],e[13],e[14]);let d=null;switch(n.viewingMode){case 1:d=a(V,H);break;case 2:d=i(V,B)}let f=t(U,H,u.eye),p=o(f),m=s(f,f,1/p),h=null;this.parameters.screenSizePerspective&&(h=c(d,m));let g=D(u,p,this.parameters.verticalOffset,h??0,this.parameters.screenSizePerspective,null);return s(d,d,g),l(W,d,n.transform.inverseRotation)}}class I extends y{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});let t=this._material.parameters;this.updateTexture(t.textureId);let n=e.camera.viewInverseTransposeMatrix;return r(t.origin,n[3],n[7],n[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?M:A,e)}}class L extends k{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1,this.unlit=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.emissiveTextureId!=null&&this.emissiveSource===0?3:this.emissiveSource===0?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||this.emissionSource===3||this.hasOcclusionTexture}}const R=d(),z=d(),B=f(0,0,1),V=d(),H=d(),U=d(),W=d(),G=d();export{I as DefaultGLMaterial,F as DefaultMaterial,L as DefaultMaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{offsetPathVertexInfoFrameIndex as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{
|
|
2
|
+
import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{offsetPathVertexInfoFrameIndex as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as _}from"../lib/screenPolygonTriangleIntersections.js";import{assert as v}from"../lib/Util.js";import{applyPolygonOffsetToHit as y}from"./intersectWithPolygonOffset.js";import{getLayout as b,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as C}from"./PathTechnique.js";import{PathTechniqueConfiguration as w}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as T}from"./TriangleMaterial.js";import{writeAttributes as E,writePosition as D,writeBufferVec2 as O,writeBufferInt16 as k,writeBufferFloat16 as A,writeBufferFloat as j,writeColor as M,writeBufferUint8 as N}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as F}from"../../../../webscene/support/AlphaCutoff.js";class I extends T{constructor(e,t){super(e,R),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new w(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,f(e.output)?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=F}intersectRay(e,t,n,r,i,a){g(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return y(_(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new z(b(),x(this.parameters))}createGLMaterial(e){return new L(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class L extends m{beginSlot(e){return this.getTechnique(C,e)}}class R extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class z{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){E(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){v(c.size===1);let{data:e,stride:t,indices:n}=c;for(let r=0;r<n.length;++r){let a=e[t*n[r]];s.set(i.offset+r,h(a,o))}}}_writeTextureBuffer(e,l,u){let d=u.offset,f=u.buffer.getField(`position`,t),m=l.get(`position`);f&&m&&(v(m.size===3),D(m,e,f,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(v(g.size===2),O(g,h,d));let _=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);_&&y&&(v(y.size===2),O(y,_,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(v(x.size===1),k(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(v(C.size===2),O(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(v(T.size===1),A(T,w,d));let E=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);E&&P&&j(P,E,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(v(I.size===2),O(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&j(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&M(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&j(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(v(W.size===1),N(W,U,d)),p()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&M(n,4,e,d)}}}export{R as Parameters,z as PathBufferWriter,I as PathMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as fe,screenPolygonIntersectsBufferedSegment as pe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as me,DrapedHit as he}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ge}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as _e,assert as N}from"../lib/Util.js";import{isImagePattern as ve}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ye}from"./VisualVariablePassParameters.js";import{writeColor as be}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as xe}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Se}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Ce,getTextureBufferLayout as we}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Te}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Ee}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as De}from"../../../../webscene/support/AlphaCutoff.js";class Oe extends de{constructor(e,t){super(e,Ae),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new Ee(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Pe(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Ne(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=De||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>De}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=I(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Me(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!_e(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=G;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Z[0],_[0]-b,_[1]+b,0),l(Z[1],_[0]+b,_[1]+b,0),l(Z[2],_[0]+b,_[1]-b,0),l(Z[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Z[e],Q[e]))return;O(a.eye,Q[0],Q[1],Ue),O(a.eye,Q[1],Q[2],We),O(a.eye,Q[2],Q[3],Ge),O(a.eye,Q[3],Q[0],Ke);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s))){if(k(Ue,L)<0&&k(Ue,R)<0||k(We,L)<0&&k(We,R)<0||k(Ge,L)<0&&k(Ge,R)<0||k(Ke,L)<0&&k(Ke,R)<0)continue;let t=a.projectToRenderScreen(L,K),n=a.projectToRenderScreen(R,q);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=a.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!a.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=a.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!a.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,J),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,L,R,_,a,r,y);if(o>=e*e)continue}x=o,m(ze,L),m(Be,R),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(ze,Be,J),S(e,t,He),W)){u(W,W,e);let n=h(W);f(W,W,1/n),r=n/g(e,t)}i(r,r,W,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c))){let t=xe(L,R,u,a,o,Ve);if(t!=null&&t<d&&(d=t,f=e,m(W,Ve),t===0))break}d<1/0&&i(d,d,W,f)}intersectScreenPolygon(t,n,r,i){let{options:a,camera:o,screenPolygonPrimitiveProcessor:s}=r;if(!a.selectionMode||!t.visible)return null;if(!_e(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let c=t.attributes,l=c.get(`position`).data,u=this._getLineSize(c),d=$,f=d*o.pixelRatio,p=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,l,n,F(this.parameters,c)))for(let[t,n]of s.processLineSegment(Je,L,R)){if(!fe(o,t,n,K,q))continue;let r=S(K,q,J),a=u/2+d;this.parameters.screenSizePerspective&&(_(G,K,q,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(r,t,n,G,o,u,f)/o.pixelRatio)),o.renderToScreen(K,Le),o.renderToScreen(q,Re),pe(i,Le,Re,a)&&(T(S(t,n,He),o.eye,V),p.updateIfCloserFromValues(g(o.eye,V),e,V,null))}return p}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=I(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Me(z,B,this.parameters,e,t))if(pe(r,z,B,o))return new he(n);return null}createBufferWriter(){return new je(Ce(this.parameters),we(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new ke(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Ie,V,i.viewMatrix);let c=h(Ie),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Fe.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Fe.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class ke extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Te,e)}}class Ae extends ye{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return ve(this.stipplePattern)&&this.stippleTexture!=null}}class je{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Pe(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return F(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`),N(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(X,r.data,t,e),t>0&&(w==null?E+=g(Y,X):E=w[t]??E);let n=s+t+1;if(c.setVec(n,X),l.set(n,E),m(Y,X),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,Y),c.getVec(t,X);let d=w?.[i]??E+g(Y,X);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&be(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ie);N(f!=null,`Missing texture buffer index field`),N(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;N(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),P(m,y+_,m,y,_),v=P(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=P(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function P(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function F(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function I(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Me(e,t,n,r,i){let a=r.get(`position`).data,c=F(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Ne(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Pe(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Se+n}}const Fe=new ge,L=b(),R=b(),z=c(),B=c(),V=b(),Ie=b(),H=b(),U=b(),W=b(),G=b(),K=n(),q=n(),Le=r(),Re=r(),ze=b(),Be=b(),Ve=b(),J=D(),He=D(),Y=b(),X=b(),Z=[n(),n(),n(),n()],Q=[b(),b(),b(),b()],Ue=A(),We=A(),Ge=A(),Ke=A(),$=4,qe={getDrapedRibbonLineMaxDistance:I},Je=[b(),b()];export{Ae as Parameters,Oe as RibbonLineMaterial,qe as test};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as fe,screenPolygonIntersectsBufferedSegment as pe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as me,DrapedHit as he}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ge}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as _e,assert as N}from"../lib/Util.js";import{isImagePattern as ve}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ye}from"./VisualVariablePassParameters.js";import{writeColor as be}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as xe,intersectScreenPolygonWithWorldSizedLineSegment as Se}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Ce}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as we,getTextureBufferLayout as Te}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ee}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as De}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";class ke extends de{constructor(e,t){super(e,je),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new De(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Fe(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Pe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Oe||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Oe}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=I(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Ne(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!_e(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=Re;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Y[0],_[0]-b,_[1]+b,0),l(Y[1],_[0]+b,_[1]+b,0),l(Y[2],_[0]+b,_[1]-b,0),l(Y[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Y[e],X[e]))return;O(a.eye,X[0],X[1],Ke),O(a.eye,X[1],X[2],Z),O(a.eye,X[2],X[3],qe),O(a.eye,X[3],X[0],Q);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s))){if(k(Ke,L)<0&&k(Ke,R)<0||k(Z,L)<0&&k(Z,R)<0||k(qe,L)<0&&k(qe,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=a.projectToRenderScreen(L,G),n=a.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=a.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!a.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=a.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!a.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,We),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,L,R,_,a,r,y);if(o>=e*e)continue}x=o,m(Ve,L),m(He,R),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(Ve,He,We),S(e,t,Ge),W)){u(W,W,e);let n=h(W);f(W,W,1/n),r=n/g(e,t)}i(r,r,W,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c))){let t=xe(L,R,u,a,o,Ue);if(t!=null&&t<d&&(d=t,f=e,m(W,Ue),t===0))break}d<1/0&&i(d,d,W,f)}intersectScreenPolygon(t,n,r,i){let{options:a}=r;if(!a.selectionMode||!t.visible)return null;if(!_e(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let o=this._getLineSize(t.attributes);return this.parameters.worldSized?this._intersectWorldSizedPolygon(t,n,r,i,o):this._intersectScreenSizedPolygon(t,n,r,i,o)}_intersectScreenSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o}=n,s=e.attributes,c=s.get(`position`).data,l=$,u=l*a.pixelRatio,d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s)))for(let[t,n]of o.processLineSegment(Ye,L,R)){if(!fe(a,t,n,G,K))continue;let o=S(G,K,We),s=i/2+l;this.parameters.screenSizePerspective&&(_(Re,G,K,.5),s=Math.max(s,this.computeScreenSizePerspectiveWidth(o,t,n,Re,a,i,u)/a.pixelRatio)),a.renderToScreen(G,ze),a.renderToScreen(K,Be),pe(r,ze,Be,s)&&(T(S(t,n,Ge),a.eye,V),d.updateIfCloserFromValues(g(a.eye,V),e,V,null))}return d}_intersectWorldSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o,metersPerRenderUnit:s}=n,{attributes:c}=e,l=c.get(`position`).data,u=i/(2*s),d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c)))for(let[t,n]of o.processLineSegment(Ye,L,R)){T(S(t,n,Ge),a.eye,V);let i=g(a.eye,V);d.valid&&i>=d.distance||Se(t,n,u,a,r)&&d.updateIfCloserFromValues(i,e,V,null)}return d}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=I(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Ne(z,B,this.parameters,e,t))if(pe(r,z,B,o))return new he(n);return null}createBufferWriter(){return new Me(we(this.parameters),Te(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new Ae(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Le,V,i.viewMatrix);let c=h(Le),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Ie.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Ie.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class Ae extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ee,e)}}class je extends ye{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return ve(this.stipplePattern)&&this.stippleTexture!=null}}class Me{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Fe(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return F(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`),N(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(J,r.data,t,e),t>0&&(w==null?E+=g(q,J):E=w[t]??E);let n=s+t+1;if(c.setVec(n,J),l.set(n,E),m(q,J),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,q),c.getVec(t,J);let d=w?.[i]??E+g(q,J);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&be(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ie);N(f!=null,`Missing texture buffer index field`),N(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;N(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),P(m,y+_,m,y,_),v=P(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=P(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function P(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function F(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function I(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Ne(e,t,n,r,i){let a=r.get(`position`).data,c=F(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Pe(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Fe(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Ce+n}}const Ie=new ge,L=b(),R=b(),z=c(),B=c(),V=b(),Le=b(),H=b(),U=b(),W=b(),Re=b(),G=n(),K=n(),ze=r(),Be=r(),Ve=b(),He=b(),Ue=b(),We=D(),Ge=D(),q=b(),J=b(),Y=[n(),n(),n(),n()],X=[b(),b(),b(),b()],Ke=A(),Z=A(),qe=A(),Q=A(),$=4,Je={getDrapedRibbonLineMaxDistance:I},Ye=[b(),b()];export{je as Parameters,ke as RibbonLineMaterial,Je as test};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{Material as e,MaterialParameters as t}from"../lib/Material.js";import{intersectTriangleGeometryPolygon2D as n}from"../lib/PolygonIntersections2D.js";import{intersectTriangleGeometry as r,intersectTriangleGeometry2D as i}from"../lib/RayIntersections.js";import{
|
|
2
|
+
import{Material as e,MaterialParameters as t}from"../lib/Material.js";import{intersectTriangleGeometryPolygon2D as n}from"../lib/PolygonIntersections2D.js";import{intersectTriangleGeometry as r,intersectTriangleGeometry2D as i}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as a,DrapedHit as o}from"../lib/screenPolygonTriangleIntersections.js";import{intersectWithPolygonOffset as s,applyPolygonOffsetToHit as c}from"./intersectWithPolygonOffset.js";class l extends e{updateConfiguration(e){super.updateConfiguration(e),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=e.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersectRay(e,t,n,i,a,o){return o=s(o,this._configuration,i,a),r(e,n,i,a,null,o)}intersectRayDraped(e,t,n,r){return i(n[0],n[1],e,r)}intersectScreenPolygon(e,t,n,r){return c(a(e,n,t,r,null),this._configuration,n.camera.eye)}intersectScreenPolygonDraped(e,t,r,i){let a=n(i,t,e);return a===null?null:new o(a)}}class u extends t{constructor(){super(...arguments),this.polygonOffset=0}}export{l as TriangleMaterial,u as TriangleMaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{fromMat4 as
|
|
2
|
+
import e from"../../../../../core/PooledArray.js";import{fromMat4 as t,transpose as n}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{subtract as i,dot as a,scaleAndAdd as o,set as s,length as c,scale as l,transformMat4 as u,transformMat3 as d,cross as f,squaredLength as p,normalize as m,copy as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _,create as v}from"../../../../../geometry/support/aaBoundingBox.js";import{fromValues as y,clipSlab as b,create as x,getStart as S}from"../../../../../geometry/support/clipRay.js";import{intersectsTransformedAabb as C}from"../../../../../geometry/support/frustumPlanes.js";import{clipClosedNegativeHalfspace as w}from"../../../../../geometry/support/plane.js";import{wrap as T}from"../../../../../geometry/support/ray.js";import{Sphere as E}from"../../../../../geometry/support/sphere.js";import{intersectConvexPolygonWithScreenPolygon as D}from"../../lib/screenPolygonTriangleIntersections.js";function O(e,t,n,r,c,l){y(c,0,1/0,W);for(let r of[0,1,2])if(!b(r,Math.min(e[r],t[r])-n,Math.max(e[r],t[r])+n,W))return null;if(!w(r.frustum[4],W)||!w(r.frustum[5],W))return null;let u=M(e,t,r,L,R,l);if(u===0)return null;i(B,c.origin,e);let d=a(B,l),f=a(c.direction,l),p=P(c.direction,l);if(Math.abs(f)>p){let e=-d/f;return e<W.c0||e>W.c1?null:(o(B,B,c.direction,e),I(a(B,L),a(B,R),u,n*n)?e:null)}if(Math.abs(d)>P(B,l))return null;let m=a(B,L),h=a(B,R),g=a(c.direction,L),_=a(c.direction,R);return s(W.ray.origin,m,h,0),s(W.ray.direction,g,_,0),!b(0,-n,u+n,W)||!b(1,-n,n,W)?null:k(W,u,n)}function k(e,t,n){let r=S(e,B);if(I(r[0],r[1],t,n*n))return e.c0;s(G.center,r[0]<0?0:t,0,0),G.radius=n;let i=e.ray.direction;if(!G.intersectRay(T(r,i),K))return null;let a=Math.abs(i[0])>Math.abs(i[1])?0:1,o=e.c0+(K[a]-r[a])/i[a];return o<=e.c1?o:null}function A(e,t,n,r,i){let a=N(e,t,n,q);if(!C(i.broadPhaseFrustum,a,null)||M(e,t,r,L,R,z)===0)return!1;let[s,c,l,u]=Y;return F(s,e,L,R,-n,-n),F(c,t,L,R,n,-n),F(l,t,L,R,n,n),F(u,e,L,R,-n,n),D(i,Y,r,Z)?(o(s,e,R,-n),o(c,t,R,-n),o(l,t,R,n),o(u,e,R,n),D(i,Y,r,Z)?!0:j(e,-n,L,R,r,i)||j(t,n,L,R,r,i)):!1}function j(e,t,n,r,i,a){let o=Math.abs(t);if(!C(a.broadPhaseFrustum,N(e,e,o,q),null))return!1;X.length=0,h(X.pushNew(),e),F(X.pushNew(),e,n,r,0,o);for(let[i,a]of J)F(X.pushNew(),e,n,r,i*t,a*o);return D(a,X,i,Z)}function M(e,r,a,o,h,g){i(o,r,e);let _=c(o);if(_===0)return 0;l(o,o,1/_);let v=a.viewMatrix;u(V,e,v),t(H,v),d(U,o,H);let y=a.projectionMatrix,b=y[11]*V[2]+y[15],x=y[11]*U[2],S=y[0]*(U[0]*b-V[0]*x),C=y[5]*(U[1]*b-V[1]*x),w=a.fullViewport,T=C*w[3]/(y[0]*w[2]),E=-S*w[2]/(y[5]*w[3]),D=Math.hypot(T,E);if(D===0)return 0;let O=T/D,k=E/D;return s(h,O,k,0),n(H,H),d(h,h,H),f(g,o,h),p(g)===0?0:(m(g,g),f(h,g,o),_)}function N(e,t,n,r){return _(Math.min(e[0],t[0])-n,Math.min(e[1],t[1])-n,Math.min(e[2],t[2])-n,Math.max(e[0],t[0])+n,Math.max(e[1],t[1])+n,Math.max(e[2],t[2])+n,r)}function P(e,t){return 16*2**-52*(Math.abs(e[0]*t[0])+Math.abs(e[1]*t[1])+Math.abs(e[2]*t[2]))}function F(e,t,n,r,i,a){o(e,t,n,i),o(e,e,r,a)}function I(e,t,n,r){let i=e<0?e:e>n?e-n:0;return i*i+t*t<=r}const L=g(),R=g(),z=g(),B=g(),V=g(),H=r(),U=g(),W=x(),G=new E,K=g(),q=v(),J=Array.from({length:3},(e,t)=>{let n=(t+1)*Math.PI/3;return t===2?[0,-1]:[Math.sin(n),Math.cos(n)]}),Y=[g(),g(),g(),g()],X=new e({allocator:e=>e??g()}),Z=new e({allocator:e=>e??g()});export{O as intersectRayWithWorldSizedLineSegment,A as intersectScreenPolygonWithWorldSizedLineSegment};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import{EventedAccessor as r}from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{debounce as s,onAbort as c,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import{on as
|
|
2
|
+
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import{EventedAccessor as r}from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{debounce as s,onAbort as c,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import u from"../../core/ReactiveMap.js";import{on as d}from"../../core/reactiveUtils.js";import{createScreenPoint as f}from"../../core/screenUtils.js";import{property as p,subclass as m}from"../../core/accessorSupport/decorators.js";import h from"../../geometry/Point.js";import g from"../../geometry/Polygon.js";import{isClockwise as _}from"../../geometry/support/coordsUtils.js";import{sketchKeys as v,selectionKeys as y}from"../interactive/keybindings.js";import{getSelectionFromGeometry as b}from"../../widgets/support/Selector2D/selectorUtils.js";import{getSelectionFromScreenSelector as x}from"../../widgets/support/Selector3D/selectorUtils.js";let S=class extends r{constructor(e){super(e),this._completed=!1,this._isConstraintKeyDown=!1,this._processTask=null,this.createTool=`rectangle`,this.effectiveSourceMap=new u,this.mode=null,this.persistSelection=!0,this.returnFeatureTitleFields=!1,this.returnGeometry=!0,this.selection=new n,this.selectionManager=null,this.selectOnComplete=!0,this.sources=null,this.toolName=``,this.type=`add`,this._process=s(async(e,n)=>{let{callback:r,completed:i}=e,a=t(async t=>{let{effectiveSelectionManager:n,effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selection:c,sources:l,view:u}=this;if(!l?.length&&!n.sources.length||!u){c.removeAll();return}let d=u.type===`3d`&&`screenSelector`in e&&e.screenSelector&&l!=null?await x({selector:e.screenSelector,signal:t,sources:l,view:u}):`selector`in e&&e.selector&&l!=null?await b({effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selector:e.selector,signal:t,sources:l,view:u}):[];if(c.removeAll(),c.addMany(d),i&&this.persistSelection)switch(this.effectiveType){case`remove`:n.updateSelection({current:[],added:[],removed:d});break;case`replace`:n.clear(),n.updateSelection({current:d,added:[],removed:[]});break;default:n.updateSelection({current:d,added:[],removed:[]})}r?.()});return c(n,()=>a.abort()),this._processTask=a,a.promise},C),this._onOperationFinish=this._onOperationFinish.bind(this)}async initialize(){await this._setup()}get _defaultMode(){return this.createTool===`polygon`?`click`:`hybrid`}get _selectionArea(){let e=this._tool.coordinates;if(e.length===0)return;let t=f(),n=this.view.spatialReference,r=e=>{t.x=e[0],t.y=e[1];let n=this.view.toMap(t);return[n?.x??0,n?.y??0]};if(e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])){let[t,i]=r(e[0]);return new h({x:t,y:i,spatialReference:n})}let i=e.map(r);return i.length===0?void 0:(_(i)||i.reverse(),new g({spatialReference:n,rings:[i]}))}get _screenSelector(){let e=this._tool.coordinates;if(e.length===0)return;let t=e=>f(e[0],e[1]);return e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])?t(e[0]):e.map(t)}get completed(){return this._completed}get effectiveSelectionManager(){return this.selectionManager??this.view.selectionManager}get effectiveType(){let e=this.type??`add`;if(this._isConstraintKeyDown)switch(e){case`add`:return`remove`;case`remove`:return`add`;case`replace`:return`add`;default:return e}return e}get processingFinalSelection(){return!!(this._processTask&&this._tool?.drawOperation?.isCompleted)}cancel(){this.selection.removeAll(),this._onOperationFinish(!0)}destroy(){this._toolImportController=o(this._toolImportController)}async _setup(){let{createTool:e,view:t}=this;if(await t.whenReady(),this.destroyed||this._toolImportController)return;let n=new AbortController;this._toolImportController=n;let r=await import(`../draw/DrawScreenTool.js`);if(n.signal.aborted)return;let o=Symbol();try{this._tool=new r.DrawScreenTool({view:t,mode:this.mode??this._defaultMode,geometryType:e,cursor:e===`point`?`default`:`crosshair`})}finally{this._toolImportController=null}if(!this._tool){a.getLogger(this).warn(`Unable to import Draw module. SelectionOperation failed to load.`);return}this.selectOnComplete||this.addHandles(this._tool.on([`cursor-update`,`vertex-add`,`vertex-remove`],()=>{this._syncConstraintKeyDown(),l(this._process(this._selectionProcessParams))}),o),this._syncConstraintKeyDown(),this.addHandles([d(()=>t,`key-down`,e=>{if(!e.repeat)switch(this._syncConstraintKeyDown(),e.key){case v.constraint:this._tool.uniformSizeToggled=!0,e.stopPropagation();break;case v.center:this._tool.centeredToggled=!0,e.stopPropagation()}}),d(()=>t,`key-up`,e=>{switch(this._syncConstraintKeyDown(),e.key){case v.constraint:this._tool.uniformSizeToggled=!1,e.stopPropagation();break;case v.center:this._tool.centeredToggled=!1,e.stopPropagation()}}),this.selection.on(`change`,({added:e,removed:t})=>this.emit(`selection-change`,{operationType:this.effectiveType,added:e,removed:t})),this._tool.on(`complete`,async e=>{this._syncConstraintKeyDown(),this.removeHandles(o),e.aborted?this.cancel():(this._tool.cursor=`progress`,await this._process({...this._selectionProcessParams,callback:this._onOperationFinish,completed:!0}))})],o),this.addHandles(i(()=>t.tools.remove(this._tool))),t.addAndActivateTool(this._tool)}_syncConstraintKeyDown(){let{inputManager:e}=this.view;this._isConstraintKeyDown=y.invertType.some(t=>e.isModifierKeyDown(t))}get _selectionProcessParams(){return this.view.type===`3d`?{screenSelector:this._screenSelector}:{selector:this._selectionArea}}_onOperationFinish(e=!1){this.removeAllHandles(),this._processTask?.abort(),this._completed=!0,this.emit(`complete`,{aborted:e,operationType:this.effectiveType,selection:this.selection.toArray(),toolName:this.toolName})}};e([p()],S.prototype,`_completed`,void 0),e([p()],S.prototype,`_defaultMode`,null),e([p()],S.prototype,`_isConstraintKeyDown`,void 0),e([p()],S.prototype,`_processTask`,void 0),e([p()],S.prototype,`_selectionArea`,null),e([p()],S.prototype,`_screenSelector`,null),e([p()],S.prototype,`completed`,null),e([p({constructOnly:!0})],S.prototype,`createTool`,void 0),e([p()],S.prototype,`effectiveSelectionManager`,null),e([p()],S.prototype,`effectiveSourceMap`,void 0),e([p()],S.prototype,`effectiveType`,null),e([p({constructOnly:!0})],S.prototype,`mode`,void 0),e([p()],S.prototype,`persistSelection`,void 0),e([p()],S.prototype,`processingFinalSelection`,null),e([p()],S.prototype,`returnFeatureTitleFields`,void 0),e([p()],S.prototype,`returnGeometry`,void 0),e([p({readOnly:!0})],S.prototype,`selection`,void 0),e([p({constructOnly:!0})],S.prototype,`selectionManager`,void 0),e([p({constructOnly:!0})],S.prototype,`selectOnComplete`,void 0),e([p()],S.prototype,`sources`,void 0),e([p({constructOnly:!0})],S.prototype,`toolName`,void 0),e([p()],S.prototype,`type`,void 0),e([p({constructOnly:!0})],S.prototype,`view`,void 0),S=e([m(`esri.views.selection.SelectionOperation`)],S);const C=100,w=S;export{w as default};
|
|
@@ -14,11 +14,13 @@ import type Polyline from "../../geometry/Polyline.js";
|
|
|
14
14
|
import type GraphicsLayer from "../../layers/GraphicsLayer.js";
|
|
15
15
|
import type KnowledgeGraphLayer from "../../layers/KnowledgeGraphLayer.js";
|
|
16
16
|
import type LinkChartLayer from "../../layers/LinkChartLayer.js";
|
|
17
|
+
import type MapImageLayer from "../../layers/MapImageLayer.js";
|
|
17
18
|
import type MapNotesLayer from "../../layers/MapNotesLayer.js";
|
|
18
19
|
import type SketchLayer from "../../layers/SketchLayer.js";
|
|
19
20
|
import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
|
|
20
21
|
import type Field from "../../layers/support/Field.js";
|
|
21
22
|
import type FieldsIndex from "../../layers/support/FieldsIndex.js";
|
|
23
|
+
import type Sublayer from "../../layers/support/Sublayer.js";
|
|
22
24
|
import type SubtypeSublayer from "../../layers/support/SubtypeSublayer.js";
|
|
23
25
|
import type FeatureSet from "../../rest/support/FeatureSet.js";
|
|
24
26
|
import type Query from "../../rest/support/Query.js";
|
|
@@ -26,7 +28,7 @@ import type View from "../View.js";
|
|
|
26
28
|
import type LinkChartView from "../LinkChartView.js";
|
|
27
29
|
import type FeatureLikeLayerView from "../layers/FeatureLikeLayerView.js";
|
|
28
30
|
import type { LoadableMixin } from "../../core/Loadable.js";
|
|
29
|
-
import type { FeatureTitleOptions } from "../../layers/types.js";
|
|
31
|
+
import type { FeatureTitleOptions, ScaleRange } from "../../layers/types.js";
|
|
30
32
|
import type { RendererUnion } from "../../renderers/types.js";
|
|
31
33
|
import type { RequestOptions } from "../../request/types.js";
|
|
32
34
|
import type { MapViewOrSceneView } from "../MapViewOrSceneView.js";
|
|
@@ -40,14 +42,21 @@ import type { CreateTool } from "../../widgets/Sketch/types.js";
|
|
|
40
42
|
*
|
|
41
43
|
* @since 5.1
|
|
42
44
|
*/
|
|
43
|
-
export type SelectableParentLayerUnion = MapNotesLayer | KnowledgeGraphLayer | LinkChartLayer | SubtypeGroupLayer;
|
|
45
|
+
export type SelectableParentLayerUnion = MapNotesLayer | KnowledgeGraphLayer | LinkChartLayer | MapImageLayer | SketchLayer | SubtypeGroupLayer;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sublayer source types from which selections can be determined.
|
|
49
|
+
*
|
|
50
|
+
* @since 5.2
|
|
51
|
+
*/
|
|
52
|
+
export type SelectableSublayerUnion = Sublayer | SubtypeSublayer;
|
|
44
53
|
|
|
45
54
|
/**
|
|
46
55
|
* Layer source types from which selections can be determined.
|
|
47
56
|
*
|
|
48
57
|
* @since 5.1
|
|
49
58
|
*/
|
|
50
|
-
export type SelectableLayerSourceUnion = SelectableLayer |
|
|
59
|
+
export type SelectableLayerSourceUnion = SelectableLayer | SelectableSublayerUnion | SelectableParentLayerUnion;
|
|
51
60
|
|
|
52
61
|
/**
|
|
53
62
|
* Types of sources from which selections can be determined.
|
|
@@ -145,6 +154,19 @@ export interface SelectableLayerBase extends Accessor, LoadableMixin {
|
|
|
145
154
|
type: SelectableLayerType;
|
|
146
155
|
/** **Optional:** The name of the field used to display features in the layer. */
|
|
147
156
|
displayField?: string | null;
|
|
157
|
+
/**
|
|
158
|
+
* **Optional:** The effective scale range of the selectable layer.
|
|
159
|
+
*
|
|
160
|
+
* @since 5.2
|
|
161
|
+
*/
|
|
162
|
+
effectiveScaleRange?: ScaleRange;
|
|
163
|
+
/**
|
|
164
|
+
* **Optional:** Indicates whether the layer is visible, accounting for potential
|
|
165
|
+
* parent layer visibility.
|
|
166
|
+
*
|
|
167
|
+
* @since 5.2
|
|
168
|
+
*/
|
|
169
|
+
effectiveVisible?: boolean | null;
|
|
148
170
|
/** **Optional:** The fields used to create feature titles. It can be a single field name or an array of field names. */
|
|
149
171
|
featureTitleFields?: string[];
|
|
150
172
|
/** **Optional:** The name of the global ID field in the layer. */
|
|
@@ -237,6 +259,12 @@ export interface SelectableLayerViewBase extends Accessor {
|
|
|
237
259
|
* @since 5.1
|
|
238
260
|
*/
|
|
239
261
|
layer: SelectableLayer;
|
|
262
|
+
/**
|
|
263
|
+
* A reference to the where clause currently applied to the layer view.
|
|
264
|
+
*
|
|
265
|
+
* @since 5.2
|
|
266
|
+
*/
|
|
267
|
+
definitionExpression?: string | null;
|
|
240
268
|
/**
|
|
241
269
|
* Indicates the layer view is currently suspended.
|
|
242
270
|
*
|
|
@@ -249,6 +277,18 @@ export interface SelectableLayerViewBase extends Accessor {
|
|
|
249
277
|
* @since 5.1
|
|
250
278
|
*/
|
|
251
279
|
updating: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Indicates whether the layer view is visible.
|
|
282
|
+
*
|
|
283
|
+
* @since 5.2
|
|
284
|
+
*/
|
|
285
|
+
visible: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Indicates whether the layer view is visible at the current scale.
|
|
288
|
+
*
|
|
289
|
+
* @since 5.2
|
|
290
|
+
*/
|
|
291
|
+
visibleAtCurrentScale: boolean;
|
|
252
292
|
/**
|
|
253
293
|
* A reference to the view associated with the layer view.
|
|
254
294
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import has from"../../core/has.js";function t(e){return e&&typeof e.highlight==`function`}function n(e){return e&&typeof e.maskOccludee==`function`}const r=()=>!has(`disable-feature:layer-based-scale-visibility`);function i(
|
|
2
|
+
import e from"../../core/Error.js";import has from"../../core/has.js";function t(e){return e&&typeof e.highlight==`function`}function n(e){return e&&typeof e.maskOccludee==`function`}const r=()=>!has(`disable-feature:layer-based-scale-visibility`);function i(t,n,r){return new e(`layerview:spatial-reference-incompatible`,`The spatial reference of this ${t} (wkid: ${n??`undefined`}) is incompatible with the spatial reference of the view (wkid: ${r??`undefined`}).`,{})}function a(e){return e.type===`integrated-mesh-3d`||e.type===`integrated-mesh-3dtiles`}export{r as hasLayerBasedScaleVisibility,t as highlightsSupported,a as isIntegratedMeshLayerView,n as occludeesSupported,i as spatialReferenceIncompatibleError};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function
|
|
2
|
+
import{isInEffectiveScaleRange as e}from"../../geometry/support/scaleUtils.js";function t(e){return!!(typeof e==`object`&&e&&`id`in e&&`type`in e)}function n(e){return!!(t(e)&&`on`in e&&e.on)}function r(e){return!!(t(e)&&`graphics`in e&&e.graphics)}function i(e){return!!(t(e)&&`fields`in e&&`fieldsIndex`in e&&`objectIdField`in e&&`createQuery`in e&&e.createQuery&&`queryFeatures`in e&&e.queryFeatures)}function a(e){return i(e)||r(e)}function o(e){return!!(typeof e==`object`&&e&&`layer`in e&&e.layer&&t(e.layer)&&`view`in e)}function s(e){return o(e)&&r(e.layer)}function c(e){return!!(o(e)&&`highlight`in e&&e.highlight)}function l(e){return!!(o(e)&&`createQuery`in e&&e.createQuery&&`queryFeatures`in e&&e.queryFeatures)}function u(e){return l(e)||s(e)}function d(e,t){return!!(typeof e==`object`&&e&&`isTable`in e&&e.isTable||t?.map?.allTables.includes(e))}function f(e,t){return u(e)?m(e)&&p(e.layer,t):!a(e)||p(e,t)}function p(t,n){return t.effectiveVisible!==!1&&e(t.effectiveScaleRange,n?.scale)}function m(e){return e.visible!==!1&&e.visibleAtCurrentScale!==!1}export{a as isSelectableLayer,t as isSelectableLayerBase,n as isSelectableLayerBaseWithEditing,u as isSelectableLayerView,o as isSelectableLayerViewBase,m as isSelectableLayerViewVisible,s as isSelectableLayerViewWithGraphics,c as isSelectableLayerViewWithHighlights,l as isSelectableLayerViewWithObjectIds,p as isSelectableLayerVisible,r as isSelectableLayerWithGraphics,i as isSelectableLayerWithObjectIds,f as isSelectionSourceVisible,d as isTableLayer};
|
package/views/webgl/Texture.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import has from"../../core/has.js";import t from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as i,isAbortError as a}from"../../core/promiseUtils.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{ResourceType as s,CompressedTextureFormat as c}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as u,deriveInternalFormat as d,isTexImageSource as f,is3DTarget as p,validateTexture as m,isCompressedFormat as h,getDimensions as g,isSizedPixelFormat as _,calcMipmapLevels as v}from"./textureUtils.js";import{ValidatedTextureDescriptor as y}from"./ValidatedTextureDescriptor.js";const b=!!has(`esri-tests-disable-gpu-memory-measurements`),x=()=>t.getLogger(`esri/views/webgl/Texture`);class S{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(t,n=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,`context`in t)this._descriptor=t,r=n;else{let r=y.validate(t,n);if(!r)throw new e(`texture:invalid-descriptor`,`Texture descriptor invalid`);this._descriptor=r}this._descriptor.target===34067?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(s.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(t,n){let r=this._descriptor;if(r.width!==t||r.height!==n){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-resize`,`Immutable textures can't be resized!`);r.width=t,r.height=n,this._descriptor.target===34067?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!u(e)&&this._descriptor.internalFormat&&r(c,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!u(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,n,r,i,a,o,s=0){o||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update uninitialized texture!`);let c=this._descriptor;c.internalFormat=d(c);let{context:l,pixelFormat:p,dataType:m,target:h,isImmutable:g}=c;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);let _=l.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES,!0);(n<0||r<0||n+i>c.width||r+a>c.height)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:v}=l;s&&((!i||!a)&&x().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),v.pixelStorei(v.UNPACK_SKIP_ROWS,s)),f(o)?v.texSubImage2D(h,t,n,r,i,a,p,m,o):u(o)?v.compressedTexSubImage2D(h,t,n,r,i,a,c.internalFormat,o.levels[t]):v.texSubImage2D(h,t,n,r,i,a,p,m,o),s&&v.pixelStorei(v.UNPACK_SKIP_ROWS,0),l.bindTexture(_,S.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,n,r,i,a,o,s,c){c||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update an uninitialized texture!`);let l=this._descriptor;l.internalFormat=d(l);let{context:f,pixelFormat:m,dataType:h,isImmutable:g,target:_}=l;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);p(_)||x().warn(`Attempting to set 3D texture data on a non-3D texture`);let v=f.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),(n<0||r<0||i<0||n+a>l.width||r+o>l.height||i+s>l.depth)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:y}=f;if(u(c))c=c.levels[t],y.compressedTexSubImage3D(_,t,n,r,i,a,o,s,l.internalFormat,c);else{let e=c;y.texSubImage3D(_,t,n,r,i,a,o,s,m,h,e)}f.bindTexture(v,S.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let t=this._descriptor;if(t.width===0||t.height===0)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot add mipmaps to immutable texture after allocation`);t.hasMipmap=!0,this._samplingModeDirty=!0,m(t)}t.samplingMode===9729?(this._samplingModeDirty=!0,t.samplingMode=9985):t.samplingMode===9728&&(this._samplingModeDirty=!0,t.samplingMode=9984);let n=this._descriptor.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(n,S.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let t=this._descriptor;if(t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot delete mipmaps to immutable texture after allocation`);t.hasMipmap=!1,this._samplingModeDirty=!0,m(t)}t.samplingMode===9985?(this._samplingModeDirty=!0,t.samplingMode=9729):t.samplingMode===9984&&(this._samplingModeDirty=!0,t.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,m(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),m(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=n(this._compressionAbortController)}_setData(t,n){let r=this._descriptor,i=r.context?.gl;if(!i)return;o(i),this.hasWebGLTextureObject||(this._glName=i.createTexture(),r.context.instanceCounter.increment(s.Texture,this)),m(r);let a=r.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(i);let c=n??r.target,l=p(c);if(f(t))this._setDataFromTexImageSource(t,c);else{let{width:n,height:a,depth:s}=r;if(n==null||a==null)throw new e(`texture:missing-size`,`Width and height must be specified!`);if(l&&s==null)throw new e(`texture:missing-depth`,`Depth must be specified!`);if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(c,r.internalFormat,r.hasMipmap,n,a,s),u(t)){if(!h(r.internalFormat))throw new e(`texture:format-mismatch`,`Attempting to use compressed data with an uncompressed format!`);this._setDataFromCompressedSource(t,r.internalFormat,c)}else this._texImage(c,0,r.internalFormat,n,a,s,t),o(i),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),o(i),r.context.bindTexture(a,S.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:n,preMultiplyAlpha:r}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!r)}_setDataFromTexImageSource(e,t){let{gl:n}=this._descriptor.context,r=this._descriptor;r.internalFormat=d(r);let i=p(t),{width:a,height:s,depth:c}=g(e);r.width&&r.height,r.width||=a,r.height||=s,i&&r.depth,i&&(r.depth=c),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,r.internalFormat,r.hasMipmap,a,s,c),this._texImage(t,0,r.internalFormat,a,s,c,e),o(n),r.hasMipmap&&(this.generateMipmap(),o(n))}_setDataFromCompressedSource(e,t,n){let r=this._descriptor,{width:i,height:a,depth:o}=r,s=e.levels,c=v(n,i,a,o),l=Math.min(c,s.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((e,r,i,a)=>{let o=s[Math.min(e,s.length-1)];this._compressedTexImage(n,e,t,r,i,a,o)},l)}_texStorage(t,n,r,i,a,o){let{gl:s}=this._descriptor.context;if(!_(n)&&!h(n))throw new e(`texture:missing-format`,`Immutable textures must have a sized or compressed internal format`);if(!this._descriptor.isImmutable)return;let c=r?v(t,i,a,o):1;if(p(t)){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);s.texStorage3D(t,c,n,i,a,o)}else s.texStorage2D(t,c,n,i,a);this._wasImmutablyAllocated=!0}_texImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t),{isImmutable:u,pixelFormat:d,dataType:f}=this._descriptor;if(u){if(s!=null){let r=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texSubImage3D(t,n,0,0,0,i,a,o,d,f,r)}else c.texSubImage2D(t,n,0,0,i,a,d,f,r)}}else{let u=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texImage3D(t,n,r,i,a,o,0,d,f,u)}else c.texImage2D(t,n,r,i,a,0,d,f,u)}}_compressedTexImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t);if(this._descriptor.isImmutable){if(s!=null){if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexSubImage3D(t,n,0,0,0,i,a,o,r,s)}else c.compressedTexSubImage2D(t,n,0,0,i,a,r,s)}}else if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexImage3D(t,n,r,i,a,o,0,s)}else c.compressedTexImage2D(t,n,r,i,a,0,s)}async _compressOnWorker(e){let{width:t,height:n,context:r,flipped:o,preMultiplyAlpha:s,hasMipmap:c,compress:l}=this._descriptor;if(!l)return;let{compressionTracker:u,compressionCallback:d,preserveSourceBitmap:f}=l,{compressedTextureETC:p,compressedTextureS3TC:m}=r.capabilities;if(!S.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!p&&!m)return;this.abortCompression();let h=new AbortController;this._compressionAbortController=h,u?.increment();let g,_=!1,v=!1;try{e instanceof ImageBitmap?f?(g=await createImageBitmap(e),i(h),v=!0):g=e:e instanceof Uint8Array?(g=e.buffer,_=this.descriptor.flipped):(g=await createImageBitmap(e,{imageOrientation:o?`flipY`:`none`}),i(h),v=!0);let r={data:g,width:t,height:n,needsFlip:_,components:this._descriptor.pixelFormat===6408?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:c,hasETC:!!p,hasS3TC:!!m},a=await S.compressionWorkerHandle.invoke(r,h.signal,1);if(i(h),a.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),d?.(e-this.usedMemory)}}catch(e){a(e)||x().error(`Texture compression failed!`)}finally{u?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),v&&g instanceof ImageBitmap&&g.close()}}_forEachMipmapLevel(t,n=1/0){let{width:r,height:i,depth:a,hasMipmap:o,target:s}=this._descriptor,c=s===32879;if(r==null||i==null||c&&a==null)throw new e(`texture:missing-size`,`Missing texture dimensions for mipmap calculation`);for(let e=0;t(e,r,i,a),!(!o||r===1&&i===1&&(!c||a===1)||e>=n);++e)r=Math.max(1,r>>1),i=Math.max(1,i>>1),c&&(a=Math.max(1,a>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,n=e.samplingMode,r=e.samplingMode;n===9985||n===9987?(n=9729,e.hasMipmap||(r=9729)):(n===9984||n===9986)&&(n=9728,e.hasMipmap||(r=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,n),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;typeof e.wrapMode==`number`?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,n=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,n),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),o(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}export{S as default};
|
|
2
|
+
import e from"../../core/Error.js";import has from"../../core/has.js";import t from"../../core/Logger.js";import{abortMaybe as n}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as i,isAbortError as a}from"../../core/promiseUtils.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{ResourceType as s,CompressedTextureFormat as c}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as u,deriveInternalFormat as d,isTexImageSource as f,is3DTarget as p,validateTexture as m,isCompressedFormat as h,getDimensions as g,isSizedPixelFormat as _,calcMipmapLevels as v}from"./textureUtils.js";import{ValidatedTextureDescriptor as y}from"./ValidatedTextureDescriptor.js";const b=!!has(`esri-tests-disable-gpu-memory-measurements`),x=()=>t.getLogger(`esri/views/webgl/Texture`);class S{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(t,n=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,`context`in t)this._descriptor=t,r=n;else{let r=y.validate(t,n);if(!r)throw new e(`texture:invalid-descriptor`,`Texture descriptor invalid`);this._descriptor=r}this._descriptor.target===34067?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return b?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(s.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(t,n){let r=this._descriptor;if(r.width!==t||r.height!==n){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-resize`,`Immutable textures can't be resized!`);r.width=t,r.height=n,this._descriptor.target===34067?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!u(e)&&this._descriptor.internalFormat&&r(c,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!u(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,n,r,i,a,o,s=0){o||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update uninitialized texture!`);let c=this._descriptor;c.internalFormat=d(c);let{context:l,pixelFormat:p,dataType:m,target:h,isImmutable:g}=c;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);let _=l.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES,!0);(n<0||r<0||n+i>c.width||r+a>c.height)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:v}=l;s&&((!i||!a)&&x().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),v.pixelStorei(v.UNPACK_SKIP_ROWS,s)),f(o)?v.texSubImage2D(h,t,n,r,i,a,p,m,o):u(o)?v.compressedTexSubImage2D(h,t,n,r,i,a,c.internalFormat,o.levels[t]):v.texSubImage2D(h,t,n,r,i,a,p,m,o),s&&v.pixelStorei(v.UNPACK_SKIP_ROWS,0),l.bindTexture(_,S.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,n,r,i,a,o,s,c){c||x().error(`An attempt to use uninitialized data!`),this.hasWebGLTextureObject||x().error(`An attempt to update an uninitialized texture!`);let l=this._descriptor;l.internalFormat=d(l);let{context:f,pixelFormat:m,dataType:h,isImmutable:g,target:_}=l;if(g&&!this._wasImmutablyAllocated)throw new e(`texture:uninitialized`,`Cannot update immutable texture before allocation!`);p(_)||x().warn(`Attempting to set 3D texture data on a non-3D texture`);let v=f.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),(n<0||r<0||i<0||n+a>l.width||r+o>l.height||i+s>l.depth)&&x().error(`An attempt to update out of bounds of the texture!`),this._configurePixelStorage();let{gl:y}=f;if(u(c))c=c.levels[t],y.compressedTexSubImage3D(_,t,n,r,i,a,o,s,l.internalFormat,c);else{let e=c;y.texSubImage3D(_,t,n,r,i,a,o,s,m,h,e)}f.bindTexture(v,S.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let t=this._descriptor;if(t.width===0||t.height===0)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot add mipmaps to immutable texture after allocation`);t.hasMipmap=!0,this._samplingModeDirty=!0,m(t)}t.samplingMode===9729?(this._samplingModeDirty=!0,t.samplingMode=9985):t.samplingMode===9728&&(this._samplingModeDirty=!0,t.samplingMode=9984);let n=this._descriptor.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(n,S.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let t=this._descriptor;if(t.hasMipmap){if(this._wasImmutablyAllocated)throw new e(`texture:immutable-change`,`Cannot delete mipmaps to immutable texture after allocation`);t.hasMipmap=!1,this._samplingModeDirty=!0,m(t)}t.samplingMode===9985?(this._samplingModeDirty=!0,t.samplingMode=9729):t.samplingMode===9984&&(this._samplingModeDirty=!0,t.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,m(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),m(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=n(this._compressionAbortController)}_setData(t,n){let r=this._descriptor,i=r.context?.gl;if(!i)return;o(i),this.hasWebGLTextureObject||(this._glName=i.createTexture(),r.context.instanceCounter.increment(s.Texture,this)),m(r);let a=r.context.bindTexture(this,S.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(S.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(i);let c=n??r.target,l=p(c);if(f(t))this._setDataFromTexImageSource(t,c);else{let{width:n,height:a,depth:s}=r;if(n==null||a==null)throw new e(`texture:missing-size`,`Width and height must be specified!`);if(l&&s==null)throw new e(`texture:missing-depth`,`Depth must be specified!`);if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(c,r.internalFormat,r.hasMipmap,n,a,s),u(t)){if(!h(r.internalFormat))throw new e(`texture:format-mismatch`,`Attempting to use compressed data with an uncompressed format!`);this._setDataFromCompressedSource(t,r.internalFormat,c)}else this._texImage(c,0,r.internalFormat,n,a,s,t),o(i),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),o(i),r.context.bindTexture(a,S.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:n,preMultiplyAlpha:r}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!n),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!r)}_setDataFromTexImageSource(e,t){let{gl:n}=this._descriptor.context,r=this._descriptor;r.internalFormat=d(r);let i=p(t),{width:a,height:s,depth:c}=g(e);r.width&&r.height,r.width||=a,r.height||=s,i&&r.depth,i&&(r.depth=c),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,r.internalFormat,r.hasMipmap,a,s,c),this._texImage(t,0,r.internalFormat,a,s,c,e),o(n),r.hasMipmap&&(this.generateMipmap(),o(n))}_setDataFromCompressedSource(e,t,n){let r=this._descriptor,{width:i,height:a,depth:o}=r,s=e.levels,c=v(n,i,a,o),l=Math.min(c,s.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((e,r,i,a)=>{let o=s[Math.min(e,s.length-1)];this._compressedTexImage(n,e,t,r,i,a,o)},l)}_texStorage(t,n,r,i,a,o){let{gl:s}=this._descriptor.context;if(!_(n)&&!h(n))throw new e(`texture:missing-format`,`Immutable textures must have a sized or compressed internal format`);if(!this._descriptor.isImmutable)return;let c=r?v(t,i,a,o):1;if(p(t)){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);s.texStorage3D(t,c,n,i,a,o)}else s.texStorage2D(t,c,n,i,a);this._wasImmutablyAllocated=!0}_texImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t),{isImmutable:u,pixelFormat:d,dataType:f}=this._descriptor;if(u){if(s!=null){let r=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texSubImage3D(t,n,0,0,0,i,a,o,d,f,r)}else c.texSubImage2D(t,n,0,0,i,a,d,f,r)}}else{let u=s;if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.texImage3D(t,n,r,i,a,o,0,d,f,u)}else c.texImage2D(t,n,r,i,a,0,d,f,u)}}_compressedTexImage(t,n,r,i,a,o,s){let c=this._descriptor.context.gl,l=p(t);if(this._descriptor.isImmutable){if(s!=null){if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexSubImage3D(t,n,0,0,0,i,a,o,r,s)}else c.compressedTexSubImage2D(t,n,0,0,i,a,r,s)}}else if(l){if(o==null)throw new e(`texture:missing-depth`,`Missing depth dimension for 3D texture upload`);c.compressedTexImage3D(t,n,r,i,a,o,0,s)}else c.compressedTexImage2D(t,n,r,i,a,0,s)}async _compressOnWorker(e){let{width:t,height:n,context:r,flipped:o,preMultiplyAlpha:s,hasMipmap:c,compress:l}=this._descriptor;if(!l)return;let{compressionTracker:u,compressionCallback:d,preserveSourceBitmap:f}=l,{compressedTextureETC:p,compressedTextureS3TC:m}=r.capabilities;if(!S.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!p&&!m)return;this.abortCompression();let h=new AbortController;this._compressionAbortController=h,u?.increment();let g,_=!1,v=!1;try{e instanceof ImageBitmap?f?(g=await createImageBitmap(e),i(h),v=!0):g=e:e instanceof Uint8Array?(g=e.buffer,_=this.descriptor.flipped):(g=await createImageBitmap(e,{imageOrientation:o?`flipY`:`none`}),i(h),v=!0);let r={data:g,width:t,height:n,needsFlip:_,components:this._descriptor.pixelFormat===6408?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:c,hasETC:!!p,hasS3TC:!!m},a=await S.compressionWorkerHandle.invoke(r,h.signal,1);if(i(h),a.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=a.internalFormat,this._setData(a.compressedTexture),d?.(e-this.usedMemory)}}catch(e){a(e)||x().error(`Texture compression failed!`)}finally{u?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),v&&g instanceof ImageBitmap&&g.close()}}_forEachMipmapLevel(t,n=1/0){let{width:r,height:i,depth:a,hasMipmap:o,target:s}=this._descriptor,c=s===32879;if(r==null||i==null||c&&a==null)throw new e(`texture:missing-size`,`Missing texture dimensions for mipmap calculation`);for(let e=0;t(e,r,i,a),!(!o||r===1&&i===1&&(!c||a===1)||e>=n);++e)r=Math.max(1,r>>1),i=Math.max(1,i>>1),c&&(a=Math.max(1,a>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,n=e.samplingMode,r=e.samplingMode;n===9985||n===9987?(n=9729,e.hasMipmap||(r=9729)):(n===9984||n===9986)&&(n=9728,e.hasMipmap||(r=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,n),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r),e.maxMipLevel!=null&&t.texParameteri(e.target,t.TEXTURE_MAX_LEVEL,e.maxMipLevel)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;typeof e.wrapMode==`number`?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,n=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,n),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),o(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as i}from"../../core/urlUtils.js";import{updateOrigins as a}from"../../core/accessorSupport/originUtils.js";import o from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as s}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as c}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as l,isFeatureCollectionLayer as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as ee}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as p,
|
|
2
|
+
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as i}from"../../core/urlUtils.js";import{updateOrigins as a}from"../../core/accessorSupport/originUtils.js";import o from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as s}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as c}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as l,isFeatureCollectionLayer as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as ee}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as p,typeKeyword as m,addTypeKeyword as te,toggleTypeKeyword as h,hasTypeKeyword as g}from"../../portal/support/portalItemUtils.js";import{project as ne}from"../../rest/geometryService/project.js";import _ from"../../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as v,isDeveloperBasemapLayer as y}from"../../support/basemapUtils.js";import{saveResources as b}from"./resourceUtils.js";import{beforeSave as x,evaluateWriteErrors as S,hasCharts as re}from"./saveUtils.js";import{hasWebDocumentAsPrimaryContent as C,hasWebDocumentAsResource as w}from"./utils.js";const T=[`NatGeo_World_Map`,`Ocean_Basemap`,`USA_Topo_Maps`,`World_Imagery`,`World_Street_Map`,`World_Terrain_Base`,`World_Topo_Map`,`World_Hillshade`,`Canvas/World_Light_Gray_Base`,`Canvas/World_Light_Gray_Reference`,`Canvas/World_Dark_Gray_Base`,`Canvas/World_Dark_Gray_Reference`,`Ocean/World_Ocean_Base`,`Ocean/World_Ocean_Reference`,`Reference/World_Boundaries_and_Places`,`Reference/World_Reference_Overlay`,`Reference/World_Transportation`].map(e=>e.toLowerCase());async function E(e,t,r){r??={},k(e,t),await n(()=>!t.updatingFromView),await t.load(),await M(t),await x(t),await j(e,t);let i=t.portalItem,{json:a,jsonContext:o}=await D(t,i,e.origin,t.portalItemResourcePath);return S(o,{errorName:`${e.name}:save`},r),await N(t,i),await ue(e,t,i,a,o),await Promise.all([C(i)?t.updateItemThumbnail():null,b(t.resourceReferences,o)]),i}async function D(e,t,n,r){let i=w(t),a=i&&t.id===e.portalItem?.id&&r!==e.portalItemResourcePath,o=ee(t,n,{withResources:!0,forceNewItemContext:a});o.portalItemResourcePath=i?r:null;let s=e.write({},o);return await Promise.all(o.resources.pendingOperations),{json:s,jsonContext:o}}async function O(e,t,r,i){i??={};let a=t.portalItem,o=await ie(e,t,r,i);await n(()=>!t.updatingFromView),await t.load(),await M(t),await x(t),await j(e,t);let{json:s,jsonContext:c}=await D(t,o,e.origin,i.portalItemResourcePath);S(c,{errorName:`${e.name}:save`},i),await V(t,o);let l,u=C(o);return u&&(l=t.getThumbnailState()),await Y(e,t,o,s,c,i)&&(t.resourceReferences.portalItem=o),l&&t.restoreThumbnailFromState(l),await Promise.all([u?t.updateItemThumbnail(a):null,b(t.resourceReferences,c)]),o}function k(t,n){if(!n.portalItem)throw new e(`${t.name}:portal-item-not-set`,`Portal item to save to has not been set on the WebMap`);A(t,n.portalItem)}function A(t,n){let r=n.type,i=t.supportedItemTypes;if(!r||!i.has(r))throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have one of these types: '${Array.from(i).join(`', '`)}'`)}async function j(t,n){if(t.name!==`linkchart`&&!n.basemap?.baseLayers.length)throw new e(`${t.name}:save`,`Map does not have a valid basemap with a base layer.`)}async function ie(t,n,r,i){let a=f.from(r);a.id&&await a.load();let{portalItemResourcePath:o}=i,{name:s,primaryItemType:c}=t;if(w(a)){if(!o)throw new e(`${s}:missing-portal-item-resource-path`,`'portalItemResourcePath' is required to save a map to '${a.type}' item`);if(o===n.portalItemResourcePath&&a.id===n.portalItem?.id)throw new e(`${s}:invalid-portal-item-resource-path`,`Target 'portalItemResourcePath' should be different from '${s}.portalItemResourcePath'`);return a}if(o)throw new e(`${s}:portal-item-resource-path-not-supported`,`'portalItemResourcePath' is not supported when saving a map to '${c}' item`);return a.id&&(a=a.clone(),a.id=null),a.type||(a.type=c),a.portal||(a.portal=d.getDefault()),A(t,a),a}function M(e){let t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then(()=>{})}async function N(e,t){w(t)||(t.extent=await q(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await H(e,t))}const P=m.JSAPI,F=`CollectorDisabled`,I=`OfflineDisabled`,L=`Workforce Project`,R=`Workforce Worker`,z=`Workforce Dispatcher`,B=m.DEVELOPER_BASEMAP;async function V(e,t){w(t)||(p(t,F),p(t,`FieldMapsDisabled`),p(t,m.METADATA),p(t,I),p(t,`Offline Map Areas`),p(t,z),p(t,L),p(t,R),await N(e,t))}async function H(e,t){te(t,P),await U(e),h(t,`Collector`,!g(t,F)&&!g(t,L)&&!g(t,R)&&!g(t,z)&&G(e)),h(t,`Data Editing`,G(e)),h(t,`Offline`,!g(t,I)&&K(e)),h(t,B,v(e.basemap)),h(t,`UtilityNetwork`,!!e.utilityNetworks?.length),h(t,`ParcelFabric`,!!e.parcelFabric),h(t,`IPS`,!!e.ipsInfo),h(t,m.CHARTS,re(e)),t.typeKeywords&&=t.typeKeywords.filter((e,t,n)=>n.indexOf(e)===t)}function U(e){let t=W(e).map(e=>e.load()).toArray();return Promise.allSettled(t).then(()=>{})}function W(e){return e.allLayers.concat(e.allTables)}function G(e){return W(e).some(e=>e.loaded&&l(e)&&e.capabilities.operations.supportsEditing&&`editingEnabled`in e&&e.editingEnabled&&(e.type!==`subtype-group`||e.sublayers.some(e=>e.editingEnabled)))}function K(e){return W(e).filter(e=>e.type!==`group`).every(t=>t.loaded&&oe(e,t))}async function q(e,t){let n=t.clone().normalize(),r;if(n.length>1)for(let e of n)r?e.width>r.width&&(r=e):r=e;else r=n[0];return J(e,r)}async function J(e,t){let n=t.spatialReference;if(n.isWGS84)return t.clone();if(n.isWebMercator)return s(t);let{getGeometryServiceURL:r}=await import(`../../portal/support/geometryServiceUtils.js`),i=await r(e),a=new _({geometries:[t],outSpatialReference:o.WGS84});return(await ne(i,a))[0]}function ae(e){return u(e)||e.type===`map-notes`||e.type===`route`||e.type===`sketch`}function oe(e,t){return l(t)&&t.capabilities.operations.supportsSync||ae(t)&&!t.portalItem||se(t)&&!ce(t)&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function se(e){return e.type===`imagery-tile`?e.supportsExportMapTiles():(e.type===`tile`||e.type===`vector-tile`)&&(e.capabilities.operations.supportsExportTiles||le(e)||y(e))}function ce(e){return e.type===`vector-tile`&&Object.keys(e.sourceNameToSource).length>1}function le(e){return e.type===`tile`&&c(e.url)&&T.some(t=>e.url?.toLowerCase().includes(`/`+t+`/`))}async function ue(e,t,n,r,i){C(n)?await n.update({data:r}):(await n.portal.signIn(),await n.resourceFromPath(t.portalItemResourcePath).update($(r))),Q(e,t,n,r,i)}async function Y(t,n,r,i,a,o){let s=n.portalItem,c={item:s,authenticated:!!(s?.id&&s.portal.user)},l=r.portal;await l.signIn();let{copyAllowed:u,itemReloaded:d}=await X(c,l);if(c.authenticated||=d,!u)throw new e(`${t.name}:save-as-copy-not-allowed`,`Owner of this map does not allow others to save a copy`);let f=!1;if(C(r))f=await Z(r,c,i,o);else{let e=r.resourceFromPath(o.portalItemResourcePath);await r.addResource(e,$(i))}return n.portalItem=r,n.portalItemResourcePath=o.portalItemResourcePath,Q(t,n,r,i,a),f}async function X(e,t){let{item:n,authenticated:r}=e;return n&&C(n)&&n.id&&n.typeKeywords?.includes(`useOnly`)?n.portal.portalHostname===t.portalHostname?(r||await n.reload(),{copyAllowed:n.itemControl===`admin`||n.itemControl===`update`,itemReloaded:!0}):{copyAllowed:!1,itemReloaded:!1}:{copyAllowed:!0,itemReloaded:!1}}async function Z(e,t,n,i){let a=e.portal,{item:o}=t,{folder:s,copyAllResources:c}=i,l=!1;if(c&&o?.id&&o.type===e.type&&r(o.portal.url,a.url)&&parseInt(o.portal.currentVersion,10)>=2023){let{total:e}=await o.fetchResources();l=!!e}if(l){let t=await o.copy({copyResources:`all`,folder:s});e.id=t.id,e.portal=t.portal;let r=e.toJSON();await e.load(),e.read(r),await e.update({data:n})}else await a.user.addItem({item:e,folder:s,data:n});return l}function Q(e,n,r,o,s){t.prototype.read.call(n,{version:o.version,authoringApp:o.authoringApp,authoringAppVersion:o.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:r.itemUrl?i(r.itemUrl):void 0}),a(s),n.resourceInfo=o}function $(e){return new Blob([JSON.stringify(e)],{type:`application/json`})}export{D as createJSON,Z as initializeNewItem,X as isCopyAllowed,E as save,O as saveAs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{generateCombinationsPanoramic as e,generateCombinations as t}from"./imageMeasurementUtils.js";function n(e){return t(e.imageToWorldProps,e.accuracyParameters)}function r(t){return e(t.imageToWorldProps,t.accuracyParameters)}export{r as generateCombinationsPanoramicWorker,n as generateCombinationsWorker};
|
|
2
|
+
import{generateCombinationsPanoramic as e,generateCombinations as t}from"./imageMeasurementUtils.js";function n(e){return t(e.imageToWorldProps,e.accuracyParameters,e.cameraHeading)}function r(t){return e(t.imageToWorldProps,t.accuracyParameters)}export{r as generateCombinationsPanoramicWorker,n as generateCombinationsWorker};
|