@arcgis/core 5.2.0-next.20 → 5.2.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/057d288d795b853295f1.js +2 -0
- package/assets/esri/core/workers/chunks/{595bc41ff36c77324d01.js → 19493c9c7e1d2ac0f80f.js} +8 -8
- package/assets/esri/core/workers/chunks/2ef80e003b4f0393ac2e.js +1 -0
- package/assets/esri/core/workers/chunks/{4fdd38d7362bf09a994b.js → 33866e6e6de1bab64599.js} +1 -1
- package/assets/esri/core/workers/chunks/360fd810d70d21c092d9.js +1 -0
- package/assets/esri/core/workers/chunks/{4517630bf869205bab87.js → 38a76bc4ef5c10ab0488.js} +1 -1
- package/assets/esri/core/workers/chunks/5468a65698931603656d.js +1 -0
- package/assets/esri/core/workers/chunks/{c9e5d3f496cefb8e3934.js → 5aa375b0c6a205134703.js} +1 -1
- package/assets/esri/core/workers/chunks/{db26cf2c2735183294b8.js → 6649acaceab00ad30e7f.js} +1 -1
- package/assets/esri/core/workers/chunks/7175f0c6a6e56b685d20.js +680 -0
- package/assets/esri/core/workers/chunks/{501fa9b029df2e7b73c3.js → 754f7ed62afc4e0a1972.js} +2 -2
- package/assets/esri/core/workers/chunks/{6ac09f4e85c664a17365.js → 8331e04ebe0a54b04ab6.js} +1 -1
- package/assets/esri/core/workers/chunks/{72edd08a2ff08970ba38.js → 87011d2fe14c54e296af.js} +1 -1
- package/assets/esri/core/workers/chunks/{5216dd0544e901039c84.js → 8c64c6b8d7376a9d1c91.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ce4fe00328173224ed2.js → 909e67dee8c30e391d69.js} +1 -1
- package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +1 -0
- package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +1 -0
- package/assets/esri/core/workers/chunks/{4104a0585969f8cd524c.js → a40ede4d3375184f21fe.js} +1 -1
- package/assets/esri/core/workers/chunks/a533d066cac26124c5ce.js +1 -0
- package/assets/esri/core/workers/chunks/a536904fe6f3b16fdbdc.js +1 -0
- package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +1 -0
- package/assets/esri/core/workers/chunks/{dd0c1cf921369e2bc48b.js → a90619adff41658f8057.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e8b9c03240ec372b587.js → c30ca771dd3f7198142b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e8d65900eefff1152207.js → c593539c2cce7a2b9d44.js} +1 -1
- package/assets/esri/core/workers/chunks/da47fdffb5969694a2ae.js +1 -0
- package/assets/esri/core/workers/chunks/{764c8ba14ab74b66b391.js → e5fcd8e7a4a660ef6ad6.js} +1 -1
- package/assets/esri/core/workers/chunks/f0519b06987471456b69.js +1 -0
- package/assets/esri/core/workers/chunks/{5f63077ec5ba3560491b.js → f1ff33584680d8718400.js} +1 -1
- package/assets/esri/core/workers/chunks/f47319d36f1527277923.js +1 -0
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Pattern.glsl.js +17 -17
- package/chunks/RibbonLine.glsl.js +45 -43
- package/chunks/bundle2.js +1 -1
- package/config.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +43 -0
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +39 -0
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/DimensionLayer.d.ts +1 -0
- package/layers/FeatureLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.d.ts +9 -1
- package/layers/ParquetLayer.d.ts +6 -10
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/data/queryValidationUtils.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/support/AnnotationFeatureSublayer.d.ts +5 -3
- package/layers/support/SymbolLayerDrawing.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/engine/transitions/FadeTransition.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/TileCpuState.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightDrawToolRenderer.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightInteractionVisuals.js +2 -0
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayerConstants.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +6 -9
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathEvaluate.glsl.js +46 -46
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +46 -18
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +22 -22
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertexInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferUtils.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTextureBuffer.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +10 -10
- package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/support/panConstraint.js +2 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print/CustomTemplate.d.ts +7 -0
- package/widgets/Search/LayerSearchSource.d.ts +3 -0
- package/assets/esri/core/workers/chunks/0a259137932211b80f0e.js +0 -1
- package/assets/esri/core/workers/chunks/35a508a9311689d8df52.js +0 -1
- package/assets/esri/core/workers/chunks/74922daaedb479ec6f03.js +0 -1
- package/assets/esri/core/workers/chunks/912a8743a02f467b63b0.js +0 -2
- package/assets/esri/core/workers/chunks/9def4619d102f1d41578.js +0 -1
- package/assets/esri/core/workers/chunks/a0876a52a3c2ad849370.js +0 -1
- package/assets/esri/core/workers/chunks/a3c5b754a6fa0f4250bf.js +0 -1
- package/assets/esri/core/workers/chunks/a98905bf6050ad3b8721.js +0 -633
- package/assets/esri/core/workers/chunks/bf67e0f6064fb9d94ac8.js +0 -1
- package/assets/esri/core/workers/chunks/cd892f429d5ffe8de99e.js +0 -1
- package/assets/esri/core/workers/chunks/d34d41a350facfa9b7c0.js +0 -1
- package/assets/esri/core/workers/chunks/d5a0e3a73df827dc7b06.js +0 -1
- package/assets/esri/core/workers/chunks/e5471373f89fd7cb9844.js +0 -1
- /package/assets/esri/core/workers/chunks/{912a8743a02f467b63b0.js.LICENSE.txt → 057d288d795b853295f1.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{501fa9b029df2e7b73c3.js.LICENSE.txt → 754f7ed62afc4e0a1972.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as n,pt2px as a}from"../../core/screenUtils.js";import{GeometryCursor as o}from"../../geometry/GeometryCursor.js";import{fromValues as l,empty as h,expandPointInPlace as c,center as m,width as f,height as u,diagonal as d,create as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{segmentIntersects as y}from"../../geometry/support/intersectsBase.js";import{isPolygon as P,isPolyline as S,isExtent as x,isMultipoint as w,isPoint as M}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as b}from"./CIMEffects.js";import T from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{getFirstFrame as R}from"./imageUtils.js";import{rotate as z}from"./mathUtils.js";import{addColorStops as L}from"./rasterizingUtils.js";import U from"./Rect.js";import F from"./TextRasterizer.js";import{getNumericValue as A,isSVGImage as j,getRelativeGradientSize as D,getEffectsInflateSize as G,fromCIMFontDecoration as H,fromCIMFontStyle as E,fromCIMHorizontalAlignment as B,fromCIMVerticalAlignment as X,getFillColor as J,getStrokeColor as N,getStrokeWidth as O,getFontWeight as q,getFontStyle as V,isCIMFill as Y,getSize as W}from"./utils.js";import{destroyHiddenSvg as K,createHiddenSvg as $,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as Z,glyphSize as tt,hittestToleranceSmallSymbol as et,hittestSmallSymbolThreshold as rt}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as it}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as st,getLineWidth as nt}from"../../views/2d/layers/graphics/graphicsUtils.js";const at=Math.PI/180,ot=.5,lt=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class ht{constructor(t){this._t=t}static createIdentity(){return new ht([1,0,0,0,1,0])}clone(){const t=this._t;return new ht(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new ht([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new ht([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new ht([e,-r,0,r,e,0])}rotate(t){return ht.multiply(this,ht.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,n=i[0]*s[0]+i[3]*s[1],a=i[1]*s[0]+i[4]*s[1],o=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=n,m[1]=a,m[2]=o,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new ht([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,n=-t[1]*e,a=-t[3]*e,o=t[0]*e;return new ht([s,n,r,a,o,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._textScaling=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||ht.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1),this._textScaling.push(1)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)],this._textScaling=[1]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}scaleText(t){return t*this._textScaling[this._textScaling.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}reverseScaleText(t){return t/this._textScaling[this._textScaling.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e=!1,r=1){const i=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*i),this._textScaling.push(this._textScaling[this._textScaling.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1),this._textScaling.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){const r=this.geomUnitsPerPoint(),i=null,s=G(t),n=!1;let a=new b(o.fromJSONCIM(e));for(const o of t){const t=k(o);t&&(a=t.execute(a,o,{geomUnitsPerPoint:r,tileKey:i,maxInflateSize:s,scale:null,spatialReference:e.spatialReference,preventClipping:n}))}return a}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=dt(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const n=i.execute(o.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(M(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else if(S(e)){for(const i of e.paths)for(const e of i)if(r.tx=e[0],r.ty=e[1],this.drawMarker(t,r),this._earlyReturn)break}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=A(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,n=r.height;if(!s||!n)return;const a=s/n,o=A(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*a*o,r*=i),l.translate(-e,-r)}let c=A(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*at);let m=A(t.offsetX),f=A(t.offsetY);if(m||f){if(this._mapRotation){const t=at*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=A(t.size,I.CIMVectorMarker.size),s=t.frame,n=s?s.ymax-s.ymin:0,a=i&&n?i/n:1,o=ht.createIdentity();s&&o.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=a,r/=a),o.translate(-e,-r)}1!==a&&o.scale(a,a);let h=A(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&o.rotate(h*at);let c=A(t.offsetX),m=A(t.offsetY);if(c||m){if(this._mapRotation){const t=at*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}o.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&o.scale(f,f);const u=e.getAngle();u&&o.rotate(u),o.translate(e.tx,e.ty);const d=t.scaleSymbolsProportionally?1:a;this.push(o,t.scaleSymbolsProportionally,d);for(const g of r){g?.symbol&&g.geometry||lt().error("Invalid marker graphic",g);let t=g.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(g.symbol,g.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!M(e))return;if(A(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=A(t.angle);s=-s,s&&i.rotate(s*at);const n=A(t.offsetX),a=A(t.offsetY);(n||a)&&i.translate(n,a);const o=this.geomUnitsPerPoint();1!==o&&i.scale(o,o),i.translate(e.x,e.y),this.push(i),this.drawText(t,r),this.pop()}}class mt extends ct{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new U(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(x(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(A(r,I.CIMSolidStroke.width)),.5*ot);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(x(t)){const e=yt(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=A(t.scaleX,1);let s=i*e,n=e;const a=this._resourceManager.getResource(r);if(null!=a){const t=a.height/a.width;s=i*(e?t>1?e:e/t:a.width),n=e?t>1?e*t:e:a.height}this._merge(this.transformPt([-s/2,-n/2]),0),this._merge(this.transformPt([-s/2,n/2]),0),this._merge(this.transformPt([s/2,-n/2]),0),this._merge(this.transformPt([s/2,n/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=n(i),s=n(s);const a=this.transformSize(1)*this.reverseTransformScalar(1);i*=a,s*=a;const o=t.horizontalAlignment??I.CIMTextSymbol.horizontalalignment,l=t.verticalAlignment??I.CIMTextSymbol.verticalalignment;let h=0;switch(o){case"Left":h=i/2;break;case"Right":h=-i/2}let c=0;switch(l){case"Bottom":c=s/2;break;case"Top":c=-s/2;break;case"Baseline":c=s/6}this._merge(this.transformPt([-i/2+h,-s/2+c]),0),this._merge(this.transformPt([-i/2+h,s/2+c]),0),this._merge(this.transformPt([i/2+h,-s/2+c]),0),this._merge(this.transformPt([i/2+h,s/2+c]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class ft extends ct{constructor(){super(...arguments),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=K(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i){const{textInfo:s,mapRotation:o,resolution:l,searchDist:h,hittestType:c,isScreenAligned:m}=i;this._resetHittest();const f=l*a(1);switch(this.setGeomUnitsPerPoint(f),c){case"point":if(1!==t.length)return lt().error("Unexpected hittest area",t),!1;this._hittestType="point",this._searchDistPoint=h/2/f,this._searchTarget=[[t[0].x,t[0].y]];break;case"rect":if(4!==t.length)return lt().error("Unexpected hittest area",t),!1;this._hittestType="rect",this._searchDistPoint=0,this._searchTarget=t.map(t=>[t.x,t.y])}if(this._textInfo=s,this._mapRotation=m?o:0,!has("esri-mobile")){const t=n(et*window.devicePixelRatio),r=n(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(Y))&&"CIMMeshSymbol"!==e?.type&&(W(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,n,a){null!=a?this._hittestSvgPath(t,a,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}drawTextSymbol(t,e,r){if(!t||!M(e))return;if(A(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity(),s=this.geomUnitsPerPoint();1!==s&&i.scale(s,s),i.translate(e.x,e.y),this.push(i),this.drawText(t,r),this.pop()}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=A(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const n=e*this.geomUnitsPerPoint(),a=n*i*(s.width/s.height);if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),e=this._searchDistPoint;Math.abs(t[0])<a/2+e&&Math.abs(t[1])<n/2+e&&(this._earlyReturn=!0)}else{const t=a/2,e=n/2,r=[[-t,e],[t,e],[t,-e],[-t,-e],[-t,e]];bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[r])&&(this._earlyReturn=!0)}}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=st(A(t.height,I.CIMTextSymbol.height)),{lineGapType:n,lineGap:a}=t,o=n?Pt(n,A(a),s):0,l=t.horizontalAlignment??I.CIMTextSymbol.horizontalalignment,h=t.verticalAlignment??I.CIMTextSymbol.verticalalignment,c="CIMBackgroundCallout"===t.callout?.type,m=it(i.glyphMosaicItems,{scale:s/tt,angle:A(t.angle),xOffset:A(t.offsetX),yOffset:A(t.offsetY),horizontalAlignment:l,verticalAlignment:h,maxLineWidth:nt(t.lineWidth),lineHeight:Z*Math.max(.25,Math.min(o||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!1,hasBackground:c}),f=this.reverseScaleText(1);for(const u of m.glyphs){const t=u.offsets,e=[[t.topLeft[0]*f,-t.topLeft[1]*f],[t.topRight[0]*f,-t.topRight[1]*f],[t.bottomRight[0]*f,-t.bottomRight[1]*f],[t.bottomLeft[0]*f,-t.bottomLeft[1]*f],[t.topLeft[0]*f,-t.topLeft[1]*f]];if("point"===this._hittestType){gt(this.reverseTransformPt(this._searchTarget[0]),[e])&&(this._earlyReturn=!0)}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[e])&&(this._earlyReturn=!0)}}}_hitTestFill(t){let e=null;if(x(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);if(gt(t,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(t,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,e)&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=$(),this._path??=Q("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=g();p(s,t);const n={x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]},a=this._getSvgPath();a.setAttribute("d",e);const o=a.getBBox();if("point"===this._hittestType){const t=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),s=this.reverseTransformPt(this._searchTarget[0]);let a=Math.max(o.width/n.width,o.height/n.height),l=1;const h=2*t*a;h<1&&(l=2/h,a*=l,o.x*=l,o.y*=l,o.width*=l,o.height*=l);const c=1+i*a/2,m=this._getCanvasContext(o.width+2*c,o.height+2*c);m.setTransform(l,0,0,l,-o.x+c,-o.y+c);const f=new Path2D(e);r?m.fill(f):(m.lineWidth=i*(a/l),m.stroke(f));const u=(n.width*a-o.width)/2,d=(n.height*a-o.height)/2,g=Math.floor((s[0]-n.x-t)*a-u+c),p=Math.floor((n.height-(s[1]-n.y)-t)*a+d+c),_=Math.ceil(2*t*a),y=Math.ceil(2*t*a),P=m.getImageData(g,p,_,y).data;for(let e=3;e<P.length;e+=4)if(P[e]>127.5)return void(this._earlyReturn=!0)}else{const t=[[n.x,n.y],[n.x,n.y+n.height],[n.x+n.width,n.y+n.height],[n.x+n.width,n.y],[n.x,n.y]];if(bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[t]))return void(this._earlyReturn=!0)}}_hitTestStroke(t,e){let r=null;if(x(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}if("point"===this._hittestType){pt(this.reverseTransformPt(this._searchTarget[0]),r,A(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,r)&&(this._earlyReturn=!0)}}_resetHittest(){this.setTransform(),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new T,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(x(t))this._buildPath(yt(t).rings,!0);else{if(!w(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,n){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!x(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const a=this._ctx;a.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",a.lineWidth=Math.max(this.transformSize(r),ot),this._setCapStyle(i),this._setJoinStyle(s),a.miterLimit=n,a.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!x(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,n=A(t.scaleX,1),a=this._resourceManager.getResource(i);if(null==a)return;let o=e*(a.width/a.height),l=e;e||(o=a.width,l=a.height);const h=j(i)||"src"in a&&j(a.src);let c="getFrame"in a?R(a):a;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:n*d*f,m12:n*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-o/2,-l/2,o,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=St(t,this.transformSize(n(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:a,anchorY:o,canvas:l}=i,h=s[0]*(a+.5),c=s[1]*(o-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-g*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:n,rotation:a,scaleX:o,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(x(t))this._buildPath(yt(t).rings,!0);else{if(!w(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=j(h)||"src"in c&&j(c.src);let u,d="getFrame"in c?R(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);a||(a=0),s?s*=t:s=0,n?n*=t:n=0,i&&(i*=t);const e=i?i/c.height:1,r=o&&i?o*i/c.width:1;if(0!==a||1!==e||1!==r||0!==s||0!==n){const t=new DOMMatrix;t.rotateSelf(0,0,-a).translateSelf(s,n).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:n,miterLimit:o,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!x(t))return w(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=j(h)||"src"in m&&j(m.src);let d="getFrame"in m?R(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(a(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(n),void 0!==o&&(_.miterLimit=o),_.lineWidth=g;for(let a of f)if(a=e(a),wt(a),a&&!(a.length<=1)){M=this.transformPt(a[0]);for(let t=1;t<a.length;t++){b=this.transformPt(a[t]);const e=_t(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(r),_.strokeStyle=y,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!x(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:n,gradientSize:o,gradientSizeUnits:l}=e,g=I.CIMGradientFill,p=e.gradientType??g.gradientType,_=-i(s??0),y=h();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==n&&"Rectangular"!==n||(t=z(t,-_)),c(y,t)}}const[w,M,b,T]=y,k=this._ctx;switch(k.save(),n){case"Buffered":lt().error(`Gradient method "${n}" currently unsupported.`);break;case"Linear":{const t=(M+T)/2,r="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(b-w),[i,s]="Discrete"===p?[b,b-r]:[w+r,w],n=z([i,t],_),h=z([s,t],_),c=k.createLinearGradient(n[0],n[1],h[0],h[1]);L(c,e),k.fillStyle=c,k.fill("evenodd");break}case"Circular":{const t=m(y),r=d(y)/2,i="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*r,[s,n]="Discrete"===p?[r,r-i]:[i,0],h=k.createRadialGradient(t[0],t[1],s,t[0],t[1],n);L(h,e),k.fillStyle=h,k.fill("evenodd");break}case"Rectangular":{const r=m(y),i=r[0],s=r[1],n=z(r,_),h=(r,i,s,a,o,l,h,c)=>{k.save(),this.pushClipPath(t);const m=z([o,l],_),f=z([h,c],_);k.beginPath(),k.moveTo(n[0],n[1]),k.lineTo(m[0],m[1]),k.lineTo(f[0],f[1]),k.lineTo(n[0],n[1]),k.clip();const u=z([r,i],_),d=z([s,a],_),g=k.createLinearGradient(u[0],u[1],d[0],d[1]);L(g,e),k.fillStyle=g,k.fill("evenodd"),k.restore()};let c="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(f(y)/2),[d,P]="Discrete"===p?[b,b-c]:[i+c,i];h(d,s,P,s,b,M,b,T),[d,P]="Discrete"===p?[w,w+c]:[i-c,i],h(d,s,P,s,w,T,w,M),c="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(u(y)/2);let[S,x]="Discrete"===p?[T,T-c]:[s+c,s];h(i,S,i,x,b,T,w,T),[S,x]="Discrete"===p?[M,M+c]:[s-c,s],h(i,S,i,x,w,M,b,M);break}}k.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:n,gradientSizeUnits:o,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!x(t))return void lt().error("Unable to draw gradient stroke");m=yt(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(a(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const r=p[0]-g[0],i=p[1]-g[1];t+=Math.sqrt(r*r+i*i),g=p}const i="Absolute"===o?this.transformSize(a(n)):D(n,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const n=p[0]-g[0],a=p[1]-g[1],o=Math.sqrt(n*n+a*a);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=z([n/o,a/o],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=n/o,r=a/o;"Discrete"===f?(h=g[0]-e*l,c=g[1]-r*l,m=h+e*i,y=c+r*i):(m=g[0]+e*(t-l),y=g[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return lt().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);L(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=o,g=p}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=A(t.separation,I.CIMHatchFill.separation)*r,s=A(t.rotation);if(0===i)return null;i<0&&(i=-i);let n=0;const a=.5*i;for(;n>a;)n-=i;for(;n<-a;)n+=i;const o=g();p(o,e),o[0]-=a,o[1]-=a,o[2]+=a,o[3]+=a;const l=[[o[0],o[1]],[o[0],o[3]],[o[2],o[3]],[o[2],o[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*at),c=Math.sin(s*at),m=-i*c,f=i*h;let u,d,_,y;n=A(t.offsetX)*r*c-A(t.offsetY)*r*h,u=_=Number.MAX_VALUE,d=y=-Number.MAX_VALUE;for(const g of l){const t=g[0],e=g[1],r=h*t+c*e,i=-c*t+h*e;u=Math.min(u,r),_=Math.min(_,i),d=Math.max(d,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=h*u-c*_-m*n/i,S=c*u+h*_-f*n/i,x=h*d-c*_-m*n/i,w=c*d+h*_-f*n/i;const M=1+Math.round((y-_)/i),b=[];for(let g=0;g<M;g++)P+=m,S+=f,x+=m,w+=f,b.push([[P,S],[x,w]]);return{paths:b}}function gt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],n=i[s];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],n=i[s];let a=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===a)continue;a=Math.sqrt(a);const o=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/a;if(Math.abs(o)<r){const i=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/a;if(i>-r&&i<a+r)return!0}}}return!1}function _t(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function St(e,r=1){const i=H(e),s=E(e.fontStyleName),n=e.fontFamilyName??t,{weight:a,style:o}=s,l=r*(e.height||5),h=B(e.horizontalAlignment),c=X(e.verticalAlignment),m=J(e),f=J(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=N(e.symbol),g=r*(O(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=J(p),y=O(p),P=N(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:n,style:V(o),weight:q(a),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:o},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const xt=1e-4;function wt(t){let e,r,i,s,n,a=t[0],o=1;for(;o<t.length;)e=t[o][0]-a[0],r=t[o][1]-a[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=xt?(t.splice(o-1,1),a=n):(n=a,a=t[o],o++),i=s}function Mt(t){const e=1e-6,r=t[0],i=t[t.length-1];return Math.abs(r[0]-i[0])<=e&&Math.abs(r[1]-i[1])<=e}function bt(t,e){t.length>1&&!Mt(t)&&(t=[...t,t[0]]);for(let r=0;r<e.length;r++){const i=e[r],s=i.length;for(const e of i)if(gt(e,[t]))return!0;if(Mt(i))for(const r of t)if(gt(r,e))return!0;for(let e=1;e<s;e++){const r=i[e-1],s=i[e];for(let e=0;e<t.length;e++){const i=t[e],n=t[(e+1)%t.length];if(y(r,s,i,n))return!0}}}return!1}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,at as cDegToRad,Pt as lineGapType2LineHeight};
|
|
2
|
+
import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import i from"../../core/Logger.js";import{deg2rad as r}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as a,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as o}from"../../geometry/GeometryCursor.js";import{fromValues as l,empty as h,expandPointInPlace as c,center as m,width as f,height as u,diagonal as d,create as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{targetIntersectsPolygon as y,pointInPolygon as P,nearLine as S}from"../../geometry/support/intersectsBase.js";import{isPolygon as x,isPolyline as w,isExtent as M,isMultipoint as b,isPoint as T}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as k}from"./CIMEffects.js";import C from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as v,getPlacementOperator as I}from"./CIMOperators.js";import{Placement as R}from"./CIMPlacements.js";import{defaultCIMValues as z}from"./defaultCIMValues.js";import{getFirstFrame as L}from"./imageUtils.js";import{rotate as U}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import A from"./Rect.js";import j from"./TextRasterizer.js";import{getNumericValue as D,isSVGImage as G,getRelativeGradientSize as H,getEffectsInflateSize as E,fromCIMFontDecoration as B,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontWeight as Y,getFontStyle as W,isCIMFill as K,getSize as $}from"./utils.js";import{destroyHiddenSvg as Q,createHiddenSvg as Z,createSvgElement as tt}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as et,glyphSize as it,hittestToleranceSmallSymbol as rt,hittestSmallSymbolThreshold as st}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as at}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as nt,getLineWidth as ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const lt=Math.PI/180,ht=.5,ct=()=>i.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class mt{constructor(t){this._t=t}static createIdentity(){return new mt([1,0,0,0,1,0])}clone(){const t=this._t;return new mt(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new mt([t,0,0,0,e,0])}scale(t,e){const i=this._t;return i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new mt([0,0,t,0,0,e])}translate(t,e){const i=this._t;return i[2]+=t,i[5]+=e,this}static createRotate(t){const e=Math.cos(t),i=Math.sin(t);return new mt([e,-i,0,i,e,0])}rotate(t){return mt.multiply(this,mt.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],i=Math.sqrt(t*t+e*e);return[t/i,e/i]}static multiply(t,e,i){const r=t._t,s=e._t,a=r[0]*s[0]+r[3]*s[1],n=r[1]*s[0]+r[4]*s[1],o=r[2]*s[0]+r[5]*s[1]+s[2],l=r[0]*s[3]+r[3]*s[4],h=r[1]*s[3]+r[4]*s[4],c=r[2]*s[3]+r[5]*s[4]+s[5],m=i._t;return m[0]=a,m[1]=n,m[2]=o,m[3]=l,m[4]=h,m[5]=c,i}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new mt([0,0,0,0,0,0]);e=1/e;const i=(t[1]*t[5]-t[2]*t[4])*e,r=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,a=-t[1]*e,n=-t[3]*e,o=t[0]*e;return new mt([s,a,i,n,o,r])}}class ft{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._textScaling=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new R,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||mt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1),this._textScaling.push(1)}setTransform(t,e){this._transfos=[t||mt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)],this._textScaling=[1]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}scaleText(t){return t*this._textScaling[this._textScaling.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}reverseScaleText(t){return t/this._textScaling[this._textScaling.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e=!1,i=1){const r=e?t.scaleRatio():1;mt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r),this._textScaling.push(this._textScaling[this._textScaling.length-1]*i)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1),this._textScaling.splice(-1,1)}drawSymbol(t,e,i){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,i)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const i=t.symbolLayers;if(!i)return;const r=t.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(i,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(i,e)}executeEffects(t,e){const i=this.geomUnitsPerPoint(),r=null,s=E(t),a=!1;let n=new k(o.fromJSONCIM(e));for(const o of t){const t=v(o);t&&(n=t.execute(n,o,{geomUnitsPerPoint:i,tileKey:r,maxInflateSize:s,scale:null,spatialReference:e.spatialReference,preventClipping:a}))}return n}drawSymbolLayers(t,e){let i=t.length;for(;i--;){const r=t[i];if(!r||!1===r.enable)continue;const s=r.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(r,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(r,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const i=pt(e,t,this.geomUnitsPerPoint());i&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,i),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const i=t.markerPlacement;if(i){const r=I(i);if(r){const s="CIMMarkerPlacementInsidePolygon"===i.type||"CIMMarkerPlacementPolygonCenter"===i.type&&i.clipAtBoundary;s&&this.pushClipPath(e);const a=r.execute(o.fromJSONCIM(e),i,this.geomUnitsPerPoint(),null);if(a){let e=null;for(;(e=a.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const i=this._placementPool.acquire();if(T(e))i.tx=e.x,i.ty=e.y,this.drawMarker(t,i);else if(x(e)){const r=_(e);r&&([i.tx,i.ty]=r,this.drawMarker(t,i))}else if(w(e)){for(const r of e.paths)for(const e of r)if(i.tx=e[0],i.ty=e[1],this.drawMarker(t,i),this._earlyReturn)break}else for(const r of e.points)if(i.tx=r[0],i.ty=r[1],this.drawMarker(t,i),this._earlyReturn)break;this._placementPool.release(i)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),r=D(t.size,z.CIMPictureMarker.size);if(null==i||r<=0)return;const s=i.width,a=i.height;if(!s||!a)return;const n=s/a,o=D(t.scaleX,1),l=mt.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,i=h.y;"Absolute"!==t.anchorPointUnits&&(e*=r*n*o,i*=r),l.translate(-e,-i)}let c=D(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*lt);let m=D(t.offsetX),f=D(t.offsetY);if(m||f){if(this._mapRotation){const t=lt*this._mapRotation,e=Math.cos(t),i=Math.sin(t),r=m*i+f*e;m=m*e-f*i,f=r}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l),this.drawImage(t,r),this.pop()}drawVectorMarker(t,e){if(!t)return;const i=t.markerGraphics;if(!i)return;const r=D(t.size,z.CIMVectorMarker.size),s=t.frame,a=s?s.ymax-s.ymin:0,n=r&&a?r/a:1,o=mt.createIdentity();s&&o.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,i=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,i*=s.ymax-s.ymin):(e/=n,i/=n),o.translate(-e,-i)}1!==n&&o.scale(n,n);let h=D(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&o.rotate(h*lt);let c=D(t.offsetX),m=D(t.offsetY);if(c||m){if(this._mapRotation){const t=lt*this._mapRotation,e=Math.cos(t),i=Math.sin(t),r=c*i+m*e;c=c*e-m*i,m=r}o.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&o.scale(f,f);const u=e.getAngle();u&&o.rotate(u),o.translate(e.tx,e.ty);const d=t.scaleSymbolsProportionally?1:n;this.push(o,t.scaleSymbolsProportionally,d);for(const g of i){g?.symbol&&g.geometry||ct().error("Invalid marker graphic",g);let t=g.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(g.symbol,g.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,i){if(!t)return;if(!T(e))return;if(D(t.height,z.CIMTextSymbol.height)<=0)return;const r=mt.createIdentity();let s=D(t.angle);s=-s,s&&r.rotate(s*lt);const a=D(t.offsetX),n=D(t.offsetY);(a||n)&&r.translate(a,n);const o=this.geomUnitsPerPoint();1!==o&&r.scale(o,o),r.translate(e.x,e.y),this.push(r),this.drawText(t,i),this.pop()}}class ut extends ft{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new A(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(x(t))this._processPath(t.rings,0);else if(w(t))this._processPath(t.paths,0);else if(M(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,i){if(!t||this._clipCount>0||null==i||i<=0)return;const r=Math.max(.5*this.transformSize(D(i,z.CIMSolidStroke.width)),.5*ht);if(x(t))this._processPath(t.rings,r);else if(w(t))this._processPath(t.paths,r);else if(M(t)){const e=yt(t);e&&this._processPath(e.rings,r)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){x(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:i}=t,r=D(t.scaleX,1);let s=r*e,a=e;const n=this._resourceManager.getResource(i);if(null!=n){const t=n.height/n.width;s=r*(e?t>1?e:e/t:n.width),a=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-a/2]),0),this._merge(this.transformPt([-s/2,a/2]),0),this._merge(this.transformPt([s/2,-a/2]),0),this._merge(this.transformPt([s/2,a/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new j);const i=St(t);let[r,s]=this._textRasterizer.computeTextSize(e,i);r=a(r),s=a(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);r*=n,s*=n;const o=t.horizontalAlignment??z.CIMTextSymbol.horizontalalignment,l=t.verticalAlignment??z.CIMTextSymbol.verticalalignment;let h=0;switch(o){case"Left":h=r/2;break;case"Right":h=-r/2}let c=0;switch(l){case"Bottom":c=s/2;break;case"Top":c=-s/2;break;case"Baseline":c=s/6}this._merge(this.transformPt([-r/2+h,-s/2+c]),0),this._merge(this.transformPt([-r/2+h,s/2+c]),0),this._merge(this.transformPt([r/2+h,-s/2+c]),0),this._merge(this.transformPt([r/2+h,s/2+c]),0)}_processPath(t,e){if(t)for(const i of t){const t=i?i.length:0;if(t>1){this._merge(this.transformPt(i[0]),e);for(let r=1;r<t;r++)this._merge(this.transformPt(i[r]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class dt extends ft{constructor(){super(...arguments),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=Q(this._svg),this._path=null,this._canvas=null}hitTest(t,e,i,r){const{textInfo:s,mapRotation:o,resolution:l,searchDist:h,hittestType:c,isScreenAligned:m}=r;this._resetHittest();const f=l*n(1);switch(this.setGeomUnitsPerPoint(f),c){case"point":if(1!==t.length)return ct().error("Unexpected hittest area",t),!1;this._hittestType="point",this._searchDistPoint=h/2/f,this._searchTarget=[[t[0].x,t[0].y]];break;case"rect":if(4!==t.length)return ct().error("Unexpected hittest area",t),!1;this._hittestType="rect",this._searchDistPoint=0,this._searchTarget=t.map(t=>[t.x,t.y])}if(this._textInfo=s,this._mapRotation=m?o:0,!has("esri-mobile")){const t=a(rt*window.devicePixelRatio),i=a(st);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(K))&&"CIMMeshSymbol"!==e?.type&&($(e)??0)<i&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,i),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,i){null!=i?this._hittestSvgPath(t,i,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,i,r,s,a,n){null!=n?this._hittestSvgPath(t,n,!1,i):this._hitTestStroke(t,i)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}drawTextSymbol(t,e,i){if(!t||!T(e))return;if(D(t.height,z.CIMTextSymbol.height)<=0)return;const r=mt.createIdentity(),s=this.geomUnitsPerPoint();1!==s&&r.scale(s,s),r.translate(e.x,e.y),this.push(r),this.drawText(t,i),this.pop()}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:i}=t,r=D(t.scaleX,1),s=this._resourceManager.getResource(i);if(null==s||0===s.height||0===e)return;const a=e*this.geomUnitsPerPoint(),n=a*r*(s.width/s.height);if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),e=this._searchDistPoint;Math.abs(t[0])<n/2+e&&Math.abs(t[1])<a/2+e&&(this._earlyReturn=!0)}else{const t=n/2,e=a/2,i=[[-t,e],[t,e],[t,-e],[-t,-e],[-t,e]],r=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(r,[i])&&(this._earlyReturn=!0)}}drawText(t,e){const i=this._textInfo;if(!i)return;const r=i.get(t);if(!r)return;if(!r.glyphMosaicItems.glyphs.length)return;const s=nt(D(t.height,z.CIMTextSymbol.height)),{lineGapType:a,lineGap:n}=t,o=a?Pt(a,D(n),s):0,l=t.horizontalAlignment??z.CIMTextSymbol.horizontalalignment,h=t.verticalAlignment??z.CIMTextSymbol.verticalalignment,c="CIMBackgroundCallout"===t.callout?.type,m=at(r.glyphMosaicItems,{scale:s/it,angle:D(t.angle),xOffset:D(t.offsetX),yOffset:D(t.offsetY),horizontalAlignment:l,verticalAlignment:h,maxLineWidth:ot(t.lineWidth),lineHeight:et*Math.max(.25,Math.min(o||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!1,hasBackground:c}),f=this.reverseScaleText(1);for(const u of m.glyphs){const t=u.offsets,e=[[t.topLeft[0]*f,-t.topLeft[1]*f],[t.topRight[0]*f,-t.topRight[1]*f],[t.bottomRight[0]*f,-t.bottomRight[1]*f],[t.bottomLeft[0]*f,-t.bottomLeft[1]*f],[t.topLeft[0]*f,-t.topLeft[1]*f]];if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);P(t,[e])&&(this._earlyReturn=!0)}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,[e])&&(this._earlyReturn=!0)}}}_hitTestFill(t){let e=null;if(M(t)){const i=t;e=[[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]}else if(x(t))e=t.rings;else{if(!w(t))return;e=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);if(P(t,e)&&(this._earlyReturn=!0),!this._earlyReturn){const i=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint();S(t,e,i)&&(this._earlyReturn=!0)}}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,e)&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=Z(),this._path??=tt("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,i,r=0){const s=g();p(s,t);const a={x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]},n=this._getSvgPath();n.setAttribute("d",e);const o=n.getBBox();if("point"===this._hittestType){const t=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),s=this.reverseTransformPt(this._searchTarget[0]);let n=Math.max(o.width/a.width,o.height/a.height),l=1;const h=2*t*n;h<1&&(l=2/h,n*=l,o.x*=l,o.y*=l,o.width*=l,o.height*=l);const c=1+r*n/2,m=this._getCanvasContext(o.width+2*c,o.height+2*c);m.setTransform(l,0,0,l,-o.x+c,-o.y+c);const f=new Path2D(e);i?m.fill(f):(m.lineWidth=r*(n/l),m.stroke(f));const u=(a.width*n-o.width)/2,d=(a.height*n-o.height)/2,g=Math.floor((s[0]-a.x-t)*n-u+c),p=Math.floor((a.height-(s[1]-a.y)-t)*n+d+c),_=Math.ceil(2*t*n),y=Math.ceil(2*t*n),P=m.getImageData(g,p,_,y).data;for(let e=3;e<P.length;e+=4)if(P[e]>127.5)return void(this._earlyReturn=!0)}else{const t=[[a.x,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height],[a.x+a.width,a.y],[a.x,a.y]],e=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;if(y(e,[t]))return void(this._earlyReturn=!0)}}_hitTestStroke(t,e){let i=null;if(M(t)){const e=t;i=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(x(t))i=t.rings;else{if(!w(t))return;i=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),r=D(e,z.CIMSolidStroke.width)*this.geomUnitsPerPoint(),s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint();S(t,i,r/2+s)&&(this._earlyReturn=!0)}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,i)&&(this._earlyReturn=!0)}}_resetHittest(){this.setTransform(),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null}}class gt extends ft{constructor(t,e,i,r){super(e,i),this._applyAdditionalRenderProps=r,this._colorSubstitutionHelper=new C,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else if(M(t))this._buildPath(yt(t).rings,!0);else{if(!b(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const i=this._ctx;i.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",i.fill("evenodd")}drawSolidStroke(t,e,i,r,s,a){if(!t||!e||0===i)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!1);else{if(!M(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(i),ht),this._setCapStyle(r),this._setJoinStyle(s),n.miterLimit=a,n.stroke()}pushClipPath(t){if(this._ctx.save(),x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else{if(!M(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:i,url:r,tintColor:s}=t,a=D(t.scaleX,1),n=this._resourceManager.getResource(r);if(null==n)return;let o=e*(n.width/n.height),l=e;e||(o=n.width,l=n.height);const h=G(r)||"src"in n&&G(n.src);let c="getFrame"in n?L(n):n;i&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,i)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:a*d*f,m12:a*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-o/2,-l/2,o,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new j);const i=St(t,this.transformSize(a(1))),r=this._textRasterizer.rasterizeText(e,i);if(!r)return;const{size:s,anchorX:n,anchorY:o,canvas:l}=r,h=s[0]*(n+.5),c=s[1]*(o-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-g*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:i,height:r,offsetX:s,offsetY:a,rotation:n,scaleX:o,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else if(M(t))this._buildPath(yt(t).rings,!0);else{if(!b(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=G(h)||"src"in c&&G(c.src);let u,d="getFrame"in c?L(c):c;if(i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,a?a*=t:a=0,r&&(r*=t);const e=r?r/c.height:1,i=o&&r?o*r/c.width:1;if(0!==n||1!==e||1!==i||0!==s||0!==a){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,a).scaleSelf(i,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,i){if(!t)return;let{colorSubstitutions:r,capStyle:s,joinStyle:a,miterLimit:o,tintColor:l,url:h,width:c}=i;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(x(t))f=t.rings;else if(w(t))f=t.paths;else{if(!M(t))return b(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=G(h)||"src"in m&&G(m.src);let d="getFrame"in m?L(m):m;r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let P,S;_.save(),this._setCapStyle(s),this._setJoinStyle(a),void 0!==o&&(_.miterLimit=o),_.lineWidth=g;for(let n of f)if(n=e(n),wt(n),n&&!(n.length<=1)){P=this.transformPt(n[0]);for(let t=1;t<n.length;t++){S=this.transformPt(n[t]);const e=_t(P,S),i=new DOMMatrix;i.translateSelf(0,P[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(i),_.strokeStyle=y,_.beginPath(),_.moveTo(P[0],P[1]),_.lineTo(S[0],S[1]),_.stroke(),P=S}}_.restore()}drawGradientFill(t,e){if(!t)return;let i;if(x(t))i=t.rings;else if(w(t))i=t.paths;else{if(!M(t))return void ct().error("Unable to draw gradient fill");i=yt(t).rings}this._buildPath(i,!0);const{angle:s,gradientMethod:a,gradientSize:o,gradientSizeUnits:l}=e,g=z.CIMGradientFill,p=e.gradientType??g.gradientType,_=-r(s??0),y=h();for(const r of i){const t=r?r.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(r[e]);"Linear"!==a&&"Rectangular"!==a||(t=U(t,-_)),c(y,t)}}const[P,S,b,T]=y,k=this._ctx;switch(k.save(),a){case"Buffered":ct().error(`Gradient method "${a}" currently unsupported.`);break;case"Linear":{const t=(S+T)/2,i="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(b-P),[r,s]="Discrete"===p?[b,b-i]:[P+i,P],a=U([r,t],_),h=U([s,t],_),c=k.createLinearGradient(a[0],a[1],h[0],h[1]);F(c,e),k.fillStyle=c,k.fill("evenodd");break}case"Circular":{const t=m(y),i=d(y)/2,r="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*i,[s,a]="Discrete"===p?[i,i-r]:[r,0],h=k.createRadialGradient(t[0],t[1],s,t[0],t[1],a);F(h,e),k.fillStyle=h,k.fill("evenodd");break}case"Rectangular":{const i=m(y),r=i[0],s=i[1],a=U(i,_),h=(i,r,s,n,o,l,h,c)=>{k.save(),this.pushClipPath(t);const m=U([o,l],_),f=U([h,c],_);k.beginPath(),k.moveTo(a[0],a[1]),k.lineTo(m[0],m[1]),k.lineTo(f[0],f[1]),k.lineTo(a[0],a[1]),k.clip();const u=U([i,r],_),d=U([s,n],_),g=k.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),k.fillStyle=g,k.fill("evenodd"),k.restore()};let c="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(f(y)/2),[d,x]="Discrete"===p?[b,b-c]:[r+c,r];h(d,s,x,s,b,S,b,T),[d,x]="Discrete"===p?[P,P+c]:[r-c,r],h(d,s,x,s,P,T,P,S),c="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(u(y)/2);let[w,M]="Discrete"===p?[T,T-c]:[s+c,s];h(r,w,r,M,b,T,P,T),[w,M]="Discrete"===p?[S,S+c]:[s-c,s],h(r,w,r,M,P,S,b,S);break}}k.restore()}drawGradientStroke(t,i){const{capStyle:r,gradientMethod:s,gradientSize:a,gradientSizeUnits:o,joinStyle:l,miterLimit:h,width:c}=i;if(!t||0===c)return;let m;if(x(t))m=t.rings;else if(w(t))m=t.paths;else{if(!M(t))return void ct().error("Unable to draw gradient stroke");m=yt(t).rings}const f=i.gradientType??z.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(n(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(r),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const i=p[0]-g[0],r=p[1]-g[1];t+=Math.sqrt(i*i+r*r),g=p}const r="Absolute"===o?this.transformSize(n(a)):H(a,z.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const a=p[0]-g[0],n=p[1]-g[1],o=Math.sqrt(a*a+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=U([a/o,n/o],-Math.PI/2),i=u/2,s="Discrete"===f?i:r-i;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*r,y=c-e*r;break}case"AlongLine":{const e=a/o,i=n/o;"Discrete"===f?(h=g[0]-e*l,c=g[1]-i*l,m=h+e*r,y=c+i*r):(m=g[0]+e*(t-l),y=g[1]+i*(t-l),h=m-e*r,c=y-i*r);break}default:return ct().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);F(P,i),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=o,g=p}}d.restore()}_buildPath(t,e){const i=this._ctx;if(i.beginPath(),t)for(const r of t){const t=r?r.length:0;if(t>1){let s=this.transformPt(r[0]);i.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(r[e]),i.lineTo(s[0],s[1]);e&&i.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function pt(t,e,i){let r=D(t.separation,z.CIMHatchFill.separation)*i,s=D(t.rotation);if(0===r)return null;r<0&&(r=-r);let a=0;const n=.5*r;for(;a>n;)a-=r;for(;a<-n;)a+=r;const o=g();p(o,e),o[0]-=n,o[1]-=n,o[2]+=n,o[3]+=n;const l=[[o[0],o[1]],[o[0],o[3]],[o[2],o[3]],[o[2],o[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*lt),c=Math.sin(s*lt),m=-r*c,f=r*h;let u,d,_,y;a=D(t.offsetX)*i*c-D(t.offsetY)*i*h,u=_=Number.MAX_VALUE,d=y=-Number.MAX_VALUE;for(const g of l){const t=g[0],e=g[1],i=h*t+c*e,r=-c*t+h*e;u=Math.min(u,i),_=Math.min(_,r),d=Math.max(d,i),y=Math.max(y,r)}_=Math.floor(_/r)*r;let P=h*u-c*_-m*a/r,S=c*u+h*_-f*a/r,x=h*d-c*_-m*a/r,w=c*d+h*_-f*a/r;const M=1+Math.round((y-_)/r),b=[];for(let g=0;g<M;g++)P+=m,S+=f,x+=m,w+=f,b.push([[P,S],[x,w]]);return{paths:b}}function _t(t,e){const i=e[0]-t[0],r=e[1]-t[1];return 180/Math.PI*Math.atan2(r,i)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,i)=>{switch(t){case"ExtraLeading":return 1+e/i;case"Multiple":return e;case"Exact":return e/i}};function St(e,i=1){const r=B(e),s=X(e.fontStyleName),a=e.fontFamilyName??t,{weight:n,style:o}=s,l=i*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?i*(e.haloSize??0):0,d=q(e.symbol),g=i*(V(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=O(p),y=V(p),P=q(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:a,style:W(o),weight:Y(n),decoration:r},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:o},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const xt=1e-4;function wt(t){let e,i,r,s,a,n=t[0],o=1;for(;o<t.length;)e=t[o][0]-n[0],i=t[o][1]-n[1],s=0!==e?i/e:Math.PI/2,void 0!==r&&Math.abs(s-r)<=xt?(t.splice(o-1,1),n=a):(a=n,n=t[o],o++),r=s}export{ft as CIMSymbolDrawHelper,gt as CanvasDrawHelper,ut as EnvDrawHelper,dt as HittestDrawHelper,mt as Transformation,lt as cDegToRad,Pt as lineGapType2LineHeight};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";let o=class extends t{constructor(e){super(e),this.computedOpacity=1,this.computedVisible=!0,this.opacity=1,this.visible=!0,this._fadeOutResolver=null,this._fadeInResolver=null}get transitioning(){return this.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";let o=class extends t{constructor(e){super(e),this.computedOpacity=1,this.computedVisible=!0,this.opacity=1,this.visible=!0,this._fadeOutResolver=null,this._fadeInResolver=null}get transitioning(){return this._targetOpacity!==this.computedOpacity}get _targetOpacity(){return!this.visible||this._fadeOutResolver?0:this.opacity}endTransition(){this._fadeInResolver?.resolve(),this._fadeOutResolver?.resolve(),this._fadeInResolver=this._fadeOutResolver=null,this.computedOpacity=this._targetOpacity}fadeIn(){return this._fadeInResolver||(this.opacity=1,this.computedOpacity=0,this._fadeOutResolver?.resolve(),this._fadeOutResolver=null,this._fadeInResolver=Promise.withResolvers()),this._fadeInResolver.promise}fadeOut(){return this._fadeOutResolver||(this.opacity=0,this._fadeInResolver?.resolve(),this._fadeInResolver=null,this._fadeOutResolver=Promise.withResolvers()),this._fadeOutResolver.promise}transitionStep(e,t){const i=has("mapview-transitions-duration"),s=i?1/i:0,o=this._targetOpacity;if(0===s)this.computedOpacity=o,this.computedVisible=this.visible;else{const t=this.computedOpacity;if(t===o)this.computedVisible=this.visible;else{const i=e*s;this.computedOpacity=t>o?Math.max(o,t-i):Math.min(o,t+i),this.computedVisible=this.computedOpacity>0}}this.transitioning||(this._fadeInResolver?.resolve(),this._fadeOutResolver?.resolve(),this._fadeOutResolver=this._fadeInResolver=null)}};e([i()],o.prototype,"computedOpacity",void 0),e([i()],o.prototype,"computedVisible",void 0),e([i()],o.prototype,"opacity",void 0),e([i()],o.prototype,"visible",void 0),e([i()],o.prototype,"transitioning",null),e([i()],o.prototype,"_fadeOutResolver",void 0),e([i()],o.prototype,"_fadeInResolver",void 0),o=e([s("esri.views.2d.engine.transitions.FadeTransition")],o);export{o as FadeTransition};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as s}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as i,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as r,RESHUFFLING_EXEMPT_DRAW_CALLS as a,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as o}from"./definitions.js";import n from"./DisplayEntity.js";import{TileCpuState as h}from"./TileCpuState.js";import{TileGpuState as u}from"./TileGpuState.js";import{debugMeshDataInfo as p}from"./mesh/meshDebugUtils.js";import
|
|
2
|
+
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as s}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as i,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as r,RESHUFFLING_EXEMPT_DRAW_CALLS as a,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as o}from"./definitions.js";import n from"./DisplayEntity.js";import{TileCpuState as h}from"./TileCpuState.js";import{TileGpuState as u}from"./TileGpuState.js";import{debugMeshDataInfo as p}from"./mesh/meshDebugUtils.js";import m from"./util/Reader.js";import{deserializeList as l}from"./util/serializationUtils.js";const g=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");class c extends s{constructor(e,s,i,r,a){super(e,s,i,r),this._fader=a,this._cpuState=new h,this._gpuState=new u,this._requiresRefresh=!1,this._ended=!1,this._geometryInvalidated=!1,this.decluttering=!1,this.presenting=!1,this.visible=!0,this.transforms.tileUnitsToPixels=t()}destroy(){super.destroy();const e=this._cpuState.takeMetrics();this._fader?.removeFeatureTileMetrics(this,e),this._cpuState.destroy(),this._gpuState.destroy()}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}get symbols(){const e=new Map;for(const t of this._cpuState.metrics)e.get(t.labelClassId)||e.set(t.labelClassId,[]),e.get(t.labelClassId).push(t);return e}get id(){return this.key.id}get hasData(){return!!this._cpuState.meshes.size}get requiresRefresh(){return this._requiresRefresh}get ended(){return this._ended}get hasAnimations(){return this._cpuState.hasAnimations}get hasMetrics(){return this._cpuState.metrics.length>0}get entityIds(){return this._cpuState.getEntityObjectIds()}get usedMemory(){return this._cpuState.usedMemory+this._gpuState.usedMemory}get isReady(){return this.presenting}getDisplayList(){return this._gpuState.displayList}getMesh(e){const t=this._gpuState.getMesh(e);if(null==t)throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return t}getSortKeys(e){return this._cpuState.getSortKeys(e)}clearCpuState(){const e=this._cpuState.takeMetrics();this._fader?.removeFeatureTileMetrics(this,e),this._cpuState.destroy(),this._cpuState=new h,this._geometryInvalidated=!0,this._ended=!1}update(e){switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}e.objectIdMap&&this._cpuState.mergeObjectIdMap(e.objectIdMap),this._aggregateMemoryStats(),e.end&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end`),this._ended=!0),this._geometryInvalidated=!0}reshuffle(e=!1){this.destroyed||(this._geometryInvalidated=!0,this._cpuState.reshuffle(e),this._aggregateMemoryStats(),has("esri-2d-update-debug")&&g().info(`Tile ${this.key.id} was reshuffled.`))}upload(e,t){this.presenting&&(this.hasMetrics&&(this._cpuState.setMetricVisibility(),this._gpuState.uploadVisibility(this._cpuState)),this._geometryInvalidated&&(this._geometryInvalidated=!1,this._cpuState.prepareForUpload(t),this._aggregateMemoryStats(),this._gpuState.uploadGeometry(this,e,t,this._cpuState)))}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*o,a=i*o,d=this._cpuState.copyPixelBufferedEntitiesFrom(e._cpuState,t,r,a);this._geometryInvalidated||=d}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:p(e?.append)}),!e.append)return;this._requiresRefresh||=e.append.requiresRefresh;const t=l(new m(e.append.entities),n),{insertedMetrics:s}=this._cpuState.append(t,e.append.data,!1,this);this._fader?.insertFeatureTileMetrics(this,s)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:p(e.modify),remove:e.remove});const t=l(new m(e.modify.entities),n),s=t.map(e=>e.id),i=e.isPixelBuffer??!1,r=[...e.remove,...s];if(i){const e=this._cpuState.removeByIdsFromBuffer(r);this._fader?.removeFeatureTileMetrics(this,e)}else{const e=this._cpuState.removeByIds(r);this._fader?.removeFeatureTileMetrics(this,e)}const{insertedMetrics:a}=this._cpuState.append(t,e.modify.data,i,this);this._fader?.insertFeatureTileMetrics(this,a)}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._cpuState.meshes.values())this.debugInfo.memory.bytesUsed+=e.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=e.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:o,length:n}=this.debugInfo.display;return t>i&&s<r||n>a&&o/n<d}}export{c as FeatureTile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import
|
|
2
|
+
import has from"../../../../core/has.js";import e from"./DisplayEntity.js";import{ReshufflePlan as t}from"./ReshufflePlan.js";import{LabelMetric as s}from"./collisions/LabelMetric.js";import{CpuMeshData as i}from"./cpuMapped/CpuMeshData.js";import r from"./util/Reader.js";import{deserializeList as n}from"./util/serializationUtils.js";class o{constructor(){this.meshes=new Map,this.entityIndex=new Map,this.entityIds=new Set,this.entityIdsFromBuffer=new Set,this.entities=[],this.metrics=[],this.objectIdMap=null}destroy(){for(const e of this.meshes.values())e.destroy();if(this.metrics.length)throw new Error("InternalError: Leaking metrics. Was `takeMetrics` called before removal?");this.meshes.clear(),this.entityIndex.clear(),this.entityIds.clear(),this.entityIdsFromBuffer.clear(),this.entities=[],this.objectIdMap=null}get usedMemory(){let t=0;for(const e of this.meshes.values())t+=e.usedMemory;if(this.entities.length){let s=0;const i=Math.min(this.entities.length,10);for(let e=0;e<i;e++)s+=this.entities[0].records.length;const r=s/i;t+=e.estimateMemory(r)*this.entities.length,t+=4*this.entities.length}return t+=25*this.entityIndex.size,t+=18*this.entityIds.size,t+=25*this.entityIdsFromBuffer.size,this.objectIdMap&&(t+=25*this.entities.length),t}get hasAnimations(){return!!this.objectIdMap}getEntityObjectIds(){return this.objectIdMap?this.entities.map(({id:e})=>({objectId:this.objectIdMap[e],displayId:e})):[]}getMesh(e){return this.meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this.entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}takeMetrics(){const e=this.metrics;return this.metrics=[],e}mergeObjectIdMap(e){this.objectIdMap??={};for(const t in e)this.objectIdMap[t]=e[t]}ensureMesh(e,t,s){let r=this.meshes.get(e);return null==r&&(r=new i(t,s),this.meshes.set(e,r)),r}append(e,t,s,i){if(!e.length)return{insertedMetrics:[]};this._removeDuplicatedBufferedEntities(e);const{offsetsByInstance:r,insertedMetrics:n}=this._insertVertexData(t,i);for(const o of e){for(const e of o.records)e.updateBaseOffsets(r.get(e.instanceId));s?this._tryInsertBufferedEntity(o):this._insertEntity(o)}return{insertedMetrics:n}}removeByIds(e){if(0===e.length)return[];const t=new Set(e),s=[];for(const r of this.entities)t.has(r.id)?(this._remove(r),this.entityIndex.delete(r.id)):s.push(r);this.entities=s;const i=this.metrics.filter(e=>t.has(e.displayId));return this.metrics=this.metrics.filter(e=>!t.has(e.displayId)),i}setMetricVisibility(){if(0!==this.metrics.length)for(const e of this.metrics){const t=this.entityIndex.get(e.id);if(null==t)throw new Error("InternalError: expected to find entity for label");const s=t.records[e.recordStart];if(null==s)throw new Error("InternalError: expected to find label record");const i=this.getMesh(s.instanceId);if(!i)throw new Error("InternalError: expected to find label mesh");if(!e.uniqueSymbol)throw new Error("InternalError: expected to find uniqueSymbol");const r=e.uniqueSymbol.show&&e.selectedForRendering;i.setRecordVisibility(t.records,e,r?0:255,t.id)}}copyPixelBufferedEntitiesFrom(t,s,i,r){let n=!1;for(const o of t.entities){let h=null;for(const d of o.records){if(!(d.overlaps&s))continue;n||=!0;const c=t.getMesh(d.instanceId),f=this.ensureMesh(d.instanceId,c.layout,c.useVisibility).copyRecordFrom(c,d,i,r);null==h&&(h=new e(o.id,o.sortKey),this.entityIdsFromBuffer.add(o.id),this.entityIndex.set(h.id,h),this.entities.push(h)),h.records.push(f)}}return n}removeByIdsFromBuffer(e){return this.removeByIds(e.filter(e=>this.entityIdsFromBuffer.has(e)))}reshuffle(e=!1){const s=new Map;for(const i of this.entities)for(const r of i.records){const i=r.instanceId;let n=s.get(i);null==n&&(n=new t(e),s.set(i,n)),n.copyRecord(r)}for(const[t,i]of s)this.getMesh(t).reshuffle(i)}prepareForUpload(e){this.entities.sort((e,t)=>{const s=e.sortKey,i=t.sortKey;return s===i?e.id-t.id:s-i}),0===e&&this.reshuffle(!0)}_insertVertexData(e,t){const i=new Map,o=[];for(const h of e){const{instanceId:e,layout:d}=h,c=d.attributes.some(e=>"visibility"===e.name),f=this.ensureMesh(e,d,c).append(h);if(h.metrics){const e=n(new r(h.metrics),s)??[];o.push(...this._insertMetrics(e,t))}i.set(e,f)}return{offsetsByInstance:i,insertedMetrics:o}}_insertMetrics(e,t){for(const s of e)s.tile=t;return this.metrics.push(...e),e}_insertEntity(e){has("esri-2d-update-debug")&&this.entityIds.has(e.id)&&console.error(`insertEntity: Already have entityId ${e.id}`),this.entityIds.add(e.id),this.entityIndex.set(e.id,e),this.entities.push(e)}_tryInsertBufferedEntity(e){this.entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this.entityIdsFromBuffer.add(e.id),this.entityIndex.set(e.id,e),this.entities.push(e))}_removeDuplicatedBufferedEntities(e){if(!this.entityIdsFromBuffer.size)return;const t=[];for(const s of e)this.entityIdsFromBuffer.has(s.id)&&t.push(s.id);this.removeByIds(t)}_remove(e){this._removeRecordsFromMesh(e.records),this.entityIds.delete(e.id),this.entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:n}=t;this.getMesh(e)?.remove(s,i,r,n)}}}export{o as TileCpuState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as m,processColorInput as u,getMinMaxZoom as d,getBitMask as p}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as f}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const x=3.14159265359/180,P=128/Math.PI;function g(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return g(e*P,256)}function k(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*x*-n),l}const v={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:M.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=p(f.bitset.isSDF)),1===t&&(a|=p(f.bitset.isMapAligned)),r&&(a|=p(f.bitset.scaleSymbolsProportionally)),o&&(a|=p(f.bitset.overrideOutlineColor)),s&&(a|=p(f.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[m(s,128),m(r,128),m(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends y{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:r}){const
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as m,processColorInput as u,getMinMaxZoom as d,getBitMask as p}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as f}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const x=3.14159265359/180,P=128/Math.PI;function g(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return g(e*P,256)}function k(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*x*-n),l}const v={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:M.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=p(f.bitset.isSDF)),1===t&&(a|=p(f.bitset.isMapAligned)),r&&(a|=p(f.bitset.scaleSymbolsProportionally)),o&&(a|=p(f.bitset.overrideOutlineColor)),s&&(a|=p(f.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[m(s,128),m(r,128),m(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends y{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:r,scaleFactor:o}){const s=this.evaluatedMeshParams.sprite?.textureBinding,a=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,s);const i=this.evaluatedMeshParams.minPixelBuffer,l=Math.max(this.evaluatedMeshParams.computedWidth,i),m=Math.max(this.evaluatedMeshParams.computedHeight,i),u=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,d=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,p=this.evaluatedMeshParams.offsetX+u,h=-this.evaluatedMeshParams.offsetY+d;if(null!=this.evaluatedMeshParams.placement){let s=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(s=n(r,2*(e*(o??1)),!1),null===s)return}this._writePlacedMarkers(e,t,s,l,m)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+p,o+h,l,m),this._writeQuad(e,a,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,s]=r.coords;e.recordBounds(o+p,s+h,l,m),this._writeQuad(e,a,o,s)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+p,o+h,l,m),this._writeQuad(e,a,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+p,r+h,l,m),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,a,t,r)})}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,u=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id);if(!u)return;const d=r.getDisplayId();let p=u.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,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)}}export{_ as MarkerMeshWriter,v as MarkerVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t,__param as e}from"tslib";import{location as i,option as o,uniform as s,texture as l,input as r,ComputeVertexInput as a}from"../../GraphShaderModule.js";import{Vec4 as p,Vec2 as n,Float as u,Sampler2D as d,Vec3 as m,min as y,max as h,Mat3 as c,ifElse as x,lessThan as v,equal as w,texture2D as V,clamp as f,abs as S,mix as b,distance as g,greaterThan as C,negate as M}from"../../graph/glsl.js";import{MarkerConstants as z}from"./markerConstants.js";import{FeatureVertexInput as _,AFeatureShader as R,FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{c256ToRad as U,softEdgeRatio as
|
|
2
|
+
import{__decorate as t,__param as e}from"tslib";import{location as i,option as o,uniform as s,texture as l,input as r,ComputeVertexInput as a}from"../../GraphShaderModule.js";import{Vec4 as p,Vec2 as n,Float as u,Sampler2D as d,Vec3 as m,min as y,max as h,Mat3 as c,ifElse as x,lessThan as v,equal as w,texture2D as V,clamp as f,abs as S,mix as b,distance as g,greaterThan as C,negate as M}from"../../graph/glsl.js";import{MarkerConstants as z}from"./markerConstants.js";import{FeatureVertexInput as _,AFeatureShader as R,FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{c256ToRad as U,softEdgeRatio as F,trueHit as N,noHit as T}from"../shaders/constants.js";import{isRectHittest as D,hittestMarkerScreenRect as q,distPointTriangle as O,xyToBarycentric as k,inTriangle as A}from"../shaders/hittestUtils.js";import{MosaicInfo as P}from"../shaders/MosaicInfo.js";import{getBit as I,getBitBool as H,rgba2float as G}from"../shaders/utils.js";import{VisualVariableColor as L}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as J}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as K}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Q}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as W}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableOpacity as X,getVisualVariableColor as Y,getVisualVariableSize as Z,getVisualVariableRotation as $}from"../shaders/vvUtils.js";class tt extends _{}t([i(3,p)],tt.prototype,"color",void 0),t([i(4,p)],tt.prototype,"outlineColor",void 0),t([i(5,n)],tt.prototype,"offset",void 0),t([i(6,n)],tt.prototype,"textureUV",void 0),t([i(7,p)],tt.prototype,"sizing",void 0),t([i(8,u)],tt.prototype,"placementAngle",void 0),t([i(9,u)],tt.prototype,"sdfDecodeCoeff",void 0),t([i(10,n)],tt.prototype,"zoomRange",void 0);class et extends a{}t([i(11,n)],et.prototype,"offsetNextVertex1",void 0),t([i(12,n)],et.prototype,"offsetNextVertex2",void 0),t([i(13,n)],et.prototype,"textureUVNextVertex1",void 0),t([i(14,n)],et.prototype,"textureUVNextVertex2",void 0);class it extends j{}function ot(t,e,i,o){return e.multiply(t.x).add(i.multiply(t.y)).add(o.multiply(t.z))}function st(t){return t.multiply(t).divide(128)}class lt extends R{constructor(){super(...arguments),this.type="MarkerShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],textureUV:["textureUVNextVertex1","textureUVNextVertex2"]}}vertex(t,e){const i=st(t.sizing.x),o=st(t.sizing.y),s=st(t.sizing.z),l=t.placementAngle,r=I(t.bitset,z.bitset.isSDF),a=I(t.bitset,z.bitset.isMapAligned),n=I(t.bitset,z.bitset.scaleSymbolsProportionally),d=H(t.bitset,z.bitset.colorLocked),x=X(this,t.id),v=Y(this,t.id,t.color,d).multiply(x),w=this.view.displayViewScreenMat3.multiply(new m(t.pos.xy,1)),V=Z(this,t.id,s).divide(s),f=i.multiply(V),S=t.offset.xy.multiply(V);let b=o.multiply(n.multiply(V.subtract(1)).add(1));b=y(b,h(f.subtract(.99),new u(0)));const g=h(b,new u(1)),C=y(b,new u(1)),M=c.fromRotation(l.multiply(U)),_=$(this,t.id),R=this._getViewRotationMatrix(a).multiply(_).multiply(M).multiply(new m(S.xy,0)).multiply(this.view.scaleFactor),j=this.clip(t.id,t.zoomRange),F=new p(w.xy.add(R.xy),j,1),N=t.textureUV.divide(this.mosaicInfo.size),T=t.outlineColor.multiply(C),D=I(t.bitset,z.bitset.overrideOutlineColor),q=t.sdfDecodeCoeff.multiply(f);return{glPosition:F,color:v,textureUV:N,outlineColor:T,outlineSize:g,distanceToPx:q,isSDF:r,overrideOutlineColor:D,...this.maybeRunHittest(t,e,{pos:t.pos,size:f,sizeCorrection:V,scaleFactor:this.view.scaleFactor,isMapAligned:a,vvRotationMat3:_,placementMat3:M,outlineSize:g,distanceToPx:q,isSDF:r})}}fragment(t){const e=this._getColor(t.textureUV,t);return this.getFragmentOutput(e,t)}hittest(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=D(this.hittestRequest);return x(r,()=>{const{tlbr:t}=this.hittestRequest;return q(o,s,l,t)},()=>x(v(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i)))}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getViewScreenMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getColor(t,e){return x(w(e.isSDF,new u(1)),this._getSDFColor(t,e),this._getSpriteColor(t,e))}_getSpriteColor(t,e){return V(this.mosaicTexture,t).multiply(e.color)}_getSDFColor(t,e){const i=V(this.mosaicTexture,t),o=new u(.5).subtract(G(i)).multiply(e.distanceToPx).multiply(F),s=f(new u(.5).subtract(o),new u(0),new u(1)),l=e.color.multiply(s);let r=e.outlineSize;this.highlight&&(r=h(r,e.overrideOutlineColor.multiply(4)));const a=r.multiply(.5),p=S(o).subtract(a),n=f(new u(.5).subtract(p),new u(0),new u(1)),d=b(e.outlineColor,e.color,e.overrideOutlineColor).multiply(n);return new u(1).subtract(d.a).multiply(l).add(d)}_hittestSmallMarker(t,e,i){const{position:o,distance:s,smallSymbolDistance:l}=this.hittestRequest,r=s.subtract(l),{viewMat3:a,tileMat3:p}=this.view,n=a.multiply(p).multiply(new m(i.pos,1)).xy,d=i.size.multiply(.5),y=g(n,o).subtract(d).add(r);return x(C(y,this.hittestRequest.distance),new u(T),new u(N))}_hittestMarker(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=this.hittestRequest.position,a=this.hittestRequest.distance,p=O(r,o,s,l);return x(C(p,a),new u(T),this._hittestSamples(o,s,l,t,e,i))}computeHittestTriangle(t,e,i){const{pos:o,sizeCorrection:s,scaleFactor:l,isMapAligned:r}=i,a=new m(t.offset.multiply(s).multiply(l),0),p=new m(e.offsetNextVertex1.multiply(s).multiply(l),0),n=new m(e.offsetNextVertex2.multiply(s).multiply(l),0),{viewMat3:u,tileMat3:d}=this.view,y=u.multiply(d).multiply(new m(o,1)),h=this._getViewScreenMatrix(r).multiply(i.vvRotationMat3).multiply(i.placementMat3);return{pos0:y.add(h.multiply(a)).xy,pos1:y.add(h.multiply(p)).xy,pos2:y.add(h.multiply(n)).xy}}_hittestSamples(t,e,i,o,s,l){const{outlineSize:r,isSDF:a,distanceToPx:d}=l,m=this.hittestRequest.position,y=this.hittestRequest.distance,h=k(m.add(new n(M(y),M(y))),t,e,i),c=k(m.add(new n(0,M(y))),t,e,i),v=k(m.add(new n(y,M(y))),t,e,i),w=k(m.add(new n(M(y),0)),t,e,i),V=k(m,t,e,i),f=k(m.add(new n(y,0)),t,e,i),S=k(m.add(new n(M(y),y)),t,e,i),b=k(m.add(new n(0,y)),t,e,i),g=k(m.add(new n(y,y)),t,e,i),z=o.textureUV.divide(this.mosaicInfo.size),_=s.textureUVNextVertex1.divide(this.mosaicInfo.size),R=s.textureUVNextVertex2.divide(this.mosaicInfo.size),j={color:new p(1),outlineColor:new p(1),overrideOutlineColor:new u(1),outlineSize:r,distanceToPx:d,isSDF:a};let U=new u(0);return U=U.add(A(h).multiply(this._getColor(ot(h,z,_,R),j).a)),U=U.add(A(c).multiply(this._getColor(ot(c,z,_,R),j).a)),U=U.add(A(v).multiply(this._getColor(ot(v,z,_,R),j).a)),U=U.add(A(w).multiply(this._getColor(ot(w,z,_,R),j).a)),U=U.add(A(V).multiply(this._getColor(ot(V,z,_,R),j).a)),U=U.add(A(f).multiply(this._getColor(ot(f,z,_,R),j).a)),U=U.add(A(S).multiply(this._getColor(ot(S,z,_,R),j).a)),U=U.add(A(b).multiply(this._getColor(ot(b,z,_,R),j).a)),U=U.add(A(g).multiply(this._getColor(ot(g,z,_,R),j).a)),x(C(U,new u(.05)),new u(N),new u(T))}}t([o(L)],lt.prototype,"visualVariableColor",void 0),t([o(B)],lt.prototype,"visualVariableOpacity",void 0),t([o(E)],lt.prototype,"visualVariableRotation",void 0),t([o(J)],lt.prototype,"visualVariableSizeMinMaxValue",void 0),t([o(K)],lt.prototype,"visualVariableSizeScaleStops",void 0),t([o(Q)],lt.prototype,"visualVariableSizeStops",void 0),t([o(W)],lt.prototype,"visualVariableSizeUnitValue",void 0),t([s(P)],lt.prototype,"mosaicInfo",void 0),t([l(d)],lt.prototype,"mosaicTexture",void 0),t([e(0,r(tt)),e(1,r(et))],lt.prototype,"vertex",null),t([e(0,r(it))],lt.prototype,"fragment",null);export{it as MarkerFragmentInput,lt as MarkerShader,tt as MarkerVertexInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as a}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as r}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as s}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as i}from"./MeshWriterVertexPack.js";const
|
|
2
|
+
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as a}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as r}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as s}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as i}from"./MeshWriterVertexPack.js";const c=96/72;class n{constructor(e,t,a,r){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=a,this._viewParams=r,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=i.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get placementInfo(){return this._evaluator.inputMeshParams.placement}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await t(e);this.placementInfo&&await a(this.placementInfo.placement)}enqueueRequest(e,t,a){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,a)}write(e,t,a,r,s,i,c,n){this.ensurePacked(t,a,r);const o=e.id||"",f=this.evaluatedMeshParams.effects,u=this._createEffectExecutionContext(a,r,o,c,n),h={target:a,options:r,level:s,viewExtent:i};if(!f||0===f.length)return void this._write(e,h);const l=this.getEffectCursor(a,f,u);if(!l)return;let m;for(;m=l.next();)m.invertY(),this._write(e,{...h,effectGeometry:m,scaleFactor:c})}ensurePacked(e,t,a){if(!this._evaluator.hasDynamicProperties)return;const r=this._evaluator.evaluateMeshParams(e,t,a);this._vertexPack.pack(r,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,a,r,s){const i=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,a,r,i,s)}_createEffectExecutionContext(e,t,a,s,i){return{geomUnitsPerPoint:c,maxInflateSize:r(this.evaluatedMeshParams.effects),scale:t.$view.scale,spatialReference:e.metadata.outSpatialReference??e.metadata.spatialReference,preventClipping:this._preventEffectClipping,tileKey:a,scaleFactor:s,matcher:i,target:e}}getEffectCursor(t,a,r){null==r.scaleFactor&&(r={...r,scaleFactor:1});const i=t.readGeometryForDisplay()?.clone();if(!i)return;const c=e.fromOptimizedCIM(i,t.geometryType);return c.invertY(),s.executeEffects(a,c,r)}}export{n as MeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as r,UniformGroup as a}from"../../GraphShaderModule.js";import{Vec4 as s,Vec2 as n,Float as p,step as u,min as m,ifElse as d,greaterThan as y,max as c,Vec3 as f,length as h,clamp as v}from"../../graph/glsl.js";import{BaseHittestVertexInput as w,FeatureVertexInput as b,AFeatureShader as V,FeatureFragmentInput as S}from"./AFeatureShader.js";import{noHit as g,trueHit as x,epsilon as j,thinLineWidthFactor as z,thinLineHalfWidth as W}from"./constants.js";import{isRectHittest as M,distPointSegment as R,hittestScreenRect as C}from"./hittestUtils.js";import{VisualVariableColor as H}from"./VisualVariableColor.js";import{VisualVariableOpacity as O}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as U}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as A,getVisualVariableOpacity as T,hasVisualVariableSize as D,getVisualVariableSize as G}from"./vvUtils.js";class L extends b{}t([e(3,s)],L.prototype,"color",void 0),t([e(4,n)],L.prototype,"offset",void 0),t([e(5,n)],L.prototype,"normal",void 0),t([e(6,p)],L.prototype,"halfWidth",void 0),t([e(7,p)],L.prototype,"referenceHalfWidth",void 0),t([e(8,n)],L.prototype,"zoomRange",void 0);class k extends S{}class B extends a{}function E(t){return c(new p(z).multiply(u(t,new p(W))),new p(1))}function I(t,i){const{halfWidth:e,normal:o}=t,l=E(e),r=h(o).multiply(e);return v(l.multiply(e.subtract(r)).divide(i.add(l).subtract(new p(1))),new p(0),new p(1))}function J(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(D(t)){const i=new p(2).multiply(l),r=G(t,e,i)
|
|
2
|
+
import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as r,UniformGroup as a}from"../../GraphShaderModule.js";import{Vec4 as s,Vec2 as n,Float as p,step as u,min as m,ifElse as d,greaterThan as y,max as c,Vec3 as f,length as h,clamp as v}from"../../graph/glsl.js";import{BaseHittestVertexInput as w,FeatureVertexInput as b,AFeatureShader as V,FeatureFragmentInput as S}from"./AFeatureShader.js";import{noHit as g,trueHit as x,epsilon as j,thinLineWidthFactor as z,thinLineHalfWidth as W}from"./constants.js";import{isRectHittest as M,distPointSegment as R,hittestScreenRect as C}from"./hittestUtils.js";import{VisualVariableColor as H}from"./VisualVariableColor.js";import{VisualVariableOpacity as O}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as U}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as A,getVisualVariableOpacity as T,hasVisualVariableSize as D,getVisualVariableSize as G}from"./vvUtils.js";class L extends b{}t([e(3,s)],L.prototype,"color",void 0),t([e(4,n)],L.prototype,"offset",void 0),t([e(5,n)],L.prototype,"normal",void 0),t([e(6,p)],L.prototype,"halfWidth",void 0),t([e(7,p)],L.prototype,"referenceHalfWidth",void 0),t([e(8,n)],L.prototype,"zoomRange",void 0);class k extends S{}class B extends a{}function E(t){return c(new p(z).multiply(u(t,new p(W))),new p(1))}function I(t,i){const{halfWidth:e,normal:o}=t,l=E(e),r=h(o).multiply(e);return v(l.multiply(e.subtract(r)).divide(i.add(l).subtract(new p(1))),new p(0),new p(1))}function J(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(D(t)){const i=new p(2).multiply(l),r=G(t,e,i),a=new p(j),s=d(y(o,a),o.divide(c(l,a)),new p(1));return new p(.5).multiply(s).multiply(r)}return o}function K(t,i){const{id:e,offset:o,pos:l,normal:r,zoomRange:a}=i,{displayViewScreenMat3:n,displayViewMat3:m}=t.view,d=A(t,e,i.color),y=T(t,e),h=J(t,i),v=new p(.5).multiply(t.antialiasingControls.antialiasing),w=c(h.add(v),new p(.45)).add(new p(.1).multiply(v)),b=E(w).multiply(w).multiply(o).multiply(t.view.scaleFactor),V=m.multiply(new f(b,new p(0))),S=n.multiply(new f(l,new p(1))).add(V),g=new p(2).multiply(u(h,new p(0))).add(t.clip(e,a)),x=new s(S.xy,g,1);return{color:d,opacity:y,halfWidth:w,normal:r,scaledOffset:b,scaledHalfWidth:h,glPosition:new s(x.xy,g,1)}}function N(t,i){const{opacity:e,color:o}=t,l=I(t,i);return e.multiply(o).multiply(l)}t([o(p)],B.prototype,"antialiasing",void 0),t([o(p)],B.prototype,"blur",void 0);class Q extends V{constructor(){super(...arguments),this.type="LineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,i){const e=K(this,t);return{...e,...this.maybeRunHittest(t,i,e.halfWidth)}}fragment(t){const i=N(t,this.antialiasingControls.blur);return this.getFragmentOutput(i,t)}hittest(t,i,e){const{pos0:o,pos1:l,pos2:r}=this.computeHittestTriangle(t,i,null),a=M(this.hittestRequest),{distance:s,smallSymbolDistance:n,smallSymbolSizeThreshold:c,tlbr:f}=this.hittestRequest,h=u(e,c.multiply(.5)).multiply(s.subtract(n)),v=this.hittestRequest.position,w=m(R(v,o,l),R(v,o,r)).subtract(e).add(h);return d(a,C(o,l,r,f),d(y(w,s),new p(g),new p(x)))}}t([o(B)],Q.prototype,"antialiasingControls",void 0),t([l(H)],Q.prototype,"visualVariableColor",void 0),t([l(O)],Q.prototype,"visualVariableOpacity",void 0),t([l(U)],Q.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(q)],Q.prototype,"visualVariableSizeScaleStops",void 0),t([l(F)],Q.prototype,"visualVariableSizeStops",void 0),t([l(P)],Q.prototype,"visualVariableSizeUnitValue",void 0),t([i(0,r(L)),i(1,r(w))],Q.prototype,"vertex",null),t([i(0,r(k))],Q.prototype,"fragment",null);export{B as AntialiasingControls,k as LineFragmentInput,Q as LineShader,L as LineVertexInput,I as getLineAntialiasing,N as getLineFragmentColor,E as getLineThinFactor,K as getLineVertexData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as s,getYDirection as n}from"../../../alignmentUtils.js";import{maxTextLineWidth as a,minTextLineWidth as l,magicLabelLineHeight as d}from"../../../definitions.js";import{shapeGlyphs as c,shapeGlyphsForMultipoint as h}from"../../../mesh/templates/shapingUtils.js";import{getMinMaxZoom as f,processColorInput as u,packBitset as m}from"../fill/meshWriterUtils.js";import{MeshWriter as p}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as g,bitsetTextIsMapAligned as x}from"../shaders/constants.js";import{TextMeshTransformProps as y}from"./TextParams.js";import{DataType as S}from"../../../../../../webgl/enums.js";const z=28,b=[4,4],_=[16,4],P={topLeft:_,topRight:_,bottomLeft:_,bottomRight:_},M=[4,2],L=[4,6],B={topLeft:M,topRight:M,bottomLeft:L,bottomRight:L},R={topLeft:M,topRight:L,bottomLeft:M,bottomRight:L},T={topLeft:L,topRight:L,bottomLeft:b,bottomRight:b},k={topLeft:b,topRight:b,bottomLeft:L,bottomRight:L},A={topLeft:L,topRight:b,bottomLeft:L,bottomRight:b},v={topLeft:b,topRight:L,bottomLeft:b,bottomRight:L};function w(t){return{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const I={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:S.HALF_FLOAT,count:2,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||z]},clipAngle:{type:S.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>G(t||0)},referenceSymbol:{type:S.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,r=s(i?"center":o.horizontalAlignment),a=n(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:d,size:c}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(d),Math.round(e(c)),r+1<<2|a+1]}},visibility:{type:S.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:S.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:S.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:S.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>m([[g,t],[x,!!e]])},offset:{type:S.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},textureUV:{type:S.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},color:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:S.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:r})=>[Math.round(e(t)),Math.round(e(r
|
|
2
|
+
import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as s,getYDirection as n}from"../../../alignmentUtils.js";import{maxTextLineWidth as a,minTextLineWidth as l,magicLabelLineHeight as d}from"../../../definitions.js";import{shapeGlyphs as c,shapeGlyphsForMultipoint as h}from"../../../mesh/templates/shapingUtils.js";import{getMinMaxZoom as f,processColorInput as u,packBitset as m}from"../fill/meshWriterUtils.js";import{MeshWriter as p}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as g,bitsetTextIsMapAligned as x}from"../shaders/constants.js";import{TextMeshTransformProps as y}from"./TextParams.js";import{DataType as S}from"../../../../../../webgl/enums.js";const z=28,b=[4,4],_=[16,4],P={topLeft:_,topRight:_,bottomLeft:_,bottomRight:_},M=[4,2],L=[4,6],B={topLeft:M,topRight:M,bottomLeft:L,bottomRight:L},R={topLeft:M,topRight:L,bottomLeft:M,bottomRight:L},T={topLeft:L,topRight:L,bottomLeft:b,bottomRight:b},k={topLeft:b,topRight:b,bottomLeft:L,bottomRight:L},A={topLeft:L,topRight:b,bottomLeft:L,bottomRight:b},v={topLeft:b,topRight:L,bottomLeft:b,bottomRight:L};function w(t){return{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const I={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:S.HALF_FLOAT,count:2,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||z]},clipAngle:{type:S.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>G(t||0)},referenceSymbol:{type:S.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,r=s(i?"center":o.horizontalAlignment),a=n(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:d,size:c}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(d),Math.round(e(c)),r+1<<2|a+1]}},visibility:{type:S.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:S.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:S.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:S.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>m([[g,t],[x,!!e]])},offset:{type:S.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},textureUV:{type:S.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:r}=t;return[i,r,e,o]}}},color:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:S.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:r})=>[Math.round(e(t)),Math.round(e(r||t)),o,i]},outlineColor:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>u(t)},haloColor:{type:S.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>u(t)},outlineAndHaloSize:{type:S.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class C extends p{constructor(){super(...arguments),this.vertexSpec=I,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new y(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,{target:e,effectGeometry:o}){const r=this._getShaping();if(!r)return;const s=1===this.evaluatedMeshParams.alignment,n=e.getDisplayId(),{placement:a}=this.evaluatedMeshParams;if(null!=a){if("PrivatePlacementMultipoint"!==a.type)this._writePlacedTextMarkers(t,e,r,i(o));else{const o=this._getMultipointShaping();o&&this._writeMultipointText(t,e,o)}return}if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,n,o.x,o.y,r,0,void 0,{mapAligned:s});if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[i,a]=o.coords;return this._writeGlyphs(t,n,i,a,r,0,void 0,{mapAligned:s})}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>this._writeGlyphs(t,n,e,o,r,0,void 0,{mapAligned:s}))}const l=e.readXForDisplay(),d=e.readYForDisplay();return this._writeGlyphs(t,n,l,d,r,0,void 0,{mapAligned:s})}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,d=r.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!d)return;const c=i.getDisplayId();let h=d.next();for(;null!=h;){const e=-h.getAngle(),o=h.tx,i=-h.ty;this._writeGlyphs(t,c,o,i,s,e,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=d.next()}}_writeMultipointText(t,i,s){const n=o.fromFeatureSetReaderCIM(i);if(!n)return;const a=-1,l=r.getPlacement(n,a,this.evaluatedMeshParams.placement,e(1),t.id);if(!l)return;const d=i.getDisplayId();let c=l.next(),h=0;for(;null!=c;){const e=c.tx,o=-c.ty,i=-c.getAngle();this._writeGlyph(t,d,e,o,s,h,i,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),c=l.next(),h++}}_getShaping(o){const i=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!r.glyphs?.glyphs.length)return null;const s=e(i.fontSize),n=e(i.offsetX),h=e(i.offsetY),f=r.glyphs.sdfSize,u=t(e(r.lineWidth),l,a),m=f/24*d*t(r.lineHeightRatio,.25,4),{backgroundColor:p,borderLineSize:g}=w(r);return c(r.glyphs,{scale:s/f,angle:i.postAngle,xOffset:n,yOffset:h,horizontalAlignment:r.horizontalAlignment,verticalAlignment:o||r.verticalAlignment,maxLineWidth:u,lineHeight:m,decoration:r.decoration,borderLineSizePx:e(g),hasBackground:!!p,useCIMAngleBehavior:r.useCIMAngleBehavior})}_getMultipointShaping(){const o=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!i.glyphs?.glyphs.length)return null;const r=e(o.fontSize),s=e(o.offsetX),n=e(o.offsetY),c=i.glyphs.sdfSize,f=t(e(i.lineWidth),l,a),u=c/24*d*t(i.lineHeightRatio,.25,4),{backgroundColor:m,borderLineSize:p}=w(i);return h(i.glyphs,{scale:r/c,angle:o.postAngle,xOffset:s,yOffset:n,horizontalAlignment:i.horizontalAlignment,verticalAlignment:i.verticalAlignment,maxLineWidth:f,lineHeight:u,decoration:i.decoration,borderLineSizePx:e(p),hasBackground:!!m,useCIMAngleBehavior:i.useCIMAngleBehavior})}_writeGlyphs(t,o,i,r,s,n,a,l,d=!0){const c=this.evaluatedMeshParams,h=this._textMeshTransformProps,m=e(h.fontSize),p=h.haloSize,g=h.outlineSize,x=e(h.offsetX),y=e(h.offsetY),{sdfSize:S,sdfRadius:z}=c.glyphs,[b,_]=f(c.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const P=s.bounds,M=i+P.x+x,L=r+P.y-y,B=2*(c.minPixelBuffer?c.minPixelBuffer/m:1),R=Math.max(P.width,P.height)*B;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),d&&t.recordBounds(M,L,R,R),this._writeTextBox(t,o,i,r,s.textBox,a,l),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),d&&t.recordBounds(M,L,R,R);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,i,r,{texcoords:s,offsets:n,fontSize:m,haloSize:p,outlineSize:g,sdfSize:S,sdfRadius:z,color:u(c.color),isBackground:!1,referenceBounds:a,minZoom:b,maxZoom:_,...l}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeGlyph(t,o,i,r,s,n,a,l,d,c=!0){const h=this.evaluatedMeshParams,f=this._textMeshTransformProps,m=e(f.fontSize),p=f.haloSize,g=f.outlineSize,x=e(f.offsetX),y=e(f.offsetY),{sdfSize:S,sdfRadius:z}=h.glyphs;0!==a&&s.setRotation(a);const b=s.bounds,_=i+b.x+x,P=r+b.y-y,M=2*(h.minPixelBuffer?h.minPixelBuffer/m:1),L=Math.max(b.width,b.height)*M,B=s.glyphs[n];t.recordStart(this.instanceId,this.attributeLayout,B.textureBinding),c&&t.recordBounds(_,P,L,L);const{texcoords:R,offsets:T}=B;this._writeQuad(t,o,i,r,{texcoords:R,offsets:T,fontSize:m,haloSize:p,outlineSize:g,sdfSize:S,sdfRadius:z,color:u(h.color),isBackground:!1,referenceBounds:l,minZoom:0,maxZoom:30,...d}),t.recordEnd(),0!==a&&s.setRotation(-a)}_writeTextBox(t,e,o,i,r,s,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:d,outlineSize:c}=this._textMeshTransformProps,{backgroundColor:h,borderLineColor:f,borderLineSize:m}=w(a),{sdfSize:p,sdfRadius:g}=a.glyphs,x=!!f&&m>0,y={isBackground:!0,fontSize:l,haloSize:d,outlineSize:c,referenceBounds:s,sdfSize:p,sdfRadius:g,...n};h&&(this._writeQuad(t,e,o,i,{texcoords:P,offsets:r.main,color:u(h),...y}),x||(this._writeQuad(t,e,o,i,{texcoords:T,offsets:r.top,color:u(h),...y}),this._writeQuad(t,e,o,i,{texcoords:k,offsets:r.bot,color:u(h),...y}),this._writeQuad(t,e,o,i,{texcoords:A,offsets:r.left,color:u(h),...y}),this._writeQuad(t,e,o,i,{texcoords:v,offsets:r.right,color:u(h),...y}))),x&&(this._writeQuad(t,e,o,i,{texcoords:B,offsets:r.top,color:u(f),...y}),this._writeQuad(t,e,o,i,{texcoords:B,offsets:r.bot,color:u(f),...y}),this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.left,color:u(f),...y}),this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.right,color:u(f),...y}))}_writeQuad(t,e,o,i,r){const s=t.vertexCount();this._writeVertex(t,e,o,i,r),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const G=t=>Math.round(t*(256/360));export{C as TextMeshWriter,I as TextVertexSpec,w as getTextBoxStyle,z as maxLabelZoom};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t,__param as e}from"tslib";import{labelPlacementOffsetPadding as i}from"../../../definitions.js";import{location as o,option as s,uniform as l,texture as
|
|
2
|
+
import{__decorate as t,__param as e}from"tslib";import{labelPlacementOffsetPadding as i}from"../../../definitions.js";import{location as o,option as s,uniform as l,texture as a,define as r,input as n,ComputeVertexInput as p}from"../../GraphShaderModule.js";import{Vec4 as d,Vec2 as u,Float as y,Sampler2D as c,mod as m,step as f,and as h,lessThan as v,greaterThanEqual as w,Vec3 as b,Mat3 as x,ifElse as V,equal as S,greaterThan as g,Bool as z,texture2D as R,smoothstep as j,Int as A,bitRShift as C,bitAnd as O}from"../../graph/glsl.js";import{FeatureVertexInput as M,AFeatureShader as T,FeatureFragmentInput as L}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as P,bitsetTextIsMapAligned as F,noHit as H,trueHit as N}from"../shaders/constants.js";import{isRectHittest as U,distPointTriangle as _,hittestScreenRect as k}from"../shaders/hittestUtils.js";import{MosaicInfo as q}from"../shaders/MosaicInfo.js";import{getBit as D}from"../shaders/utils.js";import{VisualVariableColor as I}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as W}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as G}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Z}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as J}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as K,getVisualVariableRotation as Q}from"../shaders/vvUtils.js";const X=360/254;class Y extends M{}t([o(3,d)],Y.prototype,"color",void 0),t([o(4,u)],Y.prototype,"offset",void 0),t([o(5,u)],Y.prototype,"textureUV",void 0),t([o(6,d)],Y.prototype,"fontAndReferenceSize",void 0),t([o(7,d)],Y.prototype,"outlineColor",void 0),t([o(8,d)],Y.prototype,"haloColor",void 0),t([o(9,u)],Y.prototype,"outlineAndHaloSize",void 0),t([o(10,u)],Y.prototype,"zoomRange",void 0),t([o(11,y)],Y.prototype,"clipAngle",void 0),t([o(12,d)],Y.prototype,"referenceSymbol",void 0),t([o(15,y)],Y.prototype,"visibility",void 0);class $ extends p{}t([o(13,u)],$.prototype,"offsetNextVertex1",void 0),t([o(14,u)],$.prototype,"offsetNextVertex2",void 0);class tt extends L{}class et extends T{constructor(){super(...arguments),this.type="TextShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"]},this.textRenderPassType=0,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(t,e){const{clipAngle:i,zoomRange:o,visibility:s}=t,l=i.multiply(X),a=m(l.subtract(this.view.rotation),new y(360));let r=new y(0);const n=this.view.currentZoom,p=o.x,d=o.y,u=new y(1).subtract(f(p,n)).multiply(2),c=new y(h(w(a,new y(90)),v(a,new y(270)))).multiply(2),b=new y(2).multiply(new y(1).subtract(f(n,d)));return r=r.add(e.multiply(u)),r=r.add(e.multiply(c)),r=r.add(b),s&&(r=r.add(s)),r}vertex(t,e){const o=D(t.bitset,P),s=new y(1).subtract(o);let l=t.fontAndReferenceSize[0];const a=t.fontAndReferenceSize[1],r=t.fontAndReferenceSize[2],n=t.fontAndReferenceSize[3];let p=l.divide(r);const c=1===this.textRenderPassType?t.outlineColor:2===this.textRenderPassType?t.haloColor:this._getVertexColor(t),m=this.view.displayViewScreenMat3.multiply(new b(t.pos,1));let f=t.offset,h=new y(1),v=x.identity(),w=new u(0);if(this.isLabel){if(!t.referenceSymbol)throw new Error("InternalError: Optional attribute 'referenceSymbol' expected for labels");const e=t.referenceSymbol,o=e.xy,s=e.z,l=this._unpackDirection(e.w),a=K(this,t.id,s).divide(2),r=l.multiply(a.add(i));w=o.add(r),f=f.add(w)}else{h=K(this,t.id,a).divide(a),l=l.multiply(h),p=p.multiply(h),f=f.multiply(h),v=Q(this,t.id),f=v.multiply(new b(f,0)).xy}const R=D(t.bitset,F),j=this._getViewRotationMatrix(R).multiply(new b(f,0)).multiply(this.view.scaleFactor);let A=this.isLabel?this.clipLabel(t,R):this.clip(t.id,t.zoomRange);A=this.isBackgroundPass?A.add(s.multiply(2)):A.add(o.multiply(2));let C=new y(0);if(1===this.textRenderPassType){A=A.add(V(S(t.outlineAndHaloSize.x,new y(0)),new y(2),new y(0)));C=new y(t.outlineAndHaloSize.x).divide(p).divide(n)}if(2===this.textRenderPassType){const e=t.outlineAndHaloSize.x,i=new y(t.outlineAndHaloSize.y);A=A.add(V(S(i,new y(0)),new y(2),new y(0)));C=i.add(e).divide(p).divide(n)}const O=this.isLabel?g(A,new y(1)):new z(!1);return{glPosition:new d(m.xy.add(j.xy),A,1),color:c,size:p,textureUV:t.textureUV.divide(this.mosaicInfo.size),antialiasingWidth:new y(.105).multiply(r).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:C,...this.maybeRunHittest(t,e,{vvSizeAdjustment:h,vvRotation:v,labelOffset:w,labelClipped:O,scaleFactor:this.view.scaleFactor})}}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new y(1).subtract(t);return e.multiply(t).add(i.multiply(o))}fragment(t){const e=new y(2/8),i=new y(1).subtract(e),o=R(this.mosaicTexture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,a=j(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(a),t)}computeHittestTriangle(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s,scaleFactor:l}){let a,r,n;this.isLabel?(a=new b(t.offset.multiply(l).add(s),0),r=new b(e.offsetNextVertex1.multiply(l).add(s),0),n=new b(e.offsetNextVertex2.multiply(l).add(s),0)):(a=o.multiply(new b(t.offset.multiply(l).multiply(i),0)),r=o.multiply(new b(e.offsetNextVertex1.multiply(l).multiply(i),0)),n=o.multiply(new b(e.offsetNextVertex2.multiply(l).multiply(i),0)));const{viewMat3:p,tileMat3:d}=this.view,u=p.multiply(d).multiply(new b(t.pos,1));return{pos0:u.add(d.multiply(a)).xy,pos1:u.add(d.multiply(r)).xy,pos2:u.add(d.multiply(n)).xy}}hittest(t,e,i){const{vvSizeAdjustment:o,vvRotation:s,labelOffset:l,labelClipped:a,scaleFactor:r}=i,n=U(this.hittestRequest),{pos0:p,pos1:d,pos2:u}=this.computeHittestTriangle(t,e,{vvSizeAdjustment:o,vvRotation:s,labelOffset:l,scaleFactor:r});return V(n,()=>{const{tlbr:t}=this.hittestRequest;return this.isLabel?V(a,new y(H),k(p,d,u,t)):k(p,d,u,t)},()=>{const t=_(this.hittestRequest.position,p,d,u),e=this.isLabel?a:new z(!1);return V(e,new y(H),V(g(t,this.hittestRequest.distance),new y(H),new y(N)))})}_unpackDirection(t){const e=new A(t),i=C(e,new A(2)),o=O(e,new A(3));return new u(new y(i).subtract(1),new y(o).subtract(1))}_getVertexColor(t){let e=t.color;if(this.visualVariableColor){const i=this.getColorValue(t.id);e=this.visualVariableColor.getColor(i,t.color,new z(!1))}if(this.visualVariableOpacity){const i=this.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([s(I)],et.prototype,"visualVariableColor",void 0),t([s(B)],et.prototype,"visualVariableOpacity",void 0),t([s(E)],et.prototype,"visualVariableRotation",void 0),t([s(W)],et.prototype,"visualVariableSizeMinMaxValue",void 0),t([s(G)],et.prototype,"visualVariableSizeScaleStops",void 0),t([s(Z)],et.prototype,"visualVariableSizeStops",void 0),t([s(J)],et.prototype,"visualVariableSizeUnitValue",void 0),t([l(q)],et.prototype,"mosaicInfo",void 0),t([a(c)],et.prototype,"mosaicTexture",void 0),t([r],et.prototype,"textRenderPassType",void 0),t([r],et.prototype,"isBackgroundPass",void 0),t([r],et.prototype,"isLabel",void 0),t([e(0,n(Y)),e(1,n($))],et.prototype,"vertex",null),t([e(0,n(tt))],et.prototype,"fragment",null);export{tt as TextFragmentInput,et as TextShader,Y as TextVertexInput};
|