Initial commit
This commit is contained in:
commit
05c65aad4d
155 changed files with 93617 additions and 0 deletions
41
viewer/manifesto/manifesto.js
Normal file
41
viewer/manifesto/manifesto.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
export class AIM3DManifest {
|
||||
constructor(manifest) {
|
||||
if (typeof manifest === "string" && manifest.trim().startsWith("{")) {
|
||||
this.manifestJson = JSON.parse(manifest);
|
||||
this.manifestUrl = null;
|
||||
} else if (typeof manifest === "object") {
|
||||
this.manifestJson = manifest;
|
||||
this.manifestUrl = null;
|
||||
} else {
|
||||
this.manifestUrl = manifest;
|
||||
this.manifestJson = null;
|
||||
}
|
||||
}
|
||||
|
||||
async loadManifest() {
|
||||
if (this.manifestUrl) {
|
||||
const response = await fetch(this.manifestUrl);
|
||||
this.manifestJson = await response.json();
|
||||
}
|
||||
|
||||
this.manifest = this.manifestJson;
|
||||
|
||||
this.scenes = this.manifest?.items?.filter(
|
||||
item => item.type === "Scene"
|
||||
) || [];
|
||||
}
|
||||
|
||||
annotationsFromScene(scene) {
|
||||
const result = [];
|
||||
|
||||
for (const page of scene?.items || []) {
|
||||
if (page.type !== "AnnotationPage") continue;
|
||||
|
||||
for (const annotation of page.items || []) {
|
||||
result.push(annotation);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue