@csi-foxbyte/cityjson-to-3d-tiles
Version:
A Node.js library that converts CityJSON files into Cesium 3D Tiles—complete with automatic texture atlas packing, Basis compression, three LOD levels, and customizable threading.
2 lines • 1.25 kB
JavaScript
import {MetadataError}from'3d-tiles-tools';class b{static create(o,a){const r=o.createPropertyTable(),f=a.propertyTable;f.name!==void 0&&r.setObjectName(f.name),r.setClass(f.class),r.setCount(f.count);const c=a.binaryMetadata.metadataClass.properties||{},l=Object.keys(c);for(const s of l){const p=b.createPropertyTableProperty(o,a,s);r.setProperty(s,p);}return r}static createPropertyTableProperty(o,a,r){const n=a.propertyTable.properties;if(!n)throw new MetadataError("The property table does not define any properties");const e=n[r];if(!e)throw new MetadataError(`The property table does not define property ${r}`);const s=a.binaryMetadata.binaryBufferData.bufferViewsData,p=e.values,P=s[p],T=e.arrayOffsets;let y;T!==void 0&&(y=s[T]);const O=e.arrayOffsetType??"UINT32",d=e.stringOffsets;let i;d!==void 0&&(i=s[d]);const m=e.stringOffsetType??"UINT32",t=o.createPropertyTableProperty();return t.setArrayOffsetType(O),t.setStringOffsetType(m),t.setOffset(e.offset),t.setScale(e.scale),t.setMax(e.max),t.setMin(e.min),t.setValues(P),y&&t.setArrayOffsets(y),i&&t.setStringOffsets(i),t}}export{b as StructuralMetadataPropertyTables};//# sourceMappingURL=StructuralMetadataPropertyTables.js.map
//# sourceMappingURL=StructuralMetadataPropertyTables.js.map