@arcgis/core 4.28.0-next.20230713 → 4.28.0-next.20230714
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/Basemap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{08ee2bd914867fd2cbd5.js → 490629c6f9fee501c9cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{044b15794b6403792f04.js → 4f079d0e69189c1d8bd9.js} +1 -1
- package/assets/esri/core/workers/chunks/{3835a76c017431f19422.js → 51da3c5c50b153ce6bc7.js} +1 -1
- package/assets/esri/core/workers/chunks/b694126184f85a832b39.js +1 -0
- package/assets/esri/core/workers/chunks/b8a45b28a915a423d09d.js +1 -0
- package/assets/esri/core/workers/chunks/{55109f141c9f120833f6.js → c3d773c93efb41088c54.js} +1 -1
- package/assets/esri/core/workers/chunks/e433440fecd0114cb23d.js +1 -0
- package/assets/esri/themes/base/widgets/_ElevationProfile.scss +3 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/RibbonLine.glsl.js +57 -72
- package/core/image/apng.js +1 -1
- package/core/image/gif.js +1 -1
- package/core/urlUtils.js +1 -1
- package/interfaces.d.ts +12 -0
- package/layers/support/ImageElement.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/support/BasemapStyle.js +5 -0
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
- package/views/3d/interactive/editingTools/settings.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +12 -13
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/assets/esri/core/workers/chunks/308eeeaec591b4eea1de.js +0 -1
- package/assets/esri/core/workers/chunks/498dca81073e1fb477b9.js +0 -1
- package/assets/esri/core/workers/chunks/b2a0e3e1dfccda7ed12e.js +0 -1
package/package.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../chunks/tslib.es6.js";import s from"../core/Accessor.js";import{property as e}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";import{getLocale as o,getLanguage as a}from"../intl/locale.js";const c=new Set(["ar","bs","ca","hr","cs","da","nl","en","et","fi","fr","de","el","he","hu","id","it","ja","ko","lv","lt","nb","pl","ro","ru","sr","es","sv","th","tr","uk","vi"]);let p=class extends s{constructor(r){super(r),this.id=null,this.language=null,this.serviceUrl="https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps"}getLanguageParamValue(){if(this.language)return this.language;const r=o().toLowerCase();switch(r){case"pt-br":return"pt-BR";case"pt-pt":return"pt-PT";case"zh-cn":return"zh-CN";case"zh-hk":return"zh-HK";case"zh-tw":return"zh-TW"}const s=a(r);return"pt"===s?"pt-BR":s&&c.has(s)?s:"global"}};r([e()],p.prototype,"id",void 0),r([e()],p.prototype,"language",void 0),r([e()],p.prototype,"serviceUrl",void 0),p=r([t("esri.support.BasemapStyle")],p);const i=p;export{i as default};
|
package/support/basemapUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Basemap.js";import r from"../config.js";import n from"../core/Collection.js";import a from"../core/Logger.js";import{Url as t,makeAbsolute as l,normalize as i}from"../core/urlUtils.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as u}from"./basemapDefinitions.js";const c=a.getLogger("esri.support.basemapUtils");function o(){return{}}function f(e){for(const r in e){const n=e[r];!1===n?.destroyed&&n.destroy(),delete e[r]}}function p(n,a){let t;if("string"==typeof n){
|
|
5
|
+
import e from"../Basemap.js";import r from"../config.js";import n from"../core/Collection.js";import a from"../core/Logger.js";import{Url as t,makeAbsolute as l,normalize as i}from"../core/urlUtils.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import{esriBasemapDefinitions as u}from"./basemapDefinitions.js";const c=a.getLogger("esri.support.basemapUtils");function o(){return{}}function f(e){for(const r in e){const n=e[r];!1===n?.destroyed&&n.destroy(),delete e[r]}}function p(n,a){let t;if("string"==typeof n){const l=n in u,i=!l&&n.includes("/");if(!l&&!i){const e=Object.entries(u).filter((([e,n])=>r.apiKey&&!n.classic||!r.apiKey&&n.classic&&!n.deprecated)).map((([e])=>`"${e}"`)).join(", ");return c.warn(`Unable to find basemap definition for: ${n}. Try one of these: ${e}`),null}a&&(t=a[n]),t||(t=l?e.fromId(n):new e({style:{id:n}}),a&&(a[n]=t))}else t=s(e,n);return t?.destroyed&&(c.warn("The provided basemap is already destroyed",{basemap:t}),t=null),t}function y(e){return"Web Scene"===e.portalItem?.type}function m(e,r){return e.basemap?.referenceLayers?.some((e=>e.uid===r))||e.basemap?.baseLayers?.some((e=>e.uid===r))}function d(e,r=null){const n=p(e);if(!n)return null;const a=n.clone();return r&&(a.baseLayers=g(a.baseLayers,r.baseLayers),a.referenceLayers=g(a.referenceLayers,r.referenceLayers)),a}let b;function L(e){if(b)return b(e);let r=null;const n=q(e),a=!n?.baseLayers.length;for(const t in u){const e=$(n,U(u[t]),{mustMatchReferences:a});if("equal"===e){r=t;break}"base-layers-equal"===e&&(r=t)}return r}function S(e){b=e}function v(e,r){if(e===r)return!0;return"equal"===$(q(e),q(r),{mustMatchReferences:!0})}function g(e,r){const a=new n;return e.forEach((e=>{const n=r.find((r=>A(j(e),j(r))))||e;a.includes(n)?a.push(e):a.push(n)})),a}function h(e){return!!e?.baseLayers.concat(e.referenceLayers).some(R)}function R(e){if(w(e.url))return!0;if("vector-tile"===e.type)for(const r in e.sourceNameToSource){const n=e.sourceNameToSource[r];if(w(n?.sourceUrl))return!0}return!1}function I(e,r){if(null==r||null==e)return{spatialReference:null,updating:!1};if("not-loaded"===r.loadStatus)return r.load(),{spatialReference:null,updating:!0};if(r.spatialReference)return{spatialReference:r.spatialReference,updating:!1};if(0===r.baseLayers.length)return{spatialReference:null,updating:!1};const n=r.baseLayers.at(0);switch(n.loadStatus){case"not-loaded":n.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const a=(("supportedSpatialReferences"in n?n.supportedSpatialReferences:null)||["tileInfo"in n?n.tileInfo?.spatialReference:n.spatialReference]).filter(Boolean),t=e.spatialReference;return t?{spatialReference:a.find((e=>t.equals(e)))??a[0]??null,updating:!1}:{spatialReference:a[0],updating:!1}}const T=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function w(e){if(!e)return!1;const r=new t(l(e));return!!r.authority&&T.test(r.authority)}function q(e){return e?!e.loaded&&e.resourceInfo?U(e.resourceInfo.data):{baseLayers:x(e.baseLayers),referenceLayers:x(e.referenceLayers)}:null}function x(e){return(n.isCollection(e)?e.toArray():e).map(j)}function j(e){return{type:e.type,url:B("urlTemplate"in e&&e.urlTemplate||e.url||"styleUrl"in e&&e.styleUrl||""),minScale:"minScale"in e&&null!=e.minScale?e.minScale:0,maxScale:"maxScale"in e&&null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visible||!!e.visible,sublayers:"map-image"!==e.type&&"wms"!==e.type||null==e.sublayers?void 0:e.sublayers?.map((e=>({id:e.id,visible:e.visible}))),activeLayerId:"wmts"===e.type?e.activeLayer?.id:void 0}}function U(e){return e?{baseLayers:M((e.baseMapLayers??[]).filter((e=>!e.isReference))),referenceLayers:M((e.baseMapLayers??[]).filter((e=>e.isReference)))}:null}function M(e){return e.map((e=>k(e)))}function k(e){let r;switch(e.layerType){case"VectorTileLayer":r="vector-tile";break;case"ArcGISTiledMapServiceLayer":r="tile";break;default:r="unknown"}return{type:r,url:B(e.templateUrl||e.urlTemplate||e.styleUrl||e.url),minScale:null!=e.minScale?e.minScale:0,maxScale:null!=e.maxScale?e.maxScale:0,opacity:null!=e.opacity?e.opacity:1,visible:null==e.visibility||!!e.visibility,sublayers:void 0,activeLayerId:void 0}}function $(e,r,n){if(null!=e!=(null!=r))return"not-equal";if(!e||!r)return"equal";if(!C(e.baseLayers,r.baseLayers))return"not-equal";return C(e.referenceLayers,r.referenceLayers)?"equal":n.mustMatchReferences?"not-equal":"base-layers-equal"}function C(e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!A(e[n],r[n]))return!1;return!0}function A(e,r){if(e.type!==r.type||"scene"===e.type||e.url!==r.url||e.minScale!==r.minScale||e.maxScale!==r.maxScale||e.visible!==r.visible||e.opacity!==r.opacity)return!1;if(null!=e.activeLayerId||null!=r.activeLayerId)return e.activeLayerId===r.activeLayerId;if(null!=e.sublayers||null!=r.sublayers){if(null==e.sublayers||null==r.sublayers||e.sublayers.length!==r.sublayers.length)return!1;for(let n=0;n<e.sublayers.length;n++){const a=e.sublayers.at(n),t=r.sublayers.at(n);if(a?.id!==t?.id||a?.visible!==t?.visible)return!1}}return!0}function B(e){return e?i(e).replace(/^\s*https?:/i,"").toLowerCase():""}export{d as clonePreservingTiledLayers,v as contentEquals,o as createCache,f as destroyCache,p as ensureType,I as findSpatialReference,L as getWellKnownBasemapId,h as hasDeveloperBasemapLayer,y as isBasemap3D,m as isBasemapLayer,R as isDeveloperBasemapLayer,S as overrideGetWellKnownBasemapId};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20230714",c="755c038b32d7f1500001f082ce08d39eb0ea0847";export{e as buildDate,c as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Logger.js";import{isPowerOfTwo as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as o}from"../../../../core/perspectiveUtils.js";import{watch as n,when as a,initial as m}from"../../../../core/reactiveUtils.js";import{c as h}from"../../../../chunks/mat3f64.js";import{s as l}from"../../../../chunks/vec2.js";import{a as c}from"../../../../chunks/vec2f64.js";import{DisplayObject as p}from"../DisplayObject.js";import{play as u}from"./animatedFormats/utils.js";import{BufferObject as d}from"../../../webgl/BufferObject.js";import{ContextType as f}from"../../../webgl/contextUtils.js";import{TextureWrapMode as w,Usage as g}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as y}from"../../../webgl/VertexArrayObject.js";const j=h();class _ extends p{constructor(s){super(),this.elementView=s,this.isWrapAround=!1,this.perspectiveTransform=c(),this._vertices=new Float32Array(20),this._handles=[],this._handles.push(n((()=>this.elementView.element.opacity),(e=>this.opacity=e),m),n((()=>[this.elementView.coords]),(()=>{this.requestRender()}),m),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&this._handles.push(t(e.content,"play",(()=>this.requestRender())))}),m)),s.element.load().catch((t=>{r.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:s,error:t}))}))}destroy(){this._handles.forEach((e=>e.remove())),this.texture=i(this.texture)}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,o=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(o,n),this.texture)i&&!r.paused&&(this.texture.setData(r),this.requestRender(),(t.type===f.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap());else{const e=new x;if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=o,e.height=n,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new v(t,e,r),this.requestRender()};"
|
|
5
|
+
import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Logger.js";import{isPowerOfTwo as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as o}from"../../../../core/perspectiveUtils.js";import{watch as n,when as a,initial as m}from"../../../../core/reactiveUtils.js";import{c as h}from"../../../../chunks/mat3f64.js";import{s as l}from"../../../../chunks/vec2.js";import{a as c}from"../../../../chunks/vec2f64.js";import{DisplayObject as p}from"../DisplayObject.js";import{play as u}from"./animatedFormats/utils.js";import{BufferObject as d}from"../../../webgl/BufferObject.js";import{ContextType as f}from"../../../webgl/contextUtils.js";import{TextureWrapMode as w,Usage as g}from"../../../webgl/enums.js";import{Texture as v}from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";import{VertexArrayObject as y}from"../../../webgl/VertexArrayObject.js";const j=h();class _ extends p{constructor(s){super(),this.elementView=s,this.isWrapAround=!1,this.perspectiveTransform=c(),this._vertices=new Float32Array(20),this._handles=[],this._handles.push(n((()=>this.elementView.element.opacity),(e=>this.opacity=e),m),n((()=>[this.elementView.coords]),(()=>{this.requestRender()}),m),a((()=>this.elementView.element.loaded),(()=>{const e=this.elementView.element;this.ready(),"video"===e.type&&null!=e.content&&this._handles.push(t(e.content,"play",(()=>this.requestRender())))}),m)),s.element.load().catch((t=>{r.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:s,error:t}))}))}destroy(){this._handles.forEach((e=>e.remove())),this.texture=i(this.texture)}get dvsMat3(){return this.parent.dvsMat3}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const e=r instanceof HTMLImageElement,i=r instanceof HTMLVideoElement,o=e?r.naturalWidth:i?r.videoWidth:r.width,n=e?r.naturalHeight:i?r.videoHeight:r.height;if(this._updatePerspectiveTransform(o,n),this.texture)i&&!r.paused&&(this.texture.setData(r),this.requestRender(),(t.type===f.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap());else{const e=new x;if(e.wrapMode=w.CLAMP_TO_EDGE,e.preMultiplyAlpha=!0,e.width=o,e.height=n,"getFrame"in r){const s=r=>{this.texture?this.texture.setData(r):this.texture=new v(t,e,r),this.requestRender()};"animationOptions"in this.elementView.element&&this._handles.push(u(r,this.elementView.element.animationOptions||{},null,s))}else this.texture=new v(t,e,r);(t.type===f.WEBGL2||s(o)&&s(n))&&this.texture.generateMipmap(),i&&!r.paused&&this.requestRender()}}super.beforeRender(e)}_createTransforms(){return null}updateDrawCoords(e,t){const r=this.elementView.coords;if(null==r)return;const[s,i,o,n]=r.rings[0],a=this._vertices,{x:m,y:h}=e,l=0!==t;l?a.set([i[0]-m,i[1]-h,s[0]-m,s[1]-h,o[0]-m,o[1]-h,n[0]-m,n[1]-h,n[0]-m,n[1]-h,i[0]+t-m,i[1]-h,i[0]+t-m,i[1]-h,s[0]+t-m,s[1]-h,o[0]+t-m,o[1]-h,n[0]+t-m,n[1]-h]):a.set([i[0]-m,i[1]-h,s[0]-m,s[1]-h,o[0]-m,o[1]-h,n[0]-m,n[1]-h]),this.isWrapAround=l}getVAO(e,t,r){if(null==this.elementView.coords)return null;const s=this._vertices;if(this._vao)this._geometryVbo.setData(s);else{this._geometryVbo=d.createVertex(e,g.DYNAMIC_DRAW,s);const i=d.createVertex(e,g.STATIC_DRAW,new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]));this._vao=new y(e,r,t,{geometry:this._geometryVbo,tex:i})}return this._vao}_updatePerspectiveTransform(e,t){const r=this._vertices;o(j,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),l(this.perspectiveTransform,j[6]/j[8]*e,j[7]/j[8]*t)}}export{_ 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{makeHandle as t}from"../../../../../core/handleUtils.js";import{Milliseconds as e}from"../../../../../core/time.js";import{imageTypeToCanvas as r}from"../../../../../geometry/support/meshUtils/exporters/gltf/imageutils.js";import{AnimatedSymbolRepeatType as i}from"../../../../../symbols/cim/enums.js";import{getMaterialGroup as a,getRandomValue as n}from"../grouping.js";function
|
|
5
|
+
import{makeHandle as t}from"../../../../../core/handleUtils.js";import{Milliseconds as e}from"../../../../../core/time.js";import{imageTypeToCanvas as r}from"../../../../../geometry/support/meshUtils/exporters/gltf/imageutils.js";import{AnimatedSymbolRepeatType as i}from"../../../../../symbols/cim/enums.js";import{getMaterialGroup as a,getRandomValue as n}from"../grouping.js";function o(t){return e(t.frameDurations.reduce(((t,e)=>t+e),0))}function s(t){const{width:e,height:r}=t,i=t.frameDurations.reverse(),a=e=>{const r=t.frameDurations.length-1-e;return t.getFrame(r)};return{frameCount:t.frameCount,duration:t.duration,frameDurations:i,getFrame:a,width:e,height:r}}function m(t,r){const{width:i,height:a,getFrame:n}=t,o=r/t.duration,s=t.frameDurations.map((t=>e(t*o)));return{frameCount:t.frameCount,duration:t.duration,frameDurations:s,getFrame:n,width:i,height:a}}function u(t,r){const{width:i,height:a,getFrame:n}=t,o=t.frameDurations.slice(),s=o.shift();return o.unshift(e(s+r)),{frameCount:t.frameCount,duration:t.duration+r,frameDurations:o,getFrame:n,width:i,height:a}}function h(t,r){const{width:i,height:a,getFrame:n}=t,o=t.frameDurations.slice(),s=o.pop();return o.push(e(s+r)),{frameCount:t.frameCount,duration:t.duration+r,frameDurations:o,getFrame:n,width:i,height:a}}class c{constructor(t,e,r,i){this._animation=t,this._repeatType=r,this._onFrameData=i,this._direction=1,this._currentFrame=0,this.timeToFrame=this._animation.frameDurations[this._currentFrame];let a=0;for(;e>a;)a+=this.timeToFrame,this.nextFrame();const n=this._animation.getFrame(this._currentFrame);this._onFrameData(n)}nextFrame(){if(this._currentFrame+=this._direction,this._direction>0){if(this._currentFrame===this._animation.frameDurations.length)switch(this._repeatType){case i.None:this._currentFrame-=this._direction;break;case i.Loop:this._currentFrame=0;break;case i.Oscillate:this._currentFrame-=this._direction,this._direction=-1}}else if(-1===this._currentFrame)switch(this._repeatType){case i.None:this._currentFrame-=this._direction;break;case i.Loop:this._currentFrame=this._animation.frameDurations.length-1;break;case i.Oscillate:this._currentFrame-=this._direction,this._direction=1}this.timeToFrame=this._animation.frameDurations[this._currentFrame];const t=this._animation.getFrame(this._currentFrame);this._onFrameData(t)}}function f(t,r,f,l){let d,{repeatType:g}=r;if(null==g&&(g=i.Loop),!0===r.reverseAnimation&&(t=s(t)),null!=r.duration&&(t=m(t,e(1e3*r.duration))),null!=r.repeatDelay){const a=1e3*r.repeatDelay;g===i.Loop?t=h(t,e(a)):g===i.Oscillate&&(t=u(h(t,e(a/2)),e(a/2)))}if(null!=r.startTimeOffset)d=e(1e3*r.startTimeOffset);else if(null!=r.randomizeStartTime){const i=a(f),s=82749913,m=null!=r.randomizeStartSeed?r.randomizeStartSeed:s,u=n(i,m);d=e(u*o(t))}else d=e(0);return new c(t,d,g,l)}function l(e,r,i,a){const n=null==r.playAnimation||r.playAnimation,o=f(e,r,i,a);let s,m=o.timeToFrame;function u(){s=n?setTimeout((()=>{o.nextFrame(),m=o.timeToFrame,u()}),m):void 0}return u(),t((()=>n&&clearTimeout(s)))}const d=document.createElement("canvas"),g=d.getContext("2d");function F(t,e,i){d.width=e,d.height=i;const a=[],n=t.frameDurations.length;for(let o=0;o<n;o++){const n=t.getFrame(o);g.clearRect(0,0,e,i),n instanceof ImageData?g.drawImage(r(n),0,0,e,i):g.drawImage(n,0,0,e,i),a.push(g.getImageData(0,0,e,i))}return{width:e,height:i,frameDurations:t.frameDurations,getFrame:t=>a[t],frameCount:t.frameCount,duration:t.duration}}export{c as Player,m as adjustDuration,h as appendDelay,f as createPlayer,o as getDuration,l as play,u as prependDelay,F as resize,s as reverse};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import"../../../../../intl.js";import i from"../../../../../core/Accessor.js";import{getAccentColor as s,getContrastColor as r,getTextHaloColor as n,getTextColor as a}from"../../../../../core/analysisThemeUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as l}from"../../../../../core/maybe.js";import{formatDecimal as h}from"../../../../../core/quantityFormatUtils.js";import{toUnit as c}from"../../../../../core/quantityUtils.js";import{watch as m,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{convertUnit as u,preferredImperialAreaUnit as d,preferredMetricAreaUnit as g,preferredImperialLengthUnit as L,preferredMetricLengthUnit as _}from"../../../../../core/unitUtils.js";import{property as b}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f}from"../../../../../chunks/mat4.js";import{c as S}from"../../../../../chunks/mat4f64.js";import{b as w}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{midpoint as j}from"../../support/viewUtils.js";import{LabelVisualElement as C}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as D}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as P,EuclideanSegment as V}from"../../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as M}from"../../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as R}from"../../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as U}from"../../../../../intl/locale.js";import{fetchMessageBundle as I}from"../../../../../intl/messages.js";let O=class extends i{get visible(){return this.analysisViewData.visible}get testData(){return{labels:{area:this._areaLabel,pathLength:this._pathLengthLabel,cursorSegmentLength:this._cursorSegmentLengthLabel,perimeterLength:this._perimeterLengthLabel}}}constructor(e){super(e),this._params={pathLineColor:t.toUnitRGBA(s()),pathLineWidth:3,intersectingLineColor:[1,.2,0,1],perimeterLineColor:t.toUnitRGBA(s()),perimeterLineWidth:2,projectionLineColor:t.toUnitRGBA(s()),projectionLineWidth:2,projectionLineStippleSize:5,areaColor1:t.toUnitRGBA(s(.5)),areaColor2:t.toUnitRGBA(r(.5)),labelDistance:25},this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._pathLengthLabel=null,this._cursorSegmentLengthLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._cursorSegment=null,this._origin=y(),this._originTransform=S(),this._cursorPositionRenderSpace=y(),this.messages=null,this.viewData=k,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_params:t,view:i}=this;this._path=new A({view:i,attached:!0,width:t.pathLineWidth,color:t.pathLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._intersectedPath=new A({view:i,attached:!0,width:t.pathLineWidth,color:t.intersectingLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._perimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,color:t.perimeterLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._intersectedPerimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,color:t.intersectingLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._projectionLines=new A({view:i,attached:!0,width:t.projectionLineWidth,color:t.projectionLineColor,stipplePattern:R(t.projectionLineStippleSize),polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._measurementArea=new D({view:i,attached:!0,color1:t.areaColor1,color2:t.areaColor2,isDecoration:!0});const s={attached:!0,backgroundColor:n(.6),calloutColor:n(.5),textColor:a(),view:i,isDecoration:!0};this._areaLabel=new C({...s,fontSize:z.Large}),this._pathLengthLabel=new C({...s,fontSize:z.Small}),this._cursorSegmentLengthLabel=new C({...s,fontSize:z.Small}),this._perimeterLengthLabel=new C({...s,fontSize:z.Small}),this.addHandles([m((()=>[e.mode,this.visible,e.unit,e.measurementData,e.cursorPoint]),(()=>this._update()),p),m((()=>i.state?.camera),(()=>this._updateLabels()),p),U((()=>this._updateMessageBundle()))]),this._updateMessageBundle()}destroy(){this._measurementArea=l(this._measurementArea),this._path=l(this._path),this._intersectedPath=l(this._intersectedPath),this._perimeter=l(this._perimeter),this._intersectedPerimeter=l(this._intersectedPerimeter),this._areaLabel=l(this._areaLabel),this._pathLengthLabel=l(this._pathLengthLabel),this._cursorSegmentLengthLabel=l(this._cursorSegmentLengthLabel),this._perimeterLengthLabel=l(this._perimeterLengthLabel),this._projectionLines=l(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:e},analysisViewData:t}=this;null!=e&&(this._updateViewData(e,t.path,t.cursorPoint),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(e,t,i){const s=t.isValidPolygon,r="geodesic"===e.actualMeasurementMode,n=r?e.geodesicArea:e.area;let a=1;if(n){const t=this._toPreferredAreaUnit(n,this.analysisViewData.unit);a=o(Math.sqrt(t.value)/Math.sqrt(300)),a*=Math.sqrt(u(1,t.unit,"square-meters")),a/=e.unitNormalizer.normalizeDistance(1)}const l={validMeasurement:s,path:t,pathVersion:t.version,cursorPoint:i,measurementData:e,mode:e.actualMeasurementMode,positionsGeographic:e.positionsGeographic,positionsRenderCoords:e.positionsRenderCoords,positionsProjected:e.positionsProjectedWorldCoords,positionsFittedRenderCoords:e.positionsFittedRenderCoords,intersectingSegments:r?e.geodesicIntersectingSegments:e.intersectingSegments,triangleIndices:r?e.geodesicTriangleIndices:e.triangleIndices,fittingMode:e.fittingMode,areaCentroid:r?e.geodesicAreaCentroidRenderCoords:e.areaCentroidRenderCoords,pathLengthLabelSegmentIndex:s?0:t.numVertices-2,perimeterLengthLabelSegmentIndex:0,checkerSize:a};this._set("viewData",l)}_updateOrigin(){const e=this.viewData;j(e.positionsRenderCoords,this._origin),f(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e){const t=this.viewData,i=t.path,s=this.view.renderCoordsHelper.spatialReference,r=t.mode,n=[],a=[],o=[],l=t.validMeasurement?i.numVertices:i.numVertices-1;for(let h=0;h<l;++h){const l=t[e][h],c=t[e][(h+1)%i.numVertices];let m=null;switch(r){case"euclidean":m=new V(l,c);break;case"geodesic":m=new P(l,c,s)}t.intersectingSegments.has(h)?o.push(m):a.push(m),n.push(m)}return{all:n,nonIntersecting:a,intersecting:o}}_updatePathSegments(){const{view:{renderCoordsHelper:e},viewData:t,visible:i}=this,s=this._createSegments("positionsRenderCoords"),{cursorPoint:r,mode:n,path:a}=t,o=!a.isValidPolygon,l=e.spatialReference;if(this._cursorSegment=null,a.numVertices>0&&o&&null!=r){if(e.toRenderCoords(r,this._cursorPositionRenderSpace)){const e=t.positionsRenderCoords[a.numVertices-1],i=this._cursorPositionRenderSpace;let r=null;switch(n){case"euclidean":r=new V(e,i);break;case"geodesic":r=new P(e,i,l)}s.nonIntersecting.push(r),this._cursorSegment=r}}this._path.setGeometryFromSegments(s.nonIntersecting,this._origin),this._path.visible=i,this._intersectedPath.setGeometryFromSegments(s.intersecting,this._origin),this._intersectedPath.visible=i,this._pathSegments=s.all}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode,t=this._createSegments("positionsFittedRenderCoords");this._perimeter.setGeometryFromSegments(t.nonIntersecting,this._origin),this._perimeter.visible=e,this._intersectedPerimeter.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPerimeter.visible=e,this._perimeterSegments=t.all}_updateArea(){const e=this.viewData;switch(e.mode){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&0===e.intersectingSegments.size&&e.triangleIndices?(this._measurementArea.geometry={uv:e.positionsProjected,position:e.positionsFittedRenderCoords,triangleIndices:e.triangleIndices},this._measurementArea.size=[e.checkerSize,e.checkerSize],this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const e=this.viewData,t=this.visible,i=e.path,s=e.mode;if(i.numVertices>0&&e.validMeasurement&&"euclidean"===s){const s=[];for(let t=0;t<i.numVertices;++t){const i=y();w(i,e.positionsRenderCoords[t],this._origin);const r=y();w(r,e.positionsFittedRenderCoords[t],this._origin),s.push([i,r])}this._projectionLines.geometry=s,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;const{viewData:e}=this,{measurementData:t,mode:i,path:s}=e;if(!s)return;const r=!s.isValidPolygon,n=this.visible,a=this._formatAreaLabel(this.messages,"geodesic"===i?t.geodesicArea:t.area,this.analysisViewData.unit);null!=a?(this._areaLabel.geometry={type:"point",point:e.areaCentroid},this._areaLabel.text=a,this._areaLabel.visible=e.validMeasurement&&0===e.intersectingSegments.size&&n):this._areaLabel.visible=!1,this._set("areaLabel",a);const o=this._formatLengthLabel(this.messages,"geodesic"===i?t.geodesicPathLength:t.pathLength,this.analysisViewData.unit);if(null!=o&&e.pathLengthLabelSegmentIndex>=0&&e.pathLengthLabelSegmentIndex<this._pathSegments.length){const t=this._pathSegments[e.pathLengthLabelSegmentIndex],i=null!=this._cursorSegment?this._cursorSegment:q;this._pathLengthLabel.distance=this._params.labelDistance,this._pathLengthLabel.geometry={type:"corner",left:t,right:i},this._pathLengthLabel.text=o,this._pathLengthLabel.visible=r&&s.numVertices>0&&n}else this._pathLengthLabel.visible=!1;const l="geodesic"===i?e.measurementData.geodesicCursorSegmentLength:e.measurementData.cursorSegmentLength;if(null!=l){const e=this._formatLengthLabel(this.messages,l,this.analysisViewData.unit);this._cursorSegmentLengthLabel.distance=this._params.labelDistance,this._cursorSegmentLengthLabel.geometry=null!=this._cursorSegment?{type:"segment",segment:this._cursorSegment,sampleLocation:"end"}:null,this._cursorSegmentLengthLabel.anchor="bottom",this._cursorSegmentLengthLabel.text=e,this._cursorSegmentLengthLabel.visible=r&&0!==l.value&&n}else this._cursorSegmentLengthLabel.visible=!1;this._cursorSegmentLengthLabel.overlaps(this._pathLengthLabel)&&(this._cursorSegmentLengthLabel.visible=!1),this._pathLengthLabel.overlaps(this._areaLabel)&&(this._pathLengthLabel.visible=!1);const h="geodesic"===e.mode,c=h?t.geodesicPathLength:t.perimeterLength,m=this._formatLengthLabel(this.messages,c,this.analysisViewData.unit);if(this._set("perimeterLengthLabel",m),e.validMeasurement&&0===e.intersectingSegments.size){this._perimeterLengthLabel.distance=this._params.labelDistance,this._perimeterLengthLabel.anchor="top",this._perimeterLengthLabel.text=m,this._perimeterLengthLabel.visible=!0;let t=!0;for(let i=0;i<e.path.numVertices;++i){const s=(e.perimeterLengthLabelSegmentIndex+i)%e.path.numVertices,r=h?this._pathSegments[s]:this._perimeterSegments[s];if(t=!0,this._perimeterLengthLabel.geometry={type:"segment",segment:r,sampleLocation:"center"},!this._perimeterLengthLabel.overlaps(this._areaLabel))break;t=!1}this._perimeterLengthLabel.visible=t&&n}else this._perimeterLengthLabel.visible=!1}_toPreferredAreaUnit(e,t){return c(e,this._preferredAreaUnit(e,t))}_preferredAreaUnit(e,t){switch(t){case"metric":return g(e.value,e.unit);case"imperial":return d(e.value,e.unit);default:return t}}_preferredLengthUnit(e,t){const i=this._deriveLengthUnitFromAreaUnit(t);switch(i){case"metric":return _(e.value,e.unit);case"imperial":return L(e.value,e.unit);default:return i}}_deriveLengthUnitFromAreaUnit(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";case"square-meters":return"meters";case"square-kilometers":return"kilometers"}throw new Error("unhandled area unit")}_formatAreaLabel(e,t,i){return e&&t&&h(e,t,this._preferredAreaUnit(t,i))}_formatLengthLabel(e,t,i){return e&&t&&h(e,t,this._preferredLengthUnit(t,i))}_updateMessageBundle(){this.loadingMessages=!0,I("esri/core/t9n/Units").then((e=>{this.messages=e,this.view&&this._update()})).finally((()=>{this.loadingMessages=!1}))}};var z;e([b()],O.prototype,"view",void 0),e([b()],O.prototype,"messages",void 0),e([b()],O.prototype,"analysis",void 0),e([b()],O.prototype,"viewData",void 0),e([b()],O.prototype,"analysisViewData",void 0),e([b({readOnly:!0})],O.prototype,"areaLabel",void 0),e([b({readOnly:!0})],O.prototype,"perimeterLengthLabel",void 0),e([b()],O.prototype,"loadingMessages",void 0),e([b()],O.prototype,"visible",null),O=e([v("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],O),function(e){e[e.Small=12]="Small",e[e.Large=16]="Large"}(z||(z={}));const k={validMeasurement:!1,path:null,pathVersion:-1,cursorPoint:null,measurementData:null,mode:null,positionsGeographic:null,positionsRenderCoords:null,positionsProjected:null,positionsFittedRenderCoords:null,intersectingSegments:null,triangleIndices:null,fittingMode:null,areaCentroid:null,pathLengthLabelSegmentIndex:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null},q=new V(y(),y());export{O as AreaMeasurementVisualization};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import"../../../../../intl.js";import i from"../../../../../core/Accessor.js";import{getAccentColor as s,getContrastColor as r,getTextHaloColor as n,getTextColor as a}from"../../../../../core/analysisThemeUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTen as o}from"../../../../../core/mathUtils.js";import{destroyMaybe as l}from"../../../../../core/maybe.js";import{formatDecimal as h}from"../../../../../core/quantityFormatUtils.js";import{toUnit as c}from"../../../../../core/quantityUtils.js";import{watch as m,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{convertUnit as u,preferredImperialAreaUnit as d,preferredMetricAreaUnit as g,preferredImperialLengthUnit as L,preferredMetricLengthUnit as _}from"../../../../../core/unitUtils.js";import{property as b}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{f}from"../../../../../chunks/mat4.js";import{c as S}from"../../../../../chunks/mat4f64.js";import{b as w}from"../../../../../chunks/vec3.js";import{c as y}from"../../../../../chunks/vec3f64.js";import{midpoint as j}from"../../support/viewUtils.js";import{LabelVisualElement as C}from"../../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../../interactive/visualElements/LineVisualElement.js";import{MeasurementAreaVisualElement as D}from"../../../interactive/visualElements/MeasurementAreaVisualElement.js";import{GeodesicSegment as P,EuclideanSegment as V}from"../../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as M}from"../../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as R}from"../../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as U}from"../../../../../intl/locale.js";import{fetchMessageBundle as I}from"../../../../../intl/messages.js";let O=class extends i{get visible(){return this.analysisViewData.visible}get testData(){return{labels:{area:this._areaLabel,pathLength:this._pathLengthLabel,cursorSegmentLength:this._cursorSegmentLengthLabel,perimeterLength:this._perimeterLengthLabel}}}constructor(e){super(e),this._params={pathLineColor:t.toUnitRGBA(s()),pathLineWidth:3,intersectingLineColor:[1,.2,0,1],perimeterLineColor:t.toUnitRGBA(s()),perimeterLineWidth:2,projectionLineColor:t.toUnitRGBA(s()),projectionLineWidth:2,projectionLineStippleSize:2.5,areaColor1:t.toUnitRGBA(s(.5)),areaColor2:t.toUnitRGBA(r(.5)),labelDistance:25},this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._pathLengthLabel=null,this._cursorSegmentLengthLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._cursorSegment=null,this._origin=y(),this._originTransform=S(),this._cursorPositionRenderSpace=y(),this.messages=null,this.viewData=k,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:e,_params:t,view:i}=this;this._path=new A({view:i,attached:!0,width:t.pathLineWidth,color:t.pathLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._intersectedPath=new A({view:i,attached:!0,width:t.pathLineWidth,color:t.intersectingLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._perimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,color:t.perimeterLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._intersectedPerimeter=new A({view:i,attached:!0,width:t.perimeterLineWidth,color:t.intersectingLineColor,polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._projectionLines=new A({view:i,attached:!0,width:t.projectionLineWidth,color:t.projectionLineColor,stipplePattern:R(t.projectionLineStippleSize),polygonOffset:!0,renderOccluded:M.OccludeAndTransparent,isDecoration:!0}),this._measurementArea=new D({view:i,attached:!0,color1:t.areaColor1,color2:t.areaColor2,isDecoration:!0});const s={attached:!0,backgroundColor:n(.6),calloutColor:n(.5),textColor:a(),view:i,isDecoration:!0};this._areaLabel=new C({...s,fontSize:z.Large}),this._pathLengthLabel=new C({...s,fontSize:z.Small}),this._cursorSegmentLengthLabel=new C({...s,fontSize:z.Small}),this._perimeterLengthLabel=new C({...s,fontSize:z.Small}),this.addHandles([m((()=>[e.mode,this.visible,e.unit,e.measurementData,e.cursorPoint]),(()=>this._update()),p),m((()=>i.state?.camera),(()=>this._updateLabels()),p),U((()=>this._updateMessageBundle()))]),this._updateMessageBundle()}destroy(){this._measurementArea=l(this._measurementArea),this._path=l(this._path),this._intersectedPath=l(this._intersectedPath),this._perimeter=l(this._perimeter),this._intersectedPerimeter=l(this._intersectedPerimeter),this._areaLabel=l(this._areaLabel),this._pathLengthLabel=l(this._pathLengthLabel),this._cursorSegmentLengthLabel=l(this._cursorSegmentLengthLabel),this._perimeterLengthLabel=l(this._perimeterLengthLabel),this._projectionLines=l(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:e},analysisViewData:t}=this;null!=e&&(this._updateViewData(e,t.path,t.cursorPoint),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(e,t,i){const s=t.isValidPolygon,r="geodesic"===e.actualMeasurementMode,n=r?e.geodesicArea:e.area;let a=1;if(n){const t=this._toPreferredAreaUnit(n,this.analysisViewData.unit);a=o(Math.sqrt(t.value)/Math.sqrt(300)),a*=Math.sqrt(u(1,t.unit,"square-meters")),a/=e.unitNormalizer.normalizeDistance(1)}const l={validMeasurement:s,path:t,pathVersion:t.version,cursorPoint:i,measurementData:e,mode:e.actualMeasurementMode,positionsGeographic:e.positionsGeographic,positionsRenderCoords:e.positionsRenderCoords,positionsProjected:e.positionsProjectedWorldCoords,positionsFittedRenderCoords:e.positionsFittedRenderCoords,intersectingSegments:r?e.geodesicIntersectingSegments:e.intersectingSegments,triangleIndices:r?e.geodesicTriangleIndices:e.triangleIndices,fittingMode:e.fittingMode,areaCentroid:r?e.geodesicAreaCentroidRenderCoords:e.areaCentroidRenderCoords,pathLengthLabelSegmentIndex:s?0:t.numVertices-2,perimeterLengthLabelSegmentIndex:0,checkerSize:a};this._set("viewData",l)}_updateOrigin(){const e=this.viewData;j(e.positionsRenderCoords,this._origin),f(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(e){const t=this.viewData,i=t.path,s=this.view.renderCoordsHelper.spatialReference,r=t.mode,n=[],a=[],o=[],l=t.validMeasurement?i.numVertices:i.numVertices-1;for(let h=0;h<l;++h){const l=t[e][h],c=t[e][(h+1)%i.numVertices];let m=null;switch(r){case"euclidean":m=new V(l,c);break;case"geodesic":m=new P(l,c,s)}t.intersectingSegments.has(h)?o.push(m):a.push(m),n.push(m)}return{all:n,nonIntersecting:a,intersecting:o}}_updatePathSegments(){const{view:{renderCoordsHelper:e},viewData:t,visible:i}=this,s=this._createSegments("positionsRenderCoords"),{cursorPoint:r,mode:n,path:a}=t,o=!a.isValidPolygon,l=e.spatialReference;if(this._cursorSegment=null,a.numVertices>0&&o&&null!=r){if(e.toRenderCoords(r,this._cursorPositionRenderSpace)){const e=t.positionsRenderCoords[a.numVertices-1],i=this._cursorPositionRenderSpace;let r=null;switch(n){case"euclidean":r=new V(e,i);break;case"geodesic":r=new P(e,i,l)}s.nonIntersecting.push(r),this._cursorSegment=r}}this._path.setGeometryFromSegments(s.nonIntersecting,this._origin),this._path.visible=i,this._intersectedPath.setGeometryFromSegments(s.intersecting,this._origin),this._intersectedPath.visible=i,this._pathSegments=s.all}_updatePerimeterSegments(){const e=this.visible&&"euclidean"===this.viewData.mode,t=this._createSegments("positionsFittedRenderCoords");this._perimeter.setGeometryFromSegments(t.nonIntersecting,this._origin),this._perimeter.visible=e,this._intersectedPerimeter.setGeometryFromSegments(t.intersecting,this._origin),this._intersectedPerimeter.visible=e,this._perimeterSegments=t.all}_updateArea(){const e=this.viewData;switch(e.mode){case"euclidean":this._updateAreaEuclidean(e);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(e){const t=this.visible;e.validMeasurement&&0===e.intersectingSegments.size&&e.triangleIndices?(this._measurementArea.geometry={uv:e.positionsProjected,position:e.positionsFittedRenderCoords,triangleIndices:e.triangleIndices},this._measurementArea.size=[e.checkerSize,e.checkerSize],this._measurementArea.visible=t):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const e=this.viewData,t=this.visible,i=e.path,s=e.mode;if(i.numVertices>0&&e.validMeasurement&&"euclidean"===s){const s=[];for(let t=0;t<i.numVertices;++t){const i=y();w(i,e.positionsRenderCoords[t],this._origin);const r=y();w(r,e.positionsFittedRenderCoords[t],this._origin),s.push([i,r])}this._projectionLines.geometry=s,this._projectionLines.visible=t}else this._projectionLines.geometry=null,this._projectionLines.visible=!1}_updateLabels(){if(this.destroyed)return;const{viewData:e}=this,{measurementData:t,mode:i,path:s}=e;if(!s)return;const r=!s.isValidPolygon,n=this.visible,a=this._formatAreaLabel(this.messages,"geodesic"===i?t.geodesicArea:t.area,this.analysisViewData.unit);null!=a?(this._areaLabel.geometry={type:"point",point:e.areaCentroid},this._areaLabel.text=a,this._areaLabel.visible=e.validMeasurement&&0===e.intersectingSegments.size&&n):this._areaLabel.visible=!1,this._set("areaLabel",a);const o=this._formatLengthLabel(this.messages,"geodesic"===i?t.geodesicPathLength:t.pathLength,this.analysisViewData.unit);if(null!=o&&e.pathLengthLabelSegmentIndex>=0&&e.pathLengthLabelSegmentIndex<this._pathSegments.length){const t=this._pathSegments[e.pathLengthLabelSegmentIndex],i=null!=this._cursorSegment?this._cursorSegment:q;this._pathLengthLabel.distance=this._params.labelDistance,this._pathLengthLabel.geometry={type:"corner",left:t,right:i},this._pathLengthLabel.text=o,this._pathLengthLabel.visible=r&&s.numVertices>0&&n}else this._pathLengthLabel.visible=!1;const l="geodesic"===i?e.measurementData.geodesicCursorSegmentLength:e.measurementData.cursorSegmentLength;if(null!=l){const e=this._formatLengthLabel(this.messages,l,this.analysisViewData.unit);this._cursorSegmentLengthLabel.distance=this._params.labelDistance,this._cursorSegmentLengthLabel.geometry=null!=this._cursorSegment?{type:"segment",segment:this._cursorSegment,sampleLocation:"end"}:null,this._cursorSegmentLengthLabel.anchor="bottom",this._cursorSegmentLengthLabel.text=e,this._cursorSegmentLengthLabel.visible=r&&0!==l.value&&n}else this._cursorSegmentLengthLabel.visible=!1;this._cursorSegmentLengthLabel.overlaps(this._pathLengthLabel)&&(this._cursorSegmentLengthLabel.visible=!1),this._pathLengthLabel.overlaps(this._areaLabel)&&(this._pathLengthLabel.visible=!1);const h="geodesic"===e.mode,c=h?t.geodesicPathLength:t.perimeterLength,m=this._formatLengthLabel(this.messages,c,this.analysisViewData.unit);if(this._set("perimeterLengthLabel",m),e.validMeasurement&&0===e.intersectingSegments.size){this._perimeterLengthLabel.distance=this._params.labelDistance,this._perimeterLengthLabel.anchor="top",this._perimeterLengthLabel.text=m,this._perimeterLengthLabel.visible=!0;let t=!0;for(let i=0;i<e.path.numVertices;++i){const s=(e.perimeterLengthLabelSegmentIndex+i)%e.path.numVertices,r=h?this._pathSegments[s]:this._perimeterSegments[s];if(t=!0,this._perimeterLengthLabel.geometry={type:"segment",segment:r,sampleLocation:"center"},!this._perimeterLengthLabel.overlaps(this._areaLabel))break;t=!1}this._perimeterLengthLabel.visible=t&&n}else this._perimeterLengthLabel.visible=!1}_toPreferredAreaUnit(e,t){return c(e,this._preferredAreaUnit(e,t))}_preferredAreaUnit(e,t){switch(t){case"metric":return g(e.value,e.unit);case"imperial":return d(e.value,e.unit);default:return t}}_preferredLengthUnit(e,t){const i=this._deriveLengthUnitFromAreaUnit(t);switch(i){case"metric":return _(e.value,e.unit);case"imperial":return L(e.value,e.unit);default:return i}}_deriveLengthUnitFromAreaUnit(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";case"square-meters":return"meters";case"square-kilometers":return"kilometers"}throw new Error("unhandled area unit")}_formatAreaLabel(e,t,i){return e&&t&&h(e,t,this._preferredAreaUnit(t,i))}_formatLengthLabel(e,t,i){return e&&t&&h(e,t,this._preferredLengthUnit(t,i))}_updateMessageBundle(){this.loadingMessages=!0,I("esri/core/t9n/Units").then((e=>{this.messages=e,this.view&&this._update()})).finally((()=>{this.loadingMessages=!1}))}};var z;e([b()],O.prototype,"view",void 0),e([b()],O.prototype,"messages",void 0),e([b()],O.prototype,"analysis",void 0),e([b()],O.prototype,"viewData",void 0),e([b()],O.prototype,"analysisViewData",void 0),e([b({readOnly:!0})],O.prototype,"areaLabel",void 0),e([b({readOnly:!0})],O.prototype,"perimeterLengthLabel",void 0),e([b()],O.prototype,"loadingMessages",void 0),e([b()],O.prototype,"visible",null),O=e([v("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],O),function(e){e[e.Small=12]="Small",e[e.Large=16]="Large"}(z||(z={}));const k={validMeasurement:!1,path:null,pathVersion:-1,cursorPoint:null,measurementData:null,mode:null,positionsGeographic:null,positionsRenderCoords:null,positionsProjected:null,positionsFittedRenderCoords:null,intersectingSegments:null,triangleIndices:null,fittingMode:null,areaCentroid:null,pathLengthLabelSegmentIndex:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null},q=new V(y(),y());export{O as AreaMeasurementVisualization};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../Color.js";import"../../../../intl.js";import s from"../../../../core/Accessor.js";import{makeHandle as t,destroyHandle as a}from"../../../../core/handleUtils.js";import{mapCollection as r,watch as n,syncAndInitial as o,when as l,sync as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../Color.js";import"../../../../intl.js";import s from"../../../../core/Accessor.js";import{makeHandle as t,destroyHandle as a}from"../../../../core/handleUtils.js";import{mapCollection as r,watch as n,syncAndInitial as o,when as l,sync as m}from"../../../../core/reactiveUtils.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{Z as p}from"../../../../chunks/vec4f64.js";import{LengthDimensionVisualization as u}from"./LengthDimensionVisualization.js";import{settings as f}from"./settings.js";import{RenderOccludedFlag as g}from"../../webgl-engine/lib/Material.js";import{LineMarkerMaterial as M}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{createStipplePatternSimple as _}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as y}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{LineMarkerAnchor as w}from"../../webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{onLocaleChange as v}from"../../../../intl/locale.js";import{fetchMessageBundle as L}from"../../../../intl/messages.js";let z=class extends s{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(e){super(e),this.loadingMessages=!1,this._messages=null}initialize(){const e=this.isDecoration;this._markerMaterial=new M({width:1,anchor:w.Tip,color:p,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:g.OccludeAndTransparent,markerPrimitive:"triangle",isDecoration:e}),this._dimensionLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,markerParameters:this._markerMaterial.parameters,isDecoration:e}),this._offsetLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,stipplePattern:_(5),isDecoration:e}),this._smallDimensionLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,isDecoration:e}),this._smallOffsetLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,stipplePattern:_(5),isDecoration:e});for(const i of this._lineMaterials())this.view._stage.add(i),this.addHandles(t((()=>{this.view._stage?.remove(i),i.dispose()})));const s=r((()=>this.analysisViewData.computations),(({computation:e})=>this._createVisualization(e)));this._dimensionVisualizations=s,this.addHandles([a(s),n((()=>i.toUnitRGBA(this.analysis.style.color)),(e=>{for(const i of this._lineMaterials())i.setParameters({color:e})}),o),n((()=>this.analysis.style.lineSize),(e=>{const i=c(e);this._markerMaterial.setParameters({width:i*f.markers.lineSizeFraction}),this._dimensionLineMaterial.setParameters({width:i,markerParameters:this._markerMaterial.parameters});const s=Math.max(i*f.offsetLine.lineSizeFraction,1);this._offsetLineMaterial.setParameters({width:s})}),o),n((()=>({camera:this.view.state.camera,style:j(this.analysis)})),(({camera:e,style:i})=>{for(const{visualization:s}of this._dimensionVisualizations)s.updateCameraDependentElements(e,s.computation.geometry,i),s.updateLabelStyle(i)})),n((()=>this.visible),(e=>{for(const{visualization:i}of this._dimensionVisualizations)i.visible=e}))]),this.addHandles([v((()=>this._updateMessageBundle())),l((()=>!this.loadingMessages),(()=>{for(const{visualization:e}of this._dimensionVisualizations)e.updateUnitsMessages(this._messages)}),m)]),this._updateMessageBundle()}get testInfo(){return{visualizations:this._dimensionVisualizations.items.map((({visualization:e})=>e)),disablePartialOcclusion:()=>{for(const e of this._lineMaterials())e.setParameters({renderOccluded:g.Occlude})}}}_createVisualization(e){const i=new u({analysis:this.analysis,computation:e,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:i,remove:()=>i.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await L("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function j(e){const{fontSize:i,lineSize:s,textColor:t,textBackgroundColor:a}=e.style;return{fontSize:i,lineSize:s,textBackgroundColor:a.clone(),textColor:t.clone()}}e([d({constructOnly:!0})],z.prototype,"analysisViewData",void 0),e([d({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),e([d({constructOnly:!0})],z.prototype,"isDecoration",void 0),e([d()],z.prototype,"analysis",null),e([d()],z.prototype,"visible",null),e([d()],z.prototype,"loadingMessages",void 0),z=e([h("esri.views.3d.analysis.Dimension.DimensionVisualization")],z);export{z as DimensionVisualization};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Color.js";import"../../../../intl.js";import i from"../../../../core/Accessor.js";import{getAccentColor as s,getTextHaloColor as n,getTextColor as o}from"../../../../core/analysisThemeUtils.js";import{nextHighestPowerOfTen as l,deg2rad as a}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{formatDecimal as c,formatImperialLength as d,formatImperialVerticalLength as h,formatMetricLength as u,formatMetricVerticalLength as m}from"../../../../core/quantityFormatUtils.js";import{toUnit as g}from"../../../../core/quantityUtils.js";import{watch as p,syncAndInitial as _}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as v,createRenderScreenPointArray as b}from"../../../../core/screenUtils.js";import{preferredImperialLengthUnit as L,convertUnit as w}from"../../../../core/unitUtils.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as f}from"../../../../chunks/vec2.js";import{g as A,a as P}from"../../../../chunks/vec3.js";import{c as V}from"../../../../chunks/vec3f64.js";import{MeasurementMode as j}from"../interfaces.js";import{ViewMode as E,VisualElementOrientation as z}from"./interfaces.js";import{screenSpaceTangent as M}from"../support/viewUtils.js";import{LabelVisualElement as D,mirrorPosition as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as G}from"../../interactive/visualElements/LineVisualElement.js";import{MeasurementArrowVisualElement as C}from"../../interactive/visualElements/MeasurementArrowVisualElement.js";import{RightAngleQuadVisualElement as x}from"../../interactive/visualElements/RightAngleQuadVisualElement.js";import{GeodesicSegment as T,EuclideanSegment as H}from"../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as U}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as k}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as R}from"../../../../intl/locale.js";import{fetchMessageBundle as F}from"../../../../intl/messages.js";let B=class extends i{get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(null==e||null==t||e.equals(t))return E.None;const i=this.analysisView.result;if(null==i)return E.Direct;if("geodesic"===i.mode)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?E.ProjectedGeodesic:E.Direct;const{verticalDistance:s,horizontalDistance:n}=i,o=s.value,l=n.value;return Math.min(o/l,l/o)<this.triangleCollapseRatioThreshold?E.Direct:E.Triangle}get actualVisualizedMeasurement(){if(null==this.analysisView.result)switch(this.analysisView.measurementMode){case j.Auto:case j.Euclidean:default:return"euclidean";case j.Geodesic:return"geodesic"}return this.analysisView.result.mode}get allowVisualElementsOrientationChange(){return null==this._triangleOrientationOverride}set allowVisualElementsOrientationChange(e){null==this._triangleOrientationOverride!==e&&(null==this._triangleOrientationOverride?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){const e="geodesic"===this.actualVisualizedMeasurement;return{direct:this._segmentLabel,horizontal:e?this._segmentLabel:this._horizontalLabel,vertical:this._verticalLabel}}constructor(e){super(e),this._params={triangleColor:t.toUnitRGBA(s(.75)),triangleLineWidth:3,geodesicProjectionLineWidth:2,geodesicProjectionLineColor:t.toUnitRGBA(s(.75)),guideLineWidth:2,guideStippleLengthPixels:6,directLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12},this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=V(),this._endPosition=V(),this._cornerPosition=V(),this._startPositionAtSeaLevel=V(),this._endPositionAtSeaLevel=V(),this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=z.Auto,this.triangleCollapseRatioThreshold=.03}initialize(){const e=this._params,i={attached:!0,view:this.view,isDecoration:!0};this._segmentVisualElement=new C({...i,geometry:null,renderOccluded:U.OccludeAndTransparent}),this._triangleVisualElement=new G({...i,width:e.triangleLineWidth,color:e.triangleColor,renderOccluded:U.OccludeAndTransparent}),this._rightAngleQuad=new x({...i,color:t.toUnitRGBA(s(.75)),renderOccluded:U.OccludeAndTransparent});const l={...i,polygonOffset:!0,renderOccluded:U.OccludeAndTransparent};this._projectedGeodesicLine=new G({...l,width:e.geodesicProjectionLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:k(e.guideStippleLengthPixels)}),this._geodesicStartHint=new G({...l,width:e.guideLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:k(e.guideStippleLengthPixels)}),this._geodesicEndHint=new G({...l,width:e.guideLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:k(e.guideStippleLengthPixels)});const a={...i,backgroundColor:n(.6),calloutColor:n(.5),textColor:o()};this._segmentLabel=new D({...a,fontSize:e.directLabelFontSize}),this._verticalLabel=new D({...a,fontSize:e.verticalLabelFontSize}),this._horizontalLabel=new D({...a,fontSize:e.horizontalLabelFontSize}),this.addHandles([p((()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}}),(e=>this._updateGeometryAndViewMode(e)),_),p((()=>({visible:this.visible,viewMode:this.viewMode})),(e=>this._updateVisualElementVisibility(e)),_),p((()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement})),(e=>this._updateLabelText(e)),_),p((()=>({visible:this.visible,viewMode:this.viewMode})),(e=>this._updateLabelVisibility(e)),_),p((()=>this._measurementArrowStripeLength),(e=>this._updateSegmentStripeLength(e)),_),R((async()=>this._updateMessageBundle()))]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=r(this._segmentVisualElement),this._triangleVisualElement=r(this._triangleVisualElement),this._rightAngleQuad=r(this._rightAngleQuad),this._projectedGeodesicLine=r(this._projectedGeodesicLine),this._geodesicStartHint=r(this._geodesicStartHint),this._geodesicEndHint=r(this._geodesicEndHint),this._segmentLabel=r(this._segmentLabel),this._verticalLabel=r(this._verticalLabel),this._horizontalLabel=r(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case E.None:break;case E.Direct:this._segmentVisualElement.visible=!0;break;case E.Triangle:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case E.ProjectedGeodesic:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:o,visualizedMeasurement:l,stripeLength:a}){const r=e.renderCoordsHelper;if(null==r||null==s||null==n||s.equals(n))return;let c=this._startPosition,d=this._endPosition;r.toRenderCoords(s,c),r.toRenderCoords(n,d);const h=o===z.AboveSegment?1:-1,u=h*(r.getAltitude(d)-r.getAltitude(c));u<0&&(c=this._endPosition,d=this._startPosition);const m="geodesic"===l?new T(this._startPosition,this._endPosition,r.spatialReference):new H(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=m,this._updateSegmentStripeLength(a),i){case E.Direct:this._updateSegment(m,o);break;case E.Triangle:this._updateSegmentAndTriangle({view:e,camera:t,segment:m,orientation:o,startPosition:c,endPosition:d,deltaSign:h,altitudeDelta:u});break;case E.ProjectedGeodesic:this._updateSegmentAndProjection({view:e,orientation:o,startPosition:c,endPosition:d})}}_updateSegment(e,t){this._segmentLabel.anchor=t===z.AboveSegment?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:s,startPosition:n,endPosition:o,deltaSign:l,altitudeDelta:a}){const r=this._cornerPosition;e.worldUpAtPosition(n,r),A(r,r,l*Math.abs(a)),P(r,r,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[r[0],r[1],r[2]],[o[0],o[1],o[2]]]],this._rightAngleQuad.geometry={previous:n,center:r,next:o};const c=new H(n,r),d=new H(r,o),h=Q(n,o,r,s,t);this._segmentLabel.anchor=h.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=h.vertical,this._horizontalLabel.geometry={type:"segment",segment:d,sampleLocation:"center"},this._horizontalLabel.anchor=h.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:s}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new T(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new H(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new H(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=t===z.AboveSegment?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){null!=e?(this._segmentLabel.text="euclidean"===t?e.euclideanDistance:e.geodesicDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:e,viewMode:t}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,e)switch(t){case E.Direct:i.visible=!0;break;case E.Triangle:i.visible=!0,s.visible=!0,n.visible=!0;break;case E.ProjectedGeodesic:i.visible=!0;case E.None:}}get _labelsText(){if(this.destroyed)return null;const e=this.messages,t=this.analysisView.result;if(null==t||null==e)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n,geodesicDistance:o}=t,l=this.analysisView.unit,a=e=>({euclideanDistance:"",geodesicDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(l){case"metric":return a({euclideanDistance:i&&u(e,i),geodesicDistance:o&&u(e,o),horizontalDistance:s&&u(e,s),verticalDistance:n&&m(e,n)});case"imperial":return a({euclideanDistance:i&&d(e,i),geodesicDistance:o&&d(e,o),horizontalDistance:s&&d(e,s),verticalDistance:n&&h(e,n)});default:return a({euclideanDistance:i&&c(e,i,l),geodesicDistance:o&&c(e,o,l),horizontalDistance:s&&c(e,s,l),verticalDistance:n&&c(e,n,l)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;null!=e?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(null!=this._triangleOrientationOverride)return this._triangleOrientationOverride;const e=this.visualElementOrientation;return e===z.Auto?this.view.state.camera.aboveGround?z.AboveSegment:z.BelowSegment:e}_requiresGeodesicGuideAt(e){const t=this.view;if(!t?.state)return!1;const i=t.state.camera,s=t.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(e);return s.getAltitude(e)/n>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(null==e)return null;let i=null;const s=e.directDistance;switch(t){case"metric":i=s&&g(s,"meters");break;case"imperial":i=s&&g(s,L(s.value,s.unit));break;default:i=s&&g(s,t)}if(null==i)return null;return l(i.value/30)*w(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,F("esri/core/t9n/Units").then((e=>{this.messages=e})).finally((()=>{this.loadingMessages=!1}))}get testData(){return{labels:this.labels,stripeLength:this._segmentVisualElement?.stripeLength}}};function Q(e,t,i,s,n){const o=W,l=N;n.projectToRenderScreen(i,o),n.projectToRenderScreen(t,l);const a={segment:"bottom",horizontal:"top",vertical:o[0]<l[0]?"left":"right"};{const s=I,o=J;if(M(e,i,s,n),M(e,t,o,n),f(s,o)>=q){const e=Math.sign(s[1])===Math.sign(o[1]);a.segment=e?O(a.vertical):a.vertical}else{const e=K;M(i,t,e,n),f(e,o)>=q&&(a.segment=Math.sign(e[0])===Math.sign(o[0])?O(a.horizontal):a.horizontal)}}if(s===z.BelowSegment){const e=e=>"top"===e?"bottom":"top";a.segment=e(a.segment),a.horizontal=e(a.horizontal),a.vertical=e(a.vertical)}return a}e([S()],B.prototype,"_triangleOrientationOverride",void 0),e([S()],B.prototype,"messages",void 0),e([S()],B.prototype,"view",void 0),e([S()],B.prototype,"analysis",void 0),e([S()],B.prototype,"analysisView",void 0),e([S()],B.prototype,"loadingMessages",void 0),e([S()],B.prototype,"visible",null),e([S()],B.prototype,"viewMode",null),e([S()],B.prototype,"actualVisualizedMeasurement",null),e([S()],B.prototype,"visualElementOrientation",void 0),e([S()],B.prototype,"triangleCollapseRatioThreshold",void 0),e([S()],B.prototype,"allowVisualElementsOrientationChange",null),e([S()],B.prototype,"labels",null),e([S()],B.prototype,"_labelsText",null),e([S()],B.prototype,"_actualVisualElementsOrientation",null),e([S()],B.prototype,"_measurementArrowStripeLength",null),B=e([y("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],B);const q=Math.cos(a(12)),W=v(),N=v(),I=b(),J=b(),K=b();export{B as DirectLineMeasurementVisualization};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Color.js";import"../../../../intl.js";import i from"../../../../core/Accessor.js";import{getAccentColor as s,getTextHaloColor as n,getTextColor as o}from"../../../../core/analysisThemeUtils.js";import{nextHighestPowerOfTen as l,deg2rad as a}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{formatDecimal as c,formatImperialLength as d,formatImperialVerticalLength as h,formatMetricLength as u,formatMetricVerticalLength as m}from"../../../../core/quantityFormatUtils.js";import{toUnit as g}from"../../../../core/quantityUtils.js";import{watch as p,syncAndInitial as _}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as v,createRenderScreenPointArray as b}from"../../../../core/screenUtils.js";import{preferredImperialLengthUnit as L,convertUnit as w}from"../../../../core/unitUtils.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{g as f}from"../../../../chunks/vec2.js";import{g as A,a as P}from"../../../../chunks/vec3.js";import{c as V}from"../../../../chunks/vec3f64.js";import{MeasurementMode as j}from"../interfaces.js";import{ViewMode as E,VisualElementOrientation as z}from"./interfaces.js";import{screenSpaceTangent as M}from"../support/viewUtils.js";import{LabelVisualElement as D,mirrorPosition as O}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as G}from"../../interactive/visualElements/LineVisualElement.js";import{MeasurementArrowVisualElement as C}from"../../interactive/visualElements/MeasurementArrowVisualElement.js";import{RightAngleQuadVisualElement as x}from"../../interactive/visualElements/RightAngleQuadVisualElement.js";import{GeodesicSegment as T,EuclideanSegment as H}from"../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as U}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as k}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as R}from"../../../../intl/locale.js";import{fetchMessageBundle as F}from"../../../../intl/messages.js";let B=class extends i{get visible(){return this.analysisView.visible}get viewMode(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView;if(null==e||null==t||e.equals(t))return E.None;const i=this.analysisView.result;if(null==i)return E.Direct;if("geodesic"===i.mode)return this._requiresGeodesicGuideAt(this._startPosition)||this._requiresGeodesicGuideAt(this._endPosition)?E.ProjectedGeodesic:E.Direct;const{verticalDistance:s,horizontalDistance:n}=i,o=s.value,l=n.value;return Math.min(o/l,l/o)<this.triangleCollapseRatioThreshold?E.Direct:E.Triangle}get actualVisualizedMeasurement(){if(null==this.analysisView.result)switch(this.analysisView.measurementMode){case j.Auto:case j.Euclidean:default:return"euclidean";case j.Geodesic:return"geodesic"}return this.analysisView.result.mode}get allowVisualElementsOrientationChange(){return null==this._triangleOrientationOverride}set allowVisualElementsOrientationChange(e){null==this._triangleOrientationOverride!==e&&(null==this._triangleOrientationOverride?this._triangleOrientationOverride=this._actualVisualElementsOrientation:this._triangleOrientationOverride=null)}get labels(){const e="geodesic"===this.actualVisualizedMeasurement;return{direct:this._segmentLabel,horizontal:e?this._segmentLabel:this._horizontalLabel,vertical:this._verticalLabel}}constructor(e){super(e),this._params={triangleColor:t.toUnitRGBA(s(.75)),triangleLineWidth:3,geodesicProjectionLineWidth:2,geodesicProjectionLineColor:t.toUnitRGBA(s(.75)),guideLineWidth:2,guideStippleLengthPixels:3,directLabelFontSize:16,horizontalLabelFontSize:12,verticalLabelFontSize:12},this._segmentVisualElement=null,this._triangleVisualElement=null,this._rightAngleQuad=null,this._projectedGeodesicLine=null,this._geodesicStartHint=null,this._geodesicEndHint=null,this._segmentLabel=null,this._verticalLabel=null,this._horizontalLabel=null,this._startPosition=V(),this._endPosition=V(),this._cornerPosition=V(),this._startPositionAtSeaLevel=V(),this._endPositionAtSeaLevel=V(),this._triangleOrientationOverride=null,this.messages=null,this.loadingMessages=!0,this.visualElementOrientation=z.Auto,this.triangleCollapseRatioThreshold=.03}initialize(){const e=this._params,i={attached:!0,view:this.view,isDecoration:!0};this._segmentVisualElement=new C({...i,geometry:null,renderOccluded:U.OccludeAndTransparent}),this._triangleVisualElement=new G({...i,width:e.triangleLineWidth,color:e.triangleColor,renderOccluded:U.OccludeAndTransparent}),this._rightAngleQuad=new x({...i,color:t.toUnitRGBA(s(.75)),renderOccluded:U.OccludeAndTransparent});const l={...i,polygonOffset:!0,renderOccluded:U.OccludeAndTransparent};this._projectedGeodesicLine=new G({...l,width:e.geodesicProjectionLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:k(e.guideStippleLengthPixels)}),this._geodesicStartHint=new G({...l,width:e.guideLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:k(e.guideStippleLengthPixels)}),this._geodesicEndHint=new G({...l,width:e.guideLineWidth,color:e.geodesicProjectionLineColor,stipplePattern:k(e.guideStippleLengthPixels)});const a={...i,backgroundColor:n(.6),calloutColor:n(.5),textColor:o()};this._segmentLabel=new D({...a,fontSize:e.directLabelFontSize}),this._verticalLabel=new D({...a,fontSize:e.verticalLabelFontSize}),this._horizontalLabel=new D({...a,fontSize:e.horizontalLabelFontSize}),this.addHandles([p((()=>{const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}=this.analysisView,i=this.view;return{view:i,camera:i.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}}),(e=>this._updateGeometryAndViewMode(e)),_),p((()=>({visible:this.visible,viewMode:this.viewMode})),(e=>this._updateVisualElementVisibility(e)),_),p((()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement})),(e=>this._updateLabelText(e)),_),p((()=>({visible:this.visible,viewMode:this.viewMode})),(e=>this._updateLabelVisibility(e)),_),p((()=>this._measurementArrowStripeLength),(e=>this._updateSegmentStripeLength(e)),_),R((async()=>this._updateMessageBundle()))]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=r(this._segmentVisualElement),this._triangleVisualElement=r(this._triangleVisualElement),this._rightAngleQuad=r(this._rightAngleQuad),this._projectedGeodesicLine=r(this._projectedGeodesicLine),this._geodesicStartHint=r(this._geodesicStartHint),this._geodesicEndHint=r(this._geodesicEndHint),this._segmentLabel=r(this._segmentLabel),this._verticalLabel=r(this._verticalLabel),this._horizontalLabel=r(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:e,viewMode:t}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,e)switch(t){case E.None:break;case E.Direct:this._segmentVisualElement.visible=!0;break;case E.Triangle:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case E.ProjectedGeodesic:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:e,camera:t,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:o,visualizedMeasurement:l,stripeLength:a}){const r=e.renderCoordsHelper;if(null==r||null==s||null==n||s.equals(n))return;let c=this._startPosition,d=this._endPosition;r.toRenderCoords(s,c),r.toRenderCoords(n,d);const h=o===z.AboveSegment?1:-1,u=h*(r.getAltitude(d)-r.getAltitude(c));u<0&&(c=this._endPosition,d=this._startPosition);const m="geodesic"===l?new T(this._startPosition,this._endPosition,r.spatialReference):new H(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=m,this._updateSegmentStripeLength(a),i){case E.Direct:this._updateSegment(m,o);break;case E.Triangle:this._updateSegmentAndTriangle({view:e,camera:t,segment:m,orientation:o,startPosition:c,endPosition:d,deltaSign:h,altitudeDelta:u});break;case E.ProjectedGeodesic:this._updateSegmentAndProjection({view:e,orientation:o,startPosition:c,endPosition:d})}}_updateSegment(e,t){this._segmentLabel.anchor=t===z.AboveSegment?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:e,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:e},camera:t,segment:i,orientation:s,startPosition:n,endPosition:o,deltaSign:l,altitudeDelta:a}){const r=this._cornerPosition;e.worldUpAtPosition(n,r),A(r,r,l*Math.abs(a)),P(r,r,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[r[0],r[1],r[2]],[o[0],o[1],o[2]]]],this._rightAngleQuad.geometry={previous:n,center:r,next:o};const c=new H(n,r),d=new H(r,o),h=Q(n,o,r,s,t);this._segmentLabel.anchor=h.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:c,sampleLocation:"center"},this._verticalLabel.anchor=h.vertical,this._horizontalLabel.geometry={type:"segment",segment:d,sampleLocation:"center"},this._horizontalLabel.anchor=h.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:e},orientation:t,startPosition:i,endPosition:s}){e.setAltitude(this._startPositionAtSeaLevel,0,i),e.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new T(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,e.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new H(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new H(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=t===z.AboveSegment?"top":"bottom"}_updateLabelText({text:e,visualizedMeasurement:t}){null!=e?(this._segmentLabel.text="euclidean"===t?e.euclideanDistance:e.geodesicDistance,this._horizontalLabel.text=e.horizontalDistance,this._verticalLabel.text=e.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:e,viewMode:t}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,e)switch(t){case E.Direct:i.visible=!0;break;case E.Triangle:i.visible=!0,s.visible=!0,n.visible=!0;break;case E.ProjectedGeodesic:i.visible=!0;case E.None:}}get _labelsText(){if(this.destroyed)return null;const e=this.messages,t=this.analysisView.result;if(null==t||null==e)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n,geodesicDistance:o}=t,l=this.analysisView.unit,a=e=>({euclideanDistance:"",geodesicDistance:"",horizontalDistance:"",verticalDistance:"",...e});switch(l){case"metric":return a({euclideanDistance:i&&u(e,i),geodesicDistance:o&&u(e,o),horizontalDistance:s&&u(e,s),verticalDistance:n&&m(e,n)});case"imperial":return a({euclideanDistance:i&&d(e,i),geodesicDistance:o&&d(e,o),horizontalDistance:s&&d(e,s),verticalDistance:n&&h(e,n)});default:return a({euclideanDistance:i&&c(e,i,l),geodesicDistance:o&&c(e,o,l),horizontalDistance:s&&c(e,s,l),verticalDistance:n&&c(e,n,l)})}}_updateSegmentStripeLength(e){const t=this._segmentVisualElement;null!=e?(t.stripeLength=e,t.stripesEnabled=!0):t.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(null!=this._triangleOrientationOverride)return this._triangleOrientationOverride;const e=this.visualElementOrientation;return e===z.Auto?this.view.state.camera.aboveGround?z.AboveSegment:z.BelowSegment:e}_requiresGeodesicGuideAt(e){const t=this.view;if(!t?.state)return!1;const i=t.state.camera,s=t.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(e);return s.getAltitude(e)/n>=10}get _measurementArrowStripeLength(){const{result:e,unit:t}=this.analysisView;if(null==e)return null;let i=null;const s=e.directDistance;switch(t){case"metric":i=s&&g(s,"meters");break;case"imperial":i=s&&g(s,L(s.value,s.unit));break;default:i=s&&g(s,t)}if(null==i)return null;return l(i.value/30)*w(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,F("esri/core/t9n/Units").then((e=>{this.messages=e})).finally((()=>{this.loadingMessages=!1}))}get testData(){return{labels:this.labels,stripeLength:this._segmentVisualElement?.stripeLength}}};function Q(e,t,i,s,n){const o=W,l=N;n.projectToRenderScreen(i,o),n.projectToRenderScreen(t,l);const a={segment:"bottom",horizontal:"top",vertical:o[0]<l[0]?"left":"right"};{const s=I,o=J;if(M(e,i,s,n),M(e,t,o,n),f(s,o)>=q){const e=Math.sign(s[1])===Math.sign(o[1]);a.segment=e?O(a.vertical):a.vertical}else{const e=K;M(i,t,e,n),f(e,o)>=q&&(a.segment=Math.sign(e[0])===Math.sign(o[0])?O(a.horizontal):a.horizontal)}}if(s===z.BelowSegment){const e=e=>"top"===e?"bottom":"top";a.segment=e(a.segment),a.horizontal=e(a.horizontal),a.vertical=e(a.vertical)}return a}e([S()],B.prototype,"_triangleOrientationOverride",void 0),e([S()],B.prototype,"messages",void 0),e([S()],B.prototype,"view",void 0),e([S()],B.prototype,"analysis",void 0),e([S()],B.prototype,"analysisView",void 0),e([S()],B.prototype,"loadingMessages",void 0),e([S()],B.prototype,"visible",null),e([S()],B.prototype,"viewMode",null),e([S()],B.prototype,"actualVisualizedMeasurement",null),e([S()],B.prototype,"visualElementOrientation",void 0),e([S()],B.prototype,"triangleCollapseRatioThreshold",void 0),e([S()],B.prototype,"allowVisualElementsOrientationChange",null),e([S()],B.prototype,"labels",null),e([S()],B.prototype,"_labelsText",null),e([S()],B.prototype,"_actualVisualElementsOrientation",null),e([S()],B.prototype,"_measurementArrowStripeLength",null),B=e([y("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],B);const q=Math.cos(a(12)),W=v(),N=v(),I=b(),J=b(),K=b();export{B as DirectLineMeasurementVisualization};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{getAccentColor as t,getContrastColor as o}from"../../../../core/analysisThemeUtils.js";import{memoize as i}from"../../../../core/memoize.js";import{ExtensionType as l}from"../visualElements/ExtendedLineVisualElement.js";import{RenderOccludedFlag as s}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as n}from"../../webgl-engine/materials/lineStippleUtils.js";import{desaturate as r,multiplyOpacity as h,unitRGBAFromColor as c}from"../../../support/colorUtils.js";const a=i((i=>({accent:t(),contrast:o(),selected:new e([255,255,255]),selectedOutline:new e([255,255,255]),staged:new e([12,207,255]),outline:new e([0,0,0,.5])}))),d=.3;function p(e,t){t&&Object.assign(e,t)}class u{constructor({theme:e,...t}){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=s.Opaque,this.color=a(e).accent,p(this,t)}}class g{constructor({theme:e,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9;const o=a(e);this.color=o.accent,this.outlineColor=o.outline,this.renderOccluded=s.Opaque,this.hoverOutlineColor=o.selectedOutline,p(this,t)}apply(e,t){const o=this[e];t.setParameters({color:c(o),transparent:"color"!==e||o.a<1,renderOccluded:this.renderOccluded})}}class m{constructor({theme:e,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=s.Transparent,this.minSquaredEdgeLength=900;const o=a(e);this.color=h(o.accent,.5),this.hoverColor=o.accent,p(this,t)}apply(e,t){const o=this[e];t.setParameters({color:c(o),transparent:o.a<1,renderOccluded:this.renderOccluded})}}class w{constructor({theme:e}){const t=a(e);this.vertex=new g({theme:e,color:t.accent,outlineColor:t.outline}),this.edge=new g({theme:e,color:r(h(t.accent,2/3),.5),outlineColor:h(t.outline,.5),size:8,collisionPadding:8}),this.selected=new g({theme:e,color:t.selected,outlineColor:t.outline}),this.edgeOffset=new m({theme:e})}}class f{constructor({theme:e,...t}){this.width=1.5,this.stipplePattern=n(
|
|
5
|
+
import e from"../../../../Color.js";import{getAccentColor as t,getContrastColor as o}from"../../../../core/analysisThemeUtils.js";import{memoize as i}from"../../../../core/memoize.js";import{ExtensionType as l}from"../visualElements/ExtendedLineVisualElement.js";import{RenderOccludedFlag as s}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as n}from"../../webgl-engine/materials/lineStippleUtils.js";import{desaturate as r,multiplyOpacity as h,unitRGBAFromColor as c}from"../../../support/colorUtils.js";const a=i((i=>({accent:t(),contrast:o(),selected:new e([255,255,255]),selectedOutline:new e([255,255,255]),staged:new e([12,207,255]),outline:new e([0,0,0,.5])}))),d=.3;function p(e,t){t&&Object.assign(e,t)}class u{constructor({theme:e,...t}){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=s.Opaque,this.color=a(e).accent,p(this,t)}}class g{constructor({theme:e,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9;const o=a(e);this.color=o.accent,this.outlineColor=o.outline,this.renderOccluded=s.Opaque,this.hoverOutlineColor=o.selectedOutline,p(this,t)}apply(e,t){const o=this[e];t.setParameters({color:c(o),transparent:"color"!==e||o.a<1,renderOccluded:this.renderOccluded})}}class m{constructor({theme:e,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=s.Transparent,this.minSquaredEdgeLength=900;const o=a(e);this.color=h(o.accent,.5),this.hoverColor=o.accent,p(this,t)}apply(e,t){const o=this[e];t.setParameters({color:c(o),transparent:o.a<1,renderOccluded:this.renderOccluded})}}class w{constructor({theme:e}){const t=a(e);this.vertex=new g({theme:e,color:t.accent,outlineColor:t.outline}),this.edge=new g({theme:e,color:r(h(t.accent,2/3),.5),outlineColor:h(t.outline,.5),size:8,collisionPadding:8}),this.selected=new g({theme:e,color:t.selected,outlineColor:t.outline}),this.edgeOffset=new m({theme:e})}}class f{constructor({theme:e,...t}){this.width=1.5,this.stipplePattern=n(3.3),this.falloff=0,this.innerWidth=1.5,this.renderOccluded=s.OccludeAndTransparent;const o=a(e);this.color=o.selected,this.stippleOffColor=o.outline,this.innerColor=o.selected,p(this,t)}apply(e){e.color=c(this.color),e.width=this.width,e.stipplePattern=this.stipplePattern,e.stippleOffColor=c(this.stippleOffColor),e.falloff=this.falloff,e.innerWidth=this.innerWidth,e.innerColor=c(this.innerColor),e.renderOccluded=this.renderOccluded}}class C{constructor({theme:e,...t}){this.size=4,this.outlineSize=1,this.shape="square";const o=a(e);this.color=o.selected,this.outlineColor=o.outline,p(this,t)}apply(e){e.color=c(this.color),e.size=this.size,e.outlineSize=this.outlineSize,e.outlineColor=c(this.outlineColor),e.primitive=this.shape}}class O{constructor({theme:e,...t}){this.innerWidth=1,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=d,this.globalAlphaContrastBoost=1.5,this.radius=3;const o=a(e);this.innerColor=o.selected,this.glowColor=o.accent,this.heightFillColor=o.accent,p(this,t)}apply(t,o=1){const i={glowColor:e.toUnitRGB(this.glowColor),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:e.toUnitRGB(this.innerColor),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*o,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in t?t.style=i:t.laserlineStyle=i}}class W{constructor({theme:e,...t}){const o=a(e);this.outline=new f({theme:e,color:o.outline,renderOccluded:s.OccludeAndTransparentStencil,stippleOffColor:o.selected,stipplePattern:n(3.3),width:1.5,innerWidth:0}),this.staged=new f({theme:e,color:o.selected,renderOccluded:s.OccludeAndTransparentStencil,innerColor:o.staged,stippleOffColor:o.outline,stipplePattern:n(3.3),width:1.5}),this.shadowStyle=new O({theme:e,globalAlpha:d,glowColor:o.accent,glowFalloff:8,glowWidth:8,innerColor:o.selected,innerWidth:1}),p(this,t)}}class A{constructor({theme:e,...t}){const o=a(e);this.outline=new C({theme:e,color:o.selected,outlineColor:o.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new O({theme:e,globalAlpha:d,glowColor:o.accent,glowFalloff:1.5,glowWidth:6,innerColor:o.selected,innerWidth:1,radius:2}),p(this,t)}}class z extends f{constructor({theme:e,...t}){super({theme:e}),this.extensionType=l.GROUND_RAY,p(this,t)}}class b{constructor({theme:e}){this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20;const t=a(e);this.lineGraphics=new W({theme:e}),this.pointGraphics=new A({theme:e}),this.heightPlane=new O({theme:e,globalAlpha:d,glowColor:t.accent,glowFalloff:8,glowWidth:8,innerColor:t.selected,innerWidth:1}),this.heightBox=new O({theme:e,globalAlpha:d,glowColor:t.accent,glowFalloff:8,glowWidth:8,innerColor:t.selected,innerWidth:0,heightFillColor:t.accent}),this.zVerticalLine=new z({theme:e,color:h(t.accent,5*d/3),falloff:2,innerColor:h(t.selected,0),renderOccluded:s.OccludeAndTransparent,stipplePattern:null,width:5,extensionType:l.GROUND_RAY})}}class y{constructor(e){this.colors=a(e.theme),this.visualElements=new b(e),this.manipulators=new w(e),this.zManipulator=new u(e)}}const P=i((e=>new y({theme:e})));export{P as getSettings};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{px2pt as t,pt2px as r}from"../../../../core/screenUtils.js";import{f as i,d as a}from"../../../../chunks/vec4f64.js";import{create as l,empty as s,expandWithBuffer as n,intersectsClippingArea as o,expandWithAABB as h}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as c}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as p}from"./ElevationAligners.js";import{SymbolUpdateType as m,elevationModeChangeUpdateType as d,needsElevationUpdates2D as y}from"./elevationAlignmentUtils.js";import _ from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as u}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as f}from"./interfaces.js";import{parseCapType as M,parseLineMarkerStyle as C}from"./lineUtils.js";import{ConvertOptions as b,initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as E,getAttributeValue as L}from"../support/FastSymbolUpdates.js";import w from"../../support/debugFlags.js";import{createGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfo as x,geometryToRenderInfoDraped as R}from"../../support/renderInfoUtils/line.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as D}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as j}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as A}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";import U from"../../../../geometry/Extent.js";import G from"../../../../geometry/Polygon.js";const z=["polyline","polygon","extent"],O=new b({size:!0,color:!0,rotation:!1,opacity:!0});class V extends g{constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){if(this._fastUpdates=P(this._context.renderer,O),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:t(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t=!1){const r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);this._patternHidesLine&&!t&&(r[3]=0);const i={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:M(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:A(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}get _materialColor(){return this.symbolLayer.material?.color}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._lineMaterialCached&&(this._lineMaterialCached=new S(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return null==this._ringMaterialCached&&(this._ringMaterialCached=new S(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return null==this._wireframeLineMaterialCached&&(this._wireframeLineMaterialCached=new S({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return null==this._wireframeRingMaterialCached&&(this._wireframeRingMaterialCached=new S({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return null==this._markerMaterialCached&&null!=this.symbolLayer.marker&&(this._markerMaterialCached=new j({...this._getMaterialParameters(!1,!0),placement:this.symbolLayer.marker.placement,markerPrimitive:C(this.symbolLayer.marker.style)}),this._context.stage.add(this._markerMaterialCached)),this._markerMaterialCached}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._lineMaterialCached=null,this._ringMaterialCached=null,this._wireframeLineMaterialCached=null,this._wireframeRingMaterialCached=null,this._markerMaterialCached=null}_getDrivenSize(e){return this._drivenProperties.size&&e.size?r(c(e.size)):1}_getDrivenColor(e){const t=i(1,1,1,1);return this._drivenProperties.color&&e.color&&(t[0]=e.color[0],t[1]=e.color[1],t[2]=e.color[2],e.color.length>0&&(t[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(t[3]=e.opacity),t}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return f.RecreateSymbol;{const e=this._fastUpdates;if(!E(e,t,O))return f.RecreateSymbol;this._forEachMaterial((t=>t.setParameters(e.materialParameters)))}}return f.FastUpdate}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=M(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){null!=this._lineMaterialCached&&e(this._lineMaterialCached),null!=this._ringMaterialCached&&e(this._ringMaterialCached),null!=this._wireframeLineMaterialCached&&e(this._wireframeLineMaterialCached),null!=this._wireframeRingMaterialCached&&e(this._wireframeRingMaterialCached),null!=this._markerMaterialCached&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=this.symbolLayer?.material?.color,l=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),s=i(r[0],r[1],r[2],l);e.setParameters({color:s})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=d(V.elevationModeChangeTypes,r,i);if(a!==m.UPDATE)return a;const l=y(i);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>l))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof U)return G.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,t,r){const i=e.graphic,a=this._getGeometryAsPolygonOrPolyline(i.geometry),h="polygon"===a.type?a.rings:a.paths,c=new Array,m=l(),d=x(a,this._context.elevationProvider,this._context.renderCoordsHelper,t),_="polygon"===a.type?"rings":"paths";this._logGeometryCreationWarnings(d,h,_,"LineSymbol3DLayer");for(let l=0;l<d.lines.length;l++){const t=d.lines[l],i=t.position,h=t.mapPositions;if(null!=this._context.clippingExtent&&(s(m),n(m,h),!o(m,this._context.clippingExtent)))continue;const p=this._createGeometry("polygon"===a.type?this._ringMaterial:this._lineMaterial,e,i,h,a.type,I.ELEVATED,r);c.push(p),w.LINE_WIREFRAMES&&c.push(p.instantiate({material:"polygon"===a.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial&&c.push(p.instantiate({material:this._markerMaterial}))}if(0===c.length)return null;const g=new k({geometries:c,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),f=new u(this,g,c,null,null,p,t);return f.alignedSampledElevation=d.sampledElevation,f.needsElevationUpdates=y(t.mode),f}_createGeometry(e,t,r,i,a,l,s){const n=l===I.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,o="polygon"===a,h=this._fastUpdates?.visualVariables.color,c=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerUid:this._context.layer.uid}),d={position:r,size:c?null:this._getDrivenSize(t.renderingInfo),color:h?null:this._getDrivenColor(t.renderingInfo),sizeFeature:c?L(c.field,t.graphic):null,colorFeature:h?L(h.field,t.graphic):null,opacityFeature:p?L(p.field,t.graphic):null};return v(e,{overlayInfo:n,removeDuplicateStartEnd:o,mapPositions:i,attributeData:d},m)}_createAsOverlay(e,t){const r=e.graphic,i=this._getGeometryAsPolygonOrPolyline(r.geometry),a="polygon"===i.type?i.rings:i.paths,c="polygon"===i.type?this._ringMaterial:this._lineMaterial;c.renderPriority=this._renderPriority;const p=w.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,m=this._markerMaterial;null!=p&&(p.renderPriority=this._renderPriority-.001),null!=m&&(m.renderPriority=this._renderPriority-.002);const d=new Array,y=l(),u=s(),g=R(i,this._context.overlaySR),f="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(g,a,f,"LineSymbol3DLayer");for(const l of g.lines){if(s(y),n(y,l.position),!o(y,this._context.clippingExtent))continue;h(u,y);const a=a=>{const s=this._createGeometry(a,e,l.position,void 0,i.type,I.DRAPED,r.uid),n=new D(s,{layerUid:t,graphicUid:r.uid});d.push(n)};if(null!=m){a(m);const e=this.symbolLayer.marker.placement;"begin"!==e&&"begin-end"!==e||n(y,l.position,0,1),"end"!==e&&"begin-end"!==e||n(y,l.position,l.position.length-3,1)}a(c),w.LINE_WIREFRAMES&&a(p)}return new _(this,d,u,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??t(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?r(1):1:r(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===i.type)return;const l="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(l);r.useMaterialColor&&this._patchMaterialColor(a(s),this._markerMaterialCached,e),this._patternHidesLine&&(s[3]=0),this._patchMaterialColor(s,this._lineMaterialCached,e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,l=null!=a,s=l?a.newValue:null,n=null==s&&null==this._markerColor;s&&this._patchMaterialColor(this._getCombinedOpacityAndColor(s),i,e);const o=r.diff.style?.newValue;return o&&e.symbolLayerStatePatches.push((()=>i.setParameters({markerPrimitive:C(o)}))),delete t.marker,{changed:l,useMaterialColor:n}}_patchMaterialColor(e,t,r){null!=t&&r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var I;V.elevationModeChangeTypes={definedChanged:m.RECREATE,staysOnTheGround:m.NONE,onTheGroundChanged:m.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(I||(I={}));export{V as Graphics3DLineSymbolLayer};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{px2pt as t,pt2px as r}from"../../../../core/screenUtils.js";import{f as i,d as a}from"../../../../chunks/vec4f64.js";import{create as l,empty as s,expandWithBuffer as n,intersectsClippingArea as o,expandWithAABB as h}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as c}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as p}from"./ElevationAligners.js";import{SymbolUpdateType as m,elevationModeChangeUpdateType as d,needsElevationUpdates2D as y}from"./elevationAlignmentUtils.js";import _ from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as u}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as f}from"./interfaces.js";import{parseCapType as M,parseLineMarkerStyle as C}from"./lineUtils.js";import{ConvertOptions as b,initFastSymbolUpdatesState as P,updateFastSymbolUpdatesState as E,getAttributeValue as w}from"../support/FastSymbolUpdates.js";import L from"../../support/debugFlags.js";import{createGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfo as x,geometryToRenderInfoDraped as R}from"../../support/renderInfoUtils/line.js";import{Object3D as k}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as D}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as j}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as A}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";import U from"../../../../geometry/Extent.js";import G from"../../../../geometry/Polygon.js";const z=["polyline","polygon","extent"],O=new b({size:!0,color:!0,rotation:!1,opacity:!0});class V extends g{constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){if(this._fastUpdates=P(this._context.renderer,O),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:t(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}}_getMaterialParameters(e,t=!1){const r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);this._patternHidesLine&&!t&&(r[3]=0);const i={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:M(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:A(this.symbolLayer.pattern)};return this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}get _materialColor(){return this.symbolLayer.material?.color}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return null==this._lineMaterialCached&&(this._lineMaterialCached=new S(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return null==this._ringMaterialCached&&(this._ringMaterialCached=new S(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return null==this._wireframeLineMaterialCached&&(this._wireframeLineMaterialCached=new S({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return null==this._wireframeRingMaterialCached&&(this._wireframeRingMaterialCached=new S({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return null==this._markerMaterialCached&&null!=this.symbolLayer.marker&&(this._markerMaterialCached=new j({...this._getMaterialParameters(!1,!0),placement:this.symbolLayer.marker.placement,markerPrimitive:C(this.symbolLayer.marker.style)}),this._context.stage.add(this._markerMaterialCached)),this._markerMaterialCached}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._lineMaterialCached=null,this._ringMaterialCached=null,this._wireframeLineMaterialCached=null,this._wireframeRingMaterialCached=null,this._markerMaterialCached=null}_getDrivenSize(e){return this._drivenProperties.size&&e.size?r(c(e.size)):1}_getDrivenColor(e){const t=i(1,1,1,1);return this._drivenProperties.color&&e.color&&(t[0]=e.color[0],t[1]=e.color[1],t[2]=e.color[2],e.color.length>0&&(t[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(t[3]=e.opacity),t}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,z,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return f.RecreateSymbol;{const e=this._fastUpdates;if(!E(e,t,O))return f.RecreateSymbol;this._forEachMaterial((t=>t.setParameters(e.materialParameters)))}}return f.FastUpdate}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=M(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){null!=this._lineMaterialCached&&e(this._lineMaterialCached),null!=this._ringMaterialCached&&e(this._ringMaterialCached),null!=this._wireframeLineMaterialCached&&e(this._wireframeLineMaterialCached),null!=this._wireframeRingMaterialCached&&e(this._wireframeRingMaterialCached),null!=this._markerMaterialCached&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=this.symbolLayer?.material?.color,l=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),s=i(r[0],r[1],r[2],l);e.setParameters({color:s})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=d(V.elevationModeChangeTypes,r,i);if(a!==m.UPDATE)return a;const l=y(i);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>l))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof U)return G.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,t,r){const i=e.graphic,a=this._getGeometryAsPolygonOrPolyline(i.geometry),h="polygon"===a.type?a.rings:a.paths,c=new Array,m=l(),d=x(a,this._context.elevationProvider,this._context.renderCoordsHelper,t),_="polygon"===a.type?"rings":"paths";this._logGeometryCreationWarnings(d,h,_,"LineSymbol3DLayer");for(let l=0;l<d.lines.length;l++){const t=d.lines[l],i=t.position,h=t.mapPositions;if(null!=this._context.clippingExtent&&(s(m),n(m,h),!o(m,this._context.clippingExtent)))continue;const p=this._createGeometry("polygon"===a.type?this._ringMaterial:this._lineMaterial,e,i,h,a.type,I.ELEVATED,r);c.push(p),L.LINE_WIREFRAMES&&c.push(p.instantiate({material:"polygon"===a.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial&&c.push(p.instantiate({material:this._markerMaterial}))}if(0===c.length)return null;const g=new k({geometries:c,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),f=new u(this,g,c,null,null,p,t);return f.alignedSampledElevation=d.sampledElevation,f.needsElevationUpdates=y(t.mode),f}_createGeometry(e,t,r,i,a,l,s){const n=l===I.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,o="polygon"===a,h=this._fastUpdates?.visualVariables.color,c=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerUid:this._context.layer.uid}),d={position:r,size:c?null:this._getDrivenSize(t.renderingInfo),color:h?null:this._getDrivenColor(t.renderingInfo),sizeFeature:c?w(c.field,t.graphic):null,colorFeature:h?w(h.field,t.graphic):null,opacityFeature:p?w(p.field,t.graphic):null};return v(e,{overlayInfo:n,removeDuplicateStartEnd:o,mapPositions:i,attributeData:d},m)}_createAsOverlay(e,t){const r=e.graphic,i=this._getGeometryAsPolygonOrPolyline(r.geometry),a="polygon"===i.type?i.rings:i.paths,c="polygon"===i.type?this._ringMaterial:this._lineMaterial;c.renderPriority=this._renderPriority;const p=L.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,m=this._markerMaterial;null!=p&&(p.renderPriority=this._renderPriority-.001),null!=m&&(m.renderPriority=this._renderPriority-.002);const d=new Array,y=l(),u=s(),g=R(i,this._context.overlaySR),f="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(g,a,f,"LineSymbol3DLayer");for(const l of g.lines){if(s(y),n(y,l.position),!o(y,this._context.clippingExtent))continue;h(u,y);const a=a=>{const s=this._createGeometry(a,e,l.position,void 0,i.type,I.DRAPED,r.uid),n=new D(s,{layerUid:t,graphicUid:r.uid});d.push(n)};if(null!=m){a(m);const e=this.symbolLayer.marker.placement;"begin"!==e&&"begin-end"!==e||n(y,l.position,0,1),"end"!==e&&"begin-end"!==e||n(y,l.position,l.position.length-3,1)}a(c),L.LINE_WIREFRAMES&&a(p)}return new _(this,d,u,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??t(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?r(1):1:r(e)}_prepareMaterialPatch(e,t,r){const i=t.material;if(null==i)return void(r.changed&&r.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===i.type)return;const l="complete"===i.type?i.newValue?.color:"complete"===i.diff.color?.type?i.diff.color.newValue:null,s=this._getCombinedOpacityAndColor(l);r.useMaterialColor&&this._patchMaterialColor(a(s),this._markerMaterialCached,e),this._patternHidesLine&&(s[3]=0),this._patchMaterialColor(s,this._lineMaterialCached,e),delete t.material}_prepareMarkerPatch(e,t){const r=t.marker,i=this._markerMaterial;if(null==r||"partial"!==r.type||null==r.diff||null!=r.diff.placement||null!=r.diff.style&&"complete"!==r.diff.style.type||null!=r.diff.color&&"complete"!==r.diff.color.type||null==i)return{changed:!1,useMaterialColor:null==this._markerColor};const a=r.diff.color,l=null!=a,s=l?a.newValue:null,n=null==s&&null==this._markerColor;s&&this._patchMaterialColor(this._getCombinedOpacityAndColor(s),i,e);const o=r.diff.style?.newValue;return o&&e.symbolLayerStatePatches.push((()=>i.setParameters({markerPrimitive:C(o)}))),delete t.marker,{changed:l,useMaterialColor:n}}_patchMaterialColor(e,t,r){null!=t&&r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var I;V.elevationModeChangeTypes={definedChanged:m.RECREATE,staysOnTheGround:m.NONE,onTheGroundChanged:m.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(I||(I={}));export{V as Graphics3DLineSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{create as r,empty as
|
|
5
|
+
import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{e as i}from"../../../../chunks/earcut.js";import{create as r,empty as o,expandWithBuffer as n,intersectsClippingArea as s,expandWithAABB as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as h,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as u,elevationModeChangeUpdateType as d,needsElevationUpdates2D as m}from"./elevationAlignmentUtils.js";import _ from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as y}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as f}from"./graphicUtils.js";import{ApplyRendererDiffResult as b}from"./interfaces.js";import{parseCapType as x}from"./lineUtils.js";import{geometryAsPolygon as v,createIndices3D as O,createColorGeometry as D,PolygonCreationDataBase as C}from"./polygonUtils.js";import{ConvertOptions as S,initFastSymbolUpdatesState as j,updateFastSymbolUpdatesState as A,getAttributeValue as M}from"../support/FastSymbolUpdates.js";import{createMaterial as P,uvElevationAligner as U}from"../support/patternUtils.js";import{createMapSpaceUVCoords as E,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as L}from"../../support/engineContent/line.js";import{geometryToRenderInfo as w,geometryToRenderInfoDraped as R}from"../../support/renderInfoUtils/polygon.js";import{Object3D as I}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as B}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";const z=["polyline","polygon","extent"],H=new S({size:!1,color:!0,rotation:!1,opacity:!1});class N extends g{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){this._fastUpdates=j(this._context.renderer,H)}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(null!=this._material)return;const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacityAndColor(e);this._material=P(this.symbolLayer,{color:t,transparent:t[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 B,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(this._outlineMaterial||!this._isValidOutline(e))return;this._hasOutline=!0;const i=t=>{const i=F(e.pattern);return new T({width:t,color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,cap:x(e.patternCap||"butt")})};this._outlineMaterial=i(t(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,z,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t);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 b.RecreateSymbol;if(!A(this._fastUpdates,t,H))return b.RecreateSymbol;this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return b.FastUpdate}layerOpacityChanged(){if(null!=this._material){const e=this._material.parameters.color,t=this.symbolLayer?.material?.color,i=this._getCombinedOpacity(t);this._material.setParameters({color:[e[0],e[1],e[2],i],transparent:i<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=d(N.elevationModeChangeTypes,i,r);if(o!==u.UPDATE)return o;const n=m(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=v(e.geometry);if(!r)return null;const o=w(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new k(o,t,this._context.layer.uid,e.uid),s=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=h(4*s,!0),n.boundingRect=l(9*s,!0),E(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 I({geometries:n.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:e.uid}),c=new y(this,a,n.outGeometries,null,null,U,i);return c.alignedSampledElevation=n.renderData.sampledElevation,c.needsElevationUpdates=m(i.mode),c}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:r,mapPositions:a,holeIndices:l,index:h,count:u}of i){if(null!=this._context.clippingExtent&&(o(W),n(W,a),!s(W,this._context.clippingExtent)))continue;const i=O(a,l,this._context.elevationProvider.spatialReference);if(0===i.length)continue;const d=this._fastUpdates?.visualVariables.color,m=D({material:this._material,indices:i,mapPositions:a,attributeData:{position:r,color:d?null:t.color,colorFeature:d?M(d.field,e):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*h,4*u):null,boundingRect:this._needsUV?c(t.boundingRect,9*h,9*u):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(m)}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{mapPositions:r,position:a}=t[i];if(null!=this._context.clippingExtent&&(o(W),n(W,r),!s(W,this._context.clippingExtent)))continue;const l=L(this._outlineMaterial,{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:a}},e.objectAndLayerIdColor);e.outGeometries.push(l)}}_createAsOverlay(e,t){const i=v(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=R(i,this._context.overlaySR),n=new q(r,t,this._context.layer.uid,e.uid),s=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=h(4*s,!0),G(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._hasOutline&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new _(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const r=t.renderData.polygons;for(const{position:l,holeIndices:c,index:h,count:u}of r){const r=o(W);if(n(r,l),!s(r,this._context.clippingExtent))continue;const d=i(l,c,3);if(0===d.length)continue;a(t.outBoundingBox,r);const m=this._fastUpdates?.visualVariables.color,_=D({material:this._material,indices:d,attributeData:{position:l,color:m?null:t.color,colorFeature:m?M(m.field,e):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*h,4*u):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new V(_,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(o(W),n(W,r),!s(W,this._context.clippingExtent))continue;a(e.outBoundingBox,W);const l=L(this._outlineMaterial,{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new V(l,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const t=this.symbolLayer?.outline?.color,i=this._getOutlineOpacity();return f(null!=t?e.toUnitRGB(t):null,i)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}N.elevationModeChangeTypes={definedChanged:u.RECREATE,staysOnTheGround:u.NONE,onTheGroundChanged:u.RECREATE};const W=r();class k extends C{constructor(e,t,i,r){super(e,i,r),this.color=t}}class q extends C{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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{disposeMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I as a}from"../../../chunks/mat4f64.js";import{b as l,s as h,e as u}from"../../../chunks/vec3.js";import{Z as c,f as d,c as p}from"../../../chunks/vec3f64.js";import{Z as _}from"../../../chunks/vec4f64.js";import{create as f,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as g}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{OverlaySource as R}from"./Overlay.js";import{overlayRenderOccludedFlag as O}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as C}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as D}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as q,compareTiles as A}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as w,ComponentIntersectionData as N}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as G}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as I}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as L}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{Attribute as F}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as U}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as k}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as B}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as M,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderSlot as H}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as W}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Q,getVerticalOffsetTerrain as X}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as Z}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as K,intersectTriangles as J}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as $}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ee}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as te}from"../../webgl/enums.js";const ie=7,re=10,se=f();var ne;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(ne||(ne={}));let oe=class extends i{get _isGlobal(){return this._stage.viewingMode===b.Global}constructor(e){super(e),this.type=M.TERRAIN,this.isGround=!0,this.renderSlots=[H.OPAQUE_TERRAIN,H.TRANSPARENT_TERRAIN,H.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new ee,this._passParameters=new I,this._rctx=null,this._renderDataPool=new s(C),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._highestVisibleLODTile=null,this._visible=!0,this._transparencyState=ne.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),x()}canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}requiresOutput(e){return e===j.Depth&&this._overlayRenderer.hasWater||e===j.Highlight&&this.needsHighlight}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ne.TransparentWithDraped||e===ne.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Q}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?O:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,S.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[T.ELEVATION])i.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=re-ie,i=Math.max(0,Math.floor((e.level-t)/ie)*ie);if(this._isGlobal&&0===i)return c;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=U.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=U.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=U.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._rctx=e.renderContext.rctx,this._techniqueRepository=e.techniqueRepository,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniqueRepository),this.updateTileBackground(),this._emptyTex=k(this._rctx)}uninitializeRenderContext(){this._emptyTex=r(this._emptyTex),this._tileRenderer=r(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ne.Opaque)return;const s=ae,n=le;l(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,c=e.results.max,d=e.results.ground,p=e.options.store===z.MIN,_=!!e.results.ground.target,f=X(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=o.dist?o.dist:1/0;const R=h=>{const _=h.renderData;if(!_?.vao)return;const R=_.geometry;m(se,R.boundingBox);const O=_.localOrigin;null!=f&&(f.localOrigin=O,f.applyToAabb(se));const x=se;if(he[0]=i[0]-O[0],he[1]=i[1]-O[1],he[2]=i[2]-O[2],!K(x,he,n,b,T))return;const C=(e,t,i)=>{e.set(this.type,h,t,i,a),T=p&&null!=o.dist?o.dist:1/0},v=(n,a)=>{if(null!=a&&n>=0&&(e.options.backfacesTerrain||u(a,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==d.dist||n<d.dist)&&C(d,n,a),e.options.isFiltered)return;e.options.store===z.ALL&&(null==y?(y=B(e.ray),C(y,n,a),e.results.all.push(y)):n<y.dist&&C(y,n,a)),(null==o.dist||n<o.dist)&&C(o,n,a),e.options.store!==z.MIN&&(null==c.dist||n>c.dist)&&C(c,n,a)}},D=ue;l(D,r,O);const P=R.indices,S=R.vertexAttributes,E=S.getField(Y.POSITION,g),q=new F(E.typedBuffer,3,!1,S.stride/4),A=R.indexCount/3;if(!f&&A>w){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new N(P,0,A,q)),e.intersectionData.intersectRay({r0:he,r1:D},v)}else J(he,D,0,A,P,q,null,f,v)},O=this._rootTiles;if(null!=O){(()=>{const t=this._tileIterator;t.reset(O);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===H.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&O))return null}else{const t=this.transparency===ne.Opaque?H.OPAQUE_TERRAIN:H.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case j.Color:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.active,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty?G.Disabled:this._overlayRenderer.hasWater?G.EnabledWithWater:G.Enabled,this._updateTechnique(j.Color,e.bindParameters.slot===H.OCCLUDED_TERRAIN));case j.Shadow:case j.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case j.Depth:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1));case j.Normal:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1));case j.ObjectAndLayerIdColor:return this.transparency===ne.Empty?null:this._updateTechnique(j.ObjectAndLayerIdColor,!1);case j.Highlight:return this.transparency!==ne.Empty&&this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case j.Color:{const i=e.bindParameters.slot===H.OCCLUDED_TERRAIN?R.Occluded:R.ColorAndWater;this._renderMaterialPass(e,t,i);break}case j.Depth:case j.Normal:this._renderAuxiliaryPass(e,t,R.ColorAndWater);break;case j.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight);break;case j.Shadow:case j.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,R.None);break;case j.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,i)}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r=null;if(null!=e){const i=t.toUnitRGBA(e);r=d(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,y.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?L.GridComposite:null!=i.backgroundColor?L.ColorComposite:L.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const i of e)q(this.renderOrder,i,t);e.sort(((e,t)=>A(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const r=i.localOrigin;let s=this._patchGroups.get(r);s||(s=new Array,this._patchGroups.set(r,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new Z(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],te.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const r=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=W(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:r.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=i===R.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",c),s.setUniform4fv("texOffsetAndScale",_));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:c;this._techniqueConfiguration.tileBlendInput===L.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?te.LINES:te.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const h=this._patchGroups;for(const u of h.values()){const r=u[0].renderData.localOrigin;t.program.bindDraw(new Z(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of u){const r=a.renderData,h=r.textureReference;if(null!=h){if(!o){s.setUniform4fv("texOffsetAndScale",h.offsetAndScale),s.bindTexture("tex",h.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",h.opacities)}this._renderPatch(e,t,a,l,n,i),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(D&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const h=t.program;n===R.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const u=o.geometry.indexCount;e.rctx.bindVAO(a),h.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,u,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire($,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([n({constructOnly:!0})],oe.prototype,"_overlayRenderer",void 0),e([n({constructOnly:!0})],oe.prototype,"_stage",void 0),e([n({readOnly:!0})],oe.prototype,"_isGlobal",null),e([n({constructOnly:!0})],oe.prototype,"_allTiles",void 0),e([n({constructOnly:!0})],oe.prototype,"_ellipsoidRadius",void 0),e([n({value:!1})],oe.prototype,"renderingDisabled",null),e([n()],oe.prototype,"renderPatchBorders",null),e([n()],oe.prototype,"visualizeNormals",null),e([n()],oe.prototype,"cullBackFaces",null),e([n({value:v.FRONT_TO_BACK})],oe.prototype,"renderOrder",null),e([n()],oe.prototype,"wireframe",null),oe=e([o("esri.views.3d.terrain.TerrainRenderer")],oe);const ae=p(),le=p(),he=p(),ue=p();export{oe as TerrainRenderer,ne as TransparencyMode};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{disposeMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I as a}from"../../../chunks/mat4f64.js";import{b as l,s as h,e as c}from"../../../chunks/vec3.js";import{Z as u,f as d,c as p}from"../../../chunks/vec3f64.js";import{Z as _}from"../../../chunks/vec4f64.js";import{create as f,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as g}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{OverlaySource as R}from"./Overlay.js";import{overlayRenderOccludedFlag as O}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as C}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as D}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as q,compareTiles as A}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as w,ComponentIntersectionData as N}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as G}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as I}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as L}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{Attribute as F}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as U}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as k}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as B}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as M,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderSlot as H}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as W}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Q,getVerticalOffsetTerrain as X}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as Z}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as K,intersectTriangles as J}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as $}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ee}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as te}from"../../webgl/enums.js";const re=7,ie=10,se=f();var ne;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(ne||(ne={}));let oe=class extends r{get _isGlobal(){return this._stage.viewingMode===b.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e){super(e),this.type=M.TERRAIN,this.isGround=!0,this.renderSlots=[H.OPAQUE_TERRAIN,H.TRANSPARENT_TERRAIN,H.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new ee,this._passParameters=new I,this._renderDataPool=new s(C),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._highestVisibleLODTile=null,this._visible=!0,this._transparencyState=ne.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),x()}canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}requiresOutput(e){return e===j.Depth&&this._overlayRenderer.hasWater||e===j.Highlight&&this.needsHighlight}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ne.TransparentWithDraped||e===ne.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Q}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?O:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,S.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const r of e.layerInfo[T.ELEVATION])r.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ie-re,r=Math.max(0,Math.floor((e.level-t)/re)*re);if(this._isGlobal&&0===r)return u;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=U.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=U.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=U.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniques,this._cache),this.updateTileBackground(),this._emptyTex=k(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,r,i){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ne.Opaque)return;const s=ae,n=le;l(s,i,r),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,u=e.results.max,d=e.results.ground,p=e.options.store===z.MIN,_=!!e.results.ground.target,f=X(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=o.dist?o.dist:1/0;const R=h=>{const _=h.renderData;if(!_?.vao)return;const R=_.geometry;m(se,R.boundingBox);const O=_.localOrigin;null!=f&&(f.localOrigin=O,f.applyToAabb(se));const x=se;if(he[0]=r[0]-O[0],he[1]=r[1]-O[1],he[2]=r[2]-O[2],!K(x,he,n,b,T))return;const C=(e,t,r)=>{e.set(this.type,h,t,r,a),T=p&&null!=o.dist?o.dist:1/0},v=(n,a)=>{if(null!=a&&n>=0&&(e.options.backfacesTerrain||c(a,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,i,n))){if((null==d.dist||n<d.dist)&&C(d,n,a),e.options.isFiltered)return;e.options.store===z.ALL&&(null==y?(y=B(e.ray),C(y,n,a),e.results.all.push(y)):n<y.dist&&C(y,n,a)),(null==o.dist||n<o.dist)&&C(o,n,a),e.options.store!==z.MIN&&(null==u.dist||n>u.dist)&&C(u,n,a)}},D=ce;l(D,i,O);const P=R.indices,S=R.vertexAttributes,E=S.getField(Y.POSITION,g),q=new F(E.typedBuffer,3,!1,S.stride/4),A=R.indexCount/3;if(!f&&A>w){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new N(P,0,A,q)),e.intersectionData.intersectRay({r0:he,r1:D},v)}else J(he,D,0,A,P,q,null,f,v)},O=this._rootTiles;if(null!=O){(()=>{const t=this._tileIterator;t.reset(O);const i=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||i&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(r,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const r of t)null!=r.renderData?.textureReference&&e.queriesForTile(r);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===H.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&O))return null}else{const t=this.transparency===ne.Opaque?H.OPAQUE_TERRAIN:H.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case j.Color:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.active,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty?G.Disabled:this._overlayRenderer.hasWater?G.EnabledWithWater:G.Enabled,this._updateTechnique(j.Color,e.bindParameters.slot===H.OCCLUDED_TERRAIN));case j.Shadow:case j.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case j.Depth:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1));case j.Normal:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1));case j.ObjectAndLayerIdColor:return this.transparency===ne.Empty?null:this._updateTechnique(j.ObjectAndLayerIdColor,!1);case j.Highlight:return this.transparency!==ne.Empty&&this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case j.Color:{const r=e.bindParameters.slot===H.OCCLUDED_TERRAIN?R.Occluded:R.ColorAndWater;this._renderMaterialPass(e,t,r);break}case j.Depth:case j.Normal:this._renderAuxiliaryPass(e,t,R.ColorAndWater);break;case j.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight);break;case j.Shadow:case j.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,R.None);break;case j.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,r){const{rctx:i}=e;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,r)}_renderAuxiliaryPass(e,t,r){const i=e.rctx;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,r)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const r=this._tileRenderer;let i=null;if(null!=e){const r=t.toUnitRGBA(e);i=d(r[0]||0,r[1]||0,r[2]||0)}r.setBackground(i),this._allTiles.forAll((e=>r.updateTileTexture(e,y.FADING))),this._techniqueConfiguration.tileBlendInput=r.backgroundIsGrid?L.GridComposite:null!=r.backgroundColor?L.ColorComposite:L.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const r of e)q(this.renderOrder,r,t);e.sort(((e,t)=>A(e[0],t[0],this.renderOrder))),this._patchGroups=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._patchGroups.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const i=r.localOrigin;let s=this._patchGroups.get(i);s||(s=new Array,this._patchGroups.set(i,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new Z(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],te.TRIANGLES,i,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const i=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=W(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:i.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=r===R.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",u),s.setUniform4fv("texOffsetAndScale",_));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:u;this._techniqueConfiguration.tileBlendInput===L.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?te.LINES:te.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const h=this._patchGroups;for(const c of h.values()){const i=c[0].renderData.localOrigin;t.program.bindDraw(new Z(i),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of c){const i=a.renderData,h=i.textureReference;if(null!=h){if(!o){s.setUniform4fv("texOffsetAndScale",h.offsetAndScale),s.bindTexture("tex",h.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",h.opacities)}this._renderPatch(e,t,a,l,n,r),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,r,i,s,n){const o=r.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(D&&console.error("Rendered tile with no indices: ",r.lij," : ",o));const h=t.program;n===R.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,o.overlay),s&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.bindParameters.slot));const c=o.geometry.indexCount;e.rctx.bindVAO(a),h.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(i,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire($,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([n({constructOnly:!0})],oe.prototype,"_overlayRenderer",void 0),e([n({constructOnly:!0})],oe.prototype,"_stage",void 0),e([n({readOnly:!0})],oe.prototype,"_isGlobal",null),e([n({constructOnly:!0})],oe.prototype,"_allTiles",void 0),e([n({constructOnly:!0})],oe.prototype,"_cache",void 0),e([n({constructOnly:!0})],oe.prototype,"_ellipsoidRadius",void 0),e([n({value:!1})],oe.prototype,"renderingDisabled",null),e([n()],oe.prototype,"renderPatchBorders",null),e([n()],oe.prototype,"visualizeNormals",null),e([n()],oe.prototype,"cullBackFaces",null),e([n({value:v.FRONT_TO_BACK})],oe.prototype,"renderOrder",null),e([n()],oe.prototype,"wireframe",null),oe=e([o("esri.views.3d.terrain.TerrainRenderer")],oe);const ae=p(),le=p(),he=p(),ce=p();export{oe as TerrainRenderer,ne as TransparencyMode};
|