@arcgis/core 4.33.0-next.20250325 → 4.33.0-next.20250326
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/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/containerUtils.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/fieldStats.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/stats.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0059295780fa4a090f30.js +319 -0
- package/assets/esri/core/workers/chunks/{8f4bcca8b0525e19374f.js → 042771b4e56355924140.js} +1 -1
- package/assets/esri/core/workers/chunks/1dd6d68d23ba07587ae4.js +1 -0
- package/assets/esri/core/workers/chunks/{fef46b841e8369b30227.js → 2873cb727c59328074db.js} +1 -1
- package/assets/esri/core/workers/chunks/{bea2f317b73a86e2a997.js → 4dc1e7d7ac2a4b0144c4.js} +96 -96
- package/assets/esri/core/workers/chunks/705c1ebb327f680f8519.js +1 -0
- package/assets/esri/core/workers/chunks/{bd2dcc55ac3418421ee5.js → 726e3f413824f02fe689.js} +1 -1
- package/assets/esri/core/workers/chunks/afe94e351b4a50d7bc53.js +1 -0
- package/assets/esri/core/workers/chunks/{cbbbaccc0d3683e1c0fe.js → b8a4352f83502449ff95.js} +1 -1
- package/assets/esri/core/workers/chunks/{605eddec7aac891ed141.js → ba47e43ef039fe4b8c5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a2377969f76640f1d6fe.js → d5d2a4e8e19898d86c6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5f8028928ae8e5d27dda.js → e088edb9ffbaa1ed12eb.js} +1 -1
- package/assets/esri/core/workers/chunks/ed831e51c2a03ee95879.js +1 -0
- package/assets/esri/core/workers/chunks/{3e9cd82325c473ddbf1f.js → edcc0fefd57323d2cb67.js} +1 -1
- package/assets/esri/core/workers/chunks/{065ae931b5891847a06f.js → f28eaf1d3a7f12788bcf.js} +1 -1
- package/assets/esri/core/workers/chunks/f9396af9cbfd165e72e2.js +1 -0
- package/assets/esri/core/workers/chunks/{f86736a60856ef7fdacb.js → fa3eeb40e2d732c184d8.js} +1 -1
- package/chunks/BloomBlur.glsl.js +1 -1
- package/chunks/BloomComposition.glsl.js +2 -2
- package/chunks/ComponentShader.glsl.js +24 -25
- package/chunks/HighlightApply.glsl.js +1 -1
- package/chunks/HighlightDownsample.glsl.js +1 -1
- package/chunks/HighlightToSingle.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +1 -1
- package/chunks/aiServices.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/shapePreservingProjectOperator.js +1 -1
- package/interfaces.d.ts +17 -17
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/package.json +1 -1
- package/rest/support/RasterData.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/LabelManager.js +1 -1
- package/views/2d/engine/vectorTiles/Placement.js +1 -1
- package/views/2d/engine/vectorTiles/SourceLayerData.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/BaseBucket.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/constants.js +5 -0
- package/views/2d/engine/vectorTiles/decluttering/CollisionJob.js +5 -0
- package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/core.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/jobsUtil.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/util.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/AFeatureTile.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/meshDebugUtils.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/GraphicInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/AlignedVertexSpec.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/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.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/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
- package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoubleConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +9 -9
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/{UintTexture2DBindUniform.js → Texture2DUintBindUniform.js} +1 -1
- package/views/3d/webgl-engine/core/shaderModules/{UintTexture2DPassUniform.js → Texture2DUintPassUniform.js} +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlurTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0e164b19e4ea3aa73843.js +0 -1
- package/assets/esri/core/workers/chunks/ac6b582ca180210e596c.js +0 -1
- package/assets/esri/core/workers/chunks/accd0661a6dd297fab6b.js +0 -1
- package/assets/esri/core/workers/chunks/b5f44cf03c4e5cc07bc4.js +0 -1
- package/assets/esri/core/workers/chunks/bfbb118ae3b4a4ce1c74.js +0 -319
- package/assets/esri/core/workers/chunks/fa7ddf3c89cdb8052b26.js +0 -1
- package/chunks/BloomDepthAdjust.glsl.js +0 -14
- package/views/2d/engine/vectorTiles/decluttering/jobs.js +0 -5
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +0 -5
- package/views/2d/engine/webgl/collisions/CollisionGrid.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/TextureCubeBindUniform.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/UintTexture2DDrawUniform.js +0 -5
- package/views/3d/webgl-engine/effects/bloom/BloomDepthAdjust.glsl.js +0 -5
- package/views/3d/webgl-engine/effects/bloom/BloomDepthAdjustTechnique.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{
|
|
5
|
+
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as i}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as r,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as n,RESHUFFLING_EXEMPT_DRAW_CALLS as o,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as h}from"./definitions.js";import a from"./DisplayEntity.js";import{FeatureBatchingStrategy as l}from"./enums.js";import{DisplayList as c}from"./FeatureDisplayList.js";import{ReshufflePlan as f}from"./ReshufflePlan.js";import{LabelMetric as u}from"./collisions/LabelMetric.js";import{MappedMesh as _}from"./cpuMapped/MappedMesh.js";import{debugMeshDataInfo as m}from"./mesh/meshDebugUtils.js";import p from"./util/Reader.js";import{deserializeList as y}from"./util/serializationUtils.js";const g=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");let b=0;class I extends i{constructor(e,i,r,n,o,d,h=!1){super(e,i,r,n),this._fader=o,this._labelInstanceId=d,this._meshes=new Map,this._entities=[],this._entityIndex=new Map,this._invalidated=!1,this._nextUploadAllowed=!1,this.tileAge=b++,this._metrics=[],this._clearedMetrics=[],this._entityIds=new Set,this._entityIdsFromBuffer=new Set,this._attributeEpoch=0,this._encounteredEnd=!1,this.neededForCoverage=!1,this.isCoverage=!1,this.rendering=!1,this._decluttered=!1,this._objectIdMap=null,this.visible=!0,this.transforms.labelMat2d=t(),this.transforms.tileUnitsToPixels=s(),this.enableDeferredUploads=h}destroy(){super.destroy(),this.clear(),this._finalizeMetricClear()}clear(){for(const e of this._meshes.values())e.destroy();this._meshes.clear(),this._entities=[],this._clearedMetrics=this._metrics,this._metrics=[],this._displayList=null,this._invalidated=!0,this._entityIds.clear(),this._nextUploadAllowed=!0}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}tryReady(e){const t=this._invalidated&&!this._uploadAllowed;return!(this.isReady||t||!this._encounteredEnd||!(e>=this._attributeEpoch))&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.ready [epoch=${e}]`),this.ready(),this.requestRender(),this.decluttered=!1,!0)}get decluttered(){return this._decluttered}set decluttered(e){this._decluttered=e,this.requestRender()}get id(){return this.key.id}get hasData(){return!!this._meshes.size}get hasAnimations(){return!!this._objectIdMap}get needsUpload(){return this._invalidated}get _uploadAllowed(){return!this.enableDeferredUploads||this._nextUploadAllowed}get _hasMetrics(){return this._metrics.length>0}upload(){this._nextUploadAllowed=!0}getDisplayList(e,t){if(this._uploadAllowed&&this._invalidated){this._entities.sort(((e,t)=>{const s=t.sortKey,i=e.sortKey;return i===s?e.id-t.id:i-s})),t===l.BATCHING&&this.reshuffle(!0),this._displayList=c.fromDisplayEntities(this._entities,this,e,t);for(const e of this._meshes.values())e.upload();this.debugInfo.display.length=this._displayList.length,this.debugInfo.display.minOrderedLength=this._displayList.minOrderedLength,this.debugInfo.display.minUnorderedLength=this._displayList.minUnorderedLength,this.requestRender(),this._invalidated=!1,this._nextUploadAllowed=!1}return this._displayList}getMesh(e){if(!this._meshes.has(e))throw new Error(`InternalError: Unable to find VAO for instance: ${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}onMessage(e){if(e.objectIdMap)for(const t in e.objectIdMap)this._objectIdMap||(this._objectIdMap={}),this._objectIdMap[t]=e.objectIdMap[t];switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}if(this._aggregateMemoryStats(),this.requestRender(),e.end){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end [epoch=${e.attributeEpoch}]`),!e.attributeEpoch)throw new Error("InternalError: Attribute epoch not defined.");this._attributeEpoch=e.attributeEpoch,this._encounteredEnd=!0}this.writeLabelVisibility()}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:m(e?.append)}),e.clear&&this.clear(),!e.append)return;const t=y(new p(e.append.entities),a);this._insert(t,e.append.data,!1)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:m(e.modify),remove:e.remove});const t=y(new p(e.modify.entities),a),s=t.map((e=>e.id)),i=e.isPixelBuffer??!1,r=[...e.remove,...s];i?this._removeByIdsFromBuffer(r):this._removeByIds(r),this._insert(t,e.modify.data,i)}reshuffle(e=!1){if(this.destroyed)return;const t=new Map;for(const s of this._entities)for(const i of s.records){const s=this._meshes.get(i.instanceId);let r=t.get(s);r||(r=new f(e),t.set(s,r)),r.copyRecord(i)}for(const[s,i]of t)s.reshuffle(i);this._invalidated=!0,this._aggregateMemoryStats(),has("esri-2d-update-debug")&&g().info(`Tile ${this.key.id} was reshuffled.`)}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*h,n=i*h;for(const o of e._entities){let s=null;for(const i of o.records)if(i.overlaps&t){const t=e.getMesh(i.instanceId),d=this._ensureMesh(i.instanceId,t.layout,t.useVisibility).copyRecordFrom(t,i,r,n);s||(s=new a(o.id,o.sortKey),this._entityIdsFromBuffer.add(o.id),this._entityIndex.set(s.id,s),this._entities.push(s)),s.records.push(d)}}this._invalidated=!0}writeLabelVisibility(){if(this._clearedMetrics.length)return this._finalizeMetricClear();const e=this._meshes.get(this._labelInstanceId);if(e&&this._hasMetrics){for(const t of this._metrics){const s=this._entityIndex.get(t.entityTexel);if(!s)continue;const i=t.uniqueSymbol.show&&t.selectedForRendering;e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}this._invalidated=!0}}_ensureMesh(e,t,s){return this._meshes.has(e)||this._meshes.set(e,new _(this._stage.bufferPool,t,s)),this._meshes.get(e)}_insert(e,t,s){if(!e.length)return;this._removeDuplicatedBufferedEntites(e);const i=this._insertVertexData(t);for(const r of e){for(const e of r.records)e.updateBaseOffsets(i.get(e.instanceId));s?this._tryInsertBufferedEntity(r):this._insertEntity(r)}this._invalidated=!0}_insertMetrics(e){for(const t of e)t.tile=this;this._metrics.push(...e),this._fader?.insertFeatureTileMetrics(this,e)}_insertVertexData(e){const t=new Map;for(const s of e){const{instanceId:e,layout:i}=s,r=i.attributes.some((e=>"visibility"===e.name)),n=this._ensureMesh(e,i,r).append(s);if(s.metrics){const e=y(new p(s.metrics),u)??[];this._insertMetrics(e)}t.set(e,n)}return t}_insertEntity(e){has("esri-2d-update-debug")&&this._entityIds.has(e.id)&&console.error(`Tile ${this.key.id} 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))}_removeDuplicatedBufferedEntites(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)}_removeByIdsFromBuffer(e){this._removeByIds(e.filter((e=>this._entityIdsFromBuffer.has(e))))}_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);const i=[];for(const r of this._metrics)t.has(r.entityTexel)?this._clearedMetrics.push(r):i.push(r);this._entities=s,this._metrics=i,this._invalidated=!0}_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._meshes.get(e)?.remove(s,i,r,n)}}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._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:i,length:h}=this.debugInfo.display;return t>r&&s<n||h>o&&i/h<d}get entityIds(){return this._objectIdMap?this._entities.map((({id:e})=>({objectId:this._objectIdMap[e],displayId:e}))):[]}_finalizeMetricClear(){if(!this._clearedMetrics.length)return;this._fader.removeFeatureTileMetrics(this,this._clearedMetrics),this._clearedMetrics.length=0,this._invalidated=!0;const e=this._meshes.get(this._labelInstanceId);if(e)for(const t of this._metrics){const s=this._entityIndex.get(t.entityTexel);if(!s)continue;const i=t.uniqueSymbol.show&&t.uniqueSymbol.tileSymbols.some((e=>e.selectedForRendering&&e.tile.key.equals(this.key)));e.setEntityRecordRangeVisibility(s.records,t.recordStart,t.recordCount,i?0:255)}}}export{I as FeatureTile};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"./BoundingBox.js";import{serializeList as
|
|
5
|
+
import{numericHash as e}from"../../../../../core/string.js";import{labelPlacementOffsetPadding as i}from"../definitions.js";import{VVBinding as t}from"../enums.js";import r from"./BoundingBox.js";import{serializeList as s,deserializeList as n}from"../util/serializationUtils.js";const o=2;class h{constructor(i,t,r,s,n,o,h,a,l,c=[],d=0,u=0){this.entityTexel=i,this.labelClassId=t,this.anchorX=r,this.anchorY=s,this.directionX=n,this.directionY=o,this.maxScale=h,this.minScale=a,this.referenceBounds=l,this.bounds=c,this.recordStart=d,this.recordCount=u,this.priority=0,this._colliders=null,this.uniqueSymbol=null,this.selectedForRendering=!1,this.hash=e(`${i} ${t}`)}get xTile(){return this.anchorX}get yTile(){return this.anchorY}colliders(e){if(!this._colliders){const r=e.attributeView,s=i;let n=this.referenceBounds?.size??0;const h=e.layerView.labelingCollisionInfos[0].vvEvaluators[0];if(null!=h){const e=h(r.getVisualVariableData(this.entityTexel,t.SIZE));n=isNaN(e)||null==e||e===1/0?n:e}const a=this.minScale?e.layerView.view.featuresTilingScheme.scaleToZoom(this.minScale):0,l=this.maxScale?e.layerView.view.featuresTilingScheme.scaleToZoom(this.maxScale):25,c=this.directionX*(s+n/2),d=this.directionY*(s+n/2);this._colliders=this.bounds.map((e=>({xTile:this.anchorX,yTile:this.anchorY,dxPixels:e.x-e.halfWidth+c,dyPixels:e.y-e.halfHeight+d,hard:!0,partIndex:1,width:e.width+o,height:e.height+o,angle:0,xScreen:0,yScreen:0,dxScreen:0,dyScreen:0,enabled:!0,minLod:a,maxLod:l})))}return this._colliders}get featureID(){return this.entityTexel}serialize(e){e.push(this.entityTexel),e.push(this.labelClassId),e.push(this.recordStart),e.push(this.recordCount),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),null===this.referenceBounds?(e.writeF32(0),e.writeF32(0),e.writeF32(0)):(e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY)),s(e,this.bounds)}static deserialize(e){const i=e.readInt32(),t=e.readInt32(),s=e.readInt32(),o=e.readInt32(),a=e.readF32(),l=e.readF32(),c=e.readF32(),d=e.readF32(),u=e.readF32(),f=e.readF32(),m=e.readF32(),F=e.readF32(),w=e.readF32(),x=n(e,r)??[];return new h(i,t,a,l,c,d,u,f,{size:m,offsetX:F,offsetY:w},x,s,o)}}export{h as LabelMetric};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{
|
|
5
|
+
import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{toUint32 as i,toFloat32 as r}from"../number.js";import{PooledUint32Array as e}from"../PooledUint32Array.js";import{FreeList as s}from"./FreeList.js";import{BufferObject as n}from"../../../../webgl/BufferObject.js";import{Usage as h}from"../../../../webgl/enums.js";const a=1.25,d=32767,u=d<<16|d;class o{constructor(t,i,r,s){this._pool=s;const n=e.create(i*r*Uint32Array.BYTES_PER_ELEMENT,this._pool);this.size=i,this.strideInt=r,this.bufferType=t,this.dirty={start:1/0,end:0},this.memoryStats={bytesUsed:0,bytesReserved:i*r*Uint32Array.BYTES_PER_ELEMENT},this._gpu=null,this._cpu=n,this.clear()}get elementSize(){return this._cpu.length/this.strideInt}get intSize(){return this.fillPointer*this.strideInt}get byteSize(){return this.intSize*Uint32Array.BYTES_PER_ELEMENT}get invalidated(){return this.bufferSize>0&&!this._gpu}get invalidatedComputeBuffer(){return this.bufferSize>0&&!this._gpuComputeTriangles}invalidate(){this._invalidateTriangleBuffer(),this._gpu?.dispose(),this._gpu=null}_invalidateTriangleBuffer(){this._gpuComputeTriangles?.dispose(),this._gpuComputeTriangles=null}destroy(){this._gpu?.dispose(),this._gpuComputeTriangles?.dispose(),this._cpu?.destroy()}clear(){this.dirty.start=1/0,this.dirty.end=0,this.freeList=new s({start:0,end:this._cpu.length/this.strideInt}),this.fillPointer=0}ensure(t){if(this.maxAvailableSpace()>=t)return;if(t*this.strideInt>this._cpu.length-this.fillPointer){this.invalidate();const i=this._cpu.length/this.strideInt,r=Math.round((i+t)*a),e=r*this.strideInt;this._cpu.expand(e*Uint32Array.BYTES_PER_ELEMENT),this.freeList.free(i,r-i),this.memoryStats.bytesReserved+=(r-i)*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}}setU32(t,i){this._cpu.array[t]!==i&&(this._cpu.array[t]=i,this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(t+1,this.dirty.end))}setF32(t,r){this.setU32(t,i(r))}setF32Range(t,r,e){const s=i(e);this._cpu.array.fill(s,t,r),this.dirty.start=Math.min(t,this.dirty.start),this.dirty.end=Math.max(r,this.dirty.end)}getF32(t){return r(this._cpu.array[t])}getGPUBuffer(t,i=!1){if(!this.bufferSize)return null;if(i){if("index"!==this.bufferType)throw new Error("Tired to get triangle buffer, but target is not an index buffer");return null==this._gpuComputeTriangles&&(this._gpuComputeTriangles=this._createComputeBuffer(t)),this._gpuComputeTriangles}return null==this._gpu&&(this._gpu=this._createBuffer(t)),this._gpu}getView(t,i){return this._cpu.getUint32View(t,i/Uint32Array.BYTES_PER_ELEMENT)}get bufferSize(){return this._cpu.length/this.strideInt}maxAvailableSpace(){return this.freeList.maxAvailableSpace()}insert(i,r,e,s){const n=e*this.strideInt;if(!n)return 0;const h=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,a=new Uint32Array(i,h,n),d=this.freeList.firstFit(e);t(d,"First fit region must be defined");const u=d*this.strideInt,o=n;if(this._cpu.array.set(a,u),0!==s)for(let t=0;t<a.length;t++)this._cpu.array[t+u]+=s;return this.dirty.start=Math.min(this.dirty.start,u),this.dirty.end=Math.max(this.dirty.end,u+o),this.fillPointer=Math.max(this.fillPointer,u+o),this.memoryStats.bytesUsed+=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d}copyFrom(i,r,e,s,n){const h=e*this.strideInt;if(!h)return 0;const a=r*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,d=i._cpu.getUint32View(a,h),u=this.freeList.firstFit(e);t(u,"First fit region must be defined");const o=u*this.strideInt,f=h;if(this._cpu.array.set(d,o),0!==s)for(let t=0;t<h;t++)this._cpu.array[o+t*this.strideInt+n]+=s;return this.dirty.start=Math.min(this.dirty.start,o),this.dirty.end=Math.max(this.dirty.end,o+f),this.fillPointer=Math.max(this.fillPointer,o+f),this.memoryStats.bytesUsed+=e*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,u}free(t,i,r){const e=t*this.strideInt,s=(t+i)*this.strideInt;if(!0===r)for(let n=t;n!==t+i;n++)this._cpu.array[n*this.strideInt]=u;this.dirty.start=Math.min(this.dirty.start,e),this.dirty.end=Math.max(this.dirty.end,s),this.freeList.free(t,i),this.memoryStats.bytesUsed-=i*this.strideInt*Uint32Array.BYTES_PER_ELEMENT}upload(){if(this.dirty.end){if(this._invalidateTriangleBuffer(),null==this._gpu)return this.dirty.start=1/0,void(this.dirty.end=0);this._gpu.setSubData(this._cpu.array,this.dirty.start,this.dirty.start,this.dirty.end),this.dirty.start=1/0,this.dirty.end=0}}reshuffle(t,i){if(0===i.length)return;const r=this.byteSize,s=t*this.strideInt*Uint32Array.BYTES_PER_ELEMENT,n=r>s,h=this._cpu,a=e.create(s,this._pool);n||a.array.set(this._cpu.getUint32View(0,this.intSize));for(const e of i)if(n||e.srcFrom!==e.dstFrom||0!==e.mutate){this.dirty.start=Math.min(this.dirty.start,e.dstFrom*this.strideInt),this.dirty.end=Math.max(this.dirty.end,(e.dstFrom+e.count)*this.strideInt);for(let t=0;t<e.count;t++){const i=(e.dstFrom+t)*this.strideInt,r=(e.srcFrom+t)*this.strideInt;for(let t=0;t<this.strideInt;t++)a.array[i+t]=h.array[r+t]+e.mutate}}this._cpu.destroy(),this._cpu=a,n&&this.invalidate(),this.freeList.clear(),this.memoryStats.bytesUsed=this.memoryStats.bytesReserved=s}_createBuffer(t){const i=h.DYNAMIC_DRAW;return"index"===this.bufferType?n.createIndex(t,i,this._cpu.array):n.createVertex(t,i,this._cpu.array)}_createComputeBuffer(t){const i=h.DYNAMIC_DRAW,r=new Uint32Array(this.fillPointer/3);for(let e=0;e<this.fillPointer;e+=3)r[e/3]=this._cpu.array[e];return n.createIndex(t,i,r)}}export{o as MappedBuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{i1616to32 as t}from"../number.js";import{MappedBuffer as
|
|
5
|
+
import{destroyMaybe as e}from"../../../../../core/maybe.js";import{i1616to32 as t}from"../number.js";import{MappedBuffer as i}from"./Buffer.js";import{unpackDataView as r}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{vertexLayoutHash as s}from"../shaderGraph/techniques/mesh/utils.js";import{DataType as f,PrimitiveType as o}from"../../../../webgl/enums.js";import{VertexArrayObject as n}from"../../../../webgl/VertexArrayObject.js";const u=1e3,a=4,h=[{name:"visibility",offset:0,type:f.FLOAT,count:1}],l={hash:s(h),attributes:h,stride:a};function _(e,t){const i=e.attributes.filter((e=>t.locations.has(e.name))).map((t=>({name:t.name,type:t.type,count:t.count,divisor:0,normalized:t.normalized??!1,offset:t.offset,stride:e.stride})));return new Map([["geometry",i]])}function d(e,t){const i=[],r=e.attributes.filter((e=>t.locations.has(e.name)));for(const s of r){i.push({name:s.name,type:s.type,count:s.count,divisor:0,normalized:s.normalized??!1,offset:s.offset,stride:e.stride});const r=t.computeAttributeMap[s.name];null!=r&&2===r.length&&(i.push({name:r[0],count:s.count,divisor:0,type:s.type,normalized:s.normalized??!1,offset:s.offset+e.stride,stride:e.stride}),i.push({name:r[1],count:s.count,divisor:0,type:s.type,normalized:s.normalized??!1,offset:s.offset+2*e.stride,stride:e.stride}))}return new Map([["geometry",i]])}class y{constructor(e,t,i){if(this._bufferPool=e,this._layout=t,this.useVisibility=i,this._invalidatedGeometry=!1,this._invalidatedCompute=!1,this._position=this._layout.attributes.find((e=>"pos"===e.name||"position"===e.name)),!this._position)throw new Error("InternalError: Unable to find position attribute")}destroy(){this._indexBuffer=e(this._indexBuffer),this._vertexBuffer=e(this._vertexBuffer),this._visibilityBuffer=e(this._visibilityBuffer),this._computeVAO?.disposeVAOOnly(),this._geometryVAO?.disposeVAOOnly()}get layout(){return this._layout}getDrawArgs(e,t,i,r){return r?{primitive:o.POINTS,count:t/3,offset:i/3}:{primitive:e,count:t,offset:i}}getAttributePrecisionPackFactors(){const e={};for(const t of this.layout.attributes)t.packPrecisionFactor&&(e[t.name]=t.packPrecisionFactor);return e}getDebugVertexInfo(e=!1,t){if(!this._vertexBuffer)return null;const i=this._layout,s=i.stride,f=this._vertexBuffer.getView(0,this._vertexBuffer.byteSize),o=[];if(e)if(null==t)console.log("must provide location info to see compute attributes");else for(const r of i.attributes){const e=t.computeAttributeMap[r.name];null!=e&&2===e.length&&(o.push({...r,name:e[0],offset:r.offset+s}),o.push({...r,name:e[1],offset:r.offset+2*s}))}const n=new DataView(f.slice().buffer);let u=f.byteLength/s;e&&(u=this._indexBuffer.fillPointer/3);const a=this._indexBuffer.getView(0,this._indexBuffer.byteSize);let h=0;const l=[];for(let _=0;_<u;_++){if(e){h=a[3*_]*s}const t={};for(const e of[...i.attributes,...o]){let i=`${e.offset} ${e.name}`,s=r(n,e,h);if(e.packPrecisionFactor)if(i+=` (precision: ${e.packPrecisionFactor})`,"number"==typeof s)s/=e.packPrecisionFactor;else for(let t=0;t<s.length;t++)s[t]/=e.packPrecisionFactor;t[i]=s}h+=s,l.push(t)}return{vertices:l,layout:i}}_ensure(e,t){if(this._vertexBuffer&&this._indexBuffer)this._indexBuffer.ensure(Math.max(e,u)),this._vertexBuffer.ensure(Math.max(t,u)),this._visibilityBuffer&&this._visibilityBuffer.ensure(Math.max(t,u));else{const r=this._layout.stride/Uint32Array.BYTES_PER_ELEMENT;this._indexBuffer=new i("index",Math.max(e,u),1,this._bufferPool),this._vertexBuffer=new i("vertex",Math.max(t,u),r,this._bufferPool),this.useVisibility&&(this._visibilityBuffer=new i("vertex",Math.max(t,u),a/Uint32Array.BYTES_PER_ELEMENT,this._bufferPool))}}append(e){const t=e.layout.stride,i=e.indices.byteLength/Uint32Array.BYTES_PER_ELEMENT,r=e.vertices.byteLength/t;this._ensure(i,r);const{vertices:s,indices:f}=e,o=this._vertexBuffer.insert(s,0,s.byteLength/t,0),n=new Uint32Array(r);new Float32Array(n.buffer).fill(255),this._visibilityBuffer&&this._visibilityBuffer.insert(n,0,n.byteLength/a,0);return{vertexFrom:o,indexFrom:this._indexBuffer.insert(f,0,f.byteLength/4,o)}}setEntityRecordRangeVisibility(e,t,i,r){for(let s=t;s<t+i;s++){const{vertexStart:t,vertexCount:i}=e[s];this._visibilityBuffer.setF32Range(t,t+i,r)}}getEntityRecordVisibility(e,t){const i=e.records[t];return this._visibilityBuffer.getF32(i.vertexStart)}copyRecordFrom(e,i,r,s){const{indexStart:f,indexCount:o,vertexStart:n,vertexCount:u}=i;this._ensure(o,u);const a=e._position,h=r*(a.packPrecisionFactor??1),l=s*(a.packPrecisionFactor??1),_=a.offset,d=t(h,l),y=this._vertexBuffer.copyFrom(e._vertexBuffer,n,u,d,_);this._visibilityBuffer&&e._visibilityBuffer&&this._visibilityBuffer.copyFrom(e._visibilityBuffer,n,u,0,0);const v=this._indexBuffer.copyFrom(e._indexBuffer,f,o,y-n,0),c=i.clone();return c.vertexStart=y,c.indexStart=v,c.overlaps=0,c}remove(e,t,i,r){this._indexBuffer.free(e,t),this._vertexBuffer.free(i,r),this._visibilityBuffer&&this._visibilityBuffer.free(i,r)}upload(){this._invalidatedGeometry=!0,this._invalidatedCompute=!0}getGeometryVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedGeometry){(this._vertexBuffer.invalidated||this._indexBuffer.invalidated||this._visibilityBuffer?.invalidated)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer&&this._visibilityBuffer.invalidate(),this._geometryVAO?.disposeVAOOnly(),this._geometryVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer&&this._visibilityBuffer.upload();const i=this._indexBuffer.getGPUBuffer(e,!1),r=new Map([["geometry",this._vertexBuffer.getGPUBuffer(e)]]);if(this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getGPUBuffer(e)),!this._geometryVAO){const s=_(this.layout,t);s.set("visibility",_(l,t).get("geometry")),this._geometryVAO=new n(e,t.locations,s,r,i)}this._invalidatedGeometry=!1}return this._geometryVAO}getComputeVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedCompute){(this._vertexBuffer.invalidated||this._indexBuffer.invalidatedComputeBuffer)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer&&this._visibilityBuffer.invalidate(),this._computeVAO?.disposeVAOOnly(),this._computeVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer&&this._visibilityBuffer.upload();const i=this._indexBuffer.getGPUBuffer(e,!0),r=new Map([["geometry",this._vertexBuffer.getGPUBuffer(e)]]);if(this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getGPUBuffer(e)),!this._computeVAO){const s=d(this.layout,t);s.set("visibility",_(l,t).get("geometry")),this._computeVAO=new n(e,t.locations,s,r,i),this._invalidatedCompute=!1}}return this._computeVAO}get memoryStats(){return{bytesUsed:this._vertexBuffer.memoryStats.bytesUsed+this._indexBuffer.memoryStats.bytesUsed,bytesReserved:this._vertexBuffer.memoryStats.bytesReserved+this._indexBuffer.memoryStats.bytesReserved,vertex:this._vertexBuffer.memoryStats,index:this._indexBuffer.memoryStats}}reshuffle(e){this._vertexBuffer&&this._vertexBuffer.reshuffle(e.vertex.count,e.vertex.operations),this._indexBuffer&&this._indexBuffer.reshuffle(e.index.count,e.index.operations),this._visibilityBuffer&&this._visibilityBuffer.reshuffle(e.vertex.count,e.vertex.operations)}}export{y as MappedMesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t}metricEnd(){const t=this._current.writer;this._current.metric.bounds.length&&t.writeMetric(this._current.metric)}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){if(!this._didEntityStart)return;0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,
|
|
5
|
+
import t from"../DisplayEntity.js";import e from"../DisplayRecord.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class n{constructor(e,r=0){this._id=e,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new i(Uint32Array,this._sizeHint*t.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],r=this._entities.buffer();for(const i of this._instanceIdToVertexData.values())e.push(i.serialize(t));return{message:{data:e,entities:r},transferList:t}}vertexStart(){return this._current.vertexStart??0}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,r,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t,this._current.metric.recordStart=this.recordCount()}metricEnd(){const t=this._current.writer;this._current.metric&&(this._current.metric.recordCount=this.recordCount()-this._current.metric.recordStart),this._current.metric?.bounds.length&&this._current.metric?.recordCount?(t.writeMetric(this._current.metric),this._current.metric=null):this._current.metric=null}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){if(!this._didEntityStart)return;0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,r=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=r}recordEnd(t=0){const r=this._current.vertexStart,i=this._current.writer.vertexCount-r;if(!i)return!1;const n=this._current.indexStart,s=this._current.writer.indexCount-n;return this._recordIndexStart=n,this._recordIndexCount=s,this._recordVertexStart=r,this._recordVertexCount=i,this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,n,s,r,i,t),!0}copyLast(t,r){const i=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),e.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,i,this._recordVertexCount,0);const n=this._current.writer.indexWriter,s=this._current.writer.vertexWriter,c=this._recordIndexStart+this._recordIndexCount,o=this._recordVertexCount;for(let e=this._recordIndexStart;e!==c;e++){const t=n.getValue(e);n.push(t+o)}const u=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*u,_=(this._recordVertexStart+this._recordVertexCount)*u;for(let e=h;e!==_;e++){const t=s.getValue(e);s.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=t*a,S=r*a;for(let e=i*u;e<=s.length;e+=u)s.i1616Add(e+x,y,S)}copyLastFrom(t,e,r){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const n=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,s=this._current.vertexStart,c=t._current.vertexStart-s,o=this._current.writer.indexWriter,u=this._current.writer.vertexWriter,h=t._current.writer.indexWriter,_=t._current.writer.vertexWriter;for(let l=t._current.indexStart;l!==h.length;l++){const t=h.getValue(l);o.push(t-c)}for(let l=t._current.vertexStart*n;l!==_.length;l++){const t=_.getValue(l);u.push(t)}const d=this._current.writer.layout.position,a=d.packPrecisionFactor??1,x=d.offset/Uint32Array.BYTES_PER_ELEMENT,y=e*a,S=r*a;for(let l=s*n;l<=u.length;l+=n)u.i1616Add(l+x,y,S);this.recordEnd()}_getVertexWriter(t,e){const i=this._instanceIdToVertexData;return i.has(t)||i.set(t,new r(t,e,this._sizeHint)),i.get(t)}}export{n as MeshData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../tiling/TileInfoView.js";import e from"../../../tiling/TileKey.js";import"../../../tiling/TileQueue.js";import"../../../tiling/TileStrategy.js";import{tileSize as
|
|
5
|
+
import"../../../tiling/TileInfoView.js";import e from"../../../tiling/TileKey.js";import"../../../tiling/TileQueue.js";import"../../../tiling/TileStrategy.js";import{tileSize as t}from"../definitions.js";import{MeshData as s}from"./MeshData.js";const r=1,i=2,n=4,h=8,o=16,c=32,a=64,l=128;function f(e){switch(e){case r:case h:case c:return-1;case i:case a:return 0;case n:case o:case l:return 1}}function u(e){switch(e){case r:case i:case n:return-1;case h:case o:return 0;case c:case a:case l:return 1}}const _=r|h|c,d=n|o|l,m=r|i|n,p=c|a|l;class g{constructor(e,t,r,i,n=0){this.tileKey=e,this._bufferingEnabled=t,this._sizeHint=n,this._meshes={self:new s(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0;const h=i?1:0;this._copyBufferedDataIntoSelf=r&&this._bufferingEnabled&&e.level===h}get id(){return this.tileKey.id}vertexStart(){return this._meshes.self.vertexStart()??0}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(e){this._meshes.self.indexEnsureSize(e)}entityStart(e,t=e){this._currentEntityOverlaps=0,this._meshes.self.entityStart(e,t)}entityRecordCount(){return this._meshes.self.entityRecordCount()}entityEnd(){if(this._meshes.self.entityEnd(),this._bufferingEnabled){if(this._copyBufferedDataIntoSelf)return;for(let e=0;e<8;e++){const t=1<<e;!!(this._currentEntityOverlaps&t)&&this._meshes.neighbors[e].entityEnd()}}}recordStart(e,t,s){this._currentRecordOverlaps=0,this._meshes.self.recordStart(e,t,s)}recordEnd(e=0){const t=this._meshes.self.recordEnd(this._currentRecordOverlaps);return t&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):t}recordBounds(e,t,s,r){this._bufferingEnabled&&this._addOverlap(e,t,s,r)}recordCount(){return this._meshes.self.recordCount()}metricStart(e){this._meshes.self.metricStart(e)}metricBoxWrite(e){this._meshes.self.metricBoxWrite(e)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(e){this._meshes.self.vertexWrite(e)}vertexWriteF32(e){this._meshes.self.vertexWriteF32(e)}vertexWriteRegion(e){this._meshes.self.vertexWriteRegion(e)}indexWrite(e){this._meshes.self.indexWrite(e)}serialize(t){const s={message:[],transferList:[]},r=this._meshes.self.serialize();return s.message.push({tileId:this.tileKey.id,...r.message}),s.transferList.push(...r.transferList),this._meshes.neighbors.forEach(((r,i)=>{const n=r.serialize(),h=1<<i,o=f(h),c=u(h),a=new e(this.tileKey).getNormalizedNeighbor(o,c,t);s.message.push({tileId:a.id,...n.message}),s.transferList.push(...n.transferList)})),s}_addOverlap(e,s,r,i){const n=Math.min(t/2,r),h=Math.min(t/2,i),o=255^((e<0+n?d:e>=t-n?_:d|_)|(s<0+h?p:s>=t-h?m:p|m));this._currentRecordOverlaps|=o}_copyIntoNeighbors(){for(let e=0;e<8;e++){const r=1<<e;if(!!(this._currentRecordOverlaps&r)){if(this._copyBufferedDataIntoSelf){const e=-f(r)*t,s=-u(r)*t;if(0!==s)continue;this._meshes.self.copyLast(e,s);continue}if(!this._meshes.neighbors[e]){const t=Math.floor(this._sizeHint/16);this._meshes.neighbors[e]=new s(r,t)}const i=this._meshes.neighbors[e],n=-f(r)*t,h=-u(r)*t;i.copyLastFrom(this._meshes.self,n,h)}}}}export{g as MultiTileMeshData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../DisplayEntity.js";import{
|
|
5
|
+
import t from"../DisplayEntity.js";import{LabelMetric as e}from"../collisions/LabelMetric.js";import{unpackDataView as i}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import r from"../util/Reader.js";import{deserializeList as o}from"../util/serializationUtils.js";function s(e){if(!e)return null;return{entities:o(new r(e.entities),t),vertexData:e.data.map(a)}}function a(t){const s=t.layout.stride,a=new DataView(t.vertices),n=[],c=t.vertices.byteLength/s;let l=0;for(let e=0;e<c;e++){const e={};for(const r of t.layout.attributes){let t=`${r.offset} ${r.name}`,o=i(a,r,l);if(r.packPrecisionFactor)if(t+=` (precision: ${r.packPrecisionFactor})`,"number"==typeof o)o/=r.packPrecisionFactor;else for(let e=0;e<o.length;e++)o[e]/=r.packPrecisionFactor;e[t]=o}l+=s,n.push(e)}const f=t.metrics?o(new r(t.metrics),e)??[]:[];return{vertices:n,layout:t.layout,metrics:f}}export{s as debugMeshDataInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{tileSize as t}from"../../definitions.js";function e(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function n(t,e){return Math.sqrt(t*t+e*e)}function s(t){const e=n(t[0],t[1]);t[0]/=e,t[1]/=e}function i(t,e){return n(t[0]-e[0],t[1]-e[1])}function r(t,e){return t[e+1]}function h(t){return t.length-1}function a(t){let e=0;for(let n=0;n<h(t);n++)e+=d(t,n);return e}function d(t,e,n=1){let[s,i]=r(t,e);return[s,i]=[Math.round(s),Math.round(i)],Math.sqrt(s*s+i*i)*n}class u{constructor(t,e,n,s,i){this._segments=t,this._index=e,this._distance=n,this._xStart=s,this._yStart=i,this._done=!1}static create(t){return new u(t,0,0,t[0][0],t[0][1])}clone(){return new u(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let n=Math.acos(e);return t>0&&(n=2*Math.PI-n),n}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<h(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const n=this.backwardLength;if(t<=n)return this._distance=(n-t)/this.length,this;let s=this.backwardLength;for(;this.prev();){if(s+this.length>t)return this._seekBackwards(t-s);s+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>t)return this.seek(t-n,e);n+=this.length}return this._distance=1,e?this:null}}function c(e,n,s,i=!0){const r=a(e),h=u.create(e),d=r/2;if(!i)return h.seek(d),void(h.x<t&&h.y<t&&h.x>0&&h.y>0&&s(h.clone(),0,d+0*n,r));const c=Math.max((r-n)/2,0),o=Math.floor(c/n),_=d-o*n;h.seek(_);for(let a=-o;a<=o;a++)h.x<t&&h.y<t&&h.x>0&&h.y>0&&s(h.clone(),a,d+a*n,r),h.seek(n)}function o(t,e,n){_(n,e,a(t),u.create(t),0)}function _(t,e,n,s,i){if(n<e)return;const r=s.clone().seek(n/2);if(null==r)return;t(r.clone(),n,i),n=(n-e)/2;const h=r.seek(e/2);_(t,e,n,s,i+1),_(t,e,n,h,i+1)}function l(t,e){const n=e;for(let s=0;s<t.length;s++){let e=t[s];x(e,n);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[n,s]=e[t-1],[r,h]=e[t],a=r-n,d=h-s;i.push([a,d])}t[s]=i,e=i}return t}function x(t,n){const r=1e-6;if(n<=0)return;const h=t.length;if(h<3)return;const a=[];let d=0;a.push(0);for(let e=1;e<h;e++)d+=i(t[e],t[e-1]),a.push(d);n=Math.min(n,.2*d);const u=[];u.push(t[0][0]),u.push(t[0][1]);const c=t[h-1][0],o=t[h-1][1],_=e([0,0],t[0],t[1]);s(_),t[0][0]+=n*_[0],t[0][1]+=n*_[1],e(_,t[h-1],t[h-2]),s(_),t[h-1][0]+=n*_[0],t[h-1][1]+=n*_[1];for(let e=1;e<h;e++)a[e]+=n;a[h-1]+=n;const l=.5*n;for(let e=1;e<h-1;e++){let s=0,i=0,d=0;for(let h=e-1;h>=0&&!(a[h+1]<a[e]-l);h--){const u=l+a[h+1]-a[e],c=a[h+1]-a[h],o=a[e]-a[h]<l?1:u/c;if(Math.abs(o)<r)break;const _=o*o,x=o*u-.5*_*c,g=o*c/n,f=t[h+1],y=t[h][0]-f[0],k=t[h][1]-f[1];s+=g/x*(f[0]*o*u+.5*_*(u*y-c*f[0])-_*o*c*y/3),i+=g/x*(f[1]*o*u+.5*_*(u*k-c*f[1])-_*o*c*k/3),d+=g}for(let u=e+1;u<h&&!(a[u-1]>a[e]+l);u++){const h=l-a[u-1]+a[e],c=a[u]-a[u-1],o=a[u]-a[e]<l?1:h/c;if(Math.abs(o)<r)break;const _=o*o,x=o*h-.5*_*c,g=o*c/n,f=t[u-1],y=t[u][0]-f[0],k=t[u][1]-f[1];s+=g/x*(f[0]*o*h+.5*_*(h*y-c*f[0])-_*o*c*y/3),i+=g/x*(f[1]*o*h+.5*_*(h*k-c*f[1])-_*o*c*k/3),d+=g}u.push(s/d),u.push(i/d)}u.push(c),u.push(o);for(let e=0,s=0;e<h;e++)t[e][0]=u[s++],t[e][1]=u[s++]}export{u as SegmentCursor,c as pathDivide,a as pathLength,o as pathSubdivide,r as segmentAt,h as segmentCount,d as segmentLength,l as smoothPaths};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{numericHash as t}from"../../../../../../core/string.js";import{FeatureTechniqueInstance as e}from"./TechniqueInstance.js";import{castInstanceId as s}from"./mesh/instanceIdUtils.js";class n{constructor(){this._instanceById=new Map}destroy(){this._instanceById.clear()}get size(){return this._instanceById.size}entries(){return this._instanceById.entries()}updateStart(){this._instanceByIdNext=new Map,this._shaderCountByMesh=new Map,this._shaderIndices=new Map}updateEnd(){if(!this._instanceByIdNext)throw new Error("InternalError: Found updateEnd call without corresponding updateStart");for(const t of this._instanceById.keys())this._instanceByIdNext.has(t)||this._instanceById.delete(t);for(const[t,e]of this._instanceByIdNext.entries()){const s=this._instanceById.get(t);s?s.setInput(e.getInput()):this._instanceById.set(t,e)}this._instanceByIdNext=null,this._shaderCountByMesh=null,this._shaderIndices=null}values(){return this._instanceById.values()}ensureInstance(n,i){let r;if("object"==typeof i&&"optionalAttributes"in i&&"uniforms"in i){const t=`${n.type}.${JSON.stringify(i.optionalAttributes)}`,e=t+`.${JSON.stringify(i.uniforms)}`;let s=0;null!=this._instanceByIdNext&&(this._shaderIndices.has(e)?s=this._shaderIndices.get(e):(s=this._shaderCountByMesh.get(t)??0,this._shaderCountByMesh.set(t,s+1),this._shaderIndices.set(e,s))),r=t+`.${s}`}else r=`${n.type}.${JSON.stringify(i)}`;const a=t(r);if(this._instanceByIdNext){const t=new e(s(a),n,i);return this._instanceByIdNext.set(a,t),t}if(!this._instanceById.has(a)){const t=new e(s(a),n,i);this._instanceById.set(a,t)}return this._instanceById.get(a)}getInstance(t){const e=this._instanceById.get(t);if(null==e)throw new Error(`InternalError: Unable to get instance for ${t}`);return e}}export{n as default};
|
|
5
|
+
import{numericHash as t}from"../../../../../../core/string.js";import{FeatureTechniqueInstance as e}from"./TechniqueInstance.js";import{castInstanceId as s}from"./mesh/instanceIdUtils.js";class n{constructor(){this._instanceById=new Map}destroy(){this._instanceById.clear()}get size(){return this._instanceById.size}entries(){return this._instanceById.entries()}find(t){for(const e of this.values())if(e.techniqueRef.type===t)return e;return null}updateStart(){this._instanceByIdNext=new Map,this._shaderCountByMesh=new Map,this._shaderIndices=new Map}updateEnd(){if(!this._instanceByIdNext)throw new Error("InternalError: Found updateEnd call without corresponding updateStart");for(const t of this._instanceById.keys())this._instanceByIdNext.has(t)||this._instanceById.delete(t);for(const[t,e]of this._instanceByIdNext.entries()){const s=this._instanceById.get(t);s?s.setInput(e.getInput()):this._instanceById.set(t,e)}this._instanceByIdNext=null,this._shaderCountByMesh=null,this._shaderIndices=null}values(){return this._instanceById.values()}ensureInstance(n,i){let r;if("object"==typeof i&&"optionalAttributes"in i&&"uniforms"in i){const t=`${n.type}.${JSON.stringify(i.optionalAttributes)}`,e=t+`.${JSON.stringify(i.uniforms)}`;let s=0;null!=this._instanceByIdNext&&(this._shaderIndices.has(e)?s=this._shaderIndices.get(e):(s=this._shaderCountByMesh.get(t)??0,this._shaderCountByMesh.set(t,s+1),this._shaderIndices.set(e,s))),r=t+`.${s}`}else r=`${n.type}.${JSON.stringify(i)}`;const a=t(r);if(this._instanceByIdNext){const t=new e(s(a),n,i);return this._instanceByIdNext.set(a,t),t}if(!this._instanceById.has(a)){const t=new e(s(a),n,i);this._instanceById.set(a,t)}return this._instanceById.get(a)}getInstance(t){const e=this._instanceById.get(t);if(null==e)throw new Error(`InternalError: Unable to get instance for ${t}`);return e}}export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{FeatureTechniqueInstance as
|
|
5
|
+
import{FeatureTechniqueInstance as i}from"./TechniqueInstance.js";import{Techniques as e}from"./TechniqueRegistry.js";import{castInstanceId as t}from"./mesh/instanceIdUtils.js";let n=0;function l(e,l){return new i(t(n++),e,l)}const o={visualVariableColor:null,visualVariableOpacity:null,visualVariableSizeMinMaxValue:null,visualVariableSizeScaleStops:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null,visualVariableRotation:null,visualVariableSizeOutlineScaleStops:null};class a{constructor(){this.instances={fill:l(e.fill,{uniforms:o,optionalAttributes:{zoomRange:!0}}),marker:l(e.marker,{uniforms:o,optionalAttributes:{zoomRange:!0}}),line:l(e.line,{uniforms:o,optionalAttributes:{zoomRange:!0}}),text:l(e.text,{uniforms:o,optionalAttributes:{zoomRange:!0,referenceSymbol:!1,clipAngle:!1,visibility:!1}}),outlineFill:l(e.outlineFill,{uniforms:o,optionalAttributes:{zoomRange:!0}}),complexFill:l(e.complexFill,{uniforms:o,optionalAttributes:{zoomRange:!0}}),gradientFill:l(e.gradientFill,{uniforms:o,optionalAttributes:{zoomRange:!0}}),texturedLine:l(e.texturedLine,{uniforms:o,optionalAttributes:{zoomRange:!0}}),gradientStroke:l(e.gradientStroke,{uniforms:o,optionalAttributes:{zoomRange:!0}}),animatedMarker:l(e.animatedMarker,{uniforms:o,optionalAttributes:{zoomRange:!0}})},this._instancesById=Object.values(this.instances).reduce(((i,e)=>(i.set(e.instanceId,e),i)),new Map)}getInstance(i){return this._instancesById.get(i)}}export{a as GraphicInstanceStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as n,sub as a,normalize as l,add as h,scale as c}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as u,convertToGeometry as f}from"../../../../../../../layers/graphics/featureConversionUtils.js";import g from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{getXAnchorDirection as p,getYAnchorDirection as _}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as x}from"../../../definitions.js";import{getDisplayIdTexel as M}from"../../../DisplayId.js";import b from"../../../collisions/BoundingBox.js";import{LabelMetric as y}from"../../../collisions/LabelMetric.js";import{smoothPaths as v,pathDivide as P}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as w,processColorInput as L}from"../fill/meshWriterUtils.js";import{TextMeshWriter as B,maxLabelZoom as S}from"../text/TextMeshWriter.js";const z=1,A=0,D=128,I=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class G extends B{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();this._writePoint(e,i,s,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;this._writePoint(e,s,r,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,s){const r=M(e),[o,n]=this._getMetricDir(),a=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0;return new y(r,t,i,o,n,a,l,s??null)}_writePoint(e,t,i,s){const r=this._getShaping();if(!r)return;const o=s.getDisplayId(),n=p(this.evaluatedMeshParams.horizontalAlignment),a=_(this.evaluatedMeshParams.verticalAlignment),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=M(s.getDisplayId()),m=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new y(c,t,i,n,a,l,h,m)),this._writeGlyphs(e,o,t,i,r,0,m),e.metricBoxWrite(r.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:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<z);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:w(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=r.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new g;u(a,n,!1,!1,"esriGeometryPolyline",1);const l=j(new g,a,o),h=j(new g,a,-o),c=f(h,"esriGeometryPolyline",!1,!1),m=f(l,"esriGeometryPolyline",!1,!1),d=v(m.paths,r.bounds.width),p=v(c.paths,r.bounds.width);this._current.offsetDirection="above";for(const u of d)P(u,i,t,!!s);this._current.offsetDirection="below";for(const u of p)P(u,i,t,!!s)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=v(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)P(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=I(t),h=this._current.shaping.bounds.width/(1<<z),c=Math.sqrt(n||D)/(1<<z),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?S:Math.log2(m/(c+h/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+z-u),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e;i.metricStart(this._createLineLabelMetric(s,n,a)),i.metricBoxWrite(r.boundsT);const l=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:t}),this._writeGlyphs(i,s,n,a,r,0,o,{clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t}),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current;s.metricStart(this._createLineLabelMetric(r,e.x,e.y));const o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:h,referenceBounds:c}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,p=(e.angle*(180/Math.PI)+180)%360,_=l.glyphs.length>0&&!(!d&&!u);if(n.metricStart(this._createLineLabelMetric(a,e.x,e.y)),_){const d=Math.max(o,h[0],0),u=Math.min(S,h[1]),f=i(r(),-e.angle),_={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},x=t(this.evaluatedMeshParams.offsetX),M=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=m(x,-1*M),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,c,_),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=m(x,M),[i,o]=l.shapeBackground(s(r(),f,t));_.clipAngle=p,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding);const h=2*Math.max(i.width,i.height);n.recordBounds(e.x+i.x,e.y+i.y,h,h),this._writeTextBox(n,a,e.x,e.y,o,c,_),n.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,p,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+A;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+A}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+A;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+A}_placeFirst(e,s,n,a,l=!1){const{out:h,id:c,shaping:d,zoomRange:u,referenceBounds:f}=this._current,g=d.glyphs,p=t(this.evaluatedMeshParams.offsetX),_=t(this.evaluatedMeshParams.offsetY),x=m(p,_),M=i(r(),-e.angle);o(x,x,M);for(const t of g){const i=t.x>d.bounds.x?n:1-n,r=i*e.remainingLength+(1-i)*e.backwardLength,o=Math.abs(t.x+t.width/2-d.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(o/(r+A))),g=Math.max(s,l?0:m);if(t.maxZoom=Math.min(u[1],S),t.angle=e.angle+(1-n)*Math.PI,t.minZoom=Math.max(u[0],g),this._writeLineGlyph(h,c,e.x,e.y,d.bounds,t,a,f,!0),(n||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new b(t.bounds.x+x[0],t.bounds.y+x[1],t.bounds.width,t.bounds.height);h.metricBoxWrite(e)}}}_placeOnSegment(e,s,n,a,l,h,c){const{out:d,id:u,shaping:f,referenceBounds:g}=this._current,p=f.glyphs,_=e.dx/e.length,x=e.dy/e.length,M={x:e.x+n*-l*_,y:e.y+n*-l*x},y=t(this.evaluatedMeshParams.offsetX),v=t(this.evaluatedMeshParams.offsetY),P=m(y,v),w=i(r(),-e.angle);o(P,P,w);for(const t of p){const i=t.x>f.bounds.x?h:1-h;if(!(i&&1===l||!i&&-1===l))continue;const s=Math.abs(t.x+t.width/2-f.bounds.x),r=Math.max(0,this._zoomLevel+Math.log2(s/n)-.1),o=Math.max(a,this._zoomLevel+Math.log2(s/(n+e.length+A)));if(0!==r&&(t.angle=e.angle+(1-h)*Math.PI,t.minZoom=o,t.maxZoom=r,this._writeLineGlyph(d,u,M.x,M.y,f.bounds,t,c,g,!0),(h||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new b(t.bounds.x+P[0],t.bounds.y+P[1],t.bounds.width,t.bounds.height);d.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,s,r,o,n,a,l){const h=i+r.x,c=s+r.y,m=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),d=Math.max(r.width,r.height)*m;e.recordStart(this.instanceId,this.attributeLayout,o.textureBinding),e.recordBounds(h,c,d,d);const{texcoords:u,offsets:f}=o,{fontSize:g,haloSize:p,outlineSize:_}=this._textMeshTransformProps;this._writeQuad(e,t,i,s,{texcoords:u,offsets:f,fontSize:g,haloSize:p,outlineSize:_,color:L(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o.minZoom),maxZoom:Math.min(this._current.zoomRange[1],o.maxZoom),clipAngle:n,mapAligned:l,isLineLabel:!0}),e.recordEnd()}_isVisible(e,t){const i=Math.floor(this._zoomLevel*x)/x;return e<=i&&i<=t}}function j(e,t,i){const{coords:s,lengths:r}=t,o=d(),m=d(),u=d(),f=d(),g=d(),p=d(),_=2;let x=0;for(let d=0;d<r.length;d++){const t=r[d];for(let r=0;r<t;r++){const d=_*(r+x-1),M=_*(r+x),b=_*(r+x+1);r>0?n(o,s[d],s[d+1]):n(o,0,0),n(m,s[M],s[M+1]),r<t-1?n(u,s[b],s[b+1]):n(u,0,0),0===r?n(f,0,0):(a(f,m,o),l(f,f),n(f,f[1],-f[0])),r===t-1?n(g,0,0):(a(g,u,m),l(g,g),n(g,g[1],-g[0])),h(p,f,g),l(p,p);const y=p[0]*g[0]+p[1]*g[1];0!==y&&c(p,p,y),c(p,p,i),e.coords.push(m[0]+p[0],m[1]+p[1])}e.lengths.push(t),x+=t}return e}export{G as LabelMeshWriter};
|
|
5
|
+
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{fromRotation as i,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as r}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as n,sub as a,normalize as l,add as c,scale as h}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{generalizeOptimizedGeometry as u,convertToGeometry as f}from"../../../../../../../layers/graphics/featureConversionUtils.js";import g from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as p,minMaxZoomPrecisionFactor as _}from"../../../definitions.js";import{getDisplayIdTexel as b}from"../../../DisplayId.js";import M from"../../../collisions/BoundingBox.js";import{LabelMetric as x}from"../../../collisions/LabelMetric.js";import{smoothPaths as v,pathDivide as y}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as P,processColorInput as w}from"../fill/meshWriterUtils.js";import{TextMeshWriter as L,maxLabelZoom as B}from"../text/TextMeshWriter.js";const S=1,z=0,D=128,I=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class A extends L{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();this._writePoint(e,i,s,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,r]=i.coords;this._writePoint(e,s,r,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,s){const r=b(e),[o,n]=this._getMetricDir(),a=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0,c=this.evaluatedMeshParams.labelClassId;return new x(r,c,t,i,o,n,a,l,s??null)}_writePoint(e,t,i,s){if(t<0||t>p||i<0||i>p)return;const r=this._getShaping();if(!r)return;const o=s.getDisplayId(),n=this.evaluatedMeshParams.labelClassId,[a,l]=this._getMetricDir(),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,h=this.evaluatedMeshParams.scaleInfo?.minScale??0,m=b(s.getDisplayId()),d=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new x(m,n,t,i,a,l,c,h,d)),this._writeGlyphs(e,o,t,i,r,0,d,void 0,!1),e.metricBoxWrite(r.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:s}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,s)=>this._placeSubdivGlyphs(e,t,i,s),a=(o.bounds.width+r)/(1<<S);this._current={out:e,id:t.getDisplayId(),shaping:o,zoomRange:P(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null},this._verticalPlacement="bottom"===s?"above":"top"===s?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=r.bounds.halfHeight,n=e.readGeometryForDisplay();if(!n)return;const a=new g;u(a,n,!1,!1,"esriGeometryPolyline",1);const l=G(new g,a,o),c=G(new g,a,-o),h=f(c,"esriGeometryPolyline",!1,!1),m=f(l,"esriGeometryPolyline",!1,!1),d=v(m.paths,r.bounds.width),p=v(h.paths,r.bounds.width);this._current.offsetDirection="above";for(const u of d)y(u,i,t,!!s);this._current.offsetDirection="below";for(const u of p)y(u,i,t,!!s)}_writeCenterAlong(e,t,i){const{repeatLabel:s}=this.evaluatedMeshParams,{shaping:r}=this._current,o=v(e.readLegacyGeometryForDisplay().paths,r.bounds.width);for(const n of o)y(n,i,t,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:r,labelPosition:o,repeatLabelDistance:n}=this.evaluatedMeshParams,a=this._current.zoomRange[0],l=I(t),c=this._current.shaping.bounds.width/(1<<S),h=Math.sqrt(n||D)/(1<<S),m=Math.min(i,s-i),d=this._current.shaping.isMultiline?B:Math.log2(m/(h+c/2)),u=0===t?d:Math.min(l,d),f=Math.max(a,this._zoomLevel+S-u),g=this._zoomLevel-f,p=this._current.shaping.bounds.width/2*2**g;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,f):r&&g<0?this._placeStraightAlong(e,a):"parallel"===o?this._placeStraightAlong(e,f):"curved"===o&&this._placeCurved(e,f,p)}_placeStraight(e,t){const{out:i,id:s,shaping:r,referenceBounds:o}=this._current,{x:n,y:a}=e;i.metricStart(this._createLineLabelMetric(s,n,a)),i.metricBoxWrite(r.boundsT);const l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360,h={clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,s,n,a,r,0,o,h,!1);const m={clipAngle:c,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,s,n,a,r,0,o,m,!1),i.metricEnd()}_placeCurved(e,t,i){const{out:s,id:r}=this._current;s.metricStart(this._createLineLabelMetric(r,e.x,e.y));const o=e.clone(),n=e.angle*(180/Math.PI)%360,a=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(o,t,1,n),this._placeBack(e,o,t,i,1,n),this._placeForward(e,o,t,i,1,n)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(o,t,0,a),this._placeBack(e,o,t,i,0,a),this._placeForward(e,o,t,i,0,a)),s.metricEnd()}_placeStraightAlong(e,o){const{out:n,id:a,shaping:l,zoomRange:c,referenceBounds:h}=this._current,{boxBorderLineColor:d,boxBackgroundColor:u}=this.evaluatedMeshParams,f=e.clone(),g=e.angle*(180/Math.PI)%360,p=(e.angle*(180/Math.PI)+180)%360,_=l.glyphs.length>0&&!(!d&&!u);if(n.metricStart(this._createLineLabelMetric(a,e.x,e.y)),_){const d=Math.max(o,c[0],0),u=Math.min(B,c[1]),f=i(r(),-e.angle),_={minZoom:d,maxZoom:u,clipAngle:g,mapAligned:!0,isLineLabel:!0},b=t(this.evaluatedMeshParams.offsetX),M=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=m(b,-1*M),[i,o]=l.shapeBackground(s(r(),f,t));n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding),this._writeTextBox(n,a,e.x,e.y,o,h,_),n.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=m(b,M),[i,o]=l.shapeBackground(s(r(),f,t));_.clipAngle=p,n.recordStart(this.instanceId,this.attributeLayout,l.glyphs[0].textureBinding),this._writeTextBox(n,a,e.x,e.y,o,h,_),n.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(f,o,1,g,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(f,o,0,p,!0),n.metricEnd()}_placeBack(e,t,i,s,r,o){const n=e.clone();let a=e.backwardLength+z;for(;n.prev()&&!(a>=s);)this._placeOnSegment(n,t,a,i,-1,r,o),a+=n.length+z}_placeForward(e,t,i,s,r,o){const n=e.clone();let a=e.remainingLength+z;for(;n.next()&&!(a>=s);)this._placeOnSegment(n,t,a,i,1,r,o),a+=n.length+z}_placeFirst(e,s,n,a,l=!1){const{out:c,id:h,shaping:d,zoomRange:u,referenceBounds:f}=this._current,g=d.glyphs,p=t(this.evaluatedMeshParams.offsetX),_=t(this.evaluatedMeshParams.offsetY),b=m(p,_),x=i(r(),-e.angle);o(b,b,x);for(const t of g){const i=t.x>d.bounds.x?n:1-n,r=i*e.remainingLength+(1-i)*e.backwardLength,o=Math.abs(t.x+t.width/2-d.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(o/(r+z))),g=Math.max(s,l?0:m);if(t.maxZoom=Math.min(u[1],B),t.angle=e.angle+(1-n)*Math.PI,t.minZoom=Math.max(u[0],g),this._writeLineGlyph(c,h,e.x,e.y,t,a,f,!0),(n||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom)){const e=new M(t.bounds.x+b[0],t.bounds.y+b[1],t.bounds.width,t.bounds.height);c.metricBoxWrite(e)}}}_placeOnSegment(e,s,n,a,l,c,h){const{out:d,id:u,shaping:f,referenceBounds:g}=this._current,p=f.glyphs,_=e.dx/e.length,b=e.dy/e.length,x={x:e.x+n*-l*_,y:e.y+n*-l*b},v=t(this.evaluatedMeshParams.offsetX),y=t(this.evaluatedMeshParams.offsetY),P=m(v,y),w=i(r(),-e.angle);o(P,P,w);for(const t of p){const i=t.x>f.bounds.x?c:1-c;if(!(i&&1===l||!i&&-1===l))continue;const s=Math.abs(t.x+t.width/2-f.bounds.x),r=Math.max(0,this._zoomLevel+Math.log2(s/n)-.1),o=Math.max(a,this._zoomLevel+Math.log2(s/(n+e.length+z)));if(0!==r&&(t.angle=e.angle+(1-c)*Math.PI,t.minZoom=o,t.maxZoom=r,this._writeLineGlyph(d,u,x.x,x.y,t,h,g,!0),(c||this._current.offsetDirection)&&this._isVisible(t.minZoom,t.maxZoom))){const e=new M(t.bounds.x+P[0],t.bounds.y+P[1],t.bounds.width,t.bounds.height);d.metricBoxWrite(e)}}}_writeLineGlyph(e,t,i,s,r,o,n,a){if(i<0||i>p||s<0||s>p)return;e.recordStart(this.instanceId,this.attributeLayout,r.textureBinding);const{texcoords:l,offsets:c}=r,{fontSize:h,haloSize:m,outlineSize:d}=this._textMeshTransformProps;this._writeQuad(e,t,i,s,{texcoords:l,offsets:c,fontSize:h,haloSize:m,outlineSize:d,color:w(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:n,minZoom:Math.max(this._current.zoomRange[0],r.minZoom),maxZoom:Math.min(this._current.zoomRange[1],r.maxZoom),clipAngle:o,mapAligned:a,isLineLabel:!0}),e.recordEnd()}_packedZoom(e){return Math.floor(e*_)/_}_isVisible(e,t){let i=Math.max(this._current.zoomRange[0],e),s=Math.min(this._current.zoomRange[1],t);i=this._packedZoom(i),s=this._packedZoom(s);const r=this._packedZoom(this._zoomLevel);return i<=r&&r<=s}}function G(e,t,i){const{coords:s,lengths:r}=t,o=d(),m=d(),u=d(),f=d(),g=d(),p=d(),_=2;let b=0;for(let d=0;d<r.length;d++){const t=r[d];for(let r=0;r<t;r++){const d=_*(r+b-1),M=_*(r+b),x=_*(r+b+1);r>0?n(o,s[d],s[d+1]):n(o,0,0),n(m,s[M],s[M+1]),r<t-1?n(u,s[x],s[x+1]):n(u,0,0),0===r?n(f,0,0):(a(f,m,o),l(f,f),n(f,f[1],-f[0])),r===t-1?n(g,0,0):(a(g,u,m),l(g,g),n(g,g[1],-g[0])),c(p,f,g),l(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&h(p,p,v),h(p,p,i),e.coords.push(m[0]+p[0],m[1]+p[1])}e.lengths.push(t),b+=t}return e}export{A as LabelMeshWriter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{WGLDrawPhase as e,FeatureSymbologyDrawOrder as t}from"../../../enums.js";import{FeatureTechnique as s}from"../FeatureTechnique.js";import{getSelectionDefines as r,getFeaturePipelineState as a,resolveDynamicUniforms as i,getFeatureUniforms as o,isHittest as n}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{TextShader as m,TextRenderPassType as d}from"../text/TextShader.js";class p extends s{constructor(){super(...arguments),this.type=u.Label,this.shaders={geometry:new m},this.drawPhase=e.LABEL|e.LABEL_ALPHA|e.HITTEST,this.symbologyPlane=t.TEXT}render(e,t){const{context:s,painter:u}=e,m=r(e),p={...a(e)},h=t.instance.getInput(),
|
|
5
|
+
import{WGLDrawPhase as e,FeatureSymbologyDrawOrder as t}from"../../../enums.js";import{FeatureTechnique as s}from"../FeatureTechnique.js";import{getSelectionDefines as r,getFeaturePipelineState as a,resolveDynamicUniforms as i,getFeatureUniforms as o,isHittest as n}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{TextShader as m,TextRenderPassType as d}from"../text/TextShader.js";class p extends s{constructor(){super(...arguments),this.type=u.Label,this.shaders={geometry:new m},this.drawPhase=e.LABEL|e.LABEL_ALPHA|e.HITTEST,this.symbologyPlane=t.TEXT}render(e,t){const{context:s,painter:u}=e,m=r(e),p={...a(e),stencil:!1},h=t.instance.getInput(),c={shader:this.shaders.geometry,uniforms:{...i(e,t.target,h.uniforms),...o(e,t.target),mosaicInfo:u.textureManager.getMosaicInfo(s,t.textureKey)},defines:{...m,textRenderPassType:d.Color,isBackgroundPass:!0,isLabel:!0},optionalAttributes:h.optionalAttributes,useComputeBuffer:n(e)};u.setPipelineState(p),u.setShader(c),u.submitDraw(e,t),u.setShader({...c,defines:{...m,textRenderPassType:d.Halo,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,t),u.setShader({...c,defines:{...m,textRenderPassType:d.Color,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,t)}}export{p as LabelTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../../../core/has.js";import{vertexLayoutHash as t}from"./utils.js";import{DataType as
|
|
5
|
+
import"../../../../../../../core/has.js";import{vertexLayoutHash as t}from"./utils.js";import{DataType as e}from"../../../../../../webgl/enums.js";function s(t){switch(t){case e.BYTE:case e.UNSIGNED_BYTE:return 1;case e.SHORT:case e.UNSIGNED_SHORT:case e.HALF_FLOAT:return 2;case e.FLOAT:case e.INT:case e.UNSIGNED_INT:return 4}}function o(t){const e=[],o=[],n=[];for(const i of t){const t=s(i.type)*i.count;switch(t%2||t%4||4){case 4:e.push(i);continue;case 2:o.push(i);continue;case 1:n.push(i);continue;default:throw new Error("Found unexpected dataType byte count")}}return e.push(...o),e.push(...n),e}class n{static fromVertexSpec(t,e){const{attributes:i,optionalAttributes:r}=t;let a,c,u;const p=[];for(const s in i){if(i[s].otherSource)continue;const t=i[s];"position"===t.pack?a={...t,name:s,offset:0}:"id"===t.pack?c={...t,name:s,offset:4}:"bitset"===s?u={...t,name:s,offset:7}:p.push({...t,name:s})}for(const s in r)if(!0===e[s]){const t=r[s];p.push({...t,name:s})}const h=o(p),f=[];let m=8,b=1;for(const o of h)f.push({...o,offset:m}),m+=s(o.type)*o.count,o.packAlternating&&(b=Math.max(o.packAlternating.count,b));const d=Uint32Array.BYTES_PER_ELEMENT,_=m%d;return new n(a,c,u,f,m+(_?d-_:0),b)}constructor(t,e,s,o,n,i){this.position=t,this.id=e,this.bitset=s,this.standardAttributes=o,this.stride=n,this.packVertexCount=i,o.push(s),this._attributes=[t,e,s,...o]}get attributeLayout(){if(!this._attributeLayout){const e=t(this._attributes),s=this._attributes.map((t=>({name:t.name,count:t.count,offset:t.offset,type:t.type,packPrecisionFactor:t.packPrecisionFactor,normalized:t.normalized??!1})));this._attributeLayout={attributes:s,hash:e,stride:this.stride}}return this._attributeLayout}}export{n as AlignedVertexSpec,o as sortByAlignment};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
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{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as c,magicLabelLineHeight as l,glyphSize as h}from"../../../definitions.js";import{shapeGlyphs as f}from"../../../mesh/templates/shapingUtils.js";import{packBitset as p,processColorInput as m,getMinMaxZoom as d}from"../fill/meshWriterUtils.js";import{getGeometryEngine as u}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as x,bitsetTextIsMapAligned as y}from"../shaders/constants.js";import{TextMeshTransformProps as S}from"./TextParams.js";import{DataType as _}from"../../../../../../webgl/enums.js";const P=28,
|
|
5
|
+
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{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as c,magicLabelLineHeight as l,glyphSize as h}from"../../../definitions.js";import{shapeGlyphs as f}from"../../../mesh/templates/shapingUtils.js";import{packBitset as p,processColorInput as m,getMinMaxZoom as d}from"../fill/meshWriterUtils.js";import{getGeometryEngine as u}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as x,bitsetTextIsMapAligned as y}from"../shaders/constants.js";import{TextMeshTransformProps as S}from"./TextParams.js";import{DataType as _}from"../../../../../../webgl/enums.js";const P=28,b=[4,4],T=[16,4],k={topLeft:T,topRight:T,bottomLeft:T,bottomRight:T},z=[4,2],B=[4,6],R={topLeft:z,topRight:z,bottomLeft:B,bottomRight:B},M={topLeft:z,topRight:B,bottomLeft:z,bottomRight:B},L={topLeft:B,topRight:B,bottomLeft:b,bottomRight:b},w={topLeft:b,topRight:b,bottomLeft:B,bottomRight:B},I={topLeft:B,topRight:b,bottomLeft:B,bottomRight:b},E={topLeft:b,topRight:B,bottomLeft:b,bottomRight:B},G={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:_.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||P]},clipAngle:{type:_.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>N(t||0)},referenceSymbol:{type:_.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{const r=t.isLineLabel||!t.referenceBounds,n=i(r?"center":o.horizontalAlignment),a=s(r?"middle":o.verticalAlignment),{offsetX:c,offsetY:l,size:h}=r?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(c),-e(l),Math.round(e(h)),n+1<<2|a+1]}},visibility:{type:_.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:_.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:_.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:_.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>p([[x,t],[y,!!e]])},offset:{type:_.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},textureUV:{type:_.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},color:{type:_.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:_.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>[Math.round(e(t)),Math.round(e(o??t))]},outlineColor:{type:_.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>m(t)},haloColor:{type:_.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>m(t)},outlineAndHaloSize:{type:_.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class A extends g{constructor(){super(...arguments),this.vertexSpec=G,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new S(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const r=this._getShaping();if(!r)return;const i=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,o);if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,i,o.x,o.y,r,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,i,s,n,r,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex(((e,o)=>this._writeGlyphs(t,i,e,o,r,0)))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,i,s,n,r,0)}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const c=-1,l=r.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,u());if(!l)return;const h=i.getDisplayId();let f=l.next();for(;null!=f;){const e=f.tx,o=-f.ty,r=-f.getAngle();this._writeGlyphs(t,h,e,o,s,r),f=l.next()}}_getShaping(o){const r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!i.glyphs?.glyphs.length)return null;const s=e(r.fontSize),n=e(r.offsetX),p=e(r.offsetY),m=t(e(i.lineWidth),c,a),d=l*t(i.lineHeightRatio,.25,4);return f(i.glyphs,{scale:s/h,angle:r.postAngle,xOffset:n,yOffset:p,horizontalAlignment:i.horizontalAlignment,verticalAlignment:o||i.verticalAlignment,maxLineWidth:m,lineHeight:d,decoration:i.decoration,borderLineSizePx:e(i.boxBorderLineSize),hasBackground:!!i.boxBackgroundColor,useCIMAngleBehavior:i.useCIMAngleBehavior})}_writeGlyphs(t,o,r,i,s,n,a,c,l=!0){const h=this.evaluatedMeshParams,f=this._textMeshTransformProps,p=e(f.fontSize),u=f.haloSize,g=f.outlineSize,x=e(f.offsetX),y=e(f.offsetY),[S,_]=d(h.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const P=s.bounds,b=r+P.x+x,T=i+P.y-y,k=2*(h.minPixelBuffer?h.minPixelBuffer/p:1),z=Math.max(P.width,P.height)*k;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),l&&t.recordBounds(b,T,z,z),this._writeTextBox(t,o,r,i,s.textBox,a,c),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),l&&t.recordBounds(b,T,z,z);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,r,i,{texcoords:s,offsets:n,fontSize:p,haloSize:u,outlineSize:g,color:m(h.color),isBackground:!1,referenceBounds:a,minZoom:S,maxZoom:_,...c}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,r,i,s,n){const a=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:h}=this._textMeshTransformProps,{boxBackgroundColor:f,boxBorderLineColor:p}=a,d={isBackground:!0,fontSize:c,haloSize:l,outlineSize:h,referenceBounds:s,...n};f&&(this._writeQuad(t,e,o,r,{texcoords:k,offsets:i.main,color:m(f),...d}),p||(this._writeQuad(t,e,o,r,{texcoords:L,offsets:i.top,color:m(f),...d}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.bot,color:m(f),...d}),this._writeQuad(t,e,o,r,{texcoords:I,offsets:i.left,color:m(f),...d}),this._writeQuad(t,e,o,r,{texcoords:E,offsets:i.right,color:m(f),...d}))),p&&(this._writeQuad(t,e,o,r,{texcoords:R,offsets:i.top,color:m(p),...d}),this._writeQuad(t,e,o,r,{texcoords:R,offsets:i.bot,color:m(p),...d}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.left,color:m(p),...d}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.right,color:m(p),...d}))}_writeQuad(t,e,o,r,i){const s=t.vertexCount();this._writeVertex(t,e,o,r,i),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 N=t=>Math.round(t*(254/360));export{A as TextMeshWriter,G as TextVertexSpec,P as maxLabelZoom};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{minMaxZoomPrecisionFactor as i,labelPlacementOffsetPadding as o}from"../../../definitions.js";import{location as s,option as l,uniform as a,define as r,ComputeVertexInput as n,input as
|
|
5
|
+
import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{minMaxZoomPrecisionFactor as i,labelPlacementOffsetPadding as o}from"../../../definitions.js";import{location as s,option as l,uniform as a,define as r,ComputeVertexInput as n,input as d}from"../../GraphShaderModule.js";import{abs as p,min as u,Float as y,floor as m,step as c,Vec3 as f,Mat3 as h,Vec2 as v,ifElse as w,equal as x,greaterThan as b,Bool as V,Vec4 as S,texture2D as g,smoothstep as z,Int as R,bitRShift as j,bitAnd as C}from"../../graph/glsl.js";import{FeatureVertexInput as O,FeatureFragmentInput as A,AFeatureShader as M}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as H,sdfFontSize as P,bitsetTextIsMapAligned as L,maxSdfDistance as N}from"../shaders/constants.js";import{distPointTriangle as U,failHittest as T}from"../shaders/hittestUtils.js";import{MosaicInfo as _}from"../shaders/MosaicInfo.js";import{getBit as k}from"../shaders/utils.js";import{VisualVariableColor as I}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as D}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as B}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as q}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as E}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as W}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as G,getVisualVariableRotation as Z}from"../shaders/vvUtils.js";const J=360/254;var K;!function(t){t[t.Color=0]="Color",t[t.Outline=1]="Outline",t[t.Halo=2]="Halo"}(K||(K={}));class Q extends O{}t([s(3,S)],Q.prototype,"color",void 0),t([s(4,v)],Q.prototype,"offset",void 0),t([s(5,v)],Q.prototype,"textureUV",void 0),t([s(6,v)],Q.prototype,"fontAndReferenceSize",void 0),t([s(7,S)],Q.prototype,"outlineColor",void 0),t([s(8,S)],Q.prototype,"haloColor",void 0),t([s(9,v)],Q.prototype,"outlineAndHaloSize",void 0),t([s(10,v)],Q.prototype,"zoomRange",void 0),t([s(11,y)],Q.prototype,"clipAngle",void 0),t([s(12,S)],Q.prototype,"referenceSymbol",void 0),t([s(15,y)],Q.prototype,"visibility",void 0);class X extends n{}t([s(13,v)],X.prototype,"offsetNextVertex1",void 0),t([s(14,v)],X.prototype,"offsetNextVertex2",void 0);class Y extends A{}class $ extends M{constructor(){super(...arguments),this.type="TextShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"]},this.textRenderPassType=K.Color,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(t,e){const{clipAngle:o,zoomRange:s,visibility:l}=t,a=o.multiply(J),r=p(this.view.rotation.subtract(a)),n=u(new y(360).subtract(r),r);let d=new y(0);const f=m(this.view.currentZoom.multiply(i)).divide(i),h=s.x,v=s.y,w=new y(1).subtract(c(h,f)).multiply(2),x=c(new y(90),n).multiply(2),b=new y(2).multiply(new y(1).subtract(c(f,v)));return d=d.add(e.multiply(w)),d=d.add(e.multiply(x)),d=d.add(b),l&&(d=d.add(l)),d}vertex(t,e){const i=k(t.bitset,H),s=new y(1).subtract(i);let l=t.fontAndReferenceSize[0];const a=t.fontAndReferenceSize[1];let r=l.divide(P);const n=this.textRenderPassType===K.Outline?t.outlineColor:this.textRenderPassType===K.Halo?t.haloColor:this._getVertexColor(t),d=this.view.displayViewScreenMat3.multiply(new f(t.pos,1));let p=t.offset,u=new y(1),m=h.identity(),c=new v(0);if(this.isLabel){if(!t.referenceSymbol)throw new Error("InternalError: Optional attribute 'referenceSymbol' expected for labels");const e=t.referenceSymbol,i=e.xy,s=e.z,l=this._unpackDirection(e.w),a=G(this,t.id,s).divide(2),r=l.multiply(a.add(o));c=i.add(r),p=p.add(c)}else{u=G(this,t.id,a).divide(a),l=l.multiply(u),r=r.multiply(u),p=p.multiply(u),m=Z(this,t.id),p=m.multiply(new f(p,0)).xy}const g=k(t.bitset,L),z=this._getViewRotationMatrix(g).multiply(new f(p,0));let R=this.isLabel?this.clipLabel(t,g):this.clip(t.id,t.zoomRange);R=this.isBackgroundPass?R.add(s.multiply(2)):R.add(i.multiply(2));let j=new y(0);if(this.textRenderPassType===K.Outline){R=R.add(w(x(t.outlineAndHaloSize.x,new y(0)),new y(2),new y(0)));j=new y(t.outlineAndHaloSize.x).divide(r).divide(N)}if(this.textRenderPassType===K.Halo){const e=t.outlineAndHaloSize.x,i=new y(t.outlineAndHaloSize.y);R=R.add(w(x(i,new y(0)),new y(2),new y(0)));j=i.add(e).divide(r).divide(N)}const C=this.isLabel?b(R,new y(1)):new V(!1);return{glPosition:new S(d.xy.add(z.xy),R,1),color:n,size:r,textureUV:t.textureUV.divide(this.mosaicInfo.size),antialiasingWidth:new y(.105*P).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:j,...this.maybeRunHittest(t,e,{vvSizeAdjustment:u,vvRotation:m,labelOffset:c,labelClipped:C})}}_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=g(this.mosaicInfo.texture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,a=z(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(a),t)}hittest(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s,labelClipped:l}){let a,r,n;this.isLabel?(a=new f(t.offset.add(s),0),r=new f(e.offsetNextVertex1.add(s),0),n=new f(e.offsetNextVertex2.add(s),0)):(a=o.multiply(new f(t.offset.multiply(i),0)),r=o.multiply(new f(e.offsetNextVertex1.multiply(i),0)),n=o.multiply(new f(e.offsetNextVertex2.multiply(i),0)));const{viewMat3:d,tileMat3:p}=this.view,u=d.multiply(p).multiply(new f(t.pos,1)),y=u.add(p.multiply(a)).xy,m=u.add(p.multiply(r)).xy,c=u.add(p.multiply(n)).xy,h=U(this.hittestRequest.position,y.xy,m.xy,c.xy);return this.isLabel?w(l,T(this.hittestRequest),h):h}_unpackDirection(t){const e=new R(t),i=j(e,new R(2)),o=C(e,new R(3));return new v(new y(i).subtract(1),new y(o).subtract(1))}_getVertexColor(t){let e=t.color;if(this.visualVariableColor){const i=this.storage.getColorValue(t.id);e=this.visualVariableColor.getColor(i,t.color,new V(!1))}if(this.visualVariableOpacity){const i=this.storage.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([l(I)],$.prototype,"visualVariableColor",void 0),t([l(D)],$.prototype,"visualVariableOpacity",void 0),t([l(B)],$.prototype,"visualVariableRotation",void 0),t([l(q)],$.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(E)],$.prototype,"visualVariableSizeScaleStops",void 0),t([l(F)],$.prototype,"visualVariableSizeStops",void 0),t([l(W)],$.prototype,"visualVariableSizeUnitValue",void 0),t([a(_)],$.prototype,"mosaicInfo",void 0),t([r],$.prototype,"textRenderPassType",void 0),t([r],$.prototype,"isBackgroundPass",void 0),t([r],$.prototype,"isLabel",void 0),t([e(0,d(Q)),e(1,d(X))],$.prototype,"vertex",null),t([e(0,d(Y))],$.prototype,"fragment",null);export{Y as TextFragmentInput,K as TextRenderPassType,$ as TextShader,Q as TextVertexInput};
|