@arcgis/core 4.34.0-next.104 → 4.34.0-next.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{9afdc3ac5cf99cf431e4.js → 02e7c1f5200c3fed2bee.js} +1 -1
- package/assets/esri/core/workers/chunks/08eb477a375ef882eb2d.js +1 -0
- package/assets/esri/core/workers/chunks/1dfca37f95f2b968aa54.js +1 -0
- package/assets/esri/core/workers/chunks/2248c3040e2f9a8b5cbc.js +1 -0
- package/assets/esri/core/workers/chunks/83be98ea5306e79b9f4d.js +1 -0
- package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +1 -0
- package/assets/esri/core/workers/chunks/b12eef63f24a09dab074.js +1 -0
- package/assets/esri/core/workers/chunks/c91ce5fcdd4d0a6514d3.js +1 -0
- package/assets/esri/core/workers/chunks/{50d9f69d5255af4b29bb.js → df5afa06c6deb6b40109.js} +1 -1
- package/assets/esri/core/workers/chunks/e25c4b4a03270d48f408.js +1 -0
- package/assets/esri/core/workers/chunks/e9d4cae2144974489d6e.js +1 -0
- package/assets/esri/core/workers/chunks/{86b978a48b539e9fc5b8.js → ecaa720bc7e9c1901e63.js} +1 -1
- package/assets/esri/core/workers/chunks/f64037a88ab03662dc2a.js +1 -0
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/config.js +1 -1
- package/core/SetUtils.js +1 -1
- package/core/has.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/interfaces.d.ts +35 -22
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/support/fieldConfigUtils.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +1 -1
- package/package.json +3 -3
- package/popup/FieldInfo.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/sources/strategies/constants.js +5 -0
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/volumeMeasurementErrors.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +5 -0
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +6 -0
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/interactive/editGeometry/CheckpointingEditGeometryOperations.js +5 -0
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/operations/ReplayableAppendVertex.js +5 -0
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
- package/widgets/PanoramicViewer/support/getVisibleTiles.js +5 -0
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/05eee334d58a0b9f6316.js +0 -1
- package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +0 -1
- package/assets/esri/core/workers/chunks/1da74aa308ded5748ef5.js +0 -1
- package/assets/esri/core/workers/chunks/326a76a4e80269d4029d.js +0 -1
- package/assets/esri/core/workers/chunks/459a67928bde4a62b6a4.js +0 -1
- package/assets/esri/core/workers/chunks/48634e0c5b12607972aa.js +0 -1
- package/assets/esri/core/workers/chunks/50a5caa96c111dda5c60.js +0 -1
- package/assets/esri/core/workers/chunks/5a11b188029040ccd85a.js +0 -1
- package/assets/esri/core/workers/chunks/6201356f7f91e5c06425.js +0 -1
- package/assets/esri/core/workers/chunks/7fa324900c147ba51019.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{EsriPromise as t}from"../../../../core/Promise.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectWithZConversion as
|
|
5
|
+
import{__decorate as e}from"tslib";import{EsriPromise as t}from"../../../../core/Promise.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectWithZConversion as i}from"../../../../geometry/projectionUtils.js";import{computeTriangulatedVector as s,computeTriangulatedAreaMeasurement as o,computeTriangulatedDistanceMeasurement as n}from"../../imageMeasurementUtils.js";import{TriangulatedSketchHandlerMixin as c}from"../../mixins/TriangulatedSketchHandlerMixin.js";let m=[],u=class extends(c(t)){constructor(e){super(e),this.type="measurement"}async handleUpdate(e){const{measureType:t,updatingTriangularMeasurementState:a}=this.viewModel;if(this._freezeTriangulatedViewer(),"distance"===t){const t=e.graphics[0].geometry;m=t.paths[0]}else if("area"===t){const t=e.graphics[0].geometry;m=t.rings[0]}"complete"===e.state&&(this.viewModel.triangulatedMeasurementGraphic=e.graphics.at(-1),a?await this._updateTriangularMeasurements(m):await this.viewModel.processMeasurementVectors(m))}async _computeMeasurementVector(e,t){const{activeViewer:a,mode:r,view:o}=this.viewModel,n=a?.imageSize;if(!e||!t||!n)return;const c=e.map(e=>[e[0]-.5,-.5-e[1]]),m=o?.spatialReference,u=[];for(let s=0;s<c.length;s++){const e={x:c[s][0],y:c[s][1]};let a=await this.viewModel.getMapPoint(e,{feature:t,imageSize:n,mode:r});m&&!a.spatialReference.equals(m)&&(a=await i(a,m)),u.push(a)}return s(u,t)}async _updateTriangularMeasurements(e){const{measureType:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:r,updatingTriangularMeasurementState:i}=this.viewModel;if(!a||!r||!i||2!==this.viewModel.measurementVectors?.length)return;this.viewModel.measurementVectors.splice(-1);const s=await this._computeMeasurementVector(e,r);if(s&&this.viewModel.measurementVectors.push(s),2===this.viewModel.measurementVectors.length){switch(t){case"distance":{this.viewModel.triangulatedDistanceMeasurement=await n(this.viewModel.measurementVectors);const t=await this.viewModel.calculateAccuracy(e,"distance");if(t&&this.viewModel.triangulatedDistanceMeasurement?.distance){const e=Math.atan(t/this.viewModel.triangulatedDistanceMeasurement.distance);this.viewModel.triangulatedDistanceAccuracy={distanceAccuracy:t,angleAccuracy:e}}break}case"area":if(r?.geometry.spatialReference){const e=await o(this.viewModel.measurementVectors,r.geometry.spatialReference);this.viewModel.triangulatedAreaMeasurement=e}}if(this.viewModel.updatingTriangularMeasurementState=!1,"panoramic"===this.viewModel.mode){this.viewModel.activeTriangulatedViewer.viewModel.restoreNavigationHandles()}}}_freezeTriangulatedViewer(){const{mode:e,activeTriangulatedViewer:t}=this.viewModel;"panoramic"===e&&t&&t.imageRenderer.on(["key-down","mouse-wheel","drag"],e=>{e.stopPropagation()})}};e([a()],u.prototype,"type",void 0),u=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.TriangulatedMeasurementAdapter")],u);const l=u;export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import r from"../../request.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import{JSONMap as m}from"../../core/jsonMap.js";import{rad2deg as d,deg2rad as l}from"../../core/mathUtils.js";import{throwIfAborted as c,isAbortError as p,waitTick as g}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as y,when as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as w}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as f}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as M}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as R}from"../../core/support/UpdatingHandles.js";import P from"../../geometry/SpatialReference.js";import V from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as z}from"../../layers/orientedImagery/transformations/utils.js";import C from"../../views/SceneView.js";import{logAndThrow as H,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as S}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as j,defaultImageSphereSize as O,maxPanoramicViewerHFOV as I,minPanoramicViewerHFOV as b,humanBinocularHFOV as G}from"./constants.js";import x from"./PanoramicZoomConditions.js";import F from"./PanoramicZoomViewModel.js";import{meshToGraphic as A,findDiagonalFOV as T,loadRaster as L,loadPyramid as N,loadMeshes as D,createImageSphere as W}from"./utils.js";const E={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let Z=class extends h{constructor(e){super(e),this._panTask=null,this._startPosition=null,this._targetPosition=null,this.tileCache=[],this._graphics=new V({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this.currentGraphics=new s,this.imagePyramid=null,this.imagePyramidLevel=-1,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new s([this._graphics])}),this._imageRenderer=new C({map:this._map,viewingMode:"local",camera:{position:j},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:P.WebMercator,ui:{components:["zoom"]}}),this._loadController=null,this.zoomViewModel=new F({panoramicViewerViewModel:this,view:this._imageRenderer,panoramicZoomConditions:new x({})}),this.autoLoad=!1,this.clickAction="none",this.imageMeshDistance=O/2,this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.updatingHandles=new R,this.yaw=0,this._addNavigationHandles=(e=!0)=>{this.imageRenderer.basemapTerrain.suspended=!0,this.removeHandles(E.navigation);const i=[this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})];e&&i.push(this.imageRenderer.on("double-click",this._handleDoubleClick)),this.addHandles(i,E.navigation)},this._addHFOVHandles=()=>{this.removeHandles(E.fovConstraint),this.addHandles(u(()=>[this.maxHFOV,this.minHFOV],()=>{this.zoomViewModel&&(this.zoomViewModel.panoramicZoomConditions=new x({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},y),E.fovConstraint)},this._addZoomHandles=()=>{this.zoomViewModel=new F({view:this.imageRenderer,panoramicZoomConditions:new x({maxFOV:this.maxHFOV,minFOV:this.minHFOV}),panoramicViewerViewModel:this});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this.zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createPanTask=()=>{this._panTask=o(async e=>{if(!this.imagePyramid)return;const{hfov:i,vfov:t,yaw:a,pitch:r}=this,o=this.imagePyramid.getTiles(this.imagePyramidLevel,a,r,i,t).filter(e=>!this.tileCache.includes(`${e.level}/${e.row}/${e.column}`));if(!o?.length)return;const s=await Promise.all(o.map(async i=>await i.loadMeshAtDistance(this.imageMeshDistance,{signal:e})));c(e);const n=s.map(A);n.forEach((e,i)=>{const t=o[i].key;e.attributes={key:t},this.tileCache.push(t)}),this.currentGraphics.addMany(n),this.addManyGraphics(n),this._panTask=null})},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});i.results=i.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=z(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:P.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>{this.zoomViewModel?.zoomIn()},this._zoomOut=()=>{this.zoomViewModel?.zoomOut()},this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>this.updatingHandles.addPromise(this.navigateInternal(e,i)),this.navigateInternal=async(e,i)=>{const t=await this._loadNavigationManager();return await t.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this.restoreNavigationHandles=()=>{this._addNavigationHandles(!1)}}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([u(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},y),u(()=>this.fov,()=>{this._reloadCamera()},y),u(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},y),u(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},y),_(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},y),u(()=>this.clickAction,e=>{this.removeHandles(E.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},y),u(()=>this.camera,(e,i)=>{this._panTask?.abort(),e?i?.tilt===e.tilt&&i.heading===e.heading||this._createPanTask():this._panTask=null})],E.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get distanceFactor(){return this.fov?1-5/this.fov:null}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this.zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*a/Math.sqrt(1+a**2)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(I,e/i):I}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(b,e/i):b}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*(1/Math.sqrt(1+a**2))))}_clearImageSphere(){if(!this._imageGraphic)return;const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic];this._graphics.removeMany(e),this._imageGraphic=null,e.forEach(e=>e.destroy())}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await r(e,{responseType:"image",...i})).data}catch(a){throw p(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}async loadImageTiled(e,i){this.state="image-loading";try{const{clientWidth:t,clientHeight:a}=this.imageRenderer.container;this.fov=T(G,t/a);const r=await L(e,i),o=await N(r,i),s=o.getLowResolutionTiles(),h=await D(s,i),{imageSize:m}=o;if(c(i),!s?.length)throw new n("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",{imageSource:e});this.imagePyramid=o,this.imagePyramidLevel=o.maximumPyramidLevel,this.imageSize=m;const d=h.map(A);d.forEach((e,i)=>{const t=s[i].key;e.attributes={key:t},this.tileCache.push(t)}),this._imageGraphic=d,this._graphics.addMany(this._imageGraphic),this.state="image-loaded"}catch(t){throw this.state=p(t)?"image-load-aborted":"image-load-error",t}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._clearImageSphere(),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){return await g(i),this._imageGraphic=A(W(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(G,e/i)}),this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):H(this.declaredClass,new n(k("panoramic-viewer"),S("PanoramicViewerViewModel","imageSource")))}};e([w()],Z.prototype,"_graphics",void 0),e([w()],Z.prototype,"_imageGraphic",void 0),e([w({constructOnly:!0})],Z.prototype,"currentGraphics",void 0),e([w()],Z.prototype,"imagePyramid",void 0),e([w()],Z.prototype,"imagePyramidLevel",void 0),e([w()],Z.prototype,"_map",void 0),e([w()],Z.prototype,"_imageRenderer",void 0),e([w()],Z.prototype,"_loadController",void 0),e([w()],Z.prototype,"zoomViewModel",void 0),e([w({type:Boolean})],Z.prototype,"autoLoad",void 0),e([w({type:i})],Z.prototype,"camera",null),e([f(new m({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],Z.prototype,"clickAction",void 0),e([w()],Z.prototype,"distanceFactor",null),e([w({type:Number})],Z.prototype,"fov",null),e([w({readOnly:!0})],Z.prototype,"hfov",null),e([w()],Z.prototype,"imageMeshDistance",void 0),e([w({readOnly:!0})],Z.prototype,"imageRenderer",null),e([w()],Z.prototype,"imageSize",void 0),e([w()],Z.prototype,"imageSource",void 0),e([w({readOnly:!0})],Z.prototype,"maxHFOV",null),e([w({readOnly:!0})],Z.prototype,"minHFOV",null),e([w()],Z.prototype,"navigationViewModel",void 0),e([w({type:Number})],Z.prototype,"pitch",void 0),e([w()],Z.prototype,"state",void 0),e([w()],Z.prototype,"updatingHandles",void 0),e([w()],Z.prototype,"updating",null),e([w({readOnly:!0})],Z.prototype,"vfov",null),e([w({type:Number})],Z.prototype,"yaw",void 0),Z=e([M("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],Z);const U=Z;export{U as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import r from"../../request.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import{JSONMap as m}from"../../core/jsonMap.js";import{rad2deg as d,deg2rad as l}from"../../core/mathUtils.js";import{throwIfAborted as c,isAbortError as p,waitTick as g}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as y,when as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as w}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as M}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as R}from"../../core/support/UpdatingHandles.js";import P from"../../geometry/SpatialReference.js";import V from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as z}from"../../layers/orientedImagery/transformations/utils.js";import{isGraphic as C}from"../../support/guards.js";import H from"../../views/SceneView.js";import{logAndThrow as G,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as S}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as j,defaultImageSphereSize as b,maxPanoramicViewerHFOV as I,minPanoramicViewerHFOV as O,humanBinocularHFOV as x}from"./constants.js";import A from"./PanoramicZoomConditions.js";import F from"./PanoramicZoomViewModel.js";import{meshToGraphic as T,findDiagonalFOV as L,loadRaster as N,loadPyramid as E,loadMeshes as W,createImageSphere as D}from"./utils.js";const Z={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let U=class extends h{constructor(e){super(e),this._panTask=null,this._startPosition=null,this._targetPosition=null,this.tileCache=[],this._graphics=new V({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this.currentGraphics=new s,this.imagePyramid=null,this.imagePyramidLevel=-1,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new s([this._graphics])}),this._imageRenderer=new H({map:this._map,viewingMode:"local",camera:{position:j},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:P.WebMercator,ui:{components:["zoom"]}}),this._loadController=null,this.zoomViewModel=new F({panoramicViewerViewModel:this,view:this._imageRenderer,panoramicZoomConditions:new A({})}),this.autoLoad=!1,this.clickAction="none",this.imageMeshDistance=b/2,this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.updatingHandles=new R,this.yaw=0,this._addNavigationHandles=(e=!0)=>{this.imageRenderer.basemapTerrain.suspended=!0,this.removeHandles(Z.navigation);const i=[this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})];e&&i.push(this.imageRenderer.on("double-click",this._handleDoubleClick)),this.addHandles(i,Z.navigation)},this._addHFOVHandles=()=>{this.removeHandles(Z.fovConstraint),this.addHandles(u(()=>[this.maxHFOV,this.minHFOV],()=>{this.zoomViewModel&&(this.zoomViewModel.panoramicZoomConditions=new A({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},y),Z.fovConstraint)},this._addZoomHandles=()=>{this.zoomViewModel=new F({view:this.imageRenderer,panoramicZoomConditions:new A({maxFOV:this.maxHFOV,minFOV:this.minHFOV}),panoramicViewerViewModel:this});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this.zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createPanTask=()=>{this._panTask?.abort(),this._panTask=o(async e=>{if(!this.imagePyramid)return;const{hfov:i,vfov:t,yaw:a,pitch:r}=this,o=this.imagePyramid.getTiles(this.imagePyramidLevel,a,r,i,t).filter(e=>!this.tileCache.includes(`${e.level}/${e.row}/${e.column}`));if(!o?.length)return;const s=await Promise.all(o.map(async i=>await i.loadMesh({signal:e})));c(e);const n=s.map(T);n.forEach((e,i)=>{const t=o[i].key;e.attributes={key:t},this.tileCache.push(t)}),this.addManyGraphics(n),this.currentGraphics.addMany(n),this._panTask=null})},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics}),t=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(C);i.results=i.results.filter(e=>"graphic"===e.type&&!t.includes(e.graphic)),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=z(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:P.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>{this.zoomViewModel?.zoomIn()},this._zoomOut=()=>{this.zoomViewModel?.zoomOut()},this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>this.updatingHandles.addPromise(this.navigateInternal(e,i)),this.navigateInternal=async(e,i)=>{const t=await this._loadNavigationManager();return await t.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this.restoreNavigationHandles=()=>{this._addNavigationHandles(!1)}}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([u(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},y),u(()=>this.fov,()=>{this._reloadCamera()},y),u(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},y),u(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},y),_(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},y),u(()=>this.clickAction,e=>{this.removeHandles(Z.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},y),u(()=>this.camera,(e,i)=>{this._panTask?.abort(),e?i?.tilt===e.tilt&&i.heading===e.heading||this._createPanTask():this._panTask=null}),this.currentGraphics.on("change",()=>{const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(C),i=this.currentGraphics.map(e=>e.geometry.extent);e.forEach(e=>{e.visible=!0!==i.some(i=>i.intersects(e.geometry.extent))})})],Z.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get distanceFactor(){return this.fov?1-5/this.fov:null}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this.zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*a/Math.sqrt(1+a**2)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?L(I,e/i):I}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?L(O,e/i):O}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*(1/Math.sqrt(1+a**2))))}_clearImageSphere(){if(!this._imageGraphic)return;const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic];this._graphics.removeMany(e),this._imageGraphic=null,e.forEach(e=>e.destroy()),this._graphics.removeMany(this.currentGraphics.toArray()),this.imagePyramid=null,this.imagePyramidLevel=-1,this.tileCache=[]}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await r(e,{responseType:"image",...i})).data}catch(a){throw p(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}async loadImageTiled(e,i){this._removeImageSphere(),this.state="image-loading";try{const t=await N(e,i),a=await E(t,i),r=a.getLowResolutionTiles(),o=await W(r,i),{imageSize:s}=a;if(c(i),!r?.length)throw new n("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",{imageSource:e});this.imagePyramid=a,this.imagePyramidLevel=a.maximumPyramidLevel;const h=o.map(T);h.forEach((e,i)=>{const t=r[i].key;e.attributes={key:t},this.tileCache.push(t)}),this._imageGraphic=h,this._graphics.addMany(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=L(x,e/i)}),this.imageSize=s}catch(t){throw this.state=p(t)?"image-load-aborted":"image-load-error",t}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._clearImageSphere(),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){return await g(i),this._imageGraphic=T(D(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=L(x,e/i)}),this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):G(this.declaredClass,new n(k("panoramic-viewer"),S("PanoramicViewerViewModel","imageSource")))}};e([f()],U.prototype,"_graphics",void 0),e([f()],U.prototype,"_imageGraphic",void 0),e([f({constructOnly:!0})],U.prototype,"currentGraphics",void 0),e([f()],U.prototype,"imagePyramid",void 0),e([f()],U.prototype,"imagePyramidLevel",void 0),e([f()],U.prototype,"_map",void 0),e([f()],U.prototype,"_imageRenderer",void 0),e([f()],U.prototype,"_loadController",void 0),e([f()],U.prototype,"zoomViewModel",void 0),e([f({type:Boolean})],U.prototype,"autoLoad",void 0),e([f({type:i})],U.prototype,"camera",null),e([w(new m({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],U.prototype,"clickAction",void 0),e([f()],U.prototype,"distanceFactor",null),e([f({type:Number})],U.prototype,"fov",null),e([f({readOnly:!0})],U.prototype,"hfov",null),e([f()],U.prototype,"imageMeshDistance",void 0),e([f({readOnly:!0})],U.prototype,"imageRenderer",null),e([f()],U.prototype,"imageSize",void 0),e([f()],U.prototype,"imageSource",void 0),e([f({readOnly:!0})],U.prototype,"maxHFOV",null),e([f({readOnly:!0})],U.prototype,"minHFOV",null),e([f()],U.prototype,"navigationViewModel",void 0),e([f({type:Number})],U.prototype,"pitch",void 0),e([f()],U.prototype,"state",void 0),e([f()],U.prototype,"updatingHandles",void 0),e([f()],U.prototype,"updating",null),e([f({readOnly:!0})],U.prototype,"vfov",null),e([f({type:Number})],U.prototype,"yaw",void 0),U=e([M("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],U);const q=U;export{q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import i from"../../core/Accessor.js";import{createTask as e}from"../../core/asyncUtils.js";import{throwIfAborted as
|
|
5
|
+
import{__decorate as o}from"tslib";import i from"../../core/Accessor.js";import{createTask as e}from"../../core/asyncUtils.js";import{throwIfAborted as s}from"../../core/promiseUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{meshToGraphic as a}from"./utils.js";let m=class extends i{constructor(o){super(o),this._zoomTask=null,this.panoramicZoomViewModel=null,this._updateGraphicsFromTiles=async(o,i,e,t,r)=>{const m=await Promise.all(o.map(async o=>{const i=await o.loadMesh(r);return a(i)}));s(r);const n=t.removeAll();i.splice(0),m.forEach((e,s)=>{const t=o[s].key;e.attributes={key:t},i.push(t)}),t.addMany(m),this.viewModel?.set({imagePyramidLevel:e}),this.viewModel?.addManyGraphics(m),this.viewModel?.removeManyGraphics(n)},this._zoomIn=async o=>{if(s(o),!this.viewModel)return this.panoramicZoomViewModel.zoomInFOV();const{imagePyramid:i,yaw:e,hfov:t,vfov:r,pitch:a,tileCache:m,currentGraphics:n,imageRenderer:{size:c},imagePyramidLevel:l}=this.viewModel;if(!i)return this.panoramicZoomViewModel.zoomInFOV();const h=t/c[0],p=i.getLevelWithPixelAngle(h);if(0===l||l===p)return this.panoramicZoomViewModel.zoomInFOV();const d=i.getTiles(p,e,a,t,r);return d?(await this._updateGraphicsFromTiles(d,m,p,n,{signal:o}),this.panoramicZoomViewModel.zoomInFOV()):this.panoramicZoomViewModel.zoomInFOV()},this._zoomOut=async o=>{if(s(o),!this.viewModel)return this.panoramicZoomViewModel.zoomOutFOV();const{imagePyramid:i,yaw:e,hfov:t,vfov:r,pitch:a,tileCache:m,currentGraphics:n,imagePyramidLevel:c,imageRenderer:{size:l}}=this.viewModel;if(!i)return this.panoramicZoomViewModel.zoomOutFOV();const h=i.maximumPyramidLevel,p=t/l[0],d=i.getLevelWithPixelAngle(p);if(h===c||d===c)return this.panoramicZoomViewModel.zoomOutFOV();const u=i.getTiles(d,e,a,t,r);return u?(await this._updateGraphicsFromTiles(u,m,d,n,{signal:o}),this.panoramicZoomViewModel.zoomOutFOV()):this.panoramicZoomViewModel.zoomOutFOV()},this.zoomIn=o=>{(null==this._zoomTask||this._zoomTask.finished)&&(this._zoomTask=e(this._zoomIn,o))},this.zoomOut=o=>{(null==this._zoomTask||this._zoomTask.finished)&&(this._zoomTask=e(this._zoomOut,o))}}};o([t()],m.prototype,"viewModel",void 0),o([t()],m.prototype,"panoramicZoomViewModel",void 0),m=o([r("esri.widgets.PanoramicViewer.PanoramicZoomManager")],m);export{m as PanoramicZoomManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{open as n}from"../../../core/workers/workers.js";class o{constructor(){this._connection=null,this.convertPixelBlockToImageData=async e=>{if(!this._connection)throw new t("panoramic-mesh-manager:convertPixelBlockToImageData","Panoramic mesh manager is not loaded");const{pixelBlock:
|
|
5
|
+
import t from"../../../core/Error.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{open as n}from"../../../core/workers/workers.js";class o{constructor(){this._connection=null,this.convertPixelBlockToImageData=async e=>{if(!this._connection)throw new t("panoramic-mesh-manager:convertPixelBlockToImageData","Panoramic mesh manager is not loaded");const n=e.clone(),{pixelBlock:o,transferList:i}=n.getTransferableObject();return await this._connection.invoke("convertPixelBlockToImageData",o,{transferList:i})},this.getFacesWithVertexAttributes=async e=>{if(!this._connection)throw new t("panoramic-mesh-manager:getFacesWithVertexAttributes","Panoramic mesh manager is not loaded");return await this._connection.invoke("getFacesWithVertexAttributes",e)}}destroy(){this._connection?.close()}async _startWorker(t){this._connection=await n("PanoramicMeshWorker",t)}static getInstance(){return o._instance||(o._instance=new o),o._instance}async load(t){return e(t),await this._startWorker(t),this}async recomputePositions(e,n,o,i){if(!this._connection)throw new t("panoramic-mesh-manager:recomputePositions","Panoramic mesh manager is not loaded");return await this._connection.invoke("recomputePositions",{oldDistance:e,newDistance:n,position:o},{...i,transferList:[o.buffer.slice()]})}}export{o as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Mesh.js";import s from"../../../geometry/SpatialReference.js";import
|
|
5
|
+
import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Mesh.js";import s from"../../../geometry/SpatialReference.js";import a from"../../../geometry/support/MeshMaterial.js";import r from"../../../geometry/support/MeshTexture.js";import{loadMeshDependencies as o}from"./importUtils.js";class c{constructor(i,c,l,n,h,m,w,u,p){this.level=i,this.row=c,this.column=l,this.horizontalFieldOfView=n,this.verticalFieldOfView=h,this.yaw=m,this.pitch=w,this.distance=u,this.getPixelBlock=p,this._cache=null,this.loadMesh=async i=>{const{level:c,row:l,column:n,horizontalFieldOfView:h,verticalFieldOfView:m,yaw:w,pitch:u,distance:p}=this,{Mesh:f,MeshComponent:d,MeshVertexAttributes:v,panoramicMeshManager:g}=await o(),{faces:M,...x}=await g.getFacesWithVertexAttributes({distance:p,yaw:w,horizontalFieldOfView:h,pitch:u,verticalFieldOfView:m});t(i);const y=await this.getPixelBlock(c,l,n,i);if(t(i),!y)throw new e("panoramic-viewer:missing-tile-data",`Tile data for level ${c}, row ${l}, column ${n} is missing`,{level:c,row:l,column:n});const V=await g.convertPixelBlockToImageData(y);t(i);const F=new f({vertexAttributes:new v(x),components:[new d({faces:M,trustSourceNormals:!0,material:new a({colorTexture:new r({data:V})})})],spatialReference:s.WebMercator});return await F.load(i),this._cache=F,this._cache},this.loadMeshAtDistance=async(e,t)=>{const i=this.distance;return this.distance=e,Math.abs(i-e)>1e-6&&this._cache?this._cache:await this.loadMesh(t)}}get loaded(){return null!==this._cache}get key(){return`${this.level}/${this.row}/${this.column}`}clone(){const{level:e,row:t,column:s,horizontalFieldOfView:a,verticalFieldOfView:r,yaw:o,pitch:l,distance:n,getPixelBlock:h}=this,m=new c(e,t,s,a,r,o,l,n,h);if(this._cache){const{vertexAttributes:e,components:t,spatialReference:s}=this._cache,a=t?.map(({material:e,faces:t,trustSourceNormals:i})=>({material:e,faces:t?.slice(),trustSourceNormals:i}));m._cache=new i({components:a,vertexAttributes:e.clone(),spatialReference:s})}return m}}export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Error.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../geometry/Extent.js";import{RasterJobHandlerMixin as a}from"../../../layers/mixins/RasterJobHandlerMixin.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Error.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../geometry/Extent.js";import{RasterJobHandlerMixin as a}from"../../../layers/mixins/RasterJobHandlerMixin.js";import{pixelAngleThreshold as l,defaultImageSphereSize as n}from"../constants.js";import m from"./ClosestMap.js";import h from"./getVisibleTiles.js";import c from"./PanoramicTileNode.js";let p=class extends(a(t)){constructor(e){super(e),this._maximumPyramidLevel=-1,this._pixelAngleToLevelMap=new m,this._tileMap=new Map,this.raster=null,this._fetchRawTile=async(e,t,i,r)=>{await this._initJobHandler();const{pyramidBlockWidth:s,pyramidBlockHeight:a}=this.storageInfo,{minCol:l,maxCol:n,minRow:m,maxRow:h}=this.storageInfo.blockBoundary[e],c=n-l+1,p=h-m+1,g=i*this.imageSize[0]/c,d=t*this.imageSize[1]/p,f=Math.min((i+1)*this.imageSize[0]/c,this.imageSize[0]),u=Math.min((t+1)*this.imageSize[1]/p,this.imageSize[1]),x=f-g,w=u-d,y=new o({xmin:g-.5,ymin:.5-u,xmax:f-.5,ymax:.5-d,spatialReference:this.raster.rasterInfo.spatialReference}),{pixelBlock:_}=await this.raster.fetchPixels(y,s??x,a??w,r);return _},this.getLevelTiles=e=>{const t=[],{minCol:i,maxCol:r,minRow:s,maxRow:o}=this.storageInfo.blockBoundary[e];for(let a=s;a<=o;a++)for(let s=i;s<=r;s++){const i=this._tileMap.get(`${e}/${a}/${s}`);i&&t.push(i)}return t.length?t:null},this.getLevelWithPixelAngle=e=>this._pixelAngleToLevelMap.get(e)??0,this.getLowResolutionTiles=()=>{const e=this.maximumPyramidLevel;return e<0?null:this.getLevelTiles(e)},this.getTiles=(e,t,i,r,s)=>{const{minCol:o,minRow:a,maxCol:l,maxRow:n}=this.storageInfo.blockBoundary[e];return h(e,[o,a],[l,n],this._tileMap,t,i,r,s)}}initialize(){this._processLevels()}destroy(){this.raster.rasterJobHandler=null,this.raster=null,this._shutdownJobHandler(),this._tileMap.clear(),this._pixelAngleToLevelMap.clear()}async _initJobHandler(){this._rasterJobHandler||(await super._initJobHandler(),this.raster.rasterJobHandler=this._rasterJobHandler)}_processLevels(){const{blockBoundary:e,tileInfo:t}=this.storageInfo,r=e?.length;if(!r)throw new i("panoramic-viewer:missing-pyramid-resolutions","TIFF/MRF must have pyramid resolutions defined",{rasterId:this.raster.rasterId});this._tileMap.clear();for(let i=0;i<r;i++){const{maxCol:r,maxRow:s,minCol:o,minRow:a}=e[i],m=180/(s-a+1),h=360/(r-o+1),p=h/t.size[0];if(p>l)break;this._pixelAngleToLevelMap.set(p,i);for(let e=a;e<=s;e++){const t=180-(e+.5)*m;for(let s=o;s<=r;s++){const r=(s+.5)*h-180;this._tileMap.set(`${i}/${e}/${s}`,new c(i,e,s,h,m,r,t,n/2,this._fetchRawTile))}}this._maximumPyramidLevel=i}}get rasterInfo(){return this.raster.rasterInfo}get storageInfo(){return this.rasterInfo.storageInfo}get imageSize(){const{width:e,height:t}=this.rasterInfo;return[e,t]}get maximumPyramidLevel(){return this._maximumPyramidLevel}};e([r()],p.prototype,"raster",void 0),p=e([s("esri.widgets.PanoramicViewer.support.PanoramicTilePyramid")],p);const g=p;export{g as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
function n(n){return((n+180)%360+360)%360-180}function t(n){return Math.max(-90,Math.min(90,n))}function o(o,a,i,M){const l=Math.min(Math.max(i,0),360),r=Math.min(Math.max(M,0),180),u=l/2,f=r/2,c=a-90,e=t(c-f),s=t(c+f),x=s>=90||e<=-90||l>=360,h=n(o);return{latMin:e,latMax:s,lonMin:n(h-u),lonMax:n(h+u),fullLongitude:x,hfov:l,vfov:r}}function a(n,t,o,a){if(Math.abs(t-n)>=360||Math.abs(a-o)>=360)return!0;function i(n,t){return n<=t?[[n,t]]:[[n,180],[-180,t]]}const M=i(n,t),l=i(o,a);for(const r of M)for(const n of l)if(!(r[1]<=n[0]||r[0]>=n[1]))return!0;return!1}function i(n,t,o,a){return!(t<=o||n>=a)}function M(t,o,a,i){const M=360/a,l=180/i,r=t*M-180,u=r+M,f=90-o*l,c=f-l;return{lonMinRaw:r,lonMaxRaw:u,lonMin:n(r),lonMax:n(u),latMin:c,latMax:f}}function l(n,[t,l],[r,u],f,c,e,s,x){const{latMin:h,latMax:m,lonMin:d,lonMax:g,fullLongitude:v}=o(c,e,s,x),$=r-t+1,b=u-l+1,p=[];for(let o=t;o<=r;o++){const{lonMin:t,lonMax:r}=M(o,l,$,b);if(v||a(d,g,t,r))for(let a=l;a<=u;a++){const{latMin:t,latMax:l}=M(o,a,$,b);if(!i(h,m,t,l))continue;const r=`${n}/${a}/${o}`,u=f.get(r);u&&p.push(u)}}return p}export{l as default};
|
package/widgets/Sketch.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{handlesGroup as o}from"../core/handleUtils.js";import i from"../core/Logger.js";import{removeMaybe as s,destroyMaybe as l}from"../core/maybe.js";import{ignoreAbortErrors as r}from"../core/promiseUtils.js";import{watch as n,when as a,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"../views/interactive/sketch/SketchValueOptions.js";import h from"./Widget.js";import v from"./Sketch/SketchViewModel.js";import{VisibleElements as m}from"./Sketch/VisibleElements.js";import g from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import _ from"./support/SelectionToolbar.js";import y from"./support/SketchTooltipControls.js";import b from"./support/SnappingControls.js";import"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";import C from"./support/SelectionToolbar/VisibleElements.js";import O from"./support/SketchTooltipControls/VisibleElements.js";import{substitute as S}from"../intl/substitute.js";const k="esri-sketch",P={base:k,vertical:`${k}--vertical`,docked:`${k}-bar`,floating:`${k}-pad`,chipHorizontal:`${k}__selection-count-chip--horizontal`,chipVertical:`${k}__selection-count-chip--vertical`,chipVerticalSmall:`${k}__selection-count-chip--vertical--s`,popoverWrapper:`${k}__popover-wrapper`},I={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"add-text"};let R=class extends h{constructor(e,t){super(e,t),this._activeCustomToolOptions=null,this._selectionToolbar=null,this._viewModelHandlesGroup=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new m,this._defaultViewModel=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new v({creationMode:e?.creationMode??"continuous"}))}initialize(){const{layer:e,view:t}=this,i="2d"===t?.type,l=new _({persistSelection:!1,visibleElements:new C({chip:!1,lassoTool:i,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:i}),view:t,sources:e?[e]:null,scale:this.scale});this.addHandles([n(()=>this.viewModel,e=>{this._viewModelHandlesGroup=s(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=o([e.on("create",()=>this.scheduleRender()),e.on("update",()=>this.scheduleRender()),e.on("delete",e=>this.emit("delete",e)),e.on("undo",()=>this.scheduleRender()),e.on("redo",()=>this.scheduleRender()),n(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),n(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),n(()=>e.state,()=>this.notifyChange("state"))]))},p),a(()=>l.activeOperation,()=>this.viewModel.cancel()),l.on("complete",e=>this._onSelectionOperationComplete(e)),n(()=>{const{view:e,visibleElements:{selectionTools:t}}=this;return{lassoTool:"3d"!==e?.type&&!!t?.["lasso-selection"],rectangleTool:"3d"!==e?.type&&!!t?.["rectangle-selection"]}},e=>{Object.assign(l.visibleElements,e)},p)]),this._selectionToolbar=l}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=s(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const t=this._effectiveAvailableCreateTools,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&l(t),this._set("viewModel",e))}get _effectiveAvailableCreateTools(){const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter(e=>!!o.createTools?.[e]);return"3d"===t?.type?i?.filter(e=>"multipoint"!==e):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,r(this.viewModel.create(e,i))}update(e,t){return r(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this,i=this.customActions?.filter(e=>"selection-toolbar"===e.position);return M("div",null,M("div",{classes:{[P.base]:!0,[P.floating]:"floating"===e,[P.docked]:"docked"===e,[P.vertical]:"vertical"===t}},M(g,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionTools")??!0,"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),i?.map(e=>this._renderToolbarItem(e))),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup()),this._renderSelectionSetToolbar(),this._renderSettingsMenuPopover()))}_renderSettingsMenuPopover(){const{messagesCommon:e,snappingOptions:t,view:o,viewModel:i,visibleElements:s}=this;if(!this._calcitePopoverReferenceElement)return;const l={directionModePicker:s.directionModePicker,labelsToggle:s.labelsToggle,tooltipsToggle:s.tooltipsToggle},r="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return M("calcite-popover",{closable:!0,focusTrapDisabled:!0,heading:e.settings,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:r,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,onCalcitePopoverBeforeClose:()=>this._popoverOpen=!1,onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:()=>this._refocusOnView()},M("div",{class:P.popoverWrapper},Object.values(l).includes(!0)?M(y,{sketchOptions:i.sketchOptions,viewType:o?.type,visibleElements:new O(l)}):void 0,s.snappingControls&&o&&t?M(b,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:o,visibleElements:s.snappingControlsElements}):void 0))}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?M(g,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("undoRedo")??!0,"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??10,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],o=[];this.customActions?.forEach(t=>{"settings-before"===t.position?o.push(t):"settings-after"===t.position&&e.push(t)});const i=[...o.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(t);if(i.length)return M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("settings")??!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??1e3,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter(e=>"before-selection-set"===e.position),o=this.customActions?.filter(e=>"after-selection-set"===e.position),i=this.groupCollapsePriorities?.get("selectionSet")??100;return[M("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionSet")??!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderCreateToolActionGroup(){const e=this._effectiveAvailableCreateTools?.flatMap(e=>this._renderBuiltInCreateToolItem(e))??[],t=this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[];return M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("createTools")??!0,"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??100},e,t)}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:I[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:"settings-menu-action",text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:t,scale:o,id:i,updateGraphics:{length:s}}=this,l=S(t.selectedCount,{count:s}),r="s"===o?99:999,n=s>r?S(t.selectedCountTruncated,{truncated:r}):s,a="s"===o&&"vertical"===e,p=a?`${i}-selection-chip-small`:`${i}-selection-chip`;return[a?M("span",{classes:{[P.chipVertical]:!0,[P.chipVerticalSmall]:"s"===this.scale},id:p,tabIndex:0,title:l},n):M("calcite-chip",{appearance:"outline",class:"horizontal"===e?P.chipHorizontal:P.chipVertical,id:p,kind:"brand",label:l,scale:"l"===o?"m":"s",tabIndex:0,title:"vertical"===e?l:void 0},"vertical"===e?n:l)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:s,active:l,flipRTL:r,afterCreate:n,afterUpdate:a,afterRemoved:p}){const c=`${this.id}-${e}`;return[M("calcite-action",{active:l,afterCreate:n,afterRemoved:p,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state,icon:o,iconFlipRtl:r??!1,id:c,key:e,onclick:s,scale:this.scale,text:t,title:t})]}_remeasurePopoverSizes(e){try{const t=e.parentElement,o=this?.view?.container?.getBoundingClientRect(),i=t?.style;if(!(t&&o&&i&&this.view?.container?.contains(t)))return;const s=this._calcitePopoverReferenceElement;if(!s)return;const{bottom:l,top:r}=s.getBoundingClientRect();if("horizontal"===this.layout){const e=l<o.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(i?.setProperty("--sketch-view-height-offset",l-o.top+"px"),i?.setProperty("--sketch-view-margin-offset","30px")):(i?.setProperty("--sketch-view-height-offset",o.bottom-r+"px"),i?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(i.setProperty("--sketch-view-height-offset","15px"),i.setProperty("--sketch-view-margin-offset","15px"));const n=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;i.setProperty("--sketch-popover-header-offset",`${n}px`)}catch(t){i.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(){this.activeTool&&this.view?.focus()}};e([c()],R.prototype,"_activeCustomToolOptions",void 0),e([c()],R.prototype,"activeTool",null),e([c({readOnly:!0})],R.prototype,"activeTooltip",null),e([c({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh","text"]);return e.filter(e=>t.has(e))}})],R.prototype,"availableCreateTools",void 0),e([c({readOnly:!0})],R.prototype,"createGraphic",null),e([c()],R.prototype,"creationMode",null),e([c()],R.prototype,"customToolOptions",void 0),e([c()],R.prototype,"customActions",void 0),e([c()],R.prototype,"defaultCreateOptions",null),e([c()],R.prototype,"defaultUpdateOptions",null),e([c()],R.prototype,"icon",null),e([c()],R.prototype,"label",null),e([c()],R.prototype,"labelOptions",null),e([c()],R.prototype,"layer",null),e([c({type:["horizontal","vertical"],value:"horizontal"})],R.prototype,"layout",null),e([c({value:"m"})],R.prototype,"scale",null),e([c()],R.prototype,"toolbarKind",void 0),e([c()],R.prototype,"contextualToolLocation",void 0),e([c()],R.prototype,"groupCollapsePriorities",void 0),e([c()],R.prototype,"groupAllowCollapseOptions",void 0),e([c(),w("esri/widgets/Sketch/t9n/Sketch")],R.prototype,"messages",void 0),e([c(),w("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([c()],R.prototype,"snappingOptions",null),e([c()],R.prototype,"state",null),e([c()],R.prototype,"tooltipOptions",null),e([c({readOnly:!0})],R.prototype,"updateGraphics",null),e([c({type:u,nonNullable:!0})],R.prototype,"valueOptions",null),e([c()],R.prototype,"view",null),e([c({type:v}),T(["create","update","undo","redo"])],R.prototype,"viewModel",null),e([c({type:m,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([c()],R.prototype,"_effectiveAvailableCreateTools",null),e([c()],R.prototype,"_defaultViewModel",void 0),e([c()],R.prototype,"_calcitePopoverReferenceElement",void 0),e([c()],R.prototype,"_relativeLocation",void 0),e([c()],R.prototype,"_popoverOpen",void 0),R=e([d("esri.widgets.Sketch")],R);const E=R;export{E as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{handlesGroup as o}from"../core/handleUtils.js";import i from"../core/Logger.js";import{removeMaybe as s,destroyMaybe as l}from"../core/maybe.js";import{ignoreAbortErrors as r}from"../core/promiseUtils.js";import{watch as n,when as a,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"../views/interactive/sketch/SketchValueOptions.js";import h from"./Widget.js";import v from"./Sketch/SketchViewModel.js";import{VisibleElements as m}from"./Sketch/VisibleElements.js";import g from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import _ from"./support/SelectionToolbar.js";import y from"./support/SketchTooltipControls.js";import b from"./support/SnappingControls.js";import"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";import C from"./support/SelectionToolbar/VisibleElements.js";import O from"./support/SketchTooltipControls/VisibleElements.js";import{substitute as S}from"../intl/substitute.js";const k="esri-sketch",P={base:k,vertical:`${k}--vertical`,docked:`${k}-bar`,floating:`${k}-pad`,chipHorizontal:`${k}__selection-count-chip--horizontal`,chipVertical:`${k}__selection-count-chip--vertical`,chipVerticalSmall:`${k}__selection-count-chip--vertical--s`,popoverWrapper:`${k}__popover-wrapper`},I={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"add-text"};let R=class extends h{constructor(e,t){super(e,t),this._activeCustomToolOptions=null,this._selectionToolbar=null,this._viewModelHandlesGroup=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new m,this._defaultViewModel=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new v({creationMode:e?.creationMode??"continuous"}))}initialize(){const{layer:e,view:t}=this,i="2d"===t?.type,l=new _({persistSelection:!1,visibleElements:new C({chip:!1,lassoTool:i,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:i}),view:t,sources:e?[e]:null,scale:this.scale});this.addHandles([n(()=>this.viewModel,e=>{this._viewModelHandlesGroup=s(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=o([e.on("create",()=>this.scheduleRender()),e.on("update",()=>this.scheduleRender()),e.on("delete",e=>this.emit("delete",e)),e.on("undo",()=>this.scheduleRender()),e.on("redo",()=>this.scheduleRender()),n(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),n(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),n(()=>e.state,()=>this.notifyChange("state"))]))},p),a(()=>l.activeOperation,()=>this.viewModel.cancel()),l.on("complete",e=>this._onSelectionOperationComplete(e)),n(()=>{const{view:e,visibleElements:{selectionTools:t}}=this;return{lassoTool:"3d"!==e?.type&&!!t?.["lasso-selection"],rectangleTool:"3d"!==e?.type&&!!t?.["rectangle-selection"]}},e=>{Object.assign(l.visibleElements,e)},p)]),this._selectionToolbar=l}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=s(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const t=this._effectiveAvailableCreateTools,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&l(t),this._set("viewModel",e))}get _effectiveAvailableCreateTools(){const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter(e=>!!o.createTools?.[e]);return"3d"===t?.type?i?.filter(e=>"multipoint"!==e):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,r(this.viewModel.create(e,i))}update(e,t){return r(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this,i=this.customActions?.filter(e=>"selection-toolbar"===e.position);return M("div",null,M("div",{classes:{[P.base]:!0,[P.floating]:"floating"===e,[P.docked]:"docked"===e,[P.vertical]:"vertical"===t}},M(g,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionTools")??!0,"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),i?.map(e=>this._renderToolbarItem(e))),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup()),this._renderSelectionSetToolbar(),this._renderSettingsMenuPopover()))}_renderSettingsMenuPopover(){const{messagesCommon:e,snappingOptions:t,view:o,viewModel:i,visibleElements:s}=this;if(!this._calcitePopoverReferenceElement)return;const l={directionModePicker:s.directionModePicker,labelsToggle:s.labelsToggle,tooltipsToggle:s.tooltipsToggle},r="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return M("calcite-popover",{closable:!0,heading:e.settings,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:r,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,onCalcitePopoverBeforeClose:()=>this._popoverOpen=!1,onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:()=>this._refocusOnView()},M("div",{class:P.popoverWrapper},Object.values(l).includes(!0)?M(y,{sketchOptions:i.sketchOptions,viewType:o?.type,visibleElements:new O(l)}):void 0,s.snappingControls&&o&&t?M(b,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:o,visibleElements:s.snappingControlsElements}):void 0))}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?M(g,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("undoRedo")??!0,"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??10,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],o=[];this.customActions?.forEach(t=>{"settings-before"===t.position?o.push(t):"settings-after"===t.position&&e.push(t)});const i=[...o.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(t);if(i.length)return M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("settings")??!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??1e3,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter(e=>"before-selection-set"===e.position),o=this.customActions?.filter(e=>"after-selection-set"===e.position),i=this.groupCollapsePriorities?.get("selectionSet")??100;return[M("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionSet")??!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderCreateToolActionGroup(){const e=this._effectiveAvailableCreateTools?.flatMap(e=>this._renderBuiltInCreateToolItem(e))??[],t=this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[];return M("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("createTools")??!0,"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??100},e,t)}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:I[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:"settings-menu-action",text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:t,scale:o,id:i,updateGraphics:{length:s}}=this,l=S(t.selectedCount,{count:s}),r="s"===o?99:999,n=s>r?S(t.selectedCountTruncated,{truncated:r}):s,a="s"===o&&"vertical"===e,p=a?`${i}-selection-chip-small`:`${i}-selection-chip`;return[a?M("span",{classes:{[P.chipVertical]:!0,[P.chipVerticalSmall]:"s"===this.scale},id:p,tabIndex:0,title:l},n):M("calcite-chip",{appearance:"outline",class:"horizontal"===e?P.chipHorizontal:P.chipVertical,id:p,kind:"brand",label:l,scale:"l"===o?"m":"s",tabIndex:0,title:"vertical"===e?l:void 0},"vertical"===e?n:l)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:s,active:l,flipRTL:r,afterCreate:n,afterUpdate:a,afterRemoved:p}){const c=`${this.id}-${e}`;return[M("calcite-action",{active:l,afterCreate:n,afterRemoved:p,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state,icon:o,iconFlipRtl:r??!1,id:c,key:e,onclick:s,scale:this.scale,text:t,title:t})]}_remeasurePopoverSizes(e){try{const t=e.parentElement,o=this?.view?.container?.getBoundingClientRect(),i=t?.style;if(!(t&&o&&i&&this.view?.container?.contains(t)))return;const s=this._calcitePopoverReferenceElement;if(!s)return;const{bottom:l,top:r}=s.getBoundingClientRect();if("horizontal"===this.layout){const e=l<o.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(i?.setProperty("--sketch-view-height-offset",l-o.top+"px"),i?.setProperty("--sketch-view-margin-offset","30px")):(i?.setProperty("--sketch-view-height-offset",o.bottom-r+"px"),i?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(i.setProperty("--sketch-view-height-offset","15px"),i.setProperty("--sketch-view-margin-offset","15px"));const n=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;i.setProperty("--sketch-popover-header-offset",`${n}px`)}catch(t){i.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(){this.activeTool&&this.view?.focus()}};e([c()],R.prototype,"_activeCustomToolOptions",void 0),e([c()],R.prototype,"activeTool",null),e([c({readOnly:!0})],R.prototype,"activeTooltip",null),e([c({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh","text"]);return e.filter(e=>t.has(e))}})],R.prototype,"availableCreateTools",void 0),e([c({readOnly:!0})],R.prototype,"createGraphic",null),e([c()],R.prototype,"creationMode",null),e([c()],R.prototype,"customToolOptions",void 0),e([c()],R.prototype,"customActions",void 0),e([c()],R.prototype,"defaultCreateOptions",null),e([c()],R.prototype,"defaultUpdateOptions",null),e([c()],R.prototype,"icon",null),e([c()],R.prototype,"label",null),e([c()],R.prototype,"labelOptions",null),e([c()],R.prototype,"layer",null),e([c({type:["horizontal","vertical"],value:"horizontal"})],R.prototype,"layout",null),e([c({value:"m"})],R.prototype,"scale",null),e([c()],R.prototype,"toolbarKind",void 0),e([c()],R.prototype,"contextualToolLocation",void 0),e([c()],R.prototype,"groupCollapsePriorities",void 0),e([c()],R.prototype,"groupAllowCollapseOptions",void 0),e([c(),w("esri/widgets/Sketch/t9n/Sketch")],R.prototype,"messages",void 0),e([c(),w("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([c()],R.prototype,"snappingOptions",null),e([c()],R.prototype,"state",null),e([c()],R.prototype,"tooltipOptions",null),e([c({readOnly:!0})],R.prototype,"updateGraphics",null),e([c({type:u,nonNullable:!0})],R.prototype,"valueOptions",null),e([c()],R.prototype,"view",null),e([c({type:v}),T(["create","update","undo","redo"])],R.prototype,"viewModel",null),e([c({type:m,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([c()],R.prototype,"_effectiveAvailableCreateTools",null),e([c()],R.prototype,"_defaultViewModel",void 0),e([c()],R.prototype,"_calcitePopoverReferenceElement",void 0),e([c()],R.prototype,"_relativeLocation",void 0),e([c()],R.prototype,"_popoverOpen",void 0),R=e([d("esri.widgets.Sketch")],R);const E=R;export{E as default};
|