@arcgis/core 5.2.0-next.64 → 5.2.0-next.65
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/{bb95922cd4631d6f17fb.js → 04ac5ac6f592d8c34bbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{0977f4d77c36175c2895.js → 3ddd717ea12d9823eee2.js} +1 -1
- package/assets/esri/core/workers/chunks/5adf16c034a590b5e9f5.js +1 -0
- package/assets/esri/core/workers/chunks/{57824ecc10b25e3ad794.js → 903e1cd8b76eff19ebdf.js} +1 -1
- package/assets/esri/core/workers/chunks/93c0a620a147cbf4a0ba.js +1 -0
- package/assets/esri/core/workers/chunks/9be6827e5756031a56c1.js +1 -0
- package/assets/esri/core/workers/chunks/a52c88e2d837b525ff6c.js +1 -0
- package/assets/esri/core/workers/chunks/{771ead806efbe9c91fdc.js → a5fdb02b1714e93fa69e.js} +1 -1
- package/assets/esri/core/workers/chunks/b4e5ee81b9eb171499a6.js +1 -0
- package/assets/esri/core/workers/chunks/bece22668622a9a6bfe2.js +1 -0
- package/assets/esri/core/workers/chunks/c02ae1d40c1fe95ae6c5.js +1 -0
- package/assets/esri/core/workers/chunks/d51c41c1944df0cbab3e.js +1 -0
- package/assets/esri/core/workers/chunks/d583bcea4d1a21da9147.js +1 -0
- package/assets/esri/core/workers/chunks/{ef27bf1d7941ae265ca4.js → d7267f429a051943187b.js} +1 -1
- package/assets/esri/core/workers/chunks/d9c78c2db04a06ee83ed.js +1 -0
- package/assets/esri/core/workers/chunks/{c1e45e24f5ef719a714c.js → dc7e4f7879debf557e46.js} +143 -95
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/Component.glsl.js +60 -62
- package/chunks/DefaultMaterial.glsl.js +27 -28
- package/chunks/GaussianSplat.glsl.js +7 -7
- package/chunks/GaussianSplatShadow.glsl.js +9 -9
- package/chunks/GlobalIllumination.glsl.js +35 -15
- package/chunks/Path.glsl.js +7 -6
- package/chunks/RealisticTree.glsl.js +22 -24
- package/chunks/SSAO.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +3 -2
- package/chunks/Water.glsl.js +20 -11
- package/chunks/_commonjsHelpers.js +1 -1
- package/chunks/bundle2.js +1 -1
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/parquet/ParquetFileInfo.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/raster/datasets/EphemeralBlockCache.js +1 -1
- package/layers/raster/datasets/RawBlockCache.js +1 -1
- package/layers/support/KMLSublayer.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +1 -1
- package/rest/support/Query.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/MeshSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/PolygonSymbol3D.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +24 -16
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +25 -0
- package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +2 -0
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPassParameters.js +2 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatShadowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
- package/widgets/LayerList/ListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
- package/widgets/OrientedImageryViewer/services/TransformationService.js +1 -1
- package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/TableList/ListItem.js +1 -1
- package/assets/esri/core/workers/chunks/43b39abd49c4a8ce891f.js +0 -1
- package/assets/esri/core/workers/chunks/5dbd8ca7e7b8eb9a0bf7.js +0 -1
- package/assets/esri/core/workers/chunks/6123894e2ae9233cdf89.js +0 -1
- package/assets/esri/core/workers/chunks/6b536d03b4bef408035b.js +0 -1
- package/assets/esri/core/workers/chunks/6c98a64d92c9bca78203.js +0 -1
- package/assets/esri/core/workers/chunks/78b80da3bbc1b608fe83.js +0 -1
- package/assets/esri/core/workers/chunks/7d85048c6cd6ad84faf9.js +0 -1
- package/assets/esri/core/workers/chunks/9008090a5d8431ddfa22.js +0 -1
- package/assets/esri/core/workers/chunks/a2d8bc0efddd2e13b1ad.js +0 -1
- package/assets/esri/core/workers/chunks/c97451f75c23be979476.js +0 -1
package/libs/parquet/parquet.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import t from"../../core/Logger.js";import{latitudeFieldNames as n,longitudeFieldNames as o}from"../../layers/support/locationUtils.js";import{loadParquetModule as i}from"./loadParquetModule.js";const r=()=>t.getLogger("esri.layers.ParquetLayer"),a=new Set(["uncompressed","snappy","gzip"]),l=new Set(["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeBigInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]);function s(t,n){switch(n){case"esriGeometryPoint":return t.GeometryType.Point;case"esriGeometryPolygon":case"polygon":return t.GeometryType.Polygon;case"esriGeometryPolyline":case"polyline":return t.GeometryType.Polyline;case"esriGeometryMultipoint":case"multipoint":return t.GeometryType.Multipoint;default:throw new e("parquet",`Found unexpected GeometryType: ${n}`)}}function u(e,t){const n=t.encoding,o=s(e,t.geometryType),i=t.spatialReference.wkid;if(null==i)throw new Error("InternalError: Wkid must be defined.");switch(n.type){case"wkb":return e.GeometryField.fromWkb(n.field,i,o);case"location":{const{yField:t,xField:r}=n;return e.GeometryField.fromLocation(t,r,i,o)}}}function m(e,t){const n=e.GeometryInfo.new();t.geometry&&n.setGeometry(u(e,t.geometry));const o=t.displayOptimization;if(o){const{index:t,parentColumn:i}=o,r=e=>null!=i?[i,e].join("."):e;if("z"===t.type){const o=e.DisplayOptimizationZBuilder.new();o.setCodeField(r(t.code)),o.setXColumn(r(t.xColumn)),o.setYColumn(r(t.yColumn)),o.setCooordinatePrecision(t.coordinatePrecision),o.setFullExtent(t.fullExtent),o.setSpatialReference(t.wkid,null==t.wkid?t.wkt:void 0),o.setHasZ(!!t.zColumn),o.setHasM(!!t.mColumn),t.zColumn&&o.setZColumn(r(t.zColumn)),t.mColumn&&o.setMColumn(r(t.mColumn)),n.setOptmizationZ(o)}if("xz"===t.type){const o=s(e,t.geometryType),i=e.DisplayOptimizationXZBuilder.new();i.setCodeField(r(t.code)),i.setEncoding(t.encoding),i.setFullExtent(t.fullExtent),i.setGeometryType(o),i.setSpatialReference(t.wkid,null==t.wkid?t.wkt:void 0),i.setMaxLevel(t.maxLevel),i.setHasZ(t.hasZ??!1),i.setHasM(t.hasM??!1);for(const n of t.levels??[]){const t=new Float64Array(n.transform.translate),o=new Float64Array(n.transform.scale),a=r(n.column);i.addLevel(e.MultiscaleGeometryField.new(n.level,n.scale,a,t,o))}n.setOptmizationXZ(i)}}return n}async function p(t,n){const o=await i(),r=n.geometryInfo?m(o,n.geometryInfo):null,a=n.provider.fetchRange.bind(n.provider),l=n.provider.fetchLength.bind(n.provider);try{return await o.ParquetFile.fromUrl(t,a,l,r)}catch(s){throw new e("parquet","Failed to parse file",{error:s})}}function c(e){const t=e.keyValueMetadata("geo");return null!=t?JSON.parse(t):null}function d(t){if(t.keyValueMetadata("esri"))throw new e("parquet:unsupported","File was created using an unsupported experimental display index. Please regenerate the file.");const n=t.keyValueMetadata("geodisplay");if(null!=n)return y(JSON.parse(n));const o=t.keyValueMetadata("org.apache.spark.sql.parquet.row.metadata");if(null!=o){const e=JSON.parse(o);for(const t of e.fields)if(null!=t.metadata&&"type"in t.metadata&&("xz"===t.metadata.type||"z"===t.metadata.type)){return y({parentColumn:t.name,index:t.metadata})}}return null}function y(e){if("xz"===e.index.type&&(e.index.geometryType=k(e.index.geometryType),"esri-pbf"===e.index.encoding&&(e.index.encoding="esriPBF"),"esriPBF"!==e.index.encoding))return r().warn("parquet:unsupported",`Encoding for display index must be of type esriPBF, but found ${e.index.encoding}`),null;const{xmin:t,ymin:n,xmax:o,ymax:i}=e.index.fullExtent;return Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(o)&&Number.isFinite(i)?e:(r().warn("parquet:protocol-violation","Ignoring display optimization, found bad extent",{index:e.index}),null)}function f(e){g(e);const t=w(e),n=c(e),o=d(e),i=x(n,t),{hasZ:r,hasM:a}=P(n,o);let l,s;if(i)switch(i.type){case"location":s={wkid:4326},l="esriGeometryPoint";break;case"wkb":if(n){const e=n.primary_column,t=n.columns[e];l=F(t),s=z(t)}}if(o){const e=o.index;!s&&e.wkid&&(s={wkid:e.wkid}),l||(l="z"===e.type?"esriGeometryPoint":G(e.geometryType))}return{geoMetadata:n,displayOptimization:o,hasZ:r,hasM:a,geometryEncoding:i,geometryInfo:s&&l?{geometry:i?{geometryType:l,spatialReference:s,encoding:i}:null,displayOptimization:o}:null,geometryType:l,spatialReference:s,extent:b(n,o,s),fields:t}}function g(t){for(const n of t.compressionCodecs())if(!a.has(n))throw new e("parquet:unsupported",`Compression codec ${n} is unsupported. Must be of type ${Array.from(a).join(",")}`)}function w(e){return e.fields(!1).map(e=>({name:e.name,alias:e.name,type:e.type}))}function x(e,t){if(null!=e){const t=e.primary_column;return{type:"wkb",field:t,orientation:"counterclockwise"===e.columns[t].orientation?"counter-clockwise":null}}const n=h(t.filter(e=>l.has(e.type)).map(e=>e.name));return n.latitudeFieldName&&n.longitudeFieldName?{type:"location",xField:n.longitudeFieldName,yField:n.latitudeFieldName}:null}function h(e){const t=e.map(e=>e.toLowerCase());return{longitudeFieldName:e[t.indexOf(o.find(e=>t.includes(e)))],latitudeFieldName:e[t.indexOf(n.find(e=>t.includes(e)))]}}function F(t){const{geometry_types:n}=t,o=new Set;for(const e of n){const t=M(e);t&&o.add(t)}if(o.size>1)throw new e("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:o});return 1===o.size?o.values().next().value:void 0}function M(e){switch(e.replace(/ (?:Z|M|ZM)$/u,"")){case"Point":return"esriGeometryPoint";case"Polygon":case"MultiPolygon":return"esriGeometryPolygon";case"LineString":return"esriGeometryPolyline";case"MultiPoint":return"esriGeometryMultipoint";default:return null}}function P(e,t){const n=t?.index;if("z"===n?.type)return{hasZ:null!=n.zColumn,hasM:null!=n.mColumn};if("xz"===n?.type)return{hasZ:!0===n.hasZ,hasM:!0===n.hasM};const o=e?.columns[e.primary_column]?.geometry_types??[];return{hasZ:o.some(e=>/ (?:Z|ZM)$/u.test(e)),hasM:o.some(e=>/ (?:M|ZM)$/u.test(e))}}function G(e){switch(e){case"polygon":return"esriGeometryPolygon";case"polyline":return"esriGeometryPolyline";case"multipoint":return"esriGeometryMultipoint"}}function k(t){switch(t.toLowerCase()){case"polygon":return"polygon";case"polyline":return"polyline";case"multipoint":return"multipoint";default:throw new e("parquet:unsupported",`Geometry type ${t} is unsupported`)}}function z(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?{wkid:t}:void 0}function b(e,t,n){if(!n)return null;const o=e?e.columns[e.primary_column]:null,i=o?.bbox;if(i?.every(e=>Number.isFinite(e)))switch(i.length){case 4:return{xmin:i[0],ymin:i[1],xmax:i[2],ymax:i[3],spatialReference:n};case 6:return{xmin:i[0],ymin:i[1],xmax:i[3],ymax:i[4],spatialReference:n};default:r().warn("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{geoMetadata:e})}const a=t?.index.fullExtent;return a?{...a,spatialReference:n}:null}export{p as createParquetFile,c as readGeoMetadata,d as readGeodisplayMetadata,f as readMetadata};
|
|
2
|
+
import e from"../../core/Error.js";import n from"../../core/Logger.js";import{latitudeFieldNames as t,longitudeFieldNames as o}from"../../layers/support/locationUtils.js";import{loadParquetModule as r}from"./loadParquetModule.js";const i=()=>n.getLogger("esri.layers.ParquetLayer"),l=new Set(["uncompressed","snappy","gzip"]),u=new Set(["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeBigInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]);function s(n,t){switch(t){case"esriGeometryPoint":return n.GeometryType.Point;case"esriGeometryPolygon":case"polygon":return n.GeometryType.Polygon;case"esriGeometryPolyline":case"polyline":return n.GeometryType.Polyline;case"esriGeometryMultipoint":case"multipoint":return n.GeometryType.Multipoint;default:throw new e("parquet",`Found unexpected GeometryType: ${t}`)}}function a(e,n){const t=n.encoding,o=s(e,n.geometryType),r=n.spatialReference.wkid;if(null==r)throw new Error("InternalError: Wkid must be defined.");switch(t.type){case"wkb":return e.GeometryField.fromWkb(t.field,r,o);case"location":{const{yField:n,xField:i}=t;return e.GeometryField.fromLocation(n,i,r,o)}}}function m(e,n){const t=e.GeometryInfo.new();n.geometry&&t.setGeometry(a(e,n.geometry));const o=n.displayOptimization;if(o){const{index:n}=o;if("z"===n.type){const o=e.DisplayOptimizationZBuilder.new();o.setCodeField(f(n.code)),o.setXColumn(f(n.xColumn)),o.setYColumn(f(n.yColumn)),null!=n.zColumn&&o.setZColumn(f(n.zColumn)),null!=n.mColumn&&o.setMColumn(f(n.mColumn)),o.setCooordinatePrecision(n.coordinatePrecision),o.setFullExtent(n.fullExtent),o.setSpatialReference(n.wkid,null==n.wkid?n.wkt:void 0),o.setHasZ(!!n.zColumn),o.setHasM(!!n.mColumn),n.zColumn&&o.setZColumn(f(n.zColumn)),n.mColumn&&o.setMColumn(f(n.mColumn)),t.setOptmizationZ(o)}if("xz"===n.type){const o=s(e,n.geometryType),r=e.DisplayOptimizationXZBuilder.new();r.setCodeField(f(n.code)),r.setEncoding(n.encoding),r.setFullExtent(n.fullExtent),r.setGeometryType(o),r.setSpatialReference(n.wkid,null==n.wkid?n.wkt:void 0),r.setMaxLevel(n.maxLevel),r.setHasZ(n.hasZ??!1),r.setHasM(n.hasM??!1);for(const t of n.levels??[]){const n=new Float64Array(t.transform.translate),o=new Float64Array(t.transform.scale),i=f(t.column);r.addLevel(e.MultiscaleGeometryField.new(t.level,t.resolution,i,n,o))}t.setOptmizationXZ(r)}}return t}async function c(n,t){const o=await r(),i=t.geometryInfo?m(o,t.geometryInfo):null,l=t.provider.fetchRange.bind(t.provider),u=t.provider.fetchLength.bind(t.provider);try{return await o.ParquetFile.fromUrl(n,l,u,i)}catch(s){throw new e("parquet","Failed to parse file",{error:s})}}function p(e){const n=e.keyValueMetadata("geo");return null!=n?JSON.parse(n):null}function y(n){if(n.keyValueMetadata("esri"))throw new e("parquet:unsupported","File was created using an unsupported experimental display index. Please regenerate the file.");const t=n.keyValueMetadata("geodisplay");if(null!=t){return{present:!0,optimization:d({index:JSON.parse(t)})}}const o=n.keyValueMetadata("org.apache.spark.sql.parquet.row.metadata");if(null!=o){const e=JSON.parse(o);for(const n of e.fields)if(null!=n.metadata&&w(n.metadata)){if(!h(n.metadata))return i().warn("parquet:protocol-violation","Ignoring display optimization, found invalid column path",{index:n.metadata}),{present:!0,optimization:null};const e=g(n.metadata,n.name);return null==e?(i().warn("parquet:protocol-violation","Ignoring display optimization, Spark display column paths must be non-empty strings",{index:n.metadata}),{present:!0,optimization:null}):{present:!0,optimization:d({index:e})}}}return{present:!1,optimization:null}}function d(e){if(!h(e.index))return i().warn("parquet:protocol-violation","Ignoring display optimization, found invalid column path",{index:e.index}),null;if("xz"===e.index.type&&(e.index.geometryType=E(e.index.geometryType),"esri-pbf"===e.index.encoding&&(e.index.encoding="esriPBF"),"esriPBF"!==e.index.encoding))return i().warn("parquet:unsupported",`Encoding for display index must be of type esriPBF, but found ${e.index.encoding}`),null;const{xmin:n,ymin:t,xmax:o,ymax:r}=e.index.fullExtent;return Number.isFinite(n)&&Number.isFinite(t)&&Number.isFinite(o)&&Number.isFinite(r)?e:(i().warn("parquet:protocol-violation","Ignoring display optimization, found bad extent",{index:e.index}),null)}function f(e){return Array.isArray(e)?e.join("."):e}function g(e,n){if("z"===e.type){const t=x(e.code,n),o=x(e.xColumn,n),r=x(e.yColumn,n),i=null==e.zColumn?e.zColumn:x(e.zColumn,n),l=null==e.mColumn?e.mColumn:x(e.mColumn,n);return null==t||null==o||null==r||null===i||null===l?null:{...e,code:t,xColumn:o,yColumn:r,...null==i?{}:{zColumn:i},...null==l?{}:{mColumn:l}}}const t=x(e.code,n),o=[];for(const r of e.levels){const e=x(r.column,n);if(null==e)return null;o.push({...r,column:e})}return null==t?null:{...e,code:t,levels:o}}function x(e,n){return"string"==typeof e&&e.length>0?[n,e]:null}function w(e){return"object"==typeof e&&null!=e&&"type"in e&&("z"===e.type||"xz"===e.type)}function h(e){return"z"===e.type?C(e.code)&&C(e.xColumn)&&C(e.yColumn)&&(null==e.zColumn||C(e.zColumn))&&(null==e.mColumn||C(e.mColumn)):C(e.code)&&Array.isArray(e.levels)&&e.levels.every(e=>"object"==typeof e&&null!=e&&"column"in e&&C(e.column))}function C(e){return"string"==typeof e&&e.length>0||Array.isArray(e)&&2===e.length&&e.every(e=>"string"==typeof e&&e.length>0)}function z(e){if(null==e)return null;const n=e.ordering,t=e.lod;if(null==n&&null==t)return null;if("xz"!==n?.type||null==t||n.geometry_column!==e.primary_column||t.geometry_column!==e.primary_column||n.geometry_column!==t.geometry_column||20!==n.max_level||!G(n.extent)||"pbf"!==t.encoding)return M(e,"ordering and lod must form a valid primary-column XZ pair");const o=e.columns[e.primary_column],r=v(o);if(null==r||!F(t.orientation,r.geometryType))return M(e,"geometry type, dimensions, or LOD orientation is invalid");const i=k(t.levels),l=R(o)?.wkid;if(null==i||null==l)return M(e,"LOD levels or spatial reference is invalid");const[u,s,a,m]=n.extent;return{index:{type:"xz",code:"geokey",wkid:l,wkt:null,encoding:"esriPBF",fullExtent:{xmin:u,ymin:s,xmax:a,ymax:m},geometryType:r.geometryType,maxLevel:n.max_level,hasZ:r.hasZ,hasM:r.hasM,levels:i}}}function M(e,n){return i().warn("parquet:protocol-violation",`Ignoring GeoParquet ordering and LOD extensions: ${n}`,{lod:e.lod,ordering:e.ordering}),null}function v(e){if(null==e||0===e.geometry_types.length)return null;let n,t;for(const o of e.geometry_types){const e=/^(LineString|MultiLineString|Polygon|MultiPolygon)(?: (Z|M|ZM))?$/.exec(o);if(null==e)return null;const r="LineString"===e[1]||"MultiLineString"===e[1]?"polyline":"polygon";if(null!=n&&n!==r||null!=t&&t!==(e[2]??""))return null;n=r,t=e[2]??""}return null==n||null==t?null:{geometryType:n,hasZ:"Z"===t||"ZM"===t,hasM:"M"===t||"ZM"===t}}function F(e,n){return"polygon"===n?"clockwise"===e:null==e}function k(e){if(!Array.isArray(e)||0===e.length)return null;const n=new Set,t=e.slice().sort((e,n)=>n.resolution-e.resolution),o=[];for(const[r,i]of t.entries()){if(!P(i.column)||!Number.isFinite(i.resolution)||i.resolution<=0||n.has(i.resolution)||!b(i.transform))return null;n.add(i.resolution),o.push({column:i.column,level:r,resolution:i.resolution,transform:i.transform})}return o}function P(e){return Array.isArray(e)&&2===e.length&&"geolod"===e[0]&&"string"==typeof e[1]&&e[1].length>0}function b(e){return Z(e?.scale,!0)&&Z(e?.translate,!1)}function Z(e,n){return Array.isArray(e)&&4===e.length&&e.every(e=>"number"==typeof e&&Number.isFinite(e)&&(!n||e>0))}function G(e){return Z(e,!1)&&e[0]<e[2]&&e[1]<e[3]}function T(e){q(e);const n=L(e),t=p(e),o=y(e),r=o.present?o.optimization:z(t),i=S(t,n),{hasZ:l,hasM:u}=A(t,r);let s,a;if(i)switch(i.type){case"location":a={wkid:4326},s="esriGeometryPoint";break;case"wkb":if(t){const e=t.primary_column,n=t.columns[e];s=N(n),a=R(n)}}if(r){const e=r.index;!a&&e.wkid&&(a={wkid:e.wkid}),s||(s="z"===e.type?"esriGeometryPoint":I(e.geometryType))}return{geoMetadata:t,displayOptimization:r,hasZ:l,hasM:u,geometryEncoding:i,geometryInfo:a&&s?{geometry:i?{geometryType:s,spatialReference:a,encoding:i}:null,displayOptimization:r}:null,geometryType:s,spatialReference:a,extent:$(t,r,a),fields:n}}function q(n){for(const t of n.compressionCodecs())if(!l.has(t))throw new e("parquet:unsupported",`Compression codec ${t} is unsupported. Must be of type ${Array.from(l).join(",")}`)}function L(e){return e.fields(!1).map(e=>({name:e.name,alias:e.name,type:e.type}))}function S(e,n){if(null!=e){const n=e.primary_column;return{type:"wkb",field:n,orientation:"counterclockwise"===e.columns[n].orientation?"counter-clockwise":null}}const t=_(n.filter(e=>u.has(e.type)).map(e=>e.name));return t.latitudeFieldName&&t.longitudeFieldName?{type:"location",xField:t.longitudeFieldName,yField:t.latitudeFieldName}:null}function _(e){const n=e.map(e=>e.toLowerCase());return{longitudeFieldName:e[n.indexOf(o.find(e=>n.includes(e)))],latitudeFieldName:e[n.indexOf(t.find(e=>n.includes(e)))]}}function N(n){const{geometry_types:t}=n,o=new Set;for(const e of t){const n=O(e);n&&o.add(n)}if(o.size>1)throw new e("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:o});return 1===o.size?o.values().next().value:void 0}function O(e){switch(e.replace(/ (?:Z|M|ZM)$/u,"")){case"Point":return"esriGeometryPoint";case"Polygon":case"MultiPolygon":return"esriGeometryPolygon";case"LineString":case"MultiLineString":return"esriGeometryPolyline";case"MultiPoint":return"esriGeometryMultipoint";default:return null}}function A(e,n){const t=n?.index;if("z"===t?.type)return{hasZ:null!=t.zColumn,hasM:null!=t.mColumn};if("xz"===t?.type)return{hasZ:!0===t.hasZ,hasM:!0===t.hasM};const o=e?.columns[e.primary_column]?.geometry_types??[];return{hasZ:o.some(e=>/ (?:Z|ZM)$/u.test(e)),hasM:o.some(e=>/ (?:M|ZM)$/u.test(e))}}function I(e){switch(e){case"polygon":return"esriGeometryPolygon";case"polyline":return"esriGeometryPolyline";case"multipoint":return"esriGeometryMultipoint"}}function E(n){switch(n.toLowerCase()){case"polygon":return"polygon";case"polyline":return"polyline";case"multipoint":return"multipoint";default:throw new e("parquet:unsupported",`Geometry type ${n} is unsupported`)}}function R(e){const n=e.crs?.id?.code;return"number"==typeof n?{wkid:n}:"OGC"===e.crs?.id?.authority&&"CRS84"===n?{wkid:4326}:void 0}function $(e,n,t){if(!t)return null;const o=e?e.columns[e.primary_column]:null,r=o?.bbox;if(r?.every(e=>Number.isFinite(e)))switch(r.length){case 4:return{xmin:r[0],ymin:r[1],xmax:r[2],ymax:r[3],spatialReference:t};case 6:return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t};default:i().warn("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{geoMetadata:e})}const l=n?.index.fullExtent;return l?{...l,spatialReference:t}:null}export{c as createParquetFile,f as normalizeColumnPath,p as readGeoMetadata,T as readMetadata};
|
package/package.json
CHANGED
package/rest/support/Query.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{JSONMap as e}from"../../core/jsonMap.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import{property as o,cast as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{ensureClass as a}from"../../core/accessorSupport/ensureType.js";import l from"../../geometry/Point.js";import p from"../../geometry/SpatialReference.js";import{fromJSON as u}from"../../geometry/support/jsonUtils.js";import{geometryTypes as d}from"../../geometry/support/typeUtils.js";import m from"../layerSources/DynamicDataLayer.js";import c from"./FullTextSearch.js";import y from"./OutDistance.js";import h from"./QuantizationParameters.js";import{spatialRelKebabDict as f}from"./spatialRelationships.js";import j from"./StatisticDefinition.js";import v from"../../time/TimeExtent.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{enumeration as w}from"../../core/accessorSupport/decorators/enumeration.js";var S;const R=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let b=class extends r{static{S=this}static from(t){return a(S,t)}constructor(t){super(t),this.aggregateIds=null,this.cacheHint=void 0,this.compactGeometryEnabled=!1,this.datumTransformation=null,this.defaultSpatialReferenceEnabled=!1,this.distance=void 0,this.dynamicDataSource=void 0,this.formatOf3DObjects=null,this.fullText=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=void 0,this.groupByFieldsForStatistics=null,this.having=null,this.historicMoment=null,this.maxAllowableOffset=void 0,this.maxRecordCountFactor=1,this.multipatchOption=null,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.outStatistics=null,this.parameterValues=null,this.pixelSize=null,this.quantizationParameters=null,this.rangeValues=null,this.relationParameter=null,this.resultType=null,this.returnStatisticsAggregatedIds=!1,this.returnCentroid=!1,this.returnDistinctValues=!1,this.returnExceededLimitFeatures=!0,this.returnExceededLimitGeometries=!0,this.returnGeometry=!1,this.returnQueryGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.returnTrueCurves=void 0,this.sourceSpatialReference=null,this.spatialRelationship="intersects",this.start=void 0,this.sqlFormat=null,this.text=null,this.timeExtent=null,this.timeReferenceUnknownClient=!1,this.units=null,this.outDistance=null,this.where=null}castDatumTransformation(t){return"number"==typeof t||"object"==typeof t?t:null}writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}writeParameterValues(t,e){if(t){const r={};for(const e in t){const i=t[e];Array.isArray(i)?r[e]=i.map(t=>t instanceof Date?t.getTime():t):i instanceof Date?r[e]=i.getTime():r[e]=i}e.parameterValues=r}}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10,e.where="1=1"}writeWhere(t,e){e.where=t||"1=1"}clone(){return new S(i({aggregateIds:this.aggregateIds,cacheHint:this.cacheHint,compactGeometryEnabled:this.compactGeometryEnabled,datumTransformation:this.datumTransformation,defaultSpatialReferenceEnabled:this.defaultSpatialReferenceEnabled,distance:this.distance,fullText:this.fullText,formatOf3DObjects:this.formatOf3DObjects,gdbVersion:this.gdbVersion,geometry:this.geometry,geometryPrecision:this.geometryPrecision,groupByFieldsForStatistics:this.groupByFieldsForStatistics,having:this.having,historicMoment:null!=this.historicMoment?new Date(this.historicMoment):null,maxAllowableOffset:this.maxAllowableOffset,maxRecordCountFactor:this.maxRecordCountFactor,multipatchOption:this.multipatchOption,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,outStatistics:this.outStatistics,parameterValues:this.parameterValues,pixelSize:this.pixelSize,quantizationParameters:this.quantizationParameters,rangeValues:this.rangeValues,relationParameter:this.relationParameter,resultType:this.resultType,returnStatisticsAggregatedIds:this.returnStatisticsAggregatedIds,returnDistinctValues:this.returnDistinctValues,returnGeometry:this.returnGeometry,returnCentroid:this.returnCentroid,returnExceededLimitFeatures:this.returnExceededLimitFeatures,returnExceededLimitGeometries:this.returnExceededLimitGeometries,returnQueryGeometry:this.returnQueryGeometry,returnM:this.returnM,returnZ:this.returnZ,returnTrueCurves:this.returnTrueCurves,dynamicDataSource:this.dynamicDataSource,sourceSpatialReference:this.sourceSpatialReference,spatialRelationship:this.spatialRelationship,start:this.start,sqlFormat:this.sqlFormat,text:this.text,timeExtent:this.timeExtent,timeReferenceUnknownClient:this.timeReferenceUnknownClient,units:this.units,outDistance:this.outDistance,where:this.where}))}static{this.MAX_MAX_RECORD_COUNT_FACTOR=5}};t([o({json:{write:!0}})],b.prototype,"aggregateIds",void 0),t([o({type:Boolean,json:{write:!0}})],b.prototype,"cacheHint",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"compactGeometryEnabled",void 0),t([o({json:{write:!0}})],b.prototype,"datumTransformation",void 0),t([s("datumTransformation")],b.prototype,"castDatumTransformation",null),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"defaultSpatialReferenceEnabled",void 0),t([o({type:Number,json:{write:{overridePolicy:t=>({enabled:!!t})}}})],b.prototype,"distance",void 0),t([o({type:m,json:{write:!0}})],b.prototype,"dynamicDataSource",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"formatOf3DObjects",void 0),t([o({type:[c],json:{write:{enabled:!0,overridePolicy(){return{enabled:null!=this.fullText&&this.fullText.length>0}}}}})],b.prototype,"fullText",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"gdbVersion",void 0),t([o({types:d,json:{read:u,write:!0}})],b.prototype,"geometry",void 0),t([o({type:Number,json:{write:!0}})],b.prototype,"geometryPrecision",void 0),t([o({type:[String],json:{write:!0}})],b.prototype,"groupByFieldsForStatistics",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"having",void 0),t([o({type:Date})],b.prototype,"historicMoment",void 0),t([g("historicMoment")],b.prototype,"writeHistoricMoment",null),t([o({type:Number,json:{write:!0}})],b.prototype,"maxAllowableOffset",void 0),t([o({type:Number,cast:t=>t<1?1:t>
|
|
2
|
+
import{__decorate as t}from"tslib";import{JSONMap as e}from"../../core/jsonMap.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import{property as o,cast as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{ensureClass as a}from"../../core/accessorSupport/ensureType.js";import l from"../../geometry/Point.js";import p from"../../geometry/SpatialReference.js";import{fromJSON as u}from"../../geometry/support/jsonUtils.js";import{geometryTypes as d}from"../../geometry/support/typeUtils.js";import m from"../layerSources/DynamicDataLayer.js";import c from"./FullTextSearch.js";import y from"./OutDistance.js";import h from"./QuantizationParameters.js";import{spatialRelKebabDict as f}from"./spatialRelationships.js";import j from"./StatisticDefinition.js";import v from"../../time/TimeExtent.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{enumeration as w}from"../../core/accessorSupport/decorators/enumeration.js";var S;const R=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let b=class extends r{static{S=this}static from(t){return a(S,t)}constructor(t){super(t),this.aggregateIds=null,this.cacheHint=void 0,this.compactGeometryEnabled=!1,this.datumTransformation=null,this.defaultSpatialReferenceEnabled=!1,this.distance=void 0,this.dynamicDataSource=void 0,this.formatOf3DObjects=null,this.fullText=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=void 0,this.groupByFieldsForStatistics=null,this.having=null,this.historicMoment=null,this.maxAllowableOffset=void 0,this.maxRecordCountFactor=1,this.multipatchOption=null,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.outStatistics=null,this.parameterValues=null,this.pixelSize=null,this.quantizationParameters=null,this.rangeValues=null,this.relationParameter=null,this.resultType=null,this.returnStatisticsAggregatedIds=!1,this.returnCentroid=!1,this.returnDistinctValues=!1,this.returnExceededLimitFeatures=!0,this.returnExceededLimitGeometries=!0,this.returnGeometry=!1,this.returnQueryGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.returnTrueCurves=void 0,this.sourceSpatialReference=null,this.spatialRelationship="intersects",this.start=void 0,this.sqlFormat=null,this.text=null,this.timeExtent=null,this.timeReferenceUnknownClient=!1,this.units=null,this.outDistance=null,this.where=null}castDatumTransformation(t){return"number"==typeof t||"object"==typeof t?t:null}writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}writeParameterValues(t,e){if(t){const r={};for(const e in t){const i=t[e];Array.isArray(i)?r[e]=i.map(t=>t instanceof Date?t.getTime():t):i instanceof Date?r[e]=i.getTime():r[e]=i}e.parameterValues=r}}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10,e.where="1=1"}writeWhere(t,e){e.where=t||"1=1"}clone(){return new S(i({aggregateIds:this.aggregateIds,cacheHint:this.cacheHint,compactGeometryEnabled:this.compactGeometryEnabled,datumTransformation:this.datumTransformation,defaultSpatialReferenceEnabled:this.defaultSpatialReferenceEnabled,distance:this.distance,fullText:this.fullText,formatOf3DObjects:this.formatOf3DObjects,gdbVersion:this.gdbVersion,geometry:this.geometry,geometryPrecision:this.geometryPrecision,groupByFieldsForStatistics:this.groupByFieldsForStatistics,having:this.having,historicMoment:null!=this.historicMoment?new Date(this.historicMoment):null,maxAllowableOffset:this.maxAllowableOffset,maxRecordCountFactor:this.maxRecordCountFactor,multipatchOption:this.multipatchOption,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,outStatistics:this.outStatistics,parameterValues:this.parameterValues,pixelSize:this.pixelSize,quantizationParameters:this.quantizationParameters,rangeValues:this.rangeValues,relationParameter:this.relationParameter,resultType:this.resultType,returnStatisticsAggregatedIds:this.returnStatisticsAggregatedIds,returnDistinctValues:this.returnDistinctValues,returnGeometry:this.returnGeometry,returnCentroid:this.returnCentroid,returnExceededLimitFeatures:this.returnExceededLimitFeatures,returnExceededLimitGeometries:this.returnExceededLimitGeometries,returnQueryGeometry:this.returnQueryGeometry,returnM:this.returnM,returnZ:this.returnZ,returnTrueCurves:this.returnTrueCurves,dynamicDataSource:this.dynamicDataSource,sourceSpatialReference:this.sourceSpatialReference,spatialRelationship:this.spatialRelationship,start:this.start,sqlFormat:this.sqlFormat,text:this.text,timeExtent:this.timeExtent,timeReferenceUnknownClient:this.timeReferenceUnknownClient,units:this.units,outDistance:this.outDistance,where:this.where}))}static{this.MAX_MAX_RECORD_COUNT_FACTOR=5}};t([o({json:{write:!0}})],b.prototype,"aggregateIds",void 0),t([o({type:Boolean,json:{write:!0}})],b.prototype,"cacheHint",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"compactGeometryEnabled",void 0),t([o({json:{write:!0}})],b.prototype,"datumTransformation",void 0),t([s("datumTransformation")],b.prototype,"castDatumTransformation",null),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"defaultSpatialReferenceEnabled",void 0),t([o({type:Number,json:{write:{overridePolicy:t=>({enabled:!!t})}}})],b.prototype,"distance",void 0),t([o({type:m,json:{write:!0}})],b.prototype,"dynamicDataSource",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"formatOf3DObjects",void 0),t([o({type:[c],json:{write:{enabled:!0,overridePolicy(){return{enabled:null!=this.fullText&&this.fullText.length>0}}}}})],b.prototype,"fullText",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"gdbVersion",void 0),t([o({types:d,json:{read:u,write:!0}})],b.prototype,"geometry",void 0),t([o({type:Number,json:{write:!0}})],b.prototype,"geometryPrecision",void 0),t([o({type:[String],json:{write:!0}})],b.prototype,"groupByFieldsForStatistics",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"having",void 0),t([o({type:Date})],b.prototype,"historicMoment",void 0),t([g("historicMoment")],b.prototype,"writeHistoricMoment",null),t([o({type:Number,json:{write:!0}})],b.prototype,"maxAllowableOffset",void 0),t([o({type:Number,cast:t=>t<1?1:t>S.MAX_MAX_RECORD_COUNT_FACTOR?S.MAX_MAX_RECORD_COUNT_FACTOR:t,json:{write:{overridePolicy:t=>({enabled:t>1})}}})],b.prototype,"maxRecordCountFactor",void 0),t([o({type:["xyFootprint"],json:{write:!0}})],b.prototype,"multipatchOption",void 0),t([o({type:Number,json:{read:{source:"resultRecordCount"}}})],b.prototype,"num",void 0),t([o({json:{write:!0}})],b.prototype,"objectIds",void 0),t([o({type:[String],json:{write:!0}})],b.prototype,"orderByFields",void 0),t([o({type:[String],json:{write:!0}})],b.prototype,"outFields",void 0),t([o({type:p,json:{name:"outSR",write:!0}})],b.prototype,"outSpatialReference",void 0),t([o({type:[j],json:{write:{enabled:!0,overridePolicy(){return{enabled:null!=this.outStatistics&&this.outStatistics.length>0}}}}})],b.prototype,"outStatistics",void 0),t([o({json:{write:!0}})],b.prototype,"parameterValues",void 0),t([g("parameterValues")],b.prototype,"writeParameterValues",null),t([o({type:l,json:{write:!0}})],b.prototype,"pixelSize",void 0),t([o({type:h,json:{write:!0}})],b.prototype,"quantizationParameters",void 0),t([o({type:[Object],json:{write:!0}})],b.prototype,"rangeValues",void 0),t([o({type:String,json:{read:{source:"relationParam"},write:{target:"relationParam",overridePolicy(){return{enabled:"relation"===this.spatialRelationship}}}}})],b.prototype,"relationParameter",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"resultType",void 0),t([o({type:Boolean,json:{name:"returnAggIds",write:{overridePolicy(t){return{enabled:t&&!!this.groupByFieldsForStatistics?.length&&!!this.outStatistics?.length}}}}})],b.prototype,"returnStatisticsAggregatedIds",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"returnCentroid",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"returnDistinctValues",void 0),t([o({type:Boolean,json:{default:!0,write:!0}})],b.prototype,"returnExceededLimitFeatures",void 0),t([o({type:Boolean,json:{default:!0,write:!0}})],b.prototype,"returnExceededLimitGeometries",void 0),t([o({type:Boolean,json:{write:!0}})],b.prototype,"returnGeometry",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"returnQueryGeometry",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"returnM",void 0),t([o({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],b.prototype,"returnZ",void 0),t([o({type:Boolean,json:{write:!0}})],b.prototype,"returnTrueCurves",void 0),t([o({type:p,json:{write:!0}})],b.prototype,"sourceSpatialReference",void 0),t([w(f,{ignoreUnknown:!1,name:"spatialRel"})],b.prototype,"spatialRelationship",void 0),t([o({type:Number,json:{read:{source:"resultOffset"}}})],b.prototype,"start",void 0),t([g("start"),g("num")],b.prototype,"writeStart",null),t([o({type:String,json:{write:!0}})],b.prototype,"sqlFormat",void 0),t([o({type:String,json:{write:!0}})],b.prototype,"text",void 0),t([o({type:v,json:{write:!0}})],b.prototype,"timeExtent",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],b.prototype,"timeReferenceUnknownClient",void 0),t([w(R,{ignoreUnknown:!1}),o({json:{write:{overridePolicy(t){return{enabled:!!t&&!!this.distance}}}}})],b.prototype,"units",void 0),t([o({type:y,json:{write:!0}})],b.prototype,"outDistance",void 0),t([o({type:String,json:{write:{overridePolicy(t){return{enabled:null!=t||null!=this.start&&this.start>0}}}}})],b.prototype,"where",void 0),t([g("where")],b.prototype,"writeWhere",null),b=S=t([n("esri.rest.support.Query")],b);export{b as default};
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const c="
|
|
2
|
+
const c="20260801",d="ccfdc50e1176825dea0b728ff6dc586911c94d73";export{c as buildDate,d as commitHash};
|
package/symbols/LabelSymbol3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{clone as r}from"../core/lang.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import i from"./Symbol3D.js";import a from"./TextSymbol3DLayer.js";import{hasVisibleCallout as y,hasVisibleVerticalOffset as m,calloutProperty as p}from"./callouts/calloutUtils.js";import n from"./support/Symbol3DVerticalOffset.js";import{enumeration as c}from"../core/accessorSupport/decorators/enumeration.js";var u;const b=e.ofType({base:null,key:"type",typeMap:{text:a}});let f=u=class extends i{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.type="label-3d",this.symbolLayers=new b}get symbolLayers(){return this._get("symbolLayers")}set symbolLayers(t){o(t,this._get("symbolLayers"))}supportsCallout(){return!0}hasVisibleCallout(){return y(this)}hasVisibleVerticalOffset(){return m(this)}clone(){return new u({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail),callout:r(this.callout),verticalOffset:r(this.verticalOffset)})}static fromTextSymbol(t){return new u({symbolLayers:new e([a.fromTextSymbol(t)])})}};t([s({type:n,json:{write:!0}})],f.prototype,"verticalOffset",void 0),t([s(p)],f.prototype,"callout",void 0),t([s({json:{read:!1,write:!1}})],f.prototype,"styleOrigin",void 0),t([s({type:b})],f.prototype,"symbolLayers",null),t([c({
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{clone as r}from"../core/lang.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import i from"./Symbol3D.js";import a from"./TextSymbol3DLayer.js";import{hasVisibleCallout as y,hasVisibleVerticalOffset as m,calloutProperty as p}from"./callouts/calloutUtils.js";import n from"./support/Symbol3DVerticalOffset.js";import{enumeration as c}from"../core/accessorSupport/decorators/enumeration.js";var u;const b=e.ofType({base:null,key:"type",typeMap:{text:a}});let f=u=class extends i{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.type="label-3d",this.symbolLayers=new b}get symbolLayers(){return this._get("symbolLayers")}set symbolLayers(t){o(t,this._get("symbolLayers"))}supportsCallout(){return!0}hasVisibleCallout(){return y(this)}hasVisibleVerticalOffset(){return m(this)}clone(){return new u({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail),callout:r(this.callout),verticalOffset:r(this.verticalOffset)})}static fromTextSymbol(t){return new u({symbolLayers:new e([a.fromTextSymbol(t)])})}};t([s({type:n,json:{write:!0}})],f.prototype,"verticalOffset",void 0),t([s(p)],f.prototype,"callout",void 0),t([s({json:{read:!1,write:!1}})],f.prototype,"styleOrigin",void 0),t([s({type:b})],f.prototype,"symbolLayers",null),t([c({LabelSymbol3D_1:"label-3d"},{readOnly:!0})],f.prototype,"type",void 0),f=u=t([l("esri.symbols.LabelSymbol3D")],f);export{f as default};
|
package/symbols/LineSymbol3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import o from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as t,subclass as s}from"../core/accessorSupport/decorators.js";import i from"./LineSymbol3DLayer.js";import y from"./PathSymbol3DLayer.js";import l from"./Symbol3D.js";import{enumeration as m}from"../core/accessorSupport/decorators/enumeration.js";var p;const n=o.ofType({base:null,key:"type",typeMap:{line:i,path:y}}),a=o.ofType({base:null,key:"type",typeMap:{line:i,path:y}});let b=p=class extends l{constructor(e){super(e),this.symbolLayers=new n,this.type="line-3d"}clone(){return new p({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleLineSymbol(e){return new p({symbolLayers:new o([i.fromSimpleLineSymbol(e)])})}};e([t({type:n,json:{type:a}})],b.prototype,"symbolLayers",void 0),e([m({
|
|
2
|
+
import{__decorate as e}from"tslib";import o from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as t,subclass as s}from"../core/accessorSupport/decorators.js";import i from"./LineSymbol3DLayer.js";import y from"./PathSymbol3DLayer.js";import l from"./Symbol3D.js";import{enumeration as m}from"../core/accessorSupport/decorators/enumeration.js";var p;const n=o.ofType({base:null,key:"type",typeMap:{line:i,path:y}}),a=o.ofType({base:null,key:"type",typeMap:{line:i,path:y}});let b=p=class extends l{constructor(e){super(e),this.symbolLayers=new n,this.type="line-3d"}clone(){return new p({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleLineSymbol(e){return new p({symbolLayers:new o([i.fromSimpleLineSymbol(e)])})}};e([t({type:n,json:{type:a}})],b.prototype,"symbolLayers",void 0),e([m({LineSymbol3D_1:"line-3d"},{readOnly:!0})],b.prototype,"type",void 0),b=p=e([s("esri.symbols.LineSymbol3D")],b);export{b as default};
|
package/symbols/MeshSymbol3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import e from"../core/Collection.js";import{referenceSetter as r}from"../core/collectionUtils.js";import{clone as s}from"../core/lang.js";import{property as t,subclass as l}from"../core/accessorSupport/decorators.js";import m from"./FillSymbol3DLayer.js";import y from"./Symbol3D.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";var p;const a=e.ofType({base:null,key:"type",typeMap:{fill:m}});let n=p=class extends y{constructor(o){super(o),this.type="mesh-3d",this.symbolLayers=new a}get symbolLayers(){return this._get("symbolLayers")}set symbolLayers(o){r(o,this._get("symbolLayers"))}clone(){return new p({styleOrigin:s(this.styleOrigin),symbolLayers:s(this.symbolLayers),thumbnail:s(this.thumbnail)})}static fromSimpleFillSymbol(o){return new p({symbolLayers:new e([m.fromSimpleFillSymbol(o)])})}};o([t({type:a})],n.prototype,"symbolLayers",null),o([i({
|
|
2
|
+
import{__decorate as o}from"tslib";import e from"../core/Collection.js";import{referenceSetter as r}from"../core/collectionUtils.js";import{clone as s}from"../core/lang.js";import{property as t,subclass as l}from"../core/accessorSupport/decorators.js";import m from"./FillSymbol3DLayer.js";import y from"./Symbol3D.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";var p;const a=e.ofType({base:null,key:"type",typeMap:{fill:m}});let n=p=class extends y{constructor(o){super(o),this.type="mesh-3d",this.symbolLayers=new a}get symbolLayers(){return this._get("symbolLayers")}set symbolLayers(o){r(o,this._get("symbolLayers"))}clone(){return new p({styleOrigin:s(this.styleOrigin),symbolLayers:s(this.symbolLayers),thumbnail:s(this.thumbnail)})}static fromSimpleFillSymbol(o){return new p({symbolLayers:new e([m.fromSimpleFillSymbol(o)])})}};o([t({type:a})],n.prototype,"symbolLayers",null),o([i({MeshSymbol3D_1:"mesh-3d"},{readOnly:!0})],n.prototype,"type",void 0),n=p=o([l("esri.symbols.MeshSymbol3D")],n);export{n as default};
|
package/symbols/PointSymbol3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import o from"../Color.js";import e from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import i from"./IconSymbol3DLayer.js";import m from"./ObjectSymbol3DLayer.js";import a from"./Symbol3D.js";import y from"./TextSymbol3DLayer.js";import{hasVisibleCallout as n,hasVisibleVerticalOffset as c,calloutProperty as p}from"./callouts/calloutUtils.js";import f from"./callouts/LineCallout3D.js";import b from"./support/Symbol3DVerticalOffset.js";import{enumeration as u}from"../core/accessorSupport/decorators/enumeration.js";var h;const S=e.ofType({base:null,key:"type",typeMap:{icon:i,object:m,text:y}});let w=h=class extends a{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.symbolLayers=new S,this.type="point-3d"}supportsCallout(){if((this.symbolLayers?this.symbolLayers.length:0)<1)return!1;for(const t of this.symbolLayers.items)switch(t.type){case"icon":case"text":case"object":continue;default:return!1}return!0}hasVisibleCallout(){return n(this)}hasVisibleVerticalOffset(){return c(this)}clone(){return new h({verticalOffset:r(this.verticalOffset),callout:r(this.callout),styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleMarkerSymbol(t){return new h({symbolLayers:new e([i.fromSimpleMarkerSymbol(t)])})}static fromPictureMarkerSymbol(t){return new h({symbolLayers:new e([i.fromPictureMarkerSymbol(t)])})}static fromCIMSymbol(t){const r=t.data?.symbol?.type;if("CIMPointSymbol"!==r)return null;const s=t.data.symbol;return new h(s?.callout?{symbolLayers:new e([i.fromCIMSymbol(t)]),callout:new f({size:.5,color:new o([0,0,0])}),verticalOffset:new b({screenLength:40})}:{symbolLayers:new e([i.fromCIMSymbol(t)])})}static fromTextSymbol(t){return new h({symbolLayers:new e([y.fromTextSymbol(t)])})}};t([s({type:b,json:{write:!0}})],w.prototype,"verticalOffset",void 0),t([s(p)],w.prototype,"callout",void 0),t([s({type:S,json:{origins:{"web-scene":{write:!0}}}})],w.prototype,"symbolLayers",void 0),t([u({
|
|
2
|
+
import{__decorate as t}from"tslib";import o from"../Color.js";import e from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import i from"./IconSymbol3DLayer.js";import m from"./ObjectSymbol3DLayer.js";import a from"./Symbol3D.js";import y from"./TextSymbol3DLayer.js";import{hasVisibleCallout as n,hasVisibleVerticalOffset as c,calloutProperty as p}from"./callouts/calloutUtils.js";import f from"./callouts/LineCallout3D.js";import b from"./support/Symbol3DVerticalOffset.js";import{enumeration as u}from"../core/accessorSupport/decorators/enumeration.js";var h;const S=e.ofType({base:null,key:"type",typeMap:{icon:i,object:m,text:y}});let w=h=class extends a{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.symbolLayers=new S,this.type="point-3d"}supportsCallout(){if((this.symbolLayers?this.symbolLayers.length:0)<1)return!1;for(const t of this.symbolLayers.items)switch(t.type){case"icon":case"text":case"object":continue;default:return!1}return!0}hasVisibleCallout(){return n(this)}hasVisibleVerticalOffset(){return c(this)}clone(){return new h({verticalOffset:r(this.verticalOffset),callout:r(this.callout),styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleMarkerSymbol(t){return new h({symbolLayers:new e([i.fromSimpleMarkerSymbol(t)])})}static fromPictureMarkerSymbol(t){return new h({symbolLayers:new e([i.fromPictureMarkerSymbol(t)])})}static fromCIMSymbol(t){const r=t.data?.symbol?.type;if("CIMPointSymbol"!==r)return null;const s=t.data.symbol;return new h(s?.callout?{symbolLayers:new e([i.fromCIMSymbol(t)]),callout:new f({size:.5,color:new o([0,0,0])}),verticalOffset:new b({screenLength:40})}:{symbolLayers:new e([i.fromCIMSymbol(t)])})}static fromTextSymbol(t){return new h({symbolLayers:new e([y.fromTextSymbol(t)])})}};t([s({type:b,json:{write:!0}})],w.prototype,"verticalOffset",void 0),t([s(p)],w.prototype,"callout",void 0),t([s({type:S,json:{origins:{"web-scene":{write:!0}}}})],w.prototype,"symbolLayers",void 0),t([u({PointSymbol3D_1:"point-3d"},{readOnly:!0})],w.prototype,"type",void 0),w=h=t([l("esri.symbols.PointSymbol3D")],w);export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as o}from"tslib";import r from"../core/Collection.js";import{clone as e}from"../core/lang.js";import{property as t,subclass as s}from"../core/accessorSupport/decorators.js";import m from"./ExtrudeSymbol3DLayer.js";import l from"./FillSymbol3DLayer.js";import y from"./IconSymbol3DLayer.js";import i from"./ObjectSymbol3DLayer.js";import p from"./Symbol3D.js";import a from"./WaterSymbol3DLayer.js";import{enumeration as n}from"../core/accessorSupport/decorators/enumeration.js";var c;const b=r.ofType({base:null,key:"type",typeMap:{extrude:m,fill:l,icon:y,object:i,water:a}});let f=c=class extends p{constructor(o){super(o),this.symbolLayers=new b,this.type="polygon-3d"}clone(){return new c({styleOrigin:e(this.styleOrigin),symbolLayers:e(this.symbolLayers),thumbnail:e(this.thumbnail)})}static fromJSON(o){const r=new c;return r.read(o),r}static fromSimpleFillSymbol(o){return new c({symbolLayers:new r([l.fromSimpleFillSymbol(o)])})}};o([t({type:b,json:{write:!0}})],f.prototype,"symbolLayers",void 0),o([n({
|
|
2
|
+
import{__decorate as o}from"tslib";import r from"../core/Collection.js";import{clone as e}from"../core/lang.js";import{property as t,subclass as s}from"../core/accessorSupport/decorators.js";import m from"./ExtrudeSymbol3DLayer.js";import l from"./FillSymbol3DLayer.js";import y from"./IconSymbol3DLayer.js";import i from"./ObjectSymbol3DLayer.js";import p from"./Symbol3D.js";import a from"./WaterSymbol3DLayer.js";import{enumeration as n}from"../core/accessorSupport/decorators/enumeration.js";var c;const b=r.ofType({base:null,key:"type",typeMap:{extrude:m,fill:l,icon:y,object:i,water:a}});let f=c=class extends p{constructor(o){super(o),this.symbolLayers=new b,this.type="polygon-3d"}clone(){return new c({styleOrigin:e(this.styleOrigin),symbolLayers:e(this.symbolLayers),thumbnail:e(this.thumbnail)})}static fromJSON(o){const r=new c;return r.read(o),r}static fromSimpleFillSymbol(o){return new c({symbolLayers:new r([l.fromSimpleFillSymbol(o)])})}};o([t({type:b,json:{write:!0}})],f.prototype,"symbolLayers",void 0),o([n({PolygonSymbol3D_1:"polygon-3d"},{readOnly:!0})],f.prototype,"type",void 0),f=c=o([s("esri.symbols.PolygonSymbol3D")],f);export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../../core/MapUtils.js";import{notDeepEqual as r}from"../../../../../../core/object.js";import{throwIfAborted as s,onAbort as
|
|
2
|
+
import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../../core/MapUtils.js";import{notDeepEqual as r}from"../../../../../../core/object.js";import{throwIfAborted as s,onAbort as i}from"../../../../../../core/promiseUtils.js";import{QueueProcessor as a}from"../../../../../../core/QueueProcessor.js";import{difference as o}from"../../../../../../core/SetUtils.js";import{openWithPorts as l}from"../../../../../../core/workers/workers.js";import{isFileProviderChangedError as n}from"../../../../../../layers/graphics/sources/parquet/fileProviderChangedError.js";import{loadParquetModule as d}from"../../../../../../libs/parquet/loadParquetModule.js";import{ALoadStrategy as h}from"./ALoadStrategy.js";import{fetchQueueConcurrency as u}from"./constants.js";import{ParquetSourceChunk as c}from"./chunks/ParquetSourceChunk.js";import{FeatureSetReaderParquet as p}from"../../support/FeatureSetReaderParquet.js";class m{constructor(e,r){this.subscription=e,this.chunks=[],this.ids=[],this._controller=new AbortController,this._handles=t([i(e.signal,()=>this._controller.abort()),i(r,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get options(){return{signal:this._controller.signal}}addBinaryData(t){this.chunks.push(t)}addSourceChunkId(t){this.ids.push(t)}}class _ extends h{constructor(t,e,r,s){if(super(t.metadata,e,r),this._service=t,this._loadStates=new Map,this._queue=new a({concurrency:u,process:t=>this._loadTile(t)}),!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._loaded=this._load(s)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(t,e){await this._loaded;let s=!0;return r(this.availableFields,e.availableFields)&&await this._updateFields(e.availableFields),this._schema.partial.dataSourceHash!==e.dataSourceHash&&(s=!1),this._schema.partial=e,s}async load(t){try{return await this._loaded,e(this._loadStates,t.key.id,()=>new m(t,this._options)),await this._queue.push(t)}catch(r){if(!f(r))throw r}}unload(t){const e=this._loadStates.get(t.tile.id);if(null!=e){for(const t of e.ids)this.store.removeById(t);e.destroy(),this._loadStates.delete(t.tile.id)}}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await l(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap()}_onOverride(){}async _updateFields(t){const e=new Set(t),r=o(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&r.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(r),this._options));await Promise.all(t)}}async _loadTile(t){const e=t.tile,r=t.signal,i=this._loadStates.get(e.id);await this._downloadTileData(t),s(r);const a=new c(this.metadata,null,e,null,0,!0);i.addSourceChunkId(a.chunkId),this.store.insert(a)}async _downloadTileData(t){const e=await d(),r=t.tile,i=t.signal,a=this._loadStates.get(r.id),o=await this._proxy.queryStream({type:"tile",extent:r.extent,transform:r.normalizedTransform,outFields:Array.from(this.availableFields),returnGeometry:!0,returnZ:this._schema.full.returnZ,returnM:this._schema.full.returnM,outSpatialReference:this.metadata.outSpatialReference.toJSON(),resolution:r.resolution,where:this.definitionExpression},{signal:i});let l=0;for(;;){const t=await this._proxy.getStreamNext(o,{signal:i});if(s(i),null==t)break;const{fileId:n,buffer:d}=t,h=e.ParquetChunk.deserialize(new Uint8Array(d)),u=new p(this.metadata,this._indexMap,h,n,r.transform),m=new c(this.metadata,u,r,n,l++,!1);a.addBinaryData({data:h,fileId:n}),a.addSourceChunkId(m.chunkId),this.store.insert(m)}}}function f(t){return n(t)||y(t)}function y(t){return null!=t&&"object"==typeof t&&"message"in t&&"Protocol Violation: transport error"===t.message}export{_ as ParquetTileLoadStrategy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as n}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as
|
|
2
|
+
import{__decorate as t}from"tslib";import{isSome as e}from"../../../../../core/arrayUtils.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as n}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as r}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{Manipulator3D as c}from"../../Manipulator3D.js";import{placeAtObject as h}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as m}from"../manipulatedObjectUtils.js";import{canMoveZOperations as u}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as v}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as _}from"../tooltipUtils3D.js";import{createVisualElements as g}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as f}from"../manipulations/config.js";import{MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as j}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as y}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as S}from"./ScaleRotateTransform.js";import{sceneSnappingAtProjectedLocation as M}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as R}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as w}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import O from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as T}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as A}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as x,enterInputModeIfAvailable as I}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as U}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as k}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let E=class extends R{constructor(t){super(t),this.events=new i,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new O,this.type="transform-3d",this._updatingHandles=new r,this._scaleRotate=null}initialize(){const{events:t,object:i,view:a}=this;this.tooltip=x(()=>({view:a,options:this.sketchOptions.tooltips})),this._moveManipulation=new b({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&u(i.operations,i.elevationInfo),radius:b.radiusForSymbol(i.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles(e.events.on("immediate-click",e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})));const s=i.elevationInfo;if(this._moveManipulation.elevationInfo=s,this.addHandles(v(i)),this._moveManipulation.createManipulatedObjectDragPipeline((t,e,o,n,l)=>{if(0===t){const{snappingStep:t,cancelSnapping:e}=A({snappingContext:new T({elevationInfo:s,pointer:l,editGeometryOperations:w.fromGeometry(new p({spatialReference:i.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new d,excludeFeature:i.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(e),o=o.next(M(this.view,s)).next(...t)}return{steps:o,cancel:n}},i,e=>{const{action:i,object:o,dxScreen:a,dyScreen:n}=e,s={object:o,dxScreen:a,dyScreen:n};switch(i){case"start":this._emitRecordUndo(),t.emit("translate-start",s);break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}}),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(n(()=>this._scaleRotateAdapter.angle,()=>this._updateMoveAngle())),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new S({tool:this,mode:t,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",()=>this._onScaleChanged()))}this.addHandles([g({view:this.view,object:i,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>o()}),i.on("committed",()=>this._onGeometryChanged()),this._hideManipulatorsForObjectState(),n(()=>a.scale,()=>this._updateMoveAngle())].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator(t=>{t instanceof c&&this.addHandles(t.events.on("grab-changed",()=>this._updateManipulatorsForGrabState()))});const l=a?.type,{sketchOptions:r}=this;this._meshTooltipInfo=new U({viewType:l,sketchOptions:r}),this._pointTooltipInfo=new k({viewType:l,sketchOptions:r});const h={object:i,dxScreen:0,dyScreen:0},m={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...h})},onMove:()=>t.emit("translate",{...h}),onMoveStop:()=>t.emit("translate-stop",{...h}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:i,angle:e})},onRotate:e=>t.emit("rotate",{object:i,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:i,angle:e}),onScaleStart:(e,o)=>{this._emitRecordUndo(),t.emit("scale-start",{object:i,xScale:e,yScale:o})},onScale:(e,o)=>t.emit("scale",{object:i,xScale:e,yScale:o}),onScaleStop:(e,o)=>t.emit("scale-stop",{object:i,xScale:e,yScale:o})};this.addHandles(_(this.tooltip,this.object,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:m,scaleRotateTransform:this._scaleRotate}))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!I(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsForGrabState(){if(null==this._scaleRotate)return;this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing;let t=null;this._moveManipulation.grabbing?t=this._scaleRotate.disableDisplay():this._scaleRotate.grabbing&&(t=this._moveManipulation.hideManipulators()),this.removeHandles(H),t&&this.addHandles(t,H)}_createScaleRotateAdapter(){const t=m(this.object);return"mesh"===t?.type?new j({object:this.object,viewingMode:this.view.state.viewingMode}):new y({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find(t=>t.layer===this.object.graphic?.layer),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return n(()=>this.object.visible,t=>{this._forEachManipulator(e=>e.available=t),this._moveManipulation.zManipulation.available=t&&this.enableZ&&u(this.object.operations,this.object.elevationInfo)})}_emitRecordUndo(){this.events.emit("record-undo",{updates:[this.object.createUndoRecord()]})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating}get activeTooltipInfo(){return"mesh"===m(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onActivate(){this.tooltip.hidden=!this.internallyEditable}onEditableChange(){this.internallyEditable||(this.tooltip.hidden=!0,this.tooltip.exitInputMode({focusOnView:!1}))}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=2===t.state.viewingMode||t.scale<f;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){h(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([s({constructOnly:!0,nonNullable:!0})],E.prototype,"view",void 0),t([s({constructOnly:!0,nonNullable:!0})],E.prototype,"object",void 0),t([s({constructOnly:!0,nonNullable:!0})],E.prototype,"enableZ",void 0),t([s()],E.prototype,"enableRotation",void 0),t([s()],E.prototype,"enableScaling",void 0),t([s({constructOnly:!0,type:O})],E.prototype,"sketchOptions",void 0),t([s({value:!1})],E.prototype,"snapToScene",null),t([s({constructOnly:!0})],E.prototype,"snappingManager",void 0),t([s({readOnly:!0})],E.prototype,"type",void 0),t([s({readOnly:!0})],E.prototype,"updating",null),t([s()],E.prototype,"activeTooltipInfo",null),E=t([l("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],E);const H=Symbol();export{E as TransformTool3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,removeMaybe as s,destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as n,initial as l}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as o,convertUnit as h}from"../../../core/units.js";import{property as d,subclass as u}from"../../../core/accessorSupport/decorators.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import m from"../../../geometry/HeightModelInfo.js";import{create as f}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as g}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as _,isWebMercator as y,equals as w,isGeographic as b}from"../../../geometry/support/spatialReferenceUtils.js";import v from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as S,makeCacheKey as C,getHeightModelInfoFromVCS as M}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as x}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as T}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as H}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as I}from"./LayerView3D.js";import{addLayerViewToWasm as A,getLyr3DWasm as P,removeLayerViewFromWasm as F}from"./Lyr3DWasm.js";import{LayerElevationProvider as V}from"./i3s/LayerElevationProvider.js";import{ElevationRange as R}from"../support/ElevationRange.js";import{projectToBoundingBox as j}from"../support/extentUtils.js";import{Obb as E}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as G,gaussiansPerPage as O,packedGaussianSizeInU32 as U,splatAtlasTextureWidth as D}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as z}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as B}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as k}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderer as q}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as W}from"../webgl-engine/lib/GaussianSplatShadows.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as $,isInEffectiveScaleRange as X}from"../../support/layerViewUtils.js";import{TaskPriority as Z}from"../../support/Scheduler.js";var K;const Y=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),J=3,Q=J*J,ee=255,te=(()=>{const e=new Int16Array(ee+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/ee));return e})();let ie=class extends(I(N)){static{K=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(G),this._tmpTilesWithChangedVisibility=new Array,this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(Z.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=f();return j(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw $("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);this._initializationController=new AbortController;const e=A(this,this._initializationController.signal).then(e=>{a(this._initializationController.signal),this._wasmLayerId=e,this._renderer=new q({view:this.view,layerView:this}),this.data=new z(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new W({view:this.view,layerView:this}),this.fadeHelper=new B(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new V({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),l)]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),l),this.addHandles([n(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},l)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians),this._initializationController=null});this.addHandles([n(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),n(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),n(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return P(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return x(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new R(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return X(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!S(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Y().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),h=2.048,d=o.tileOrigin.x*h,u=o.tileOrigin.y*h,m=o.tileOrigin.z*h,f=t.desc;if(null==f.obb)throw new Error("meshData.desc.obb undefined");const g=f.obb.quaternion,_=new E(f.obb.center,f.obb.halfSize,c(...g)),y=this.view.state.isGlobal,w=y?p(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:d,y:u,z:m},invPosScale:o.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:y,ellipsoidRadius:w};let v;this._renderablesBeingCreated.add(e.handle);try{v=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal)}catch(C){throw this._renderablesBeingCreated.delete(e.handle),C}return this._renderablesBeingCreated.delete(e.handle),()=>v}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,m=n.z,f=h.x,g=h.y,_=h.z,y=new Uint32Array(r),w=new Float32Array(3*r),b=new Uint32Array(r),v=new Uint32Array(r),S=new Array,C=Math.ceil(r/O);let M=1/0,x=-1/0,T=1/0,H=-1/0,I=0,A=-1,P=0,F=0;for(let R=0;R<r;R++){const e=R*U,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,y=n>>>24,S=te[y],C=(a>>>10&255)+S,V=(a>>>18&255)+S,j=(a>>>26&63|(3&n)<<6)+S,E=C>0?C:0,G=V>0?V:0,O=j>0?j:0,D=E|G<<8|O<<16,z=Math.max(E,G,O),B=o*l+c,L=h*l+p,k=u*l+m;if(w[I]=B-f,w[I+1]=L-g,w[I+2]=k-_,d){const e=B*B+L*L+k*k;T=Math.min(T,e),H=Math.max(H,e)}else M=Math.min(M,k),x=Math.max(x,k);b[R]=i,v[R]=D,z>A&&(A=z),y>P&&(P=y),I+=3,F++,F===K.createRenderableBatchSize&&(F=0,t.madeProgress()&&(t=yield))}F>0&&t.madeProgress(),d&&(M=Math.sqrt(T)-u,x=Math.sqrt(H)-u);const V=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:j}=this.layer;j?.hasZ&&j.zmax&&j.zmin&&(M=Math.max(M,j.zmin),x=Math.min(x,j.zmax));const E=new R(M,x);try{for(let e=0;e<C;e++){let t=this.data.textureAtlas.allocatePage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.allocatePage()),null===t)throw new Error("ran out of gaussian splat memory");S.push(t);const i=r-e*O,n=Math.min(i,O),l=e*O,o=t*O;for(let e=0;e<n;e++)y[l+e]=o+e;const h=e*G,d=n*U;this._pageBuffer.set(s.subarray(h,h+d));const u=o%D,c=Math.floor(o/D);this.data.textureAtlas.update(u,c,this._pageBuffer),this.data.headerTexture.update(t,a)}}catch(B){throw this.data.textureAtlas.freePages(S),B}const z=new k(i,o,y,S,w,b,v,r,V,P/ee,E);return this._tileHandles.set(i,z),this._cacheTileMemory+=z.usedMemory,this._memCache.put(`${z.handle}`,z),{memUsageBytes:z.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Q}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(const{obb:i}of e)if(!t(i))break})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,r=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,r);let a=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,r):this._prepareTileFadeOut(i,s);a||=l}a?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(r),l=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,l&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(r);this.fadeHelper.fadeTile(a,1,s),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(C(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(C(e.handle),e)}destroy(){this._initializationController=i(this._initializationController),this._createRenderableAbortController.abort(),F(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(const{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=r(this._shadows),this._renderer=r(this._renderer),this._memCache.destroy(),this.data=r(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(_(this.view.renderSpatialReference)||y(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&w(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=M(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!b(t)&&t.wkid&&-1!==t.wkid&&(i=o(v.units[v[t.wkid]])),i&&(e=new m({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===g(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=h(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=T(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,x(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){const t=Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians);this._wasm?.setMaximumGaussianSplatCount(t)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0!==e.lifecycleState||this._renderablesBeingCreated.has(e.handle)||this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,r=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new H(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a,n)}get test(){}};e([d()],ie.prototype,"layer",void 0),e([d({readOnly:!0})],ie.prototype,"_clippingBox",null),e([d()],ie.prototype,"elevationOffset",null),e([d({readOnly:!0})],ie.prototype,"visibleAtCurrentScale",null),e([d()],ie.prototype,"fullExtentInLocalViewSpatialReference",void 0),ie=K=e([u("esri.views.3d.layers.GaussianSplatLayerView3D")],ie);const se=ie;export{se as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,removeMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{watch as n,initial as l}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as o,convertUnit as h}from"../../../core/units.js";import{property as d,subclass as u}from"../../../core/accessorSupport/decorators.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import m from"../../../geometry/HeightModelInfo.js";import{create as f}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as g}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as _,isWebMercator as y,equals as w,isGeographic as b}from"../../../geometry/support/spatialReferenceUtils.js";import v from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as S,makeCacheKey as C,getHeightModelInfoFromVCS as x}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as M}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as T}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as H}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as I}from"./LayerView3D.js";import{addLayerViewToWasm as A,getLyr3DWasm as F,removeLayerViewFromWasm as P}from"./Lyr3DWasm.js";import{LayerElevationProvider as V}from"./i3s/LayerElevationProvider.js";import{ElevationRange as R}from"../support/ElevationRange.js";import{projectToBoundingBox as j}from"../support/extentUtils.js";import{Obb as E}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as G,gaussiansPerPage as O,packedGaussianSizeInU32 as U,splatAtlasTextureWidth as D}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as z}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as B}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as k}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderer as q}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as W}from"../webgl-engine/lib/GaussianSplatShadows.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as $,isInEffectiveScaleRange as X}from"../../support/layerViewUtils.js";import{TaskPriority as Z}from"../../support/Scheduler.js";var K;const Y=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),J=3,Q=J*J,ee=255,te=(()=>{const e=new Int16Array(ee+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/ee));return e})();let ie=class extends(I(N)){static{K=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(G),this._tmpTilesWithChangedVisibility=new Array,this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(Z.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=f();return j(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw $("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);this._initializationController=new AbortController;const e=A(this,this._initializationController.signal).then(e=>{r(this._initializationController.signal),this._wasmLayerId=e,this._renderer=new q({view:this.view,layerView:this}),this.data=new z(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new W({view:this.view,layerView:this}),this.fadeHelper=new B(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new V({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),n(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),l)]),this._suspendedHandle=n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),l),this.addHandles([n(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},l)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians),this._initializationController=null});this.addHandles([n(()=>this.view.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())}),n(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),n(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return F(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return M(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new R(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return X(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!S(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Y().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const a=i.atrbs[0].view,r=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==a.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,r/4);const o=this.extractHeader(l),h=2.048,d=o.tileOrigin.x*h,u=o.tileOrigin.y*h,m=o.tileOrigin.z*h,f=t.desc;if(null==f.obb)throw new Error("meshData.desc.obb undefined");const g=f.obb.quaternion,_=new E(f.obb.center,f.obb.halfSize,c(...g)),y=this.view.state.isGlobal,w=y?p(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:d,y:u,z:m},invPosScale:o.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:y,ellipsoidRadius:w};let v;this._renderablesBeingCreated.add(e.handle);try{v=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal)}catch(C){throw this._renderablesBeingCreated.delete(e.handle),C}return this._renderablesBeingCreated.delete(e.handle),()=>v}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:a,packedHeader:r,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,m=n.z,f=h.x,g=h.y,_=h.z,y=new Uint32Array(a),w=new Float32Array(3*a),b=new Uint32Array(a),v=new Uint32Array(a),S=new Array,C=Math.ceil(a/O);let x=1/0,M=-1/0,T=1/0,H=-1/0,I=0,A=-1,F=0,P=0;for(let R=0;R<a;R++){const e=R*U,i=s[e],a=s[e+1],r=s[e+2],n=s[e+3],o=16383&a,h=a>>>14&16383,u=a>>>28&15|(1023&r)<<4,y=n>>>24,S=te[y],C=(r>>>10&255)+S,V=(r>>>18&255)+S,j=(r>>>26&63|(3&n)<<6)+S,E=C>0?C:0,G=V>0?V:0,O=j>0?j:0,D=E|G<<8|O<<16,z=Math.max(E,G,O),B=o*l+c,L=h*l+p,k=u*l+m;if(w[I]=B-f,w[I+1]=L-g,w[I+2]=k-_,d){const e=B*B+L*L+k*k;T=Math.min(T,e),H=Math.max(H,e)}else x=Math.min(x,k),M=Math.max(M,k);b[R]=i,v[R]=D,z>A&&(A=z),y>F&&(F=y),I+=3,P++,P===K.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(x=Math.sqrt(T)-u,M=Math.sqrt(H)-u);const V=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:j}=this.layer;j?.hasZ&&j.zmax&&j.zmin&&(x=Math.max(x,j.zmin),M=Math.min(M,j.zmax));const E=new R(x,M);try{for(let e=0;e<C;e++){let t=this.data.textureAtlas.allocatePage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.allocatePage()),null===t)throw new Error("ran out of gaussian splat memory");S.push(t);const i=a-e*O,n=Math.min(i,O),l=e*O,o=t*O;for(let e=0;e<n;e++)y[l+e]=o+e;const h=e*G,d=n*U;this._pageBuffer.set(s.subarray(h,h+d));const u=o%D,c=Math.floor(o/D);this.data.textureAtlas.update(u,c,this._pageBuffer),this.data.headerTexture.update(t,r)}}catch(B){throw this.data.textureAtlas.freePages(S),B}const z=new k(i,o,y,S,w,b,v,a,V,F/ee,E);return this._tileHandles.set(i,z),this._cacheTileMemory+=z.usedMemory,this._memCache.put(`${z.handle}`,z),{memUsageBytes:z.usedMemory,numGaussians:a}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Q}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(const{obb:i}of e)if(!t(i))break})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,a=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,a);let r=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,a):this._prepareTileFadeOut(i,s);r||=l}r?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}this._triggerFadeIns(t,s,i);const a=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,a]of this._tileFadeInsAwaitingInitialSort){if(a>e||!t.has(s))continue;const r=this._tileHandles.get(s);if(!r){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(a),l=0===r.lifecycleState;2!==r.lifecycleState&&(r.lifecycleState=2,l&&this._popTileFromCache(r),i.push(r)),this.fadeHelper.fadeTile(r,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(a);this.fadeHelper.fadeTile(r,1,s),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(C(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(C(e.handle),e)}destroy(){this._initializationController=i(this._initializationController),this._createRenderableAbortController.abort(),P(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(const{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=a(this._shadows),this._renderer=a(this._renderer),this._memCache.destroy(),this.data=a(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(_(this.view.renderSpatialReference)||y(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&w(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=x(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!b(t)&&t.wkid&&-1!==t.wkid&&(i=o(v.units[v[t.wkid]])),i&&(e=new m({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===g(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=h(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=T(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,M(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){const t=Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians);this._wasm?.setMaximumGaussianSplatCount(t)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0!==e.lifecycleState||this._renderablesBeingCreated.has(e.handle)||this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,a=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new H(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,a,r,n)}get test(){}};e([d()],ie.prototype,"layer",void 0),e([d({readOnly:!0})],ie.prototype,"_clippingBox",null),e([d()],ie.prototype,"elevationOffset",null),e([d({readOnly:!0})],ie.prototype,"visibleAtCurrentScale",null),e([d()],ie.prototype,"fullExtentInLocalViewSpatialReference",void 0),ie=K=e([u("esri.views.3d.layers.GaussianSplatLayerView3D")],ie);const se=ie;export{se as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as o,createAbortError as n}from"../../../core/promiseUtils.js";import{initial as a,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as h}from"../../../core/scheduling.js";import{unitFromRESTJSON as d,convertUnit as u}from"../../../core/units.js";import{property as m,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as f,invert as b}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as y,IDENTITY as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as w,sub as C,dot as x,set as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as E,clone as R,ZEROS as M,fromValues as O}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as S,clone as V,ONES as U}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as H,isMars as D,getReferenceEllipsoid as P,SphericalECEFSpatialReferenceLike as I}from"../../../geometry/ellipsoidUtils.js";import k from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as A}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as F}from"../../../geometry/projection/projectVectorToVector.js";import{create as G}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as z}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as B,isWebMercator as N,equals as W,isGeographic as q,isCGCS2000 as X}from"../../../geometry/support/spatialReferenceUtils.js";import $ from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4f as Z,BufferViewVec4u8 as Y,BufferViewVec4u16 as J,BufferViewVec3f as K,BufferViewVec3u8 as Q,BufferViewVec3u16 as ee,BufferViewVec2f as te,BufferViewUint32 as ie,BufferViewUint16 as re}from"../../../geometry/support/buffer/BufferView.js";import se from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as oe,validateMeshData as ne,makeCacheKey as ae}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as le}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as ce}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as he}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as de}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as ue,removeLayerViewFromWasm as me,getLyr3DWasm as pe}from"./Lyr3DWasm.js";import{toWasmModification as fe}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ye}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ge,alphaModeConversion as _e,faceCullingConversion as ve,wrapModeConversion as we}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as Ce}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as xe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Te}from"../state/Frustum.js";import{ElevationRange as je}from"../support/ElevationRange.js";import{toBoundingRect as Ee}from"../support/extentUtils.js";import{Obb as Re}from"../support/orientedBoundingBox.js";import{glLayout as Me}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as Oe,SourceGeometry as Se}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ve}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ue}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as He}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as De}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Pe}from"../webgl-engine/materials/pbrUtils.js";import Ie from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ke,isInEffectiveScaleRange as Le,validateScaleRange as Ae}from"../../support/layerViewUtils.js";import{TaskPriority as Fe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ge}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as ze,SizedPixelFormat as Be}from"../../webgl/enums.js";import{alphaCutoff as Ne}from"../../../webscene/support/AlphaCutoff.js";var We;function qe(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return ze.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return ze.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Be.RG8;case 6407:return Be.RGB8;case 6408:return Be.RGBA8;case 6403:return Be.R8;default:return null}}let Xe=class extends(he(Ie)){static{We=ye}constructor(e){super(e),this[We]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.drapeTargetType=1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ge,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Fe.TILES3D,this),this._frustum=new Te(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{o(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new ce(Ce(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),a),!this._canProjectWithoutEngine())throw ke("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=ue(this,this._initializationController.signal).then(t=>{o(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new xe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),a),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),a),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a)]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),me(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=fe(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=G();this._layerClippingArea=Ee(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=h(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,le(e))}get _wasm(){return pe(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(n()):this._wasm?.queryElevation(this,e,t)??Promise.reject(n())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Le(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ae(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new de(this.usedMemory,s,o,Ye(t),Ye(e),Ye(r),Ye(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(B(this.view.renderSpatialReference)||N(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&W(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=oe(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!q(t)&&t.wkid&&-1!==t.wkid&&(i=d($.units[$[t.wkid]])),i&&(e=new k({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===z(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=u(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return le(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new je(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new je;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||X(i)||H(i)||D(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=P(i).radius,{eye:o,viewForward:n,near:a}=t.state.contentCamera,l=w(j(),n),c=500,h=Math.max(o[2],c),d=h+s,u=Math.sqrt(d**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=h>.5*s?.5*Math.PI*s:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;C(f,r,o);const s=x(f,l);Math.abs(s)<p&&s+i>a&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!ne(t))throw new Error("meshData not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage?.removeTexture(e)),o}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:n,elevationRange:a}=s;let l=0,c=0,h=0;for(const e of n){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),h+=e.intersectionGeometry.usedMemory}const d=Array.from(i.values()),u=new Ze(e.handle,n,d,h,c,l,o,e.stableNodeId,e.nodeDepth,a);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ae(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(o){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,r=e.desc.prims.length;try{const s=e.desc;for(let o=0;o<r;o++){const r=s.prims[o].materialId,n=s.materials&&null!=r?s.materials[r]:null;let a=Promise.resolve(Ke),l=null,c=null,h=null,d=null,u=null;if(n){const i="Pbr"===n.lightingModel;l=this._getTexture(n.baseColorTex,e,t),c=i?this._getTexture(n.metalTex,e,t):null,h=i?this._getTexture(n.emissiveTex,e,t):null,d=i?this._getTexture(n.occlusionTex,e,t):null,u=i?this._getTexture(n.normalTex,e,t):null;const r=[l,c,h,d,u].map(e=>e?.loadPromise??null);a=Promise.all(r)}i.push(new Qe(a,l,c,h,d,u))}}catch(s){throw i.forEach(e=>e.cleanup()),s}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=e.data.buffer,o=r.prims.length,n=E(...r.origin),a=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=g;if(l){const e=_();L(I,n,e,a),c=f(y(),e)}if(null==r.obb)throw new Error("meshData.desc.obb undefined");const h=Je(r.obb),d=l?P(this.view.spatialReference).radius:0,u=new Array;try{for(let i=0;i<o;i++){const e=r.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==ge[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:n,normalsData:a,colorView:l,texCoord0Data:c,indicesView:h}=this.getBufferViews(e,s);if(null==n||null==h){o.cleanup();continue}const d=n.count,m=(e,t)=>null==e||e===d||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);m(null!=c?c.length/2:void 0,"numTexcoord")&&m(l?.count,"numColors")&&m(a?.length,"normals")?u.push({componentIndex:i,positionView:n,indicesView:h,texCoord0Data:c,colorView:l,normalsData:a}):o.cleanup()}const e=c!==g,m=e?b(y(),c)??g:g,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:_}=await this._workerHandle.processTiles3DVertices(u,n,d,l,c,h,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&h.setHalfSize(f);for(const s of p){const{componentIndex:o,positionView:l,indicesView:c,layout:d,textureCoordinateType:u,interleavedVertexData:p,indices:f}=s,b=r.prims[o],y=t[o],g=h.clone(),_=Me(d),w=new Uint32Array([0,c.typedBuffer.length]),C=new Oe(_,this._imShading?2:0,u,e?2:0),x=new Se({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:f},{positions:l.typedBuffer,indices:c.typedBuffer},w,C),T=this.view.renderSpatialReference,E=j(),R=[1,1,1];A(n,T,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),F(n,T,E,a);const M=v&&null!=b.materialId?v[b.materialId]:null,O=this._createComponentMaterialInitParameters(M,y);O.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:S(E[0],E[1],R[0],R[1]),transform:new Ve(n,m),obb:g,geometry:x,elevationAlignable:!1},O);i.push(V)}const{fullExtent:w}=this.layer;return w?.hasZ&&w.zmax&&w.zmin&&(_.minElevation=Math.max(_.minElevation,w.zmin),_.maxElevation=Math.min(_.maxElevation,w.zmax)),{tileObb:h,componentObjects:i,elevationRange:_}}catch(m){throw i.forEach(e=>this._collection.destroyObject(e)),m}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let r=U,s=Ne,o=1,n=!1,a=2,l=O(0,0,0);const c=R(Pe),h=t.baseColorTexture,d=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(r=V(e.baseColorFactor),s=e.alphaCutoff??Ne,i&&(T(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=_e[e.alphaMode],n=e.isDoubleSided,a=ve[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:r,textureAlphaCutoff:s,mrrFactors:c,baseColorTexture:h,metallicRoughnessTexture:d,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:n,cullFace:a,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ae(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ae(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ae(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const s=i.get(r)??this._createTexture(e,t,i);return s?new Ue(this._stage.renderView.textures,s.id):null}_createTexture(e,t,i){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!r.mipCount||s>1,n=we[e.wrapMode??"None"];let a=r.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let c=null,h=null,d=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(c=l,a=6403,h=""):"Rg8"===r.pixelFormat||"Ga8"===r.pixelFormat?(c=l,a=33319,h=""):"Rgb8"===r.pixelFormat?(c=l,a=6407,h=""):"Rgba8"===r.pixelFormat&&(c=l,a=6408,h="");break;case"Dxt1":c=l,a=6407,h="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,h="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,h="image/ktx2";break;case"Png":h="image/png",d=document.createElement("img");break;case"Jpeg":h="image/jpeg",d=document.createElement("img");break;case"Etc2":h="image/ktx",d=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(d&&h){const e=new Blob([l],{type:h});d.src=URL.createObjectURL(e),c=d}if(c&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=qe(a,h,r.format),l=new He(c,{mipmap:o,maxAnisotropy:s,encoding:h,wrap:n,pixelFormat:a,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(l),i.set(r,l),l}return null}getBufferViews(e,t){let i,r,s,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,h=void 0,d=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new K(t,c.byteOffset,h,d);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new K(t,c.byteOffset,h,d);o=new Uint32Array(e.count),De(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===s&&(s=new te(t,c.byteOffset,h,d).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(r=new Z(t,c.byteOffset,h,d)),"U8"===c.type&&(r=new Y(t,c.byteOffset,h,d)),"U16"===c.type&&(r=new J(t,c.byteOffset,h,d))):3===c.ncomp&&("F32"===c.type&&(r=new K(t,c.byteOffset,h,d)),"U8"===c.type&&(r=new Q(t,c.byteOffset,h,d)),"U16"===c.type&&(r=new ee(t,c.byteOffset,h,d))),null==r&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new re(t,i.byteOffset,r,s);break;case"U32":n=new ie(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new re(new Uint16Array(e).buffer):new ie(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},a),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([m()],Xe.prototype,"fullOpacity",null),e([m({readOnly:!0})],Xe.prototype,"ready",null),e([m({type:[se]})],Xe.prototype,"_modifications",void 0),e([m()],Xe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([m()],Xe.prototype,"layer",void 0),e([m({readOnly:!0})],Xe.prototype,"visibleAtCurrentScale",null),e([m({readOnly:!0})],Xe.prototype,"_collection",null),e([m()],Xe.prototype,"elevationOffset",null),e([m({readOnly:!0})],Xe.prototype,"visibleElevationRange",null),e([m()],Xe.prototype,"fullExtentInLocalViewSpatialReference",void 0),Xe=e([p("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Xe);const $e=Xe;class Ze{constructor(e,t,i,r,s,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const h=j();n?.getCenter(h),this._obbCenterX=h[0],this._obbCenterY=h[1],this._obbCenterZ=h[2];const d=n?.radius??-1;this._obbRadius=d,this._obbRadiusSquared=d*d,this._obbShortestHalfsize=n?Math.min(n.halfSizeX,n.halfSizeY,n.halfSizeZ):0,this._mbsCenter=n?n.getCenter(j()):M}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,o=i-e[0],n=r-e[1],a=s-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,o=this._obbCenterX-i[0];if(o>s)return!1;const n=this._obbCenterY-i[1];if(n>s)return!1;const a=this._obbCenterZ-i[2];if(a>s)return!1;const l=o*o+n*n+a*a;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Ye(e){return Math.round(e/1048.576)/1e3}function Je(e){return new Re(e.center,e.halfSize,v(...e.quaternion))}const Ke=new Array;class Qe{constructor(e,t,i,r,s,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{$e as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as o,createAbortError as n}from"../../../core/promiseUtils.js";import{initial as a,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as h}from"../../../core/scheduling.js";import{unitFromRESTJSON as d,convertUnit as u}from"../../../core/units.js";import{property as m,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as f,invert as b}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as y,IDENTITY as g}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as w,sub as C,dot as x,set as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as j,freeze as E,clone as R,ZEROS as M,fromValues as O}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as S,clone as V,ONES as U}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as H,isMars as D,getReferenceEllipsoid as P,SphericalECEFSpatialReferenceLike as I}from"../../../geometry/ellipsoidUtils.js";import k from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as L}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as A}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as F}from"../../../geometry/projection/projectVectorToVector.js";import{create as G}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as z}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as B,isWebMercator as N,equals as W,isGeographic as q,isCGCS2000 as X}from"../../../geometry/support/spatialReferenceUtils.js";import $ from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4f as Z,BufferViewVec4u8 as Y,BufferViewVec4u16 as J,BufferViewVec3f as K,BufferViewVec3u8 as Q,BufferViewVec3u16 as ee,BufferViewVec2f as te,BufferViewUint32 as ie,BufferViewUint16 as re}from"../../../geometry/support/buffer/BufferView.js";import se from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as oe,validateMeshData as ne,makeCacheKey as ae}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as le}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as ce}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as he}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as de}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as ue,removeLayerViewFromWasm as me,getLyr3DWasm as pe}from"./Lyr3DWasm.js";import{toWasmModification as fe}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as ye}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ge,alphaModeConversion as _e,faceCullingConversion as ve,wrapModeConversion as we}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as Ce}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as xe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Te}from"../state/Frustum.js";import{ElevationRange as je}from"../support/ElevationRange.js";import{toBoundingRect as Ee}from"../support/extentUtils.js";import{Obb as Re}from"../support/orientedBoundingBox.js";import{glLayout as Me}from"../support/buffer/glUtil.js";import{ComponentGeometryParameters as Oe,SourceGeometry as Se}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Ve}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ue}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as He}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as De}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Pe}from"../webgl-engine/materials/pbrUtils.js";import Ie from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as ke,isInEffectiveScaleRange as Le,validateScaleRange as Ae}from"../../support/layerViewUtils.js";import{TaskPriority as Fe}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ge}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as ze,SizedPixelFormat as Be}from"../../webgl/enums.js";import{alphaCutoff as Ne}from"../../../webscene/support/AlphaCutoff.js";var We;function qe(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return ze.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return ze.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx2"===t)return null;switch(e){case 33319:return Be.RG8;case 6407:return Be.RGB8;case 6408:return Be.RGBA8;case 6403:return Be.R8;default:return null}}let Xe=class extends(he(Ie)){static{We=ye}constructor(e){super(e),this[We]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ge,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Fe.TILES3D,this),this._frustum=new Te(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{o(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new ce(Ce(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),a),!this._canProjectWithoutEngine())throw ke("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=ue(this,this._initializationController.signal).then(t=>{o(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new xe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),a),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),a),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a)]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),me(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=fe(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=G();this._layerClippingArea=Ee(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=h(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,le(e))}get _wasm(){return pe(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(n()):this._wasm?.queryElevation(this,e,t)??Promise.reject(n())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Le(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Ae(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,s++):(i+=n.textureMemoryUsage,r+=n.vboMemoryUsage,o++)}),new de(this.usedMemory,s,o,Ye(t),Ye(e),Ye(r),Ye(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(B(this.view.renderSpatialReference)||N(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&W(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=oe(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!q(t)&&t.wkid&&-1!==t.wkid&&(i=d($.units[$[t.wkid]])),i&&(e=new k({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===z(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=u(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return le(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new je(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new je;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||X(i)||H(i)||D(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=P(i).radius,{eye:o,viewForward:n,near:a}=t.state.contentCamera,l=w(j(),n),c=500,h=Math.max(o[2],c),d=h+s,u=Math.sqrt(d**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=h>.5*s?.5*Math.PI*s:m,f=j();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;C(f,r,o);const s=x(f,l);Math.abs(s)<p&&s+i>a&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!ne(t))throw new Error("meshData not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(o){throw i.forEach(e=>this._stage?.removeTexture(e)),o}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:o,componentObjects:n,elevationRange:a}=s;let l=0,c=0,h=0;for(const e of n){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:o}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(o?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),h+=e.intersectionGeometry.usedMemory}const d=Array.from(i.values()),u=new Ze(e.handle,n,d,h,c,l,o,e.stableNodeId,e.nodeDepth,a);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ae(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(o){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),o}}_createPrimitiveTextureBundles(e,t){const i=new Array,r=e.desc.prims.length;try{const s=e.desc;for(let o=0;o<r;o++){const r=s.prims[o].materialId,n=s.materials&&null!=r?s.materials[r]:null;let a=Promise.resolve(Ke),l=null,c=null,h=null,d=null,u=null;if(n){const i="Pbr"===n.lightingModel;l=this._getTexture(n.baseColorTex,e,t),c=i?this._getTexture(n.metalTex,e,t):null,h=i?this._getTexture(n.emissiveTex,e,t):null,d=i?this._getTexture(n.occlusionTex,e,t):null,u=i?this._getTexture(n.normalTex,e,t):null;const r=[l,c,h,d,u].map(e=>e?.loadPromise??null);a=Promise.all(r)}i.push(new Qe(a,l,c,h,d,u))}}catch(s){throw i.forEach(e=>e.cleanup()),s}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=e.data.buffer,o=r.prims.length,n=E(...r.origin),a=this.view.basemapTerrain.spatialReference,l=this.view.state.isGlobal;let c=g;if(l){const e=_();L(I,n,e,a),c=f(y(),e)}if(null==r.obb)throw new Error("meshData.desc.obb undefined");const h=Je(r.obb),d=l?P(this.view.spatialReference).radius:0,u=new Array;try{for(let i=0;i<o;i++){const e=r.prims[i],o=t[i];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(e));if(null==ge[e.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive."),o.cleanup();continue}const{positionView:n,normalsData:a,colorView:l,texCoord0Data:c,indicesView:h}=this.getBufferViews(e,s);if(null==n||null==h){o.cleanup();continue}const d=n.count,m=(e,t)=>null==e||e===d||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);m(null!=c?c.length/2:void 0,"numTexcoord")&&m(l?.count,"numColors")&&m(a?.length,"normals")?u.push({componentIndex:i,positionView:n,indicesView:h,texCoord0Data:c,colorView:l,normalsData:a}):o.cleanup()}const e=c!==g,m=e?b(y(),c)??g:g,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:_}=await this._workerHandle.processTiles3DVertices(u,n,d,l,c,h,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const v=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&h.setHalfSize(f);for(const s of p){const{componentIndex:o,positionView:l,indicesView:c,layout:d,textureCoordinateType:u,interleavedVertexData:p,indices:f}=s,b=r.prims[o],y=t[o],g=h.clone(),_=Me(d),w=new Uint32Array([0,c.typedBuffer.length]),C=new Oe(_,this._imShading?2:0,u,e?2:0),x=new Se({interleavedVertexData:p,vertexCount:p.byteLength/_[0].stride,indexData:f},{positions:l.typedBuffer,indices:c.typedBuffer},w,C),T=this.view.renderSpatialReference,E=j(),R=[1,1,1];A(n,T,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),F(n,T,E,a);const M=v&&null!=b.materialId?v[b.materialId]:null,O=this._createComponentMaterialInitParameters(M,y);O.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:S(E[0],E[1],R[0],R[1]),transform:new Ve(n,m),obb:g,geometry:x,elevationAlignable:!1},O);i.push(V)}const{fullExtent:w}=this.layer;return w?.hasZ&&w.zmax&&w.zmin&&(_.minElevation=Math.max(_.minElevation,w.zmin),_.maxElevation=Math.min(_.maxElevation,w.zmax)),{tileObb:h,componentObjects:i,elevationRange:_}}catch(m){throw i.forEach(e=>this._collection.destroyObject(e)),m}}_createComponentMaterialInitParameters(e,t){const i="Pbr"===(null!=e?e.lightingModel:"Unlit");let r=U,s=Ne,o=1,n=!1,a=2,l=O(0,0,0);const c=R(Pe),h=t.baseColorTexture,d=t.metallicRoughnessTexture,u=t.emissionTexture,m=t.occlusionTexture,p=t.normalTexture;return e&&(r=V(e.baseColorFactor),s=e.alphaCutoff??Ne,i&&(T(c,e.metallicFactor,e.roughnessFactor,0),e.emissiveFactor&&(l=e.emissiveFactor)),o=_e[e.alphaMode],n=e.isDoubleSided,a=ve[e.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:r,textureAlphaCutoff:s,mrrFactors:c,baseColorTexture:h,metallicRoughnessTexture:d,normalTexture:p,occlusionTexture:m,emissionTexture:u,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:o,doubleSided:n,cullFace:a,isGround:this.layer.replacesTerrain,emissiveBaseColor:l,usePBR:i,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ae(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ae(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ae(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const s=i.get(r)??this._createTexture(e,t,i);return s?new Ue(this._stage.renderView.textures,s.id):null}_createTexture(e,t,i){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,o=!!r.mipCount||s>1,n=we[e.wrapMode??"None"];let a=r.alpha?6408:6407;const l=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let c=null,h=null,d=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(c=l,a=6403,h=""):"Rg8"===r.pixelFormat||"Ga8"===r.pixelFormat?(c=l,a=33319,h=""):"Rgb8"===r.pixelFormat?(c=l,a=6407,h=""):"Rgba8"===r.pixelFormat&&(c=l,a=6408,h="");break;case"Dxt1":c=l,a=6407,h="image/vnd-ms.dds";break;case"Dxt5":c=l,a=6408,h="image/vnd-ms.dds";break;case"Basis":c=l,a=6407,h="image/ktx2";break;case"Png":h="image/png",d=document.createElement("img");break;case"Jpeg":h="image/jpeg",d=document.createElement("img");break;case"Etc2":h="image/ktx",d=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(d&&h){const e=new Blob([l],{type:h});d.src=URL.createObjectURL(e),c=d}if(c&&null!=h){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,t=qe(a,h,r.format),l=new He(c,{mipmap:o,maxAnisotropy:s,encoding:h,wrap:n,pixelFormat:a,internalFormat:t??void 0,immutable:null!=t,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(l),i.set(r,l),l}return null}getBufferViews(e,t){let i,r,s,o,n;for(let l=0;l<e.atrbs.length;l++){const n=e.atrbs[l],{view:c}=n,h=void 0,d=c.byteOffset+c.byteCount;try{switch(n.sem){case"Position":3!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+c+")"):i=new K(t,c.byteOffset,h,d);break;case"Normal":if(3!==c.ncomp||"F32"!==c.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+c+")");else{const e=new K(t,c.byteOffset,h,d);o=new Uint32Array(e.count),De(e.typedBuffer,new Int16Array(o.buffer,o.byteOffset,2*o.length))}break;case"TexCoord":2!==c.ncomp||"F32"!==c.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+c+")"):void 0===s&&(s=new te(t,c.byteOffset,h,d).typedBuffer);break;case"Color":4===c.ncomp?("F32"===c.type&&(r=new Z(t,c.byteOffset,h,d)),"U8"===c.type&&(r=new Y(t,c.byteOffset,h,d)),"U16"===c.type&&(r=new J(t,c.byteOffset,h,d))):3===c.ncomp&&("F32"===c.type&&(r=new K(t,c.byteOffset,h,d)),"U8"===c.type&&(r=new Q(t,c.byteOffset,h,d)),"U16"===c.type&&(r=new ee(t,c.byteOffset,h,d))),null==r&&this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+c+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+n.sem+"). Skipping vertex attribute.")}}catch(a){this._dbg(2,"Error Creating buffer ("+a+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,r=void 0,s=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":n=new re(t,i.byteOffset,r,s);break;case"U32":n=new ie(t,i.byteOffset,r,s);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==n&&null!=i){const e=i.count;n=n=e<65535?new re(new Uint16Array(e).buffer):new ie(new Uint32Array(e).buffer);for(let t=0;t<e;t++)n.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:n,normalsData:o}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},a),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([m()],Xe.prototype,"fullOpacity",null),e([m({readOnly:!0})],Xe.prototype,"ready",null),e([m({type:[se]})],Xe.prototype,"_modifications",void 0),e([m()],Xe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([m()],Xe.prototype,"layer",void 0),e([m({readOnly:!0})],Xe.prototype,"visibleAtCurrentScale",null),e([m({readOnly:!0})],Xe.prototype,"_collection",null),e([m()],Xe.prototype,"elevationOffset",null),e([m({readOnly:!0})],Xe.prototype,"visibleElevationRange",null),e([m()],Xe.prototype,"fullExtentInLocalViewSpatialReference",void 0),Xe=e([p("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Xe);const $e=Xe;class Ze{constructor(e,t,i,r,s,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const h=j();n?.getCenter(h),this._obbCenterX=h[0],this._obbCenterY=h[1],this._obbCenterZ=h[2];const d=n?.radius??-1;this._obbRadius=d,this._obbRadiusSquared=d*d,this._obbShortestHalfsize=n?Math.min(n.halfSizeX,n.halfSizeY,n.halfSizeZ):0,this._mbsCenter=n?n.getCenter(j()):M}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,o=i-e[0],n=r-e[1],a=s-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,o=this._obbCenterX-i[0];if(o>s)return!1;const n=this._obbCenterY-i[1];if(n>s)return!1;const a=this._obbCenterZ-i[2];if(a>s)return!1;const l=o*o+n*n+a*a;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Ye(e){return Math.round(e/1048.576)/1e3}function Je(e){return new Re(e.center,e.halfSize,v(...e.quaternion))}const Ke=new Array;class Qe{constructor(e,t,i,r,s,o){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=o}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{$e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{property as e,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{property as e,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as a,rotate as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as c,copy as l,subtract as _,length as v,normalize as P,add as f,scale as w,dot as u,cross as C,transformMat4 as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyAll as x}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{getVoxelWasm as b}from"../../layers/VoxelWasm.js";import{TiltRange as j}from"../Constraints.js";import{InteractiveController as R}from"./InteractiveController.js";import{excludeTerrain as M,normalizeCoordinate as U,getTiltScaleFactor as V,maxRotatePivotDistanceModifier as D,minRotatePivotDistance as O,inferNavigationMode as T,rotatePivotSearchAreaSize as A}from"../utils/navigationUtils.js";let H=class extends R{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(t){super(t),this.pivot=0,this._rotScale=0,this._lastPoint=m(),this._tmpWorldUp=g(),this._tmpViewDir=g(),this._tmpRotCurPoint=m(),this._tmpTransf=h(),this._tmpAxis=g(),this._tmpPivotPoint=g(),this._pivotPos=g(),this._constraintOptions=new y(15,2,0,this.startCamera)}initialize(){this._rotScale=0===this.pivot?3:1.5}begin(t){if(this.running){switch(this.pivot){case 1:l(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=3,this._constraintOptions.tiltMode=1,this._constraintOptions.selection=0;break;case 0:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,this.view.basemapTerrain.invisible?M:{})&&!c(this.startCamera.eye,this._pivotPos);i||l(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=2,this._constraintOptions.tiltMode=0,this._constraintOptions.selection=11;break}}U(this.startCamera,t,this._lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,e=g();_(e,this._pivotPos,s.eye);const o=v(e),a=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(s.eye,F);let n=Math.max(V(F,s.viewForward,D)*a,O);i&&(n=Math.min(o,n));const h=r(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),p=T(this.startCamera,h,this.view.renderCoordsHelper,this.view.viewingMode);let m=this.view.stage.renderView.getMinimalDepthForArea(b(this.view),s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*A,A),c=this.view.stage.renderView.getMinimalDepthForArea(b(this.view),t[0],t[1],s,A);null==m&&null==c||(m=m??c??0,c=null==c||1===p?m:c,n=m>c?c:m,n=i?Math.min(n,o):n),P(e,e),l(this._pivotPos,f(this._tmpPivotPoint,s.eye,w(this._tmpPivotPoint,e,n)))}update(t){if(this.running){switch(this.pivot){case 1:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this._pivotPos);break;case 0:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this._pivotPos)}x(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.running&&this.finishController()}_applyRotation(t,r,e,o){this.view.renderCoordsHelper.worldUpAtPosition(o,this._tmpWorldUp),U(t,r,this._tmpRotCurPoint);let h=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,m=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;_(this._tmpViewDir,e,o);const c=v(this._tmpViewDir),l=i(u(this._tmpViewDir,this._tmpWorldUp)/c);if(1===this.pivot){h*=-.5;const t=.5*Math.PI-l,i=.5*Math.PI*.99;h=t-Math.max(-i,Math.min(i,t+h))}return h=s(h+l,j.min,j.max)-l,C(this._tmpAxis,t.up,this._tmpViewDir),0===this.pivot&&(m=-m),a(this._tmpTransf,m,this._tmpWorldUp),n(this._tmpTransf,this._tmpTransf,h,this._tmpAxis),d(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),t.up=d(W,t.up,this._tmpTransf),f(W,o,this._tmpViewDir),p(this._lastPoint,this._tmpRotCurPoint),W}};t([e()],H.prototype,"pivot",void 0),H=t([o("esri.views.3d.state.controllers.RotateController")],H);const W=g(),F=g();export{H as RotateController};
|