@arcgis/core 4.29.0-next.20240221 → 4.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0bc21d2a0b65bd4e9d76.js +1 -0
- package/assets/esri/core/workers/chunks/{6e50220f8e2d392e2855.js → 5b275309d78453a9319e.js} +1 -1
- package/assets/esri/core/workers/chunks/{6fd8047741a0df006ddd.js → 69f6558b538d1b2d3086.js} +1 -1
- package/assets/esri/core/workers/chunks/{63c2ca47e8df5e9b5574.js → 87fb028c66de06bf6d75.js} +1 -1
- package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +1 -0
- package/assets/esri/core/workers/chunks/{958402a4f6dd0d23546d.js → a4c3da057ec2a07bbbe8.js} +1 -1
- package/assets/esri/core/workers/chunks/{48c6a9ed53cf4f9255b0.js → b454c6b992bcdbab36a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{e7b26c7e9e24dc6255be.js → cacf97b0a7a1057b9f79.js} +1 -1
- package/config.js +1 -1
- package/copyright.txt +56 -28
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/interfaces.d.ts +8 -8
- package/kernel.js +1 -1
- package/layers/orientedImagery/core/CameraOrientation.js +1 -1
- package/layers/orientedImagery/core/ElevationSourceDefinitions.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +5 -0
- package/layers/orientedImagery/transformations/updateElevation.js +5 -0
- package/layers/orientedImagery/transformations/updateElevationUtils.js +5 -0
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +5 -0
- package/layers/support/EditingCapabilities.js +1 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/package.json +1 -1
- package/rest/print.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/meshFastUpdateUtils.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/layers/support/editableLayerViews.js +5 -0
- package/views/webgl/testDoublePrecisionArithmetic.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
- package/widgets/Editor/support/EditorItem.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/assets/esri/core/workers/chunks/25f73748df0ee82d06cb.js +0 -1
- package/assets/esri/core/workers/chunks/2d7a18f8c540269ecee9.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import r from"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import"../../symbols.js";import{isSome as a}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{toPt as n}from"../../core/screenUtils.js";import{fetchMessageBundle as i}from"../../intl/messages.js";import s from"../../layers/support/AggregateField.js";import o from"../../layers/support/ExpressionInfo.js";import l from"../../renderers/support/AttributeColorInfo.js";import{OthersCategory as u}from"../../renderers/support/OthersCategory.js";import p from"../heuristics/outline.js";import m from"../heuristics/sizeRange.js";import{createVisualVariables as c}from"./size.js";import{errorCallback as d,createColors as f,createSymbol as h,getSymbolOutlineFromScheme as b,verifyBasicFieldValidity as y,getBasemapInfo as w}from"./support/utils.js";import g from"../statistics/predominantCategories.js";import{getSumOfAttributesExpr as v}from"../statistics/support/utils.js";import{verifyBinningParams as S}from"../support/binningUtils.js";import{getFieldsList as z}from"../support/utils.js";import{LayerType as E,binningCapableLayerTypes as j,createLayerAdapter as C,getLayerTypeLabels as x,getLayerTypes as V}from"../support/adapters/support/layerUtils.js";import{cloneScheme as $,getSchemes as T}from"../symbology/pieChart.js";import{getCIMSymbolColor as I}from"../../symbols/support/cimSymbolUtils.js";import k from"../../symbols/SimpleLineSymbol.js";const O=[E.CSVLayer,E.FeatureLayer,E.GeoJSONLayer,E.OGCFeatureLayer,E.OrientedImageryLayer,E.StreamLayer,E.WFSLayer];async function q(e){if(!(e?.layer&&e.view&&e.attributes?.length))throw new t("pie-chart-renderer:missing-parameters","'layer', 'view' and 'attributes' parameters are required");if(e.attributes.length>10)throw new t("pie-chart-renderer:invalid-parameters","PieChart renderer does not support more than 10 attributes");e.forBinning&&S(e,"pie-chart-renderer");const r={...e,layer:e.layer,view:e.view,attributes:e.attributes};r.shape=r.shape||"pie",r.othersCategoryEnabled??=!0,r.includeSizeVariable=e.includeSizeVariable||!1;const a=e.forBinning?j:O,n=C(r.layer,a,e.forBinning);if(!n)throw new t("pie-chart-renderer:invalid-parameters","'layer' must be one of these types: "+x(a).join(", "));r.layer=n;const i=null!=r.signal?{signal:r.signal}:null;await Promise.all([e.view.when(),n.load(i)]);const s=n.geometryType,o="polygon"===s,l="point"===s||"multipoint"===s||o;if(r.outlineOptimizationEnabled=!!o&&r.outlineOptimizationEnabled,r.sizeOptimizationEnabled=!!l&&r.sizeOptimizationEnabled,!l)throw new t("pie-chart-renderer:not-supported","PieChart renderer is only supported for point and polygon layers");const u=[],p=r.attributes;for(const t of p){const e=await z({field:t.field,valueExpression:t.valueExpression});u.push(...e)}const m=y(n,u.filter(Boolean),"pie-chart-renderer:invalid-parameters");if(m)throw m;return r}async function L(e){let r=e.pieChartScheme,a=null,t=null;const n=await w(e.basemap,e.view);if(a=null!=n.basemapId?n.basemapId:null,t=null!=n.basemapTheme?n.basemapTheme:null,r)return{scheme:$(r),basemapId:a,basemapTheme:t};const i=T({numColors:e.attributes.length,geometryType:e.layer.geometryType,basemapTheme:t});return i&&(r=i.primaryScheme,a=i.basemapId,t=i.basemapTheme),{scheme:r,basemapId:a,basemapTheme:t}}async function B(e,r){const{valueExpression:a,sqlExpression:t,sqlWhere:n}=v(e.attributes),s=await i("esri/smartMapping/t9n/smartMapping");return c({layer:e.layer,basemap:e.basemap,valueExpression:a,sqlExpression:t,sqlWhere:n,sizeScheme:r,sizeOptimizationEnabled:e.sizeOptimizationEnabled,legendOptions:{title:s.sumOfCategories},view:e.view,signal:e.signal})}async function R(e){const[s,o]=await Promise.all([q(e),i("esri/smartMapping/t9n/smartMapping")]),c=await L(s),y=c?.scheme;if(!y)throw new t("pie-chart-renderer:insufficient-info","Unable to find pie-chart scheme");const w=s.layer,{includeSizeVariable:v,sizeOptimizationEnabled:S,outlineOptimizationEnabled:z,view:E,signal:j}=s,C=y.sizeScheme,x=s.attributes,V=x.map((e=>e.field)).filter(a),[T,I,O,R]=await Promise.all([V.length>1?g({layer:w,fields:V,view:E,signal:j}):null,v?B(s,C):null,!v&&S?m({layer:w,view:E,signal:j}).catch(d):null,z?p({layer:w,view:E,signal:j}).catch(d):null]),P=T?.predominantCategoryInfos?{uniqueValueInfos:T.predominantCategoryInfos}:{uniqueValueInfos:V.map((e=>({value:e,count:0})))},U=f(y.colors,x.length),F=x.map(((e,r)=>new l({field:e.field,valueExpression:e.valueExpression,label:e.label,valueExpressionTitle:e.valueExpressionTitle,color:U[r]}))),M=w.geometryType,N=null!=C&&"background"in C&&C.background,_=new r({attributes:F,othersCategory:new u({label:o.other,color:s.othersCategoryEnabled?y.colorForOthersCategory:null,threshold:.04}),holePercentage:"donut"===s.shape?.45:0,backgroundFillSymbol:N?h(M,{type:"2d",color:N.color,outline:b(N,M,R?.opacity)}):null,size:n(y.size),outline:new k(b(y,"point",R?.opacity)),legendOptions:s.legendOptions});if(I&&(S||I.visualVariables.forEach((e=>{"number"==typeof e.minSize&&"number"==typeof e.maxSize&&(e.minSize*=2.5,e.maxSize*=1.8)})),S&&"point"===M&&I.visualVariables.forEach((e=>{e?.minSize&&"object"==typeof e.minSize&&e.minSize?.stops?.forEach((e=>{e.size*=1.8}))})),_.authoringInfo=I.authoringInfo.clone(),_.visualVariables=I.visualVariables?.map((e=>e.clone()))),R?.visualVariables?.length){const e=R.visualVariables.map((e=>e.clone()));_.visualVariables?_.visualVariables.push(...e):_.visualVariables=e}return O?.minSize&&("point"===M&&O.minSize.stops?.forEach((e=>{e.size*=2.5})),"polygon"===M&&O.minSize.stops?.forEach((e=>{e.size*=1.8})),_.visualVariables?_.visualVariables.push(O.minSize):_.visualVariables=[O.minSize]),{renderer:_,pieChartScheme:$(y),size:I,basemapId:c.basemapId,basemapTheme:c.basemapTheme,statistics:P}}const P=new Set(["unique-value","class-breaks"]),U=new e("#aaaaaa"),F=new e("#5c5c5c"),M=[new e("#e60049"),new e("#0bb4ff"),new e("#50e991"),new e("#e6d800"),new e("#9b19f5"),new e("#ffa300"),new e("#dc0ab4"),new e("#b3d4ff"),new e("#00bfa0"),new e("#f0cccc")];async function N(e){if(!e||!e.layer)throw new t("pie-chart-cluster-renderer:missing-parameters","'layer' parameter is required");const r={...e};r.shape=r.shape||"pie",r.defaultSymbolEnabled??=!0;const a=e.layer;if(!V(O).includes(a.type))throw new t("pie-chart-cluster-renderer:invalid-parameters","'layer' must be one of these types: "+x(O).join(", "));const n=null!=r.signal?{signal:r.signal}:null;await a.load(n);if(!("point"===a.geometryType))throw new t("pie-chart-cluster-renderer:invalid-parameters","Cluster renderers are only supported for point layers");const{renderer:i}=a;if(!i)throw new t("pie-chart-cluster-renderer:invalid-parameters","input layer does not have a renderer.");if(!P.has(i.type))throw new t("pie-chart-cluster-renderer:invalid-parameters",`Cannot create a pie chart renderer for clusters based on a ${i.type} renderer.`);if("valueExpression"in i&&i.valueExpression)throw new t("pie-chart-cluster-renderer:invalid-parameters","Cannot create a pie chart renderer for clusters from a layer whose renderer contains a valueExpression.");if("unique-value"===i.type){if(i.field2)throw new t("pie-chart-cluster-renderer:invalid-parameters","Cannot create a pie chart renderer for clusters from a UniqueValueRenderer using more than one field.");if(null!=i.uniqueValueInfos&&i.uniqueValueInfos.length>10)throw new t("pie-chart-cluster-renderer:invalid-parameters","PieChart cluster renderer cannot be created from a UniqueValueRenderer with more than 10 unique value infos.")}if("class-breaks"===i.type){if(i.classBreakInfos.length<2)throw new t("pie-chart-cluster-renderer:invalid-parameters","Cannot create a pie chart renderer for clusters from a layer renderer with a continuous color or size gradient.");if(i.classBreakInfos.length>10)throw new t("pie-chart-cluster-renderer:invalid-parameters","PieChart cluster renderer can not be created from a ClassBreaksRenderer with more than 10 class break infos.");if("class-breaks-size"===i?.authoringInfo?.type)throw new t("pie-chart-cluster-renderer:invalid-parameters","PieChart cluster renderer can not be created from a ClassBreaksRenderer with breaks varied by size instead of color.")}return r}async function _(e){const a=await N(e),{layer:t,shape:n,defaultSymbolEnabled:s,legendOptions:o}=a,{renderer:u}=t,p=(await i("esri/smartMapping/t9n/smartMapping")).other;let m=[];"unique-value"===u?.type&&(m=A({renderer:u,defaultSymbolEnabled:s,defaultLabelBackup:p})),"class-breaks"===u?.type&&(m=D({renderer:u,defaultSymbolEnabled:s,defaultLabelBackup:p}));const c=[],d=[];for(const r of m){const{field:e,color:a}=r;c.push(e),d.push(new l({color:a,field:e.name,label:e.alias}))}return{fields:c,renderer:new r({attributes:d,legendOptions:o,holePercentage:"donut"===n?.45:0,outline:null,size:18,othersCategory:null})}}function A(e){const{renderer:r,defaultSymbolEnabled:a,defaultLabelBackup:t}=e,{field:n,defaultSymbol:i,defaultLabel:l}=r,u=r.uniqueValueInfos??[],p=i&&a,m=p?9:10,c=f(M,m),d=u.slice(0,m).map(((e,r)=>{const a=e.label,t=c[r];return{field:new s({name:W(e.value?.toString()),alias:a,onStatisticExpression:new o({title:`Field definition - ${a}`,expression:H(n,e),returnType:"number"}),statisticType:"sum"}),color:G(e.symbol,t)}}))??[];if(p){const e="cluster_default",r=l||t;d.push({field:new s({name:W(e),alias:r,onStatisticExpression:new o({title:`Field definition - ${r}`,expression:J(n,u),returnType:"number"}),statisticType:"sum"}),color:G(i,F)})}return d}function D(e){const{renderer:r,defaultSymbolEnabled:a,defaultLabelBackup:t}=e,{field:n,classBreakInfos:i,defaultSymbol:l,defaultLabel:u}=r,p=l&&a,m=p?9:10,c=f(M,m),d=i.slice(0,m).map(((e,r)=>{const a=e.label||`${e.minValue} - ${e.maxValue}`,t=c[r];return{field:new s({name:W(a),alias:a,onStatisticExpression:new o({title:`Field definition - ${a}`,expression:Z(n,e),returnType:"number"}),statisticType:"sum"}),color:G(e.symbol,t)}}));if(p){const e="cluster_default",r=u||t;d.push({field:new s({name:W(e),alias:r,onStatisticExpression:new o({title:`Field definition - ${r}`,expression:K(n,i),returnType:"number"}),statisticType:"sum"}),color:G(l,F)})}return d}function W(e){return"SUM_"+(e+"").replaceAll(/[^a-zA-Z0-9_]/g,"_")}function G(e,r){if("simple-marker"===e?.type&&e.color)return e.color.clone();if("cim"===e?.type){const r=I(e);if(r)return r.clone()}return r?r.clone():U.clone()}function H(e,r){return`Number(Text($feature["${e}"]) == "${r.value+""}")`}function J(e,r){return`Number(!(${r.map((r=>`(Text($feature["${e}"]) == "${r.value+""}")`)).join(" || ")}))`}function Z(e,r){return`Number($feature["${e}"] >= ${r.minValue} && $feature["${e}"] < ${r.maxValue})`}function K(e,r){return`Number(!(${r.map((r=>`($feature["${e}"] >= ${r.minValue} && $feature["${e}"] < ${r.maxValue})`)).join(" || ")}))`}export{R as createRenderer,_ as createRendererForClustering};
|
|
5
|
+
import e from"../../Color.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import r from"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/Logger.js";import"../../symbols.js";import{isSome as a}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{toPt as n}from"../../core/screenUtils.js";import{fetchMessageBundle as i}from"../../intl/messages.js";import s from"../../layers/support/AggregateField.js";import o from"../../layers/support/ExpressionInfo.js";import l from"../../renderers/support/AttributeColorInfo.js";import{OthersCategory as u}from"../../renderers/support/OthersCategory.js";import p from"../heuristics/outline.js";import m from"../heuristics/sizeRange.js";import{createVisualVariables as c}from"./size.js";import{errorCallback as d,createColors as f,createSymbol as h,getSymbolOutlineFromScheme as b,verifyBasicFieldValidity as y,getBasemapInfo as w}from"./support/utils.js";import g from"../statistics/predominantCategories.js";import{getSumOfAttributesExpr as v}from"../statistics/support/utils.js";import{verifyBinningParams as S}from"../support/binningUtils.js";import{getFieldsList as z}from"../support/utils.js";import{LayerType as E,binningCapableLayerTypes as j,createLayerAdapter as C,getLayerTypeLabels as x,getLayerTypes as V}from"../support/adapters/support/layerUtils.js";import{cloneScheme as $,getSchemes as T}from"../symbology/pieChart.js";import{getCIMSymbolColor as I}from"../../symbols/support/cimSymbolUtils.js";import k from"../../symbols/SimpleLineSymbol.js";const O=[E.CSVLayer,E.FeatureLayer,E.GeoJSONLayer,E.OGCFeatureLayer,E.OrientedImageryLayer,E.StreamLayer,E.WFSLayer];async function q(e){if(!(e?.layer&&e.view&&e.attributes?.length))throw new t("pie-chart-renderer:missing-parameters","'layer', 'view' and 'attributes' parameters are required");if(e.attributes.length>10)throw new t("pie-chart-renderer:invalid-parameters","PieChart renderer does not support more than 10 attributes");e.forBinning&&S(e,"pie-chart-renderer");const r={...e,layer:e.layer,view:e.view,attributes:e.attributes};r.shape=r.shape||"pie",r.othersCategoryEnabled??=!0,r.includeSizeVariable=e.includeSizeVariable||!1;const a=e.forBinning?j:O,n=C(r.layer,a,e.forBinning);if(!n)throw new t("pie-chart-renderer:invalid-parameters","'layer' must be one of these types: "+x(a).join(", "));r.layer=n;const i=null!=r.signal?{signal:r.signal}:null;await Promise.all([e.view.when(),n.load(i)]);const s=n.geometryType,o="polygon"===s,l="point"===s||"multipoint"===s||o;if(r.outlineOptimizationEnabled=!!o&&r.outlineOptimizationEnabled,r.sizeOptimizationEnabled=!!l&&r.sizeOptimizationEnabled,!l)throw new t("pie-chart-renderer:not-supported","PieChart renderer is only supported for point and polygon layers");const u=[],p=r.attributes;for(const t of p){const e=await z({field:t.field,valueExpression:t.valueExpression});u.push(...e)}const m=y(n,u.filter(Boolean),"pie-chart-renderer:invalid-parameters");if(m)throw m;return r}async function L(e){let r=e.pieChartScheme,a=null,t=null;const n=await w(e.basemap,e.view);if(a=null!=n.basemapId?n.basemapId:null,t=null!=n.basemapTheme?n.basemapTheme:null,r)return{scheme:$(r),basemapId:a,basemapTheme:t};const i=T({numColors:e.attributes.length,geometryType:e.layer.geometryType,basemapTheme:t});return i&&(r=i.primaryScheme,a=i.basemapId,t=i.basemapTheme),{scheme:r,basemapId:a,basemapTheme:t}}async function B(e,r){const{valueExpression:a,sqlExpression:t,sqlWhere:n}=v(e.attributes),s=await i("esri/smartMapping/t9n/smartMapping");return c({layer:e.layer,basemap:e.basemap,valueExpression:a,sqlExpression:t,sqlWhere:n,sizeScheme:r,sizeOptimizationEnabled:e.sizeOptimizationEnabled,legendOptions:{title:s.sumOfCategories},view:e.view,signal:e.signal})}async function R(e){const[s,o]=await Promise.all([q(e),i("esri/smartMapping/t9n/smartMapping")]),c=await L(s),y=c?.scheme;if(!y)throw new t("pie-chart-renderer:insufficient-info","Unable to find pie-chart scheme");const w=s.layer,{includeSizeVariable:v,sizeOptimizationEnabled:S,outlineOptimizationEnabled:z,view:E,signal:j}=s,C=y.sizeScheme,x=s.attributes,V=x.map((e=>e.field)).filter(a),[T,I,O,R]=await Promise.all([V.length>1?g({layer:w,fields:V,view:E,signal:j}):null,v?B(s,C):null,!v&&S?m({layer:w,view:E,signal:j}).catch(d):null,z?p({layer:w,view:E,signal:j}).catch(d):null]),P=T?.predominantCategoryInfos?{uniqueValueInfos:T.predominantCategoryInfos}:{uniqueValueInfos:V.map((e=>({value:e,count:0})))},U=f(y.colors,x.length),F=x.map(((e,r)=>new l({field:e.field,valueExpression:e.valueExpression,label:e.label,valueExpressionTitle:e.valueExpressionTitle,color:U[r]}))),M=w.geometryType,N=null!=C&&"background"in C&&C.background,_=new r({attributes:F,othersCategory:new u({label:o.other,color:s.othersCategoryEnabled?y.colorForOthersCategory:null,threshold:.04}),holePercentage:"donut"===s.shape?.45:0,backgroundFillSymbol:N?h(M,{type:"2d",color:N.color,outline:b(N,M,R?.opacity)}):null,size:n(y.size),outline:new k(b(y,"point",R?.opacity)),legendOptions:s.legendOptions});if(I&&(S||I.visualVariables.forEach((e=>{"number"==typeof e.minSize&&"number"==typeof e.maxSize&&(e.minSize*=2.5,e.maxSize*=1.8)})),S&&"point"===M&&I.visualVariables.forEach((e=>{e?.minSize&&"object"==typeof e.minSize&&e.minSize?.stops?.forEach((e=>{e.size*=1.8}))})),_.authoringInfo=I.authoringInfo.clone(),_.visualVariables=I.visualVariables?.map((e=>e.clone()))),R?.visualVariables?.length){const e=R.visualVariables.map((e=>e.clone()));_.visualVariables?_.visualVariables.push(...e):_.visualVariables=e}return O?.minSize&&("point"===M&&O.minSize.stops?.forEach((e=>{e.size*=2.5})),"polygon"===M&&O.minSize.stops?.forEach((e=>{e.size*=1.8})),_.visualVariables?_.visualVariables.push(O.minSize):_.visualVariables=[O.minSize]),{renderer:_,pieChartScheme:$(y),size:I,basemapId:c.basemapId,basemapTheme:c.basemapTheme,statistics:P}}const P=new Set(["unique-value","class-breaks"]),U=new e("#aaaaaa"),F=new e("#5c5c5c"),M=[new e("#e60049"),new e("#0bb4ff"),new e("#50e991"),new e("#e6d800"),new e("#9b19f5"),new e("#ffa300"),new e("#dc0ab4"),new e("#b3d4ff"),new e("#00bfa0"),new e("#f0cccc")];async function N(e){if(!e||!e.layer)throw new t("pie-chart-cluster-renderer:missing-parameters","'layer' parameter is required");const r={...e};r.shape=r.shape||"pie",r.defaultSymbolEnabled??=!0;const a=e.layer;if(!V(O).includes(a.type))throw new t("pie-chart-cluster-renderer:invalid-parameters","'layer' must be one of these types: "+x(O).join(", "));const n=null!=r.signal?{signal:r.signal}:null;await a.load(n);if(!("point"===a.geometryType))throw new t("pie-chart-cluster-renderer:invalid-parameters","Cluster renderers are only supported for point layers");const{renderer:i}=a;if(!i)throw new t("pie-chart-cluster-renderer:invalid-parameters","input layer does not have a renderer.");if(!P.has(i.type))throw new t("pie-chart-cluster-renderer:invalid-parameters",`Cannot create a pie chart renderer for clusters based on a ${i.type} renderer.`);if("valueExpression"in i&&i.valueExpression)throw new t("pie-chart-cluster-renderer:invalid-parameters","Cannot create a pie chart renderer for clusters from a layer whose renderer contains a valueExpression.");if("unique-value"===i.type){if(i.field2)throw new t("pie-chart-cluster-renderer:invalid-parameters","Cannot create a pie chart renderer for clusters from a UniqueValueRenderer using more than one field.");if(null!=i.uniqueValueInfos&&i.uniqueValueInfos.length>10)throw new t("pie-chart-cluster-renderer:invalid-parameters","PieChart cluster renderer cannot be created from a UniqueValueRenderer with more than 10 unique value infos.")}if("class-breaks"===i.type){if(i.classBreakInfos.length<2)throw new t("pie-chart-cluster-renderer:invalid-parameters","Cannot create a pie chart renderer for clusters from a layer renderer with a continuous color or size gradient.");if(i.classBreakInfos.length>10)throw new t("pie-chart-cluster-renderer:invalid-parameters","PieChart cluster renderer can not be created from a ClassBreaksRenderer with more than 10 class break infos.");if("class-breaks-size"===i?.authoringInfo?.type)throw new t("pie-chart-cluster-renderer:invalid-parameters","PieChart cluster renderer can not be created from a ClassBreaksRenderer with breaks varied by size instead of color.")}return r}async function _(e){const a=await N(e),{layer:t,shape:n,defaultSymbolEnabled:s,legendOptions:o}=a,{renderer:u}=t,p=(await i("esri/smartMapping/t9n/smartMapping")).other;let m=[];"unique-value"===u?.type&&(m=A({renderer:u,defaultSymbolEnabled:s,defaultLabelBackup:p})),"class-breaks"===u?.type&&(m=D({renderer:u,defaultSymbolEnabled:s,defaultLabelBackup:p}));const c=[],d=[];for(const r of m){const{field:e,color:a}=r;c.push(e),d.push(new l({color:a,field:e.name,label:e.alias}))}return{fields:c,renderer:new r({attributes:d,legendOptions:o,holePercentage:"donut"===n?.45:0,outline:null,size:9,othersCategory:null})}}function A(e){const{renderer:r,defaultSymbolEnabled:a,defaultLabelBackup:t}=e,{field:n,defaultSymbol:i,defaultLabel:l}=r,u=r.uniqueValueInfos??[],p=i&&a,m=p?9:10,c=f(M,m),d=u.slice(0,m).map(((e,r)=>{const a=e.label,t=c[r];return{field:new s({name:W(e.value?.toString()),alias:a,onStatisticExpression:new o({title:`Field definition - ${a}`,expression:H(n,e),returnType:"number"}),statisticType:"sum"}),color:G(e.symbol,t)}}))??[];if(p){const e="cluster_default",r=l||t;d.push({field:new s({name:W(e),alias:r,onStatisticExpression:new o({title:`Field definition - ${r}`,expression:J(n,u),returnType:"number"}),statisticType:"sum"}),color:G(i,F)})}return d}function D(e){const{renderer:r,defaultSymbolEnabled:a,defaultLabelBackup:t}=e,{field:n,classBreakInfos:i,defaultSymbol:l,defaultLabel:u}=r,p=l&&a,m=p?9:10,c=f(M,m),d=i.slice(0,m).map(((e,r)=>{const a=e.label||`${e.minValue} - ${e.maxValue}`,t=c[r];return{field:new s({name:W(a),alias:a,onStatisticExpression:new o({title:`Field definition - ${a}`,expression:Z(n,e),returnType:"number"}),statisticType:"sum"}),color:G(e.symbol,t)}}));if(p){const e="cluster_default",r=u||t;d.push({field:new s({name:W(e),alias:r,onStatisticExpression:new o({title:`Field definition - ${r}`,expression:K(n,i),returnType:"number"}),statisticType:"sum"}),color:G(l,F)})}return d}function W(e){return"SUM_"+(e+"").replaceAll(/[^a-zA-Z0-9_]/g,"_")}function G(e,r){if("simple-marker"===e?.type&&e.color)return e.color.clone();if("cim"===e?.type){const r=I(e);if(r)return r.clone()}return r?r.clone():U.clone()}function H(e,r){return`Number(Text($feature["${e}"]) == "${r.value+""}")`}function J(e,r){return`Number(!(${r.map((r=>`(Text($feature["${e}"]) == "${r.value+""}")`)).join(" || ")}))`}function Z(e,r){return`Number($feature["${e}"] >= ${r.minValue} && $feature["${e}"] < ${r.maxValue})`}function K(e,r){return`Number(!(${r.map((r=>`($feature["${e}"] >= ${r.minValue} && $feature["${e}"] < ${r.maxValue})`)).join(" || ")}))`}export{R as createRenderer,_ as createRendererForClustering};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{verticalLengthUnitFromSpatialReference as e,convertUnit as n}from"../core/unitUtils.js";import{getMetersPerUnit as t}from"../symbols/support/unitConversionUtils.js";function o(e){return e?w:$}function r(e,n){return n?.mode?n.mode:o(e).mode}function u(e,n){return null!=n?n:o(e)}function i(e,n){return r(null!=e&&e.hasZ,n)}function l(e,n){return u(null!=e&&!!e.hasZ,n)}function s(e){const n=f(e);return i(e.geometry,n)}function a(e){const n=f(e),t=i(e.geometry,n);return{mode:t,offset:null!=n&&"on-the-ground"!==t?P(n):0}}function c(e){if("on-the-ground"===s(e))return!1;const n=f(e),t=n?.featureExpressionInfo?n.featureExpressionInfo.expression:null;return!(!t||"0"===t)}function f(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function d(t,o){if(!t?.offset)return 0;const{offset:r,unit:u}=t;if("decimal-degrees"===u)return 0;const i="unknown"!==u&&u?u:"meters",l=e(o);return l?n(r,i,l):0}function v(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=d(t,e.spatialReference);switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function g(e,n,t,o=null){return m(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function h(e,n,t,o,r=null){return m(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function m(e,n,t,o,r,u,i=null){if(null==u)return;const l=null!=i?i.mode:"absolute-height";if("on-the-ground"===l)return 0;const{absoluteZ:s}=p(n,t,o,r,e,u);return b(s,n,t,o,r,e,i,l)}function p(e,n,t,o,r,u){const i=d(u,o);switch(u.mode){case"absolute-height":return{absoluteZ:t+i,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+i,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+i,elevation:u}}}}function b(e,n,t,o,r,u,i,l){const s=d(i,r);switch(l){case"absolute-height":return e-s;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+s);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+s)}}function E(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function x(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function y(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function Z(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function I(e,n){n&&e.warn(".elevationInfo=",n)}function P(e){return(e?.offset??0)*t(e?.unit)}const w={mode:"absolute-height",offset:0},$={mode:"on-the-ground",offset:null};export{w as absoluteHeightElevationInfo,E as elevationContextAffectsAlignment,x as elevationModeRequiredMessage,y as elevationModeUnsupportedMessage,Z as featureExpressionUnsupportedMessage,g as getConvertedElevation,h as getConvertedElevationFromVector,m as getConvertedElevationFromXYZ,u as getEffectiveElevationInfo,r as getEffectiveElevationMode,d as getElevationOffset,P as getElevationOffsetInMeters,l as getGeometryEffectiveElevationInfo,i as getGeometryEffectiveElevationMode,a as getGraphicEffectiveElevationInfo,s as getGraphicEffectiveElevationMode,v as getZForElevationMode,c as hasGraphicFeatureExpressionInfo,I as logInvalidElevationInfoWarning,$ as onTheGroundElevationInfo,p as zValueInAbsoluteHeightMode};
|
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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20240223",d="417264d9eb93e159f11fe008e11ab15de964fd70";export{e as buildDate,d 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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as O}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as I}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function K(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let Z=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),s=E(r);e.push({objectId:t,highlightFlags:s})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new I(this.layer);case"oriented-imagery":return new O(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:s,filter:i,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(s),l=a?.toJSON(),h=i?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:i.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(s);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const i=await this.featureContainer.hitTest(s);if(0===i.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(i),n=this.featureContainer.getSortKeys(i),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return K(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r),{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r),{})}async queryUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await K(r,{features:[]}),i=F.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await K(r,{features:[]}),i=S.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return K(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return K(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return K(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return K(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return K(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return K(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await K(r,{count:0,extent:null});return{count:s.count,extent:G.fromJSON(s.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,s=this.featureContainer.updatingHandles.updating,i=e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),s=t&&this.availableFields.includes(t);return r&&!s?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this.layerAdapter.createServiceOptions(this.view),i=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(s,i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(s.source)&&(u=s.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,s,i){i&&(i=i.clone());const a=null!=i?i.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(i??=new w,i.timeExtent=o),i=t.addFilters?.(i,e)??i;let n=i?.toJSON()??null;return s.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(s)),n}e([g()],Z.prototype,"_worker",void 0),e([g()],Z.prototype,"_commandsQueue",void 0),e([g()],Z.prototype,"_sourceRefreshVersion",void 0),e([g()],Z.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],Z.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],Z.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],Z.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],Z.prototype,"hasFullGeometries",null),e([g()],Z.prototype,"featureEffectView",void 0),e([g()],Z.prototype,"labelingCollisionInfos",null),e([g()],Z.prototype,"layerAdapter",null),e([g()],Z.prototype,"updateHash",null),e([g()],Z.prototype,"updating",void 0),Z=e([f(z)],Z);const X=Z;export{X as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as s}from"../../../core/arrayUtils.js";import i from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{debounce as h,throwIfNotAbortError as c,isAbortError as p}from"../../../core/promiseUtils.js";import{watch as d,initial as y}from"../../../core/reactiveUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{diff as m}from"../../../core/accessorSupport/diffUtils.js";import _ from"../../../layers/effects/FeatureEffectView.js";import w from"../../../layers/support/FeatureFilter.js";import{packFields as v}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as b}from"../../../layers/support/layerUtils.js";import S from"../../../rest/support/AggregateFeatureSet.js";import F from"../../../rest/support/FeatureSet.js";import A from"../../../rest/support/Query.js";import{getHighlightBits as E}from"../engine/highlightReasons.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as C}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as R}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as U}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as j}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as x}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as q}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as Q}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as k}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as I}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{StreamLayerAdapter as O}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as L}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as H}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{HighlightCounter as J}from"./support/HighlightCounter.js";import{FeatureTileSubscriptionManager as N}from"../tiling/FeatureTileSubscriptionManager.js";import T from"../../layers/FeatureLayerView.js";import M from"../../layers/LayerView.js";import $ from"../../layers/RefreshableLayerView.js";import G from"../../../geometry/Extent.js";function P(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const z="esri.views.2d.layers.FeatureLayerView2D",B=4294967294;async function K(e,t){try{return await e}catch(r){if("no-queryEngine"!==r.name)throw r;return t}}let Z=class extends(T($(V(M)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new J,this._updateHighlight=h((async()=>{const e=[];for(const t of this._highlightCounter.ids()){const r=this._highlightCounter.getHighestReason(t),s=E(r);e.push({objectId:t,highlightFlags:s})}this._worker.pipeline.updateHighlight({highlights:e})})),this._lastAvailableFields=[],this.eventLog=new U,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new _}destroy(){this._worker?.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===b(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._worker&&this._worker.destroy();const t=this._createClientOptions();this._worker=await R(t)}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new q(this.layer):new x(this.layer);case"geojson":case"csv":case"wfs":return new q(this.layer);case"subtype-group":return new L(this.layer);case"ogc-feature":return new k(this.layer);case"stream":return new O(this.layer);case"oriented-imagery":return new I(this.layer);case"knowledge-graph-sublayer":return new Q(this.layer);case"catalog-footprint":return new j(this.layer);default:a(this.layer)}return null}get updateHash(){if(!this.layerAdapter)return null;const{availableFields:e,_displayRefreshVersion:t,timeExtent:r,clips:s,filter:i,featureEffect:a,_sourceRefreshVersion:o,view:{timeZone:n}}=this,u=JSON.stringify(s),l=a?.toJSON(),h=i?.toJSON();return JSON.stringify({availableFields:e,clipsHash:u,displayRefreshVersion:t,effectHash:l,filterHash:h,sourceRefreshVersion:o,timeExtent:r,timeZone:n,...this.layerAdapter.getUpdateHashProperties(this.view)})}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return this._worker.pipeline.queryHeatmapStatistics(e)}highlight(e,t="highlight"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:i.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(s);return o?.length?(this._addHighlight(o,t),n((()=>this._removeHighlight(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,s){const i=await this.featureContainer.hitTest(s);if(0===i.length)return null;const{features:a,aggregates:o}=await this._worker.pipeline.getDisplayFeatures(i),n=this.featureContainer.getSortKeys(i),u=({displayId:e},{displayId:t})=>n.has(e)&&n.has(t)?n.get(e)-n.get(t):e-t;return a.sort(u).reverse(),o.sort(u).reverse(),[...o.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...a.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}queryStatistics(){return K(this._worker.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}querySummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r),{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r),{})}async queryUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r),{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r),{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r),{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r),{classBreakInfos:[]})}async queryHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s={...t,scale:this.view.scale};return K(this._worker.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r),{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=F.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=this._worker.pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await K(r,{features:[]}),i=F.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await K(r,{features:[]}),i=S.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}queryAggregateIds(e,t){return K(this._worker.aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t),[])}queryAggregateCount(e,t){return K(this._worker.aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t),0)}queryAggregateJSON(e,t){return K(this._worker.aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),{features:[]})}async queryFeaturesJSON(e,t){return K(this._worker.features.executeQuery(this._cleanUpQuery(e),t),{features:[]})}queryObjectIds(e,t){return K(this._worker.features.executeQueryForIds(this._cleanUpQuery(e),t),[])}queryFeatureCount(e,t){return K(this._worker.features.executeQueryForCount(this._cleanUpQuery(e),t),0)}async queryExtent(e,t){const r=this._worker.features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await K(r,{count:0,extent:null});return{count:s.count,extent:G.fromJSON(s.extent)}}async getSampleFeatures(e){return this._worker.pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;const t=this._subscriptionManager.update(e);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),this.featureContainer=new C(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new N({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),this._worker.pipeline.updateSubscriptions(e)},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([d((()=>this.updateHash),(()=>this._update()),y),d((()=>this.updateSuspended),(e=>{e||this._subscriptionManager.resume()}))]),"stream"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._fields=null,this.featureContainer.destroy(),this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._worker.pipeline.onDetach()}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,s=this.featureContainer.updatingHandles.updating,i=e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t)))),fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await H(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=A.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=A.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();return this._validateEdit(e)?this._commandsQueue.push({type:"edit",edits:e}).catch(c):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%B+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%B+1}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),s=t&&this.availableFields.includes(t);return r&&!s?(u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this.layerAdapter.createServiceOptions(this.view),i=this._createViewSchemaConfig(),a={source:this.layerAdapter.createSourceSchema(s,i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},o=!!m(this._lastSchema?.source.mutable,a.source.mutable)||!!m(this._lastSchema?.processor,a.processor);if(!o)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=a,this._fields=null;const n=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${n}] FeatureLayerView2D._doUpdate`,{changes:o});let u=[];Array.isArray(s.source)&&(u=s.source),await this._worker.pipeline.updateSchema(a,n,{transferList:u}),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${n}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){try{this.featureContainer.editStart(),await this._worker.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(t){p(t),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=P(this._lastAvailableFields,e);return this._lastAvailableFields=t,v(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[W(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,outSpatialReference:this.view.spatialReference,tileInfoJSON:this.view.featuresTilingScheme.tileInfo.toJSON(),scale:this.view.scale}}_addHighlight(e,t){this._highlightCounter.addReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_removeHighlight(e,t){this._highlightCounter.deleteReason(e,t),this._updateHighlight().catch((e=>{p(e)||u.getLogger(this).error(e)}))}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function W(e,t,r,s,i){i&&(i=i.clone());const a=null!=i?i.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(i??=new w,i.timeExtent=o),i=t.addFilters?.(i,e)??i;let n=i?.toJSON()??null;return s.size&&(n??=(new w).toJSON(),n.hiddenIds=Array.from(s)),n}e([g()],Z.prototype,"_worker",void 0),e([g()],Z.prototype,"_commandsQueue",void 0),e([g()],Z.prototype,"_sourceRefreshVersion",void 0),e([g()],Z.prototype,"_displayRefreshVersion",void 0),e([g({readOnly:!0})],Z.prototype,"_pipelineUpdating",void 0),e([g({readOnly:!0})],Z.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],Z.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],Z.prototype,"hasFullGeometries",null),e([g()],Z.prototype,"featureEffectView",void 0),e([g()],Z.prototype,"labelingCollisionInfos",null),e([g()],Z.prototype,"layerAdapter",null),e([g()],Z.prototype,"updateHash",null),e([g()],Z.prototype,"updating",void 0),Z=e([f(z)],Z);const X=Z;export{X 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.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{createScreenPointArray as r,createRenderScreenPointArray3 as n,screenPointObjectToArray as a,castRenderScreenPointArray as c}from"../../../core/screenUtils.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,set as _,multiply as u,identity as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as p,t as b,e as v,h as y,c as j,a as L,s as S,f as R}from"../../../chunks/vec32.js";import{create as O,ZEROS as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as A,projectPoint as E}from"../../../geometry/projection.js";import{computeENUToSphericalPCPFLocalRotation as D}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as F}from"../../../geometry/projection/projectors.js";import{containsPointObject as z}from"../../../geometry/support/aaBoundingRect.js";import{create as C,distance2 as P,fromPoints as x,closestRayDistance2 as I}from"../../../geometry/support/lineSegment.js";import{create as M,fromPositionAndNormal as k,intersectRay as U}from"../../../geometry/support/plane.js";import{create as W}from"../../../geometry/support/ray.js";import{sv3d as B}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N,hydratedSpatialReference as H}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as V}from"../support/ElevationProvider.js";import{fromScreen as q}from"../support/geometryUtils/ray.js";import{Camera as G}from"../webgl-engine/lib/Camera.js";import{Object3D as Y}from"../webgl-engine/lib/Object3D.js";import{UpdatePolicy as J}from"../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as K}from"../webgl-engine/lib/WebGLLayer.js";import{ManipulatorStateCustomFlags as Q,ManipulatorStateFlags as X}from"../../interactive/interfaces.js";import Z from"../../../geometry/Point.js";class ${constructor(e){this.metadata=void 0,this._camera=new G,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=m(),this._worldFrame=null,this._renderLocation=O(),this._renderLocationDirty=!0,this._location=new Z({x:0,y:0,z:0}),this._elevationAlignedLocation=new Z,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=Q.None,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:r(),renderScreenPointArray:n(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),i((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=m()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=H(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=p(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(t,i){if(!this.available)return null;const s=a(t,ie),o=this._getCollisionRadius(i),r=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(f(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+r;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae),n=o*this.screenLocation.pixelSize,a=q(this._camera,s,oe);if(null==a)return null;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],i);for(let t=1;t<s.length;t++){const o=v(he,s[t],i),l=I(x(e,o,se),a);if(null!=l&&l<n*n){const t=p(B.get(),e,o);y(t,t,.5);const i=c(B.get());return this._camera.projectToRenderScreen(t,i),i[2]+r}j(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??w,i=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(i,ae),a=o*this.screenLocation.pixelSize,c=q(this._camera,s,oe);if(null==c)return null;const h=l(re,n),d=b(_e,e,h),_=v(ue,t,n);k(_,d,ce);const u=de;if(U(ce,c,u)&&L(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+r;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(i,ae),a=o*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=q(this._camera,s,oe);if(null==h)return null;const d=l(re,n),_=b(_e,t,d),u=this._calculateModelTransformPosition(ue);k(u,_,ce);const g=de;if(!U(ce,h,g))break;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],n);for(let t=1;t<s.length;t++){const i=v(he,s[t],n),o=P(x(e,i,se),g);if(null!=o&&o<a*a){const t=p(B.get(),e,i);y(t,t,.5);const s=c(B.get());return this._camera.projectToRenderScreen(t,s),s[2]+r}j(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new K(t,{pickable:!1,updatePolicy:J.SYNC}),i.engineLayerId=this._engineLayer.id):t?.getObject&&(this._engineLayer=t.getObject(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,null==this._materialIdReferences&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),A(this._location.spatialReference,this.view.spatialReference)||(this.location=new Z({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,o(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){E(this.location,me,e.spatialReference)&&z(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=this.elevationInfo.offset??0;switch(this.elevationInfo.mode){case"on-the-ground":e=V(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(V(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(V(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?X.Focused:X.Unfocused)|(this.selected?X.Selected:X.Unselected),o=this._noDisplayCount>0;for(const{stateMask:r,objects:n}of i){if(o){for(const e of n)e.visible=!1;continue}const e=(r&X.All)!==X.None,i=(r&Q.All)!==Q.None,a=!e||(s&r)==(r&X.All),c=!i||(this.state&r)==(r&Q.All);if(a&&c)for(const s of n)s.visible=!0,s.transformation=t;else for(const t of n)t.visible=!1}}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach((({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))}));const s=new Map;this._renderObjects.forEach((e=>{const t=new Y({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)}));const o=[];s.forEach(((e,t)=>o.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id)||0;0===s&&e.add(t),i.set(t.id,s+1)})),t.forEach((({objects:t})=>{i.addMany(t),e.addMany(t)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:t})=>{i.removeMany(t),e.removeMany(t)})),s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id);1===s?(e.remove(t),i.delete(t.id)):i.set(t.id,s-1)})),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ne);return S(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return R(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return _(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&u(t,t,this._worldFrame),u(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){let e=!1;if(null!=this._engineResources)for(const t of this._engineResources.objectsByState){for(const i of t.objects)if(i.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,i){switch(e.viewingMode){case"local":return g(i),!0;case"global":{const o=T(e.renderCoordsHelper.spatialReference);return F(t,0,le,0,o.radius),D(s(le[0]),s(le[1]),i),!0}}}const ie=r(),se=C(),oe=W(),re=h(),ne=m(),ae=m(),ce=M(),le=O(),he=O(),de=O(),_e=O(),ue=O(),ge=O(),me=new Z({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{$ as Manipulator3D};
|
|
5
|
+
import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{createScreenPointArray as r,createRenderScreenPointArray3 as n,screenPointObjectToArray as a,castRenderScreenPointArray as c}from"../../../core/screenUtils.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,set as _,multiply as u,identity as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{g as p,t as b,e as v,h as y,c as j,a as L,s as S,f as R}from"../../../chunks/vec32.js";import{create as O,ZEROS as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as A,projectPoint as E}from"../../../geometry/projection.js";import{computeENUToSphericalPCPFLocalRotation as D}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as F}from"../../../geometry/projection/projectors.js";import{containsPointObject as z}from"../../../geometry/support/aaBoundingRect.js";import{create as P,distance2 as C,fromPoints as I,closestRayDistance2 as x}from"../../../geometry/support/lineSegment.js";import{create as M,fromPositionAndNormal as k,intersectRay as U}from"../../../geometry/support/plane.js";import{create as W}from"../../../geometry/support/ray.js";import{sv3d as B}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N,hydratedSpatialReference as H}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationOffset as V}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as q}from"../support/ElevationProvider.js";import{fromScreen as G}from"../support/geometryUtils/ray.js";import{Camera as Y}from"../webgl-engine/lib/Camera.js";import{Object3D as J}from"../webgl-engine/lib/Object3D.js";import{UpdatePolicy as K}from"../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as Q}from"../webgl-engine/lib/WebGLLayer.js";import{ManipulatorStateCustomFlags as X,ManipulatorStateFlags as Z}from"../../interactive/interfaces.js";import $ from"../../../geometry/Point.js";class ee{constructor(e){this.metadata=void 0,this._camera=new Y,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=m(),this._worldFrame=null,this._renderLocation=O(),this._renderLocationDirty=!0,this._location=new $({x:0,y:0,z:0}),this._elevationAlignedLocation=new $,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=X.None,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:r(),renderScreenPointArray:n(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=pe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),i((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){te(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=m()),ie(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=H(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(te(this._modelTransform)){const t=this._calculateModelTransformOffset(me);e=p(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(t,i){if(!this.available)return null;const s=a(t,se),o=this._getCollisionRadius(i),r=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(f(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+r;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ce),n=o*this.screenLocation.pixelSize,a=G(this._camera,s,re);if(null==a)return null;for(const s of e){if(0===s.length)continue;const e=v(he,s[0],i);for(let t=1;t<s.length;t++){const o=v(de,s[t],i),l=x(I(e,o,oe),a);if(null!=l&&l<n*n){const t=p(B.get(),e,o);y(t,t,.5);const i=c(B.get());return this._camera.projectToRenderScreen(t,i),i[2]+r}j(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??w,i=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(i,ce),a=o*this.screenLocation.pixelSize,c=G(this._camera,s,re);if(null==c)return null;const h=l(ne,n),d=b(ue,e,h),_=v(ge,t,n);k(_,d,le);const u=_e;if(U(le,c,u)&&L(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+r;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(i,ce),a=o*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=G(this._camera,s,re);if(null==h)return null;const d=l(ne,n),_=b(ue,t,d),u=this._calculateModelTransformPosition(ge);k(u,_,le);const g=_e;if(!U(le,h,g))break;for(const s of e){if(0===s.length)continue;const e=v(he,s[0],n);for(let t=1;t<s.length;t++){const i=v(de,s[t],n),o=C(I(e,i,oe),g);if(null!=o&&o<a*a){const t=p(B.get(),e,i);y(t,t,.5);const s=c(B.get());return this._camera.projectToRenderScreen(t,s),s[2]+r}j(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new Q(t,{pickable:!1,updatePolicy:K.SYNC}),i.engineLayerId=this._engineLayer.id):t?.getObject&&(this._engineLayer=t.getObject(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,null==this._materialIdReferences&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),A(this._location.spatialReference,this.view.spatialReference)||(this.location=new $({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,o(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){E(this.location,fe,e.spatialReference)&&z(e.extent,fe)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=V(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case"on-the-ground":e=q(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(q(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(q(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ce;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?Z.Focused:Z.Unfocused)|(this.selected?Z.Selected:Z.Unselected),o=this._noDisplayCount>0;for(const{stateMask:r,objects:n}of i){if(o){for(const e of n)e.visible=!1;continue}const e=(r&Z.All)!==Z.None,i=(r&X.All)!==X.None,a=!e||(s&r)==(r&Z.All),c=!i||(this.state&r)==(r&X.All);if(a&&c)for(const s of n)s.visible=!0,s.transformation=t;else for(const t of n)t.visible=!1}}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach((({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))}));const s=new Map;this._renderObjects.forEach((e=>{const t=new J({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)}));const o=[];s.forEach(((e,t)=>o.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id)||0;0===s&&e.add(t),i.set(t.id,s+1)})),t.forEach((({objects:t})=>{i.addMany(t),e.addMany(t)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:t})=>{i.removeMany(t),e.removeMany(t)})),s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id);1===s?(e.remove(t),i.delete(t.id)):i.set(t.id,s-1)})),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae);return S(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return R(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return _(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&u(t,t,this._worldFrame),u(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){let e=!1;if(null!=this._engineResources)for(const t of this._engineResources.objectsByState){for(const i of t.objects)if(i.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function te(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function ie(e,t,i){switch(e.viewingMode){case"local":return g(i),!0;case"global":{const o=T(e.renderCoordsHelper.spatialReference);return F(t,0,he,0,o.radius),D(s(he[0]),s(he[1]),i),!0}}}const se=r(),oe=P(),re=W(),ne=h(),ae=m(),ce=m(),le=M(),he=O(),de=O(),_e=O(),ue=O(),ge=O(),me=O(),fe=new $({x:0,y:0,z:0,spatialReference:null}),pe=()=>{};export{ee as Manipulator3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{handlesGroup as i,makeHandle as s}from"../../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as o,when as a,syncAndInitial as n,sync as l,initial as c}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as d,getEffectiveElevationMode as v}from"../../../../../support/elevationInfoUtils.js";import f from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as g}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as w}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as y}from"../meshFastUpdateUtils.js";import{Settings as E}from"../settings.js";import{ExtendedLineVisualElement as V}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as _}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as j}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as G}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as L}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as S}from"../../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as x}from"../../../webgl-engine/lib/Material.js";import{DrawGraphicTool as D,geometryTypeToDrawOperationGeometryType as I}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as T}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as C,ElevationDrawSurface as O}from"../../../../draw/drawSurfaces.js";import{getDrawMeshHelpMessage as b}from"../../../../draw/support/helpMessageUtils3d.js";let z=class extends D{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new E({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new f({mode:e,offset:t});const
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{handlesGroup as i,makeHandle as s}from"../../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as o,when as a,syncAndInitial as n,sync as l,initial as c}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEffectiveElevationInfo as d,getEffectiveElevationMode as v}from"../../../../../support/elevationInfoUtils.js";import f from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as g}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as w}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as y}from"../meshFastUpdateUtils.js";import{Settings as E}from"../settings.js";import{ExtendedLineVisualElement as V}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as _}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as j}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as G}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as L}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as S}from"../../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as x}from"../../../webgl-engine/lib/Material.js";import{DrawGraphicTool as D,geometryTypeToDrawOperationGeometryType as I}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as T}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as C,ElevationDrawSurface as O}from"../../../../draw/drawSurfaces.js";import{getDrawMeshHelpMessage as b}from"../../../../draw/support/helpMessageUtils3d.js";let z=class extends D{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this._settings=new E({getTheme:()=>this.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t,unit:i}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new f({mode:e,offset:t,unit:i});const s=this.geometryToPlace;s&&this.addHandles([o((()=>s.vertexSpace.origin),(()=>this.graphic?.notifyMeshTransformChanged()),l),o((()=>({vertexAttributes:s.vertexAttributes,alwaysUpdate:{}})),(()=>this.graphic?.notifyGeometryChanged()),l)])}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:d(t)}}return e}initializeGraphic(e){const{view:t}=this,s=this._createGraphicState=new S({graphic:e});return i([t.maskOccludee(e),t.trackGraphicState(s),o((()=>({element:this._outlineVisualElement,isDraped:s.isDraped})),(({element:e,isDraped:t})=>{e&&(e.isDraped=t)}),n),this._setupLoadingIndicator(s),...y(s,t)])}updateDrawMeshTooltipInfo(e){const{graphic:t,sketchOptions:i,view:s}=this;e.sketchOptions=i,e.viewType=s.type,e.helpMessage=b(t,this.view),this.updateElevation(e.elevation)}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new T({view:this.view,manipulators:this.manipulators,geometryType:I(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new C(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new O(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new w,segmentLabels:t?new g:null,labelOptions:this.sketchOptions.labels,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===v(this.hasZ,this.elevationInfo),cursor:this.cursor,constraintsEnabled:!0})}onActiveVertexChanged(e){const{view:a}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._activeVertexVisualElement.recreate(),this._updateVerticalLineVisualElement(e),s();const n=this._settings,l=n.manipulators.vertex,p=new j({view:a,spatialReference:a.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:l.size,outlineSize:l.outlineSize,renderOccluded:l.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=p;const h=n.visualElements.zVerticalLine,m=new V({view:a,extensionType:h.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:x.OccludeAndTransparent,isDecoration:!0});this._verticalLineVisualElement=m;const u=i([o((()=>n.visualElements.zVerticalLine),(e=>e.apply(m)),c),o((()=>({selectedColor:t(n.colors.selected),outlineColor:t(n.manipulators.vertex.outlineColor)})),(({selectedColor:e,outlineColor:t})=>{p.color=e,p.outlineColor=t}),c),s((()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)}))]);return p.attached=!0,this._updateVerticalLineVisualElement(e),u}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:s}=this.view;m(M,e[0],e[1],e[2]),A.setFromElevationInfo(this.elevationInfo),M[2]=G(M,s,A,i);i.toRenderCoords(M,this.view.spatialReference,M)?(t.setStartEndFromWorldDownAtLocation(M),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,s();const t=this.internalGraphicsLayer.elevationInfo,{view:a}=this,n=this._settings,l=new _({view:a,geometry:e,elevationInfo:t,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===v(this.hasZ,t),attached:!1,isDecoration:!0});this._outlineVisualElement=l;const p=i([o((()=>n.visualElements.lineGraphics.outline),(e=>e.apply(l)),c),o((()=>n.visualElements.lineGraphics.shadowStyle),(e=>e.apply(l)),c),s((()=>{this._outlineVisualElement=r(this._outlineVisualElement)}))]);return l.attached=!0,l.laserlineEnabled=!0,p}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,s();const{view:a}=this,n=this._settings,l=n.manipulators.vertex,p=new j({view:a,spatialReference:a.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:l.size,outlineSize:l.outlineSize,renderOccluded:l.renderOccluded,attached:!1,isDecoration:!0}),h=i([o((()=>({color:t(n.manipulators.vertex.color),outlineColor:t(n.manipulators.vertex.outlineColor)})),(({color:e,outlineColor:t})=>{p.color=e,p.outlineColor=t}),c),s((()=>{this._verticesVisualElement=r(this._verticesVisualElement)}))]);return p.attached=!0,this._verticesVisualElement=p,h}updateGraphicGeometry(e){if("mesh"!==this.geometryType||"point"!==e?.type)super.updateGraphicGeometry(e);else{const t=this.geometryToPlace;t?.centerAt(e);const i=this._graphic;t&&i.geometry===t||(i.geometry=t)}}_setupLoadingIndicator(e){const{drawOperation:t}=this;if(!this.geometryToPlace)return t.loading=!1,null;t.loading=!0;const r=s((()=>{t.loading=!1}));let o;const l=()=>o&&cancelAnimationFrame(o);return i([a((()=>e.displaying),(()=>{l(),o=requestAnimationFrame((()=>r.remove()))}),{...n,once:!0}),s(l),r])}};e([p({constructOnly:!0})],z.prototype,"elevationInfo",void 0),e([p({constructOnly:!0})],z.prototype,"geometryType",void 0),e([p()],z.prototype,"type",void 0),e([p({constructOnly:!0})],z.prototype,"view",void 0),z=e([h("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],z);const A=new L,M=u();export{z as DrawGraphicTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{makeHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{isRelativeVertexSpace as o}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{MeshTransformUpdateAction as
|
|
5
|
+
import{makeHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{isRelativeVertexSpace as o}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{MeshTransformUpdateAction as i}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as n}from"../../../ViewingMode.js";function a(o,s){const{graphic:i}=o;return[t((()=>o.displaying),(e=>{e?c(i,s):p(i,s)}),{...r}),e((()=>p(i,s)))]}function c(e,t){const{geometry:r}=e;f(r,t)&&e.notifyMeshTransformChanged({action:i.EnableFastUpdates})}function p(e,t){const{geometry:r}=e;f(r,t)&&e.notifyMeshTransformChanged({action:i.DisableFastUpdates})}function f(e,{state:{viewingMode:t},spatialReference:r}){if("mesh"!==e?.type)return!1;const{vertexSpace:i,spatialReference:a}=e;if(!o(i))return!1;const{type:c}=i;return t===n.Global&&"local"===c||t===n.Local&&s(r,a)&&"georeferenced"===c&&!a.isGeographic}export{a as meshTransformFastUpdateHandles,p as tryDisableMeshTransformFastUpdates,c as tryEnableMeshTransformFastUpdates};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as r,transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as s,multiply as n,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as f,g as p,h as d,j as g,n as x,f as _,b as T}from"../../../../chunks/vec32.js";import{ZEROS as b,ONES as y,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as w}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as j}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as M}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as O}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as P,empty as A,expandWithBuffer as E,intersectsClippingArea as R}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as I}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as N,getZeroIndexArray as F}from"../../../../geometry/support/Indices.js";import S from"../../../../geometry/support/MeshComponent.js";import U from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import B from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as L}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{a as $,b as V}from"../../../../chunks/vec3.js";import{project as G}from"../../../../geometry/support/meshUtils/georeference.js";import{transformNormal as D,projectNormalToPCPF as H,transformTangent as k,projectTangentToPCPF as q}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as W}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as z}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as Y}from"../../../ViewingMode.js";import{isEncodedMeshTexture as J}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as K}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as Q}from"./ElevationAligners.js";import{needsElevationUpdates3D as X,evaluateElevationInfoAtPoint as Z}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ee}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as te}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as re}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as oe,MeshFastUpdateProcessor as ae}from"./MeshFastUpdateProcessor.js";import{createMaterial as se}from"../support/edgeUtils.js";import{parseColorMixMode as ne,encodeSymbolColor as ie}from"../support/symbolColorUtils.js";import{debugFlags as le}from"../../support/debugFlags.js";import{Attribute as ce}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as ue,CullFaceOptions as me}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as he}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as fe}from"../../webgl-engine/lib/Geometry.js";import{Object3D as pe}from"../../webgl-engine/lib/Object3D.js";import{Texture as de}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as ge}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as xe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as _e}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Te,defaultSchematicMRRFactors as be,defaultAdvancedMRRFactors as ye}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as ve}from"../../../webgl/enums.js";const Ce=["mesh"];class we extends re{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new oe,this._fastUpdateProcessor=new ae,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){le.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new _e({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new _e({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ce,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,X)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){const a=e.fastTransformUpdatesEnabled;switch(o){case z.EnableFastUpdates:if(a)return!0;break;case z.DisableFastUpdates:if(!a)return!0;break;default:if(!a)return!1}const s=this._context.renderCoordsHelper.spatialReference,n=Ne,{origin:i,transform:l}=r;if(!j(t,f(Oe,i.x,i.y,i.z??0),n,s))return!1;switch(o){case z.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case z.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case z.UpdateFastLocalOrigin:e.updateFastLocalOrigin(n,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(n);const{elevationProvider:u,renderCoordsHelper:m}=this._context,h=(e,t)=>Z(e,u,c,m,t);return e.alignedSampledElevation=Q(e,c,u.spatialReference,h,m,n),e.updateTransform(n,l,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_textureTransformUid(e){const{offset:t,scale:r,rotation:o}=e??Ue;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:s,colorTextureTransform:n,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,h=this._colorOrTextureUid(a),f=this._colorOrTextureUid(s),p=this._textureTransformUid(n),d=this._colorOrTextureUid(i),g=this._textureTransformUid(l);if(o.color=a,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${h},ctmuid:${f},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof U){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:h}=t.material,f=this._colorOrTextureUid(a),p=this._textureTransformUid(s),d=this._colorOrTextureUid(i),g=this._colorOrTextureUid(c),x=this._textureTransformUid(u),_=this._colorOrTextureUid(m),T=this._textureTransformUid(h);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=this._convertTextureTransform(n),o.normalTextureTransform=this._convertTextureTransform(l),o.emissiveTextureTransform=this._convertTextureTransform(u),o.occlusionTextureTransform=this._convertTextureTransform(h),o.metallicRoughnessTextureTransform=this._convertTextureTransform(s),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${f},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_convertTextureTransform(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const t=this._getInternalTexture(e,ue.Opaque);return t?.id}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let a=this._textures.get(o);if(!a){let s=null;const n=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,maxAnisotropy:n,mipmap:n>1};J(r)?(s=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(s=r,i.preMultiplyAlpha=t!==ue.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),a=new de(s,i),this._textures.set(o,a),a.load(this._context.stage.renderView.renderingContext),this._context.stage.add(a)}return a}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ve.CLAMP_TO_EDGE;case"mirror":return ve.MIRRORED_REPEAT;default:return ve.REPEAT}}_setInternalMaterialParameters(t,r){if(null!=t.color&&this._setInternalColorValueParameters(t.color,r),null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture)),r.colorTextureTransformMatrix=K(t.colorTextureTransform),r.normalTextureTransformMatrix=K(t.normalTextureTransform);const o=null!=t.normalTextureTransform?.scale?t.normalTextureTransform?.scale:h;r.scale=[o[0],o[1]],r.occlusionTextureTransformMatrix=K(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=K(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=K(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=C;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=C)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,s=r.material?.alphaMode,n="blend"===s,i=!("opaque"===s)&&(this._hasTransparentVertexColors(t)||null!=o&&o.a<1||a?.transparent||n),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=Te({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),h={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:b,diffuse:y,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:me.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};h.mrrFactors=m?[...be]:[l.metallic,l.roughness,ye[2]],r.material&&(h.doubleSided=r.material.doubleSided,h.cullFace=r.material.doubleSided?me.None:me.Back,h.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(h),this._setMaterialTransparentParameter(h,u),this._setInternalMaterialParameters(l,h);const f=new xe(h);return u.material=f,this._materialInfoCache.set(l.uid,u),this._context.stage.add(f),f}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?ue.MaskBlend:ue.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?ue.Opaque:"mask"===t.alphaMode?ue.Mask:ue.Blend}_addDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],n=[],i=[],l=[];for(let h=0;h<r;h++){const e=t[h],r=e.attributes.get(ge.POSITION),o=e.attributes.get(ge.NORMAL),c=r.data,u=r.indices,m=o.data,f=o.indices;for(let t=0;t<u.length;t++){const e=3*u[t],r=3*f[t];for(let t=0;t<3;t++)s.push(c[e+t]);for(let t=0;t<3;t++)s.push(c[e+t]+m[r+t]*a);if(n.push(n.length),n.push(n.length),t%3==0){this._calculateFaceNormal(c,u,t,Ee),this._getFaceVertices(c,u,t,Oe,Pe,Ae),p(Oe,Oe,Pe),p(Oe,Oe,Ae),d(Oe,Oe,1/3);for(let e=0;e<3;e++)i.push(Oe[e]);for(let e=0;e<3;e++)i.push(Oe[e]+Ee[e]*a);l.push(l.length),l.push(l.length)}}}const c=t[0].transformation,u=new fe(this._debugVertexNormalMaterial,[[ge.POSITION,new ce(s,n,3,!0)]],null,he.Line);t.push(u),u.transformation=c;const m=new fe(this._debugFaceNormalMaterial,[[ge.POSITION,new ce(i,l,3,!0)]],null,he.Line);m.transformation=c,t.push(m)}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const s=this._createGeometryInfo(a,t,o);if(null==s)return null;const{geometries:n,objectTransformation:i}=s;le.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(a,n);const l=new pe({geometries:n,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=se(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new te(n[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new ee(this,l,n,null,null,Q,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=X(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:h,renderCoordsHelper:f}=this._context,p=(e,t)=>Z(e,h,r,f,t);return m.alignedSampledElevation=Q(m,r,h.spatialReference,p,f),m}_getCenterPointInElevationSR(e){const t=W(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return O([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,o){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,t,r,o);case"flat":return this._createComponentNormalsFlat(e,o);case"smooth":return this._createComponentNormalsSmooth(e,o)}}_createComponentNormalsSource(e,t,r,o){if(null==t)return this._createComponentNormalsFlat(e,o);let a=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){this._calculateFaceNormal(e,o,s,Ee);for(let e=0;e<3;e++){const r=3*o[s+e];Oe[0]=t[r],Oe[1]=t[r+1],Oe[2]=t[r+2],g(Ee,Oe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new je(t,o,a)}_createComponentNormalsFlat(e,t){const r=I(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const s=this._calculateFaceNormal(e,t,a,Ee);for(let e=0;e<3;e++)r[a+e]=s[e],o[a+e]=a/3}return new je(r,o,!1)}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=this._calculateFaceNormal(e,t,s,Ee);for(let e=0;e<3;e++){const a=t[s+e];let n=r[a];n||(n={normal:v(),count:0},r[a]=n),p(n.normal,n.normal,o),n.count++}}const o=I(3*t.length),a=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(x(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];a[s]=s}return new je(o,a,!1)}_getFaceVertices(e,t,r,o,a,s){const n=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,o){return this._getFaceVertices(e,t,r,Oe,Pe,Ae),_(Pe,Pe,Oe),_(Ae,Ae,Oe),T(Oe,Pe,Ae),x(o,Oe),o}_getOrCreateComponents(e){return e.components??Se}_createPositionBuffer(e,t){let r=e.vertexAttributes.position;const o=t.reprojection===Be.ECEF?t.transformBeforeProject:null;if(o&&(r=$(new Float64Array(r.length),r,o)),t.reprojection===Be.NONE)return t.needsBufferCopy?new Float64Array(r):r;const a=o?r:new Float64Array(r.length);return M(r,e.spatialReference,0,a,this._context.renderCoordsHelper.spatialReference,0,r.length/3),a}_createNormalBuffer(e,t,r){let o=e.vertexAttributes.normal;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=D(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return H(o,s,t,e.spatialReference,n)}_createTangentBuffer(e,t,r){let o=e.vertexAttributes.tangent;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=k(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return q(o,s,t,e.spatialReference,n)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=ne(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ie(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,a=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const n=this._computeReprojectionInfo(e),i=this._createPositionBuffer(e,n),l=this._createColorBuffer(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,n),h=this._createTangentBuffer(e,i,n);return{positionBuffer:i,normalBuffer:m,tangentBuffer:h,uvBuffer:a,colorBuffer:l,symbolColorBuffer:u,objectTransformation:n.reprojection===Be.NONE&&n.objectTransformation?n.objectTransformation:this._transformOriginLocal(e,i,m,h),geometryTransformation:n.reprojection===Be.NONE&&n.geometryTransformation?n.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?this._context.renderCoordsHelper.viewingMode===Y.Local?Be.NONE:Be.ECEF:Be.NONE;if(L(t)){const o=t.origin,a=c(),i=e.transform?.localMatrix??u;if(r===Be.NONE){j(e.spatialReference,o,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:a,geometryTransformation:m(i),needsBufferCopy:!1}}const l=s(c(),o);return n(l,l,i),{reprojection:r,transformBeforeProject:l,needsBufferCopy:!0}}return{reprojection:r,needsBufferCopy:!0}}_transformOriginLocal(e,t,a,s){const n=this._context.renderCoordsHelper.spatialReference,l=e.anchor;Me[0]=l.x,Me[1]=l.y,Me[2]=l.z??0;const u=c();return j(e.spatialReference,Me,u,n),i(Re,u),$(t,t,Re),(a||s)&&(r(Ie,u),o(Ie,Ie),a&&V(a,a,Ie),s&&V(s,s,Ie,4)),u}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces??N(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=G({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===Y.Local}),a=o.length/3;return A(Fe),E(Fe,o,0,a),!R(Fe,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!w(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:s,colorBuffer:n,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,f=this._getOrCreateComponents(e),p=new Array;let d=!1;const g=l(Oe,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of f){if(!this._validateFaces(e,l))return null;const t=this._getOrCreateFaces(e,l);if(0===t.length)continue;const o=this._createComponentNormals(a,c,l,t);o.didFlipNormals&&(d=!0);const m=[[ge.POSITION,new ce(a,t,3,!0)],[ge.NORMAL,new ce(o.normals,o.indices,3,!0)]];n&&m.push([ge.COLOR,new ce(n,t,4,!0)]),i&&m.push([ge.SYMBOLCOLOR,new ce(i,F(t.length),4,!0)]),s&&m.push([ge.UV0,new ce(s,t,2,!0)]),u&&m.push([ge.TANGENT,new ce(u,t,4,!0)]);const f=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new fe(g,m,null,he.Mesh,f);_.transformation=h,_.localOrigin=x,p.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:p,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class je{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}const Me=v(),Oe=v(),Pe=v(),Ae=v(),Ee=v(),Re=c(),Ie=a(),Ne=c(),Fe=P(),Se=[new S],Ue=new B;var Be;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(Be||(Be={}));export{we as Graphics3DMeshFillSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as r,transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as s,multiply as n,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as f,g as p,h as d,j as g,n as x,f as _,b as T}from"../../../../chunks/vec32.js";import{ZEROS as b,ONES as y,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as w}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as j}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as R}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as M}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,empty as P,expandWithBuffer as A,intersectsClippingArea as E}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as N}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as I,getZeroIndexArray as S}from"../../../../geometry/support/Indices.js";import U from"../../../../geometry/support/MeshComponent.js";import B from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import F from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as D}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as L}from"../../../../geometry/support/spatialReferenceUtils.js";import{a as V,b as $}from"../../../../chunks/vec3.js";import{project as G}from"../../../../geometry/support/meshUtils/georeference.js";import{transformNormal as H,projectNormalToPCPF as k,transformTangent as q,projectTangentToPCPF as W}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as z}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as Y}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as J}from"../../../ViewingMode.js";import{isEncodedMeshTexture as K}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as Q}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as X}from"./ElevationAligners.js";import{needsElevationUpdates3D as Z,evaluateElevationInfoAtPoint as ee}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as te}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as re}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as oe}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as ae,MeshFastUpdateProcessor as se}from"./MeshFastUpdateProcessor.js";import{createMaterial as ne}from"../support/edgeUtils.js";import{parseColorMixMode as ie,encodeSymbolColor as le}from"../support/symbolColorUtils.js";import{debugFlags as ce}from"../../support/debugFlags.js";import{Attribute as ue}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as me,CullFaceOptions as he}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as fe}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as pe}from"../../webgl-engine/lib/Geometry.js";import{Object3D as de}from"../../webgl-engine/lib/Object3D.js";import{Texture as ge}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as xe}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as _e}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Te}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as be,defaultSchematicMRRFactors as ye,defaultAdvancedMRRFactors as ve}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Ce}from"../../../webgl/enums.js";const we=["mesh"];class je extends oe{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new ae,this._fastUpdateProcessor=new se,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){ce.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Te({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new Te({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,we,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,Z)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){const a=e.fastTransformUpdatesEnabled;switch(o){case Y.EnableFastUpdates:if(a)return!0;break;case Y.DisableFastUpdates:if(!a)return!0;break;default:if(!a)return!1}const s=this._context.renderCoordsHelper.spatialReference,n=Se,{origin:i,transform:l}=r;if(!j(t,f(Oe,i.x,i.y,i.z??0),n,s))return!1;switch(o){case Y.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case Y.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case Y.UpdateFastLocalOrigin:e.updateFastLocalOrigin(n,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(n);const{elevationProvider:u,renderCoordsHelper:m}=this._context,h=(e,t)=>ee(e,u,c,m,t);return e.alignedSampledElevation=X(e,c,u.spatialReference,h,m,n),e.updateTransform(n,l,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_textureTransformUid(e){const{offset:t,scale:r,rotation:o}=e??Fe;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:s,colorTextureTransform:n,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,h=this._colorOrTextureUid(a),f=this._colorOrTextureUid(s),p=this._textureTransformUid(n),d=this._colorOrTextureUid(i),g=this._textureTransformUid(l);if(o.color=a,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${h},ctmuid:${f},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof B){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:h}=t.material,f=this._colorOrTextureUid(a),p=this._textureTransformUid(s),d=this._colorOrTextureUid(i),g=this._colorOrTextureUid(c),x=this._textureTransformUid(u),_=this._colorOrTextureUid(m),T=this._textureTransformUid(h);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=this._convertTextureTransform(n),o.normalTextureTransform=this._convertTextureTransform(l),o.emissiveTextureTransform=this._convertTextureTransform(u),o.occlusionTextureTransform=this._convertTextureTransform(h),o.metallicRoughnessTextureTransform=this._convertTextureTransform(s),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${f},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_convertTextureTransform(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const t=this._getInternalTexture(e,me.Opaque);return t?.id}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let a=this._textures.get(o);if(!a){let s=null;const n=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,maxAnisotropy:n,mipmap:n>1};K(r)?(s=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(s=r,i.preMultiplyAlpha=t!==me.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),a=new ge(s,i),this._textures.set(o,a),a.load(this._context.stage.renderView.renderingContext),this._context.stage.add(a)}return a}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return Ce.CLAMP_TO_EDGE;case"mirror":return Ce.MIRRORED_REPEAT;default:return Ce.REPEAT}}_setInternalMaterialParameters(t,r){if(null!=t.color&&this._setInternalColorValueParameters(t.color,r),null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture)),r.colorTextureTransformMatrix=Q(t.colorTextureTransform),r.normalTextureTransformMatrix=Q(t.normalTextureTransform);const o=null!=t.normalTextureTransform?.scale?t.normalTextureTransform?.scale:h;r.scale=[o[0],o[1]],r.occlusionTextureTransformMatrix=Q(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=Q(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=Q(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=C;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=C)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,s=r.material?.alphaMode,n="blend"===s,i=!("opaque"===s)&&(this._hasTransparentVertexColors(t)||null!=o&&o.a<1||a?.transparent||n),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=be({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),h={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:b,diffuse:y,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:he.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};h.mrrFactors=m?[...ye]:[l.metallic,l.roughness,ve[2]],r.material&&(h.doubleSided=r.material.doubleSided,h.cullFace=r.material.doubleSided?he.None:he.Back,h.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(h),this._setMaterialTransparentParameter(h,u),this._setInternalMaterialParameters(l,h);const f=new _e(h);return u.material=f,this._materialInfoCache.set(l.uid,u),this._context.stage.add(f),f}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?me.MaskBlend:me.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?me.Opaque:"mask"===t.alphaMode?me.Mask:me.Blend}_addDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],n=[],i=[],l=[];for(let h=0;h<r;h++){const e=t[h],r=e.attributes.get(xe.POSITION),o=e.attributes.get(xe.NORMAL),c=r.data,u=r.indices,m=o.data,f=o.indices;for(let t=0;t<u.length;t++){const e=3*u[t],r=3*f[t];for(let t=0;t<3;t++)s.push(c[e+t]);for(let t=0;t<3;t++)s.push(c[e+t]+m[r+t]*a);if(n.push(n.length),n.push(n.length),t%3==0){this._calculateFaceNormal(c,u,t,Ee),this._getFaceVertices(c,u,t,Oe,Pe,Ae),p(Oe,Oe,Pe),p(Oe,Oe,Ae),d(Oe,Oe,1/3);for(let e=0;e<3;e++)i.push(Oe[e]);for(let e=0;e<3;e++)i.push(Oe[e]+Ee[e]*a);l.push(l.length),l.push(l.length)}}}const c=t[0].transformation,u=new pe(this._debugVertexNormalMaterial,[[xe.POSITION,new ue(s,n,3,!0)]],null,fe.Line);t.push(u),u.transformation=c;const m=new pe(this._debugFaceNormalMaterial,[[xe.POSITION,new ue(i,l,3,!0)]],null,fe.Line);m.transformation=c,t.push(m)}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const s=this._createGeometryInfo(a,t,o);if(null==s)return null;const{geometries:n,objectTransformation:i}=s;ce.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(a,n);const l=new de({geometries:n,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=ne(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new re(n[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new te(this,l,n,null,null,X,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=Z(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:h,renderCoordsHelper:f}=this._context,p=(e,t)=>ee(e,h,r,f,t);return m.alignedSampledElevation=X(m,r,h.spatialReference,p,f),m}_getCenterPointInElevationSR(e){const t=z(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return M([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,o){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,t,r,o);case"flat":return this._createComponentNormalsFlat(e,o);case"smooth":return this._createComponentNormalsSmooth(e,o)}}_createComponentNormalsSource(e,t,r,o){if(null==t)return this._createComponentNormalsFlat(e,o);let a=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){this._calculateFaceNormal(e,o,s,Ee);for(let e=0;e<3;e++){const r=3*o[s+e];Oe[0]=t[r],Oe[1]=t[r+1],Oe[2]=t[r+2],g(Ee,Oe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new Re(t,o,a)}_createComponentNormalsFlat(e,t){const r=N(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const s=this._calculateFaceNormal(e,t,a,Ee);for(let e=0;e<3;e++)r[a+e]=s[e],o[a+e]=a/3}return new Re(r,o,!1)}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=this._calculateFaceNormal(e,t,s,Ee);for(let e=0;e<3;e++){const a=t[s+e];let n=r[a];n||(n={normal:v(),count:0},r[a]=n),p(n.normal,n.normal,o),n.count++}}const o=N(3*t.length),a=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(x(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];a[s]=s}return new Re(o,a,!1)}_getFaceVertices(e,t,r,o,a,s){const n=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,o){return this._getFaceVertices(e,t,r,Oe,Pe,Ae),_(Pe,Pe,Oe),_(Ae,Ae,Oe),T(Oe,Pe,Ae),x(o,Oe),o}_getOrCreateComponents(e){return e.components??Be}_createPositionBuffer(e,t){let r=e.vertexAttributes.position;const o=t.reprojection===De.RENDER?t.transformBeforeProject:null;if(o&&(r=V(new Float64Array(r.length),r,o)),t.reprojection===De.NONE)return t.needsBufferCopy?new Float64Array(r):r;const a=o?r:new Float64Array(r.length);return R(r,e.spatialReference,0,a,this._context.renderCoordsHelper.spatialReference,0,r.length/3),a}_createNormalBuffer(e,t,r){let o=e.vertexAttributes.normal;if(null==o)return null;const a=r.reprojection===De.RENDER?r.transformBeforeProject:null;a&&(o=H(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===De.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return k(o,s,t,e.spatialReference,n)}_createTangentBuffer(e,t,r){let o=e.vertexAttributes.tangent;if(null==o)return null;const a=r.reprojection===De.RENDER?r.transformBeforeProject:null;a&&(o=q(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===De.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return W(o,s,t,e.spatialReference,n)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=ie(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return le(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,a=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const n=this._computeReprojectionInfo(e),i=this._createPositionBuffer(e,n),l=this._createColorBuffer(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,n),h=this._createTangentBuffer(e,i,n);return{positionBuffer:i,normalBuffer:m,tangentBuffer:h,uvBuffer:a,colorBuffer:l,symbolColorBuffer:u,objectTransformation:n.reprojection===De.NONE&&n.objectTransformation?n.objectTransformation:this._transformOriginLocal(e,i,m,h),geometryTransformation:n.reprojection===De.NONE&&n.geometryTransformation?n.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?L(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?De.NONE:De.RENDER:De.NONE;if(D(t)){const o=t.origin,a=c(),i=e.transform?.localMatrix??u;if(r===De.NONE){j(e.spatialReference,o,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:a,geometryTransformation:m(i),needsBufferCopy:!1}}const l=s(c(),o);return n(l,l,i),{reprojection:r,transformBeforeProject:l,needsBufferCopy:!0}}return{reprojection:r,needsBufferCopy:!0}}_transformOriginLocal(e,t,a,s){const n=this._context.renderCoordsHelper.spatialReference,l=e.anchor;Me[0]=l.x,Me[1]=l.y,Me[2]=l.z??0;const u=c();return j(e.spatialReference,Me,u,n),i(Ne,u),V(t,t,Ne),(a||s)&&(r(Ie,u),o(Ie,Ie),a&&$(a,a,Ie),s&&$(s,s,Ie,4)),u}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces??I(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=G({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===J.Local}),a=o.length/3;return P(Ue),A(Ue,o,0,a),!E(Ue,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!w(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:s,colorBuffer:n,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,f=this._getOrCreateComponents(e),p=new Array;let d=!1;const g=l(Oe,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of f){if(!this._validateFaces(e,l))return null;const t=this._getOrCreateFaces(e,l);if(0===t.length)continue;const o=this._createComponentNormals(a,c,l,t);o.didFlipNormals&&(d=!0);const m=[[xe.POSITION,new ue(a,t,3,!0)],[xe.NORMAL,new ue(o.normals,o.indices,3,!0)]];n&&m.push([xe.COLOR,new ue(n,t,4,!0)]),i&&m.push([xe.SYMBOLCOLOR,new ue(i,S(t.length),4,!0)]),s&&m.push([xe.UV0,new ue(s,t,2,!0)]),u&&m.push([xe.TANGENT,new ue(u,t,4,!0)]);const f=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new pe(g,m,null,fe.Mesh,f);_.transformation=h,_.localOrigin=x,p.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:p,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==J.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Re{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}const Me=v(),Oe=v(),Pe=v(),Ae=v(),Ee=v(),Ne=c(),Ie=a(),Se=c(),Ue=O(),Be=[new U],Fe=new F;var De;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(De||(De={}));export{je as Graphics3DMeshFillSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../request.js";import i from"../../../../core/Accessor.js";import{splitIntoChunks as r}from"../../../../core/arrayUtils.js";import{resultOrAbort as s,result as o}from"../../../../core/asyncUtils.js";import{estimateStringByteSize as n,estimateNumberByteSize as a}from"../../../../core/byteSizeEstimations.js";import d from"../../../../core/Collection.js";import{makeHandle as c}from"../../../../core/handleUtils.js";import h from"../../../../core/Logger.js";import{destroyMaybe as l,abortMaybe as u}from"../../../../core/maybe.js";import{whenOrAbort as m,createResolver as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,initial as f}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as v}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";import{assetMapFromAssetMapsJSON as w,extractMesh as I}from"../../../../rest/support/meshFeatureSet.js";import{direct3DObjectFeatureLayerDisplayEnabled as F,i3sPatchingEnabled as A,sceneLayerEditingEnabled as L}from"../../../../support/featureFlags.js";import{isTimeoutError as x}from"../../../../support/requestUtils.js";import{ViewingMode as E}from"../../../ViewingMode.js";import S from"../FeatureLayerView3D.js";const D="esri.views.3d.layers.i3s.I3SOverrides";let G=class extends i{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=$,this._original3DOFLDefinitionExpression=null,this._interactiveEditingSessions=new d,this.geometryOverrides=new d,this._clientGeometryCache=new Map,this._associatedLayerView=null,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._featureIdLocks=new Map}initialize(){this._memCache=this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally((()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})),this.is3DOFL&&null!=this._associatedLayer&&(F()?this._associatedLayer.load().then((e=>{this.destroyed||(this._original3DOFLDefinitionExpression=e.definitionExpression,this.addHandles(y((()=>this._definitionExpression),(t=>e.definitionExpression=t),f)),this._associatedLayerView=new S({layer:this._associatedLayer,view:this.view}))})):A())}destroy(){this.is3DOFL&&null!=this._associatedLayer&&(F()?null!=this._associatedLayerView&&(this._associatedLayer.definitionExpression=this._original3DOFLDefinitionExpression):A()),this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=u(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return L()&&null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort(((e,t)=>e-t)):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get _definitionExpression(){const e=this.sortedGeometryChangedObjectIds;return 0===e.length?"1 = 0":`OBJECTID IN (${e.join(",")})`}get updating(){if(!this.is3DOFL)return!1;if(this._pendingFetchChangedObjectIds)return!0;if(F()){return!(null!=this._associatedLayerView)||null!=this._associatedLayerView&&this._associatedLayerView.updating}return!1}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,i=new M(e,(()=>{t.remove(i)}));return t.unshift(i),i}async applyAttributeOverrides(e,t,i,r=[]){if(this._pendingFetchChangedObjectIds&&await m(this._pendingFetchChangedObjectIds,i),null==t)return;const{attributeData:s,loadedAttributes:o}=t;if(null==o||null==s||0===this._attributeChangedObjectIds.size)return;const n=new Set;for(const d of o)n.add(d.index);for(const d of r)n.has(d.index)||(o.push(d),s[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:s,loadedAttributes:o},r=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:n,fieldNames:a}=r;if(0===n.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(n,a,i);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const i=this._clientGeometryCache.get(e);if(null!=i&&(this.geometryOverrides.remove(i),this._clientGeometryCache.delete(e)),null!=t){const i={oid:e,mesh:t};this.geometryOverrides.add(i),this._clientGeometryCache.set(e,i)}}updateAttributeValue(e,t,i){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,i)}featureAdded(e){this.is3DOFL&&A()&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,i){this._memCache.put(this._getAttributeCacheKey(e,t),i,this._memCacheAttributeValueSize(i))}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:i},r){const s=new Set,o=new Array;for(const a of t)o[a.index]=i[a.name];const n=new Set;for(let a=0;a<e.length;a++){const i=e[a];if(r.has(i))for(const e of t){const t=this._attributeFromCache(i,e.index);void 0===t?(s.add(i),n.add(e.name)):o[e.index][a]=t}}return{objectIds:Array.from(s),fieldNames:Array.from(n)}}_attributeFromCache(e,t){const i=this._fromInteractiveEditingSession(e,t);if(void 0!==i)return i;const r=this._getAttributeCacheKey(e,t);return this._memCache.get(r)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const i of this._interactiveEditingSessions){if(i.objectId!==e)continue;const r=i.getAttribute(t);if(void 0!==r)return r}}_getAttributeCacheKey(e,t){return`${e}-${t}`}async _queryAttributeOverridesFromAssociatedLayer(e,t,i){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:r}=this.layer;if(null==r)return null;const s=r.createQuery(),{objectIdField:o}=r,n=[o,...t];s.where="1=1",s.returnGeometry=!1,s.outFields=n,s.cacheHint=!0;const a=await this._executeBatchQuery(r,e,s,i),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL||!A())return null;const i=this.layer.associatedLayer,r=i.infoFor3D,{spatialReference:s}=i,{state:{viewingMode:o},spatialReference:n}=this.view,a=o===E.Global,d=s.isGeographic;if(a&&!d)return h.getLogger(D).warn("unsupported-pcs-edits-in-global-view",this.layer.title,N(s,n,this.view.viewingMode,k.Mode)),null;if(!a){if(d)return h.getLogger(D).warn("unsupported-gcs-edits-in-local-view",this.layer.title,N(s,n,this.view.viewingMode,k.Mode)),null;if(!O(n,s))return h.getLogger(D).warn("unsupported-mismatched-spatial-reference-edits-in-local-view",this.layer.title,N(s,n,this.view.viewingMode,k.SpatialReference)),null}this._logWarningIfMaximumObjectsExceeded();const{objectIdField:c,globalIdField:l}=i,u=[c,...null!=l?[l]:[]],m=i.createQuery();m.where="1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=i.hasZ,m.returnM=i.hasM;const g=await this._executeBatchQuery(i,e,m,t),p=[];for(const h of g){if(!h.ok)continue;const e=h.value,{assetMaps:t,features:i,globalIdFieldName:o}=e;if(null==t)continue;const n=w(r,t);for(const a of i){const e=I(a,o,s,r,n),t=a;null!=e?(t.geometry=e,p.push(t)):t.geometry=null}}return p}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${v(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;t&&t.loaded?e+=` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:e+=` (${this.layer.parsedUrl.path})`,h.getLogger(D).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,i,o){if(0===t.length)return[];const n=j(e);t=[...t].sort(((e,t)=>e-t));const a=r(t,n).map((t=>{const r=i.clone();return r.objectIds=t,s(C(e,r,{signal:o}))}));return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,i,{loadedAttributes:r,attributeData:s}){const o=this._associatedLayer;if(null==o)return;const n=o.objectIdField,a=i.map((t=>(t in s||(s[t]=new Array(e.length)),s[t]))),d=new Map(r.map((e=>[e.name,e.index]))),c=i.map((e=>d.get(e))),h=new Map(Array.from(e,((e,t)=>[e,t])));for(const l of t){const e=l.attributes[n];for(let t=0;t<i.length;t++){const r=c[t],s=h.get(e),o=l.attributes[i[t]];a[t][s]=o,this._cacheAttributeValue(e,r,o)}}}_memCacheAttributeValueSize(e){return"string"==typeof e?n(e):a()}async _fetchChangedObjectIds(e){const i=this.layer;await i.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:r}=i;if(null==r||!r.capabilities?.operations?.supportsChangeTracking)return;const s=this._getFetchChangedObjectIdsServerGen();if(null==s)return;const n=r.layerId,a=this.is3DOFL,d={f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:s}])};if(a){const e=r.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const c=await o(t(`${r.url}/extractChanges`,{method:"post",query:d,timeout:V,signal:e}));if(!c.ok&&x(c.error)){const e=this.layer.title;h.getLogger(D).warn("extractChanges:timeout",e,`${e} could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.`)}if(c.ok&&1===c.value.data?.edits?.length){const t=c.value.data.edits[0],i=t?.objectIds,s=t?.fieldUpdates,o=i?.adds??[],n=i?.updates??[],d=i?.deletes??[],h=[...o,...n,...d],l=a?[...o,...s??n,...d]:[],u=Math.min(this._maximumNumberOfEditOVerrides,h.length);u<h.length&&(this._warnMaximumChangedObjectsExceeded=!0);const m=h.sort(((e,t)=>e-t));for(let e=0;e<u;++e){const t=m[e];this._attributeChangedObjectIds.add(t)}for(const e of l)this._geometryChangedObjectIds.add(e);if(this.is3DOFL&&A()&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let i=!0;for(;i;){const r=new Array;for(const i of e){const e=t.get(i);e&&r.push(e)}0===r.length?i=!1:await Promise.all(r)}const r=g(),s=r.promise;for(const o of e)t.set(o,s);return c((()=>{for(const i of e)t.delete(i);r.resolve()}))}get test(){const e=Array.from(this._attributeChangedObjectIds),t=this._pendingFetchChangedObjectIds,i=this;return{changedObjectIds:e,pendingFetchChangedObjectIds:t,get maximumNumberOfEditOVerrides(){return i._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(e){i._maximumNumberOfEditOVerrides=e}}}};e([b({constructOnly:!0})],G.prototype,"view",void 0),e([b({constructOnly:!0})],G.prototype,"layer",void 0),e([b({readOnly:!0})],G.prototype,"is3DOFL",null),e([b()],G.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],G.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],G.prototype,"geometryOverrides",void 0),e([b()],G.prototype,"_clientGeometryCache",void 0),e([b()],G.prototype,"_associatedLayer",null),e([b()],G.prototype,"_associatedLayerView",void 0),e([b({constructOnly:!0})],G.prototype,"memoryController",void 0),e([b()],G.prototype,"_attributeChangedObjectIds",void 0),e([b()],G.prototype,"_geometryChangedObjectIds",void 0),e([b()],G.prototype,"hasGeometryChanges",null),e([b()],G.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],G.prototype,"_pendingFetchAbortController",void 0),e([b()],G.prototype,"_definitionExpression",null),e([b()],G.prototype,"updating",null),e([b()],G.prototype,"isEmpty",null),G=e([_(D)],G);class M{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}const V=1e4,$=5e4;var k;function N(e,t,i,r){return`Displaying the edits of a SceneLayer with a${r===k.Mode?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${i} viewing mode${r===k.SpatialReference?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${r===k.Mode?"viewing mode":"view spatial reference"} to display edits.`}!function(e){e[e.Mode=0]="Mode",e[e.SpatialReference=1]="SpatialReference"}(k||(k={}));export{G as I3SOverrides};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../request.js";import i from"../../../../core/Accessor.js";import{splitIntoChunks as r}from"../../../../core/arrayUtils.js";import{resultOrAbort as s,result as o}from"../../../../core/asyncUtils.js";import{estimateStringByteSize as n,estimateNumberByteSize as a}from"../../../../core/byteSizeEstimations.js";import d from"../../../../core/Collection.js";import{makeHandle as c}from"../../../../core/handleUtils.js";import h from"../../../../core/Logger.js";import{destroyMaybe as l,abortMaybe as u}from"../../../../core/maybe.js";import{whenOrAbort as m,createResolver as g}from"../../../../core/promiseUtils.js";import p from"../../../../core/ReactiveSet.js";import{watch as y,initial as f}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import{subclass as _}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as v}from"../../../../intl/number.js";import{getMaximumQuerySize as j,queryAllJSON as C}from"../../../../layers/support/featureQueryAll.js";import{assetMapFromAssetMapsJSON as w,extractMesh as I}from"../../../../rest/support/meshFeatureSet.js";import{direct3DObjectFeatureLayerDisplayEnabled as F,i3sPatchingEnabled as A,sceneLayerEditingEnabled as L}from"../../../../support/featureFlags.js";import{isTimeoutError as x}from"../../../../support/requestUtils.js";import{ViewingMode as E}from"../../../ViewingMode.js";import S from"../FeatureLayerView3D.js";const G="esri.views.3d.layers.i3s.I3SOverrides";let D=class extends i{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=$,this._original3DOFLDefinitionExpression=null,this._interactiveEditingSessions=new d,this.geometryOverrides=new d,this._clientGeometryCache=new Map,this._associatedLayerView=null,this._attributeChangedObjectIds=new p,this._geometryChangedObjectIds=new p,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._featureIdLocks=new Map}initialize(){this._memCache=this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally((()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})),this.is3DOFL&&null!=this._associatedLayer&&(F()?this._associatedLayer.load().then((e=>{this.destroyed||(this._original3DOFLDefinitionExpression=e.definitionExpression,this.addHandles(y((()=>this._definitionExpression),(t=>e.definitionExpression=t),f)),this._associatedLayerView=new S({layer:this._associatedLayer,view:this.view}))})):A())}destroy(){this.is3DOFL&&null!=this._associatedLayer&&(F()?null!=this._associatedLayerView&&(this._associatedLayer.definitionExpression=this._original3DOFLDefinitionExpression):A()),this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=u(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return L()&&null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort(((e,t)=>e-t)):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get _definitionExpression(){const e=this.sortedGeometryChangedObjectIds;return 0===e.length?"1 = 0":`OBJECTID IN (${e.join(",")})`}get updating(){if(!this.is3DOFL)return!1;if(this._pendingFetchChangedObjectIds)return!0;if(F()){return!(null!=this._associatedLayerView)||null!=this._associatedLayerView&&this._associatedLayerView.updating}return!1}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,i=new M(e,(()=>{t.remove(i)}));return t.unshift(i),i}async applyAttributeOverrides(e,t,i,r=[]){if(this._pendingFetchChangedObjectIds&&await m(this._pendingFetchChangedObjectIds,i),null==t)return;const{attributeData:s,loadedAttributes:o}=t;if(null==o||null==s||0===this._attributeChangedObjectIds.size)return;const n=new Set;for(const d of o)n.add(d.index);for(const d of r)n.has(d.index)||(o.push(d),s[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:s,loadedAttributes:o},r=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:n,fieldNames:a}=r;if(0===n.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(n,a,i);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const i=this._clientGeometryCache.get(e);if(null!=i&&(this.geometryOverrides.remove(i),this._clientGeometryCache.delete(e)),null!=t){const i={oid:e,mesh:t};this.geometryOverrides.add(i),this._clientGeometryCache.set(e,i)}}updateAttributeValue(e,t,i){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,i)}featureAdded(e){this.is3DOFL&&A()&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,i){this._memCache.put(this._getAttributeCacheKey(e,t),i,this._memCacheAttributeValueSize(i))}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:i},r){const s=new Set,o=new Array;for(const a of t)o[a.index]=i[a.name];const n=new Set;for(let a=0;a<e.length;a++){const i=e[a];if(r.has(i))for(const e of t){const t=this._attributeFromCache(i,e.index);void 0===t?(s.add(i),n.add(e.name)):o[e.index][a]=t}}return{objectIds:Array.from(s),fieldNames:Array.from(n)}}_attributeFromCache(e,t){const i=this._fromInteractiveEditingSession(e,t);if(void 0!==i)return i;const r=this._getAttributeCacheKey(e,t);return this._memCache.get(r)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const i of this._interactiveEditingSessions){if(i.objectId!==e)continue;const r=i.getAttribute(t);if(void 0!==r)return r}}_getAttributeCacheKey(e,t){return`${e}-${t}`}async _queryAttributeOverridesFromAssociatedLayer(e,t,i){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:r}=this.layer;if(null==r)return null;const s=r.createQuery(),{objectIdField:o}=r,n=[o,...t];s.where="1=1",s.returnGeometry=!1,s.outFields=n,s.cacheHint=!0;const a=await this._executeBatchQuery(r,e,s,i),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL||!A())return null;const i=this.layer.associatedLayer,r=i.infoFor3D,{spatialReference:s}=i,{state:{viewingMode:o},spatialReference:n}=this.view,a=o===E.Global,d=s.isGeographic;if(a&&!d)return h.getLogger(G).warn("unsupported-pcs-edits-in-global-view",this.layer.title,N(s,n,this.view.viewingMode,k.Mode)),null;if(!a&&d)return h.getLogger(G).warn("unsupported-gcs-edits-in-local-view",this.layer.title,N(s,n,this.view.viewingMode,k.Mode)),null;if(!(O(s,n)||a&&n.isWebMercator&&s.isWGS84))return h.getLogger(G).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,N(s,n,this.view.viewingMode,k.SpatialReference)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:c,globalIdField:l}=i,u=[c,...null!=l?[l]:[]],m=i.createQuery();m.where="1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=i.hasZ,m.returnM=i.hasM;const g=await this._executeBatchQuery(i,e,m,t),p=[];for(const h of g){if(!h.ok)continue;const e=h.value,{assetMaps:t,features:i,globalIdFieldName:o}=e;if(null==t)continue;const n=w(r,t);for(const a of i){const e=I(a,o,s,r,n),t=a;null!=e?(t.geometry=e,p.push(t)):t.geometry=null}}return p}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${v(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;t&&t.loaded?e+=` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:e+=` (${this.layer.parsedUrl.path})`,h.getLogger(G).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,i,o){if(0===t.length)return[];const n=j(e);t=[...t].sort(((e,t)=>e-t));const a=r(t,n).map((t=>{const r=i.clone();return r.objectIds=t,s(C(e,r,{signal:o}))}));return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,i,{loadedAttributes:r,attributeData:s}){const o=this._associatedLayer;if(null==o)return;const n=o.objectIdField,a=i.map((t=>(t in s||(s[t]=new Array(e.length)),s[t]))),d=new Map(r.map((e=>[e.name,e.index]))),c=i.map((e=>d.get(e))),h=new Map(Array.from(e,((e,t)=>[e,t])));for(const l of t){const e=l.attributes[n];for(let t=0;t<i.length;t++){const r=c[t],s=h.get(e),o=l.attributes[i[t]];a[t][s]=o,this._cacheAttributeValue(e,r,o)}}}_memCacheAttributeValueSize(e){return"string"==typeof e?n(e):a()}async _fetchChangedObjectIds(e){const i=this.layer;await i.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:r}=i;if(null==r||!r.capabilities?.operations?.supportsChangeTracking)return;const s=this._getFetchChangedObjectIdsServerGen();if(null==s)return;const n=r.layerId,a=this.is3DOFL,d={f:"json",returnIdsOnly:!0,layers:`[${n}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:n,serverGen:s}])};if(a){const e=r.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const c=await o(t(`${r.url}/extractChanges`,{method:"post",query:d,timeout:V,signal:e}));if(!c.ok&&x(c.error)){const e=this.layer.title;h.getLogger(G).warn("extractChanges:timeout",e,`${e} could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.`)}if(c.ok&&1===c.value.data?.edits?.length){const t=c.value.data.edits[0],i=t?.objectIds,s=t?.fieldUpdates,o=i?.adds??[],n=i?.updates??[],d=i?.deletes??[],h=[...o,...n,...d],l=a?[...o,...s??n,...d]:[],u=Math.min(this._maximumNumberOfEditOVerrides,h.length);u<h.length&&(this._warnMaximumChangedObjectsExceeded=!0);const m=h.sort(((e,t)=>e-t));for(let e=0;e<u;++e){const t=m[e];this._attributeChangedObjectIds.add(t)}for(const e of l)this._geometryChangedObjectIds.add(e);if(this.is3DOFL&&A()&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let i=!0;for(;i;){const r=new Array;for(const i of e){const e=t.get(i);e&&r.push(e)}0===r.length?i=!1:await Promise.all(r)}const r=g(),s=r.promise;for(const o of e)t.set(o,s);return c((()=>{for(const i of e)t.delete(i);r.resolve()}))}get test(){const e=Array.from(this._attributeChangedObjectIds),t=this._pendingFetchChangedObjectIds,i=this;return{changedObjectIds:e,pendingFetchChangedObjectIds:t,get maximumNumberOfEditOVerrides(){return i._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(e){i._maximumNumberOfEditOVerrides=e}}}};e([b({constructOnly:!0})],D.prototype,"view",void 0),e([b({constructOnly:!0})],D.prototype,"layer",void 0),e([b({readOnly:!0})],D.prototype,"is3DOFL",null),e([b()],D.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],D.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],D.prototype,"geometryOverrides",void 0),e([b()],D.prototype,"_clientGeometryCache",void 0),e([b()],D.prototype,"_associatedLayer",null),e([b()],D.prototype,"_associatedLayerView",void 0),e([b({constructOnly:!0})],D.prototype,"memoryController",void 0),e([b()],D.prototype,"_attributeChangedObjectIds",void 0),e([b()],D.prototype,"_geometryChangedObjectIds",void 0),e([b()],D.prototype,"hasGeometryChanges",null),e([b()],D.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],D.prototype,"_pendingFetchAbortController",void 0),e([b()],D.prototype,"_definitionExpression",null),e([b()],D.prototype,"updating",null),e([b()],D.prototype,"isEmpty",null),D=e([_(G)],D);class M{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}const V=1e4,$=5e4;var k;function N(e,t,i,r){return`Displaying the edits of a SceneLayer with a${r===k.Mode?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${i} viewing mode${r===k.SpatialReference?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${r===k.Mode?"viewing mode":"view spatial reference"} to display edits.`}!function(e){e[e.Mode=0]="Mode",e[e.SpatialReference=1]="SpatialReference"}(k||(k={}));export{D as I3SOverrides};
|