@loaders.gl/i3s 3.4.0-alpha.1 → 3.4.0-alpha.3
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/dist/dist.min.js +421 -210
- package/dist/es5/arcgis-webscene-loader.js +7 -11
- package/dist/es5/arcgis-webscene-loader.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +51 -63
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-building-scene-layer-loader.js +13 -16
- package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +19 -22
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +86 -94
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +14 -18
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +109 -124
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +4 -5
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js +99 -107
- package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +14 -21
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +13 -17
- package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +166 -187
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +31 -35
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/customizeColors.js +102 -107
- package/dist/es5/lib/utils/customizeColors.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +0 -2
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/es5/types.js +8 -8
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -1
- package/dist/es5/workers/i3s-content-worker.js.map +1 -1
- package/dist/esm/arcgis-webscene-loader.js +1 -4
- package/dist/esm/arcgis-webscene-loader.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +2 -14
- package/dist/esm/i3s-attribute-loader.js.map +1 -1
- package/dist/esm/i3s-building-scene-layer-loader.js +1 -2
- package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
- package/dist/esm/i3s-content-loader.js +1 -2
- package/dist/esm/i3s-content-loader.js.map +1 -1
- package/dist/esm/i3s-loader.js +1 -3
- package/dist/esm/i3s-loader.js.map +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -3
- package/dist/esm/i3s-node-page-loader.js.map +1 -1
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +0 -8
- package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/esm/lib/parsers/constants.js +3 -4
- package/dist/esm/lib/parsers/constants.js.map +1 -1
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js +0 -4
- package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-attribute.js +0 -7
- package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +0 -3
- package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js +0 -20
- package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/esm/lib/parsers/parse-i3s.js +2 -8
- package/dist/esm/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/esm/lib/utils/customizeColors.js +0 -4
- package/dist/esm/lib/utils/customizeColors.js.map +1 -1
- package/dist/esm/lib/utils/url-utils.js +0 -3
- package/dist/esm/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/types.js +6 -6
- package/dist/esm/types.js.map +1 -1
- package/dist/i3s-content-nodejs-worker.js +59 -62
- package/dist/i3s-content-nodejs-worker.js.map +3 -3
- package/dist/i3s-content-worker.js +328 -146
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.js +5 -1
- package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s-tile-content.js +2 -0
- package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
- package/dist/lib/parsers/parse-i3s.js +2 -0
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/lib/helpers/i3s-nodepages-tiles.ts +3 -0
- package/src/lib/parsers/parse-i3s-tile-content.ts +2 -0
- package/src/lib/parsers/parse-i3s.ts +2 -0
- package/src/types.ts +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s-tile-content.js","names":["scratchVector","Vector3","getLoaderForTextureFormat","textureFormat","CompressedTextureLoader","BasisLoader","ImageLoader","I3S_ATTRIBUTE_TYPE","parseI3STileContent","arrayBuffer","tileOptions","tilesetOptions","options","context","content","attributes","indices","featureIds","vertexCount","modelMatrix","Matrix4","coordinateSystem","byteLength","texture","textureUrl","url","getUrlWithToken","i3s","token","loader","fetch","response","decodeTextures","textureLoaderOptions","image","type","parse","load","compressed","mipmaps","width","height","data","material","makePbrMaterial","materialDefinition","parseI3SNodeGeometry","contentByteLength","byteOffset","featureCount","isDracoGeometry","DracoLoader","draco","attributeNameEntry","decompressedGeometry","header","value","POSITION","NORMAL","COLOR_0","TEXCOORD_0","featureIndex","uvRegion","position","normal","color","uv0","id","updateAttributesMetadata","getFeatureIdsFromFeatureIndexMetadata","flattenFeatureIdsByFeatureIndices","store","defaultGeometrySchema","vertexAttributes","attributesOrder","ordering","featureAttributes","featureAttributeOrder","headers","parseHeaders","normalizeAttributes","normalizedVertexAttributes","offset","normalizedFeatureAttributes","flattenFeatureIdsByFaceRanges","concatAttributes","COORDINATE_SYSTEM","METER_OFFSETS","enuMatrix","parsePositions","invert","getModelMatrix","LNGLAT_OFFSETS","customizeColors","positions","normals","colors","normalizeAttribute","texCoords","uvRegions","region","attributeIndex","key","loaderData","dracoAttribute","name","metadata","attribute","normalized","property","TypedArrayTypeHeader","getConstructorForDataFormat","HeaderAttributeProperty","sizeOf","attributeCount","valueType","valuesPerElement","buffer","slice","parseUint64Values","TypedArrayType","GL_TYPE_MAP","size","elementsCount","attributeSize","values","dataView","DataView","index","left","getUint32","right","push","Uint32Array","mbs","cartographicOrigin","cartesianOrigin","Ellipsoid","WGS84","cartographicToCartesian","eastNorthUpToFixedFrame","offsetsToCartesians","vertices","Float64Array","length","scaleX","double","scaleY","i","x","y","z","subarray","pbrMaterial","pbrMetallicRoughness","baseColorFactor","baseColorTexture","texCoord","alphaCutoff","alphaMode","toUpperCase","emissiveFactor","convertColorFormat","setMaterialTexture","colorFactor","normalizedColor","source","emissiveTexture","metallicRoughnessTexture","normalTexture","occlusionTexture","faceRange","range","featureIdsLength","orderedFeatureIndices","startIndex","fillId","Number","endValue","prevValue","trianglesCount","endIndex","fill","featureIndices","result","Float32Array","intArray"],"sources":["../../../../src/lib/parsers/parse-i3s-tile-content.ts"],"sourcesContent":["import type {TypedArray} from '@loaders.gl/schema';\nimport {load, parse} from '@loaders.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {DracoLoader, DracoMesh} from '@loaders.gl/draco';\nimport {BasisLoader, CompressedTextureLoader} from '@loaders.gl/textures';\n\nimport {\n FeatureAttribute,\n VertexAttribute,\n I3SMeshAttributes,\n I3SMeshAttribute,\n TileContentTexture,\n HeaderAttributeProperty,\n I3SMaterialDefinition,\n I3STileContent,\n I3STileOptions,\n I3STilesetOptions\n} from '../../types';\nimport {getUrlWithToken} from '../utils/url-utils';\n\nimport {GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {customizeColors} from '../utils/customizeColors';\n\nconst scratchVector = new Vector3([0, 0, 0]);\n\nfunction getLoaderForTextureFormat(textureFormat?: 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2') {\n switch (textureFormat) {\n case 'ktx-etc2':\n case 'dds':\n return CompressedTextureLoader;\n case 'ktx2':\n return BasisLoader;\n case 'jpg':\n case 'png':\n default:\n return ImageLoader;\n }\n}\n\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\n\nexport async function parseI3STileContent(\n arrayBuffer: ArrayBuffer,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<I3STileContent> {\n const content: I3STileContent = {\n attributes: {},\n indices: null,\n featureIds: [],\n vertexCount: 0,\n modelMatrix: new Matrix4(),\n coordinateSystem: 0,\n byteLength: 0,\n texture: null\n };\n\n if (tileOptions.textureUrl) {\n const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n const response = await fetch(url, options?.fetch as RequestInit);\n const arrayBuffer = await response.arrayBuffer();\n\n if (options?.i3s.decodeTextures) {\n if (loader === ImageLoader) {\n const options = {...tileOptions.textureLoaderOptions, image: {type: 'data'}};\n try {\n // @ts-ignore context must be defined\n // Image constructor is not supported in worker thread.\n // Do parsing image data on the main thread by using context to avoid worker issues.\n content.texture = await context.parse(arrayBuffer, options);\n } catch (e) {\n // context object is different between worker and node.js conversion script.\n // To prevent error we parse data in ordinary way if it is not parsed by using context.\n content.texture = await parse(arrayBuffer, loader, options);\n }\n } else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n let texture = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n if (loader === BasisLoader) {\n texture = texture[0];\n }\n content.texture = {\n compressed: true,\n mipmaps: false,\n width: texture[0].width,\n height: texture[0].height,\n data: texture\n };\n }\n } else {\n content.texture = arrayBuffer;\n }\n }\n\n content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n if (content.material) {\n content.texture = null;\n }\n\n return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(\n arrayBuffer: ArrayBuffer,\n content: I3STileContent,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<I3STileContent> {\n const contentByteLength = arrayBuffer.byteLength;\n let attributes: I3SMeshAttributes;\n let vertexCount: number;\n let byteOffset: number = 0;\n let featureCount: number = 0;\n let indices: TypedArray | undefined;\n\n if (tileOptions.isDracoGeometry) {\n const decompressedGeometry: DracoMesh = await parse(arrayBuffer, DracoLoader, {\n draco: {\n attributeNameEntry: I3S_ATTRIBUTE_TYPE\n }\n });\n // @ts-expect-error\n vertexCount = decompressedGeometry.header.vertexCount;\n indices = decompressedGeometry.indices?.value;\n const {\n POSITION,\n NORMAL,\n COLOR_0,\n TEXCOORD_0,\n ['feature-index']: featureIndex,\n ['uv-region']: uvRegion\n } = decompressedGeometry.attributes;\n\n attributes = {\n position: POSITION,\n normal: NORMAL,\n color: COLOR_0,\n uv0: TEXCOORD_0,\n uvRegion,\n id: featureIndex\n };\n\n updateAttributesMetadata(attributes, decompressedGeometry);\n\n const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n\n if (featureIds) {\n flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n }\n } else {\n const {\n vertexAttributes,\n ordering: attributesOrder,\n featureAttributes,\n featureAttributeOrder\n } = tilesetOptions.store.defaultGeometrySchema;\n // First 8 bytes reserved for header (vertexCount and featureCount)\n const headers = parseHeaders(arrayBuffer, tilesetOptions);\n byteOffset = headers.byteOffset;\n vertexCount = headers.vertexCount;\n featureCount = headers.featureCount;\n // Getting vertex attributes such as positions, normals, colors, etc...\n const {attributes: normalizedVertexAttributes, byteOffset: offset} = normalizeAttributes(\n arrayBuffer,\n byteOffset,\n vertexAttributes,\n vertexCount,\n attributesOrder\n );\n\n // Getting feature attributes such as featureIds and faceRange\n const {attributes: normalizedFeatureAttributes} = normalizeAttributes(\n arrayBuffer,\n offset,\n featureAttributes,\n featureCount,\n featureAttributeOrder\n );\n\n flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n }\n\n if (\n !options?.i3s?.coordinateSystem ||\n options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS\n ) {\n const enuMatrix = parsePositions(attributes.position, tileOptions);\n content.modelMatrix = enuMatrix.invert();\n content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n } else {\n content.modelMatrix = getModelMatrix(attributes.position);\n content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n }\n\n attributes.color = await customizeColors(\n attributes.color,\n attributes.id,\n tileOptions,\n tilesetOptions,\n options\n );\n\n content.attributes = {\n positions: attributes.position,\n normals: attributes.normal,\n colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n texCoords: attributes.uv0,\n uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n };\n content.indices = indices || null;\n\n if (attributes.id && attributes.id.value) {\n content.featureIds = attributes.id.value;\n }\n\n // Remove undefined attributes\n for (const attributeIndex in content.attributes) {\n if (!content.attributes[attributeIndex]) {\n delete content.attributes[attributeIndex];\n }\n }\n\n content.vertexCount = vertexCount;\n content.byteLength = contentByteLength;\n\n return content;\n}\n\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(\n attributes: I3SMeshAttributes,\n decompressedGeometry: DracoMesh\n): void {\n for (const key in decompressedGeometry.loaderData.attributes) {\n const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n\n switch (dracoAttribute.name) {\n case 'POSITION':\n attributes.position.metadata = dracoAttribute.metadata;\n break;\n case 'feature-index':\n attributes.id.metadata = dracoAttribute.metadata;\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(\n normalizedVertexAttributes: I3SMeshAttributes,\n normalizedFeatureAttributes: I3SMeshAttributes\n): I3SMeshAttributes {\n return {...normalizedVertexAttributes, ...normalizedFeatureAttributes};\n}\n\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute: I3SMeshAttribute): I3SMeshAttribute {\n if (!attribute) {\n return attribute;\n }\n attribute.normalized = true;\n return attribute;\n}\n\nfunction parseHeaders(arrayBuffer: ArrayBuffer, options: I3STilesetOptions) {\n let byteOffset = 0;\n // First 8 bytes reserved for header (vertexCount and featurecount)\n let vertexCount = 0;\n let featureCount = 0;\n for (const {property, type} of options.store.defaultGeometrySchema.header) {\n const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n switch (property) {\n case HeaderAttributeProperty.vertexCount:\n vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n byteOffset += sizeOf(type);\n break;\n case HeaderAttributeProperty.featureCount:\n featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n byteOffset += sizeOf(type);\n break;\n default:\n break;\n }\n }\n\n return {\n vertexCount,\n featureCount,\n byteOffset\n };\n}\n\n/* eslint-enable max-statements */\n\nfunction normalizeAttributes(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n vertexAttributes: VertexAttribute | FeatureAttribute,\n attributeCount: number,\n attributesOrder: string[]\n) {\n const attributes: I3SMeshAttributes = {};\n\n // the order of attributes depend on the order being added to the vertexAttributes object\n for (const attribute of attributesOrder) {\n if (vertexAttributes[attribute]) {\n const {valueType, valuesPerElement}: {valueType: string; valuesPerElement: number} =\n vertexAttributes[attribute];\n // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n // Code below does not account when the bytelength is actually bigger than\n // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n // In those cases tiles without regions could fail or have garbage values.\n if (\n byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n arrayBuffer.byteLength\n ) {\n const buffer = arrayBuffer.slice(byteOffset);\n let value: TypedArray;\n\n if (valueType === 'UInt64') {\n value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n } else {\n const TypedArrayType = getConstructorForDataFormat(valueType);\n value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n }\n\n attributes[attribute] = {\n value,\n type: GL_TYPE_MAP[valueType],\n size: valuesPerElement\n };\n\n switch (attribute) {\n case 'color':\n attributes.color.normalized = true;\n break;\n case 'position':\n case 'region':\n case 'normal':\n default:\n }\n\n byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n } else if (attribute !== 'uv0') {\n break;\n }\n }\n }\n\n return {attributes, byteOffset};\n}\n\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(\n buffer: ArrayBuffer,\n elementsCount: number,\n attributeSize: number\n): Uint32Array {\n const values: number[] = [];\n const dataView = new DataView(buffer);\n let offset = 0;\n\n for (let index = 0; index < elementsCount; index++) {\n // split 64-bit number into two 32-bit parts\n const left = dataView.getUint32(offset, true);\n const right = dataView.getUint32(offset + 4, true);\n // combine the two 32-bit values\n const value = left + 2 ** 32 * right;\n\n values.push(value);\n offset += attributeSize;\n }\n\n return new Uint32Array(values);\n}\n\nfunction parsePositions(attribute: I3SMeshAttribute, options: I3STileOptions): Matrix4 {\n const mbs = options.mbs;\n const value = attribute.value;\n const metadata = attribute.metadata;\n const enuMatrix = new Matrix4();\n const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n const cartesianOrigin = new Vector3();\n Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n\n return enuMatrix;\n}\n\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(\n vertices: number[] | TypedArray,\n metadata: any = {},\n cartographicOrigin: Vector3\n): Float64Array {\n const positions = new Float64Array(vertices.length);\n const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n for (let i = 0; i < positions.length; i += 3) {\n positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n }\n\n for (let i = 0; i < positions.length; i += 3) {\n // @ts-ignore\n Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n positions[i] = scratchVector.x;\n positions[i + 1] = scratchVector.y;\n positions[i + 2] = scratchVector.z;\n }\n\n return positions;\n}\n\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions: I3SMeshAttribute): Matrix4 {\n const metadata = positions.metadata;\n const scaleX: number = metadata?.['i3s-scale_x']?.double || 1;\n const scaleY: number = metadata?.['i3s-scale_y']?.double || 1;\n const modelMatrix = new Matrix4();\n modelMatrix[0] = scaleX;\n modelMatrix[5] = scaleY;\n return modelMatrix;\n}\n\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition?: I3SMaterialDefinition, texture?: TileContentTexture) {\n let pbrMaterial;\n if (materialDefinition) {\n pbrMaterial = {\n ...materialDefinition,\n pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n ? {...materialDefinition.pbrMetallicRoughness}\n : {baseColorFactor: [255, 255, 255, 255]}\n };\n } else {\n pbrMaterial = {\n pbrMetallicRoughness: {}\n };\n if (texture) {\n pbrMaterial.pbrMetallicRoughness.baseColorTexture = {texCoord: 0};\n } else {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n }\n }\n\n // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n\n if (pbrMaterial.alphaMode) {\n // I3S contain alphaMode in lowerCase\n pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n }\n\n // Convert colors from [255,255,255,255] to [1,1,1,1]\n if (pbrMaterial.emissiveFactor) {\n pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n }\n if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(\n pbrMaterial.pbrMetallicRoughness.baseColorFactor\n );\n }\n\n if (texture) {\n setMaterialTexture(pbrMaterial, texture);\n }\n\n return pbrMaterial;\n}\n\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor: number[]): number[] {\n const normalizedColor = [...colorFactor];\n for (let index = 0; index < colorFactor.length; index++) {\n normalizedColor[index] = colorFactor[index] / 255;\n }\n return normalizedColor;\n}\n\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image: TileContentTexture): void {\n const texture = {source: {image}};\n // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n // properties defined in materialDefinition\n if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n material.pbrMetallicRoughness.baseColorTexture = {\n ...material.pbrMetallicRoughness.baseColorTexture,\n texture\n };\n } else if (material.emissiveTexture) {\n material.emissiveTexture = {...material.emissiveTexture, texture};\n } else if (\n material.pbrMetallicRoughness &&\n material.pbrMetallicRoughness.metallicRoughnessTexture\n ) {\n material.pbrMetallicRoughness.metallicRoughnessTexture = {\n ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n texture\n };\n } else if (material.normalTexture) {\n material.normalTexture = {...material.normalTexture, texture};\n } else if (material.occlusionTexture) {\n material.occlusionTexture = {...material.occlusionTexture, texture};\n }\n}\n\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes: I3SMeshAttributes): void {\n const {id, faceRange} = normalizedFeatureAttributes;\n\n if (!id || !faceRange) {\n return;\n }\n\n const featureIds = id.value;\n const range = faceRange.value;\n const featureIdsLength = range[range.length - 1] + 1;\n const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n\n let featureIndex = 0;\n let startIndex = 0;\n\n for (let index = 1; index < range.length; index += 2) {\n const fillId = Number(featureIds[featureIndex]);\n const endValue = range[index];\n const prevValue = range[index - 1];\n const trianglesCount = endValue - prevValue + 1;\n const endIndex = startIndex + trianglesCount * 3;\n\n orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n\n featureIndex++;\n startIndex = endIndex;\n }\n\n normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(\n attributes: I3SMeshAttributes,\n featureIds: Int32Array\n): void {\n const featureIndices = attributes.id.value;\n const result = new Float32Array(featureIndices.length);\n\n for (let index = 0; index < featureIndices.length; index++) {\n result[index] = featureIds[featureIndices[index]];\n }\n\n attributes.id.value = result;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(\n featureIndex: I3SMeshAttribute\n): Int32Array | undefined {\n return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n"],"mappings":";;;;;;;;;;;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAYA;AAEA;AAEA;AAAyD;AAAA;AAAA;AAAA;AAAA;AAEzD,IAAMA,aAAa,GAAG,IAAIC,cAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE5C,SAASC,yBAAyB,CAACC,aAA2D,EAAE;EAC9F,QAAQA,aAAa;IACnB,KAAK,UAAU;IACf,KAAK,KAAK;MACR,OAAOC,iCAAuB;IAChC,KAAK,MAAM;MACT,OAAOC,qBAAW;IACpB,KAAK,KAAK;IACV,KAAK,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EACvB;EAEAlG,2BAA2B,CAAChB,EAAE,CAACX,KAAK,GAAGsH,qBAAqB;AAC9D;;AAQA,SAASxG,iCAAiC,CACxCvD,UAA6B,EAC7BE,UAAsB,EAChB;EACN,IAAMsK,cAAc,GAAGxK,UAAU,CAACoD,EAAE,CAACX,KAAK;EAC1C,IAAMgI,MAAM,GAAG,IAAIC,YAAY,CAACF,cAAc,CAACvC,MAAM,CAAC;EAEtD,KAAK,IAAIhB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGuD,cAAc,CAACvC,MAAM,EAAEhB,KAAK,EAAE,EAAE;IAC1DwD,MAAM,CAACxD,KAAK,CAAC,GAAG/G,UAAU,CAACsK,cAAc,CAACvD,KAAK,CAAC,CAAC;EACnD;EAEAjH,UAAU,CAACoD,EAAE,CAACX,KAAK,GAAGgI,MAAM;AAC9B;;AAOA,SAASnH,qCAAqC,CAC5CR,YAA8B,EACN;EAAA;EACxB,OAAOA,YAAY,aAAZA,YAAY,gDAAZA,YAAY,CAAE6C,QAAQ,oFAAtB,sBAAyB,iBAAiB,CAAC,2DAA3C,uBAA6CgF,QAAQ;AAC9D"}
|
|
1
|
+
{"version":3,"file":"parse-i3s-tile-content.js","names":["_core","require","_core2","_geospatial","_images","_draco","_textures","_types","_urlUtils","_constants","_customizeColors","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","arguments","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","scratchVector","Vector3","getLoaderForTextureFormat","textureFormat","CompressedTextureLoader","BasisLoader","ImageLoader","I3S_ATTRIBUTE_TYPE","parseI3STileContent","_x","_x2","_x3","_x4","_x5","_parseI3STileContent","_asyncToGenerator2","_regenerator","mark","_callee","arrayBuffer","tileOptions","tilesetOptions","options","context","content","_options$i3s","url","loader","response","_arrayBuffer","_options","texture","wrap","_callee$","_context","prev","attributes","indices","featureIds","vertexCount","modelMatrix","Matrix4","coordinateSystem","byteLength","textureUrl","getUrlWithToken","i3s","token","fetch","sent","decodeTextures","textureLoaderOptions","image","type","parse","t0","load","compressed","mipmaps","width","height","data","material","makePbrMaterial","materialDefinition","parseI3SNodeGeometry","abrupt","stop","_x6","_x7","_x8","_x9","_x10","_parseI3SNodeGeometry","_callee2","_options$i3s2","contentByteLength","byteOffset","featureCount","_decompressedGeometry","decompressedGeometry","_decompressedGeometry2","POSITION","NORMAL","COLOR_0","TEXCOORD_0","featureIndex","uvRegion","_tilesetOptions$store","vertexAttributes","attributesOrder","featureAttributes","featureAttributeOrder","headers","_normalizeAttributes","normalizedVertexAttributes","offset","_normalizeAttributes2","normalizedFeatureAttributes","enuMatrix","attributeIndex","_callee2$","_context2","isDracoGeometry","DracoLoader","draco","attributeNameEntry","header","position","normal","color","uv0","id","updateAttributesMetadata","getFeatureIdsFromFeatureIndexMetadata","flattenFeatureIdsByFeatureIndices","store","defaultGeometrySchema","ordering","parseHeaders","normalizeAttributes","flattenFeatureIdsByFaceRanges","concatAttributes","COORDINATE_SYSTEM","METER_OFFSETS","parsePositions","invert","getModelMatrix","LNGLAT_OFFSETS","customizeColors","positions","normals","colors","normalizeAttribute","texCoords","uvRegions","region","loaderData","dracoAttribute","metadata","attribute","normalized","_iterator","_step","_step$value","property","TypedArrayTypeHeader","getConstructorForDataFormat","HeaderAttributeProperty","sizeOf","attributeCount","_iterator2","_step2","_vertexAttributes$att","valueType","valuesPerElement","buffer","parseUint64Values","TypedArrayType","GL_TYPE_MAP","size","elementsCount","attributeSize","values","dataView","DataView","index","left","getUint32","right","Math","pow","Uint32Array","mbs","cartographicOrigin","cartesianOrigin","Ellipsoid","WGS84","cartographicToCartesian","eastNorthUpToFixedFrame","offsetsToCartesians","vertices","undefined","Float64Array","scaleX","double","scaleY","x","y","z","subarray","_metadata$i3sScale_x","_metadata$i3sScale_y","pbrMaterial","pbrMetallicRoughness","baseColorFactor","baseColorTexture","texCoord","alphaCutoff","alphaMode","toUpperCase","emissiveFactor","convertColorFormat","setMaterialTexture","colorFactor","normalizedColor","_toConsumableArray2","emissiveTexture","metallicRoughnessTexture","normalTexture","occlusionTexture","faceRange","range","featureIdsLength","orderedFeatureIndices","startIndex","fillId","Number","endValue","prevValue","trianglesCount","endIndex","fill","featureIndices","result","Float32Array","_featureIndex$metadat","_featureIndex$metadat2","intArray"],"sources":["../../../../src/lib/parsers/parse-i3s-tile-content.ts"],"sourcesContent":["import type {TypedArray} from '@loaders.gl/schema';\nimport {load, parse} from '@loaders.gl/core';\nimport {Vector3, Matrix4} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {DracoLoader, DracoMesh} from '@loaders.gl/draco';\nimport {BasisLoader, CompressedTextureLoader} from '@loaders.gl/textures';\n\nimport {\n FeatureAttribute,\n VertexAttribute,\n I3SMeshAttributes,\n I3SMeshAttribute,\n TileContentTexture,\n HeaderAttributeProperty,\n I3SMaterialDefinition,\n I3STileContent,\n I3STileOptions,\n I3STilesetOptions\n} from '../../types';\nimport {getUrlWithToken} from '../utils/url-utils';\n\nimport {GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';\nimport {I3SLoaderOptions} from '../../i3s-loader';\nimport {customizeColors} from '../utils/customizeColors';\n\nconst scratchVector = new Vector3([0, 0, 0]);\n\nfunction getLoaderForTextureFormat(textureFormat?: 'jpg' | 'png' | 'ktx-etc2' | 'dds' | 'ktx2') {\n switch (textureFormat) {\n case 'ktx-etc2':\n case 'dds':\n return CompressedTextureLoader;\n case 'ktx2':\n return BasisLoader;\n case 'jpg':\n case 'png':\n default:\n return ImageLoader;\n }\n}\n\nconst I3S_ATTRIBUTE_TYPE = 'i3s-attribute-type';\n\nexport async function parseI3STileContent(\n arrayBuffer: ArrayBuffer,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: LoaderOptions,\n context?: LoaderContext\n): Promise<I3STileContent> {\n const content: I3STileContent = {\n attributes: {},\n indices: null,\n featureIds: [],\n vertexCount: 0,\n modelMatrix: new Matrix4(),\n coordinateSystem: 0,\n byteLength: 0,\n texture: null\n };\n\n if (tileOptions.textureUrl) {\n // @ts-expect-error options is not properly typed\n const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);\n const loader = getLoaderForTextureFormat(tileOptions.textureFormat);\n const response = await fetch(url, options?.fetch as RequestInit);\n const arrayBuffer = await response.arrayBuffer();\n\n // @ts-expect-error options is not properly typed\n if (options?.i3s.decodeTextures) {\n if (loader === ImageLoader) {\n const options = {...tileOptions.textureLoaderOptions, image: {type: 'data'}};\n try {\n // @ts-ignore context must be defined\n // Image constructor is not supported in worker thread.\n // Do parsing image data on the main thread by using context to avoid worker issues.\n content.texture = await context.parse(arrayBuffer, options);\n } catch (e) {\n // context object is different between worker and node.js conversion script.\n // To prevent error we parse data in ordinary way if it is not parsed by using context.\n content.texture = await parse(arrayBuffer, loader, options);\n }\n } else if (loader === CompressedTextureLoader || loader === BasisLoader) {\n let texture = await load(arrayBuffer, loader, tileOptions.textureLoaderOptions);\n if (loader === BasisLoader) {\n texture = texture[0];\n }\n content.texture = {\n compressed: true,\n mipmaps: false,\n width: texture[0].width,\n height: texture[0].height,\n data: texture\n };\n }\n } else {\n content.texture = arrayBuffer;\n }\n }\n\n content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);\n if (content.material) {\n content.texture = null;\n }\n\n return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);\n}\n\n/* eslint-disable max-statements */\nasync function parseI3SNodeGeometry(\n arrayBuffer: ArrayBuffer,\n content: I3STileContent,\n tileOptions: I3STileOptions,\n tilesetOptions: I3STilesetOptions,\n options?: I3SLoaderOptions\n): Promise<I3STileContent> {\n const contentByteLength = arrayBuffer.byteLength;\n let attributes: I3SMeshAttributes;\n let vertexCount: number;\n let byteOffset: number = 0;\n let featureCount: number = 0;\n let indices: TypedArray | undefined;\n\n if (tileOptions.isDracoGeometry) {\n const decompressedGeometry: DracoMesh = await parse(arrayBuffer, DracoLoader, {\n draco: {\n attributeNameEntry: I3S_ATTRIBUTE_TYPE\n }\n });\n // @ts-expect-error\n vertexCount = decompressedGeometry.header.vertexCount;\n indices = decompressedGeometry.indices?.value;\n const {\n POSITION,\n NORMAL,\n COLOR_0,\n TEXCOORD_0,\n ['feature-index']: featureIndex,\n ['uv-region']: uvRegion\n } = decompressedGeometry.attributes;\n\n attributes = {\n position: POSITION,\n normal: NORMAL,\n color: COLOR_0,\n uv0: TEXCOORD_0,\n uvRegion,\n id: featureIndex\n };\n\n updateAttributesMetadata(attributes, decompressedGeometry);\n\n const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);\n\n if (featureIds) {\n flattenFeatureIdsByFeatureIndices(attributes, featureIds);\n }\n } else {\n const {\n vertexAttributes,\n ordering: attributesOrder,\n featureAttributes,\n featureAttributeOrder\n } = tilesetOptions.store.defaultGeometrySchema;\n // First 8 bytes reserved for header (vertexCount and featureCount)\n const headers = parseHeaders(arrayBuffer, tilesetOptions);\n byteOffset = headers.byteOffset;\n vertexCount = headers.vertexCount;\n featureCount = headers.featureCount;\n // Getting vertex attributes such as positions, normals, colors, etc...\n const {attributes: normalizedVertexAttributes, byteOffset: offset} = normalizeAttributes(\n arrayBuffer,\n byteOffset,\n vertexAttributes,\n vertexCount,\n attributesOrder\n );\n\n // Getting feature attributes such as featureIds and faceRange\n const {attributes: normalizedFeatureAttributes} = normalizeAttributes(\n arrayBuffer,\n offset,\n featureAttributes,\n featureCount,\n featureAttributeOrder\n );\n\n flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes);\n attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);\n }\n\n if (\n !options?.i3s?.coordinateSystem ||\n options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS\n ) {\n const enuMatrix = parsePositions(attributes.position, tileOptions);\n content.modelMatrix = enuMatrix.invert();\n content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;\n } else {\n content.modelMatrix = getModelMatrix(attributes.position);\n content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;\n }\n\n attributes.color = await customizeColors(\n attributes.color,\n attributes.id,\n tileOptions,\n tilesetOptions,\n options\n );\n\n content.attributes = {\n positions: attributes.position,\n normals: attributes.normal,\n colors: normalizeAttribute(attributes.color), // Normalize from UInt8\n texCoords: attributes.uv0,\n uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region) // Normalize from UInt16\n };\n content.indices = indices || null;\n\n if (attributes.id && attributes.id.value) {\n content.featureIds = attributes.id.value;\n }\n\n // Remove undefined attributes\n for (const attributeIndex in content.attributes) {\n if (!content.attributes[attributeIndex]) {\n delete content.attributes[attributeIndex];\n }\n }\n\n content.vertexCount = vertexCount;\n content.byteLength = contentByteLength;\n\n return content;\n}\n\n/**\n * Update attributes with metadata from decompressed geometry.\n * @param decompressedGeometry\n * @param attributes\n */\nfunction updateAttributesMetadata(\n attributes: I3SMeshAttributes,\n decompressedGeometry: DracoMesh\n): void {\n for (const key in decompressedGeometry.loaderData.attributes) {\n const dracoAttribute = decompressedGeometry.loaderData.attributes[key];\n\n switch (dracoAttribute.name) {\n case 'POSITION':\n attributes.position.metadata = dracoAttribute.metadata;\n break;\n case 'feature-index':\n attributes.id.metadata = dracoAttribute.metadata;\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * Do concatenation of attribute objects.\n * Done as separate fucntion to avoid ts errors.\n * @param normalizedVertexAttributes\n * @param normalizedFeatureAttributes\n * @returns - result of attributes concatenation.\n */\nfunction concatAttributes(\n normalizedVertexAttributes: I3SMeshAttributes,\n normalizedFeatureAttributes: I3SMeshAttributes\n): I3SMeshAttributes {\n return {...normalizedVertexAttributes, ...normalizedFeatureAttributes};\n}\n\n/**\n * Normalize attribute to range [0..1] . Eg. convert colors buffer from [255,255,255,255] to [1,1,1,1]\n * @param attribute - geometry attribute\n * @returns - geometry attribute in right format\n */\nfunction normalizeAttribute(attribute: I3SMeshAttribute): I3SMeshAttribute {\n if (!attribute) {\n return attribute;\n }\n attribute.normalized = true;\n return attribute;\n}\n\nfunction parseHeaders(arrayBuffer: ArrayBuffer, options: I3STilesetOptions) {\n let byteOffset = 0;\n // First 8 bytes reserved for header (vertexCount and featurecount)\n let vertexCount = 0;\n let featureCount = 0;\n for (const {property, type} of options.store.defaultGeometrySchema.header) {\n const TypedArrayTypeHeader = getConstructorForDataFormat(type);\n switch (property) {\n case HeaderAttributeProperty.vertexCount:\n vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];\n byteOffset += sizeOf(type);\n break;\n case HeaderAttributeProperty.featureCount:\n featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];\n byteOffset += sizeOf(type);\n break;\n default:\n break;\n }\n }\n\n return {\n vertexCount,\n featureCount,\n byteOffset\n };\n}\n\n/* eslint-enable max-statements */\n\nfunction normalizeAttributes(\n arrayBuffer: ArrayBuffer,\n byteOffset: number,\n vertexAttributes: VertexAttribute | FeatureAttribute,\n attributeCount: number,\n attributesOrder: string[]\n) {\n const attributes: I3SMeshAttributes = {};\n\n // the order of attributes depend on the order being added to the vertexAttributes object\n for (const attribute of attributesOrder) {\n if (vertexAttributes[attribute]) {\n const {valueType, valuesPerElement}: {valueType: string; valuesPerElement: number} =\n vertexAttributes[attribute];\n // protect from arrayBuffer read overunns by NOT assuming node has regions always even though its declared in defaultGeometrySchema.\n // In i3s 1.6: client is required to decide that based on ./shared resource of the node (materialDefinitions.[Mat_id].params.vertexRegions == true)\n // In i3s 1.7 the property has been rolled into the 3d scene layer json/node pages.\n // Code below does not account when the bytelength is actually bigger than\n // the calculated value (b\\c the tile potentially could have mesh segmentation information).\n // In those cases tiles without regions could fail or have garbage values.\n if (\n byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <=\n arrayBuffer.byteLength\n ) {\n const buffer = arrayBuffer.slice(byteOffset);\n let value: TypedArray;\n\n if (valueType === 'UInt64') {\n value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));\n } else {\n const TypedArrayType = getConstructorForDataFormat(valueType);\n value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);\n }\n\n attributes[attribute] = {\n value,\n type: GL_TYPE_MAP[valueType],\n size: valuesPerElement\n };\n\n switch (attribute) {\n case 'color':\n attributes.color.normalized = true;\n break;\n case 'position':\n case 'region':\n case 'normal':\n default:\n }\n\n byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);\n } else if (attribute !== 'uv0') {\n break;\n }\n }\n }\n\n return {attributes, byteOffset};\n}\n\n/**\n * Parse buffer to return array of uint64 values\n *\n * @param buffer\n * @param elementsCount\n * @returns 64-bit array of values until precision is lost after Number.MAX_SAFE_INTEGER\n */\nfunction parseUint64Values(\n buffer: ArrayBuffer,\n elementsCount: number,\n attributeSize: number\n): Uint32Array {\n const values: number[] = [];\n const dataView = new DataView(buffer);\n let offset = 0;\n\n for (let index = 0; index < elementsCount; index++) {\n // split 64-bit number into two 32-bit parts\n const left = dataView.getUint32(offset, true);\n const right = dataView.getUint32(offset + 4, true);\n // combine the two 32-bit values\n const value = left + 2 ** 32 * right;\n\n values.push(value);\n offset += attributeSize;\n }\n\n return new Uint32Array(values);\n}\n\nfunction parsePositions(attribute: I3SMeshAttribute, options: I3STileOptions): Matrix4 {\n const mbs = options.mbs;\n const value = attribute.value;\n const metadata = attribute.metadata;\n const enuMatrix = new Matrix4();\n const cartographicOrigin = new Vector3(mbs[0], mbs[1], mbs[2]);\n const cartesianOrigin = new Vector3();\n Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);\n Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);\n attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);\n\n return enuMatrix;\n}\n\n/**\n * Converts position coordinates to absolute cartesian coordinates\n * @param vertices - \"position\" attribute data\n * @param metadata - When the geometry is DRACO compressed, contain position attribute's metadata\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/compressedAttributes.cmn.md\n * @param cartographicOrigin - Cartographic origin coordinates\n * @returns - converted \"position\" data\n */\nfunction offsetsToCartesians(\n vertices: number[] | TypedArray,\n metadata: any = {},\n cartographicOrigin: Vector3\n): Float64Array {\n const positions = new Float64Array(vertices.length);\n const scaleX = (metadata['i3s-scale_x'] && metadata['i3s-scale_x'].double) || 1;\n const scaleY = (metadata['i3s-scale_y'] && metadata['i3s-scale_y'].double) || 1;\n for (let i = 0; i < positions.length; i += 3) {\n positions[i] = vertices[i] * scaleX + cartographicOrigin.x;\n positions[i + 1] = vertices[i + 1] * scaleY + cartographicOrigin.y;\n positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;\n }\n\n for (let i = 0; i < positions.length; i += 3) {\n // @ts-ignore\n Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector);\n positions[i] = scratchVector.x;\n positions[i + 1] = scratchVector.y;\n positions[i + 2] = scratchVector.z;\n }\n\n return positions;\n}\n\n/**\n * Get model matrix for loaded vertices\n * @param positions positions attribute\n * @returns Matrix4 - model matrix for geometry transformation\n */\nfunction getModelMatrix(positions: I3SMeshAttribute): Matrix4 {\n const metadata = positions.metadata;\n const scaleX: number = metadata?.['i3s-scale_x']?.double || 1;\n const scaleY: number = metadata?.['i3s-scale_y']?.double || 1;\n const modelMatrix = new Matrix4();\n modelMatrix[0] = scaleX;\n modelMatrix[5] = scaleY;\n return modelMatrix;\n}\n\n/**\n * Makes a glTF-compatible PBR material from an I3S material definition\n * @param materialDefinition - i3s material definition\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n * @param texture - texture image\n * @returns {object}\n */\nfunction makePbrMaterial(materialDefinition?: I3SMaterialDefinition, texture?: TileContentTexture) {\n let pbrMaterial;\n if (materialDefinition) {\n pbrMaterial = {\n ...materialDefinition,\n pbrMetallicRoughness: materialDefinition.pbrMetallicRoughness\n ? {...materialDefinition.pbrMetallicRoughness}\n : {baseColorFactor: [255, 255, 255, 255]}\n };\n } else {\n pbrMaterial = {\n pbrMetallicRoughness: {}\n };\n if (texture) {\n pbrMaterial.pbrMetallicRoughness.baseColorTexture = {texCoord: 0};\n } else {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = [255, 255, 255, 255];\n }\n }\n\n // Set default 0.25 per spec https://github.com/Esri/i3s-spec/blob/master/docs/1.7/materialDefinitions.cmn.md\n pbrMaterial.alphaCutoff = pbrMaterial.alphaCutoff || 0.25;\n\n if (pbrMaterial.alphaMode) {\n // I3S contain alphaMode in lowerCase\n pbrMaterial.alphaMode = pbrMaterial.alphaMode.toUpperCase();\n }\n\n // Convert colors from [255,255,255,255] to [1,1,1,1]\n if (pbrMaterial.emissiveFactor) {\n pbrMaterial.emissiveFactor = convertColorFormat(pbrMaterial.emissiveFactor);\n }\n if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {\n pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(\n pbrMaterial.pbrMetallicRoughness.baseColorFactor\n );\n }\n\n if (texture) {\n setMaterialTexture(pbrMaterial, texture);\n }\n\n return pbrMaterial;\n}\n\n/**\n * Convert color from [255,255,255,255] to [1,1,1,1]\n * @param colorFactor - color array\n * @returns - new color array\n */\nfunction convertColorFormat(colorFactor: number[]): number[] {\n const normalizedColor = [...colorFactor];\n for (let index = 0; index < colorFactor.length; index++) {\n normalizedColor[index] = colorFactor[index] / 255;\n }\n return normalizedColor;\n}\n\n/**\n * Set texture in PBR material\n * @param {object} material - i3s material definition\n * @param image - texture image\n * @returns\n */\nfunction setMaterialTexture(material, image: TileContentTexture): void {\n const texture = {source: {image}};\n // I3SLoader now support loading only one texture. This elseif sequence will assign this texture to one of\n // properties defined in materialDefinition\n if (material.pbrMetallicRoughness && material.pbrMetallicRoughness.baseColorTexture) {\n material.pbrMetallicRoughness.baseColorTexture = {\n ...material.pbrMetallicRoughness.baseColorTexture,\n texture\n };\n } else if (material.emissiveTexture) {\n material.emissiveTexture = {...material.emissiveTexture, texture};\n } else if (\n material.pbrMetallicRoughness &&\n material.pbrMetallicRoughness.metallicRoughnessTexture\n ) {\n material.pbrMetallicRoughness.metallicRoughnessTexture = {\n ...material.pbrMetallicRoughness.metallicRoughnessTexture,\n texture\n };\n } else if (material.normalTexture) {\n material.normalTexture = {...material.normalTexture, texture};\n } else if (material.occlusionTexture) {\n material.occlusionTexture = {...material.occlusionTexture, texture};\n }\n}\n\n/**\n * Flatten feature ids using face ranges\n * @param normalizedFeatureAttributes\n * @returns\n */\nfunction flattenFeatureIdsByFaceRanges(normalizedFeatureAttributes: I3SMeshAttributes): void {\n const {id, faceRange} = normalizedFeatureAttributes;\n\n if (!id || !faceRange) {\n return;\n }\n\n const featureIds = id.value;\n const range = faceRange.value;\n const featureIdsLength = range[range.length - 1] + 1;\n const orderedFeatureIndices = new Uint32Array(featureIdsLength * 3);\n\n let featureIndex = 0;\n let startIndex = 0;\n\n for (let index = 1; index < range.length; index += 2) {\n const fillId = Number(featureIds[featureIndex]);\n const endValue = range[index];\n const prevValue = range[index - 1];\n const trianglesCount = endValue - prevValue + 1;\n const endIndex = startIndex + trianglesCount * 3;\n\n orderedFeatureIndices.fill(fillId, startIndex, endIndex);\n\n featureIndex++;\n startIndex = endIndex;\n }\n\n normalizedFeatureAttributes.id.value = orderedFeatureIndices;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param attributes\n * @param featureIds\n * @returns\n */\nfunction flattenFeatureIdsByFeatureIndices(\n attributes: I3SMeshAttributes,\n featureIds: Int32Array\n): void {\n const featureIndices = attributes.id.value;\n const result = new Float32Array(featureIndices.length);\n\n for (let index = 0; index < featureIndices.length; index++) {\n result[index] = featureIds[featureIndices[index]];\n }\n\n attributes.id.value = result;\n}\n\n/**\n * Flatten feature ids using featureIndices\n * @param featureIndex\n * @returns\n */\nfunction getFeatureIdsFromFeatureIndexMetadata(\n featureIndex: I3SMeshAttribute\n): Int32Array | undefined {\n return featureIndex?.metadata?.['i3s-feature-ids']?.intArray;\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AAYA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAEA,IAAAS,gBAAA,GAAAT,OAAA;AAAyD,SAAAU,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,MAAA,oBAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,EAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA,CAAAQ,MAAA,qBAAAN,EAAA,EAAAF,CAAA,GAAAE,EAAA,MAAAO,CAAA,UAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,QAAAH,CAAA,IAAAT,CAAA,CAAAQ,MAAA,WAAAK,IAAA,mBAAAA,IAAA,SAAAC,KAAA,EAAAd,CAAA,CAAAS,CAAA,UAAAM,CAAA,WAAAA,EAAAC,EAAA,UAAAA,EAAA,KAAAC,CAAA,EAAAP,CAA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AA6B,EAC7BE,UAAsB,EAChB;EACN,IAAMyL,cAAc,GAAG3L,UAAU,CAAC4E,EAAE,CAACjK,KAAK;EAC1C,IAAMiR,MAAM,GAAG,IAAIC,YAAY,CAACF,cAAc,CAACtR,MAAM,CAAC;EAEtD,KAAK,IAAI6N,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGyD,cAAc,CAACtR,MAAM,EAAE6N,KAAK,EAAE,EAAE;IAC1D0D,MAAM,CAAC1D,KAAK,CAAC,GAAGhI,UAAU,CAACyL,cAAc,CAACzD,KAAK,CAAC,CAAC;EACnD;EAEAlI,UAAU,CAAC4E,EAAE,CAACjK,KAAK,GAAGiR,MAAM;AAC9B;AAOA,SAAS9G,qCAAqCA,CAC5C5B,YAA8B,EACN;EAAA,IAAA4I,qBAAA,EAAAC,sBAAA;EACxB,OAAO7I,YAAY,aAAZA,YAAY,wBAAA4I,qBAAA,GAAZ5I,YAAY,CAAEqD,QAAQ,cAAAuF,qBAAA,wBAAAC,sBAAA,GAAtBD,qBAAA,CAAyB,iBAAiB,CAAC,cAAAC,sBAAA,uBAA3CA,sBAAA,CAA6CC,QAAQ;AAC9D"}
|
|
@@ -47,8 +47,7 @@ function normalizeTileNonUrlData(tile) {
|
|
|
47
47
|
var mbs = [0, 0, 0, 1];
|
|
48
48
|
if (tile.mbs) {
|
|
49
49
|
mbs = tile.mbs;
|
|
50
|
-
boundingVolume.sphere = [].concat((0, _toConsumableArray2.default)(_geospatial.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3))), [
|
|
51
|
-
tile.mbs[3]]);
|
|
50
|
+
boundingVolume.sphere = [].concat((0, _toConsumableArray2.default)(_geospatial.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3))), [tile.mbs[3]]);
|
|
52
51
|
} else if (tile.obb) {
|
|
53
52
|
boundingVolume.box = [].concat((0, _toConsumableArray2.default)(_geospatial.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center)), (0, _toConsumableArray2.default)(tile.obb.halfSize), (0, _toConsumableArray2.default)(tile.obb.quaternion));
|
|
54
53
|
var obb = new _culling.OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);
|
|
@@ -78,40 +77,37 @@ function _normalizeTilesetData() {
|
|
|
78
77
|
_normalizeTilesetData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tileset, options, context) {
|
|
79
78
|
var _options$i3s, rootNodeUrl;
|
|
80
79
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
81
|
-
while (1) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
_context.next = 6;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
tileset.nodePagesTile = new _i3sNodepagesTiles.default(tileset, options);
|
|
90
|
-
tileset.root = tileset.nodePagesTile.formTileFromNodePages(0);
|
|
91
|
-
_context.next = 10;
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
tileset.url = context.url;
|
|
83
|
+
if (!tileset.nodePages) {
|
|
84
|
+
_context.next = 6;
|
|
92
85
|
break;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
86
|
+
}
|
|
87
|
+
tileset.nodePagesTile = new _i3sNodepagesTiles.default(tileset, options);
|
|
88
|
+
tileset.root = tileset.nodePagesTile.formTileFromNodePages(0);
|
|
89
|
+
_context.next = 10;
|
|
90
|
+
break;
|
|
91
|
+
case 6:
|
|
92
|
+
rootNodeUrl = (0, _urlUtils.getUrlWithToken)("".concat(tileset.url, "/nodes/root"), (_options$i3s = options.i3s) === null || _options$i3s === void 0 ? void 0 : _options$i3s.token);
|
|
93
|
+
_context.next = 9;
|
|
94
|
+
return (0, _core.load)(rootNodeUrl, tileset.loader, _objectSpread(_objectSpread({}, options), {}, {
|
|
95
|
+
i3s: _objectSpread(_objectSpread({}, options.i3s), {}, {
|
|
96
|
+
loadContent: false,
|
|
97
|
+
isTileHeader: true,
|
|
98
|
+
isTileset: false
|
|
99
|
+
})
|
|
100
|
+
}));
|
|
101
|
+
case 9:
|
|
102
|
+
tileset.root = _context.sent;
|
|
103
|
+
case 10:
|
|
104
|
+
tileset.basePath = tileset.url;
|
|
105
|
+
tileset.type = _tiles.TILESET_TYPE.I3S;
|
|
106
|
+
tileset.lodMetricType = tileset.root.lodMetricType;
|
|
107
|
+
tileset.lodMetricValue = tileset.root.lodMetricValue;
|
|
108
|
+
case 14:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context.stop();
|
|
115
111
|
}
|
|
116
112
|
}, _callee);
|
|
117
113
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-i3s.js","names":["normalizeTileData","tile","context","url","contentUrl","geometryData","href","textureUrl","textureData","attributeUrls","attributeData","generateTileAttributeUrls","normalizeTileNonUrlData","isDracoGeometry","boundingVolume","mbs","sphere","Ellipsoid","WGS84","cartographicToCartesian","slice","obb","box","center","halfSize","quaternion","OrientedBoundingBox","fromCenterHalfSizeQuaternion","boundingSphere","getBoundingSphere","radius","lodMetricType","lodSelection","metricType","lodMetricValue","maxError","transformMatrix","transform","type","TILE_TYPE","MESH","refine","TILE_REFINEMENT","REPLACE","normalizeTilesetData","tileset","options","nodePages","nodePagesTile","I3SNodePagesTiles","root","formTileFromNodePages","rootNodeUrl","getUrlWithToken","i3s","token","load","loader","loadContent","isTileHeader","isTileset","basePath","TILESET_TYPE","I3S"],"sources":["../../../../src/lib/parsers/parse-i3s.ts"],"sourcesContent":["import {OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {load} from '@loaders.gl/core';\nimport {TILE_TYPE, TILE_REFINEMENT, TILESET_TYPE} from '@loaders.gl/tiles';\nimport I3SNodePagesTiles from '../helpers/i3s-nodepages-tiles';\nimport {generateTileAttributeUrls, getUrlWithToken} from '../utils/url-utils';\nimport {\n I3STilesetHeader,\n I3STileHeader,\n Mbs,\n I3SMinimalNodeData,\n Node3DIndexDocument\n} from '../../types';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\n\nexport function normalizeTileData(tile : Node3DIndexDocument, context: LoaderContext): I3STileHeader {\n const url: string = context.url || '';\n let contentUrl: string | undefined;\n if (tile.geometryData) {\n contentUrl = `${url}/${tile.geometryData[0].href}`;\n }\n\n let textureUrl: string | undefined;\n if (tile.textureData) {\n textureUrl = `${url}/${tile.textureData[0].href}`;\n }\n\n let attributeUrls: string[] | undefined;\n if (tile.attributeData) {\n attributeUrls = generateTileAttributeUrls(url, tile);\n }\n\n return normalizeTileNonUrlData({\n ...tile,\n url,\n contentUrl,\n textureUrl,\n attributeUrls,\n isDracoGeometry: false\n });\n}\n\nexport function normalizeTileNonUrlData(tile : I3SMinimalNodeData): I3STileHeader {\n const boundingVolume: {box?: number[]; sphere?: number[]} = {};\n let mbs: Mbs = [0, 0, 0, 1];\n if (tile.mbs) {\n mbs = tile.mbs;\n boundingVolume.sphere = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere\n tile.mbs[3] // radius of sphere\n ] as Mbs;\n } else if (tile.obb) {\n boundingVolume.box = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box\n ...tile.obb.halfSize, // halfSize\n ...tile.obb.quaternion // quaternion\n ];\n const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(\n boundingVolume.box.slice(0, 3),\n tile.obb.halfSize,\n tile.obb.quaternion\n );\n const boundingSphere = obb.getBoundingSphere();\n boundingVolume.sphere = [...boundingSphere.center , boundingSphere.radius] as Mbs;\n mbs = [...tile.obb.center, boundingSphere.radius] as Mbs;\n }\n\n const lodMetricType = tile.lodSelection?.[0].metricType;\n const lodMetricValue = tile.lodSelection?.[0].maxError;\n const transformMatrix = tile.transform;\n const type = TILE_TYPE.MESH;\n /**\n * I3S specification supports only REPLACE\n */\n const refine = TILE_REFINEMENT.REPLACE;\n\n return {...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, transformMatrix, type, refine};\n}\n\nexport async function normalizeTilesetData(tileset : I3STilesetHeader, options : LoaderOptions, context: LoaderContext) {\n tileset.url = context.url;\n\n if (tileset.nodePages) {\n tileset.nodePagesTile = new I3SNodePagesTiles(tileset, options);\n tileset.root = tileset.nodePagesTile.formTileFromNodePages(0);\n } else {\n const rootNodeUrl = getUrlWithToken(`${tileset.url}/nodes/root`, options.i3s?.token);\n // eslint-disable-next-line no-use-before-define\n tileset.root = await load(rootNodeUrl, tileset.loader, {\n ...options,\n i3s: {\n ...options.i3s,\n loadContent: false, isTileHeader: true, isTileset: false}\n });\n }\n\n // base path that non-absolute paths in tileset are relative to.\n tileset.basePath = tileset.url;\n tileset.type = TILESET_TYPE.I3S;\n\n // populate from root node\n tileset.lodMetricType = tileset.root.lodMetricType;\n tileset.lodMetricValue = tileset.root.lodMetricValue;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAA8E;AAAA;AAUvE,SAASA,iBAAiB,CAACC,IAA0B,EAAEC,OAAsB,EAAiB;EACnG,IAAMC,GAAW,GAAGD,OAAO,CAACC,GAAG,IAAI,EAAE;EACrC,IAAIC,UAA8B;EAClC,IAAIH,IAAI,CAACI,YAAY,EAAE;IACrBD,UAAU,aAAMD,GAAG,cAAIF,IAAI,CAACI,YAAY,CAAC,CAAC,CAAC,CAACC,IAAI,CAAE;EACpD;EAEA,IAAIC,UAA8B;EAClC,IAAIN,IAAI,CAACO,WAAW,EAAE;IAC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AC;YAAA;UAAA;YAExDC,WAAW,GAAG,IAAAC,yBAAe,YAAIR,OAAO,CAAC1C,GAAG,kCAAe2C,OAAO,CAACQ,GAAG,iDAAX,aAAaC,KAAK,CAAC;YAAA;YAAA,OAE/D,IAAAC,UAAI,EAACJ,WAAW,EAAEP,OAAO,CAACY,MAAM,kCAChDX,OAAO;cACVQ,GAAG,kCACER,OAAO,CAACQ,GAAG;gBACdI,WAAW,EAAE,KAAK;gBAAEC,YAAY,EAAE,IAAI;gBAAEC,SAAS,EAAE;cAAK;YAAC,GAC3D;UAAA;YALFf,OAAO,CAACK,IAAI;UAAA;YASdL,OAAO,CAACgB,QAAQ,GAAGhB,OAAO,CAAC1C,GAAG;YAC9B0C,OAAO,CAACP,IAAI,GAAGwB,mBAAY,CAACC,GAAG;;YAG/BlB,OAAO,CAACd,aAAa,GAAGc,OAAO,CAACK,IAAI,CAACnB,aAAa;YAClDc,OAAO,CAACX,cAAc,GAAGW,OAAO,CAACK,IAAI,CAAChB,cAAc;UAAC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACtD;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"parse-i3s.js","names":["_culling","require","_geospatial","_core","_tiles","_i3sNodepagesTiles","_interopRequireDefault","_urlUtils","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","normalizeTileData","tile","context","url","contentUrl","geometryData","concat","href","textureUrl","textureData","attributeUrls","attributeData","generateTileAttributeUrls","normalizeTileNonUrlData","isDracoGeometry","_tile$lodSelection","_tile$lodSelection2","boundingVolume","mbs","sphere","_toConsumableArray2","Ellipsoid","WGS84","cartographicToCartesian","slice","obb","box","center","halfSize","quaternion","OrientedBoundingBox","fromCenterHalfSizeQuaternion","boundingSphere","getBoundingSphere","radius","lodMetricType","lodSelection","metricType","lodMetricValue","maxError","transformMatrix","transform","type","TILE_TYPE","MESH","refine","TILE_REFINEMENT","REPLACE","normalizeTilesetData","_x","_x2","_x3","_normalizeTilesetData","_asyncToGenerator2","_regenerator","mark","_callee","tileset","options","_options$i3s","rootNodeUrl","wrap","_callee$","_context","prev","next","nodePages","nodePagesTile","I3SNodePagesTiles","root","formTileFromNodePages","getUrlWithToken","i3s","token","load","loader","loadContent","isTileHeader","isTileset","sent","basePath","TILESET_TYPE","I3S","stop"],"sources":["../../../../src/lib/parsers/parse-i3s.ts"],"sourcesContent":["import {OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {load} from '@loaders.gl/core';\nimport {TILE_TYPE, TILE_REFINEMENT, TILESET_TYPE} from '@loaders.gl/tiles';\nimport I3SNodePagesTiles from '../helpers/i3s-nodepages-tiles';\nimport {generateTileAttributeUrls, getUrlWithToken} from '../utils/url-utils';\nimport {\n I3STilesetHeader,\n I3STileHeader,\n Mbs,\n I3SMinimalNodeData,\n Node3DIndexDocument\n} from '../../types';\nimport type {LoaderOptions, LoaderContext} from '@loaders.gl/loader-utils';\n\nexport function normalizeTileData(tile : Node3DIndexDocument, context: LoaderContext): I3STileHeader {\n const url: string = context.url || '';\n let contentUrl: string | undefined;\n if (tile.geometryData) {\n contentUrl = `${url}/${tile.geometryData[0].href}`;\n }\n\n let textureUrl: string | undefined;\n if (tile.textureData) {\n textureUrl = `${url}/${tile.textureData[0].href}`;\n }\n\n let attributeUrls: string[] | undefined;\n if (tile.attributeData) {\n attributeUrls = generateTileAttributeUrls(url, tile);\n }\n\n return normalizeTileNonUrlData({\n ...tile,\n url,\n contentUrl,\n textureUrl,\n attributeUrls,\n isDracoGeometry: false\n });\n}\n\nexport function normalizeTileNonUrlData(tile : I3SMinimalNodeData): I3STileHeader {\n const boundingVolume: {box?: number[]; sphere?: number[]} = {};\n let mbs: Mbs = [0, 0, 0, 1];\n if (tile.mbs) {\n mbs = tile.mbs;\n boundingVolume.sphere = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)), // cartesian center of sphere\n tile.mbs[3] // radius of sphere\n ] as Mbs;\n } else if (tile.obb) {\n boundingVolume.box = [\n ...Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center), // cartesian center of box\n ...tile.obb.halfSize, // halfSize\n ...tile.obb.quaternion // quaternion\n ];\n const obb = new OrientedBoundingBox().fromCenterHalfSizeQuaternion(\n boundingVolume.box.slice(0, 3),\n tile.obb.halfSize,\n tile.obb.quaternion\n );\n const boundingSphere = obb.getBoundingSphere();\n boundingVolume.sphere = [...boundingSphere.center , boundingSphere.radius] as Mbs;\n mbs = [...tile.obb.center, boundingSphere.radius] as Mbs;\n }\n\n const lodMetricType = tile.lodSelection?.[0].metricType;\n const lodMetricValue = tile.lodSelection?.[0].maxError;\n const transformMatrix = tile.transform;\n const type = TILE_TYPE.MESH;\n /**\n * I3S specification supports only REPLACE\n */\n const refine = TILE_REFINEMENT.REPLACE;\n\n return {...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, transformMatrix, type, refine};\n}\n\nexport async function normalizeTilesetData(tileset : I3STilesetHeader, options : LoaderOptions, context: LoaderContext) {\n tileset.url = context.url;\n\n if (tileset.nodePages) {\n tileset.nodePagesTile = new I3SNodePagesTiles(tileset, options);\n tileset.root = tileset.nodePagesTile.formTileFromNodePages(0);\n } else {\n // @ts-expect-error options is not properly typed\n const rootNodeUrl = getUrlWithToken(`${tileset.url}/nodes/root`, options.i3s?.token);\n // eslint-disable-next-line no-use-before-define\n tileset.root = await load(rootNodeUrl, tileset.loader, {\n ...options,\n i3s: {\n // @ts-expect-error options is not properly typed\n ...options.i3s,\n loadContent: false, isTileHeader: true, isTileset: false}\n });\n }\n\n // base path that non-absolute paths in tileset are relative to.\n tileset.basePath = tileset.url;\n tileset.type = TILESET_TYPE.I3S;\n\n // populate from root node\n tileset.lodMetricType = tileset.root.lodMetricType;\n tileset.lodMetricValue = tileset.root.lodM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D,GAAG,mBAAAwD,YAAA,GAAeD,OAAO,CAACc,GAAG,cAAAb,YAAA,uBAAXA,YAAA,CAAac,KAAK,CAAC;UAAAV,QAAA,CAAAE,IAAA;UAAA,OAE/D,IAAAS,UAAI,EAACd,WAAW,EAAEH,OAAO,CAACkB,MAAM,EAAAxF,aAAA,CAAAA,aAAA,KAChDuE,OAAO;YACVc,GAAG,EAAArF,aAAA,CAAAA,aAAA,KAEEuE,OAAO,CAACc,GAAG;cACdI,WAAW,EAAE,KAAK;cAAEC,YAAY,EAAE,IAAI;cAAEC,SAAS,EAAE;YAAK;UAAC,GAC3D;QAAA;UANFrB,OAAO,CAACY,IAAI,GAAAN,QAAA,CAAAgB,IAAA;QAAA;UAUdtB,OAAO,CAACuB,QAAQ,GAAGvB,OAAO,CAACtD,GAAG;UAC9BsD,OAAO,CAACf,IAAI,GAAGuC,mBAAY,CAACC,GAAG;UAG/BzB,OAAO,CAACtB,aAAa,GAAGsB,OAAO,CAACY,IAAI,CAAClC,aAAa;UAClDsB,OAAO,CAACnB,cAAc,GAAGmB,OAAO,CAACY,IAAI,CAAC/B,cAAc;QAAC;QAAA;UAAA,OAAAyB,QAAA,CAAAoB,IAAA;MAAA;IAAA,GAAA3B,OAAA;EAAA,CACtD;EAAA,OAAAJ,qBAAA,CAAAlE,KAAA,OAAAI,SAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-i3s-obb-to-mbs.js","names":["convertI3SObbToMbs","obb","halfSize","centerCartesian","Ellipsoid","WGS84","cartographicToCartesian","center","sphere","BoundingSphere","fromCornerPoints","radius"],"sources":["../../../../src/lib/utils/convert-i3s-obb-to-mbs.ts"],"sourcesContent":["import {BoundingSphere} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\n\nexport function convertI3SObbToMbs(obb) {\n const halfSize = obb.halfSize;\n const centerCartesian = Ellipsoid.WGS84.cartographicToCartesian(obb.center);\n const sphere = new BoundingSphere().fromCornerPoints(\n [\n centerCartesian[0] - halfSize[0],\n centerCartesian[1] - halfSize[1],\n centerCartesian[2] - halfSize[2]\n ],\n [\n centerCartesian[0] + halfSize[0],\n centerCartesian[1] + halfSize[1],\n centerCartesian[2] + halfSize[2]\n ]\n );\n return [...obb.center, sphere.radius];\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AAEO,
|
|
1
|
+
{"version":3,"file":"convert-i3s-obb-to-mbs.js","names":["_culling","require","_geospatial","convertI3SObbToMbs","obb","halfSize","centerCartesian","Ellipsoid","WGS84","cartographicToCartesian","center","sphere","BoundingSphere","fromCornerPoints","concat","_toConsumableArray2","default","radius"],"sources":["../../../../src/lib/utils/convert-i3s-obb-to-mbs.ts"],"sourcesContent":["import {BoundingSphere} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\n\nexport function convertI3SObbToMbs(obb) {\n const halfSize = obb.halfSize;\n const centerCartesian = Ellipsoid.WGS84.cartographicToCartesian(obb.center);\n const sphere = new BoundingSphere().fromCornerPoints(\n [\n centerCartesian[0] - halfSize[0],\n centerCartesian[1] - halfSize[1],\n centerCartesian[2] - halfSize[2]\n ],\n [\n centerCartesian[0] + halfSize[0],\n centerCartesian[1] + halfSize[1],\n centerCartesian[2] + halfSize[2]\n ]\n );\n return [...obb.center, sphere.radius];\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEO,SAASE,kBAAkBA,CAACC,GAAG,EAAE;EACtC,IAAMC,QAAQ,GAAGD,GAAG,CAACC,QAAQ;EAC7B,IAAMC,eAAe,GAAGC,qBAAS,CAACC,KAAK,CAACC,uBAAuB,CAACL,GAAG,CAACM,MAAM,CAAC;EAC3E,IAAMC,MAAM,GAAG,IAAIC,uBAAc,EAAE,CAACC,gBAAgB,CAClD,CACEP,eAAe,CAAC,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC,EAChCC,eAAe,CAAC,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC,EAChCC,eAAe,CAAC,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC,CACjC,EACD,CACEC,eAAe,CAAC,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC,EAChCC,eAAe,CAAC,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC,EAChCC,eAAe,CAAC,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC,CACjC,CACF;EACD,UAAAS,MAAA,KAAAC,mBAAA,CAAAC,OAAA,EAAWZ,GAAG,CAACM,MAAM,IAAEC,MAAM,CAACM,MAAM;AACtC"}
|
|
@@ -18,84 +18,82 @@ function _customizeColors() {
|
|
|
18
18
|
var _options$i3s2;
|
|
19
19
|
var colorizeAttributeField, colorizeAttributeData, objectIdField, objectIdAttributeData, attributeValuesMap, i, _i, color;
|
|
20
20
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
|
-
while (1) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_context.next = 2;
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
return _context.abrupt("return", colors);
|
|
29
|
-
case 2:
|
|
30
|
-
colorizeAttributeField = tilesetOptions.fields.find(function (_ref3) {
|
|
31
|
-
var _options$i3s3, _options$i3s3$colorsB;
|
|
32
|
-
var name = _ref3.name;
|
|
33
|
-
return name === (options === null || options === void 0 ? void 0 : (_options$i3s3 = options.i3s) === null || _options$i3s3 === void 0 ? void 0 : (_options$i3s3$colorsB = _options$i3s3.colorsByAttribute) === null || _options$i3s3$colorsB === void 0 ? void 0 : _options$i3s3$colorsB.attributeName);
|
|
34
|
-
});
|
|
35
|
-
if (!(!colorizeAttributeField || !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(colorizeAttributeField.type))) {
|
|
36
|
-
_context.next = 5;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
return _context.abrupt("return", colors);
|
|
40
|
-
case 5:
|
|
41
|
-
_context.next = 7;
|
|
42
|
-
return loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
|
|
43
|
-
case 7:
|
|
44
|
-
colorizeAttributeData = _context.sent;
|
|
45
|
-
if (colorizeAttributeData) {
|
|
46
|
-
_context.next = 10;
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
return _context.abrupt("return", colors);
|
|
50
|
-
case 10:
|
|
51
|
-
objectIdField = tilesetOptions.fields.find(function (_ref4) {
|
|
52
|
-
var type = _ref4.type;
|
|
53
|
-
return type === 'esriFieldTypeOID';
|
|
54
|
-
});
|
|
55
|
-
if (objectIdField) {
|
|
56
|
-
_context.next = 13;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
return _context.abrupt("return", colors);
|
|
60
|
-
case 13:
|
|
61
|
-
_context.next = 15;
|
|
62
|
-
return loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
|
|
63
|
-
case 15:
|
|
64
|
-
objectIdAttributeData = _context.sent;
|
|
65
|
-
if (objectIdAttributeData) {
|
|
66
|
-
_context.next = 18;
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
return _context.abrupt("return", colors);
|
|
70
|
-
case 18:
|
|
71
|
-
attributeValuesMap = {};
|
|
72
|
-
for (i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {
|
|
73
|
-
attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i], options);
|
|
74
|
-
}
|
|
75
|
-
_i = 0;
|
|
76
|
-
case 21:
|
|
77
|
-
if (!(_i < featureIds.value.length)) {
|
|
78
|
-
_context.next = 29;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
color = attributeValuesMap[featureIds.value[_i]];
|
|
82
|
-
if (color) {
|
|
83
|
-
_context.next = 25;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
return _context.abrupt("continue", 26);
|
|
87
|
-
case 25:
|
|
88
|
-
colors.value.set(color, _i * 4);
|
|
89
|
-
case 26:
|
|
90
|
-
_i++;
|
|
91
|
-
_context.next = 21;
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
if (options !== null && options !== void 0 && (_options$i3s2 = options.i3s) !== null && _options$i3s2 !== void 0 && _options$i3s2.colorsByAttribute) {
|
|
24
|
+
_context.next = 2;
|
|
92
25
|
break;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
26
|
+
}
|
|
27
|
+
return _context.abrupt("return", colors);
|
|
28
|
+
case 2:
|
|
29
|
+
colorizeAttributeField = tilesetOptions.fields.find(function (_ref3) {
|
|
30
|
+
var _options$i3s3, _options$i3s3$colorsB;
|
|
31
|
+
var name = _ref3.name;
|
|
32
|
+
return name === (options === null || options === void 0 ? void 0 : (_options$i3s3 = options.i3s) === null || _options$i3s3 === void 0 ? void 0 : (_options$i3s3$colorsB = _options$i3s3.colorsByAttribute) === null || _options$i3s3$colorsB === void 0 ? void 0 : _options$i3s3$colorsB.attributeName);
|
|
33
|
+
});
|
|
34
|
+
if (!(!colorizeAttributeField || !['esriFieldTypeDouble', 'esriFieldTypeInteger', 'esriFieldTypeSmallInteger'].includes(colorizeAttributeField.type))) {
|
|
35
|
+
_context.next = 5;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return _context.abrupt("return", colors);
|
|
39
|
+
case 5:
|
|
40
|
+
_context.next = 7;
|
|
41
|
+
return loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
|
|
42
|
+
case 7:
|
|
43
|
+
colorizeAttributeData = _context.sent;
|
|
44
|
+
if (colorizeAttributeData) {
|
|
45
|
+
_context.next = 10;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return _context.abrupt("return", colors);
|
|
49
|
+
case 10:
|
|
50
|
+
objectIdField = tilesetOptions.fields.find(function (_ref4) {
|
|
51
|
+
var type = _ref4.type;
|
|
52
|
+
return type === 'esriFieldTypeOID';
|
|
53
|
+
});
|
|
54
|
+
if (objectIdField) {
|
|
55
|
+
_context.next = 13;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return _context.abrupt("return", colors);
|
|
59
|
+
case 13:
|
|
60
|
+
_context.next = 15;
|
|
61
|
+
return loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
|
|
62
|
+
case 15:
|
|
63
|
+
objectIdAttributeData = _context.sent;
|
|
64
|
+
if (objectIdAttributeData) {
|
|
65
|
+
_context.next = 18;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return _context.abrupt("return", colors);
|
|
69
|
+
case 18:
|
|
70
|
+
attributeValuesMap = {};
|
|
71
|
+
for (i = 0; i < objectIdAttributeData[objectIdField.name].length; i++) {
|
|
72
|
+
attributeValuesMap[objectIdAttributeData[objectIdField.name][i]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i], options);
|
|
73
|
+
}
|
|
74
|
+
_i = 0;
|
|
75
|
+
case 21:
|
|
76
|
+
if (!(_i < featureIds.value.length)) {
|
|
77
|
+
_context.next = 29;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
color = attributeValuesMap[featureIds.value[_i]];
|
|
81
|
+
if (color) {
|
|
82
|
+
_context.next = 25;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return _context.abrupt("continue", 26);
|
|
86
|
+
case 25:
|
|
87
|
+
colors.value.set(color, _i * 4);
|
|
88
|
+
case 26:
|
|
89
|
+
_i++;
|
|
90
|
+
_context.next = 21;
|
|
91
|
+
break;
|
|
92
|
+
case 29:
|
|
93
|
+
return _context.abrupt("return", colors);
|
|
94
|
+
case 30:
|
|
95
|
+
case "end":
|
|
96
|
+
return _context.stop();
|
|
99
97
|
}
|
|
100
98
|
}, _callee);
|
|
101
99
|
}));
|
|
@@ -118,7 +116,6 @@ function calculateColorForAttribute(attributeValue, options) {
|
|
|
118
116
|
}
|
|
119
117
|
return color;
|
|
120
118
|
}
|
|
121
|
-
|
|
122
119
|
function loadFeatureAttributeData(_x6, _x7, _x8, _x9) {
|
|
123
120
|
return _loadFeatureAttributeData.apply(this, arguments);
|
|
124
121
|
}
|
|
@@ -127,35 +124,33 @@ function _loadFeatureAttributeData() {
|
|
|
127
124
|
var _options$i3s4;
|
|
128
125
|
var attributeUrls, attributeStorageInfo, attributeIndex, objectIdAttributeUrl, attributeType, objectIdAttributeData;
|
|
129
126
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
130
|
-
while (1) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return _context2.stop();
|
|
158
|
-
}
|
|
127
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
attributeUrls = _ref.attributeUrls;
|
|
130
|
+
attributeStorageInfo = _ref2.attributeStorageInfo;
|
|
131
|
+
attributeIndex = attributeStorageInfo.findIndex(function (_ref5) {
|
|
132
|
+
var name = _ref5.name;
|
|
133
|
+
return attributeName === name;
|
|
134
|
+
});
|
|
135
|
+
if (!(attributeIndex === -1)) {
|
|
136
|
+
_context2.next = 5;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
return _context2.abrupt("return", null);
|
|
140
|
+
case 5:
|
|
141
|
+
objectIdAttributeUrl = (0, _urlUtils.getUrlWithToken)(attributeUrls[attributeIndex], options === null || options === void 0 ? void 0 : (_options$i3s4 = options.i3s) === null || _options$i3s4 === void 0 ? void 0 : _options$i3s4.token);
|
|
142
|
+
attributeType = (0, _i3sAttributeLoader.getAttributeValueType)(attributeStorageInfo[attributeIndex]);
|
|
143
|
+
_context2.next = 9;
|
|
144
|
+
return (0, _core.load)(objectIdAttributeUrl, _i3sAttributeLoader.I3SAttributeLoader, {
|
|
145
|
+
attributeName: attributeName,
|
|
146
|
+
attributeType: attributeType
|
|
147
|
+
});
|
|
148
|
+
case 9:
|
|
149
|
+
objectIdAttributeData = _context2.sent;
|
|
150
|
+
return _context2.abrupt("return", objectIdAttributeData);
|
|
151
|
+
case 11:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context2.stop();
|
|
159
154
|
}
|
|
160
155
|
}, _callee2);
|
|
161
156
|
}));
|