@arcgis/core 6.0.0-next.1 → 6.0.0-next.2
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/261fea092ee7d27608a0.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/{aa1054834738aef48bda.js → a0356702f2d3f787aeac.js} +1 -1
- package/assets/esri/core/workers/chunks/ac4cc49104d26c384e98.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/chunks/RibbonLine.glsl.js +9 -11
- package/config.js +1 -1
- package/core/screenUtils.js +1 -1
- package/kernel.js +1 -1
- package/package.json +2 -2
- 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/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/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/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +9 -2
- package/assets/esri/core/workers/chunks/084222c00d263a534952.js +0 -1
- package/assets/esri/core/workers/chunks/37a636f61cfe89c6bfd1.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/ca7fb75e2c62e7d37122.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,__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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{multiplyOpacity as e}from"../../../core/colorUtils.js";import{destroyHandle as t,makeHandle as n}from"../../../core/handleUtils.js";import{lerp as r}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as a}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as o,absoluteHeightElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{vectorToRender as c}from"./support/viewUtils.js";import{ExtendedLineVisualElement as l}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as u}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as f}from"./visualElements/RightAngleQuadVisualElement.js";import{createDehydratedPoint as p,isTarget as m,withSelfSnappingZ as h}from"../../interactive/sketch/normalizedPoint.js";import{defaults as g}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as _}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as v}from"../../interactive/snapping/hints/LineSnappingHint.js";class y extends _{sortUniqueHints(e){return e.sort((e,t)=>(t instanceof v?t.length:0)-(e instanceof v?e.length:0))}visualizeIntersectionPoint(e,n){let{spatialReference:r,view:i}=n,a=b(n);return t(new d({view:i,primitive:`circle`,geometry:p(e.intersectionPoint,r),elevationInfo:e.isDraped?o:s,size:20,outlineSize:2,color:a.intersectionPointColor,outlineColor:a.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){let{view:r,spatialReference:i}=n,a=b(n),o=x(e.point,e.domain,n);return t(new d({view:r,primitive:`circle`,geometry:p(o,i),elevationInfo:S(e),size:20,outlineSize:2,color:a.pointColor,outlineColor:a.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n){let{view:
|
|
2
|
+
import{multiplyOpacity as e}from"../../../core/colorUtils.js";import{destroyHandle as t,makeHandle as n}from"../../../core/handleUtils.js";import{lerp as r}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectVectorToVector as a}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as o,absoluteHeightElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{vectorToRender as c}from"./support/viewUtils.js";import{ExtendedLineVisualElement as l}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as u}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as f}from"./visualElements/RightAngleQuadVisualElement.js";import{createDehydratedPoint as p,isTarget as m,withSelfSnappingZ as h}from"../../interactive/sketch/normalizedPoint.js";import{defaults as g}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as _}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as v}from"../../interactive/snapping/hints/LineSnappingHint.js";class y extends _{sortUniqueHints(e){return e.sort((e,t)=>(t instanceof v?t.length:0)-(e instanceof v?e.length:0))}visualizeIntersectionPoint(e,n){let{spatialReference:r,view:i}=n,a=b(n);return t(new d({view:i,primitive:`circle`,geometry:p(e.intersectionPoint,r),elevationInfo:e.isDraped?o:s,size:20,outlineSize:2,color:a.intersectionPointColor,outlineColor:a.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){let{view:r,spatialReference:i}=n,a=b(n),o=x(e.point,e.domain,n);return t(new d({view:r,primitive:`circle`,geometry:p(o,i),elevationInfo:S(e),size:20,outlineSize:2,color:a.pointColor,outlineColor:a.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n,r){let{view:i,spatialReference:a}=n,o=b(n),s=x(e.lineStart,e.domain,n),c=x(e.lineEnd,e.domain,n);return t(C(e.type,s,c,a,S(e),i,o,r,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeCurve(e,t){return n()}visualizeParallelSign(e,n,i){let{view:a,spatialReference:o}=n,s=b(n),{isDraped:c}=e,l=S(e),d=x(e.lineStart,e.domain,n),f=x(e.lineEnd,e.domain,n),p=w(d,o,l,a,c),m=w(f,o,l,a,c),h=r(m,p,m,.5),_=new u({view:a,attached:!1,offset:g.parallelLineHintOffset,length:g.parallelLineHintLength,width:g.parallelLineHintWidth,color:s.parallelSignColor,location:h,renderOccluded:c?4:16,transparentRenderOrder:i,isDraped:c,renderGroup:3,isDecoration:!0});return _.setDirectionFromPoints(p,h),_.attached=!0,t(_)}visualizeRightAngleQuad(e,n,r){let{view:i,spatialReference:a}=n,o=b(n),s=S(e),{isDraped:c}=e,l=x(e.previousVertex,e.domain,n),u=x(e.centerVertex,e.domain,n),d=x(e.nextVertex,e.domain,n),p=w(l,a,s,i,c),m=w(u,a,s,i,c),h=w(d,a,s,i,c);return t(new f({view:i,attached:!0,color:c?o.rightAngleColorDraped:o.rightAngleColor,renderOccluded:c?4:2,outlineRenderOccluded:c?4:16,outlineColor:o.rightAngleOutlineColor,outlineSize:g.rightAngleHintOutlineSize,size:g.rightAngleHintSize,transparentRenderOrder:r,isDraped:c,geometry:{previous:p,center:m,next:h},renderGroup:3,isDecoration:!0}))}}function b(t){let{effectiveTheme:n}=t.view,r=n.accentColor.toUnitRGBA(),i=[0,0,0,0];return{intersectionPointColor:i,intersectionPointOutlineColor:r,pointColor:i,pointOutlineColor:r,lineColor:r,lineOutlineColor:void 0,parallelSignColor:r,rightAngleColor:r,rightAngleColorDraped:e(n.accentColor,.5).toUnitRGBA(),rightAngleOutlineColor:r}}function x(e,t,{selfSnappingZ:n,view:r,spatialReference:i}){return t&2&&m(e)&&n!=null?h(e,n,r,i):e}function S(e){return e.isDraped?o:s}function C(e,t,n,r,i,a,o,s,c=!1,u=!0,d=!0){let f=w(t,r,i,a,c),p=w(n,r,i,a,c),m=new l({view:a,extensionType:3,start:f,end:p,isDraped:c,color:o.lineColor,renderOccluded:c?4:16,transparentRenderOrder:s,renderGroup:3,isDecoration:!0});switch(e){case 0:m.width=g.lineHintWidthTarget,m.fadedExtensions={start:0,end:g.lineHintFadedExtensions};break;case 2:m.width=g.lineHintWidthReference,m.fadedExtensions={start:0,end:0};break;case 1:m.width=g.lineHintWidthReference,m.fadedExtensions={start:u?g.lineHintFadedExtensions:0,end:d?g.lineHintFadedExtensions:0}}return m.attached=!0,m}function w(e,t,n,r,o){let s=i();if(o){let n=r.overlayManager.spatialReference;a(e,t,s,n)}else c(e,t,n,r,s);return s}export{y as SnappingVisualizer3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Collection.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{debounce as o}from"../../../../../core/promiseUtils.js";import{scale as s,zeroMeters as c}from"../../../../../core/quantity.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as m}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as ee}from"../../../../../core/support/UpdatingHandles.js";import te from"../../../../../geometry/Point.js";import{makeDehydratedPoint as h}from"../../../../../layers/graphics/dehydratedPoint.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as v,supportsElevationMode as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as x}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as S}from"../tooltipUtils3D.js";import{createVisualElements as C}from"../visualElementUtils.js";import{discRadius as ne}from"../manipulations/config.js";import{MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as E}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as D}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as A,resetManipulatedObjectMany as j}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as N}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import P from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as F}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as L,enterInputModeIfAvailable as R}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as H}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class G{constructor(e){this.objects=e,this.type=`move-start`}}class K{constructor(e,t,n){this.dx=e,this.dy=t,this.objects=n,this.type=`move`}}class q{constructor(e){this.objects=e,this.type=`move-stop`}}class J{constructor(e){this.objects=e,this.type=`hold`}}const Y=Symbol(`manipulators`),X=Symbol(`tooltips`),Z=Symbol(`move-manipulator-display`);let Q=class extends M{get _infos(){return Array.from(this._infosByType.values())}constructor(e){super(e),this._infosByType=new Map,this.events=new r,this.objects=new n,this.enableVisualElements=!0,this.enableZ=!0,this.manipulatorRadius=null,this.toolOptions=new P,this.type=`move-3d`,this._measurementWorker=new W({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new ee,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=o(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){let{view:e}=this;this.tooltip=L(()=>({view:e,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,e=>{e.removed.forEach(e=>this.removeHandles(e)),this._updateObjectInfos(e),this._setupObjectUpdateHandles(e.added),this._refreshManipulators(),this._connectTooltips()}));let t=this.objects.toArray();this._updateObjectInfos({added:t,removed:[]}),this._setupObjectUpdateHandles(t),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=a(this.tooltip),this._moveManipulation=a(this._moveManipulation),this._set(`view`,null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(e){if(this.destroyed||R(e,this.tooltip))return;let t=this.firstGrabbedManipulator;if(e.type===`hold`&&t!=null){let e=this._getActiveObjectInfos(this._infos,t).map(({object:e})=>e);this.events.emit(`hold`,new J(e))}return super.onInputEvent(e)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){let{objects:e}=this;if(e.length!==1)return!1;let t=v(e.at(0))?.type;return t===`point`||t===`mesh`}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:e,removed:t}){for(let t of e){if(D(t)!==0)continue;let e=new re(t);this._infosByType.set(t,e)}for(let e of t)this._infosByType.delete(e)}_setupObjectUpdateHandles(e){for(let t of e){let e=this._infosByType.get(t);this.addHandles(x(e.object),t),y(t)&&this.addHandles(l(()=>{let{mode:e,unit:n,offset:r}=t.elevationInfo;return[e,n,r]},()=>this._refreshManipulators()),t)}}_refreshManipulators(){if(this.removeHandles(Y),this.removeHandles(Z),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),this._infosByType.size===0)return;let e=this._infos;this._createManipulators(e),this._createVisualElements(e),this._updateMoveManipulation(e)}_createManipulators(e){for(let t of e){let n=t.object;t.manipulationXY=new E({tool:this,view:this.view,object:n}),t.manipulationXY.forEachManipulator(e=>{this.addHandles([e.events.on(`immediate-click`,e=>{this.events.emit(`immediate-click`,{...e,object:n}),e.stopPropagation()}),e.events.on(`grab-changed`,({action:e})=>{e===`start`?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],Y)}),this.addHandles(t.manipulationXY.createDragPipeline((t,n,r,i)=>this._buildDragEventPipeline(e,0,t,n,r,i)),Y)}this._createMoveManipulation(e)}_updateMoveManipulatorDisplay(){let e=this._infos.some(e=>e.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!e),this.removeHandles(Z),e&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Z)}_createMoveManipulation(e){let t=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:this.manipulatorRadius??(e.length===1?w.radiusForSymbol(e[0].object.graphic?.symbol):ne)});this._moveManipulation=t,t.elevationInfo={mode:`absolute-height`,offset:0},t.forEachManipulator(e=>{this.addHandles(e.events.on(`immediate-click`,n=>{let r=this.objects.at(0);!t.zManipulation.hasManipulator(e)&&this.objects.length===1&&r&&this.events.emit(`immediate-click`,{...n,object:r}),n.stopPropagation()}),Y)});let n=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._showTooltip(e):this._hideTooltip()}),t.events.on(`grab-changed`,()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=c)})],Y)};this._moveManipulation.xyManipulation.forEachManipulator(n(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(1)),this._moveManipulation.zManipulation.forEachManipulator(n(2));let r=()=>this._updateMoveManipulation(e);for(let t of e){this.addHandles([t.object.on(`committed`,r),this._updatingHandles.add(()=>t.object.visible,r)],Y);let n=Symbol();this.addHandles(this._updatingHandles.add(()=>t.object.isDraped,r=>{this._updateMoveManipulation(e),this.removeHandles(n),r&&this.addHandles(k({view:this.view,geometry:t.object.graphic?.geometry,elevationInfo:t.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(e)}),n)},u),Y),this.addHandles(i(()=>this.removeHandles(n)),Y)}let a=e[e.length-1];this.addHandles(a.object.on(`committed`,()=>this._updateMoveManipulationAngle(a)),Y);let{object:o}=a,{operations:s}=o;if(s){let n=o.graphic;this.addHandles(t.createDragPipeline((t,n,r,i,a)=>this._buildDragEventPipeline(e,t,n,r,i,a),o.elevationInfo,s.data.spatialReference,n),Y)}this._updateMoveManipulationAngle(a)}_createVisualElements(e){if(this.enableVisualElements)for(let t of e){let n=t.object,r=C({view:this.view,object:n,forEachManipulator:e=>{t.manipulationXY?.forEachManipulator(e),this._moveManipulation?.forEachManipulator(e)},onManipulatorsChanged:()=>i()});r!=null&&(t.geometryRepresentation=r.visualElement,t.geometryRepresentation instanceof O&&this.addHandles([t.geometryRepresentation.events.on(`attachment-origin-changed`,()=>{t.object.isDraped||this._updateMoveManipulation(e)}),this._updatingHandles.add(()=>t.object.isDraped,()=>this._updateMoveManipulation(e))],Y),this.addHandles(r,Y))}}_updateMoveManipulationAngle(e){this._moveManipulation&&(this._moveManipulation.angle=_(v(e.object)))}_updateMoveManipulation(e){let t=h(0,0,0,this.view.spatialReference),n=0,r=!1,i=this._moveManipulation;if(i){for(let i of e){if(!i.object.visible)continue;this.enableZ&&b(i.object.operations,i.object.elevationInfo)&&(r=!0);let e=i.geometryRepresentation instanceof O&&!i.object.isDraped?i.geometryRepresentation.attachmentOrigin:i.object.origin;if(e!=null){let{x:r,y:i,z:a}=e;t.x+=r,t.y+=i,a&&(t.z??=0,t.z+=a),n++}}n>0?(t.x/=n,t.y/=n,t.z??=0,t.z/=n,i.location=t,i.xyManipulation.available=!0,i.xyAxisManipulation.available=!0,i.zManipulation.available=r):i.available=!1}}_buildDragEventPipeline(e,t,n,r,i,a){let o=[],s=[],c=null,l=null,u=()=>{for(let e of o)e.dragging=!1;o.length=0,s.length=0,c=null,l=null,this._updateMoveManipulatorDisplay()};if(e.length===1&&t===0){let t=e[0].object;({steps:r,cancel:i}=this._buildSnappingPipelineSteps(t,t.elevationInfo,r,i,a))}return i=i.next(e=>l?.(e)).next(()=>(s.length&&this.events.emit(`move-stop`,new q(s)),this.destroyed||u(),null)),r=r.next(t=>{if(t.action===`start`){o.length=0,s.length=0;for(let t of this._getActiveObjectInfos(e,n))o.push(t),s.push(t.object),t.dragging=!0;if(s.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),c=A(s),l=j(s),this._emitRecordUndo(),this.events.emit(`move-start`,new G(s)),this.destroyed))return null}return s.length===0?null:t}).next(e=>c?.(e)).next(e=>(this._updateMoveTooltip(t,e),e)).next(e=>{switch(e.action){case`start`:case`update`:if(e.translationX||e.translationY||e.translationZ){let t=this.view.toScreen(e.mapStart),n=this.view.toScreen(e.mapEnd);if(!t||!n)return null;let r=n.x-t.x,i=n.y-t.y;if(this.events.emit(`move`,new K(r,i,s)),this.destroyed)return null}break;case`end`:if(this.events.emit(`move-stop`,new q(s)),this.destroyed)return null;u()}return null}),{steps:r,cancel:i}}_getActiveObjectInfos(e,t){return e.filter(e=>!e.dragging&&(e.manipulationXY?.hasManipulator(t)||!e.manipulationXY?.grabbing))}_connectTooltips(){this.removeHandles(X);let e;if(this._shouldShowMovePointTooltip){let t=this.objects.at(0),{events:n}=this;this._movePointTooltipInfo??=new z({viewType:this.view.type,toolOptions:this.toolOptions});let r={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),n.emit(`move-start`,new G([t]))},onMove:()=>n.emit(`move`,new K(0,0,[t])),onMoveStop:()=>n.emit(`move-stop`,new q([t])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};e=S(this.tooltip,t,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:r,onRecordUndo:e=>n.emit(`record-undo`,{updates:[e]})}))}else e=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,e=>{this.tooltip.info=e},d);this.addHandles(e,X)}_showTooltip(e){this._shouldShowMovePointTooltip||this._updateMoveTooltip(e)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(e,t){if(this._shouldShowMovePointTooltip)return;let{toolOptions:n}=this;switch(e){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new B({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,(e,t)=>this._measurementWorker.autoDistance2DBetweenPoints($(e),$(t))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,async(e,n)=>s(await this._measurementWorker.autoDistance2DBetweenPoints($(e),$(n)),T(t))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new H({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,U))}this._latestTooltipInfo.toolOptions=n}async _updateMoveTooltipDistanceAsync(e,t,n){if(t!=null&&t.action!==`end`){let{mapStart:r,mapEnd:i}=t;e.distance=await n(r,i)??c}else e.distance=c}_emitRecordUndo(){let e=this.objects.toArray().map(e=>e.createUndoRecord?.()).filter(t);e.length>0&&this.events.emit(`record-undo`,{updates:e})}_buildSnappingPipelineSteps(e,t,n,r,i){let a=v(e);if(a==null||a.type!==`point`&&a.type!==`mesh`)return{steps:n,cancel:r};let o=(a.type===`point`?a:a.origin).clone(),s=new F({elevationInfo:t,pointer:i,editGeometryOperations:N.fromGeometry(o,this.view.state.viewingMode),visualizer:new g,excludeFeature:e.graphic}),c=this.snappingManager,{snappingStep:l,cancelSnapping:u}=I({snappingContext:s,snappingManager:c,updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(u),n=n.next(e=>{let t=s.coordinateHelper.pointToVector(o);return{...e,snapOrigin:t}}).next(...l),{steps:n,cancel:r}}get test(){}};e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`objects`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableVisualElements`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableZ`,void 0),e([f({constructOnly:!0})],Q.prototype,`manipulatorRadius`,void 0),e([f({constructOnly:!0,type:P})],Q.prototype,`toolOptions`,void 0),e([f({constructOnly:!0})],Q.prototype,`snappingManager`,void 0),e([f()],Q.prototype,`type`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`_latestTooltipInfo`,void 0),e([f()],Q.prototype,`_shouldShowMovePointTooltip`,null),e([f()],Q.prototype,`activeTooltipInfo`,null),Q=e([p(`esri.views.3d.interactive.editingTools.move.MoveTool3D`)],Q);const $=m(te);class re{constructor(e){this.object=e,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{J as HoldEvent,K as MoveEvent,G as MoveStartEvent,q as MoveStopEvent,Q as MoveTool3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Collection.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{debounce as o}from"../../../../../core/promiseUtils.js";import{scale as s,zeroMeters as c}from"../../../../../core/quantity.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as m}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as ee}from"../../../../../core/support/UpdatingHandles.js";import te from"../../../../../geometry/Point.js";import{makeDehydratedPoint as h}from"../../../../../layers/graphics/dehydratedPoint.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as v,supportsElevationMode as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as x}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as S}from"../tooltipUtils3D.js";import{createVisualElements as C}from"../visualElementUtils.js";import{discRadius as ne}from"../manipulations/config.js";import{MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as E}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as D}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as A,resetManipulatedObjectMany as j}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as N}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import P from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as F}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as L,enterInputModeIfAvailable as R}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as H}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class G{constructor(e){this.objects=e,this.type=`move-start`}}class K{constructor(e,t,n){this.dx=e,this.dy=t,this.objects=n,this.type=`move`}}class q{constructor(e){this.objects=e,this.type=`move-stop`}}class J{constructor(e){this.objects=e,this.type=`hold`}}const Y=Symbol(`manipulators`),X=Symbol(`tooltips`),Z=Symbol(`move-manipulator-display`);let Q=class extends M{get _infos(){return Array.from(this._infosByType.values())}constructor(e){super(e),this._infosByType=new Map,this.events=new r,this.objects=new n,this.enableVisualElements=!0,this.enableZ=!0,this.manipulatorRadius=null,this.toolOptions=new P,this.type=`move-3d`,this._measurementWorker=new W({preloadGeodetic:!0}),this._ownedTooltip=null,this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new ee,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=o(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){let{view:e}=this;this.tooltip??=this._ownedTooltip=L(()=>({view:e,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,e=>{e.removed.forEach(e=>this.removeHandles(e)),this._updateObjectInfos(e),this._setupObjectUpdateHandles(e.added),this._refreshManipulators(),this._connectTooltips()}));let t=this.objects.toArray();this._updateObjectInfos({added:t,removed:[]}),this._setupObjectUpdateHandles(t),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this._ownedTooltip=a(this._ownedTooltip),this._moveManipulation=a(this._moveManipulation),this._set(`view`,null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(e){if(this.destroyed||R(e,this.tooltip))return;let t=this.firstGrabbedManipulator;if(e.type===`hold`&&t!=null){let e=this._getActiveObjectInfos(this._infos,t).map(({object:e})=>e);this.events.emit(`hold`,new J(e))}return super.onInputEvent(e)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){let{objects:e}=this;if(e.length!==1)return!1;let t=v(e.at(0))?.type;return t===`point`||t===`mesh`}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:e,removed:t}){for(let t of e){if(D(t)!==0)continue;let e=new re(t);this._infosByType.set(t,e)}for(let e of t)this._infosByType.delete(e)}_setupObjectUpdateHandles(e){for(let t of e){let e=this._infosByType.get(t);this.addHandles(x(e.object),t),y(t)&&this.addHandles(l(()=>{let{mode:e,unit:n,offset:r}=t.elevationInfo;return[e,n,r]},()=>this._refreshManipulators()),t)}}_refreshManipulators(){if(this.removeHandles(Y),this.removeHandles(Z),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),this._infosByType.size===0)return;let e=this._infos;this._createManipulators(e),this._createVisualElements(e),this._updateMoveManipulation(e)}_createManipulators(e){for(let t of e){let n=t.object;t.manipulationXY=new E({tool:this,view:this.view,object:n}),t.manipulationXY.forEachManipulator(e=>{this.addHandles([e.events.on(`immediate-click`,e=>{this.events.emit(`immediate-click`,{...e,object:n}),e.stopPropagation()}),e.events.on(`grab-changed`,({action:e})=>{e===`start`?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],Y)}),this.addHandles(t.manipulationXY.createDragPipeline((t,n,r,i)=>this._buildDragEventPipeline(e,0,t,n,r,i)),Y)}this._createMoveManipulation(e)}_updateMoveManipulatorDisplay(){let e=this._infos.some(e=>e.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!e),this.removeHandles(Z),e&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Z)}_createMoveManipulation(e){let t=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:this.manipulatorRadius??(e.length===1?w.radiusForSymbol(e[0].object.graphic?.symbol):ne)});this._moveManipulation=t,t.elevationInfo={mode:`absolute-height`,offset:0},t.forEachManipulator(e=>{this.addHandles(e.events.on(`immediate-click`,n=>{let r=this.objects.at(0);!t.zManipulation.hasManipulator(e)&&this.objects.length===1&&r&&this.events.emit(`immediate-click`,{...n,object:r}),n.stopPropagation()}),Y)});let n=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._showTooltip(e):this._hideTooltip()}),t.events.on(`grab-changed`,()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=c)})],Y)};this._moveManipulation.xyManipulation.forEachManipulator(n(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(1)),this._moveManipulation.zManipulation.forEachManipulator(n(2));let r=()=>this._updateMoveManipulation(e);for(let t of e){this.addHandles([t.object.on(`committed`,r),this._updatingHandles.add(()=>t.object.visible,r)],Y);let n=Symbol();this.addHandles(this._updatingHandles.add(()=>t.object.isDraped,r=>{this._updateMoveManipulation(e),this.removeHandles(n),r&&this.addHandles(k({view:this.view,geometry:t.object.graphic?.geometry,elevationInfo:t.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(e)}),n)},u),Y),this.addHandles(i(()=>this.removeHandles(n)),Y)}let a=e[e.length-1];this.addHandles(a.object.on(`committed`,()=>this._updateMoveManipulationAngle(a)),Y);let{object:o}=a,{operations:s}=o;if(s){let n=o.graphic;this.addHandles(t.createDragPipeline((t,n,r,i,a)=>this._buildDragEventPipeline(e,t,n,r,i,a),o.elevationInfo,s.data.spatialReference,n),Y)}this._updateMoveManipulationAngle(a)}_createVisualElements(e){if(this.enableVisualElements)for(let t of e){let n=t.object,r=C({view:this.view,object:n,forEachManipulator:e=>{t.manipulationXY?.forEachManipulator(e),this._moveManipulation?.forEachManipulator(e)},onManipulatorsChanged:()=>i()});r!=null&&(t.geometryRepresentation=r.visualElement,t.geometryRepresentation instanceof O&&this.addHandles([t.geometryRepresentation.events.on(`attachment-origin-changed`,()=>{t.object.isDraped||this._updateMoveManipulation(e)}),this._updatingHandles.add(()=>t.object.isDraped,()=>this._updateMoveManipulation(e))],Y),this.addHandles(r,Y))}}_updateMoveManipulationAngle(e){this._moveManipulation&&(this._moveManipulation.angle=_(v(e.object)))}_updateMoveManipulation(e){let t=h(0,0,0,this.view.spatialReference),n=0,r=!1,i=this._moveManipulation;if(i){for(let i of e){if(!i.object.visible)continue;this.enableZ&&b(i.object.operations,i.object.elevationInfo)&&(r=!0);let e=i.geometryRepresentation instanceof O&&!i.object.isDraped?i.geometryRepresentation.attachmentOrigin:i.object.origin;if(e!=null){let{x:r,y:i,z:a}=e;t.x+=r,t.y+=i,a&&(t.z??=0,t.z+=a),n++}}n>0?(t.x/=n,t.y/=n,t.z??=0,t.z/=n,i.location=t,i.xyManipulation.available=!0,i.xyAxisManipulation.available=!0,i.zManipulation.available=r):i.available=!1}}_buildDragEventPipeline(e,t,n,r,i,a){let o=[],s=[],c=null,l=null,u=()=>{for(let e of o)e.dragging=!1;o.length=0,s.length=0,c=null,l=null,this._updateMoveManipulatorDisplay()};if(e.length===1&&t===0){let t=e[0].object;({steps:r,cancel:i}=this._buildSnappingPipelineSteps(t,t.elevationInfo,r,i,a))}return i=i.next(e=>l?.(e)).next(()=>(s.length&&this.events.emit(`move-stop`,new q(s)),this.destroyed||u(),null)),r=r.next(t=>{if(t.action===`start`){o.length=0,s.length=0;for(let t of this._getActiveObjectInfos(e,n))o.push(t),s.push(t.object),t.dragging=!0;if(s.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),c=A(s),l=j(s),this._emitRecordUndo(),this.events.emit(`move-start`,new G(s)),this.destroyed))return null}return s.length===0?null:t}).next(e=>c?.(e)).next(e=>(this._updateMoveTooltip(t,e),e)).next(e=>{switch(e.action){case`start`:case`update`:if(e.translationX||e.translationY||e.translationZ){let t=this.view.toScreen(e.mapStart),n=this.view.toScreen(e.mapEnd);if(!t||!n)return null;let r=n.x-t.x,i=n.y-t.y;if(this.events.emit(`move`,new K(r,i,s)),this.destroyed)return null}break;case`end`:if(this.events.emit(`move-stop`,new q(s)),this.destroyed)return null;u()}return null}),{steps:r,cancel:i}}_getActiveObjectInfos(e,t){return e.filter(e=>!e.dragging&&(e.manipulationXY?.hasManipulator(t)||!e.manipulationXY?.grabbing))}_connectTooltips(){this.removeHandles(X);let e;if(this._shouldShowMovePointTooltip){let t=this.objects.at(0),{events:n}=this;this._movePointTooltipInfo??=new z({viewType:this.view.type,toolOptions:this.toolOptions});let r={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),n.emit(`move-start`,new G([t]))},onMove:()=>n.emit(`move`,new K(0,0,[t])),onMoveStop:()=>n.emit(`move-stop`,new q([t])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};e=S(this.tooltip,t,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:r,onRecordUndo:e=>n.emit(`record-undo`,{updates:[e]})}))}else e=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,e=>{this.tooltip.info=e},d);this.addHandles(e,X)}_showTooltip(e){this._shouldShowMovePointTooltip||this._updateMoveTooltip(e)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(e,t){if(this._shouldShowMovePointTooltip)return;let{toolOptions:n}=this;switch(e){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new B({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,(e,t)=>this._measurementWorker.autoDistance2DBetweenPoints($(e),$(t))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,async(e,n)=>s(await this._measurementWorker.autoDistance2DBetweenPoints($(e),$(n)),T(t))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new H({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,U))}this._latestTooltipInfo.toolOptions=n}async _updateMoveTooltipDistanceAsync(e,t,n){if(t!=null&&t.action!==`end`){let{mapStart:r,mapEnd:i}=t;e.distance=await n(r,i)??c}else e.distance=c}_emitRecordUndo(){let e=this.objects.toArray().map(e=>e.createUndoRecord?.()).filter(t);e.length>0&&this.events.emit(`record-undo`,{updates:e})}_buildSnappingPipelineSteps(e,t,n,r,i){let a=v(e);if(a==null||a.type!==`point`&&a.type!==`mesh`)return{steps:n,cancel:r};let o=(a.type===`point`?a:a.origin).clone(),s=new F({elevationInfo:t,pointer:i,editGeometryOperations:N.fromGeometry(o,this.view.state.viewingMode),visualizer:new g,excludeFeature:e.graphic}),c=this.snappingManager,{snappingStep:l,cancelSnapping:u}=I({snappingContext:s,snappingManager:c,updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(u),n=n.next(e=>{let t=s.coordinateHelper.pointToVector(o);return{...e,snapOrigin:t}}).next(...l),{steps:n,cancel:r}}get test(){}};e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`objects`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableVisualElements`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableZ`,void 0),e([f({constructOnly:!0})],Q.prototype,`manipulatorRadius`,void 0),e([f({constructOnly:!0,type:P})],Q.prototype,`toolOptions`,void 0),e([f({constructOnly:!0})],Q.prototype,`snappingManager`,void 0),e([f()],Q.prototype,`type`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`tooltip`,void 0),e([f()],Q.prototype,`_ownedTooltip`,void 0),e([f()],Q.prototype,`_latestTooltipInfo`,void 0),e([f()],Q.prototype,`_shouldShowMovePointTooltip`,null),e([f()],Q.prototype,`activeTooltipInfo`,null),Q=e([p(`esri.views.3d.interactive.editingTools.move.MoveTool3D`)],Q);const $=m(te);class re{constructor(e){this.object=e,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{J as HoldEvent,K as MoveEvent,G as MoveStartEvent,q as MoveStopEvent,Q as MoveTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as m}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as h,pointAt as g,create as _}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as y}from"../../../../geometry/support/ray.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{LaserlineVisualElement as x}from"./LaserlineVisualElement.js";import{drapedZ as S}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as C}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";class E extends b{constructor(e){super(e),this._ray=v(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._fadedExtensions=N,this._laserline=new x({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:D,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:D,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),y(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),y(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),y(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(e==null||this._stippleOffColor==null||!o(e,this._stippleOffColor))&&(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??N,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new T(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._createGeometry(e);n.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){let e=new T(this.materialParameters,this.view.state.isGlobal);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this._createGeometry(e);return this._updateVerticesDraped(t),new w(t)}_createGeometry(e){let t=this.extensionType===3,n=t?[i(),i(),i(),i()]:[i(),i()];return C(e,n,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(j):this._updateLineSegmentInfinite(this._extensionType,j)}_updateLineSegmentFinite(e){return h(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,O),e){case 0:O.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(O.ray.direction,O.ray.direction),this._extensionType===2&&t!=null&&(O.c1=Math.abs(n-t));break}}if(!m(n.frustum,O))return this._updateLineSegmentFinite(t);let i=d(O,k),a=f(O,A);return h(i,a,t)}_updateVertexAttributesObject3D(e,t){let n=e.geometries[0].getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=e[2];e.geometryVertexAttributeUpdated(e.geometries[0],`position`)}_updateVertexAttributesDraped(e,t){let n=e.getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=S;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===3?(yield g(e,-this.fadedExtensions.start,k),yield g(e,0,k),yield g(e,1,k),yield g(e,1+this.fadedExtensions.end,k)):(yield g(e,0,k),yield g(e,1,k))}}function D(e){e.geometries=[]}const O=p(),k=i(),A=i(),j=_(),M=1/3,N={start:M,end:M};export{E as ExtendedLineVisualElement};
|
|
2
|
+
import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as m}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as h,pointAt as g,create as _}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as y}from"../../../../geometry/support/ray.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{LaserlineVisualElement as x}from"./LaserlineVisualElement.js";import{drapedZ as S}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as C}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";class E extends b{constructor(e){super(e),this._ray=v(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=N,this._laserline=new x({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:D,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:D,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),y(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),y(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),y(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(e==null||this._stippleOffColor==null||!o(e,this._stippleOffColor))&&(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??N,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new T(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._createGeometry(e);n.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){let e=new T(this.materialParameters,this.view.state.isGlobal);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this._createGeometry(e);return this._updateVerticesDraped(t),new w(t)}_createGeometry(e){let t=this.extensionType===3,n=t?[i(),i(),i(),i()]:[i(),i()];return C(e,n,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(j):this._updateLineSegmentInfinite(this._extensionType,j)}_updateLineSegmentFinite(e){return h(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,O),e){case 0:O.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(O.ray.direction,O.ray.direction),this._extensionType===2&&t!=null&&(O.c1=Math.abs(n-t));break}}if(!m(n.frustum,O))return this._updateLineSegmentFinite(t);let i=d(O,k),a=f(O,A);return h(i,a,t)}_updateVertexAttributesObject3D(e,t){let n=e.geometries[0].getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=e[2];e.geometryVertexAttributeUpdated(e.geometries[0],`position`)}_updateVertexAttributesDraped(e,t){let n=e.getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=S;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===3?(yield g(e,-this.fadedExtensions.start,k),yield g(e,0,k),yield g(e,1,k),yield g(e,1+this.fadedExtensions.end,k)):(yield g(e,0,k),yield g(e,1,k))}}function D(e){e.geometries=[]}const O=p(),k=i(),A=i(),j=_(),M=1/3,N={start:M,end:M};export{E as ExtendedLineVisualElement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view.state.isGlobal),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
|
|
2
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this._transparentRenderOrder=0,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view.state.isGlobal),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
|
|
2
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
|