@arcgis/core 4.27.0-next.20230320 → 4.27.0-next.20230321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
- package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
- package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
- package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
- package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
- package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
- package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
- package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
- package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
- package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
- package/chunks/ColorMaterial.glsl.js +16 -14
- package/interfaces.d.ts +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/CloudsData.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/interfaces.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/buffer/workerHelper.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Upload.js +5 -0
- package/widgets/Editor/UploadState.js +4 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
- package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
- package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
- package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
- package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
- package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{get as t}from"../../../../core/maybe.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{estimateSize as i}from"../../../../core/typedArrayUtil.js";import{i as a,k as o,w as n,c as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{l as h,o as d,c as m,C as p,a as u,s as y}from"../../../../chunks/vec3.js";import{d as _,O as f,Z as g,f as b,c as P}from"../../../../chunks/vec3f64.js";import{O as x,c as R}from"../../../../chunks/vec4f64.js";import{projectPointToVector as v,computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection.js";import{create as C,size as S,containsPoint as j,center as w}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as U,objectSymbolLayerSizeWithResourceSize as T}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as I}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as O,SampleElevationInfo as G}from"./elevationAlignmentUtils.js";import{ElevationContext as A}from"./ElevationContext.js";import D from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as M}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as F,mixinColorAndOpacity as z,computeObjectScale as V,computeObjectRotation as k}from"./graphicUtils.js";import{ApplyRendererDiffResult as H}from"./interfaces.js";import{LoadStatus as W}from"./Loadable.js";import{makeLodResources as q}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as $,extendPointGraphicElevationContext as Z}from"./pointUtils.js";import{isValidPrimitive as J,primitiveLodResources as K}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as Q}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as X,updateFastSymbolUpdatesState as Y,ConvertOptions as ee,evaluateModelTransform as te,evaluateModelTransformScale as se}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as re}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ie}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ae}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as oe,texturesFromLodResources as ne,geometriesFromLodResources as le,geometriesFromLodLevelResources as ce}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";class de{constructor(e,t,s,r,i,a,o,n,l,c,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=l,this.extentPadding=c,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class me extends M{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(F(this.symbolLayer))throw new Error}const t=this.symbolLayer.resource;if(this._isPrimitive){const s=t&&J(t.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return null!=this._resources?this._resources.lodRenderer:null}_setMaterialTransparencyParams(e,s=t(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(s),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?re.None:re.Back,e}async _createResourcesForPrimitive(t,s){const i=this.symbolLayer,a=C(U(t)),o=_(S(a)),n=_(T(o,i)),l=h(n),c=!1,d=!1,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},p=!!m.usePBR;this._setMaterialTransparencyParams(m);const u=this.symbol;if("point-3d"===u.type&&u.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=u.verticalOffset;m.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},m.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=x;else{const t=null!=i.material?i.material.color:null,s=null!=t?e.toUnitRGBA(t):x;m.externalColor=s}this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(a,n,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const y=new he(m),g=K(t,y);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const b=oe(g).map((e=>({opacity:1,transparent:e.parameters.transparent}))),P=await this._createStageResources(g,p,s),R=await this._createLodRenderer(g,s);return new de(g,R,P,b,o,c,d,a,n,l,p,null)}async _createResourcesForUrl(e,s){const i={materialParamsMixin:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParamsMixin,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(i.materialParamsMixin.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=a.verticalOffset;i.materialParamsMixin.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},i.materialParamsMixin.castShadows=!1}i.signal=s,i.usePBR=this._context.physicalBasedRenderingEnabled,i.skipHighLods=this._context.skipHighSymbolLods;const o=i.usePBR,n=await N(e,i),l=n.isEsriSymbolResource,c=n.isWosr,d=q(n.lods);d.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius));const m=this._context,p=this.symbolLayer.material,u=this._getExternalColorParameters(p),y=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacity(y,{hasIntrinsicColor:!0}),g=this.needsDrivenTransparentPass,b=oe(d),P=oe(d).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));b.forEach((e=>{const t=e.parameters;e.setParameters(u);const s=t.opacity*f,r=s<1||g||t.transparent;e.setParameters({opacity:s,transparent:r}),m.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:m.sharedResources.screenSizePerspectiveSettings})}));const x=n.referenceBoundingBox,R=_(S(x)),v=_(d.levels[0].pivotOffset),L=_(T(R,this.symbolLayer)),C=h(L),j=this._fastUpdates;Y(j,this._context.renderer,this._fastVisualVariableConvertOptions(x,L,R,v))&&b.forEach((e=>e.setParameters(j.materialParameters)));const w=await this._createStageResources(d,o,s),E=await this._createLodRenderer(d,s);return new de(d,E,w,P,R,l,c,x,L,C,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,r){const i=this._context.stage,a=oe(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const o=ne(e);i.addMany(o),this._addDisposeResource((()=>i.removeMany(o))),await i.load(o,r),s(r);const n=le(e);return i.addMany(n),this._addDisposeResource((()=>i.removeMany(n))),{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),l(s,te(i.materialParameters,_e,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,_e),se(e,i.materialParameters,_e)}}:null,o=new ae({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:a},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o.slots,o,t),o}_getExternalColorParameters(t){const s={};return this._drivenProperties.color?s.externalColor=x:null!=t&&null!=t.color?s.externalColor=e.toUnitRGBA(t.color):(s.externalColor=x,s.colorMixMode="ignore"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=$(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new A),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._drivenProperties.opacity,s=!this._isPrimitive,r=this._resources.stageResources.materials,i=this._resources.originalMaterialParameters;for(let a=0;a<r.length;a++){const o=r[a],n=t(this.symbolLayer,"material","color"),l=i[a],c=this._getCombinedOpacity(n,{hasIntrinsicColor:s})*l.opacity,h=c<1||e||l.transparent;o.setParameters({opacity:c,transparent:h}),this._isPrimitive&&o.setParameters({cullFace:h?re.None:re.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return H.Recreate_Symbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return H.Recreate_Symbol;if(!Y(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return H.Recreate_Symbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return H.Fast_Update}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=ce(e.levels[0]).reduce(((e,t)=>e+t.indices.get(ie.POSITION).length),0)/3,s=e=>Array.from(e.vertexAttributes.values()).reduce(((e,t)=>e+i(t.data)),0)+Array.from(e.indices.values()).reduce(((e,t)=>e+i(t)),0),r=ne(e).reduce(((e,t)=>e+(t.params.encoding&&"image/ktx2"===t.params.encoding?t.estimatedTexMemRequired:t.estimatedTexMemRequired/4)),0)+le(e).reduce(((e,t)=>e+s(t)),0);return{primitivesPerFeature:t,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:{...Q(this.symbol,this.symbolLayer),resourceBytes:r}}}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i,a){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),n=null==this._fastUpdates&&this._hasPerInstanceColor()?z(s.color,s.opacity):null,l=this._context.clippingExtent;if(v(t,pe,this._context.elevationProvider.spatialReference),null!=l&&!j(l,pe))return null;const c=this._requiresTerrainElevation(r),h=this._computeGlobalTransform(t,r,ye,fe),d=this._computeLocalTransform(this._resources,this.symbolLayer,s,ue),m=this._resources.lodRenderer.instanceData,p=m.addInstance();this._instanceIndexToGraphicUid.set(p,i),m.setLocalTransform(p,d,!1),m.setGlobalTransform(p,h),o&&m.setFeatureAttribute(p,o),n&&m.setColor(p,n),null!=this._context.stage.renderView.objectAndLayerIdRenderHelper&&m.setObjectAndLayerIdColor(p,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:i,layerUid:a}));const u=new D(this,p,I,r);return c&&(u.alignedSampledElevation=fe.sampledElevation),u.needsElevationUpdates=B(r.mode),Z(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return O(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),pe[0]=e.x,pe[1]=e.y,pe[2]=r.z,L(e.spatialReference,pe,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return a(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=V(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||o(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&$(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,ye,fe),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=fe.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,ye,!0),Z(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===W.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=_(T(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(m,d,t,ue),r=e.instanceIndex;m.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):x;delete r.color;const o=this._resources;null!=o&&t.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(e.instanceIndex,a),t=this._setMaterialTransparencyParams({},i)):t=this._setMaterialTransparencyParams({externalColor:a},i);for(const s of o.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return k(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,t,s){const r=P();switch(s.anchor){case"center":m(r,w(e)),d(r,r);break;case"top":{const t=w(e);y(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=w(e);y(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=w(e),i=S(e),a=s.anchorPosition,o=a?b(a.x,a.y,a.z):g;p(r,i,o),u(r,r,t),d(r,r);break}default:null!=t?d(r,t):m(r,g)}return r}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&n(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?_(S(e)):f,a=null!=e?this._computeAnchor(e,r,this.symbolLayer):g,o=this._context.renderCoordsHelper.unitInMeters,n=V(null!=t?t:void 0,t,s,o),l=b(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ee(i,t??f,o,a,n,l)}}const pe=P(),ue=c(),ye=c(),_e=R(),fe=new G;export{me as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{get as t}from"../../../../core/maybe.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{estimateSize as i}from"../../../../core/typedArrayUtil.js";import{i as a,k as o,w as n,c as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{l as h,o as d,c as m,C as p,a as u,s as y}from"../../../../chunks/vec3.js";import{d as _,O as f,Z as g,f as b,c as P}from"../../../../chunks/vec3f64.js";import{O as x,c as R}from"../../../../chunks/vec4f64.js";import{projectPointToVector as v,computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection.js";import{create as C,size as S,containsPoint as j,center as w}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as U,objectSymbolLayerSizeWithResourceSize as T}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as I}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as O,SampleElevationInfo as G}from"./elevationAlignmentUtils.js";import{ElevationContext as A}from"./ElevationContext.js";import D from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as M}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,mixinColorAndOpacity as F,computeObjectScale as V,computeObjectRotation as k}from"./graphicUtils.js";import{ApplyRendererDiffResult as H}from"./interfaces.js";import{LoadStatus as W}from"./Loadable.js";import{makeLodResources as q}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as $,extendPointGraphicElevationContext as Z}from"./pointUtils.js";import{isValidPrimitive as J,primitiveLodResources as K}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as Q}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as X,updateFastSymbolUpdatesState as Y,ConvertOptions as ee,evaluateModelTransform as te,evaluateModelTransformScale as se}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as re}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ie}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ae}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as oe,texturesFromLodResources as ne,geometriesFromLodResources as le,geometriesFromLodLevelResources as ce}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";class de{constructor(e,t,s,r,i,a,o,n,l,c,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=l,this.extentPadding=c,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class me extends M{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(z(this.symbolLayer))throw new Error}const t=this.symbolLayer.resource;if(this._isPrimitive){const s=t&&J(t.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return null!=this._resources?this._resources.lodRenderer:null}_setMaterialTransparencyParams(e,s=t(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(s),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?re.None:re.Back,e}async _createResourcesForPrimitive(t,s){const i=this.symbolLayer,a=C(U(t)),o=_(S(a)),n=_(T(o,i)),l=h(n),c=!1,d=!1,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},p=!!m.usePBR;this._setMaterialTransparencyParams(m);const u=this.symbol;if("point-3d"===u.type&&u.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=u.verticalOffset;m.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},m.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=x;else{const t=null!=i.material?i.material.color:null,s=null!=t?e.toUnitRGBA(t):x;m.externalColor=s}this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(a,n,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const y=new he(m),g=K(t,y);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const b=oe(g).map((e=>({opacity:1,transparent:e.parameters.transparent}))),P=await this._createStageResources(g,p,s),R=await this._createLodRenderer(g,s);return new de(g,R,P,b,o,c,d,a,n,l,p,null)}async _createResourcesForUrl(e,s){const i={materialParamsMixin:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParamsMixin,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(i.materialParamsMixin.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=a.verticalOffset;i.materialParamsMixin.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},i.materialParamsMixin.castShadows=!1}i.signal=s,i.usePBR=this._context.physicalBasedRenderingEnabled,i.skipHighLods=this._context.skipHighSymbolLods;const o=i.usePBR,n=await N(e,i),l=n.isEsriSymbolResource,c=n.isWosr,d=q(n.lods);d.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius));const m=this._context,p=this.symbolLayer.material,u=this._getExternalColorParameters(p),y=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacity(y,{hasIntrinsicColor:!0}),g=this.needsDrivenTransparentPass,b=oe(d),P=oe(d).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));b.forEach((e=>{const t=e.parameters;e.setParameters(u);const s=t.opacity*f,r=s<1||g||t.transparent;e.setParameters({opacity:s,transparent:r}),m.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:m.sharedResources.screenSizePerspectiveSettings})}));const x=n.referenceBoundingBox,R=_(S(x)),v=_(d.levels[0].pivotOffset),L=_(T(R,this.symbolLayer)),C=h(L),j=this._fastUpdates;Y(j,this._context.renderer,this._fastVisualVariableConvertOptions(x,L,R,v))&&b.forEach((e=>e.setParameters(j.materialParameters)));const w=await this._createStageResources(d,o,s),E=await this._createLodRenderer(d,s);return new de(d,E,w,P,R,l,c,x,L,C,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,r){const i=this._context.stage,a=oe(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const o=ne(e);i.addMany(o),this._addDisposeResource((()=>i.removeMany(o))),await i.load(o,r),s(r);const n=le(e);return i.addMany(n),this._addDisposeResource((()=>i.removeMany(n))),{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),l(s,te(i.materialParameters,_e,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,_e),se(e,i.materialParameters,_e)}}:null,o=new ae({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:a},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o.slots,o,t),o}_getExternalColorParameters(t){const s={};return this._drivenProperties.color?s.externalColor=x:null!=t&&null!=t.color?s.externalColor=e.toUnitRGBA(t.color):(s.externalColor=x,s.colorMixMode="ignore"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=$(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new A),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._drivenProperties.opacity,s=!this._isPrimitive,r=this._resources.stageResources.materials,i=this._resources.originalMaterialParameters;for(let a=0;a<r.length;a++){const o=r[a],n=t(this.symbolLayer,"material","color"),l=i[a],c=this._getCombinedOpacity(n,{hasIntrinsicColor:s})*l.opacity,h=c<1||e||l.transparent;o.setParameters({opacity:c,transparent:h}),this._isPrimitive&&o.setParameters({cullFace:h?re.None:re.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return H.RecreateSymbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return H.RecreateSymbol;if(!Y(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return H.RecreateSymbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return H.FastUpdate}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=ce(e.levels[0]).reduce(((e,t)=>e+t.indices.get(ie.POSITION).length),0)/3,s=e=>Array.from(e.vertexAttributes.values()).reduce(((e,t)=>e+i(t.data)),0)+Array.from(e.indices.values()).reduce(((e,t)=>e+i(t)),0),r=ne(e).reduce(((e,t)=>e+(t.params.encoding&&"image/ktx2"===t.params.encoding?t.estimatedTexMemRequired:t.estimatedTexMemRequired/4)),0)+le(e).reduce(((e,t)=>e+s(t)),0);return{primitivesPerFeature:t,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:{...Q(this.symbol,this.symbolLayer),resourceBytes:r}}}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i,a){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),n=null==this._fastUpdates&&this._hasPerInstanceColor()?F(s.color,s.opacity):null,l=this._context.clippingExtent;if(v(t,pe,this._context.elevationProvider.spatialReference),null!=l&&!j(l,pe))return null;const c=this._requiresTerrainElevation(r),h=this._computeGlobalTransform(t,r,ye,fe),d=this._computeLocalTransform(this._resources,this.symbolLayer,s,ue),m=this._resources.lodRenderer.instanceData,p=m.addInstance();this._instanceIndexToGraphicUid.set(p,i),m.setLocalTransform(p,d,!1),m.setGlobalTransform(p,h),o&&m.setFeatureAttribute(p,o),n&&m.setColor(p,n),null!=this._context.stage.renderView.objectAndLayerIdRenderHelper&&m.setObjectAndLayerIdColor(p,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:i,layerUid:a}));const u=new D(this,p,I,r);return c&&(u.alignedSampledElevation=fe.sampledElevation),u.needsElevationUpdates=B(r.mode),Z(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return O(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),pe[0]=e.x,pe[1]=e.y,pe[2]=r.z,L(e.spatialReference,pe,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return a(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=V(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||o(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&$(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,ye,fe),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=fe.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,ye,!0),Z(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===W.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=_(T(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(m,d,t,ue),r=e.instanceIndex;m.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):x;delete r.color;const o=this._resources;null!=o&&t.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(e.instanceIndex,a),t=this._setMaterialTransparencyParams({},i)):t=this._setMaterialTransparencyParams({externalColor:a},i);for(const s of o.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return k(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,t,s){const r=P();switch(s.anchor){case"center":m(r,w(e)),d(r,r);break;case"top":{const t=w(e);y(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=w(e);y(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=w(e),i=S(e),a=s.anchorPosition,o=a?b(a.x,a.y,a.z):g;p(r,i,o),u(r,r,t),d(r,r);break}default:null!=t?d(r,t):m(r,g)}return r}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&n(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?_(S(e)):f,a=null!=e?this._computeAnchor(e,r,this.symbolLayer):g,o=this._context.renderCoordsHelper.unitInMeters,n=V(null!=t?t:void 0,t,s,o),l=b(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ee({size:!0,color:!0,rotation:!0,opacity:!1},i,t??f,o,a,n,l)}}const pe=P(),ue=c(),ye=c(),_e=R(),fe=new G;export{me as Graphics3DObjectSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{get as t}from"../../../../core/maybe.js";import{w as i}from"../../../../chunks/mat4.js";import{I as s,c as r}from"../../../../chunks/mat4f64.js";import{s as a,b as o}from"../../../../chunks/vec2.js";import{f as n,b as l}from"../../../../chunks/vec2f64.js";import{s as h}from"../../../../chunks/vec3.js";import{d as c,c as p}from"../../../../chunks/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection.js";import{create as f,empty as d,expandWithBuffer as u,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as _,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as g,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as w}from"./elevationAlignmentUtils.js";import{ElevationContext as x}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as j,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as S,PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as D,getAttributeValue as L}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as U}from"./interfaces.js";import{ConvertOptions as E,initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as k}from"../support/FastSymbolUpdates.js";import{SamplePosition as z}from"../../support/ElevationProvider.js";import{CullFaceOptions as A}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as G}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as O}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as B,TriangulationCapBuilder as q,NoCapBuilder as F}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as H,MiterExtruder as M}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as W,PathGeometry as N,isPathGeometry as T}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Z,StaticPathGeometry as J}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as K}from"../../webgl-engine/lib/pathGeometryUtils.js";import{creatQuadProfile as Q,createCircleProfile as X}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Y}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ee}from"../../webgl-engine/materials/PathMaterial.js";const te=["polyline"];class ie extends D{constructor(e,t,i,s){super(e,t,i,s),this._intrinsicSize=n(1,1),this._upVectorAlignment=W.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const i=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,s=null!=this.symbolLayer.height?this.symbolLayer.height:i;this._vvConvertOptions=new E([1,1,1],[i,1,s],this._context.renderCoordsHelper.unitInMeters),this._vvConvertOptions.supportsOpacity=!0,this._vvConvertOptions.supportsRotation=!1,this._fastUpdates=this._context.renderer?.visualVariables?.length>0?R(this._context.renderer,this._vvConvertOptions):null;const r=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?W.World:W.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=X(j);break;case"quad":this._profile=Q()}let h=[0,0];switch("center"!==r&&(h={left:[.5,0],right:[-.5,0],top:[0,-.5],bottom:[0,.5]}[r],this._profile.translate(h[0],h[1])),this.symbolLayer.join){case"round":this._extruder=new M(0,S);break;case"bevel":this._extruder=new M(0,1);break;case"miter":this._extruder=new M(.8*Math.PI,1);break;default:this._extruder=new H}const p=this.symbolLayer.cap||"butt";switch(p){case"none":this._startCap=new F,this._endCap=new F;break;case"butt":default:this._startCap=new q(this._profile,0),this._endCap=new q(this._profile,0,!0);break;case"square":this._startCap=new q(this._profile,-.5),this._endCap=new q(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new B({profile:this._profile,flip:!1,breakNormals:e,subdivisions:C}),this._endCap=new B({profile:this._profile,flip:!0,breakNormals:e,subdivisions:C});break}}const m=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacityAndColor(m),d=c(f),u=f[3],y=u<1||this.needsDrivenTransparentPass,_={diffuse:d,ambient:d,opacity:u,transparent:y,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:y||"none"===p?A.None:A.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,i,s),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates&&this._fastUpdates.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)};this._material=new ee(e)}else _.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,this._material=new $(_);this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,te,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t,new x),s=e.renderingInfo;return this._createAs3DShape(t,s,i,t.uid)}layerOpacityChanged(){const e=t(this.symbolLayer,"material","color"),i=this._getCombinedOpacity(e),s=i<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:i,transparent:s})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,g)}slicePlaneEnabledChanged(){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return U.Recreate_Symbol;if(!k(this._fastUpdates,t,this._vvConvertOptions))return U.Recreate_Symbol;this._material.setParameters(this._fastUpdates.materialParameters)}return U.Fast_Update}_getVertexData(e){let t=0;const i=e.paths,s=[],r=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of i)t+=c.length;const n=_(3*t);let l,h=0;for(const c of i){s.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||r.equals(a)||m(n,r,0,n,a,0,t)?(null==a||a.equals(o)?l=b(n):(l=_(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:s,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t,a,o){const n=e.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,m=f(),_=this._context.renderCoordsHelper,b=new z(l.vertexDataES);for(const f of l.pathVertexDataInfos){const n=f.numVertices;if(n<2)continue;const g=f.offset;if(null!=this._context.clippingExtent&&(d(m),u(m,l.vertexDataES,g,n),!y(m,this._context.clippingExtent)))continue;const w=new Array,x=g+3*n;for(let e=g;e<x;e+=3){b.offset=e;const t=v(b,this._context.elevationProvider,a,_);h(ne,l.vertexDataRS[e],l.vertexDataRS[e+1],l.vertexDataRS[e+2]),_.setAltitude(ne,t),l.vertexDataRS[e]=ne[0],l.vertexDataRS[e+1]=ne[1],l.vertexDataRS[e+2]=ne[2],w.push(Y(this._upVectorAlignment))}const P=new I(w,l.vertexDataES,l.vertexDataRS,g);se(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new O(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,i=t.size?L(t.size.field,e):0,s=t.color?L(t.color.field,e):0,r=t.opacity?L(t.opacity.field,e):0;S=new Z(j,i,s,r)}else{const e=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const i=t.size;e[0]*=re(i[0],"symbol-value"===i[2]?this.symbolLayer.height||0:i[2],this.symbolLayer.width||0),e[1]*=re(i[2],"symbol-value"===i[0]?this.symbolLayer.width||0:i[0],this.symbolLayer.height||0)}let i;this._drivenProperties.color&&(i=t.color),this._drivenProperties.opacity&&null!=t.opacity&&(i=i?[i[0],i[1],i[2],t.opacity]:[1,1,1,t.opacity]);const s=new J(j);s.bake(e),i&&s.bakeVertexColors(i),S=s}const{vertexAttributes:C,indices:D}=S.createGeometryData(),V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),U=new N(this._material,C,D,S,p,this._stencilWidth,V);U.transformation=i(r(),s,j.path.origin),c.push(U)}if(0===c.length)return null;const w=new G({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),x=new P(this,w,c,null,null,((e,t,i,s,r)=>oe(e,t,s,r,this._upVectorAlignment)),a);return x.alignedSampledElevation=0,x.needsElevationUpdates=g(a.mode),x}}function se(e,t,i){const{origin:s,positions:r}=e;let a=e.offset;switch(t){default:case W.World:for(const t of e.vertices)ne[0]=r[a++]+s[0],ne[1]=r[a++]+s[1],ne[2]=r[a++]+s[2],i.worldUpAtPosition(ne,ne),t.setFrameFromUpVector(ne);break;case W.Path:ne[0]=r[a]+s[0],ne[1]=r[a+1]+s[1],ne[2]=r[a+2]+s[2],i.worldUpAtPosition(ne,ne),K(e,ne)}}function re(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ae(e,t,i,s){let r=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(ne,l[p],l[p+1],l[p+2]),i(ne,le),r+=le.sampledElevation,ne[0]=n[p]+a[0],ne[1]=n[p+1]+a[1],ne[2]=n[p+2]+a[2],s.setAltitude(ne,le.z),n[p]=ne[0]-a[0],n[p+1]=ne[1]-a[1],n[p+2]=ne[2]-a[2];return e.updatePathVertexInformation(),r/o.length}function oe(e,t,i,s,r){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!T(l))continue;const e=l.path,o=e.builder.path;n+=ae(o,t,i,s),r!==W.World&&se(o,r,s),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const ne=p(),le=new w;export{ie as Graphics3DPathSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{get as t}from"../../../../core/maybe.js";import{w as i}from"../../../../chunks/mat4.js";import{I as s,c as r}from"../../../../chunks/mat4f64.js";import{s as a,b as o}from"../../../../chunks/vec2.js";import{f as n,b as l}from"../../../../chunks/vec2f64.js";import{s as h}from"../../../../chunks/vec3.js";import{d as c,c as p}from"../../../../chunks/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection.js";import{create as f,empty as d,expandWithBuffer as u,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as _}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as g,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as w}from"./elevationAlignmentUtils.js";import{ElevationContext as x}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as j,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as S,PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as D}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{isValidSize as L}from"./graphicUtils.js";import{ApplyRendererDiffResult as V}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as E,updateFastSymbolUpdatesState as k,getAttributeValue as R}from"../support/FastSymbolUpdates.js";import{SamplePosition as z}from"../../support/ElevationProvider.js";import{CullFaceOptions as A}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as G}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as B}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as O,TriangulationCapBuilder as q,NoCapBuilder as F}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as H,MiterExtruder as M}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as W,PathGeometry as N,isPathGeometry as T}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Z,StaticPathGeometry as J}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as K}from"../../webgl-engine/lib/pathGeometryUtils.js";import{creatQuadProfile as Q,createCircleProfile as X}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Y}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ee}from"../../webgl-engine/materials/PathMaterial.js";const te=["polyline"];class ie extends C{constructor(e,t,i,s){super(e,t,i,s),this._intrinsicSize=n(1,1),this._upVectorAlignment=W.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const i=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,s=null!=this.symbolLayer.height?this.symbolLayer.height:i;this._vvConvertOptions=new U({size:!0,color:!0,rotation:!1,opacity:!0},[1,1,1],[i,1,s],this._context.renderCoordsHelper.unitInMeters),this._fastUpdates=this._context.renderer?.visualVariables?.length>0?E(this._context.renderer,this._vvConvertOptions):null;const r=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?W.World:W.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=X(j);break;case"quad":this._profile=Q()}let h=[0,0];switch("center"!==r&&(h={left:[.5,0],right:[-.5,0],top:[0,-.5],bottom:[0,.5]}[r],this._profile.translate(h[0],h[1])),this.symbolLayer.join){case"round":this._extruder=new M(0,S);break;case"bevel":this._extruder=new M(0,1);break;case"miter":this._extruder=new M(.8*Math.PI,1);break;default:this._extruder=new H}const p=this.symbolLayer.cap||"butt";switch(p){case"none":this._startCap=new F,this._endCap=new F;break;case"butt":default:this._startCap=new q(this._profile,0),this._endCap=new q(this._profile,0,!0);break;case"square":this._startCap=new q(this._profile,-.5),this._endCap=new q(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new O({profile:this._profile,flip:!1,breakNormals:e,subdivisions:D}),this._endCap=new O({profile:this._profile,flip:!0,breakNormals:e,subdivisions:D});break}}const m=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacityAndColor(m),d=c(f),u=f[3],y=u<1||this.needsDrivenTransparentPass,b={diffuse:d,ambient:d,opacity:u,transparent:y,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:y||"none"===p?A.None:A.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,i,s),!L(this._intrinsicSize[0])||!L(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates&&this._fastUpdates.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={...b,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)};this._material=new ee(e)}else b.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,this._material=new $(b);this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,te,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t,new x),s=e.renderingInfo;return this._createAs3DShape(t,s,i,t.uid)}layerOpacityChanged(){const e=t(this.symbolLayer,"material","color"),i=this._getCombinedOpacity(e),s=i<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:i,transparent:s})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,g)}slicePlaneEnabledChanged(){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return V.RecreateSymbol;if(!k(this._fastUpdates,t,this._vvConvertOptions))return V.RecreateSymbol;this._material.setParameters(this._fastUpdates.materialParameters)}return V.FastUpdate}_getVertexData(e){let t=0;const i=e.paths,s=[],r=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of i)t+=c.length;const n=b(3*t);let l,h=0;for(const c of i){s.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||r.equals(a)||m(n,r,0,n,a,0,t)?(null==a||a.equals(o)?l=_(n):(l=b(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:s,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t,a,o){const n=e.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,m=f(),b=this._context.renderCoordsHelper,_=new z(l.vertexDataES);for(const f of l.pathVertexDataInfos){const n=f.numVertices;if(n<2)continue;const g=f.offset;if(null!=this._context.clippingExtent&&(d(m),u(m,l.vertexDataES,g,n),!y(m,this._context.clippingExtent)))continue;const w=new Array,x=g+3*n;for(let e=g;e<x;e+=3){_.offset=e;const t=v(_,this._context.elevationProvider,a,b);h(ne,l.vertexDataRS[e],l.vertexDataRS[e+1],l.vertexDataRS[e+2]),b.setAltitude(ne,t),l.vertexDataRS[e]=ne[0],l.vertexDataRS[e+1]=ne[1],l.vertexDataRS[e+2]=ne[2],w.push(Y(this._upVectorAlignment))}const P=new I(w,l.vertexDataES,l.vertexDataRS,g);se(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new B(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,i=R(t.size?.field,e)??0,s=R(t.color?.field,e)??0,r=R(t.opacity?.field,e)??0;S=new Z(j,i,s,r)}else{const e=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const i=t.size;e[0]*=re(i[0],"symbol-value"===i[2]?this.symbolLayer.height||0:i[2],this.symbolLayer.width||0),e[1]*=re(i[2],"symbol-value"===i[0]?this.symbolLayer.width||0:i[0],this.symbolLayer.height||0)}let i;this._drivenProperties.color&&(i=t.color),this._drivenProperties.opacity&&null!=t.opacity&&(i=i?[i[0],i[1],i[2],t.opacity]:[1,1,1,t.opacity]);const s=new J(j);s.bake(e),i&&s.bakeVertexColors(i),S=s}const{vertexAttributes:D,indices:C}=S.createGeometryData(),L=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),V=new N(this._material,D,C,S,p,this._stencilWidth,L);V.transformation=i(r(),s,j.path.origin),c.push(V)}if(0===c.length)return null;const w=new G({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),x=new P(this,w,c,null,null,((e,t,i,s,r)=>oe(e,t,s,r,this._upVectorAlignment)),a);return x.alignedSampledElevation=0,x.needsElevationUpdates=g(a.mode),x}}function se(e,t,i){const{origin:s,positions:r}=e;let a=e.offset;switch(t){default:case W.World:for(const t of e.vertices)ne[0]=r[a++]+s[0],ne[1]=r[a++]+s[1],ne[2]=r[a++]+s[2],i.worldUpAtPosition(ne,ne),t.setFrameFromUpVector(ne);break;case W.Path:ne[0]=r[a]+s[0],ne[1]=r[a+1]+s[1],ne[2]=r[a+2]+s[2],i.worldUpAtPosition(ne,ne),K(e,ne)}}function re(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ae(e,t,i,s){let r=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(ne,l[p],l[p+1],l[p+2]),i(ne,le),r+=le.sampledElevation,ne[0]=n[p]+a[0],ne[1]=n[p+1]+a[1],ne[2]=n[p+2]+a[2],s.setAltitude(ne,le.z),n[p]=ne[0]-a[0],n[p+1]=ne[1]-a[1],n[p+2]=ne[2]-a[2];return e.updatePathVertexInformation(),r/o.length}function oe(e,t,i,s,r){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!T(l))continue;const e=l.path,o=e.builder.path;n+=ae(o,t,i,s),r!==W.World&&se(o,r,s),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const ne=p(),le=new w;export{ie as Graphics3DPathSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{get as t}from"../../../../core/maybe.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{create as
|
|
5
|
+
import e from"../../../../Color.js";import{get as t}from"../../../../core/maybe.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{create as o,empty as n,expandWithBuffer as s,intersectsClippingArea as a,expandWithAABB as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as h}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as p,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{ElevationContext as y}from"./ElevationContext.js";import g from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as f}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as x}from"./graphicUtils.js";import{ApplyRendererDiffResult as v}from"./interfaces.js";import{parseCapType as O}from"./lineUtils.js";import{geometryAsPolygon as D,createColorGeometry as C,PolygonCreationDataBase as j}from"./polygonUtils.js";import{ConvertOptions as S,initFastSymbolUpdatesState as A,updateFastSymbolUpdatesState as M,getAttributeValue as P}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as E}from"../support/patternUtils.js";import{createMapSpaceUVCoords as L,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as w}from"../../support/engineContent/line.js";import{geometryToRenderInfo as R,geometryToRenderInfoDraped as I}from"../../support/renderInfoUtils/polygon.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as F}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as z}from"../../webgl-engine/materials/RibbonLineMaterial.js";const H=["polyline","polygon","extent"],W=new S({size:!1,color:!0,rotation:!1,opacity:!1});class N extends b{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){this._fastUpdates=A(this._context.renderer,W)}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(null!=this._material)return;const e=t(this.symbolLayer,"material","color"),i=this._getCombinedOpacityAndColor(e);this._material=U(this.symbolLayer,{color:i,transparent:i[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,hasVertexColors:!0,writeLinearDepth:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._material instanceof T,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(this._outlineMaterial||!this._isValidOutline(e))return;this._hasOutline=!0;const t=t=>{const i=B(e.pattern);return new z({width:t,color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:O(e.patternCap||"butt")})};this._outlineMaterial=t(i(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return null!=e&&null!=e.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new y);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return v.RecreateSymbol;if(!M(this._fastUpdates,t,W))return v.RecreateSymbol;this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return v.FastUpdate}layerOpacityChanged(){if(null!=this._material){const e=this._material.parameters.color,i=t(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(i);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(null!=this._outlineMaterial){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,o=m(N.elevationModeChangeTypes,i,r);if(o!==d.UPDATE)return o;const n=_(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){if(this._material&&this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._outlineMaterial){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=D(e.geometry);if(!r)return null;const o=R(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new q(o,t,this._context.layer.uid,e.uid),s=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=p(4*s,!0),n.boundingRect=c(9*s,!0),L(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._hasOutline&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,r.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const a=new V({geometries:n.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:e.uid}),l=new f(this,a,n.outGeometries,null,null,E,i);return l.alignedSampledElevation=n.renderData.sampledElevation,l.needsElevationUpdates=_(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:o,mapPositions:l,holeIndices:c,index:p,count:d}of i){if(null!=this._context.clippingExtent&&(n(k),s(k,l),!a(k,this._context.clippingExtent)))continue;const i=r(l,c,3);if(0===i.length)continue;const m=this._fastUpdates?.visualVariables.color,_=C({material:this._material,indices:i,mapPositions:l,attributeData:{position:o,color:m?null:t.color,colorFeature:m?P(m.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*p,4*d):null,boundingRect:this._needsUV?h(t.boundingRect,9*p,9*d):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(_)}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{mapPositions:r,position:o}=t[i];if(null!=this._context.clippingExtent&&(n(k),s(k,r),!a(k,this._context.clippingExtent)))continue;const l=w(this._outlineMaterial,{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.objectAndLayerIdColor);e.outGeometries.push(l)}}_createAsOverlay(e,t){const i=D(e.geometry);if(null==i)return null;this._material.renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._outlineMaterial&&(this._outlineMaterial.renderPriority=this._renderPriority);const r=I(i,this._context.overlaySR),o=new J(r,t,this._context.layer.uid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=p(4*s,!0),G(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._hasOutline&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new g(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const i=t.renderData.polygons;for(const{position:o,holeIndices:c,index:h,count:p}of i){const i=n(k);if(s(i,o),!a(i,this._context.clippingExtent))continue;const d=r(o,c,3);if(0===d.length)continue;l(t.outBoundingBox,i);const m=this._fastUpdates?.visualVariables.color,_=C({material:this._material,indices:d,attributeData:{position:o,color:m?null:t.color,colorFeature:m?P(m.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*h,4*p):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new F(_,t))}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(n(k),s(k,r),!a(k,this._context.clippingExtent))continue;l(e.outBoundingBox,k);const o=w(this._outlineMaterial,{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new F(o,e))}}_getOutlineOpacity(){const e=t(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const i=t(this.symbolLayer,"outline","color"),r=this._getOutlineOpacity();return x(null!=i?e.toUnitRGB(i):null,r)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}N.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE};const k=o();class q extends j{constructor(e,t,i,r){super(e,i,r),this.color=t}}class J extends j{constructor(e,t,i,r){super(e,i,r),this.color=t}}export{N as Graphics3DPolygonFillSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{forEach as e}from"../../../../core/asyncUtils.js";import{isSome as t}from"../../../../core/maybe.js";import{onAbortOrThrow as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as a}from"./Graphics3DObject3DGraphicLayer.js";import{make as l}from"./Graphics3DSymbolLayerFactory.js";import{ApplyRendererDiffResult as n}from"./interfaces.js";import{Loadable as i,LoadStatus as y}from"./Loadable.js";import{totalSymbolComplexities as h}from"./symbolComplexity.js";class c extends i{set symbol(e){this._symbol=e,e.symbolLayers.forEach(((t,s)=>{const r=this.symbolLayers[s];null!=r&&(r.symbol=e,r.symbolLayer=t)}))}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(t){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const n=[];for(let e=0;e<a;e++){const r=o.getItemAt(e);if(!1===r.enabled)continue;m.renderPriority=1-(1+e)/a,m.renderPriorityStep=1/a,m.ignoreDrivers=r._ignoreDrivers;const i=l(this.symbol,r,this._context,m),y=s(t,(()=>{this.symbolLayers[e]=null,i.destroy()}));y&&n.push(y),this.symbolLayers[e]=i}if(await e(this.symbolLayers,(async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}})),n.forEach((e=>e.remove())),r(t),this.symbolLayers.length&&!this.symbolLayers.some((e=>!!e)))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some((e=>null!=e&&e.queryForSnapping))}createGraphics3DGraphic(e,t){const s=e.graphic,r=new Array(this.symbolLayers.length);for(let o=0;o<this.symbolLayers.length;o++){const t=this.symbolLayers[o];r[o]=null!=t?t.createGraphics3DGraphic(e):null}const a=this._context.arcade||this._context.featureExpressionInfoContext&&this._context.featureExpressionInfoContext.arcade&&this._context.featureExpressionInfoContext.arcade.modules||null;return new o(s,t||this,r,e.layer,a)}get complexity(){return h(this.symbolLayers.map((e=>null!=e?e.complexity:null)))}globalPropertyChanged(e,t){const s=this.symbolLayers.length;for(let r=0;r<s;r++){const s=this.symbolLayers[r],o=e=>{const t=e.layers[r];return t instanceof a?t:null};if(null!=s&&!s.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus!==y.LOADED?n.
|
|
5
|
+
import{forEach as e}from"../../../../core/asyncUtils.js";import{isSome as t}from"../../../../core/maybe.js";import{onAbortOrThrow as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as a}from"./Graphics3DObject3DGraphicLayer.js";import{make as l}from"./Graphics3DSymbolLayerFactory.js";import{ApplyRendererDiffResult as n}from"./interfaces.js";import{Loadable as i,LoadStatus as y}from"./Loadable.js";import{totalSymbolComplexities as h}from"./symbolComplexity.js";class c extends i{set symbol(e){this._symbol=e,e.symbolLayers.forEach(((t,s)=>{const r=this.symbolLayers[s];null!=r&&(r.symbol=e,r.symbolLayer=t)}))}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(t){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const n=[];for(let e=0;e<a;e++){const r=o.getItemAt(e);if(!1===r.enabled)continue;m.renderPriority=1-(1+e)/a,m.renderPriorityStep=1/a,m.ignoreDrivers=r._ignoreDrivers;const i=l(this.symbol,r,this._context,m),y=s(t,(()=>{this.symbolLayers[e]=null,i.destroy()}));y&&n.push(y),this.symbolLayers[e]=i}if(await e(this.symbolLayers,(async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}})),n.forEach((e=>e.remove())),r(t),this.symbolLayers.length&&!this.symbolLayers.some((e=>!!e)))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some((e=>null!=e&&e.queryForSnapping))}createGraphics3DGraphic(e,t){const s=e.graphic,r=new Array(this.symbolLayers.length);for(let o=0;o<this.symbolLayers.length;o++){const t=this.symbolLayers[o];r[o]=null!=t?t.createGraphics3DGraphic(e):null}const a=this._context.arcade||this._context.featureExpressionInfoContext&&this._context.featureExpressionInfoContext.arcade&&this._context.featureExpressionInfoContext.arcade.modules||null;return new o(s,t||this,r,e.layer,a)}get complexity(){return h(this.symbolLayers.map((e=>null!=e?e.complexity:null)))}globalPropertyChanged(e,t){const s=this.symbolLayers.length;for(let r=0;r<s;r++){const s=this.symbolLayers[r],o=e=>{const t=e.layers[r];return t instanceof a?t:null};if(null!=s&&!s.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus!==y.LOADED?n.RecreateSymbol:this.symbolLayers.reduce(((s,r)=>s!==n.RecreateSymbol&&null!=r?Math.min(s,r.applyRendererDiff(e,t)):s),n.FastUpdate)}prepareSymbolPatch(e){if(this.loadStatus===y.FAILED)return;if("partial"!==e.diff.type)return;const t=e.diff.diff;if(!t.symbolLayers||"partial"!==t.symbolLayers.type)return;const s=t.symbolLayers.diff;this.symbolLayers.forEach(((t,r)=>{if(null==t)return;const o=s[r];if(o){const s={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(s),e.symbolStatePatches.push(...s.symbolLayerStatePatches),s.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push(((e,t)=>{const o=e.layers[r];null!=o&&s.graphics3DGraphicPatches.forEach((e=>e(o,t)))}))}}))}updateGeometry(e,t){for(let s=0;s<this.symbolLayers.length;s++){const r=this.symbolLayers[s];if(null==r)continue;const o=e.layers[s];if(!o||!r.updateGeometry(o,t))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){const s=this.symbolLayers[t];if(null==s)continue;const r=e.layers[t];null!=r&&s.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=0,t=0,s=0;return this.symbolLayers.forEach((r=>{null!=r&&(r.loadStatus===y.LOADING?e++:r.isFastUpdatesEnabled()?s++:t++)})),{loading:e,slow:t,fast:s}}async queryForSnapping(e,s,o,a){const l=this.symbolLayers.filter(t).filter((e=>null!=e.queryForSnapping)).map((t=>t.queryForSnapping(e,s,o,a))),n=await Promise.all(l);return r(a),n.flat()}destroy(){if(this.destroyed)console.error("Graphics3DSymbol.destroy called when already destroyed!");else{super.destroy();for(const e of this.symbolLayers)null!=e&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}}const m={renderPriority:0,renderPriorityStep:1,ignoreDrivers:!1};export{c 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{O as i}from"../../../../chunks/vec3f64.js";import{f as o}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as r}from"./elevationAlignmentUtils.js";import{ElevationContext as n}from"./ElevationContext.js";import{zeroContext as s}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as a}from"./graphicUtils.js";import{ApplyRendererDiffResult as l}from"./interfaces.js";import{Loadable as p}from"./Loadable.js";import{defaultSymbolLayerComplexity as
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{O as i}from"../../../../chunks/vec3f64.js";import{f as o}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as r}from"./elevationAlignmentUtils.js";import{ElevationContext as n}from"./ElevationContext.js";import{zeroContext as s}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as a}from"./graphicUtils.js";import{ApplyRendererDiffResult as l}from"./interfaces.js";import{Loadable as p}from"./Loadable.js";import{defaultSymbolLayerComplexity as d}from"./symbolComplexity.js";import{getAttributeValue as c}from"../support/FastSymbolUpdates.js";const h=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class u extends p{constructor(e,t,i,o){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this._elevationInfoOverride=null,this._ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this.complexity=null,this.logger=h,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=o.renderPriority,this._renderPriorityStep=o.renderPriorityStep,this._elevationContext=new n,this.complexity=this.computeComplexity(),this._ignoreDrivers=o.ignoreDrivers,this._ignoreDrivers||(this._drivenProperties=y(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}_drivenPropertiesChanged(e){if(this._ignoreDrivers)return!1;const t=this._drivenProperties,i=y(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,o){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${o} geometry failed to be created`;let a=null;r?!this._logGeometryValidationWarnings(t,i,o)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (failed to project geometry to view spatial reference)`,a&&h.warnOncePerTick(a)}_logGeometryValidationWarnings(e,t,i){const o=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(h.warnOncePerTick(`${o} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(h.warnOncePerTick(`${o} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return h.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return f}_defaultElevationInfoZ(){return v}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const i=e.geometry,o=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:o.unit,t.mode=this.getGeometryElevationMode(i,o),t.offsetMeters=this._elevationContext.meterUnitOffset??o.offset??0;const r=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;r&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=r?s:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=g){let i=1;return this.draped||(i*=this._getLayerOpacity()),this._drivenProperties.opacity||(null!=e?i*=e.a:t.hasIntrinsicColor||(i=0)),i}_getCombinedOpacityAndColor(t,o=g){const r=this._getCombinedOpacity(t,o);if(this._drivenProperties.color)return a(null,r);const n=null!=t?e.toUnitRGB(t):i;return a(n,r)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,o=this._drivenProperties.opacity?e.opacity:null,r=a(i,o);return null!=t&&(r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=t),r}isFastUpdatesEnabled(){return null!=this._fastUpdates}computeComplexity(){return d(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==r.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,i){let o=r.UPDATE;return e.forEach((e=>{const n=t(e);if(null!=n){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=i(n.elevationContext.mode)}else o=r.RECREATE})),o}applyRendererDiff(e,t){return l.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,i=t.size?c(t.size.field,e):0,r=t.color?c(t.color.field,e):0,n=t.opacity?c(t.opacity.field,e):0;return o(i,r,n,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&h.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function y(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let i=0;i<e.stops.length;i++){const o=e.stops[i].color;o&&(t.opacity=!0,o.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),t}const f={mode:"on-the-ground",offset:0,unit:"meters"},v={mode:"absolute-height",offset:0,unit:"meters"},g={hasIntrinsicColor:!1};export{u as Graphics3DSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ApplyRendererDiffResult as t}from"./interfaces.js";import{Loadable as s}from"./Loadable.js";import{emptySymbolComplexity as r}from"./symbolComplexity.js";class i extends s{constructor(t,s,r){super(s),this.symbol=t,this._convert=r,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const s=await this.symbol.fetchSymbol({signal:t});s.id=this.symbol.id,this.graphics3DSymbol=this._convert(s),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:r}globalPropertyChanged(t,s){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,s)}applyRendererDiff(s,r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(s,r):t.
|
|
5
|
+
import{ApplyRendererDiffResult as t}from"./interfaces.js";import{Loadable as s}from"./Loadable.js";import{emptySymbolComplexity as r}from"./symbolComplexity.js";class i extends s{constructor(t,s,r){super(s),this.symbol=t,this._convert=r,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const s=await this.symbol.fetchSymbol({signal:t});s.id=this.symbol.id,this.graphics3DSymbol=this._convert(s),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:r}globalPropertyChanged(t,s){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,s)}applyRendererDiff(s,r){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(s,r):t.RecreateSymbol}prepareSymbolPatch(t){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(t)}updateGeometry(t,s){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t,s)}onRemoveGraphic(){}getFastUpdateStatus(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getFastUpdateStatus():{loading:1,fast:0,slow:0}}destroy(){null!=this.graphics3DSymbol&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return void 0===this.graphics3DSymbol}}export{i 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var e;!function(e){e[e.
|
|
5
|
+
var e;!function(e){e[e.RecreateSymbol=0]="RecreateSymbol",e[e.RecreateGraphics=1]="RecreateGraphics",e[e.FastUpdate=2]="FastUpdate"}(e||(e={}));export{e as ApplyRendererDiffResult};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import{getZeroIndexArray as t}from"../../../../geometry/support/Indices.js";import{Attribute as e}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as i}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as
|
|
5
|
+
import"../../../../geometry.js";import{getZeroIndexArray as t}from"../../../../geometry/support/Indices.js";import{Attribute as e}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as i}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as r}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as n}from"../../webgl-engine/lib/VertexAttribute.js";import a from"../../../../geometry/Extent.js";import o from"../../../../geometry/Polygon.js";function s(a){const o=[[n.POSITION,a.indices]],s=[[n.POSITION,new e(a.attributeData.position,3,!0)]];return null!=a.attributeData.colorFeature?(s.push([n.COLORFEATUREATTRIBUTE,new e([a.attributeData.colorFeature],1,!0)]),o.push([n.COLORFEATUREATTRIBUTE,new Array(a.indices.length).fill(0)])):a.attributeData.color&&(s.push([n.COLOR,new e(a.attributeData.color,4,!0)]),o.push([n.COLOR,t(a.indices.length)])),a.attributeData.uvMapSpace&&(s.push([n.UVMAPSPACE,new e(a.attributeData.uvMapSpace,4,!0)]),o.push([n.UVMAPSPACE,a.indices])),a.attributeData.boundingRect&&(s.push([n.BOUNDINGRECT,new e(a.attributeData.boundingRect,9,!0)]),o.push([n.BOUNDINGRECT,a.indices])),new r(a.material,s,o,a.mapPositions,i.Mesh,a.attributeData.objectAndLayerIdColor)}function u(t){const i=[[n.POSITION,t.indices],[n.UV0,t.indices]],a=[[n.POSITION,new e(t.attributeData.position,3,!0)],[n.UV0,new e(t.attributeData.uv0,2,!0)]];return new r(t.material,a,i,t.mapPositions)}function c(t){switch(t.type){case"extent":if(t instanceof a)return o.fromExtent(t);break;case"polygon":return t}return null}class p{constructor(t,e,i){this.renderData=t,this.layerUid=e,this.graphicUid=i,this.outGeometries=new Array}}export{p as PolygonCreationDataBase,s as createColorGeometry,u as createWaterGeometry,c as geometryAsPolygon};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{f as e}from"../../../../chunks/mat3.js";import{c as o}from"../../../../chunks/mat3f64.js";import{i,c as n,s,m as r,k as l,w as a,q as u,r as f,p as c}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{s as d}from"../../../../chunks/vec3.js";import{c as z}from"../../../../chunks/vec3f64.js";import{meterIn as v}from"../../../../renderers/support/lengthUtils.js";import m from"../../support/debugFlags.js";import{NoParameters as h}from"../../webgl-engine/core/shaderModules/interfaces.js";var S,y;!function(t){t[t.Undefined=0]="Undefined",t[t.DefinedSize=1]="DefinedSize",t[t.DefinedScale=2]="DefinedScale"}(S||(S={})),function(t){t[t.Undefined=0]="Undefined",t[t.DefinedAngle=1]="DefinedAngle"}(y||(y={}));class x{constructor(t){this.field=t}}class g extends x{constructor(t){super(t),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[S.Undefined,S.Undefined,S.Undefined]}}class C extends x{constructor(t){super(t),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0]}}class b extends x{constructor(t){super(t),this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}}class D extends x{constructor(t){super(t),this.offset=[0,0,0],this.factor=[1,1,1],this.type=[0,0,0]}}class w{constructor(){this.size=null,this.color=null,this.opacity=null,this.rotation=null}}function U(t){return null!=t}function M(t){return"number"==typeof t}function V(t){return"string"==typeof t}function j(t){return null==t||V(t)}function k(t,e){t&&t.push(e)}function A(t,e,o,i=p()){const n=t||0,s=e||0,r=o||0;return 0!==n&&u(i,i,-n/180*Math.PI),0!==s&&f(i,i,s/180*Math.PI),0!==r&&c(i,i,r/180*Math.PI),i}function R(t,e,o,i,n){const s=t.minSize,r=t.maxSize;if(t.expression)return k(n,"Could not convert size info: expression not supported"),!1;if(t.useSymbolValue){const t=i.symbolSize[o];return e.minSize[o]=t,e.maxSize[o]=t,e.offset[o]=e.minSize[o],e.factor[o]=0,e.type[o]=S.DefinedSize,!0}if(U(t.field))return U(t.stops)?2===t.stops.length&&M(t.stops[0].size)&&M(t.stops[1].size)?(I(t.stops[0].size,t.stops[1].size,t.stops[0].value,t.stops[1].value,e,o),e.type[o]=S.DefinedSize,!0):(k(n,"Could not convert size info: stops only supported with 2 elements"),!1):M(s)&&M(r)&&U(t.minDataValue)&&U(t.maxDataValue)?(I(s,r,t.minDataValue,t.maxDataValue,e,o),e.type[o]=S.DefinedSize,!0):null!=v[t.valueUnit]?(e.minSize[o]=-1/0,e.maxSize[o]=1/0,e.offset[o]=0,e.factor[o]=1/v[t.valueUnit],e.type[o]=S.DefinedSize,!0):"unknown"===t.valueUnit?(k(n,"Could not convert size info: proportional size not supported"),!1):(k(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!U(t.field)){if(t.stops&&t.stops[0]&&M(t.stops[0].size))return e.minSize[o]=t.stops[0].size,e.maxSize[o]=t.stops[0].size,e.offset[o]=e.minSize[o],e.factor[o]=0,e.type[o]=S.DefinedSize,!0;if(M(s))return e.minSize[o]=s,e.maxSize[o]=s,e.offset[o]=s,e.factor[o]=0,e.type[o]=S.DefinedSize,!0}return k(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function I(t,e,o,i,n,s){const r=Math.abs(i-o)>0?(e-t)/(i-o):0;n.minSize[s]=r>0?t:e,n.maxSize[s]=r>0?e:t,n.offset[s]=t-o*r,n.factor[s]=r}function T(t,e,o,i){if(t.normalizationField||t.valueRepresentation)return k(i,"Could not convert size info: unsupported property"),null;if(!j(t.field))return k(i,"Could not convert size info: field is not a string"),null;if(e.size){if(t.field)if(e.size.field){if(t.field!==e.size.field)return k(i,"Could not convert size info: multiple fields in use"),null}else e.size.field=t.field}else e.size=new g(t.field);let n;switch(t.axis){case"width":return n=R(t,e.size,0,o,i),n?e:null;case"height":return n=R(t,e.size,2,o,i),n?e:null;case"depth":return n=R(t,e.size,1,o,i),n?e:null;case"width-and-depth":return n=R(t,e.size,0,o,i),n&&R(t,e.size,1,o,i),n?e:null;case null:case void 0:case"all":return n=R(t,e.size,0,o,i),n=n&&R(t,e.size,1,o,i),n=n&&R(t,e.size,2,o,i),n?e:null;default:return k(i,`Could not convert size info: unknown axis "${t.axis}""`),null}}function P(t,e,o){for(let n=0;n<3;++n){let o=e.unitInMeters;t.type[n]===S.DefinedSize&&(o*=e.modelSize[n],t.type[n]=S.DefinedScale),t.minSize[n]=t.minSize[n]/o,t.maxSize[n]=t.maxSize[n]/o,t.offset[n]=t.offset[n]/o,t.factor[n]=t.factor[n]/o}let i;if(t.type[0]!==S.Undefined)i=0;else if(t.type[1]!==S.Undefined)i=1;else{if(t.type[2]===S.Undefined)return k(o,"No size axis contains a valid size or scale"),!1;i=2}for(let n=0;n<3;++n)t.type[n]===S.Undefined&&(t.minSize[n]=t.minSize[i],t.maxSize[n]=t.maxSize[i],t.offset[n]=t.offset[i],t.factor[n]=t.factor[i],t.type[n]=t.type[i]);return!0}function F(t,e,o){t[4*e]=o.r/255,t[4*e+1]=o.g/255,t[4*e+2]=o.b/255,t[4*e+3]=o.a}function E(t,e,o){if(t.normalizationField)return k(o,"Could not convert color info: unsupported property"),null;if(V(t.field)){if(!t.stops)return k(o,"Could not convert color info: missing stops or colors"),null;{if(t.stops.length>8)return k(o,"Could not convert color info: too many color stops"),null;e.color=new C(t.field);const i=t.stops;for(let t=0;t<8;++t){const o=i[Math.min(t,i.length-1)];e.color.values[t]=o.value,F(e.color.colors,t,o.color)}}}else{if(!(t.stops&&t.stops.length>=0))return k(o,"Could not convert color info: no field and no colors/stops"),null;{const o=t.stops&&t.stops.length>=0&&t.stops[0].color;e.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let t=0;t<8;t++)e.color.values[t]=1/0,F(e.color.colors,t,o)}}return e}function q(t,e,o){if(t.normalizationField)return k(o,"Could not convert opacity info: unsupported property"),null;if(V(t.field)){if(!t.stops)return k(o,"Could not convert opacity info: missing stops or opacities"),null;{if(t.stops.length>8)return k(o,"Could not convert opacity info: too many opacity stops"),null;e.opacity=new b(t.field);const i=t.stops;for(let t=0;t<8;++t){const o=i[Math.min(t,i.length-1)];e.opacity.values[t]=o.value,e.opacity.opacityValues[t]=o.opacity}}}else{if(!(t.stops&&t.stops.length>=0))return k(o,"Could not convert opacity info: no field and no opacities/stops"),null;{const o=t.stops&&t.stops.length>=0?t.stops[0].opacity:0;e.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let t=0;t<8;t++)e.opacity.values[t]=1/0,e.opacity.opacityValues[t]=o}}return e}function O(t,e,o){const i=2===o&&"arithmetic"===t.rotationType;e.offset[o]=i?90:0,e.factor[o]=i?-1:1,e.type[o]=1}function _(t,e,o){if(!V(t.field))return k(o,"Could not convert rotation info: field is not a string"),null;if(e.rotation){if(t.field)if(e.rotation.field){if(t.field!==e.rotation.field)return k(o,"Could not convert rotation info: multiple fields in use"),null}else e.rotation.field=t.field}else e.rotation={field:t.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(t.axis){case"tilt":return O(t,e.rotation,0),e;case"roll":return O(t,e.rotation,1),e;case null:case void 0:case"heading":return O(t,e.rotation,2),e;default:return k(o,`Could not convert rotation info: unknown axis "${t.axis}""`),null}}class ${constructor(t=[1,1,1],e=[1,1,1],o=1,i=[0,0,0],n=[1,1,1],s=[0,0,0]){this.modelSize=t,this.symbolSize=e,this.unitInMeters=o,this.anchor=i,this.scale=n,this.rotation=s,this.supportsSize=!0,this.supportsColor=!0,this.supportsRotation=!0,this.supportsOpacity=!1}}function B(t,e,o){if(!t)return null;const i=t.reduce(((t,i)=>{if(!t)return t;if(i.valueExpression)return k(o,"Could not convert visual variables: arcade expressions not supported"),null;switch(i.type){case"size":return e.supportsSize?T(i,t,e,o):t;case"color":return e.supportsColor?E(i,t,o):t;case"opacity":return e.supportsOpacity?q(i,t,o):null;case"rotation":return e.supportsRotation?_(i,t,o):t;default:return null}}),new w);return!(t.length>0&&i)||i.size||i.color||i.opacity||i.rotation?i&&i.size&&!P(i.size,e,o)?null:i:null}class L{constructor(t,e,o){this.visualVariables=t,this.materialParameters=e,this.requiresShaderTransformation=o}}function N(t,e){if(!t)return null;if(m.TESTS_DISABLE_FAST_UPDATES)return null;const o=B(t.visualVariables,e);return o?new L(o,K(o,e),!!o.size):null}function G(t,e,o){if(!e||!t)return!1;const i=t.visualVariables,n=B(e.visualVariables,o);return!!n&&(!!(H(i.size,n.size,"size")&&H(i.color,n.color,"color")&&H(i.rotation,n.rotation,"rotation")&&H(i.opacity,n.opacity,"opacity"))&&(t.visualVariables=n,t.materialParameters=K(n,o),t.requiresShaderTransformation=!!n.size,!0))}function H(t,e,o){if(!!t!=!!e)return!1;if(t&&t.field!==e?.field)return!1;if(t&&"rotation"===o){const o=t,i=e;for(let t=0;t<3;t++)if(o.type[t]!==i.type[t]||o.offset[t]!==i.offset[t]||o.factor[t]!==i.factor[t])return!1}return!0}class J extends h{constructor(t=null){super(),this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.vvSize=t?.size??null,this.vvColor=t?.color??null,this.vvOpacity=t?.opacity??null}}function K(t,n){const s=new J(t);return s.vvSize&&(s.vvSymbolAnchor=n.anchor,i(Z),A(n.rotation[2],n.rotation[0],n.rotation[1],Z),s.vvSymbolRotationMatrix=s.vvSymbolRotationMatrix||o(),e(s.vvSymbolRotationMatrix,Z)),s}function Q(e,o,i){if(!e.vvSize)return i;n(X,i);const u=e.vvSymbolRotationMatrix;s(Z,u[0],u[1],u[2],0,u[3],u[4],u[5],0,u[6],u[7],u[8],0,0,0,0,1),r(X,X,Z);for(let n=0;n<3;++n){const i=e.vvSize.offset[n]+o[0]*e.vvSize.factor[n];Y[n]=t(i,e.vvSize.minSize[n],e.vvSize.maxSize[n])}return l(X,X,Y),a(X,X,e.vvSymbolAnchor),X}function W(e,o,i){if(o.vvSize)for(let n=0;n<3;++n){const s=o.vvSize.offset[n]+i[0]*o.vvSize.factor[n];e[n]=t(s,o.vvSize.minSize[n],o.vvSize.maxSize[n])}else d(e,1,1,1)}const X=p(),Y=z(),Z=p();export{$ as ConvertOptions,C as FastColorInfo,b as FastOpacityInfo,D as FastRotationInfo,y as FastRotationType,g as FastSizeInfo,S as FastSizeType,L as FastSymbolUpdatesState,w as FastVisualVariables,J as VisualVariablesParameters,B as convertVisualVariables,Q as evaluateModelTransform,W as evaluateModelTransformScale,K as getMaterialParameters,N as initFastSymbolUpdatesState,G as updateFastSymbolUpdatesState};
|
|
5
|
+
import"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{f as t}from"../../../../chunks/mat3.js";import{c as o}from"../../../../chunks/mat3f64.js";import{i,c as n,s,m as r,k as l,w as a,q as u,r as f,p as c}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{s as d}from"../../../../chunks/vec3.js";import{c as z}from"../../../../chunks/vec3f64.js";import{meterIn as v}from"../../../../renderers/support/lengthUtils.js";import m from"../../support/debugFlags.js";import{NoParameters as h}from"../../webgl-engine/core/shaderModules/interfaces.js";var S,y;!function(e){e[e.Undefined=0]="Undefined",e[e.DefinedSize=1]="DefinedSize",e[e.DefinedScale=2]="DefinedScale"}(S||(S={})),function(e){e[e.Undefined=0]="Undefined",e[e.DefinedAngle=1]="DefinedAngle"}(y||(y={}));class x{constructor(e){this.field=e}}class g extends x{constructor(e){super(e),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[S.Undefined,S.Undefined,S.Undefined]}}class b extends x{constructor(e){super(e),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0]}}class C extends x{constructor(e){super(e),this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}}class D extends x{constructor(e){super(e),this.offset=[0,0,0],this.factor=[1,1,1],this.type=[0,0,0]}}class w{}function U(e){return null!=e}function V(e){return"number"==typeof e}function M(e){return"string"==typeof e}function j(e){return null==e||M(e)}function k(e,t){e&&e.push(t)}function A(e,t,o,i=p()){const n=e||0,s=t||0,r=o||0;return 0!==n&&u(i,i,-n/180*Math.PI),0!==s&&f(i,i,s/180*Math.PI),0!==r&&c(i,i,r/180*Math.PI),i}function I(e,t,o,i,n){const s=e.minSize,r=e.maxSize;if(e.expression)return k(n,"Could not convert size info: expression not supported"),!1;if(e.useSymbolValue){const e=i.symbolSize[o];return t.minSize[o]=e,t.maxSize[o]=e,t.offset[o]=t.minSize[o],t.factor[o]=0,t.type[o]=S.DefinedSize,!0}if(U(e.field))return U(e.stops)?2===e.stops.length&&V(e.stops[0].size)&&V(e.stops[1].size)?(T(e.stops[0].size,e.stops[1].size,e.stops[0].value,e.stops[1].value,t,o),t.type[o]=S.DefinedSize,!0):(k(n,"Could not convert size info: stops only supported with 2 elements"),!1):V(s)&&V(r)&&U(e.minDataValue)&&U(e.maxDataValue)?(T(s,r,e.minDataValue,e.maxDataValue,t,o),t.type[o]=S.DefinedSize,!0):null!=v[e.valueUnit]?(t.minSize[o]=-1/0,t.maxSize[o]=1/0,t.offset[o]=0,t.factor[o]=1/v[e.valueUnit],t.type[o]=S.DefinedSize,!0):"unknown"===e.valueUnit?(k(n,"Could not convert size info: proportional size not supported"),!1):(k(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!U(e.field)){if(e.stops&&e.stops[0]&&V(e.stops[0].size))return t.minSize[o]=e.stops[0].size,t.maxSize[o]=e.stops[0].size,t.offset[o]=t.minSize[o],t.factor[o]=0,t.type[o]=S.DefinedSize,!0;if(V(s))return t.minSize[o]=s,t.maxSize[o]=s,t.offset[o]=s,t.factor[o]=0,t.type[o]=S.DefinedSize,!0}return k(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function T(e,t,o,i,n,s){const r=Math.abs(i-o)>0?(t-e)/(i-o):0;n.minSize[s]=r>0?e:t,n.maxSize[s]=r>0?t:e,n.offset[s]=e-o*r,n.factor[s]=r}function F(e,t,o,i){if(e.normalizationField||e.valueRepresentation)return k(i,"Could not convert size info: unsupported property"),null;if(!j(e.field))return k(i,"Could not convert size info: field is not a string"),null;if(t.size){if(e.field)if(t.size.field){if(e.field!==t.size.field)return k(i,"Could not convert size info: multiple fields in use"),null}else t.size.field=e.field}else t.size=new g(e.field);let n;switch(e.axis){case"width":return n=I(e,t.size,0,o,i),n?t:null;case"height":return n=I(e,t.size,2,o,i),n?t:null;case"depth":return n=I(e,t.size,1,o,i),n?t:null;case"width-and-depth":return n=I(e,t.size,0,o,i),n&&I(e,t.size,1,o,i),n?t:null;case null:case void 0:case"all":return n=I(e,t.size,0,o,i),n=n&&I(e,t.size,1,o,i),n=n&&I(e,t.size,2,o,i),n?t:null;default:return k(i,`Could not convert size info: unknown axis "${e.axis}""`),null}}function P(e,t,o){for(let n=0;n<3;++n){let o=t.unitInMeters;e.type[n]===S.DefinedSize&&(o*=t.modelSize[n],e.type[n]=S.DefinedScale),e.minSize[n]=e.minSize[n]/o,e.maxSize[n]=e.maxSize[n]/o,e.offset[n]=e.offset[n]/o,e.factor[n]=e.factor[n]/o}let i;if(e.type[0]!==S.Undefined)i=0;else if(e.type[1]!==S.Undefined)i=1;else{if(e.type[2]===S.Undefined)return k(o,"No size axis contains a valid size or scale"),!1;i=2}for(let n=0;n<3;++n)e.type[n]===S.Undefined&&(e.minSize[n]=e.minSize[i],e.maxSize[n]=e.maxSize[i],e.offset[n]=e.offset[i],e.factor[n]=e.factor[i],e.type[n]=e.type[i]);return!0}function R(e,t,o){e[4*t]=o.r/255,e[4*t+1]=o.g/255,e[4*t+2]=o.b/255,e[4*t+3]=o.a}function E(e,t,o){if(e.normalizationField)return k(o,"Could not convert color info: unsupported property"),null;if(M(e.field)){if(!e.stops)return k(o,"Could not convert color info: missing stops or colors"),null;{if(e.stops.length>8)return k(o,"Could not convert color info: too many color stops"),null;t.color=new b(e.field);const i=e.stops;for(let e=0;e<8;++e){const o=i[Math.min(e,i.length-1)];t.color.values[e]=o.value,R(t.color.colors,e,o.color)}}}else{if(!(e.stops&&e.stops.length>=0))return k(o,"Could not convert color info: no field and no colors/stops"),null;{const o=e.stops&&e.stops.length>=0&&e.stops[0].color;t.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)t.color.values[e]=1/0,R(t.color.colors,e,o)}}return t}function q(e,t,o){if(e.normalizationField)return k(o,"Could not convert opacity info: unsupported property"),null;if(M(e.field)){if(!e.stops)return k(o,"Could not convert opacity info: missing stops or opacities"),null;{if(e.stops.length>8)return k(o,"Could not convert opacity info: too many opacity stops"),null;t.opacity=new C(e.field);const i=e.stops;for(let e=0;e<8;++e){const o=i[Math.min(e,i.length-1)];t.opacity.values[e]=o.value,t.opacity.opacityValues[e]=o.opacity}}}else{if(!(e.stops&&e.stops.length>=0))return k(o,"Could not convert opacity info: no field and no opacities/stops"),null;{const o=e.stops&&e.stops.length>=0?e.stops[0].opacity:0;t.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let e=0;e<8;e++)t.opacity.values[e]=1/0,t.opacity.opacityValues[e]=o}}return t}function _(e,t,o){const i=2===o&&"arithmetic"===e.rotationType;t.offset[o]=i?90:0,t.factor[o]=i?-1:1,t.type[o]=1}function $(e,t,o){if(!M(e.field))return k(o,"Could not convert rotation info: field is not a string"),null;if(t.rotation){if(e.field)if(t.rotation.field){if(e.field!==t.rotation.field)return k(o,"Could not convert rotation info: multiple fields in use"),null}else t.rotation.field=e.field}else t.rotation={field:e.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(e.axis){case"tilt":return _(e,t.rotation,0),t;case"roll":return _(e,t.rotation,1),t;case null:case void 0:case"heading":return _(e,t.rotation,2),t;default:return k(o,`Could not convert rotation info: unknown axis "${e.axis}""`),null}}class B{constructor(e,t=[1,1,1],o=[1,1,1],i=1,n=[0,0,0],s=[1,1,1],r=[0,0,0]){this.supports=e,this.modelSize=t,this.symbolSize=o,this.unitInMeters=i,this.anchor=n,this.scale=s,this.rotation=r}}function L(e,t,o){if(!e)return null;const i=e.reduce(((e,i)=>{if(!e)return e;if(i.valueExpression)return k(o,"Could not convert visual variables: arcade expressions not supported"),null;switch(i.type){case"size":return t.supports.size?F(i,e,t,o):e;case"color":return t.supports.color?E(i,e,o):e;case"opacity":return t.supports.opacity?q(i,e,o):null;case"rotation":return t.supports.rotation?$(i,e,o):e;default:return null}}),new w);return!(e.length>0&&i)||i.size||i.color||i.opacity||i.rotation?i&&i.size&&!P(i.size,t,o)?null:i:null}class N{constructor(e,t,o){this.visualVariables=e,this.materialParameters=t,this.requiresShaderTransformation=o}}function O(e,t){if(!e)return null;if(m.TESTS_DISABLE_FAST_UPDATES)return null;const o=L(e.visualVariables,t);return o?new N(o,K(o,t),!!o.size):null}function G(e,t,o){if(!t||!e)return!1;const i=e.visualVariables,n=L(t.visualVariables,o);return!!n&&(!!(H(i.size,n.size,"size")&&H(i.color,n.color,"color")&&H(i.rotation,n.rotation,"rotation")&&H(i.opacity,n.opacity,"opacity"))&&(e.visualVariables=n,e.materialParameters=K(n,o),e.requiresShaderTransformation=!!n.size,!0))}function H(e,t,o){if(!!e!=!!t)return!1;if(e&&e.field!==t?.field)return!1;if(e&&"rotation"===o){const o=e,i=t;for(let e=0;e<3;e++)if(o.type[e]!==i.type[e]||o.offset[e]!==i.offset[e]||o.factor[e]!==i.factor[e])return!1}return!0}class J extends h{constructor(e){super(),this.vvSize=e?.size??null,this.vvColor=e?.color??null,this.vvOpacity=e?.opacity??null}}function K(e,n){const s=new J(e);return s.vvSize&&(s.vvSymbolAnchor=n.anchor,i(ee),A(n.rotation[2],n.rotation[0],n.rotation[1],ee),s.vvSymbolRotationMatrix=s.vvSymbolRotationMatrix||o(),t(s.vvSymbolRotationMatrix,ee)),s}function Q(t,o,i){if(!t.vvSize)return i;n(Y,i);const u=t.vvSymbolRotationMatrix;s(ee,u[0],u[1],u[2],0,u[3],u[4],u[5],0,u[6],u[7],u[8],0,0,0,0,1),r(Y,Y,ee);for(let n=0;n<3;++n){const i=t.vvSize.offset[n]+o[0]*t.vvSize.factor[n];Z[n]=e(i,t.vvSize.minSize[n],t.vvSize.maxSize[n])}return l(Y,Y,Z),a(Y,Y,t.vvSymbolAnchor),Y}function W(t,o,i){if(o.vvSize)for(let n=0;n<3;++n){const s=o.vvSize.offset[n]+i[0]*o.vvSize.factor[n];t[n]=e(s,o.vvSize.minSize[n],o.vvSize.maxSize[n])}else d(t,1,1,1)}function X(e,t){const o=null==e?0:t.attributes[e];return"number"==typeof o&&isFinite(o)?o:0}const Y=p(),Z=z(),ee=p();export{B as ConvertOptions,b as FastColorInfo,C as FastOpacityInfo,D as FastRotationInfo,y as FastRotationType,g as FastSizeInfo,S as FastSizeType,N as FastSymbolUpdatesState,w as FastVisualVariables,J as VisualVariablesParameters,L as convertVisualVariables,Q as evaluateModelTransform,W as evaluateModelTransformScale,X as getAttributeValue,K as getMaterialParameters,O as initFastSymbolUpdatesState,G as updateFastSymbolUpdatesState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{BufferViewVec2f as e,BufferViewVec2f64 as t,BufferViewVec3f as i,BufferViewVec3f64 as
|
|
5
|
+
import{BufferViewVec2f as e,BufferViewVec2f64 as t,BufferViewVec3f as i,BufferViewVec3f64 as r,BufferViewVec4f as s,BufferViewVec4f64 as n,BufferViewMat3f as h,BufferViewMat3f64 as d,BufferViewMat4f as u,BufferViewMat4f64 as f,BufferViewVec4u8 as o,BufferViewFloat as l,BufferViewFloat64 as p,BufferViewUint8 as c,BufferViewUint16 as a,BufferViewInt8 as _,BufferViewVec2i8 as y,BufferViewVec2i16 as F,BufferViewVec2u8 as m,BufferViewVec4u16 as b,BufferViewUint32 as w,BufferViewVec3u8 as g,BufferViewVec2u16 as v,BufferViewVec3u16 as E,BufferViewVec2u32 as T,BufferViewVec3u32 as A,BufferViewVec4u32 as B,BufferViewVec3i8 as U,BufferViewVec4i8 as C,BufferViewInt16 as M,BufferViewVec3i16 as j,BufferViewVec4i16 as L,BufferViewInt32 as $,BufferViewVec2i32 as x,BufferViewVec3i32 as V,BufferViewVec4i32 as k}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as z}from"../../../../geometry/support/buffer/types.js";import{assert as q}from"../../webgl-engine/lib/Util.js";class D{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new D(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t,i,r){const s=this.stride;if(s%4==0){const n=new Uint32Array(e.buffer,t*s,r*s/4);new Uint32Array(this.buffer,i*s,r*s/4).set(n)}else{const n=new Uint8Array(e.buffer,t*s,r*s);new Uint8Array(this.buffer,i*s,r*s).set(n)}}}class G{constructor(e=null){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach((e=>this._fields.set(e[0],{...e[1],constructor:N(e[1].constructor)}))))}vec2f(t,i){return this._appendField(t,e,i),this}vec2f64(e,i){return this._appendField(e,t,i),this}vec3f(e,t){return this._appendField(e,i,t),this}vec3f64(e,t){return this._appendField(e,r,t),this}vec4f(e,t){return this._appendField(e,s,t),this}vec4f64(e,t){return this._appendField(e,n,t),this}mat3f(e,t){return this._appendField(e,h,t),this}mat3f64(e,t){return this._appendField(e,d,t),this}mat4f(e,t){return this._appendField(e,u,t),this}mat4f64(e,t){return this._appendField(e,f,t),this}vec4u8(e,t){return this._appendField(e,o,t),this}f32(e,t){return this._appendField(e,l,t),this}f64(e,t){return this._appendField(e,p,t),this}u8(e,t){return this._appendField(e,c,t),this}u16(e,t){return this._appendField(e,a,t),this}i8(e,t){return this._appendField(e,_,t),this}vec2i8(e,t){return this._appendField(e,y,t),this}vec2i16(e,t){return this._appendField(e,F,t),this}vec2u8(e,t){return this._appendField(e,m,t),this}vec4u16(e,t){return this._appendField(e,b,t),this}u32(e,t){return this._appendField(e,w,t),this}_appendField(e,t,i){if(this._fields.has(e))return void q(!1,`${e} already added to vertex buffer layout`);const r=t.ElementCount*z(t.ElementType),s=this._stride;this._stride+=r,this._fields.set(e,{size:r,constructor:t,offset:s,optional:i})}alignTo(e){return this._stride=Math.floor((this._stride+e-1)/e)*e,this}createBuffer(e){return new D(this,e)}createView(e){return new D(this,e)}clone(){const e=new G;return e._stride=this._stride,e._fields=new Map,this._fields.forEach(((t,i)=>e._fields.set(i,t))),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function H(){return new G}class I{constructor(e){this.fields=new Array,e.fields.forEach(((e,t)=>{const i={...e,constructor:K(e.constructor)};this.fields.push([t,i])})),this.stride=e.stride}}const J=[l,e,i,s,h,u,p,t,r,n,d,f,c,m,g,o,a,v,E,b,w,T,A,B,_,y,U,C,M,F,j,L,$,x,V,k];function K(e){return`${e.ElementType}_${e.ElementCount}`}function N(e){return O.get(e)}const O=new Map;J.forEach((e=>O.set(K(e),e)));export{D as InterleavedBuffer,G as InterleavedLayout,I as PackedLayout,H as newLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{DataType as t}from"../../../webgl/enums.js";import{VertexElementDescriptor as e}from"../../../webgl/VertexElementDescriptor.js";function
|
|
5
|
+
import{DataType as t}from"../../../webgl/enums.js";import{VertexElementDescriptor as e}from"../../../webgl/VertexElementDescriptor.js";function r(t,r=0){const n=t.stride;return Array.from(t.fields.keys()).filter((e=>{const r=t.fields.get(e)?.optional;return!(r&&r.glPadding)})).map((i=>{const s=t.fields.get(i),f=s.constructor.ElementCount,l=o(s.constructor.ElementType),u=s.offset,c=!(!s.optional||!s.optional.glNormalized);return new e(i,f,l,u,n,c,r)}))}function o(t){const e=n[t];if(e)return e;throw new Error("BufferType not supported in WebGL")}const n={u8:t.UNSIGNED_BYTE,u16:t.UNSIGNED_SHORT,u32:t.UNSIGNED_INT,i8:t.BYTE,i16:t.SHORT,i32:t.INT,f32:t.FLOAT};export{r as glLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{PackedLayout as e,InterleavedLayout as r}from"./InterleavedLayout.js";function u(r,u){return u.push(r.buffer),{buffer:r.buffer,layout:new e(r.layout)}}function t(e){return new r(e.layout).createView(e.buffer)}export{u as packInterleavedBuffer,t as unpackInterleavedBuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as
|
|
5
|
+
import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as c}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function h(t,e,r=null){const o=[],n=[],i=e.mapPositions;T(e,n,o);const a=n[0][1].data,u=o[0][1].length,l=s(u);return b(e,n,o,l),A(e,n,o,l),g(e,n,o,l),E(e,n,o,l),I(e,n,o,l),O(e,n,o,l),R(e,n,o,a),new f(t,n,o,i,c.Line,r)}function T(t,e,r){const{attributeData:{position:o},removeDuplicateStartEnd:n}=t,i=D(o)&&n,a=o.length/3-(i?1:0),u=new Array(2*(a-1)),s=i?o.slice(0,o.length-3):o;let l=0;for(let p=0;p<a-1;p++)u[l++]=p,u[l++]=p+1;e.push([m.POSITION,new p(s,3,i)]),r.push([m.POSITION,u])}function b(t,e,r,n){if(null!=t.attributeData.colorFeature)return;const i=t.attributeData.color;e.push([m.COLOR,new p(i??o,4)]),r.push([m.COLOR,n])}function g(t,e,r,o){if(null==t.attributeData.normal)return;const n=t.attributeData.normal;e.push([m.NORMAL,new p(n,3)]),r.push([m.NORMAL,o])}function E(t,e,r,o){null!=t.attributeData.colorFeature&&(e.push([m.COLORFEATUREATTRIBUTE,new p([t.attributeData.colorFeature],1,!0)]),r.push([m.COLOR,o]))}function A(t,e,r,o){null==t.attributeData.sizeFeature&&(e.push([m.SIZE,new p([t.attributeData.size??1],1,!0)]),r.push([m.SIZE,o]))}function I(t,e,r,o){null!=t.attributeData.sizeFeature&&(e.push([m.SIZEFEATUREATTRIBUTE,new p([t.attributeData.sizeFeature],1,!0)]),r.push([m.SIZEFEATUREATTRIBUTE,o]))}function O(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&(e.push([m.OPACITYFEATUREATTRIBUTE,new p([n],1,!0)]),r.push([m.OPACITYFEATUREATTRIBUTE,o]))}function R(r,o,s,c){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==l.Global||!r.overlayInfo.spatialReference.isGeographic)return;const f=a(c.length),h=n(r.overlayInfo.spatialReference);for(let t=0;t<f.length;t+=3)i(c,t,f,t,h);const T=c.length/3,b=u(T+1);let g=j,E=w,A=0,I=0;e(g,f[I++],f[I++],f[I++]),b[0]=0;for(let n=1;n<T+1;++n)n===T&&(I=0),e(E,f[I++],f[I++],f[I++]),A+=t(g,E),b[n]=A,[g,E]=[E,g];o.push([m.DISTANCETOSTART,new p(b,1,!0)]),s.push([m.DISTANCETOSTART,s[0][1]])}function D(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const j=r(),w=r();function y(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{h as createGeometry,y as lineStripsToParameters};
|