@arcgis/core 6.0.0-next.1 → 6.0.0-next.3
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/analysis/DimensionSimpleStyle.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01803f76bc0d9f2cd566.js +1 -0
- package/assets/esri/core/workers/chunks/{a7325ebb7edf3273bb34.js → 12b84262dedc6b393136.js} +1 -1
- package/assets/esri/core/workers/chunks/19bb07942c265d64e321.js +1 -0
- package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +1 -0
- package/assets/esri/core/workers/chunks/261fea092ee7d27608a0.js +1 -0
- package/assets/esri/core/workers/chunks/347bf269c2b1583d2dca.js +1 -0
- package/assets/esri/core/workers/chunks/{8af92bcc075e03e3e902.js → 512628db534605a2a93e.js} +22 -22
- package/assets/esri/core/workers/chunks/5e4d6c283c2fa28db022.js +1 -0
- package/assets/esri/core/workers/chunks/64770e2cf41211b63fd2.js +1 -0
- package/assets/esri/core/workers/chunks/{ffb3728e6ac428f62af1.js → 71103472c45928bd730c.js} +1 -1
- package/assets/esri/core/workers/chunks/73a87fb270818aa75fc5.js +1 -0
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +1 -0
- package/assets/esri/core/workers/chunks/8313c626596a76c7449d.js +1 -0
- package/assets/esri/core/workers/chunks/84e9258a57d8c365f361.js +1 -0
- package/assets/esri/core/workers/chunks/{b0cfec11c758eed8095f.js → 87b4e916b2668203a6b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{40fb1910f780e78c128c.js → 8b54589f173259c1ba55.js} +1 -1
- package/assets/esri/core/workers/chunks/{61ad8306ab79aca79505.js → 8ba32d3a0df4a206ef1c.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa1054834738aef48bda.js → a0356702f2d3f787aeac.js} +1 -1
- package/assets/esri/core/workers/chunks/ac4cc49104d26c384e98.js +1 -0
- package/assets/esri/core/workers/chunks/b1008bdfca995ebf98ed.js +1 -0
- package/assets/esri/core/workers/chunks/bc7b9a5a8942aa3ea249.js +1 -0
- package/assets/esri/core/workers/chunks/d4926545193414cf2f16.js +1 -0
- package/assets/esri/core/workers/chunks/ec28e18275d36e71b438.js +1 -0
- package/assets/esri/core/workers/chunks/{050c4b212f2b5691db34.js → f762f70e7d39634ce797.js} +1 -1
- package/assets/esri/core/workers/chunks/{32d08b571bbd996d4e6d.js → fb4ff0ac2bc445fec413.js} +1 -1
- package/assets/esri/core/workers/chunks/{4310c8d2b40ae69c3681.js → fccbb902fe08448f91de.js} +1 -1
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/chunks/RibbonLine.glsl.js +9 -11
- package/config.js +1 -1
- package/core/screenUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/GeospatialPDFLayer.d.ts +2 -5
- package/layers/GeospatialPDFLayer.js +1 -1
- package/layers/ParquetLayer.d.ts +8 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/geospatialPDF/renderExtentUtils.js +1 -1
- package/package.json +3 -3
- package/smartMapping/renderers/support/spikeUtils.js +3 -3
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/symbols/callouts/LineCallout3D.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/edges/Edges3D.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/Symbol3DTextBorder.js +1 -1
- package/symbols/support/defaults3D.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +2 -0
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +2 -0
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +23 -9
- package/views/DOMContainer.d.ts +1 -0
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/managers/TooltipManager.js +1 -1
- package/views/interactive/snapping/SnappingVisualizer.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/layers/FeatureLikeLayerView.d.ts +1 -0
- package/views/layers/GraphicsLayerView.d.ts +1 -0
- package/views/layers/ImageryLayerView.d.ts +1 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/types.d.ts +20 -0
- package/widgets/OrientedImageryViewer.d.ts +9 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +9 -2
- package/assets/esri/core/workers/chunks/01b00fbf6a6a22d573ee.js +0 -1
- package/assets/esri/core/workers/chunks/084222c00d263a534952.js +0 -1
- package/assets/esri/core/workers/chunks/1f3148cebee1961249a4.js +0 -1
- package/assets/esri/core/workers/chunks/37a636f61cfe89c6bfd1.js +0 -1
- package/assets/esri/core/workers/chunks/380cc538c1ab453870fa.js +0 -1
- package/assets/esri/core/workers/chunks/4848f195eb93cc93dd15.js +0 -1
- package/assets/esri/core/workers/chunks/750a9f3cdb96b966274a.js +0 -1
- package/assets/esri/core/workers/chunks/897fc8e78a0d54a5ff5a.js +0 -1
- package/assets/esri/core/workers/chunks/9432feca48ca3e5849bd.js +0 -1
- package/assets/esri/core/workers/chunks/956a40f40bde416efe93.js +0 -1
- package/assets/esri/core/workers/chunks/985b3f18cee87c3fe022.js +0 -1
- package/assets/esri/core/workers/chunks/ae2181805d8ba130babc.js +0 -1
- package/assets/esri/core/workers/chunks/ca7fb75e2c62e7d37122.js +0 -1
- package/assets/esri/core/workers/chunks/cfae60b9d2f2939e9c16.js +0 -1
- package/assets/esri/core/workers/chunks/d6d5a9e73ee43d6066d3.js +0 -1
- package/assets/esri/core/workers/chunks/e7c60bd85abbd36cdc64.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Color.js";import{ClonableMixin as n}from"../../core/Clonable.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Color.js";import{ClonableMixin as n}from"../../core/Clonable.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{onePixelInPoints as i}from"../../core/screenUtils.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{colorAndTransparencyProperty as s,screenSizeProperty as c}from"./materialUtils.js";let l=class extends n(r){constructor(e){super(e),this.color=new t([0,0,0,1])}get size(){return this._get(`size`)??i}set size(e){this._set(`size`,e)}};e([a({...s({colorRequiredOnWrite:!0}),json:void 0})],l.prototype,`color`,void 0),e([a({...c,json:void 0})],l.prototype,`size`,null),l=e([o(`esri.symbols.support.Symbol3DTextBorder`)],l);export{l as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../Color.js";import t from"../../core/Collection.js";import{
|
|
2
|
+
import e from"../../Color.js";import t from"../../core/Collection.js";import{onePixelInPoints as n}from"../../core/screenUtils.js";import r from"../FillSymbol3DLayer.js";import i from"../LineSymbol3D.js";import a from"../LineSymbol3DLayer.js";import o from"../MeshSymbol3D.js";import s from"../PointSymbol3D.js";import c from"../PolygonSymbol3D.js";import l from"../edges/SolidEdges3D.js";import{defaultPointSymbol2D as u,defaultPolylineSymbol2D as d,defaultPolygonSymbol2D as f}from"./defaults.js";import{defaultColor as p,defaultOutlineColor as m}from"./defaultsJSON.js";const h=s.fromSimpleMarkerSymbol(u),g=i.fromSimpleLineSymbol(d),_=c.fromSimpleFillSymbol(f),v=new o({symbolLayers:new t([new r({material:{color:p},edges:new l({size:n,color:new e(m)})})])}),y=new i({symbolLayers:new t([new a({material:{color:new e([0,0,0])},size:n})])}),b=new c({symbolLayers:new t([new r({outline:{color:new e([0,0,0]),size:n}})])});function x(e){if(e==null)return null;switch(e.type){case`mesh`:return v;case`point`:case`multipoint`:return h;case`polyline`:return g;case`polygon`:case`extent`:return _}return null}export{b as defaultRendererPolygonSymbol3D,y as defaultRendererPolylineSymbol3D,x as getDefaultSymbol3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as n}from"../../../../core/colorUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{isAborted as i,ignoreAbortErrors as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import d from"../../../../symbols/SimpleFillSymbol.js";import f from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as p}from"../../../analysis/ExclusiveOperationManager.js";import{bindViewToolOptions as m}from"../../../interactive/options/bindViewToolOptions.js";import h from"../../../../widgets/Sketch/SketchViewModel.js";function g(e){return e?.type===`polygon`}let _=class extends t{constructor(e){super(e),this._invisibleAreaSymbol=new d({color:null,outline:null}),this._invisibleLineSymbol=new f({color:null,width:0}),this._operationManager=new p,this._updatingHandles=new u}initialize(){this._sketchViewModel=new h({defaultCreateOptions:{mode:`click`},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:`none`,shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{t
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as n}from"../../../../core/colorUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{isAborted as i,ignoreAbortErrors as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import d from"../../../../symbols/SimpleFillSymbol.js";import f from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as p}from"../../../analysis/ExclusiveOperationManager.js";import{bindViewToolOptions as m}from"../../../interactive/options/bindViewToolOptions.js";import h from"../../../../widgets/Sketch/SketchViewModel.js";function g(e){return e?.type===`polygon`}let _=class extends t{constructor(e){super(e),this._invisibleAreaSymbol=new d({color:null,outline:null}),this._invisibleLineSymbol=new f({color:null,width:0}),this._operationManager=new p,this._updatingHandles=new u}initialize(){this._sketchViewModel=new h({defaultCreateOptions:{mode:`click`},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:`none`,shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{!t||!e?this._operationManager.stop():this._analysis.geometry&&this._operationManager.currentOperationType!==`place`&&this.reshape().catch(()=>{})}),o(()=>this.measurementViewData.analysis.geometry,e=>{e||(this._operationManager.stop(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll())}),o(()=>this.measurementViewData.snappingOptions,e=>{this._sketchViewModel&&(this._sketchViewModel.snappingOptions=e)},s),m(this._sketchViewModel.sketchOptions,()=>this.view.options,()=>({values:{displayUnits:{area:this._analysis.unit}}})),o(()=>this.view.effectiveTheme.accentColor,e=>{this._areaSymbol=new d({color:n(e,.3),outline:new f({color:e,width:2})})},s)])}destroy(){this._areaSymbol?.destroy(),this._invisibleAreaSymbol.destroy(),this._invisibleLineSymbol.destroy(),this._operationManager.destroy(),this._sketchViewModel?.destroy(),this._updatingHandles.destroy()}get state(){if(!this.measurementViewData.visible||!this._operationManager.currentOperationType)return`idle`;switch(this._operationManager.currentOperationType){case`place`:return`placing`;case`reshape`:return`reshaping`}}get updating(){return!this._sketchViewModel||this._sketchViewModel.updating||this._updatingHandles.updating}async place(e){return this._operationManager.start(`place`,async t=>{if(!this._sketchViewModel||!this.measurementViewData.sketchGraphicsLayer)return;let n=this._analysis.clone(),o=this._sketchViewModel.on([`create`,`undo`,`redo`],e=>{let n=`state`in e?e.state:`active`,r=`graphic`in e?e.graphic:e.graphics?.at(0);switch(n){case`start`:case`active`:{let e=r?.geometry;e?.type===`polygon`&&(this._analysis.geometry=e);break}case`cancel`:case`complete`:t.stop(),a(this.reshape())}});t.handles.push(o,r(()=>{o.remove(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll();let r=this._analysis;if(!r.valid)return r.clear(),t.reject();if(i(e)||n.equals(r))return t.reject();t.resolve({})})),this._sketchViewModel.activeLineSymbol=this._invisibleLineSymbol,this._sketchViewModel.polygonSymbol=this._invisibleAreaSymbol,this._sketchViewModel.layer=this.measurementViewData.sketchGraphicsLayer,this._updatingHandles.consumePromise(a(this._sketchViewModel.create(`polygon`)))},e)}async reshape(e){return this._operationManager.start(`reshape`,async t=>{if(!this._sketchViewModel)return;let n=()=>!this._areaSymbol||!this._sketchViewModel||!this.measurementViewData.manipulatorGraphic||!this.measurementViewData.manipulatorGraphicsLayer?Promise.resolve():(this._sketchViewModel.activeLineSymbol=null,this._sketchViewModel.polygonSymbol=this._areaSymbol,this._sketchViewModel.layer=this.measurementViewData.manipulatorGraphicsLayer,this._updatingHandles.addPromise(a(this._sketchViewModel.update(this.measurementViewData.manipulatorGraphic,{tool:`reshape`})))),o=this._sketchViewModel.on(`update`,e=>{let r=e.graphics[0]?.geometry;this._analysis.geometry=g(r)?r:null,e.state===`complete`&&(this.measurementViewData.interactive?n():t.stop())});t.handles.push(o,r(()=>{if(o.remove(),this._sketchViewModel?.cancel(),i(e))return t.reject();t.resolve()})),await n()},e)}get _analysis(){return this.measurementViewData.analysis}};e([c()],_.prototype,`_sketchViewModel`,void 0),e([c()],_.prototype,`measurementViewData`,void 0),e([c()],_.prototype,`state`,null),e([c()],_.prototype,`updating`,null),e([c()],_.prototype,`view`,void 0),_=e([l(`esri.views.2d.analysis.AreaMeasurement.AreaMeasurementTool`)],_);export{_ as AreaMeasurementTool};
|
|
@@ -98,6 +98,8 @@ export default abstract class AreaMeasurementAnalysisView2D extends AnalysisView
|
|
|
98
98
|
/**
|
|
99
99
|
* Starts an interactive placement operation to create a new [AreaMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/AreaMeasurementAnalysis/).
|
|
100
100
|
*
|
|
101
|
+
* Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/2d/analysis/AreaMeasurementAnalysisView2D/#interactive) to `true`.
|
|
102
|
+
*
|
|
101
103
|
* The placement operation will finish when the user presses the escape key, double taps, or double clicks.
|
|
102
104
|
* To stop the placing programmatically, pass an abort signal as an argument when calling the method.
|
|
103
105
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{toAdaptiveLengthUnitForArea as t,toAdaptiveAreaUnit as n}from"../../../core/quantity.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import o from"./AnalysisView2D.js";import{AreaMeasurementAreaVisualization as s}from"./AreaMeasurement/AreaMeasurementAreaVisualization.js";import{AreaMeasurementController as c}from"./AreaMeasurement/AreaMeasurementController.js";import{AreaMeasurementManipulatorVisualization as l}from"./AreaMeasurement/AreaMeasurementManipulatorVisualization.js";import{AreaMeasurementSketchVisualization as u}from"./AreaMeasurement/AreaMeasurementSketchVisualization.js";import{AreaMeasurementTool as d}from"./AreaMeasurement/AreaMeasurementTool.js";import f from"../../interactive/snapping/SnappingOptions.js";let p=class extends o{constructor(e){super(e),this.analysis=null,this.snappingOptions=new f,this.type=`area-measurement-view-2d`}initialize(){let{view:e}=this;this._areaVisualization=new s({view:e,measurementViewData:this}),this._controller=new c({view:e,measurementViewData:this}),this._manipulatorVisualization=new l({view:e,measurementViewData:this}),this._sketchVisualization=new u({view:e,measurementViewData:this}),this._tool=new d({view:e,measurementViewData:this})}destroy(){this._areaVisualization?.destroy(),this._controller?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get result(){let e=this._controller?.result;if(!e)return e;let{unit:r}=this,{area:i,display:a,mode:o,perimeter:s}=e;return{area:i?n(i,r):null,display:a,mode:o,perimeter:s?t(s,r):null}}get unit(){return this.analysis.unit??this.view.options.displayUnits.area??a(this.view)}get updating(){return(this._areaVisualization?.updating??!0)||(this._controller?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(e){super.visible=e}async place(e){return this._tool.place(e)}};e([r()],p.prototype,`_areaVisualization`,void 0),e([r()],p.prototype,`_controller`,void 0),e([r()],p.prototype,`_manipulatorVisualization`,void 0),e([r()],p.prototype,`_sketchVisualization`,void 0),e([r()],p.prototype,`_tool`,void 0),e([r({constructOnly:!0})],p.prototype,`analysis`,void 0),e([r()],p.prototype,`manipulatorGraphic`,null),e([r()],p.prototype,`manipulatorGraphicsLayer`,null),e([r()],p.prototype,`sketchGraphicsLayer`,null),e([r({readOnly:!0})],p.prototype,`result`,null),e([r({type:f,nonNullable:!0})],p.prototype,`snappingOptions`,void 0),e([r({readOnly:!0})],p.prototype,`type`,void 0),e([r({readOnly:!0})],p.prototype,`unit`,null),e([r({readOnly:!0})],p.prototype,`updating`,null),p=e([i(`esri.views.2d.analysis.AreaMeasurementAnalysisView2D`)],p);const m=p;export{m as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{toAdaptiveLengthUnitForArea as t,toAdaptiveAreaUnit as n}from"../../../core/quantity.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import o from"./AnalysisView2D.js";import{AreaMeasurementAreaVisualization as s}from"./AreaMeasurement/AreaMeasurementAreaVisualization.js";import{AreaMeasurementController as c}from"./AreaMeasurement/AreaMeasurementController.js";import{AreaMeasurementManipulatorVisualization as l}from"./AreaMeasurement/AreaMeasurementManipulatorVisualization.js";import{AreaMeasurementSketchVisualization as u}from"./AreaMeasurement/AreaMeasurementSketchVisualization.js";import{AreaMeasurementTool as d}from"./AreaMeasurement/AreaMeasurementTool.js";import f from"../../interactive/snapping/SnappingOptions.js";let p=class extends o{constructor(e){super(e),this.analysis=null,this.snappingOptions=new f,this.type=`area-measurement-view-2d`}initialize(){let{view:e}=this;this._areaVisualization=new s({view:e,measurementViewData:this}),this._controller=new c({view:e,measurementViewData:this}),this._manipulatorVisualization=new l({view:e,measurementViewData:this}),this._sketchVisualization=new u({view:e,measurementViewData:this}),this._tool=new d({view:e,measurementViewData:this})}destroy(){this._areaVisualization?.destroy(),this._controller?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get result(){let e=this._controller?.result;if(!e)return e;let{unit:r}=this,{area:i,display:a,mode:o,perimeter:s}=e;return{area:i?n(i,r):null,display:a,mode:o,perimeter:s?t(s,r):null}}get unit(){return this.analysis.unit??this.view.options.displayUnits.area??a(this.view)}get updating(){return(this._areaVisualization?.updating??!0)||(this._controller?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(e){super.visible=e}async place(e){return this.interactive=!0,this._tool.place(e)}};e([r()],p.prototype,`_areaVisualization`,void 0),e([r()],p.prototype,`_controller`,void 0),e([r()],p.prototype,`_manipulatorVisualization`,void 0),e([r()],p.prototype,`_sketchVisualization`,void 0),e([r()],p.prototype,`_tool`,void 0),e([r({constructOnly:!0})],p.prototype,`analysis`,void 0),e([r()],p.prototype,`manipulatorGraphic`,null),e([r()],p.prototype,`manipulatorGraphicsLayer`,null),e([r()],p.prototype,`sketchGraphicsLayer`,null),e([r({readOnly:!0})],p.prototype,`result`,null),e([r({type:f,nonNullable:!0})],p.prototype,`snappingOptions`,void 0),e([r({readOnly:!0})],p.prototype,`type`,void 0),e([r({readOnly:!0})],p.prototype,`unit`,null),e([r({readOnly:!0})],p.prototype,`updating`,null),p=e([i(`esri.views.2d.analysis.AreaMeasurementAnalysisView2D`)],p);const m=p;export{m as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as n}from"../../../../core/colorUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{ignoreAbortErrors as i,isAborted as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import d from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as f}from"../../../analysis/ExclusiveOperationManager.js";import{bindViewToolOptions as p}from"../../../interactive/options/bindViewToolOptions.js";import m from"../../../../widgets/Sketch/SketchViewModel.js";function h(e){return e?.type===`polyline`}let g=class extends t{constructor(e){super(e),this._invisibleLineSymbol=new d({color:null,width:0}),this._operationManager=new f,this._updatingHandles=new u}initialize(){this._sketchViewModel=new m({defaultCreateOptions:{mode:`click`},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:`none`,shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},updateOnGraphicClick:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{t
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{multiplyOpacity as n}from"../../../../core/colorUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{ignoreAbortErrors as i,isAborted as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import d from"../../../../symbols/SimpleLineSymbol.js";import{ExclusiveOperationManager as f}from"../../../analysis/ExclusiveOperationManager.js";import{bindViewToolOptions as p}from"../../../interactive/options/bindViewToolOptions.js";import m from"../../../../widgets/Sketch/SketchViewModel.js";function h(e){return e?.type===`polyline`}let g=class extends t{constructor(e){super(e),this._invisibleLineSymbol=new d({color:null,width:0}),this._operationManager=new f,this._updatingHandles=new u}initialize(){this._sketchViewModel=new m({defaultCreateOptions:{mode:`click`},defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{edgeOperation:`none`,shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},updateOnGraphicClick:!1,view:this.view}),this.addHandles([o(()=>({interactive:this.measurementViewData.interactive,visible:this.measurementViewData.visible}),({interactive:e,visible:t})=>{!t||!e?this._operationManager.stop():this._analysis.geometry&&this._operationManager.currentOperationType!==`place`&&this.reshape().catch(()=>{})}),o(()=>this.measurementViewData.analysis.geometry,e=>{e||(this._operationManager.stop(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll())}),o(()=>this.measurementViewData.snappingOptions,e=>{this._sketchViewModel&&(this._sketchViewModel.snappingOptions=e)},s),p(this._sketchViewModel.sketchOptions,()=>this.view.options,()=>({values:{displayUnits:{length:this._analysis.unit}}})),o(()=>this.view.effectiveTheme.accentColor,e=>{this._lineSymbol=new d({color:n(e,.3),width:2})},s)])}destroy(){this._invisibleLineSymbol.destroy(),this._lineSymbol?.destroy(),this._operationManager.destroy(),this._sketchViewModel?.destroy(),this._updatingHandles.destroy()}get state(){if(!this.measurementViewData.visible||!this._operationManager.currentOperationType)return`idle`;switch(this._operationManager.currentOperationType){case`place`:return`placing`;case`reshape`:return`reshaping`}}get updating(){return!this._sketchViewModel||this._sketchViewModel.updating||this._updatingHandles.updating}async place(e){return this._operationManager.start(`place`,async t=>{if(!this._sketchViewModel||!this.measurementViewData.sketchGraphicsLayer)return;let n=this._analysis.clone(),o=this._sketchViewModel.on(`create`,e=>{switch(e.state){case`start`:case`active`:{let t=e.graphic?.geometry;t?.type===`polyline`&&(this._analysis.geometry=t);break}case`cancel`:case`complete`:t.stop(),i(this.reshape())}});t.handles.push(o,r(()=>{o.remove(),this._sketchViewModel?.cancel(),this.measurementViewData.sketchGraphicsLayer?.removeAll();let r=this._analysis;if(!r.valid)return r.clear(),t.reject();if(a(e)||n.equals(r))return t.reject();t.resolve({})})),this._sketchViewModel.activeLineSymbol=this._invisibleLineSymbol,this._sketchViewModel.polylineSymbol=this._invisibleLineSymbol,this._sketchViewModel.layer=this.measurementViewData.sketchGraphicsLayer,this._updatingHandles.consumePromise(i(this._sketchViewModel.create(`polyline`)))},e)}async reshape(e){return this._operationManager.start(`reshape`,async t=>{if(!this._sketchViewModel)return;let n=()=>!this._lineSymbol||!this._sketchViewModel||!this.measurementViewData.manipulatorGraphic||!this.measurementViewData.manipulatorGraphicsLayer?Promise.resolve():(this._sketchViewModel.activeLineSymbol=null,this._sketchViewModel.polylineSymbol=this._lineSymbol,this._sketchViewModel.layer=this.measurementViewData.manipulatorGraphicsLayer,this._updatingHandles.addPromise(i(this._sketchViewModel.update(this.measurementViewData.manipulatorGraphic,{tool:`reshape`})))),o=this._sketchViewModel.on(`update`,e=>{let r=e.graphics[0]?.geometry;this._analysis.geometry=h(r)?r:null,e.state===`complete`&&(this.measurementViewData.interactive?n():t.stop())});t.handles.push(o,r(()=>{if(o.remove(),this._sketchViewModel?.cancel(),a(e))return t.reject();t.resolve()})),await n()},e)}get _analysis(){return this.measurementViewData.analysis}};e([c()],g.prototype,`_sketchViewModel`,void 0),e([c()],g.prototype,`measurementViewData`,void 0),e([c()],g.prototype,`state`,null),e([c()],g.prototype,`updating`,null),e([c()],g.prototype,`view`,void 0),g=e([l(`esri.views.2d.analysis.DistanceMeasurement.DistanceMeasurementTool`)],g);export{g as DistanceMeasurementTool};
|
|
@@ -97,6 +97,8 @@ export default abstract class DistanceMeasurementAnalysisView2D extends Analysis
|
|
|
97
97
|
/**
|
|
98
98
|
* Starts an interactive placement operation to create a new [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DistanceMeasurementAnalysis/).
|
|
99
99
|
*
|
|
100
|
+
* Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/2d/analysis/DistanceMeasurementAnalysisView2D/#interactive) to `true`.
|
|
101
|
+
*
|
|
100
102
|
* The placement operation will finish when the user presses the escape key, double taps, or double clicks.
|
|
101
103
|
* To stop the placing programmatically, pass an abort signal as an argument when calling the method.
|
|
102
104
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{toAdaptiveLengthUnit as t}from"../../../core/quantity.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as i}from"../../../support/getDefaultUnitForView.js";import a from"./AnalysisView2D.js";import{DistanceMeasurementController as o}from"./DistanceMeasurement/DistanceMeasurementController.js";import{DistanceMeasurementLineVisualization as s}from"./DistanceMeasurement/DistanceMeasurementLineVisualization.js";import{DistanceMeasurementManipulatorVisualization as c}from"./DistanceMeasurement/DistanceMeasurementManipulatorVisualization.js";import{DistanceMeasurementSketchVisualization as l}from"./DistanceMeasurement/DistanceMeasurementSketchVisualization.js";import{DistanceMeasurementTool as u}from"./DistanceMeasurement/DistanceMeasurementTool.js";import d from"../../interactive/snapping/SnappingOptions.js";let f=class extends a{constructor(e){super(e),this.analysis=null,this.snappingOptions=new d,this.type=`distance-measurement-view-2d`}initialize(){let{view:e}=this;this._lineVisualization=new s({view:e,measurementViewData:this}),this._controller=new o({view:e,measurementViewData:this}),this._manipulatorVisualization=new c({view:e,measurementViewData:this}),this._sketchVisualization=new l({view:e,measurementViewData:this}),this._tool=new u({view:e,measurementViewData:this})}destroy(){this._lineVisualization?.destroy(),this._controller?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get result(){let e=this._controller?.result;return e&&{...e,length:t(e.length,this.unit)}}get unit(){return this.analysis.unit??this.view.options.displayUnits.length??i(this.view)}get updating(){return(this._controller?.updating??!0)||(this._lineVisualization?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(e){super.visible=e}async place(e){return this._tool.place(e)}};e([n()],f.prototype,`_lineVisualization`,void 0),e([n()],f.prototype,`_controller`,void 0),e([n()],f.prototype,`_manipulatorVisualization`,void 0),e([n()],f.prototype,`_sketchVisualization`,void 0),e([n()],f.prototype,`_tool`,void 0),e([n({constructOnly:!0})],f.prototype,`analysis`,void 0),e([n()],f.prototype,`manipulatorGraphic`,null),e([n()],f.prototype,`manipulatorGraphicsLayer`,null),e([n()],f.prototype,`sketchGraphicsLayer`,null),e([n({readOnly:!0})],f.prototype,`result`,null),e([n({type:d,nonNullable:!0})],f.prototype,`snappingOptions`,void 0),e([n({readOnly:!0})],f.prototype,`type`,void 0),e([n({readOnly:!0})],f.prototype,`unit`,null),e([n({readOnly:!0})],f.prototype,`updating`,null),f=e([r(`esri.views.2d.analysis.DistanceMeasurementAnalysisView2D`)],f);const p=f;export{p as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{toAdaptiveLengthUnit as t}from"../../../core/quantity.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as i}from"../../../support/getDefaultUnitForView.js";import a from"./AnalysisView2D.js";import{DistanceMeasurementController as o}from"./DistanceMeasurement/DistanceMeasurementController.js";import{DistanceMeasurementLineVisualization as s}from"./DistanceMeasurement/DistanceMeasurementLineVisualization.js";import{DistanceMeasurementManipulatorVisualization as c}from"./DistanceMeasurement/DistanceMeasurementManipulatorVisualization.js";import{DistanceMeasurementSketchVisualization as l}from"./DistanceMeasurement/DistanceMeasurementSketchVisualization.js";import{DistanceMeasurementTool as u}from"./DistanceMeasurement/DistanceMeasurementTool.js";import d from"../../interactive/snapping/SnappingOptions.js";let f=class extends a{constructor(e){super(e),this.analysis=null,this.snappingOptions=new d,this.type=`distance-measurement-view-2d`}initialize(){let{view:e}=this;this._lineVisualization=new s({view:e,measurementViewData:this}),this._controller=new o({view:e,measurementViewData:this}),this._manipulatorVisualization=new c({view:e,measurementViewData:this}),this._sketchVisualization=new l({view:e,measurementViewData:this}),this._tool=new u({view:e,measurementViewData:this})}destroy(){this._lineVisualization?.destroy(),this._controller?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get result(){let e=this._controller?.result;return e&&{...e,length:t(e.length,this.unit)}}get unit(){return this.analysis.unit??this.view.options.displayUnits.length??i(this.view)}get updating(){return(this._controller?.updating??!0)||(this._lineVisualization?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(e){super.visible=e}async place(e){return this.interactive=!0,this._tool.place(e)}};e([n()],f.prototype,`_lineVisualization`,void 0),e([n()],f.prototype,`_controller`,void 0),e([n()],f.prototype,`_manipulatorVisualization`,void 0),e([n()],f.prototype,`_sketchVisualization`,void 0),e([n()],f.prototype,`_tool`,void 0),e([n({constructOnly:!0})],f.prototype,`analysis`,void 0),e([n()],f.prototype,`manipulatorGraphic`,null),e([n()],f.prototype,`manipulatorGraphicsLayer`,null),e([n()],f.prototype,`sketchGraphicsLayer`,null),e([n({readOnly:!0})],f.prototype,`result`,null),e([n({type:d,nonNullable:!0})],f.prototype,`snappingOptions`,void 0),e([n({readOnly:!0})],f.prototype,`type`,void 0),e([n({readOnly:!0})],f.prototype,`unit`,null),e([n({readOnly:!0})],f.prototype,`updating`,null),f=e([r(`esri.views.2d.analysis.DistanceMeasurementAnalysisView2D`)],f);const p=f;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{onePointInPixels as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{maxTileCoordValue as n}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as i,tileSize as a}from"../../../definitions.js";import{AAnimatedMeshWriter as o}from"./AnimatedMeshWriter.js";import{angle as s,sizing as c,animationPointerAndBaseSizeAndReferenceSize as l,uv as u,offset as d,pos as f,bitset as p,id as m,lineLength as h,value1Position2Value2 as g,zoomRange as _}from"./attributes.js";import{clipWithVertexInterpolation as v}from"./clipping.js";import{createComputedAnimatedMeshParams as y}from"./ComputedAnimatedParams.js";function b(e,t){let n=[],r=0,i=0;for(;e.nextPath();){i=t?0:r,e.nextPoint();let{x:a,y:o}=e,s=[{x:a,y:o,attributes:[i]}];for(;e.nextPoint();){let{x:t,y:n}=e,r=t-a,c=n-o,l=Math.sqrt(r*r+c*c);i+=l,s.push({x:t,y:n,attributes:[i]}),a=t,o=n}s.length>1&&n.push(s),r=i}return{lineData:n,totalDistance:r}}class x extends o{get vertexSpec(){return{createComputedParams:y,optionalAttributes:{zoomRange:_,value1Position2Value2:g,lineLength:h},attributes:{id:m,bitset:p,pos:f,offset:d.marker,uv:u.marker,animationPointerAndBaseSizeAndReferenceSize:l,sizing:c,angle:s}}}_write(e,{target:n,effect:r}){let i=r?.geometry,{textureBinding:a}=this.evaluatedMeshParams.sprite;e.recordStart(this.instanceId,this.attributeLayout,a);let o=n.getDisplayId();if(this.shift&&n.geometryType===`esriGeometryPolyline`){if(!i){let r=t.fromFeatureSetReaderCIM(n);r&&this._writeParticles(e,n,r)}}else if(this.evaluatedMeshParams.placement!=null)this._writePlacedMarkers(e,n);else if(n.geometryType===`esriGeometryPolygon`){let t=n.readCentroidForDisplay();if(!t)return;let[r,i]=t.coords;this._writeQuad(e,o,r,i)}else if(n.geometryType===`esriGeometryPoint`){let t=n.readXForDisplay(),r=n.readYForDisplay();this._writeQuad(e,o,t,r)}else{let t=n.readGeometryForDisplay();t&&t.forEachVertex((t,n)=>{this._writeQuad(e,o,t,n)})}e.recordEnd()}_writePlacedMarkers(i,a){let o=t.fromFeatureSetReaderCIM(a)?.clone();if(!o)return;let s=r.getPlacement(o,-1,this.evaluatedMeshParams.placement,e,i.id);if(!s)return;let c=a.getDisplayId(),l=s.next(),u=null;for(;l!=null;){let e=l.tx,t=-l.ty;if(Math.abs(e)>n||Math.abs(t)>n){l=s.next();continue}let r=-l.getAngle();i.recordBounds(e,t,64,64),this.shift?u&&this._writeQuad(i,c,u[0],u[1],void 0,r):this._writeQuad(i,c,e,t,void 0,r),u=[e,t],l=s.next()}}_writeParticles(e,t,n){let r=t.getDisplayId(),{placement:i}=this.evaluatedMeshParams,o=i?.placePerPart??!1,{lineData:s,totalDistance:c}=b(n,o);if(s.length===0)return;let l=this.evaluatedMeshParams.baseSize,u={x:-l,y:-l,width:a+2*l,height:a+2*l},d=s.flatMap(e=>{let t=o?e[e.length-1].attributes[0]:c;return S(v(e,u),t)});for(let{particles:t,lineLength:n}of d){let a=i=>{for(let a of t){let{a:t,b:o}=a;this._writeQuad(e,r,t.position[0],t.position[1],[t.distance-i,o.position[0],o.position[1],o.distance-i],this.evaluatedMeshParams.angleToLine?Math.atan2(t.direction[1],t.direction[0]):0,n,!0)}};if(!i||`placementTemplate`in i||i.type===`CIMMarkerPlacementOnVertices`){let e;if(i&&i.type!==`CIMMarkerPlacementOnVertices`)e=i.placementTemplate;else{e=[0];for(let n of t){let{a:t,b:r}=n,i=t.position[0]-r.position[0],a=t.position[1]-r.position[1],o=Math.sqrt(i*i+a*a);e.push(o)}}let r=-1*n;for(;r<2*n;)for(let t of e)r+=t,a(r)}else i.type===`CIMMarkerPlacementAtExtremities`?i.extremityPlacement===`JustBegin`?a(1):i.extremityPlacement===`JustEnd`?(a(n-1),a(-1)):i.extremityPlacement===`Both`&&(a(1),a(n-1)):i.type===`CIMMarkerPlacementOnLine`&&(i.relativeTo===`LineBeginning`?a(1):i.relativeTo===`LineEnd`?(a(n-1),a(-1)):i.relativeTo===`LineMiddle`&&a(n/2))}}_writeQuad(e,t,n,r,a,o=0,s=0,c=!1){let{rect:l}=this.evaluatedMeshParams.sprite,u=l.x+i,d=l.y+i,f=l.x+l.width-i,p=l.y+l.height-i,m=e.vertexCount();c||e.recordBounds(n,r,64,64);let h={texXmin:u,texYmin:d,texXmax:f,texYmax:p,value1Position2Value2:a,angle:o,lineLength:s};for(let i=0;i<4;i++)this._writeVertex(e,t,n,r,h);e.indexEnsureSize(6),e.indexWrite(m),e.indexWrite(m+1),e.indexWrite(m+2),e.indexWrite(m+1),e.indexWrite(m+3),e.indexWrite(m+2)}}function S(e,t){let n=[];for(let r of e){let e=[],{x:i,y:a}=r[0],o=r[0].attributes[0];for(let t=1;t<r.length;t++){let{x:n,y:s}=r[t],c=r[t].attributes[0],l=n-i,u=s-a,d=Math.sqrt(l*l+u*u);if(d>0)l/=d,u/=d;else continue;e.push({a:{position:[i,a],distance:o,direction:[l,u]},b:{position:[n,s],distance:c,direction:[l,u]}}),i=n,a=s,o=c}n.push({particles:e,lineLength:t})}return n}class C extends x{constructor(){super(...arguments),this.shift=!1}}class w extends x{constructor(){super(...arguments),this.shift=!0}}export{C as AnimatedMarkerMeshWriter,w as AnimatedMarkerShiftMeshWriter,b as convertToLineData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as
|
|
2
|
+
import{pt2px as e,onePointInPixels as t}from"../../../../../../../core/screenUtils.js";import{identity as n,translate as r,rotate as i}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as s}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as c}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as l}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as u}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as d,processColorInput as f,getMinMaxZoom as p,getBitMask as m}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as g}from"./markerConstants.js";import{MeshWriter as _}from"../mesh/MeshWriter.js";import{DataType as v}from"../../../../../../webgl/enums.js";const y=128/Math.PI;function b(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function x(e){return b(e*y,256)}function S(e,t,o,s,c=!1){let l=a(),u=c?1:-1;return n(l),(t||o)&&r(l,l,[t,-o]),s&&i(l,l,u*.017453292519944444*-s),l}const C={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:v.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>p(e,t)}},attributes:{pos:{type:v.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:v.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:v.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:n,overrideOutlineColor:r,colorLocked:i})=>{let a=0;return e.sdf&&(a|=m(g.bitset.isSDF)),t===1&&(a|=m(g.bitset.isMapAligned)),n&&(a|=m(g.bitset.scaleSymbolsProportionally)),r&&(a|=m(g.bitset.overrideOutlineColor)),i&&(a|=m(g.bitset.colorLocked)),a}},offset:{type:v.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:n,anchorX:r,anchorY:i,offsetX:a,offsetY:s,rotateClockwise:c})=>{let l=S(0,a,s,-e,c),u=-(.5+r)*t,d=-(.5-i)*n,f=[u,d],p=[u+t,d],m=[u,d+n],h=[u+t,d+n];return o(f,f,l),o(p,p,l),o(m,m,l),o(h,h,l),[f,p,m,h]}}},textureUV:{type:v.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:n,texYmin:r})=>[[t,r],[e,r],[t,n],[e,n]]}},color:{type:v.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>f(e)},outlineColor:{type:v.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>f(e)},sizing:{type:v.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:n,referenceSize:r})=>[d(Math.max(e,t),128),d(n,128),d(r,128),0]},placementAngle:{type:v.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>x(e)},sdfDecodeCoeff:{type:v.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class w extends _{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=C}get _requiresPerFeaturePacking(){return this._getPointSymbolCalloutMarkerEffect()!=null}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}getLocalCalloutReferenceInfo(){let e=this.evaluatedMeshParams.boundsInfo;if(!e)return;let t=e.size/2;return{anchor:{x:0,y:0},bodyBounds:{xmin:e.offsetX-t,ymin:e.offsetY-t,xmax:e.offsetX+t,ymax:e.offsetY+t},bodyBoundsUseReferenceScale:!0}}getCalloutCollisionBounds(e){if(this._getPointSymbolCalloutMarkerEffect())return this.evaluatedMeshParams.getPointSymbolCalloutBounds(e.bodyBounds)}_prepareEvaluatedMeshParams(t,n,r,i){let a=this._getPointSymbolCalloutMarkerEffect();if(!a)return;let o=i?.effect?.referenceBounds;if(!o){t.resetSizeOverride();return}let s=o.xmax-o.xmin,c=o.ymax-o.ymin;t.applyPointSymbolCalloutBackgroundScale(a.backgroundScale,s,c,e(a.gap??0),a.contentWidthRatio,a.contentHeightRatio,a.contentRequiresRadialFit)}_write(e,{target:t,effect:n,scaleFactor:r}){let i=n?.geometry,a=this.evaluatedMeshParams.sprite?.textureBinding,o=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,a);let s=this.evaluatedMeshParams.minPixelBuffer,u=Math.max(this.evaluatedMeshParams.computedWidth,s),d=Math.max(this.evaluatedMeshParams.computedHeight,s),f=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,p=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,m=this.evaluatedMeshParams.offsetX+f,h=-this.evaluatedMeshParams.offsetY+p;if(this.evaluatedMeshParams.placement!=null){let n=null;if(i!=null){let e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight)*(r??1);if(n=c(i,2*e,!1),n===null)return}this._writePlacedMarkers(e,t,n,u,d)}else if(i?.nextPath()){i.nextPoint();let t=i.x,n=i.y;e.recordBounds(t+m,n+h,u,d),this._writeQuad(e,o,t,n)}else if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;e.recordBounds(r+m,i+h,u,d),this._writeQuad(e,o,r,i)}else if(t.geometryType===`esriGeometryPoint`){let n=t.readXForDisplay(),r=t.readYForDisplay();e.recordBounds(n+m,r+h,u,d),this._writeQuad(e,o,n,r)}else t.readGeometryForDisplay()?.forEachVertex((t,n)=>{e.recordBounds(t+m,n+h,u,d),!(Math.abs(t)>l||Math.abs(n)>l)&&this._writeQuad(e,o,t,n)});e.recordEnd()}_writePlacedMarkers(e,n,r,i,a){let o=r??s.fromFeatureSetReaderCIM(n);if(!o)return;let c=u.getPlacement(o,-1,this.evaluatedMeshParams.placement,t,e.id);if(!c)return;let d=n.getDisplayId(),f=c.next(),p=this.evaluatedMeshParams.offsetX,m=-this.evaluatedMeshParams.offsetY;for(;f!=null;){let t=f.tx,n=-f.ty;if(Math.abs(t)>l||Math.abs(n)>l){f=c.next();continue}let r=-f.getAngle();e.recordBounds(t+p,n+m,i,a),this._writeQuad(e,d,t,n,r),f=c.next()}}_writeQuad(e,t,n,r,i){let a=e.vertexCount(),o=i==null?null:{placementAngle:i};this._writeVertex(e,t,n,r,o),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}_getPointSymbolCalloutMarkerEffect(){for(let{effect:e}of this.effectInfos??[])if(e.type===`CIMPointSymbolCallout`&&e.part===`marker`)return e}}export{w as MarkerMeshWriter,C as MarkerVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e,__param as t}from"tslib";import{location as n,option as r,input as i}from"../../GraphShaderModule.js";import{Vec4 as a,Vec2 as o,Float as s,step as c,min as l,ifElse as u,greaterThan as d,max as f,Vec3 as p,
|
|
2
|
+
import{__decorate as e,__param as t}from"tslib";import{location as n,option as r,input as i}from"../../GraphShaderModule.js";import{Vec4 as a,Vec2 as o,Float as s,step as c,min as l,ifElse as u,greaterThan as d,max as f,Vec3 as p,cond as m,lessThanEqual as h,length as g,clamp as _}from"../../graph/glsl.js";import{BaseHittestVertexInput as v,FeatureVertexInput as y,AFeatureShader as b,FeatureFragmentInput as x}from"./AFeatureShader.js";import{noHit as S,trueHit as C,epsilon as w,thinLineWidthFactor as T,thinLineHalfWidth as E}from"./constants.js";import{distPointSegment as D,isRectHittest as O,hittestMarkerRect as k,isPolygonHittest as A,hittestPolygon as j,isPointHittest as M}from"./hittestUtils.js";import{VisualVariableColor as N}from"./VisualVariableColor.js";import{VisualVariableOpacity as P}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as F}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as I}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as L}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as R}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as z,getVisualVariableOpacity as B,hasVisualVariableSize as V,getVisualVariableSize as H}from"./vvUtils.js";class U extends y{}e([n(3,a)],U.prototype,`color`,void 0),e([n(4,o)],U.prototype,`offset`,void 0),e([n(5,o)],U.prototype,`normal`,void 0),e([n(6,s)],U.prototype,`halfWidth`,void 0),e([n(7,s)],U.prototype,`referenceHalfWidth`,void 0),e([n(8,o)],U.prototype,`zoomRange`,void 0);class W extends x{}function G(e){return f(new s(T).multiply(c(e,new s(E))),new s(1))}function K(e,t){let{halfWidth:n,normal:r}=e,i=G(n),a=g(r).multiply(n);return _(i.multiply(n.subtract(a)).divide(t.add(i).subtract(new s(1))),new s(0),new s(1))}function q(e,t,n){let{halfWidth:r,referenceHalfWidth:i}=t;if(V(e)){let t=new s(2).multiply(i),a=H(e,n,t),o=new s(.5).multiply(a),c=new s(w);return m([h(r,c),o],[h(i,c),r],[!0,r.divide(f(i,c)).multiply(o)])}return r}function J(e,t){let{id:n,offset:r,pos:i,normal:o,zoomRange:l}=t,u=e.getFeatureId(n,t.bitset),d=e.view.getDisplayViewMat3(),m=e.tile.getDisplayViewScreenMat3(e.view),h=z(e,u,t.color),g=B(e,u),_=q(e,t,u),v=new s(.5).multiply(e.view.getAntialiasing()),y=f(_.add(v),new s(.45)).add(new s(.1).multiply(v)),b=G(y).multiply(y).multiply(r).multiply(e.tileInfo.scaleFactor),x=e.getLabelOffset(b,t.bitset),S=d.multiply(new p(x,new s(0))),C=m.multiply(new p(e.getLabelPosition(i,n,t.bitset),new s(1))).add(S),w=new s(2).multiply(c(_,new s(0))).add(e.clip(n,t.bitset,l)),T=new a(C.xy,w,1);return{color:h,opacity:g,halfWidth:y,normal:o,scaledOffset:b,scaledHalfWidth:_,glPosition:new a(T.xy,w,1)}}function Y(e,t){let{opacity:n,color:r}=e,i=K(e,t);return n.multiply(r).multiply(i)}class X extends b{constructor(){super(...arguments),this.type=`LineShader`,this.computeAttributes={pos:[`nextPos1`,`nextPos2`]}}vertex(e,t){let n=J(this,e);return{...n,...this.maybeRunHittest(e,t,n.halfWidth)}}fragment(e){let t=Y(e,this.view.getAntialiasing());return this.getFragmentOutput(t,e)}hittest(e,t,n){let{pos0:r,pos1:i,pos2:a}=this.computeHittestTriangle(e,t,null),{distance:o,smallSymbolDistance:f,smallSymbolSizeThreshold:p}=this.hittestRequest,m=c(n,p.multiply(.5)).multiply(o.subtract(f)),h=this.hittestRequest.position,g=l(D(h,r,i),D(h,r,a)).subtract(n).add(m);return u(M(this.hittestRequest),u(d(g,o),new s(S),new s(C)),()=>u(O(this.hittestRequest),k({pos0:r,pos1:i,pos2:a},this.hittestRequest.rect.xy,this.hittestRequest.rect.zw),u(A(this.hittestRequest),j({pos0:r,pos1:i,pos2:a},this.hittestRequest.viewSize,this.hittestMaskTexture),new s(S))))}}e([r(N)],X.prototype,`visualVariableColor`,void 0),e([r(P)],X.prototype,`visualVariableOpacity`,void 0),e([r(F)],X.prototype,`visualVariableSizeMinMaxValue`,void 0),e([r(I)],X.prototype,`visualVariableSizeScaleStops`,void 0),e([r(L)],X.prototype,`visualVariableSizeStops`,void 0),e([r(R)],X.prototype,`visualVariableSizeUnitValue`,void 0),e([t(0,i(U)),t(1,i(v))],X.prototype,`vertex`,null),e([t(0,i(W))],X.prototype,`fragment`,null);export{W as LineFragmentInput,X as LineShader,U as LineVertexInput,K as getLineAntialiasing,Y as getLineFragmentColor,G as getLineThinFactor,J as getLineVertexData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e,__param as t}from"tslib";import{
|
|
2
|
+
import{__decorate as e,__param as t}from"tslib";import{onePointInPixels as n}from"../../../../../../../core/screenUtils.js";import{dashSdfRasterizationScale as r,dashSdfDistanceNormalization as i}from"../../../../../../../symbols/cim/constants.js";import{location as a,uniform as o,texture as s,input as c}from"../../GraphShaderModule.js";import{Float as l,Vec2 as u,Vec4 as d,Sampler2D as f,max as p,fract as m,mix as h,texture2D as g,cond as _,equal as v,sqrt as y,pow as b,clamp as x,ifElse as S,greaterThan as C,dot as w}from"../../graph/glsl.js";import{BaseHittestVertexInput as T}from"./AFeatureShader.js";import{bitsetLineScaleDash as E,bitsetLineIsSdf as D,bitsetGenericConsiderAlphaOnly as O}from"./constants.js";import{LineVertexInput as k,LineShader as A,getLineVertexData as j,getLineAntialiasing as M,LineFragmentInput as N}from"./LineShader.js";import{MosaicInfo as P}from"./MosaicInfo.js";import{getBit as F,rgba2float as I}from"./utils.js";class L extends k{}e([a(9,l)],L.prototype,`accumulatedDistance`,void 0),e([a(10,u)],L.prototype,`segmentDirection`,void 0),e([a(11,l)],L.prototype,`offsetAlongLine`,void 0),e([a(12,l)],L.prototype,`capType`,void 0),e([a(13,d)],L.prototype,`tlbr`,void 0);class R extends N{}class z extends A{constructor(){super(...arguments),this.type=`TexturedLineShader`}_getDistanceRatio(e,t){let r=F(e.bitset,E);return r.multiply(p(t,new l(.25)).multiply(new l(2))).add(new l(1).subtract(r).multiply(n))}_getSDFAlpha(e){let{halfWidth:t,normal:n,tlbr:a,patternSize:o,accumulatedDistance:s,offsetAlongLine:c,dashToPx:f,capType:S}=e,C=o.x.divide(r).multiply(f),w=m(s.add(c).divide(C)),T=h(a.xy,a.zw,new u(w,.5)),E=I(g(this.mosaicTexture,T)).multiply(2).subtract(1).multiply(i).multiply(f),D=n.y.multiply(t),O=_([v(S,new l(1)),E.subtract(t)],[v(S,new l(2)),y(b(p(E,new l(0)),new l(2)).add(D.multiply(D))).subtract(t)],[!0,E]),k=x(new l(.25).subtract(O),new l(0),new l(1));return new d(k)}_getPatternColor(e){let{halfWidth:t,normal:n,color:r,accumulatedDistance:i,patternSize:a,sampleAlphaOnly:o,tlbr:s}=e,c=a.y.multiply(new l(2).multiply(t).divide(a.x)),f=m(i.divide(c)),p=new l(.5).multiply(n.y).add(new l(.5)),_=h(s.xy,s.zw,new u(p,f)),v=g(this.mosaicTexture,_);return this.visualVariableColor!=null&&(v=S(C(o,new l(.5)),new d(r.a),r)),v}vertex(e,t){let{segmentDirection:n,tlbr:r,bitset:i}=e,a=j(this,e),o=e.accumulatedDistance.divide(this.tile.getDisplayZoomFactor(this.tileInfo)).add(w(n,a.scaledOffset)),s=new u(r.z.subtract(r.x),r.w.subtract(r.y)),c=r.divide(this.mosaicInfo.size.xyxy),d=F(i,D),f=F(i,O),p=S(C(d,new l(.5)),this._getDistanceRatio(e,a.scaledHalfWidth),new l(1));return{...a,tlbr:c,patternSize:s,accumulatedDistance:o,isSDF:d,sampleAlphaOnly:f,dashToPx:p,offsetAlongLine:e.offsetAlongLine,capType:e.capType,...this.maybeRunHittest(e,t,a.halfWidth)}}fragment(e){let{color:t,opacity:n,isSDF:r}=e,i=M(e,this.view.getAntialiasing()),a=S(C(r,new l(.5)),this._getSDFAlpha(e),this._getPatternColor(e)),o=t.multiply(n).multiply(i).multiply(a);return this.getFragmentOutput(o,e)}}e([o(P)],z.prototype,`mosaicInfo`,void 0),e([s(f)],z.prototype,`mosaicTexture`,void 0),e([t(0,c(L)),t(1,c(T))],z.prototype,`vertex`,null);export{R as TexturedLineFragmentInput,z as TexturedLineShader,L as TexturedLineVertexInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../../../../../../core/mathUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as n}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as r}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as i}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as a,getYDirection as o}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as s,maxLineHeightRatio as c,minLineHeightRatio as l,labelPlacementOffsetPadding as u,maxTextLineWidth as d,minTextLineWidth as f,magicLabelLineHeight as p,packDegreesU8 as m}from"../../../definitions.js";import{shapeTextResource as h,shapeTextResourceForMultipoint as g}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as _,getMinMaxZoom as v,packBitset as y}from"../fill/meshWriterUtils.js";import{MeshWriter as b}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as x,bitsetTextIsMapAligned as S}from"../shaders/constants.js";import{TextMeshTransformProps as C}from"./TextParams.js";import{DataType as w}from"../../../../../../webgl/enums.js";const T=28,E=[4,4],D=[16,4],O={topLeft:D,topRight:D,bottomLeft:D,bottomRight:D};function k(n){return n==null?d:e(t(n),f,d)}function A(t,n){return t/24*p*e(n,l,c)}const j=[4,2],M=[4,6],N={topLeft:j,topRight:j,bottomLeft:M,bottomRight:M},P={topLeft:j,topRight:M,bottomLeft:j,bottomRight:M},F={topLeft:M,topRight:M,bottomLeft:E,bottomRight:E},I={topLeft:E,topRight:E,bottomLeft:M,bottomRight:M},L={topLeft:M,topRight:E,bottomLeft:M,bottomRight:E},R={topLeft:E,topRight:M,bottomLeft:E,bottomRight:M};function z(e){return e.useBackgroundCallout?{backgroundColor:null,borderLineColor:null,borderLineSize:0}:{backgroundColor:e.boxBackgroundColor??e.backgroundColor??null,borderLineColor:e.boxBorderLineColor??e.borderLineColor??null,borderLineSize:e.boxBorderLineSize>0?e.boxBorderLineSize:e.borderLineWidth??0}}const B={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:w.UNSIGNED_SHORT,count:2,packPrecisionFactor:s,packTessellation:({minZoom:e,maxZoom:t})=>[e||0,t||28]},clipAngle:{type:w.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:e})=>H(e||0)},referenceSymbol:{type:w.BYTE,count:4,packTessellation:(e,n)=>{let r=e.isLineLabel||!e.referenceBounds,i=a(r?`center`:n.horizontalAlignment),s=o(r?`middle`:n.verticalAlignment),{offsetX:c,offsetY:l,size:u}=r?{offsetX:0,offsetY:0,size:0}:e.referenceBounds;return[t(c),-t(l),Math.round(t(u)),i+1<<2|s+1]}}},attributes:{pos:{type:w.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:w.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:w.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:e,mapAligned:t})=>y([[x,e],[S,!!t]])},offset:{type:w.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},textureUV:{type:w.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},color:{type:w.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:e})=>e},fontAndReferenceSize:{type:w.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:e,sdfSize:n,sdfRadius:r},{referenceSize:i})=>[Math.round(t(e)),Math.round(t(i||e)),n,r]},outlineColor:{type:w.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>_(e)},haloColor:{type:w.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:e})=>_(e)},outlineAndHaloSize:{type:w.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:e,haloSize:n})=>[Math.round(t(e)),Math.round(t(n))]}}};class V extends b{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=B,this._textMeshParamsPropsInitialized=!1,this._calloutEffectGeometry=null}getCalloutEffectGeometry({target:e}){if(e.geometryType!==`esriGeometryPoint`&&e.geometryType!==`esriGeometryMultipoint`)return this._calloutEffectGeometry;let t=e.readGeometryForDisplay();return t&&e.geometryType?n.fromOptimizedCIM(t.clone(),e.geometryType):null}getCalloutRotation(){return this._textMeshParamsPropsInitialized?this._textMeshTransformProps.postAngle:null}ensurePacked(e,t,n){this._calloutEffectGeometry=null,super.ensurePacked(e,t,n),(!this._textMeshParamsPropsInitialized||this._evaluator.hasDynamicProperties)&&(this._textMeshTransformProps=new C(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}getLocalCalloutReferenceInfo(){return this._createLocalCalloutReferenceInfo(this._getShaping(),void 0,!0,!0)}_createLocalCalloutReferenceInfo(e,n,r=!1,i=!1){if(!e)return;let a=e.boundsT,o=i?e.bounds:a,[s,c]=n?this._getReferenceSymbolOffset(n):[0,0],l=i?t(this._textMeshTransformProps.offsetX):0,u=i?t(this._textMeshTransformProps.offsetY):0,d={xmin:a.xmin,ymin:-a.ymax,xmax:a.xmax,ymax:-a.ymin};return{anchor:{x:0,y:0},bodyBounds:{xmin:o.xmin+s+l,ymin:-o.ymax-c+u,xmax:o.xmax+s+l,ymax:-o.ymin-c+u},collisionBodyBounds:d,...r?{bodyBoundsUseReferenceScale:!0}:null}}_getReferenceSymbolOffset(e){let n=t(e.size)/2+u;return[t(e.offsetX)+a(this.evaluatedMeshParams.horizontalAlignment)*n,-t(e.offsetY)+o(this.evaluatedMeshParams.verticalAlignment)*n]}_write(e,{target:t,effect:n}){this._calloutEffectGeometry=null;let i=n?.geometry,a=this._getShaping();if(!a)return;let o=this.evaluatedMeshParams.alignment===1,s=t.getDisplayId(),{placement:c}=this.evaluatedMeshParams;if(c!=null){if(c.type!==`PrivatePlacementMultipoint`)this._writePlacedTextMarkers(e,t,a,r(i));else{let n=this._getMultipointShaping();n&&this._writeMultipointText(e,t,n,r(i))}return}if(i?.nextPath())return i.nextPoint(),this._setCalloutEffectGeometry(i.x,i.y),this._writeGlyphs(e,s,i.x,i.y,a,0,void 0,{mapAligned:o});if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;return this._setCalloutEffectGeometry(r,i),this._writeGlyphs(e,s,r,i,a,0,void 0,{mapAligned:o})}if(t.geometryType===`esriGeometryMultipoint`){t.readGeometryForDisplay()?.forEachVertex((t,n)=>{this._setCalloutEffectGeometry(t,n),this._writeGlyphs(e,s,t,n,a,0,void 0,{mapAligned:o})});return}let l=t.readXForDisplay(),u=t.readYForDisplay();return this._setCalloutEffectGeometry(l,u),this._writeGlyphs(e,s,l,u,a,0,void 0,{mapAligned:o})}_writePlacedTextMarkers(e,r,a,o){let s=o??n.fromFeatureSetReaderCIM(r);if(!s)return;let c=i.getPlacement(s,-1,this.evaluatedMeshParams.placement,t(1),e.id);if(!c)return;let l=r.getDisplayId(),u=c.next();for(;u!=null;){let t=-u.getAngle(),n=u.tx,r=-u.ty;this._setCalloutEffectGeometry(n,r),this._writeGlyphs(e,l,n,r,a,t,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next()}}_writeMultipointText(e,r,a,o){let s=o??n.fromFeatureSetReaderCIM(r);if(!s)return;let c=i.getPlacement(s,-1,this.evaluatedMeshParams.placement,t(1),e.id);if(!c)return;let l=r.getDisplayId(),u=c.next(),d=0;for(;u!=null;){let t=u.tx,n=-u.ty,r=-u.getAngle();if(this._setCalloutEffectGeometry(t,n),d>=a.glyphs.length)break;this._writeGlyph(e,l,t,n,a,d,r,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next(),d++}}_setCalloutEffectGeometry(e,t){this._calloutEffectGeometry??=n.fromJSON({x:e,y:t})}_getShaping(n){let r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;let a=t(r.fontSize),o=t(r.offsetX),s=t(r.offsetY),{sdfSize:u}=this._getDefaultGlyphMetrics(i.glyphs),d=k(i.lineWidth),f=A(u,i.lineHeightRatio),{backgroundColor:p,borderLineSize:m}=z(i);return h(i.glyphs,{scale:a/u,angle:r.postAngle,xOffset:o,yOffset:s,horizontalAlignment:i.horizontalAlignment,verticalAlignment:n||i.verticalAlignment,maxLineWidth:d,lineHeight:f,lineHeightRatio:e(i.lineHeightRatio,l,c),decoration:i.decoration,borderLineSizePx:t(m),hasBackground:!!p,useCIMAngleBehavior:i.useCIMAngleBehavior})}_getMultipointShaping(){let n=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!this._hasGlyphs(r.glyphs))return null;let i=t(n.fontSize),a=t(n.offsetX),o=t(n.offsetY),{sdfSize:s}=this._getDefaultGlyphMetrics(r.glyphs),u=k(r.lineWidth),d=A(s,r.lineHeightRatio),{backgroundColor:f,borderLineSize:p}=z(r);return g(r.glyphs,{scale:i/s,angle:n.postAngle,xOffset:a,yOffset:o,horizontalAlignment:r.horizontalAlignment,verticalAlignment:r.verticalAlignment,maxLineWidth:u,lineHeight:d,lineHeightRatio:e(r.lineHeightRatio,l,c),decoration:r.decoration,borderLineSizePx:t(p),hasBackground:!!f,useCIMAngleBehavior:r.useCIMAngleBehavior})}_hasGlyphs(e){return e?e.type===`glyphs`?e.glyphs.length>0:e.runs.some(e=>e.glyphs.glyphs.length>0):!1}_getDefaultGlyphMetrics(e){if(e.type===`glyphs`)return{sdfSize:e.sdfSize,sdfRadius:e.sdfRadius,sdfPadding:e.sdfPadding};let[t]=e.runs;return{sdfSize:t?.glyphs.sdfSize??24,sdfRadius:t?.glyphs.sdfRadius??8,sdfPadding:t?.glyphs.sdfPadding??3}}_writeGlyphs(e,n,r,i,a,o,s,c,l=!0){let u=this.evaluatedMeshParams,d=this._textMeshTransformProps,f=t(d.fontSize),p=d.haloSize,m=d.outlineSize,h=t(d.offsetX),g=t(d.offsetY),y=this._getDefaultGlyphMetrics(u.glyphs),b=_(u.color),[x,S]=v(u.scaleInfo,this.getTileInfo());o!==0&&a.setRotation(o);let C=a.bounds,w=r+C.x+h,T=i+C.y-g,E=(u.minPixelBuffer?u.minPixelBuffer/f:1)*2,D=Math.max(C.width,C.height)*E;a.textBox&&(e.recordStart(this.instanceId,this.attributeLayout,a.glyphs[0].textureBinding),l&&e.recordBounds(w,T,D,D),this._writeTextBox(e,n,r,i,a.textBox,s,c),e.recordEnd());for(let t of a.glyphs){e.recordStart(this.instanceId,this.attributeLayout,t.textureBinding),l&&e.recordBounds(w,T,D,D);let{texcoords:a,offsets:o}=t,u=t.fontSize??f;this._writeQuad(e,n,r,i,{texcoords:a,offsets:o,fontSize:u,haloSize:p,outlineSize:m,sdfSize:y.sdfSize,sdfRadius:y.sdfRadius,color:t.color?_(t.color):b,isBackground:!1,referenceBounds:s,minZoom:x,maxZoom:S,...c}),e.recordEnd()}o!==0&&a.setRotation(-o)}_writeGlyph(e,n,r,i,a,o,s,c,l,u=!0){let d=this.evaluatedMeshParams,f=this._textMeshTransformProps,p=t(f.fontSize),m=f.haloSize,h=f.outlineSize,g=t(f.offsetX),v=t(f.offsetY),y=this._getDefaultGlyphMetrics(d.glyphs),b=_(d.color);s!==0&&a.setRotation(s);let x=a.bounds,S=r+x.x+g,C=i+x.y-v,w=(d.minPixelBuffer?d.minPixelBuffer/p:1)*2,T=Math.max(x.width,x.height)*w,E=a.glyphs[o];e.recordStart(this.instanceId,this.attributeLayout,E.textureBinding),u&&e.recordBounds(S,C,T,T);let{texcoords:D,offsets:O}=E,k=E.fontSize??p;this._writeQuad(e,n,r,i,{texcoords:D,offsets:O,fontSize:k,haloSize:m,outlineSize:h,sdfSize:y.sdfSize,sdfRadius:y.sdfRadius,color:E.color?_(E.color):b,isBackground:!1,referenceBounds:c,minZoom:0,maxZoom:30,...l}),e.recordEnd(),s!==0&&a.setRotation(-s)}_writeTextBox(e,t,n,r,i,a,o){let s=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:u}=this._textMeshTransformProps,{backgroundColor:d,borderLineColor:f,borderLineSize:p}=z(s),{sdfSize:m,sdfRadius:h}=this._getDefaultGlyphMetrics(s.glyphs),g=!!f&&p>0,v={isBackground:!0,fontSize:c,haloSize:l,outlineSize:u,referenceBounds:a,sdfSize:m,sdfRadius:h,...o};d&&(this._writeQuad(e,t,n,r,{texcoords:O,offsets:i.main,color:_(d),...v}),g||(this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.top,color:_(d),...v}),this._writeQuad(e,t,n,r,{texcoords:I,offsets:i.bot,color:_(d),...v}),this._writeQuad(e,t,n,r,{texcoords:L,offsets:i.left,color:_(d),...v}),this._writeQuad(e,t,n,r,{texcoords:R,offsets:i.right,color:_(d),...v}))),g&&(this._writeQuad(e,t,n,r,{texcoords:N,offsets:i.top,color:_(f),...v}),this._writeQuad(e,t,n,r,{texcoords:N,offsets:i.bot,color:_(f),...v}),this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.left,color:_(f),...v}),this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.right,color:_(f),...v}))}_writeQuad(e,t,n,r,i){let a=e.vertexCount();this._writeVertex(e,t,n,r,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}const H=e=>Math.round(e*m);export{V as TextMeshWriter,B as TextVertexSpec,z as getTextBoxStyle,T as maxLabelZoom};
|
|
2
|
+
import{clamp as e}from"../../../../../../../core/mathUtils.js";import{pt2px as t,onePointInPixels as n}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as r}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as a}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as o,getYDirection as s}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as c,maxLineHeightRatio as l,minLineHeightRatio as u,labelPlacementOffsetPadding as d,maxTextLineWidth as f,minTextLineWidth as p,magicLabelLineHeight as m,packDegreesU8 as h}from"../../../definitions.js";import{shapeTextResource as g,shapeTextResourceForMultipoint as _}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as v,getMinMaxZoom as y,packBitset as b}from"../fill/meshWriterUtils.js";import{MeshWriter as x}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as S,bitsetTextIsMapAligned as C}from"../shaders/constants.js";import{TextMeshTransformProps as w}from"./TextParams.js";import{DataType as T}from"../../../../../../webgl/enums.js";const E=28,D=[4,4],O=[16,4],k={topLeft:O,topRight:O,bottomLeft:O,bottomRight:O};function A(n){return n==null?f:e(t(n),p,f)}function j(t,n){return t/24*m*e(n,u,l)}const M=[4,2],N=[4,6],P={topLeft:M,topRight:M,bottomLeft:N,bottomRight:N},F={topLeft:M,topRight:N,bottomLeft:M,bottomRight:N},I={topLeft:N,topRight:N,bottomLeft:D,bottomRight:D},L={topLeft:D,topRight:D,bottomLeft:N,bottomRight:N},R={topLeft:N,topRight:D,bottomLeft:N,bottomRight:D},z={topLeft:D,topRight:N,bottomLeft:D,bottomRight:N};function B(e){return e.useBackgroundCallout?{backgroundColor:null,borderLineColor:null,borderLineSize:0}:{backgroundColor:e.boxBackgroundColor??e.backgroundColor??null,borderLineColor:e.boxBorderLineColor??e.borderLineColor??null,borderLineSize:e.boxBorderLineSize>0?e.boxBorderLineSize:e.borderLineWidth??0}}const V={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:T.UNSIGNED_SHORT,count:2,packPrecisionFactor:c,packTessellation:({minZoom:e,maxZoom:t})=>[e||0,t||28]},clipAngle:{type:T.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:e})=>U(e||0)},referenceSymbol:{type:T.BYTE,count:4,packTessellation:(e,n)=>{let r=e.isLineLabel||!e.referenceBounds,i=o(r?`center`:n.horizontalAlignment),a=s(r?`middle`:n.verticalAlignment),{offsetX:c,offsetY:l,size:u}=r?{offsetX:0,offsetY:0,size:0}:e.referenceBounds;return[t(c),-t(l),Math.round(t(u)),i+1<<2|a+1]}}},attributes:{pos:{type:T.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:T.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:T.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:e,mapAligned:t})=>b([[S,e],[C,!!t]])},offset:{type:T.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},textureUV:{type:T.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},color:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:e})=>e},fontAndReferenceSize:{type:T.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:e,sdfSize:n,sdfRadius:r},{referenceSize:i})=>[Math.round(t(e)),Math.round(t(i||e)),n,r]},outlineColor:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>v(e)},haloColor:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:e})=>v(e)},outlineAndHaloSize:{type:T.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:e,haloSize:n})=>[Math.round(t(e)),Math.round(t(n))]}}};class H extends x{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=V,this._textMeshParamsPropsInitialized=!1,this._calloutEffectGeometry=null}getCalloutEffectGeometry({target:e}){if(e.geometryType!==`esriGeometryPoint`&&e.geometryType!==`esriGeometryMultipoint`)return this._calloutEffectGeometry;let t=e.readGeometryForDisplay();return t&&e.geometryType?r.fromOptimizedCIM(t.clone(),e.geometryType):null}getCalloutRotation(){return this._textMeshParamsPropsInitialized?this._textMeshTransformProps.postAngle:null}ensurePacked(e,t,n){this._calloutEffectGeometry=null,super.ensurePacked(e,t,n),(!this._textMeshParamsPropsInitialized||this._evaluator.hasDynamicProperties)&&(this._textMeshTransformProps=new w(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}getLocalCalloutReferenceInfo(){return this._createLocalCalloutReferenceInfo(this._getShaping(),void 0,!0,!0)}_createLocalCalloutReferenceInfo(e,n,r=!1,i=!1){if(!e)return;let a=e.boundsT,o=i?e.bounds:a,[s,c]=n?this._getReferenceSymbolOffset(n):[0,0],l=i?t(this._textMeshTransformProps.offsetX):0,u=i?t(this._textMeshTransformProps.offsetY):0,d={xmin:a.xmin,ymin:-a.ymax,xmax:a.xmax,ymax:-a.ymin};return{anchor:{x:0,y:0},bodyBounds:{xmin:o.xmin+s+l,ymin:-o.ymax-c+u,xmax:o.xmax+s+l,ymax:-o.ymin-c+u},collisionBodyBounds:d,...r?{bodyBoundsUseReferenceScale:!0}:null}}_getReferenceSymbolOffset(e){let n=t(e.size)/2+d;return[t(e.offsetX)+o(this.evaluatedMeshParams.horizontalAlignment)*n,-t(e.offsetY)+s(this.evaluatedMeshParams.verticalAlignment)*n]}_write(e,{target:t,effect:n}){this._calloutEffectGeometry=null;let r=n?.geometry,a=this._getShaping();if(!a)return;let o=this.evaluatedMeshParams.alignment===1,s=t.getDisplayId(),{placement:c}=this.evaluatedMeshParams;if(c!=null){if(c.type!==`PrivatePlacementMultipoint`)this._writePlacedTextMarkers(e,t,a,i(r));else{let n=this._getMultipointShaping();n&&this._writeMultipointText(e,t,n,i(r))}return}if(r?.nextPath())return r.nextPoint(),this._setCalloutEffectGeometry(r.x,r.y),this._writeGlyphs(e,s,r.x,r.y,a,0,void 0,{mapAligned:o});if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;return this._setCalloutEffectGeometry(r,i),this._writeGlyphs(e,s,r,i,a,0,void 0,{mapAligned:o})}if(t.geometryType===`esriGeometryMultipoint`){t.readGeometryForDisplay()?.forEachVertex((t,n)=>{this._setCalloutEffectGeometry(t,n),this._writeGlyphs(e,s,t,n,a,0,void 0,{mapAligned:o})});return}let l=t.readXForDisplay(),u=t.readYForDisplay();return this._setCalloutEffectGeometry(l,u),this._writeGlyphs(e,s,l,u,a,0,void 0,{mapAligned:o})}_writePlacedTextMarkers(e,t,i,o){let s=o??r.fromFeatureSetReaderCIM(t);if(!s)return;let c=a.getPlacement(s,-1,this.evaluatedMeshParams.placement,n,e.id);if(!c)return;let l=t.getDisplayId(),u=c.next();for(;u!=null;){let t=-u.getAngle(),n=u.tx,r=-u.ty;this._setCalloutEffectGeometry(n,r),this._writeGlyphs(e,l,n,r,i,t,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next()}}_writeMultipointText(e,t,i,o){let s=o??r.fromFeatureSetReaderCIM(t);if(!s)return;let c=a.getPlacement(s,-1,this.evaluatedMeshParams.placement,n,e.id);if(!c)return;let l=t.getDisplayId(),u=c.next(),d=0;for(;u!=null;){let t=u.tx,n=-u.ty,r=-u.getAngle();if(this._setCalloutEffectGeometry(t,n),d>=i.glyphs.length)break;this._writeGlyph(e,l,t,n,i,d,r,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next(),d++}}_setCalloutEffectGeometry(e,t){this._calloutEffectGeometry??=r.fromJSON({x:e,y:t})}_getShaping(n){let r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;let a=t(r.fontSize),o=t(r.offsetX),s=t(r.offsetY),{sdfSize:c}=this._getDefaultGlyphMetrics(i.glyphs),d=A(i.lineWidth),f=j(c,i.lineHeightRatio),{backgroundColor:p,borderLineSize:m}=B(i);return g(i.glyphs,{scale:a/c,angle:r.postAngle,xOffset:o,yOffset:s,horizontalAlignment:i.horizontalAlignment,verticalAlignment:n||i.verticalAlignment,maxLineWidth:d,lineHeight:f,lineHeightRatio:e(i.lineHeightRatio,u,l),decoration:i.decoration,borderLineSizePx:t(m),hasBackground:!!p,useCIMAngleBehavior:i.useCIMAngleBehavior})}_getMultipointShaping(){let n=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!this._hasGlyphs(r.glyphs))return null;let i=t(n.fontSize),a=t(n.offsetX),o=t(n.offsetY),{sdfSize:s}=this._getDefaultGlyphMetrics(r.glyphs),c=A(r.lineWidth),d=j(s,r.lineHeightRatio),{backgroundColor:f,borderLineSize:p}=B(r);return _(r.glyphs,{scale:i/s,angle:n.postAngle,xOffset:a,yOffset:o,horizontalAlignment:r.horizontalAlignment,verticalAlignment:r.verticalAlignment,maxLineWidth:c,lineHeight:d,lineHeightRatio:e(r.lineHeightRatio,u,l),decoration:r.decoration,borderLineSizePx:t(p),hasBackground:!!f,useCIMAngleBehavior:r.useCIMAngleBehavior})}_hasGlyphs(e){return e?e.type===`glyphs`?e.glyphs.length>0:e.runs.some(e=>e.glyphs.glyphs.length>0):!1}_getDefaultGlyphMetrics(e){if(e.type===`glyphs`)return{sdfSize:e.sdfSize,sdfRadius:e.sdfRadius,sdfPadding:e.sdfPadding};let[t]=e.runs;return{sdfSize:t?.glyphs.sdfSize??24,sdfRadius:t?.glyphs.sdfRadius??8,sdfPadding:t?.glyphs.sdfPadding??3}}_writeGlyphs(e,n,r,i,a,o,s,c,l=!0){let u=this.evaluatedMeshParams,d=this._textMeshTransformProps,f=t(d.fontSize),p=d.haloSize,m=d.outlineSize,h=t(d.offsetX),g=t(d.offsetY),_=this._getDefaultGlyphMetrics(u.glyphs),b=v(u.color),[x,S]=y(u.scaleInfo,this.getTileInfo());o!==0&&a.setRotation(o);let C=a.bounds,w=r+C.x+h,T=i+C.y-g,E=(u.minPixelBuffer?u.minPixelBuffer/f:1)*2,D=Math.max(C.width,C.height)*E;a.textBox&&(e.recordStart(this.instanceId,this.attributeLayout,a.glyphs[0].textureBinding),l&&e.recordBounds(w,T,D,D),this._writeTextBox(e,n,r,i,a.textBox,s,c),e.recordEnd());for(let t of a.glyphs){e.recordStart(this.instanceId,this.attributeLayout,t.textureBinding),l&&e.recordBounds(w,T,D,D);let{texcoords:a,offsets:o}=t,u=t.fontSize??f;this._writeQuad(e,n,r,i,{texcoords:a,offsets:o,fontSize:u,haloSize:p,outlineSize:m,sdfSize:_.sdfSize,sdfRadius:_.sdfRadius,color:t.color?v(t.color):b,isBackground:!1,referenceBounds:s,minZoom:x,maxZoom:S,...c}),e.recordEnd()}o!==0&&a.setRotation(-o)}_writeGlyph(e,n,r,i,a,o,s,c,l,u=!0){let d=this.evaluatedMeshParams,f=this._textMeshTransformProps,p=t(f.fontSize),m=f.haloSize,h=f.outlineSize,g=t(f.offsetX),_=t(f.offsetY),y=this._getDefaultGlyphMetrics(d.glyphs),b=v(d.color);s!==0&&a.setRotation(s);let x=a.bounds,S=r+x.x+g,C=i+x.y-_,w=(d.minPixelBuffer?d.minPixelBuffer/p:1)*2,T=Math.max(x.width,x.height)*w,E=a.glyphs[o];e.recordStart(this.instanceId,this.attributeLayout,E.textureBinding),u&&e.recordBounds(S,C,T,T);let{texcoords:D,offsets:O}=E,k=E.fontSize??p;this._writeQuad(e,n,r,i,{texcoords:D,offsets:O,fontSize:k,haloSize:m,outlineSize:h,sdfSize:y.sdfSize,sdfRadius:y.sdfRadius,color:E.color?v(E.color):b,isBackground:!1,referenceBounds:c,minZoom:0,maxZoom:30,...l}),e.recordEnd(),s!==0&&a.setRotation(-s)}_writeTextBox(e,t,n,r,i,a,o){let s=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:u}=this._textMeshTransformProps,{backgroundColor:d,borderLineColor:f,borderLineSize:p}=B(s),{sdfSize:m,sdfRadius:h}=this._getDefaultGlyphMetrics(s.glyphs),g=!!f&&p>0,_={isBackground:!0,fontSize:c,haloSize:l,outlineSize:u,referenceBounds:a,sdfSize:m,sdfRadius:h,...o};d&&(this._writeQuad(e,t,n,r,{texcoords:k,offsets:i.main,color:v(d),..._}),g||(this._writeQuad(e,t,n,r,{texcoords:I,offsets:i.top,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:L,offsets:i.bot,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:R,offsets:i.left,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:z,offsets:i.right,color:v(d),..._}))),g&&(this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.top,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.bot,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.left,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.right,color:v(f),..._}))}_writeQuad(e,t,n,r,i){let a=e.vertexCount();this._writeVertex(e,t,n,r,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}const U=e=>Math.round(e*h);export{H as TextMeshWriter,V as TextVertexSpec,B as getTextBoxStyle,E as maxLabelZoom};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{snapshotLineOfSightTargetState as o,restoreLineOfSightTargetState as s}from"./LineOfSightAuthoringUtils.js";import{LineOfSightItemManipulatedObject3D as c}from"./LineOfSightItemManipulatedObject3D.js";import{LineOfSightItemTool as l}from"./LineOfSightItemTool.js";import{discRadiusSmall as u}from"../../interactive/editingTools/manipulations/config.js";import{MoveTool3D as d}from"../../interactive/editingTools/move/MoveTool3D.js";import{bindViewToolOptions as f}from"../../../interactive/options/bindViewToolOptions.js";import p from"../../../interactive/options/InteractiveToolOptions.js";const
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{snapshotLineOfSightTargetState as o,restoreLineOfSightTargetState as s}from"./LineOfSightAuthoringUtils.js";import{LineOfSightItemManipulatedObject3D as c}from"./LineOfSightItemManipulatedObject3D.js";import{LineOfSightItemTool as l}from"./LineOfSightItemTool.js";import{discRadiusSmall as u}from"../../interactive/editingTools/manipulations/config.js";import{MoveTool3D as d}from"../../interactive/editingTools/move/MoveTool3D.js";import{bindViewToolOptions as f}from"../../../interactive/options/bindViewToolOptions.js";import p from"../../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as m}from"../../../interactive/tooltip/tooltipCommonUtils.js";const h=Symbol(`inactiveMoveManipulatorDisplay`);let g=class extends t{get visible(){return this._get(`visible`)??!0}set visible(e){this._set(`visible`,e),this._itemTool.visible=e,this._moveTool.visible=e}get manipulatorsInteractive(){return this._get(`manipulatorsInteractive`)??!0}set manipulatorsInteractive(e){this._set(`manipulatorsInteractive`,e),this._itemTool.manipulatorsInteractive=e}constructor(e){super(e),this._selectedItem=null,this._objectByItem=new Map,this._undoStack=[],this._redoStack=[];let t=new p;this._tooltip=m(()=>({view:e.view,options:t.tooltips})),this._moveTool=new d({enableVisualElements:!1,manipulatorRadius:u,snappingManager:e.snappingManager,toolOptions:t,tooltip:this._tooltip,view:e.view}),this._itemTool=new l({analysisViewData:e.analysisViewData,snappingManager:e.snappingManager,tooltip:this._tooltip,view:e.view})}initialize(){this.view.tools.add(this._itemTool),this.view.tools.add(this._moveTool),this._itemTool.visible=this.visible,this._moveTool.visible=this.visible,this._itemTool.manipulatorsInteractive=this.manipulatorsInteractive;let e=e=>{let t=e.at(0);t!=null&&this._itemTool.showInteractionVisuals(t)},t=()=>this._itemTool.hideInteractionVisuals();this.addHandles([f(this._moveTool.toolOptions,()=>this.view.options),n(()=>({observer:this.analysis.observer,targets:this.analysis.targets.toArray()}),({observer:e,targets:t})=>this._syncObjects(e,t),r),this._itemTool.events.on(`select-item`,({item:e})=>this._setSelectedItem(e)),this._itemTool.events.on(`selection-cleared`,()=>{if(this._moveTool.hasFocusedManipulators){let e=this._selectedItem==null?null:this._objectByItem.get(this._selectedItem);this._itemTool.selectObject(e)}else this._setSelectedItem(null)}),this._itemTool.events.on(`delete-item`,({target:e})=>this._deleteTarget(e)),this._itemTool.events.on(`record-undo`,({record:e})=>this._recordHistory(_([e]))),this._moveTool.events.on(`record-undo`,({updates:e})=>this._recordHistory(_(e))),this._moveTool.events.on(`hold`,({objects:t})=>e(t)),this._moveTool.events.on(`move-start`,({objects:t})=>{this._itemTool.endDrag(),e(t)}),this._moveTool.events.on(`move-stop`,t),n(()=>({sphereGrabbed:this._itemTool.hasGrabbedManipulators,manipulators:this._moveTool.manipulators.toArray()}),({sphereGrabbed:e})=>{let t=[];e&&this._moveTool.manipulators.forEach(({manipulator:e})=>{t.push(e.disableDisplay())}),this.removeHandles(h),this.addHandles(t,h)},r),n(()=>this._moveTool.firstGrabbedManipulator,e=>{e??t()})])}destroy(){this.removeHandles(h),this.stop(),this.view.tools.remove(this._itemTool),this.view.tools.remove(this._moveTool),this._itemTool.destroy(),this._moveTool.destroy(),this._tooltip.destroy();for(let e of this._objectByItem.values())this.removeHandles(e),e.destroy();this._objectByItem.clear(),this._undoStack.length=0,this._redoStack.length=0}get active(){return this._itemTool.active||this._moveTool.active}get canRedo(){return this._redoStack.length>0}get canUndo(){return this._undoStack.length>0}get hasSelection(){return this._selectedItem!=null}get selectedItem(){return this._selectedItem}get updating(){return this._itemTool.updating||this._moveTool.updating}get laserLineVisualElement(){return this._itemTool.laserLineVisualElement}get verticalLineVisualElement(){return this._itemTool.verticalLineVisualElement}selectItem(e){return this._objectByItem.has(e)?(this._setSelectedItem(e),!0):!1}clearSelection(){return this.hasSelection?(this._setSelectedItem(null),!0):!1}deleteSelectedItem(){let e=this._selectedItem;if(e==null)return!1;let t=this.analysis.targets.find(t=>t===e);return t!=null&&this._deleteTarget(t)}getObserverManipulator(){let e=this.analysis.observer,t=e==null?null:this._itemTool.getManipulator(e);return t!=null&&v(t)?t:null}getTargetManipulator(e){let t=this._itemTool.getManipulator(e);return t!=null&&y(t)?t:null}hasManipulatorAt(e,t){return this._itemTool.hasManipulatorAt(e,t)}redo(){let e=this._redoStack.pop();e!=null&&(e.redo()?(this._undoStack.push(e),this._notifyHistoryChanged()):this._redoStack.push(e))}setEditableFlag(e,t){this._itemTool.setEditableFlag(e,t),this._moveTool.setEditableFlag(e,t)}stop(){(this.view.activeTool===this._itemTool||this.view.activeTool===this._moveTool)&&(this.view.activeTool=null),this._itemTool.hideInteractionVisuals(),this.snappingManager.doneSnapping(),this.clearSelection()}undo(){let e=this._undoStack.pop();e!=null&&(e.undo(),this._redoStack.push(e),this._notifyHistoryChanged())}_syncObjects(e,t){let n=new Set(e==null?t:[e,...t]);for(let[e,t]of this._objectByItem)n.has(e)||(this._selectedItem===e&&this._setSelectedItem(null),this.removeHandles(t),this._itemTool.removeObject(t),this._objectByItem.delete(e),t.destroy());e!=null&&this._ensureObject(e);for(let e of t)this._ensureObject(e);this._setSelectedItem(this._selectedItem)}_ensureObject(e){if(this._objectByItem.has(e))return;let t=new c({analysisViewData:this.analysisViewData,intersector:this.intersector,item:e,view:this.view});this._objectByItem.set(e,t),this._itemTool.addObject(t),this.addHandles(t.on(`modified-externally`,()=>{this._selectedItem===e&&this._setSelectedItem(e)}),t)}_setSelectedItem(e){let t=e==null?null:this._objectByItem.get(e);this._selectedItem=t==null?null:e,this._itemTool.selectObject(t),this._moveTool.objects.removeAll(),t!=null&&this._moveTool.objects.add(t),this._itemTool.interacting=this._selectedItem!=null}_deleteTarget(e){if(this.analysis.targets.length<=1)return!1;let t=this.analysis.targets.indexOf(e);if(t<0)return!1;let n=o(e),r=this._selectedItem===e;return this.analysis.targets.remove(e),this._recordHistory({undo:()=>{s(n,e),this.analysis.targets.add(e,Math.min(t,this.analysis.targets.length)),r&&this._setSelectedItem(e)},redo:()=>this.analysis.targets.includes(e)&&this.analysis.targets.length<=1?!1:(this.analysis.targets.remove(e),this._selectedItem===e&&this._setSelectedItem(null),!0)}),!0}_recordHistory(e){this._undoStack.push(e),this._redoStack.length=0,this._notifyHistoryChanged()}_notifyHistoryChanged(){this.notifyChange(`canUndo`),this.notifyChange(`canRedo`)}get testInfo(){return{moveTooltip:this._tooltip}}};e([i({constructOnly:!0})],g.prototype,`analysisViewData`,void 0),e([i({constructOnly:!0})],g.prototype,`analysis`,void 0),e([i({constructOnly:!0})],g.prototype,`intersector`,void 0),e([i({constructOnly:!0})],g.prototype,`snappingManager`,void 0),e([i({constructOnly:!0})],g.prototype,`view`,void 0),e([i()],g.prototype,`visible`,null),e([i()],g.prototype,`manipulatorsInteractive`,null),e([i()],g.prototype,`_selectedItem`,void 0),e([i()],g.prototype,`active`,null),e([i()],g.prototype,`canRedo`,null),e([i()],g.prototype,`canUndo`,null),e([i()],g.prototype,`selectedItem`,null),e([i()],g.prototype,`updating`,null),g=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightEditTool`)],g);function _(e){return{undo:()=>{for(let t=e.length-1;t>=0;t--)e[t].undo(null)},redo:()=>{for(let t of e)t.redo(null);return!0}}}function v(e){return e.metadata.type===`observer`}function y(e){return e.metadata.type===`target`}export{g as LineOfSightEditTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../../core/Evented.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,syncAndInitial as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{getGeometryEffectiveElevationInfo as s}from"../../../../support/elevationInfoUtils.js";import{convertLineOfSightElevationMode as c,snapshotLineOfSightObserverState as l,snapshotLineOfSightTargetState as u,restoreLineOfSightObserverState as d,restoreLineOfSightTargetState as f,updateLineOfSightItemFromAuthoredPoint as p}from"./LineOfSightAuthoringUtils.js";import{EditGeometryOperations as m}from"../../../interactive/editGeometry/EditGeometryOperations.js";const h=Symbol(`line-of-sight-item-operations`);let g=class extends t{constructor(e){super(e),this._operations=null,this._dragIntersectionContext=null,this._syncSource=null}initialize(){this.addHandles([r(()=>{let{elevationInfo:e,feature:t,position:n}=this.item;return{elevationInfo:e,elevationMode:e?.mode,elevationOffset:e?.offset,elevationUnit:e?.unit,feature:t,position:n,positionCoordinates:n?.toArray(),spatialReference:n?.spatialReference}},()=>this._syncOperationsFromItem(),i),r(()=>{let{origin:e}=this;return{origin:e,originCoordinates:e?.toArray(),spatialReference:e?.spatialReference}},()=>this.emit(`committed`),i)])}destroy(){this.removeHandles(h),this._operations=n(this._operations),this._dragIntersectionContext=null}get operations(){return this._operations}get elevationInfo(){let{position:e,elevationInfo:t}=this.item;return s(e,t)}get visible(){return this.analysisViewData.visible&&this.origin!=null}get isDraped(){return this.elevationInfo.mode===`on-the-ground`}get origin(){return this.item.type===`observer`?this.analysisViewData.elevationAlignedObserver:this.analysisViewData.computations.find(e=>e.target===this.item)?.elevationAlignedTargetLocation??null}get updating(){return!1}toMap(e){return this.intersector.getScreenPointIntersection(e)?.mapPoint}createUndoRecord(){let e=this._snapshotState(),t=null;return{undo:()=>{t=this._snapshotState(),this._restoreSnapshot(e)},redo:()=>{t!=null&&(e=this._snapshotState(),this._restoreSnapshot(t))}}}setElevationMode(e){let{position:t,elevationInfo:n}=this.item;if(t==null||e===this.elevationInfo.mode)return null;let r=c({view:this.view,point:t,sourceElevationInfo:n,mode:e,preserveZ:!0}),i=this.createUndoRecord();this._syncSource=`operations`;try{this.item.elevationInfo=r.elevationInfo,this.item.position=r.position}finally{this._syncSource=null}return this._syncOperationsFromItem(!1),i}updateDragIntersection(e){this._dragIntersectionContext=e.action===`cancel`?null:{dragging:e.action!==`end`,intersection:this.intersector.getScreenPointIntersection(e.screenPoint)}}_snapshotState(){let{item:e}=this;return e.type===`observer`?l(e):u(e)}_restoreSnapshot(e){let{item:t}=this;t.type===`observer`?d(e,t):f(e,t),this.destroyed||(this._syncOperationsFromItem(),this.emit(`committed`))}_replaceOperations(e){this.removeHandles(h),this._operations=n(this._operations),this._operations=e,e!=null&&this.addHandles(e.data.on(`change`,()=>this._operationsGeometryChanged()),h)}_syncOperationsFromItem(e=!0){let{position:t}=this.item,n=this._operations;if(this._syncSource!==`operations`){this._syncSource=`item`;try{if(t==null){if(n==null)return;this._replaceOperations(null)}else!n?.data.geometry?.equals(t)&&!n?.trySetGeometry(t)&&this._replaceOperations(m.fromGeometry(t,this.view.state.viewingMode));e?this._emitModifiedExternally():this.emit(`committed`)}finally{this._syncSource=null}}}_operationsGeometryChanged(){let e=this._operations?.data.geometry;if(this._syncSource===`item`||e?.type!==`point`)return;let t=this._dragIntersectionContext;this._syncSource=`operations`;try{t==null?this.item.position=e:p(this.view,this.item,this.intersector,e,{elevationInfo:this.item.elevationInfo,preservedIntersection:t.intersection})}finally{this._syncSource=null}t!=null&&!t.dragging&&(this._dragIntersectionContext=null),this.emit(`committed`)}_emitModifiedExternally(){this.emit(`modified-externally`),this.emit(`committed`)}};e([a({constructOnly:!0})],g.prototype,`analysisViewData`,void 0),e([a({constructOnly:!0})],g.prototype,`intersector`,void 0),e([a({constructOnly:!0})],g.prototype,`item`,void 0),e([a({constructOnly:!0})],g.prototype,`view`,void 0),e([a()],g.prototype,`_operations`,void 0),g=e([o(`esri.views.3d.analysis.LineOfSight.LineOfSightItemManipulatedObject3D`)],g);export{g as LineOfSightItemManipulatedObject3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../core/Evented.js";import{handlesGroup as n}from"../../../../core/handleUtils.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import a from"../../../../core/ReactiveMap.js";import{initial as o,watch as s,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as f,fromPoints as p}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as m}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as h,LineOfSightTargetManipulator as g,LineOfSightTargetManipulatorState as _,getInteractiveLineOfSightTargetManipulatorState as v}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as y}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as b}from"../../interactive/editingTools/dragEventPipeline3D.js";import{connectTooltipToManipulatedObject as x}from"../../interactive/editingTools/tooltipUtils3D.js";import{mouseButtons as S}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as C,dragAtLocation as w,sceneSnappingAtLocation as T,dragManipulatedObject as E}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as D}from"../../../interactive/InteractiveToolBase.js";import{bindViewToolOptions as O}from"../../../interactive/options/bindViewToolOptions.js";import k from"../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as A}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as j}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as M,enterInputModeIfAvailable as N}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as P}from"../../../interactive/tooltip/infos/MovePointTooltipInfo.js";const F=f(),I=Symbol(`inactiveManipulatorDisplay`);let L=class extends D{get _manipulatorsToHide(){let e=this._manipulatorByObject.values();return this.view.tools.some(e=>e.hasGrabbedManipulators)||e.some(e=>e.grabbing)?e.filter(e=>!e.grabbing).toArray():[]}constructor(e){super(e),this.events=new t,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new a,this._updatingHandles=new d,this._toolOptions=new k,this._interactionVisuals=null,this._grabbedManipulator=null,this._visualsManipulator=null,this._tooltipHandle=null,this._tooltipObject=null,this._tooltipUndoRecord=null,this._tooltipInfo=new P({toolOptions:this._toolOptions,viewType:`3d`})}initialize(){let{view:e}=this;this._tooltip=M(()=>({view:e,options:this._toolOptions.tooltips})),this._interactionVisuals=new m({view:e}),this.addHandles([O(this._toolOptions,()=>e.options),this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(e=>({isTargetVisible:e.computationResult.isTargetVisible,isValid:e.computationResult.isValid,target:e.target})),grabbedManipulator:this._grabbedManipulator,interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),o),s(()=>this._manipulatorsToHide,e=>{let t=e.map(e=>e.disableDisplay());this.removeHandles(I),this.addHandles(t,I)},c),s(()=>this._tooltip.mode,e=>{e!==`input`&&this._grabbedManipulator==null&&this._disconnectTooltip()})]),this.finishToolCreation()}destroy(){this.removeHandles(I),this._disconnectTooltip(),this._tooltip=r(this._tooltip),this._interactionVisuals=r(this._interactionVisuals),this._updatingHandles.destroy(),this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}showInteractionVisuals(e){this._visualsManipulator=this._manipulatorByObject.get(e),this._syncInteractionVisuals()}hideInteractionVisuals(){this._visualsManipulator=null,this._syncInteractionVisuals()}addObject(e){if(this._manipulatorByObject.has(e))return;let t=e.item.type===`observer`?new h(this.view,{deleting:!1,intersection:null,type:`observer`}):new g(this.view,{deleting:!1,target:e.item,type:`target`});t.cursor=`move`,this._objectByItem.set(e.item,e),this._manipulatorByObject.set(e,t),this.manipulators.add(t),this.addHandles(this._connectManipulator(e,t),e),this._syncManipulator(e,t)}removeObject(e){let t=this._manipulatorByObject.get(e);t!=null&&(this._grabbedManipulator===t&&(this._grabbedManipulator=null),this._tooltipObject===e&&this._disconnectTooltip(),this._visualsManipulator===t&&this.hideInteractionVisuals(),this.removeHandles(e),this.removeHandles(e),this._objectByItem.delete(e.item),this._manipulatorByObject.delete(e),this.manipulators.remove(t),t.destroy())}getManipulator(e){let t=this._objectByItem.get(e);return t==null?null:this._manipulatorByObject.get(t)}hasManipulatorAt(e,t){for(let n of this._manipulatorByObject.values())if(n.consumesClicks&&n.intersectionDistance(e,t)!=null)return!0;return!1}selectObject(e){this._tooltipObject!=null&&this._tooltipObject!==e&&this._disconnectTooltip();let t=!1;for(let[n,r]of this._manipulatorByObject){let i=n===e;r.selected=i,t||=i}return this._syncManipulators(),t}onInputEvent(e){e.type===`hold`&&this._grabbedManipulator!=null&&(this._visualsManipulator=this._grabbedManipulator,this._syncInteractionVisuals()),N(e,this._tooltip)}onManipulatorSelectionChanged(){[...this._manipulatorByObject.values()].some(e=>e.selected)||this.events.emit(`selection-cleared`)}_connectManipulator(e,t){let r=()=>this._syncManipulator(e,t);return n([e.on(`committed`,r),e.on(`modified-externally`,r),t.events.on(`immediate-click`,n=>{this.events.emit(`select-item`,{item:e.item}),n.button===S.Right&&t.metadata.type===`target`&&this.events.emit(`delete-item`,{target:t.metadata.target}),n.stopPropagation()}),t.events.on(`grab-changed`,({action:n})=>{n===`start`?(this.events.emit(`select-item`,{item:e.item}),this._grabbedManipulator=t,this._connectTooltip(e)):this._grabbedManipulator===t&&(this._grabbedManipulator=null,this.hideInteractionVisuals(),this._tooltip.mode!==`input`&&this._disconnectTooltip()),this._manipulatorByObject.set(e,t)}),t.events.on(`drag`,t=>{e.updateDragIntersection(t),t.action===`start`&&this.showInteractionVisuals(e)}),t.events.on(`location-update`,()=>this._syncInteractionVisuals()),this._createDragHandle(e,t)])}_createDragHandle(e,t){return C(t,(n,r,i,a)=>{let o=e.operations;if(o==null)return;let s=null,{cancelSnapping:c,snappingStep:l}=j({snappingContext:new A({editGeometryOperations:o,elevationInfo:e.elevationInfo,pointer:a,visualizer:new y}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});i.next(e=>(s?.undo(null),s=null,e)).next(c);let u=o.data.allVerticesUnordered.at(0);r.next(t=>(t.action===`start`&&(s=e.createUndoRecord()),{...t,snapOrigin:u?.pos})).next(w(this.view,t.elevationAlignedLocation)).next(b(this.view,o.data.geometry,e.elevationInfo,o.data.spatialReference)).next(T(this.view,e.elevationInfo)).next(...l).next(E(e)).next(e=>(e.action===`end`&&s!=null&&(this.events.emit(`record-undo`,{record:s}),s=null),e))})}_connectTooltip(e){this._disconnectTooltip(),this._tooltipObject=e,this._tooltipHandle=x(this._tooltip,e,()=>({activeTooltipInfo:this._tooltipInfo,onRecordUndo:e=>this.events.emit(`record-undo`,{record:e}),callbacks:{onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._tooltipUndoRecord=e.createUndoRecord()},onMove:()=>{},onMoveStop:()=>{this._tooltipUndoRecord!=null&&(this.events.emit(`record-undo`,{record:this._tooltipUndoRecord}),this._tooltipUndoRecord=null)},onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}},toolOptions:this._toolOptions}))}_disconnectTooltip(){this._tooltipHandle=i(this._tooltipHandle),this._tooltipObject=null,this._tooltipUndoRecord=null,this._tooltip.clear()}_syncManipulators(){for(let[e,t]of this._manipulatorByObject)this._syncManipulator(e,t);this._syncInteractionVisuals()}_syncManipulator(e,t){let n=e.origin;if(t.available=this.visible&&e.visible&&n!=null,t.interactive=this.manipulatorsInteractive&&(this._grabbedManipulator==null||this._grabbedManipulator===t),n!=null&&(t.elevationAlignedLocation=n),e.item.type!==`target`)return;let r=this.analysisViewData.computations.find(t=>t.target===e.item),i=r==null||!r.computationResult.isValid?_.undefined:r.computationResult.isTargetVisible?_.visible:_.occluded;t.state=this.interacting&&t.selected?v(i):i}_syncInteractionVisuals(){let e=this._interactionVisuals,t=this._visualsManipulator,n=this.visible&&this.analysisViewData.visible;if(e==null||t==null||!n){e?.hide();return}let r=[...this._manipulatorByObject.entries()].find(([e])=>e.item.type===`observer`)?.[1];if(r==null){e.hide();return}let i=t===r?null:p(r.renderLocation,t.renderLocation,F);e.update({target:t.renderLocation,lineVerticalPlaneSegment:i,visible:!0})}};e([l({constructOnly:!0})],L.prototype,`analysisViewData`,void 0),e([l({constructOnly:!0})],L.prototype,`snappingManager`,void 0),e([l({constructOnly:!0})],L.prototype,`view`,void 0),e([l()],L.prototype,`automaticManipulatorSelection`,void 0),e([l()],L.prototype,`removeIncompleteOnCancel`,void 0),e([l()],L.prototype,`interacting`,void 0),e([l()],L.prototype,`manipulatorsInteractive`,void 0),e([l()],L.prototype,`_grabbedManipulator`,void 0),e([l()],L.prototype,`_manipulatorsToHide`,null),e([l()],L.prototype,`updating`,null),L=e([u(`esri.views.3d.analysis.LineOfSight.LineOfSightItemTool`)],L);export{L as LineOfSightItemTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../core/Evented.js";import{handlesGroup as n}from"../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import i from"../../../../core/ReactiveMap.js";import{initial as a,watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{create as d,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as p}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as m,LineOfSightTargetManipulator as h,LineOfSightTargetManipulatorState as g,getInteractiveLineOfSightTargetManipulatorState as _}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as v}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as y}from"../../interactive/editingTools/dragEventPipeline3D.js";import{mouseButtons as b}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as x,dragAtLocation as S,sceneSnappingAtLocation as C,dragManipulatedObject as w}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../interactive/InteractiveToolBase.js";import{SnappingContext as E}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{enterInputModeIfAvailable as O}from"../../../interactive/tooltip/tooltipCommonUtils.js";const k=d(),A=Symbol(`inactiveManipulatorDisplay`);let j=class extends T{get _manipulatorsToHide(){let e=this._manipulatorByObject.values();return this.view.tools.some(e=>e.hasGrabbedManipulators)||e.some(e=>e.grabbing)?e.filter(e=>!e.grabbing).toArray():[]}constructor(e){super(e),this.events=new t,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new i,this._updatingHandles=new u,this._interactionVisuals=null,this._grabbedManipulator=null,this._visualsManipulator=null}initialize(){let{view:e}=this;this._interactionVisuals=new p({view:e}),this.addHandles([this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(e=>({isTargetVisible:e.computationResult.isTargetVisible,isValid:e.computationResult.isValid,target:e.target})),grabbedManipulator:this._grabbedManipulator,interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),a),o(()=>this._manipulatorsToHide,e=>{let t=e.map(e=>e.disableDisplay());this.removeHandles(A),this.addHandles(t,A)},s)]),this.finishToolCreation()}destroy(){this.removeHandles(A),this._interactionVisuals=r(this._interactionVisuals),this._updatingHandles.destroy(),this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}showInteractionVisuals(e){this._visualsManipulator=this._manipulatorByObject.get(e),this._syncInteractionVisuals()}hideInteractionVisuals(){this._visualsManipulator=null,this._syncInteractionVisuals()}addObject(e){if(this._manipulatorByObject.has(e))return;let t=e.item.type===`observer`?new m(this.view,{deleting:!1,intersection:null,type:`observer`}):new h(this.view,{deleting:!1,target:e.item,type:`target`});t.cursor=`move`,this._objectByItem.set(e.item,e),this._manipulatorByObject.set(e,t),this.manipulators.add(t),this.addHandles(this._connectManipulator(e,t),e),this._syncManipulator(e,t)}removeObject(e){let t=this._manipulatorByObject.get(e);t!=null&&(this._grabbedManipulator===t&&(this._grabbedManipulator=null),this._visualsManipulator===t&&this.hideInteractionVisuals(),this.removeHandles(e),this.removeHandles(e),this._objectByItem.delete(e.item),this._manipulatorByObject.delete(e),this.manipulators.remove(t),t.destroy())}getManipulator(e){let t=this._objectByItem.get(e);return t==null?null:this._manipulatorByObject.get(t)}hasManipulatorAt(e,t){for(let n of this._manipulatorByObject.values())if(n.consumesClicks&&n.intersectionDistance(e,t)!=null)return!0;return!1}selectObject(e){let t=!1;for(let[n,r]of this._manipulatorByObject){let i=n===e;r.selected=i,t||=i}return this._syncManipulators(),t}onInputEvent(e){e.type===`hold`&&this._grabbedManipulator!=null&&(this._visualsManipulator=this._grabbedManipulator,this._syncInteractionVisuals()),O(e,this.tooltip)}onManipulatorSelectionChanged(){[...this._manipulatorByObject.values()].some(e=>e.selected)||this.events.emit(`selection-cleared`)}_connectManipulator(e,t){let r=()=>this._syncManipulator(e,t);return n([e.on(`committed`,r),e.on(`modified-externally`,r),t.events.on(`immediate-click`,n=>{this.events.emit(`select-item`,{item:e.item}),n.button===b.Right&&t.metadata.type===`target`&&this.events.emit(`delete-item`,{target:t.metadata.target}),n.stopPropagation()}),t.events.on(`grab-changed`,({action:n})=>{n===`start`?(this.events.emit(`select-item`,{item:e.item}),this._grabbedManipulator=t):this._grabbedManipulator===t&&(this._grabbedManipulator=null,this.hideInteractionVisuals()),this._manipulatorByObject.set(e,t)}),t.events.on(`drag`,t=>{e.updateDragIntersection(t),t.action===`start`&&this.showInteractionVisuals(e)}),t.events.on(`location-update`,()=>this._syncInteractionVisuals()),this._createDragHandle(e,t)])}_createDragHandle(e,t){return x(t,(n,r,i,a)=>{let o=e.operations;if(o==null)return;let s=null,{cancelSnapping:c,snappingStep:l}=D({snappingContext:new E({editGeometryOperations:o,elevationInfo:e.elevationInfo,pointer:a,visualizer:new v}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});i.next(e=>(s?.undo(null),s=null,e)).next(c);let u=o.data.allVerticesUnordered.at(0);r.next(t=>(t.action===`start`&&(s=e.createUndoRecord()),{...t,snapOrigin:u?.pos})).next(S(this.view,t.elevationAlignedLocation)).next(y(this.view,o.data.geometry,e.elevationInfo,o.data.spatialReference)).next(C(this.view,e.elevationInfo)).next(...l).next(w(e)).next(e=>(e.action===`end`&&s!=null&&(this.events.emit(`record-undo`,{record:s}),s=null),e))})}_syncManipulators(){for(let[e,t]of this._manipulatorByObject)this._syncManipulator(e,t);this._syncInteractionVisuals()}_syncManipulator(e,t){let n=e.origin;if(t.available=this.visible&&e.visible&&n!=null,t.interactive=this.manipulatorsInteractive&&(this._grabbedManipulator==null||this._grabbedManipulator===t),n!=null&&(t.elevationAlignedLocation=n),e.item.type!==`target`)return;let r=this.analysisViewData.computations.find(t=>t.target===e.item),i=r==null||!r.computationResult.isValid?g.undefined:r.computationResult.isTargetVisible?g.visible:g.occluded;t.state=this.interacting&&t.selected?_(i):i}_syncInteractionVisuals(){let e=this._interactionVisuals,t=this._visualsManipulator,n=this.visible&&this.analysisViewData.visible;if(e==null||t==null||!n){e?.hide();return}let r=[...this._manipulatorByObject.entries()].find(([e])=>e.item.type===`observer`)?.[1];if(r==null){e.hide();return}let i=t===r?null:f(r.renderLocation,t.renderLocation,k);e.update({target:t.renderLocation,lineVerticalPlaneSegment:i,visible:!0})}};e([c({constructOnly:!0})],j.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],j.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],j.prototype,`view`,void 0),e([c({constructOnly:!0})],j.prototype,`tooltip`,void 0),e([c()],j.prototype,`automaticManipulatorSelection`,void 0),e([c()],j.prototype,`removeIncompleteOnCancel`,void 0),e([c()],j.prototype,`interacting`,void 0),e([c()],j.prototype,`manipulatorsInteractive`,void 0),e([c()],j.prototype,`_grabbedManipulator`,void 0),e([c()],j.prototype,`_manipulatorsToHide`,null),e([c()],j.prototype,`updating`,null),j=e([l(`esri.views.3d.analysis.LineOfSight.LineOfSightItemTool`)],j);export{j as LineOfSightItemTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as r,syncAndInitial as i,watch as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import{convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{createDrawTool as u}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as d}from"./LineOfSightRootPlugin.js";import{isLineOfSightTargetPlugin as f}from"./LineOfSightTargetPlugin.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const m=Symbol(`hiddenManipulatorHandle`);let h=class extends t{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(e){super(e),this.visible=!0,this.observerPlacementElevationInfo=null,this.targetPlacementElevationInfo=null,this._drawTool=null,this._renderer=null,this._observerSessionElevationInfo=null,this._targetSessionElevationInfo=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([r(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},i),a(()=>this.activeTooltipInfo,e=>{e&&(e.elevationModeContext=this._elevationModeContext)},i)])}destroy(){this._destroyDrawTool()}get
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as r,syncAndInitial as i,watch as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import{convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{createDrawTool as u}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as d}from"./LineOfSightRootPlugin.js";import{isLineOfSightTargetPlugin as f}from"./LineOfSightTargetPlugin.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const m=Symbol(`hiddenManipulatorHandle`);let h=class extends t{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(e){super(e),this.visible=!0,this.observerPlacementElevationInfo=null,this.targetPlacementElevationInfo=null,this._drawTool=null,this._renderer=null,this._observerSessionElevationInfo=null,this._targetSessionElevationInfo=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([r(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},i),a(()=>this.activeTooltipInfo,e=>{e&&(e.elevationModeContext=this._elevationModeContext)},i)])}destroy(){this._destroyDrawTool()}get _placementElevationInfo(){return this.analysis.observer==null?this._observerSessionElevationInfo:this._targetSessionElevationInfo}get _effectiveElevationInfo(){return this._placementElevationInfo??c}get _elevationModeContext(){let e=this;return{get mode(){return e._effectiveElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(!t||!n||!r||e===this._effectiveElevationInfo.mode)return;let i=t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked===!0,{position:a,elevationInfo:o}=l({view:this.view,point:r,sourceElevationInfo:this._placementElevationInfo,mode:e,preserveZ:i}),s=()=>{t.defaultZ=a.z,this.analysis.observer==null?this._observerSessionElevationInfo=o:this._targetSessionElevationInfo=o,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a},c=t.mostDownstreamPlugin;f(c)?c.changeElevationMode(e,i,s):s(),this._renderer?.refresh()}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid,this._observerSessionElevationInfo=this.observerPlacementElevationInfo?.clone()??null,this._targetSessionElevationInfo=this.targetPlacementElevationInfo?.clone()??null;let{drawTool:e,renderer:t}=this._createDrawTool();this._drawTool=e,this._renderer=t,this.view.addAndActivateTool(e),e.begin([d({analysis:this.analysis,analysisViewData:this.analysisViewData,getObserverElevationInfo:()=>this._observerSessionElevationInfo,getTargetElevationInfo:()=>this._targetSessionElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return u({analysis:this.analysis,analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,getSourceElevationInfo:()=>this._effectiveElevationInfo,getVisible:()=>this.visible,onCancel:e=>{e===this._drawTool&&!this._sessionStartedWithValidAnalysis&&this.analysis.observer==null&&(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(e)},onComplete:e=>this._destroyDrawTool(e),onManipulatorCountChange:e=>this._hideManipulatorOnAppearance(e),shouldPreventVertexAdd:this.shouldPreventVertexAdd})}_destroyDrawTool(e=this._drawTool){if(e==null)return;let t=e===this._drawTool;this.view.activeTool===e&&(this.view.activeTool=null),this.view.tools.includes(e)&&this.view.tools.remove(e),e.destroy(),t&&(this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(e){e.removeHandles(m),e.addHandles(e.manipulators.toArray().map(e=>e instanceof p?e.disableDisplay():null).filter(n),m)}};e([o({constructOnly:!0})],h.prototype,`view`,void 0),e([o({constructOnly:!0})],h.prototype,`analysis`,void 0),e([o({constructOnly:!0})],h.prototype,`analysisViewData`,void 0),e([o({constructOnly:!0})],h.prototype,`parent`,void 0),e([o({constructOnly:!0})],h.prototype,`shouldPreventVertexAdd`,void 0),e([o({constructOnly:!0})],h.prototype,`snappingManager`,void 0),e([o()],h.prototype,`visible`,void 0),e([o()],h.prototype,`observerPlacementElevationInfo`,void 0),e([o()],h.prototype,`targetPlacementElevationInfo`,void 0),e([o()],h.prototype,`active`,null),e([o()],h.prototype,`canRedo`,null),e([o()],h.prototype,`canUndo`,null),e([o()],h.prototype,`updating`,null),e([o()],h.prototype,`activeTooltipInfo`,null),e([o()],h.prototype,`tooltip`,null),e([o()],h.prototype,`_drawTool`,void 0),e([o()],h.prototype,`_renderer`,void 0),e([o()],h.prototype,`_observerSessionElevationInfo`,void 0),e([o()],h.prototype,`_targetSessionElevationInfo`,void 0),e([o()],h.prototype,`_elevationModeContext`,null),h=e([s(`esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController`)],h);export{h as LineOfSightPlacementController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as r}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as a}from"./LineOfSightRayIntersector.js";import{DrawTool as o}from"../../../draw/DrawTool.js";import{bindViewToolOptions as s}from"../../../interactive/options/bindViewToolOptions.js";import c from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function u(u){let{analysis:d,analysisViewData:f,snappingManager:p,view:m,getVisible:h,getSourceElevationInfo:g,
|
|
2
|
+
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as r}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as a}from"./LineOfSightRayIntersector.js";import{DrawTool as o}from"../../../draw/DrawTool.js";import{bindViewToolOptions as s}from"../../../interactive/options/bindViewToolOptions.js";import c from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function u(u){let{analysis:d,analysisViewData:f,snappingManager:p,view:m,getVisible:h,getSourceElevationInfo:g,onCancel:_,onComplete:v,onManipulatorCountChange:y,shouldPreventVertexAdd:b}=u,x=g(),S=new r({analysis:d,analysisViewData:f,view:m}),C=new a({view:m}),w=new c,T=new o({elevationInfo:x,enableVertexVisuals:!1,hasZ:!0,renderer:S,toolOptions:w,snappingManager:p,view:m});return S.elevationInfo=x,T.addHandles([e(S),e(C),s(w,()=>m.options),T.on(`cancel`,()=>_(T)),T.on(`complete`,()=>v(T)),t(()=>[h(),f.visible,g()],([e,t,n])=>{T.visible=e&&t,S.analysisVisible=T.visible,T.elevationInfo=n,S.elevationInfo=n,S.refresh()},n),t(()=>T.manipulators.length,()=>y(T),n),t(()=>T.mostDownstreamPlugin,()=>{T.defaultZ=0},n),T.on([`before-vertex-add`,`before-vertex-add-at-point`],e=>{let t=e.detail.originalEvent;if(t?.type!==`immediate-click`)return;let n=l(t);if(b(n,t.pointerType)){e.preventDefault();return}let r=C.getScreenPointIntersection(n);if(r?.mapPoint==null)e.preventDefault();else{let e=T.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=r)}})]),{drawTool:T,renderer:S}}export{u as createDrawTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as r,throwIfAborted as i,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as o,sync as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as d,absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import p from"../../../../symbols/support/ElevationInfo.js";import{createDrawTool as m,getFeatureReference as h}from"./placementUtils.js";import{detachToolFromView as g}from"./toolLifecycleUtils.js";import _ from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as y}from"./viewshedToolUtils.js";import{vectorToRender as b}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as x}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as S}from"../../../input/InputManager.js";import{sketchKeys as C}from"../../../interactive/keybindings.js";import{bindViewToolOptions as w}from"../../../interactive/options/bindViewToolOptions.js";import T from"../../../interactive/options/InteractiveToolOptions.js";const E=Symbol(`hiddenManipulatorHandle`);let D=class extends n{constructor(e){super(e),this.placementMode=`multiple`,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new T,this._observerScenePoint=u(),this._targetScenePoint=u(),this._mapPointVector=u(),this.creationState=null}initialize(){this.addHandles([w(this._toolOptions,()=>this.view.options),o(()=>[this._drawTool?.tooltipManager,this.creationState],([e,t])=>{e&&(e.enabled=t===`placing-observer`)}),o(()=>[this._drawTool?.activeTooltipInfo,this.creationState],([e,t])=>{e&&(e.elevationModeContext=t===`placing-observer`?this._elevationModeContext:null)}),this.view.on(`key-down`,e=>this._handleKeyDown(e),S.DEFAULT),o(()=>{let{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:e!=null&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{e!=null&&!t&&this.analysis.viewsheds.add(e)},s)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get _elevationModeContext(){let e=this;return{get mode(){return e._observerDrawToolElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(this.creationState!==`placing-observer`||!t||!n||!r||e===this._observerDrawToolElevationInfo.mode)return;let i=this.observerPlacementElevationInfo?.clone()??new p;i.mode=e;let a=r.clone();t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked||(a.z=d(this.view,r,this._observerDrawToolElevationInfo,i)),t.defaultZ=a.z,this.observerPlacementElevationInfo=i,this._setDrawToolElevationInfo(i),n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a,this._onObserverMapPointPreview(a)}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(r()),i(t);let{resolve:n,reject:o,promise:s}=Promise.withResolvers(),c=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new _({abortHandle:c,reject:o,resolve:n}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),s}cancelPlaceOperation(){(this.creationState!=null||this._placeOperation!=null)&&(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return this.creationState!=null&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){this.creationState!=null&&(C.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):C.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){this._removeStaged()&&this.placementMode===`multiple`?(this.callbacks.setSelectedViewshed(null),this._startObserverPlacement()):(this._destroyDrawTool(),this._abortCreation())}_removeStaged(){let{stagedViewshed:e}=this;return this.stagedViewshed=null,e?(this.analysis.viewsheds.remove(e),!0):!1}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,n,r){let i=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:r});this.analysis.viewsheds.add(i),this.stagedViewshed=i,this.creationState=`placing-target`,this._updateStagedViewshed(n),this.callbacks.setSelectedViewshed(null)}_onCancel(e){let t=this._removeStaged();if(this.creationState===`placing-observer`){if(t&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(e),this._abortCreation()}else t?(this.creationState=`placing-observer`,this.callbacks.setSelectedViewshed(null),this.placementMode===`multiple`?this._startPointPlacement():(this._destroyDrawTool(e),this._abortCreation())):(this._destroyDrawTool(e),this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);let t=this.stagedViewshed;return t?.valid?(this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),!0):!1}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){let t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState=`placing-observer`,this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);let{drawTool:e,renderer:t}=m({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>this.creationState===`placing-observer`});this._drawTool=e,this._renderer=t;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,t)=>this._onObserverMapPointComplete(e,t),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(t){this._destroyDrawTool(e),this._rejectPlaceOperation(t instanceof Error?t:Error(String(t)))}}_onComplete(e){this._removeStaged(),this._finishPlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t){let{intersector:n,snappingManager:r,view:i}=this,a=e.clone(),o=this._toScenePoint(e,this._targetScenePoint,this._observerDrawToolElevationInfo),s=h({intersector:n,snappingManager:r,screenPoint:t,view:i});this._renderer?.updatePlacementLocation(o),this._handleObserverPlacementComplete(a,o,s),this._setDrawToolElevationInfo(f)}_onTargetMapPointComplete(e){let t=this._toScenePoint(e,this._targetScenePoint);return this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)?(this.placementMode===`multiple`&&(this.creationState=`placing-observer`,this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e)),!0):!1}_onObserverMapPointPreview(e){let t=e.clone(),n=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(n)}_onTargetMapPointPreview(e){let t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){let t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??f}get _snapToSceneEnabled(){let e=this.observerPlacementElevationInfo?.mode;return this.creationState!==`placing-observer`||e==null||e===`absolute-height`?null:!1}_onManipulatorCountChange(e){e.removeHandles(E);let t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof x&&t.push(e.disableDisplay())}),e.addHandles(t,E)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&g(this.view,e)}_toScenePoint(e,t,n=f){let{x:r,y:i,z:a,spatialReference:o}=e,s=this._mapPointVector;return s[0]=r,s[1]=i,s[2]=a??0,b(s,o,n,this.view,t)}_updateStagedViewshed(e){let t=this.stagedViewshed;if(!t)return;let n=this.callbacks.findViewshedComputedData(t);if(!n)return;let{heading:r,tilt:i,farDistance:a}=y(this.view,n,e);t.farDistance=a,t.tilt=i,t.heading=r}get test(){}};e([c({constructOnly:!0})],D.prototype,`analysis`,void 0),e([c({constructOnly:!0})],D.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],D.prototype,`intersector`,void 0),e([c({constructOnly:!0})],D.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],D.prototype,`view`,void 0),e([c({constructOnly:!0})],D.prototype,`callbacks`,void 0),e([c()],D.prototype,`placementMode`,void 0),e([c()],D.prototype,`observerPlacementElevationInfo`,void 0),e([c()],D.prototype,`stagedViewshed`,void 0),e([c()],D.prototype,`_placeOperation`,void 0),e([c()],D.prototype,`_drawTool`,void 0),e([c()],D.prototype,`_renderer`,void 0),e([c()],D.prototype,`_toolOptions`,void 0),e([c()],D.prototype,`updating`,null),e([c()],D.prototype,`active`,null),e([c()],D.prototype,`creationState`,void 0),e([c()],D.prototype,`_elevationModeContext`,null),D=e([l(`esri.views.3d.analysis.Viewshed.ViewshedPlacementController`)],D);export{D as ViewshedPlacementController};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as r,throwIfAborted as i,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as o,sync as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as d,absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import p from"../../../../symbols/support/ElevationInfo.js";import{createDrawTool as m,getFeatureReference as h}from"./placementUtils.js";import{detachToolFromView as g}from"./toolLifecycleUtils.js";import _ from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as y}from"./viewshedToolUtils.js";import{vectorToRender as b}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as x}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as S}from"../../../input/InputManager.js";import{sketchKeys as C}from"../../../interactive/keybindings.js";import{bindViewToolOptions as w}from"../../../interactive/options/bindViewToolOptions.js";import T from"../../../interactive/options/InteractiveToolOptions.js";const E=Symbol(`hiddenManipulatorHandle`);let D=class extends n{constructor(e){super(e),this.placementMode=`multiple`,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new T,this._observerScenePoint=u(),this._targetScenePoint=u(),this._mapPointVector=u(),this.creationState=null}initialize(){this.addHandles([w(this._toolOptions,()=>this.view.options),o(()=>[this._drawTool?.tooltipManager,this.creationState],([e,t])=>{e&&(e.enabled=t===`placing-observer`)}),o(()=>[this._drawTool?.activeTooltipInfo,this.creationState],([e,t])=>{e&&(e.elevationModeContext=t===`placing-observer`?this._elevationModeContext:null)}),this.view.on(`key-down`,e=>this._handleKeyDown(e),S.DEFAULT),o(()=>{let{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:e!=null&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{e!=null&&!t&&this.analysis.viewsheds.add(e)},s)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get _elevationModeContext(){let e=this;return{get mode(){return e._observerDrawToolElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(this.creationState!==`placing-observer`||!t||!n||!r||e===this._observerDrawToolElevationInfo.mode)return;let i=this.observerPlacementElevationInfo?.clone()??new p;i.mode=e;let a=r.clone();t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked||(a.z=d(this.view,r,this._observerDrawToolElevationInfo,i)),t.defaultZ=a.z,this.observerPlacementElevationInfo=i,t.elevationInfo=i,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(r()),i(t);let{resolve:n,reject:o,promise:s}=Promise.withResolvers(),c=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new _({abortHandle:c,reject:o,resolve:n}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),s}cancelPlaceOperation(){(this.creationState!=null||this._placeOperation!=null)&&(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return this.creationState!=null&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){this.creationState!=null&&(C.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):C.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){this._removeStaged()&&this.placementMode===`multiple`?(this.callbacks.setSelectedViewshed(null),this._startObserverPlacement()):(this._destroyDrawTool(),this._abortCreation())}_removeStaged(){let{stagedViewshed:e}=this;return this.stagedViewshed=null,e?(this.analysis.viewsheds.remove(e),!0):!1}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,n,r){let i=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:r});this.analysis.viewsheds.add(i),this.stagedViewshed=i,this.creationState=`placing-target`,this._updateStagedViewshed(n),this.callbacks.setSelectedViewshed(null)}_onCancel(e){let t=this._removeStaged();if(this.creationState===`placing-observer`){if(t&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(e),this._abortCreation()}else t?(this.creationState=`placing-observer`,this.callbacks.setSelectedViewshed(null),this.placementMode===`multiple`?this._startPointPlacement():(this._destroyDrawTool(e),this._abortCreation())):(this._destroyDrawTool(e),this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);let t=this.stagedViewshed;return t?.valid?(this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),!0):!1}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){let t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState=`placing-observer`,this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);let{drawTool:e,renderer:t}=m({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>this.creationState===`placing-observer`});this._drawTool=e,this._renderer=t;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,t)=>this._onObserverMapPointComplete(e,t),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(t){this._destroyDrawTool(e),this._rejectPlaceOperation(t instanceof Error?t:Error(String(t)))}}_onComplete(e){this._removeStaged(),this._finishPlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t){let{intersector:n,snappingManager:r,view:i}=this,a=e.clone(),o=this._toScenePoint(e,this._targetScenePoint,this._observerDrawToolElevationInfo),s=h({intersector:n,snappingManager:r,screenPoint:t,view:i});this._renderer?.updatePlacementLocation(o),this._handleObserverPlacementComplete(a,o,s),this._setDrawToolElevationInfo(f)}_onTargetMapPointComplete(e){let t=this._toScenePoint(e,this._targetScenePoint);return this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)?(this.placementMode===`multiple`&&(this.creationState=`placing-observer`,this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e)),!0):!1}_onObserverMapPointPreview(e){let t=e.clone(),n=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(n)}_onTargetMapPointPreview(e){let t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){let t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??f}_onManipulatorCountChange(e){e.removeHandles(E);let t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof x&&t.push(e.disableDisplay())}),e.addHandles(t,E)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&g(this.view,e)}_toScenePoint(e,t,n=f){let{x:r,y:i,z:a,spatialReference:o}=e,s=this._mapPointVector;return s[0]=r,s[1]=i,s[2]=a??0,b(s,o,n,this.view,t)}_updateStagedViewshed(e){let t=this.stagedViewshed;if(!t)return;let n=this.callbacks.findViewshedComputedData(t);if(!n)return;let{heading:r,tilt:i,farDistance:a}=y(this.view,n,e);t.farDistance=a,t.tilt=i,t.heading=r}get test(){}};e([c({constructOnly:!0})],D.prototype,`analysis`,void 0),e([c({constructOnly:!0})],D.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],D.prototype,`intersector`,void 0),e([c({constructOnly:!0})],D.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],D.prototype,`view`,void 0),e([c({constructOnly:!0})],D.prototype,`callbacks`,void 0),e([c()],D.prototype,`placementMode`,void 0),e([c()],D.prototype,`observerPlacementElevationInfo`,void 0),e([c()],D.prototype,`stagedViewshed`,void 0),e([c()],D.prototype,`_placeOperation`,void 0),e([c()],D.prototype,`_drawTool`,void 0),e([c()],D.prototype,`_renderer`,void 0),e([c()],D.prototype,`_toolOptions`,void 0),e([c()],D.prototype,`updating`,null),e([c()],D.prototype,`active`,null),e([c()],D.prototype,`creationState`,void 0),e([c()],D.prototype,`_elevationModeContext`,null),D=e([l(`esri.views.3d.analysis.Viewshed.ViewshedPlacementController`)],D);export{D as ViewshedPlacementController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){this._interactiveHandle
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){if(this._interactiveHandle)return;let{defaultCaptureMode:i}=this;this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:i,inputMapPosition:i===`grabbable-object`?r:void 0},{disableDefaultXYFields:this.step===`target`}),this.addHandles(t(()=>{let e=this._interactiveHandle;return{outputMapPosition:e?.outputMapPosition,screenPosition:e?.screenPosition}},({outputMapPosition:e,screenPosition:t})=>{this.outputMapPosition=e?.clone(),this.screenPosition=t,e&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,e)},n),this._ownHandlesKey)}_getInitialMapPoint(e){return this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??e:this.inputMapPosition??e}};e([r({constructOnly:!0})],c.prototype,`step`,void 0),e([r()],c.prototype,`defaultCaptureMode`,void 0),e([r()],c.prototype,`inputMapPosition`,void 0),e([r()],c.prototype,`outputMapPosition`,void 0),e([r()],c.prototype,`screenPosition`,void 0),e([r()],c.prototype,`hasCommittedPoint`,void 0),e([r()],c.prototype,`_interactiveHandle`,void 0),c=e([i(`esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin`)],c);function l(e){return{uniqueId:Symbol(`viewshed-${e}-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new c({step:e})}}export{c as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,
|
|
2
|
+
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,onCancel:p,onComplete:m,onManipulatorCountChange:h,isPlacingObserver:g}=a,_=new o({view:u,isPlacingObserver:g}),v=new l({elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:_,toolOptions:d,snappingManager:c,view:u});return v.addHandles([e(_),v.on(`cancel`,()=>p(v)),v.on(`complete`,()=>m(v)),t(()=>v.mostDownstreamPlugin,()=>v.defaultZ=0,n),t(()=>v.manipulators.length,()=>h(v),r),t(()=>s.visible,e=>_.analysisVisible=e,i)]),{drawTool:v,renderer:_}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
|