Created
March 30, 2025 09:41
-
-
Save xeolabs/fce5292286a8f8c046e1a5e52066e2af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '@loaders.gl/polyfills';/**/ | |
import {Converter} from "../io"; | |
import {GLTFReader} from "../gltf"; | |
import {DotBIMReader, DotBIMWriter} from "../dotbim"; | |
import {WebIFCLoader} from "../webifc"; | |
import {CityJSONReader} from "../cityjson"; | |
import {XKTReader} from "../xkt"; | |
import {XGFReader, XGFWriter} from "../xgf"; | |
import {LASReader} from "../las"; | |
import {FloatArrayParam} from "../math"; | |
export function getConverter(options: any): Promise<Converter> { | |
return new Promise<Converter>((resolve, reject) => { | |
const converter = new Converter({ | |
readers: { | |
"dotbim": new DotBIMReader(), | |
// "ifc": new WebIFCLoader({ | |
// | |
// }), | |
"glb": new GLTFReader(), | |
"cityjson": new CityJSONReader(), | |
"xkt": new XKTReader(), | |
"xgf": new XGFReader(), | |
"las": new LASReader() | |
}, | |
writers: { | |
"xgf": new XGFWriter(), | |
"dotbim": new DotBIMWriter() | |
}, | |
pipelines: { | |
"gltf2xgf": { | |
input: { | |
reader: "gltf", | |
fileExtensions: ["glb", "gltf"], | |
options: {} | |
}, | |
output: { | |
writer: "xgf", | |
version: "1.0", | |
options: {}, | |
autoDataModel: true | |
} | |
}, | |
"ifc2xgf": { | |
input: { | |
reader: "ifc", | |
fileExtensions: ["ifc"], | |
options: {} | |
}, | |
output: { | |
writer: "xgf", | |
version: "1.0", | |
options: {}, | |
autoDataModel: true | |
} | |
}, | |
"ifc2dotbim": { | |
input: { | |
reader: "ifc", | |
fileExtensions: ["ifc"], | |
options: {} | |
}, | |
output: { | |
writer: "dotbim", | |
version: "1.1", | |
options: {} | |
} | |
}, | |
"dotbim2xgf": { | |
input: { | |
reader: "dotbim", | |
fileExtensions: ["bim"], | |
options: {} | |
}, | |
output: { | |
writer: "xgf", | |
version: "1.0", | |
options: {}, | |
autoDataModel: true | |
} | |
}, | |
"las2xgf": { | |
input: { | |
reader: "las", | |
fileExtensions: ["las", "laz"], | |
options: { | |
center: false, | |
transform: [ | |
1, 0, 0, 0, | |
0, 1, 0, 0, | |
0, 0, 1, 0, | |
0, 0, 0, 1 | |
], | |
skip: 1, | |
fp64: false, | |
colorDepth: "auto" | |
} | |
}, | |
output: { | |
writer: "xgf", | |
version: "1.0", | |
options: {}, | |
autoDataModel: true | |
} | |
}, | |
"cityjson2xgf": { | |
input: { | |
reader: "cityjson", | |
fileExtensions: ["json"], | |
options: {} | |
}, | |
output: { | |
writer: "xgf", | |
version: "1.0", | |
options: {}, | |
autoDataModel: true | |
} | |
} | |
} | |
}); | |
resolve(converter); | |
}); | |
} | |
converter.convert({ | |
pipeline: "gltf2xkt", | |
sourceFileData: null | |
}).then(conversionResults => { | |
}).catch(reason => { | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment