@arcgis/core 5.1.0-next.95 → 5.1.0-next.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.d.ts +16 -1
- package/Graphic.js +1 -1
- package/applications/MapViewer/templateUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0175098da590a7109539.js +1 -0
- package/assets/esri/core/workers/chunks/0e6feed31340cf3c1966.js +1 -0
- package/assets/esri/core/workers/chunks/26f28406056ddc0e159c.js +1 -0
- package/assets/esri/core/workers/chunks/27d6ad4ca5ab8c9d62cd.js +1 -0
- package/assets/esri/core/workers/chunks/{23241e6093e245f9c774.js → 2b00229c238aae70b948.js} +1 -1
- package/assets/esri/core/workers/chunks/{6b4c99c7648f37feec00.js → 308e1b0aea941958de44.js} +1 -1
- package/assets/esri/core/workers/chunks/34c11e7c8762fe0c19fb.js +1 -0
- package/assets/esri/core/workers/chunks/34e026549ba2822b8ebd.js +1 -0
- package/assets/esri/core/workers/chunks/4020f95d8131493f799e.js +1 -0
- package/assets/esri/core/workers/chunks/40bc7c65b708fcc80fab.js +1 -0
- package/assets/esri/core/workers/chunks/{8de61993e114f453579b.js → 40e887e87ae24ace27a5.js} +1 -1
- package/assets/esri/core/workers/chunks/4255ad7601c7a7621b71.js +1 -0
- package/assets/esri/core/workers/chunks/{5853925d2f7fb550bd2e.js → 44b5e4640fe547285e0c.js} +1 -1
- package/assets/esri/core/workers/chunks/58c15c42e6a618386a2f.js +1 -0
- package/assets/esri/core/workers/chunks/6d59a9cf533ebc590f70.js +1 -0
- package/assets/esri/core/workers/chunks/{0f527961805cd45c14e2.js → 708bd77e6d723e3f0aa8.js} +1 -1
- package/assets/esri/core/workers/chunks/7485d59d60d61737d662.js +1 -0
- package/assets/esri/core/workers/chunks/7dc9ff66e1eceadbae24.js +1 -0
- package/assets/esri/core/workers/chunks/9954928d6430e2bfdb1a.js +1 -0
- package/assets/esri/core/workers/chunks/9a29b7f9e6281ee40c37.js +1 -0
- package/assets/esri/core/workers/chunks/9f4a9b193485f88d4461.js +1 -0
- package/assets/esri/core/workers/chunks/a001e7e8a39f27284d87.js +1 -0
- package/assets/esri/core/workers/chunks/a93a058678c8c8996d54.js +1 -0
- package/assets/esri/core/workers/chunks/acb8cff06142f828fb78.js +1 -0
- package/assets/esri/core/workers/chunks/{bf73232057ebc1ecc0ad.js → b06cc59068d32baaaa87.js} +1 -1
- package/assets/esri/core/workers/chunks/b63cbf6c2c9ec1b02b9a.js +1 -0
- package/assets/esri/core/workers/chunks/b891d95b7858665cd6c1.js +1 -0
- package/assets/esri/core/workers/chunks/bfb417d72d0c90e116fe.js +1 -0
- package/assets/esri/core/workers/chunks/c0c693c2e0043ecba4a5.js +1 -0
- package/assets/esri/core/workers/chunks/{fa869bfe4366f7f49cca.js → e5f8c73349407c25956b.js} +1 -1
- package/assets/esri/core/workers/chunks/e8a885b576da3ec145d3.js +1 -0
- package/assets/esri/core/workers/chunks/{bd721bbc7afc75d3bddb.js → eda51e512eff551ad858.js} +1 -1
- package/assets/esri/core/workers/chunks/f27397379c6c88bc6ef4.js +1 -0
- package/assets/esri/core/workers/chunks/f91a2c69a93295cf4de6.js +1 -0
- package/assets/esri/core/workers/chunks/fec3fffcf854a6226df4.js +1 -0
- package/chunks/GaussianSplat.glsl.js +9 -9
- package/chunks/NativeLine.glsl.js +4 -4
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/SceneLayer.d.ts +59 -32
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/scene/ModelFileInfo.d.ts +6 -2
- package/layers/scene/ModelInfo.d.ts +16 -7
- package/layers/scene/types.d.ts +2 -0
- package/layers/support/ExportImageServiceParameters.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/types.d.ts +25 -2
- package/package.json +1 -1
- package/rest/knowledgeGraph/CreateReplicaResponse.d.ts +5 -4
- package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +1 -1
- package/rest/query/operations/queryUtils.js +1 -1
- package/rest/support/OutDistance.js +1 -1
- package/rest/support/Query.d.ts +39 -1
- package/rest/support/Query.js +1 -1
- package/support/revision.js +1 -1
- package/tables/AttributeTableTemplate.d.ts +1 -1
- package/tables/elements/AttributeTableGroupElement.d.ts +1 -1
- package/tables/support/tablesUtils.d.ts +2 -2
- package/tables/support/templateUtils.d.ts +136 -0
- package/tables/support/templateUtils.js +2 -0
- package/tables/support/types.d.ts +90 -0
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/attributes.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.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/BaseLayerView2D.d.ts +2 -2
- package/views/2d/layers/BaseLayerViewGL2D.d.ts +2 -2
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -19
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +40 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
- package/widgets/BatchAttributeForm/expressions/types.d.ts +1 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +52 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +3 -0
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/EditableInput.d.ts +2 -0
- package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +79 -0
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0ab1384282afc8731857.js +0 -1
- package/assets/esri/core/workers/chunks/130abc6a353e4d79a1b1.js +0 -1
- package/assets/esri/core/workers/chunks/1a68a249540fda9083a9.js +0 -1
- package/assets/esri/core/workers/chunks/1ae016e4f5e39c34a941.js +0 -1
- package/assets/esri/core/workers/chunks/2f6ba01ea8b8f193bea5.js +0 -1
- package/assets/esri/core/workers/chunks/31837f2f8859e2cf2efd.js +0 -1
- package/assets/esri/core/workers/chunks/41e811138c96d85fd3e8.js +0 -1
- package/assets/esri/core/workers/chunks/43b5cfb34b11c4124b51.js +0 -1
- package/assets/esri/core/workers/chunks/44b30dfce12824ee1f33.js +0 -1
- package/assets/esri/core/workers/chunks/4644e1b00fd4e628219d.js +0 -1
- package/assets/esri/core/workers/chunks/5648379d1ed4ca02eedd.js +0 -1
- package/assets/esri/core/workers/chunks/6666cd3bf1a3d175dc8c.js +0 -1
- package/assets/esri/core/workers/chunks/7536f0683e488159d8bd.js +0 -1
- package/assets/esri/core/workers/chunks/8bfe4841c83eb3abfbe8.js +0 -1
- package/assets/esri/core/workers/chunks/a12fd6a445f42326642f.js +0 -1
- package/assets/esri/core/workers/chunks/a8e2fbbfbdf1c3203d5e.js +0 -1
- package/assets/esri/core/workers/chunks/a94674826e5893c9d197.js +0 -1
- package/assets/esri/core/workers/chunks/b2504657d3ef8769005e.js +0 -1
- package/assets/esri/core/workers/chunks/b90db0829da3f96e4a19.js +0 -1
- package/assets/esri/core/workers/chunks/bd9dae2d5ec199f8e9ba.js +0 -1
- package/assets/esri/core/workers/chunks/be19d4a6fb9b1c923127.js +0 -1
- package/assets/esri/core/workers/chunks/c2589e5e0e0f81a378c2.js +0 -1
- package/assets/esri/core/workers/chunks/c33f1f722499a5c6fc11.js +0 -1
- package/assets/esri/core/workers/chunks/e03713dee3205c96d53f.js +0 -1
- package/assets/esri/core/workers/chunks/ead6e4d0a515c0913bee.js +0 -1
- package/assets/esri/core/workers/chunks/f95e3333a65a0c09fd1e.js +0 -1
- package/assets/esri/core/workers/chunks/ffb8fa77297578afef7c.js +0 -1
- package/tables/types.d.ts +0 -18
- package/widgets/FeatureTable/support/templateUtils.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as f,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as p,FlatGeometry as _}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as x}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as P,convertToGeometry as v}from"../../../../../../../layers/graphics/featureConversionUtils.js";import b from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{importLazily as M}from"../../../../../../../symbols/cim/utils.js";import{tileSize as w,minMaxZoomPrecisionFactor as L}from"../../../definitions.js";import I from"../../../collisions/BoundingBox.js";import{LabelMetric as B}from"../../../collisions/LabelMetric.js";import{smoothPaths as S,pathDivide as z}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as G,processColorInput as j}from"../fill/meshWriterUtils.js";import{TextMeshWriter as D,maxLabelZoom as A}from"../text/TextMeshWriter.js";const F=1,k=0,R=128,$=w*w/16,C=M(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),E=M(()=>import("../../../../../../../chunks/FlatGeometry.js"));function O(e,t,r){return i(`${e}${t}${r}`)}function Z(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(A-o)}`)}function T(e,t,r){return i(`${e}${t}${r}`)}function W(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(A-s)}`)}const U=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class X extends D{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),C.getImportPromise(),E.getImportPromise()])}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new B(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=C.module,s=E.module.constructFromFlatGeometry,o=t.readGeometryForDisplay(),n=t.readCentroidForDisplay()?.coords,a=o?.area()||0;if(!n)return;const l=a>=$;e.requiresRefresh||=l;const c=s(f(i)),h=s(f({x:n[0],y:n[1]})),m=!!r.execute(h,c,null);if(!o||!l||!m)return void this._writePoint(e,n[0],n[1],0,t);const u=s(g("polygon",o,null)),d=r.execute(u,c,null);if(!d)return void this._writePoint(e,n[0],n[1],0,t);const P=p(new _(d.toFlatGeometry())),v=y.fromOptimized(P,"esriGeometryPolygon",1),b=x(v)??n;this._writePoint(e,b[0],b[1],0,t)}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=O(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=T(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new B(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<F);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:G(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=P(n,"esriGeometryPolyline",1)??new b,l=Y(a,o),c=Y(a,-o),h=v(c,"esriGeometryPolyline",!1,!1),m=v(l,"esriGeometryPolyline",!1,!1),u=S(m.paths,s.bounds.width),d=S(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,z(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,z(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=S(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,z(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,u=this._current.zoomRange[0],d=U(t),f=this._current.shaping.bounds.width/(1<<F),g=Math.sqrt(n||R)/(1<<F),p=Math.min(i,r-i),_=h.isMultiline?A:Math.log2(p/(g+f/2)),y=0===t?_:Math.min(d,_),x=Math.max(u,this._zoomLevel+F-y),P=this._zoomLevel-x,v=h.bounds.width/2*2**P,b=Z(a,c,m,t,this._zoomLevel),M=W(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,b,M):s&&P<0?this._placeStraightAlong(e,u,b,M):"parallel"===o?this._placeStraightAlong(e,x,b,M):"curved"===o&&this._placeCurved(e,x,v,b,M)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,p=e.clone(),_=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(A,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:_,mapAligned:!0,isLineLabel:!0},p=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(p,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(p,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(p,i,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(p,i,0,y,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+k;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+k}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+k;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+k}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,m=this._getBoundsOffset(e.angle);for(const u of h){const h=u.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(u.x+u.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+k))),p=Math.max(t,s?0:g);u.angle=e.angle+(1-i)*Math.PI;const _=[Math.max(l[0],p),Math.min(l[1],A)];this._writeLineGlyph(o,n,e.x,e.y,u,_,r,c),this._writeLineGlyphBox(o,u,i,_,m)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*u,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const p of m){const t=p.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const m=Math.abs(p.x+p.width/2-c.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(m/(i+e.length+k)));if(0===u)continue;p.angle=e.angle+(1-o)*Math.PI;const _=[d,u];this._writeLineGlyph(a,l,f.x,f.y,p,_,n,h),this._writeLineGlyphBox(a,p,o,_,g)}}_getBoundsOffset(e){const i=t(this.evaluatedMeshParams.offsetX),s=t(this.evaluatedMeshParams.offsetY),a=u(i,s),l=r(o(),-e);return n(a,a,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>w||r<0||r>w)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps,{sdfSize:d,sdfRadius:f}=this.evaluatedMeshParams.glyphs;this._writeQuad(e,t,i,r,{sdfSize:d,sdfRadius:f,texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:u,color:j(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new I(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_packedZoom(e){return Math.floor(e*L)/L}_isVisible(e){let t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]);t=this._packedZoom(t),i=this._packedZoom(i);const r=this._packedZoom(this._zoomLevel);return t<=r&&r<=i}}function Y(e,t){const i=new b,{coords:r,lengths:s}=e,o=d(),n=d(),u=d(),f=d(),g=d(),p=d(),_=2;let y=0;for(let d=0;d<s.length;d++){const e=s[d];for(let s=0;s<e;s++){const d=_*(s+y-1),x=_*(s+y),P=_*(s+y+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<e-1?a(u,r[P],r[P+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===e-1?a(g,0,0):(l(g,u,n),c(g,g),a(g,g[1],-g[0])),h(p,f,g),c(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&m(p,p,v),m(p,p,t),i.coords.push(n[0]+p[0],n[1]+p[1])}i.lengths.push(e),y+=e}return i}export{X as LabelMeshWriter,O as labelIdHash,T as labelMetricHash,Z as lineLabelIdHash,W as lineLabelMetricHash};
|
|
2
|
+
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as f,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as p,FlatGeometry as _}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as x}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as P,convertToGeometry as v}from"../../../../../../../layers/graphics/featureConversionUtils.js";import b from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{importLazily as M}from"../../../../../../../symbols/cim/utils.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as S}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as z,processColorInput as G}from"../fill/meshWriterUtils.js";import{TextMeshWriter as j,maxLabelZoom as D}from"../text/TextMeshWriter.js";const A=1,F=0,R=128,$=w*w/16,k=M(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),C=M(()=>import("../../../../../../../chunks/FlatGeometry.js"));function E(e,t,r){return i(`${e}${t}${r}`)}function O(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(D-o)}`)}function T(e,t,r){return i(`${e}${t}${r}`)}function W(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(D-s)}`)}const Z=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class U extends j{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),k.getImportPromise(),C.getImportPromise()])}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=k.module,s=C.module.constructFromFlatGeometry,o=t.readGeometryForDisplay(),n=t.readCentroidForDisplay()?.coords,a=o?.area()||0;if(!n)return;const l=a>=$;e.requiresRefresh||=l;const c=s(f(i)),h=s(f({x:n[0],y:n[1]})),m=!!r.execute(h,c,null);if(!o||!l||!m)return void this._writePoint(e,n[0],n[1],0,t);const u=s(g("polygon",o,null)),d=r.execute(u,c,null);if(!d)return void this._writePoint(e,n[0],n[1],0,t);const P=p(new _(d.toFlatGeometry())),v=y.fromOptimized(P,"esriGeometryPolygon",1),b=x(v)??n;this._writePoint(e,b[0],b[1],0,t)}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=E(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=T(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new I(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<A);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:z(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=P(n,"esriGeometryPolyline",1)??new b,l=X(a,o),c=X(a,-o),h=v(c,"esriGeometryPolyline",!1,!1),m=v(l,"esriGeometryPolyline",!1,!1),u=B(m.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,S(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,S(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,S(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,u=this._current.zoomRange[0],d=Z(t),f=this._current.shaping.bounds.width/(1<<A),g=Math.sqrt(n||R)/(1<<A),p=Math.min(i,r-i),_=h.isMultiline?D:Math.log2(p/(g+f/2)),y=0===t?_:Math.min(d,_),x=Math.max(u,this._zoomLevel+A-y),P=this._zoomLevel-x,v=h.bounds.width/2*2**P,b=O(a,c,m,t,this._zoomLevel),M=W(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,b,M):s&&P<0?this._placeStraightAlong(e,u,b,M):"parallel"===o?this._placeStraightAlong(e,x,b,M):"curved"===o&&this._placeCurved(e,x,v,b,M)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,p=e.clone(),_=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(D,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:_,mapAligned:!0,isLineLabel:!0},p=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(p,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(p,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(p,i,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(p,i,0,y,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+F;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+F}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+F;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+F}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,m=this._getBoundsOffset(e.angle);for(const u of h){const h=u.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(u.x+u.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+F))),p=Math.max(t,s?0:g);u.angle=e.angle+(1-i)*Math.PI;const _=[Math.max(l[0],p),Math.min(l[1],D)];this._writeLineGlyph(o,n,e.x,e.y,u,_,r,c),this._writeLineGlyphBox(o,u,i,_,m)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*u,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const p of m){const t=p.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const m=Math.abs(p.x+p.width/2-c.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(m/(i+e.length+F)));if(0===u)continue;p.angle=e.angle+(1-o)*Math.PI;const _=[d,u];this._writeLineGlyph(a,l,f.x,f.y,p,_,n,h),this._writeLineGlyphBox(a,p,o,_,g)}}_getBoundsOffset(e){const i=t(this.evaluatedMeshParams.offsetX),s=t(this.evaluatedMeshParams.offsetY),a=u(i,s),l=r(o(),-e);return n(a,a,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>w||r<0||r>w)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps,{sdfSize:d,sdfRadius:f}=this.evaluatedMeshParams.glyphs;this._writeQuad(e,t,i,r,{sdfSize:d,sdfRadius:f,texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:u,color:G(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function X(e,t){const i=new b,{coords:r,lengths:s}=e,o=d(),n=d(),u=d(),f=d(),g=d(),p=d(),_=2;let y=0;for(let d=0;d<s.length;d++){const e=s[d];for(let s=0;s<e;s++){const d=_*(s+y-1),x=_*(s+y),P=_*(s+y+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<e-1?a(u,r[P],r[P+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===e-1?a(g,0,0):(l(g,u,n),c(g,g),a(g,g[1],-g[0])),h(p,f,g),c(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&m(p,p,v),m(p,p,t),i.coords.push(n[0]+p[0],n[1]+p[1])}i.lengths.push(e),y+=e}return i}export{U as LabelMeshWriter,E as labelIdHash,T as labelMetricHash,O as lineLabelIdHash,W as lineLabelMetricHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{
|
|
2
|
+
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{thinLineHalfWidthThreshold as s}from"../../../definitions.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as r}from"../../../mesh/templates/templateUtils.js";import{processLineCapInput as o,processLineJoinInput as n,packRounded as a,processColorInput as h,getMinMaxZoom as c}from"../fill/meshWriterUtils.js";import{MeshWriter as l}from"../mesh/MeshWriter.js";import{getLineClippingMargin as m}from"../mesh/utils.js";import{DataType as u}from"../../../../../../webgl/enums.js";class p{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const d={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:u.HALF_FLOAT,count:2,pack:({scaleInfo:t},{tileInfo:e})=>c(t,e)}},attributes:{id:{type:u.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:u.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:u.UNSIGNED_BYTE,count:1},color:{type:u.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>h(t)},offset:{type:u.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[a(t,16),a(e,16)]},normal:{type:u.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[a(t,16),a(e,16)]},halfWidth:{type:u.HALF_FLOAT,count:1,pack:({width:e})=>t(.5*e)},referenceHalfWidth:{type:u.HALF_FLOAT,count:1,pack:({referenceWidth:e})=>t(.5*e)}}};class f{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const _=65535;class x extends l{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=d,this._currentWrite=new f,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:_,textured:!1},this._tessParams=new p,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,{target:s,effectGeometry:i}){const r=i??e.fromFeatureSetReaderCIM(s);r&&this._writeGeometry(t,s,r)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){return r(t,m(this.evaluatedMeshParams))}_writeVertices(e,i,r){const{_currentWrite:a,_tessellationOptions:h,evaluatedMeshParams:c}=this,{width:l,capType:m,joinType:u,miterLimit:p,hasSizeVV:d}=c,f=t(.5*l);h.halfWidth=f,h.capType=o(m),h.joinType=n(u),h.miterLimit=p;const x=!d;a.out=e,a.id=i.getDisplayId(),a.vertexCount=0,a.indexCount=0,a.vertexFrom=e.vertexCount(),a.vertexBounds=x&&f<s?0:1;for(const{line:t,start:s,pathLength:o}of r)h.initialDistance=s%_,a.pathLength=o,a.distanceOffset=Math.floor(s/_)*_,this._lineTessellator.tessellate(t,h,x)}_writeTesselatedVertex(t,e,s,i,r,o,n,a,h,c,l){const{out:m,id:u,vertexBounds:p,pathLength:d,distanceOffset:f}=this._currentWrite;return this.hasEffects&&m.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=n,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=c,this._tessParams.directionX=r,this._tessParams.directionY=o,this._tessParams.distance=l,this._tessParams.pathLength=d,this._tessParams.distanceOffset=f,this._writeVertex(m,u,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{x as LineMeshWriter,p as LineTessellationParams,d as LineVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/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{
|
|
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 o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),l=Math.max(this.evaluatedMeshParams.computedHeight,a),m=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,u=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,d=this.evaluatedMeshParams.offsetX+m,p=-this.evaluatedMeshParams.offsetY+u;if(null!=this.evaluatedMeshParams.placement){let o=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(o=n(r,2*e,!1),null===o)return}this._writePlacedMarkers(e,t,o,i,l)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+d,o+p,i,l),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+d,a+p,i,l),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+d,o+p,i,l),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+d,r+p,i,l),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,s,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.1/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{getMinMaxZoom as t}from"../fill/meshWriterUtils.js";import{MeshWriter as r}from"../mesh/MeshWriter.js";import{DataType as i}from"../../../../../../webgl/enums.js";const o={createComputedParams:e=>e,optionalAttributes:{},attributes:{pos:{type:i.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:i.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:i.UNSIGNED_BYTE,count:1,pack:e=>0},offset:{type:i.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:t})=>{const r=e(t),i=-r/2,o=-r/2;return[[i,o],[i+r,o],[i,o+r],[i+r,o+r]]}}},texCoords:{type:i.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{getMinMaxZoom as t}from"../fill/meshWriterUtils.js";import{MeshWriter as r}from"../mesh/MeshWriter.js";import{DataType as i}from"../../../../../../webgl/enums.js";const o={createComputedParams:e=>e,optionalAttributes:{},attributes:{pos:{type:i.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:i.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:i.UNSIGNED_BYTE,count:1,pack:e=>0},offset:{type:i.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:t})=>{const r=e(t),i=-r/2,o=-r/2;return[[i,o],[i+r,o],[i,o+r],[i+r,o+r]]}}},texCoords:{type:i.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},referenceSize:{type:i.UNSIGNED_BYTE,count:1,pack:({size:t})=>e(t)},zoomRange:{type:i.UNSIGNED_BYTE,count:2,pack:({scaleInfo:e},{tileInfo:r})=>t(e,r)}}};class s extends r{constructor(){super(...arguments),this.vertexSpec=o}_write(t,{target:r}){const i=r.getDisplayId(),o=this.evaluatedMeshParams.minPixelBuffer,s=Math.max(e(this.evaluatedMeshParams.size),o);let a,c;if("esriGeometryPoint"===r.geometryType)a=r.readXForDisplay(),c=r.readYForDisplay();else{const e=r.readCentroidForDisplay();if(!e)return;a=e?.coords[0],c=e?.coords[1]}t.recordStart(this.instanceId,this.attributeLayout),t.recordBounds(a,c,s,s);const n=t.vertexCount();this._writeVertex(t,i,a,c),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2),t.recordEnd()}}export{s as PieChartMeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{GLSLShaderModule as e}from"../../GLSLShaderModule.js";import{Float as i,Vec4 as t,FixedArray as a,Vec2 as s,Mat3 as r,Sampler2D as o,Vec3 as l}from"../../graph/glsl.js";import{resolveIncludes as n}from"../../../shaders/sources/resolver.js";const p={hittestDist:i,hittestPos:s},d={size:i},y={filterFlags:o,animation:o,visualVariableData:o,dataDriven0:o,dataDriven1:o,dataDriven2:o,gpgpu:o},u={displayViewScreenMat3:r,displayViewMat3:r,displayMat3:r,viewMat3:r,tileMat3:r,displayZoomFactor:i,requiredZoomFactor:i,tileOffset:s,currentScale:i,currentZoom:i,metersPerSRUnit:i};class h extends e{constructor(){super(...arguments),this.vertexShader=n("materials/pie/pie.vert"),this.fragmentShader=n("materials/pie/pie.frag"),this.required={...u,...d,outlineWidth:i,colors:a,defaultColor:t,othersColor:t,outlineColor:t,donutRatio:i,sectorThreshold:i},this.textures=y,this.options={hittestUniforms:p,visualVariableSizeMinMaxValue:{minMaxValueAndSize:t},visualVariableSizeScaleStops:{sizes:{type:"array",elementType:i,size:8},values:{type:"array",elementType:i,size:8}},visualVariableSizeStops:{sizes:{type:"array",elementType:i,size:8},values:{type:"array",elementType:i,size:8}},visualVariableSizeUnitValue:{unitValueToPixelsRatio:i},visualVariableOpacity:{opacities:{type:"array",elementType:i,size:8},opacityValues:{type:"array",elementType:i,size:8}},highlightUniforms:{highlightAll:i,activeReasons:i}},this.locations={pos:{index:0,type:s},id:{index:1,type:l},bitset:{index:2,type:i},offset:{index:3,type:s},texCoords:{index:4,type:s},
|
|
2
|
+
import{GLSLShaderModule as e}from"../../GLSLShaderModule.js";import{Float as i,Vec4 as t,FixedArray as a,Vec2 as s,Mat3 as r,Sampler2D as o,Vec3 as l}from"../../graph/glsl.js";import{resolveIncludes as n}from"../../../shaders/sources/resolver.js";const p={hittestDist:i,hittestPos:s},d={size:i},y={filterFlags:o,animation:o,visualVariableData:o,dataDriven0:o,dataDriven1:o,dataDriven2:o,gpgpu:o},u={displayViewScreenMat3:r,displayViewMat3:r,displayMat3:r,viewMat3:r,tileMat3:r,displayZoomFactor:i,requiredZoomFactor:i,tileOffset:s,currentScale:i,currentZoom:i,metersPerSRUnit:i};class h extends e{constructor(){super(...arguments),this.vertexShader=n("materials/pie/pie.vert"),this.fragmentShader=n("materials/pie/pie.frag"),this.required={...u,...d,outlineWidth:i,colors:a,defaultColor:t,othersColor:t,outlineColor:t,donutRatio:i,sectorThreshold:i},this.textures=y,this.options={hittestUniforms:p,visualVariableSizeMinMaxValue:{minMaxValueAndSize:t},visualVariableSizeScaleStops:{sizes:{type:"array",elementType:i,size:8},values:{type:"array",elementType:i,size:8}},visualVariableSizeStops:{sizes:{type:"array",elementType:i,size:8},values:{type:"array",elementType:i,size:8}},visualVariableSizeUnitValue:{unitValueToPixelsRatio:i},visualVariableOpacity:{opacities:{type:"array",elementType:i,size:8},opacityValues:{type:"array",elementType:i,size:8}},highlightUniforms:{highlightAll:i,activeReasons:i}},this.locations={pos:{index:0,type:s},id:{index:1,type:l},bitset:{index:2,type:i},offset:{index:3,type:s},texCoords:{index:4,type:s},referenceSize:{index:5,type:i},zoomRange:{index:6,type:s}},this.defines={VV_SIZE_MIN_MAX_VALUE:"boolean",VV_SIZE_SCALE_STOPS:"boolean",VV_SIZE_FIELD_STOPS:"boolean",VV_SIZE_UNIT_VALUE:"boolean",VV_OPACITY:"boolean",HITTEST:"boolean",numberOfFields:"number",highlight:"boolean",inside:"boolean",outside:"boolean"}}setNumberOfFields(e){this.required.colors={type:"array",elementType:t,size:e}}}export{h as PieChartShader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/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{
|
|
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 c}from"../../../definitions.js";import{shapeGlyphs as d}from"../../../mesh/templates/shapingUtils.js";import{getMinMaxZoom as f,processColorInput as h,packBitset as p}from"../fill/meshWriterUtils.js";import{MeshWriter as m}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as u,bitsetTextIsMapAligned as g}from"../shaders/constants.js";import{TextMeshTransformProps as x}from"./TextParams.js";import{DataType as y}from"../../../../../../webgl/enums.js";const S=28,b=[4,4],z=[16,4],_={topLeft:z,topRight:z,bottomLeft:z,bottomRight:z},L=[4,2],P=[4,6],T={topLeft:L,topRight:L,bottomLeft:P,bottomRight:P},R={topLeft:L,topRight:P,bottomLeft:L,bottomRight:P},k={topLeft:P,topRight:P,bottomLeft:b,bottomRight:b},B={topLeft:b,topRight:b,bottomLeft:P,bottomRight:P},M={topLeft:P,topRight:b,bottomLeft:P,bottomRight:b},w={topLeft:b,topRight:P,bottomLeft:b,bottomRight:P};function A(t){return{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const v={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:y.HALF_FLOAT,count:2,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||S]},clipAngle:{type:y.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>C(t||0)},referenceSymbol:{type:y.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:c,size:d}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(c),Math.round(e(d)),r+1<<2|a+1]}},visibility:{type:y.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:y.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:y.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:y.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>p([[u,t],[g,!!e]])},offset:{type:y.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:y.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:y.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:y.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:y.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>h(t)},haloColor:{type:y.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>h(t)},outlineAndHaloSize:{type:y.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class I extends m{constructor(){super(...arguments),this.vertexSpec=v,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new x(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();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,i(o));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 a=e.readXForDisplay(),l=e.readYForDisplay();return this._writeGlyphs(t,n,a,l,r,0,void 0,{mapAligned:s})}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,c=r.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!c)return;const d=i.getDisplayId();let f=c.next();for(;null!=f;){const e=-f.getAngle(),o=f.tx,i=-f.ty;this._writeGlyphs(t,d,o,i,s,e,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),f=c.next()}}_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),f=e(i.offsetY),h=r.glyphs.sdfSize,p=t(e(r.lineWidth),l,a),m=h/24*c*t(r.lineHeightRatio,.25,4),{backgroundColor:u,borderLineSize:g}=A(r);return d(r.glyphs,{scale:s/h,angle:i.postAngle,xOffset:n,yOffset:f,horizontalAlignment:r.horizontalAlignment,verticalAlignment:o||r.verticalAlignment,maxLineWidth:p,lineHeight:m,decoration:r.decoration,borderLineSizePx:e(g),hasBackground:!!u,useCIMAngleBehavior:r.useCIMAngleBehavior})}_writeGlyphs(t,o,i,r,s,n,a,l,c=!0){const d=this.evaluatedMeshParams,p=this._textMeshTransformProps,m=e(p.fontSize),u=p.haloSize,g=p.outlineSize,x=e(p.offsetX),y=e(p.offsetY),{sdfSize:S,sdfRadius:b}=d.glyphs,[z,_]=f(d.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const L=s.bounds,P=i+L.x+x,T=r+L.y-y,R=2*(d.minPixelBuffer?d.minPixelBuffer/m:1),k=Math.max(L.width,L.height)*R;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),c&&t.recordBounds(P,T,k,k),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),c&&t.recordBounds(P,T,k,k);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,i,r,{texcoords:s,offsets:n,fontSize:m,haloSize:u,outlineSize:g,sdfSize:S,sdfRadius:b,color:h(d.color),isBackground:!1,referenceBounds:a,minZoom:z,maxZoom:_,...l}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,i,r,s,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:c,outlineSize:d}=this._textMeshTransformProps,{backgroundColor:f,borderLineColor:p,borderLineSize:m}=A(a),{sdfSize:u,sdfRadius:g}=a.glyphs,x=!!p&&m>0,y={isBackground:!0,fontSize:l,haloSize:c,outlineSize:d,referenceBounds:s,sdfSize:u,sdfRadius:g,...n};f&&(this._writeQuad(t,e,o,i,{texcoords:_,offsets:r.main,color:h(f),...y}),x||(this._writeQuad(t,e,o,i,{texcoords:k,offsets:r.top,color:h(f),...y}),this._writeQuad(t,e,o,i,{texcoords:B,offsets:r.bot,color:h(f),...y}),this._writeQuad(t,e,o,i,{texcoords:M,offsets:r.left,color:h(f),...y}),this._writeQuad(t,e,o,i,{texcoords:w,offsets:r.right,color:h(f),...y}))),x&&(this._writeQuad(t,e,o,i,{texcoords:T,offsets:r.top,color:h(p),...y}),this._writeQuad(t,e,o,i,{texcoords:T,offsets:r.bot,color:h(p),...y}),this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.left,color:h(p),...y}),this._writeQuad(t,e,o,i,{texcoords:R,offsets:r.right,color:h(p),...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 C=t=>Math.round(t*(256/360));export{I as TextMeshWriter,v as TextVertexSpec,A as getTextBoxStyle,S as maxLabelZoom};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t,__param as e}from"tslib";import{
|
|
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 r,define as a,input as n,ComputeVertexInput as p}from"../../GraphShaderModule.js";import{mod as d,Float as u,step as y,and as m,lessThan as c,greaterThanEqual as h,Vec3 as f,Mat3 as v,Vec2 as w,ifElse as b,equal as x,greaterThan as V,Bool as S,Vec4 as R,texture2D as g,smoothstep as z,Int as j,bitRShift as A,bitAnd as C,Sampler2D as O}from"../../graph/glsl.js";import{AFeatureShader as M,FeatureVertexInput as T,FeatureFragmentInput as L}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as P,bitsetTextIsMapAligned as H}from"../shaders/constants.js";import{isRectHittest as N,distPointTriangle as U,failHittest as q,hittestScreenRect as _}from"../shaders/hittestUtils.js";import{MosaicInfo as k}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 F}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as W}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as G}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as Z}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as J,getVisualVariableRotation as K}from"../shaders/vvUtils.js";const Q=360/254;class X extends T{}t([o(3,R)],X.prototype,"color",void 0),t([o(4,w)],X.prototype,"offset",void 0),t([o(5,w)],X.prototype,"textureUV",void 0),t([o(6,R)],X.prototype,"fontAndReferenceSize",void 0),t([o(7,R)],X.prototype,"outlineColor",void 0),t([o(8,R)],X.prototype,"haloColor",void 0),t([o(9,w)],X.prototype,"outlineAndHaloSize",void 0),t([o(10,w)],X.prototype,"zoomRange",void 0),t([o(11,u)],X.prototype,"clipAngle",void 0),t([o(12,R)],X.prototype,"referenceSymbol",void 0),t([o(15,u)],X.prototype,"visibility",void 0);class Y extends p{}t([o(13,w)],Y.prototype,"offsetNextVertex1",void 0),t([o(14,w)],Y.prototype,"offsetNextVertex2",void 0);class $ extends L{}class tt extends M{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(Q),r=d(l.subtract(this.view.rotation),new u(360));let a=new u(0);const n=this.view.currentZoom,p=o.x,f=o.y,v=new u(1).subtract(y(p,n)).multiply(2),w=new u(m(h(r,new u(90)),c(r,new u(270)))).multiply(2),b=new u(2).multiply(new u(1).subtract(y(n,f)));return a=a.add(e.multiply(v)),a=a.add(e.multiply(w)),a=a.add(b),s&&(a=a.add(s)),a}vertex(t,e){const o=D(t.bitset,P),s=new u(1).subtract(o);let l=t.fontAndReferenceSize[0];const r=t.fontAndReferenceSize[1],a=t.fontAndReferenceSize[2],n=t.fontAndReferenceSize[3];let p=l.divide(a);const d=1===this.textRenderPassType?t.outlineColor:2===this.textRenderPassType?t.haloColor:this._getVertexColor(t),y=this.view.displayViewScreenMat3.multiply(new f(t.pos,1));let m=t.offset,c=new u(1),h=v.identity(),g=new w(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),r=J(this,t.id,s).divide(2),a=l.multiply(r.add(i));g=o.add(a),m=m.add(g)}else{c=J(this,t.id,r).divide(r),l=l.multiply(c),p=p.multiply(c),m=m.multiply(c),h=K(this,t.id),m=h.multiply(new f(m,0)).xy}const z=D(t.bitset,H),j=this._getViewRotationMatrix(z).multiply(new f(m,0));let A=this.isLabel?this.clipLabel(t,z):this.clip(t.id,t.zoomRange);A=this.isBackgroundPass?A.add(s.multiply(2)):A.add(o.multiply(2));let C=new u(0);if(1===this.textRenderPassType){A=A.add(b(x(t.outlineAndHaloSize.x,new u(0)),new u(2),new u(0)));C=new u(t.outlineAndHaloSize.x).divide(p).divide(n)}if(2===this.textRenderPassType){const e=t.outlineAndHaloSize.x,i=new u(t.outlineAndHaloSize.y);A=A.add(b(x(i,new u(0)),new u(2),new u(0)));C=i.add(e).divide(p).divide(n)}const O=this.isLabel?V(A,new u(1)):new S(!1);return{glPosition:new R(y.xy.add(j.xy),A,1),color:d,size:p,textureUV:t.textureUV.divide(this.mosaicInfo.size),antialiasingWidth:new u(.105).multiply(a).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:C,...this.maybeRunHittest(t,e,{vvSizeAdjustment:c,vvRotation:h,labelOffset:g,labelClipped:O})}}_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))}fragment(t){const e=new u(2/8),i=new u(1).subtract(e),o=g(this.mosaicTexture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,r=z(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(r),t)}computeHittestTriangle(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s}){let l,r,a;this.isLabel?(l=new f(t.offset.add(s),0),r=new f(e.offsetNextVertex1.add(s),0),a=new f(e.offsetNextVertex2.add(s),0)):(l=o.multiply(new f(t.offset.multiply(i),0)),r=o.multiply(new f(e.offsetNextVertex1.multiply(i),0)),a=o.multiply(new f(e.offsetNextVertex2.multiply(i),0)));const{viewMat3:n,tileMat3:p}=this.view,d=n.multiply(p).multiply(new f(t.pos,1));return{pos0:d.add(p.multiply(l)).xy,pos1:d.add(p.multiply(r)).xy,pos2:d.add(p.multiply(a)).xy}}hittest(t,e,i){const{vvSizeAdjustment:o,vvRotation:s,labelOffset:l,labelClipped:r}=i,a=N(this.hittestRequest),{pos0:n,pos1:p,pos2:d}=this.computeHittestTriangle(t,e,{vvSizeAdjustment:o,vvRotation:s,labelOffset:l});return b(a,()=>{const{tlbr:t}=this.hittestRequest;return this.isLabel?b(r,q(this.hittestRequest),_(n,p,d,t)):_(n,p,d,t)},()=>{const t=U(this.hittestRequest.position,n,p,d),e=this.isLabel?b(r,q(this.hittestRequest),t):t;return b(V(e,this.hittestRequest.distance),new u(0),new u(1))})}_unpackDirection(t){const e=new j(t),i=A(e,new j(2)),o=C(e,new j(3));return new w(new u(i).subtract(1),new u(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 S(!1))}if(this.visualVariableOpacity){const i=this.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([s(I)],tt.prototype,"visualVariableColor",void 0),t([s(B)],tt.prototype,"visualVariableOpacity",void 0),t([s(E)],tt.prototype,"visualVariableRotation",void 0),t([s(F)],tt.prototype,"visualVariableSizeMinMaxValue",void 0),t([s(W)],tt.prototype,"visualVariableSizeScaleStops",void 0),t([s(G)],tt.prototype,"visualVariableSizeStops",void 0),t([s(Z)],tt.prototype,"visualVariableSizeUnitValue",void 0),t([l(k)],tt.prototype,"mosaicInfo",void 0),t([r(O)],tt.prototype,"mosaicTexture",void 0),t([a],tt.prototype,"textRenderPassType",void 0),t([a],tt.prototype,"isBackgroundPass",void 0),t([a],tt.prototype,"isLabel",void 0),t([e(0,n(X)),e(1,n(Y))],tt.prototype,"vertex",null),t([e(0,n($))],tt.prototype,"fragment",null);export{$ as TextFragmentInput,tt as TextShader,X as TextVertexInput};
|