Skip to content

Commit

Permalink
feat: expose streamer objects
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jun 23, 2024
1 parent 070cd93 commit 988f92e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.0.17",
"version": "2.0.18",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/Components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Components implements Disposable {
/**
* The version of the @thatopen/components library.
*/
static readonly release = "2.0.14";
static readonly release = "2.0.18";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
2 changes: 1 addition & 1 deletion packages/front/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components-front",
"description": "Collection of frontend tools to author BIM apps.",
"version": "2.0.16",
"version": "2.0.17",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
2 changes: 2 additions & 0 deletions packages/front/src/fragments/IfcStreamer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
StreamLoaderSettings,
} from "./src";

export * from "./src";

/**
* The IfcStreamer component is responsible for managing and streaming tiled IFC data. It provides methods for loading, removing, and managing IFC models, as well as handling visibility and caching. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Front/IfcStreamer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components-front/classes/IfcStreamer).
*/
Expand Down
20 changes: 18 additions & 2 deletions packages/front/src/fragments/IfcStreamer/src/streamer-db.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
import Dexie from "dexie";

/**
* Interface representing a streamed file.
*/
interface IStreamedFile {
/**
* Unique identifier for the file.
*/
id: string;

/**
* The file content as a Uint8Array.
*/
file: Uint8Array;
}

/**
* A class representing a database for storing streamed files. It extends Dexie, a minimalistic wrapper for IndexedDB.
*/
export class StreamFileDatabase extends Dexie {
// Declare implicit table properties.
// (just to inform Typescript. Instantiated by Dexie in stores() method)
/**
* Declare implicit table properties.
* (Just to inform Typescript. Instantiated by Dexie in stores() method)
* @type {Dexie.Table<IStreamedFile, string>}
*/
files!: Dexie.Table<IStreamedFile, string>; // number = type of the primkey

constructor() {
Expand Down
45 changes: 45 additions & 0 deletions packages/front/src/fragments/IfcStreamer/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,66 @@
import * as OBC from "@thatopen/components";

/**
* Represents an instance of a streamed object.
*/
export interface StreamedInstance {
/**
* Unique identifier of the instance.
*/
id: number;

/**
* Color of the instance.
*/
color: number[];

/**
* Transformation matrix of the instance.
*/
transformation: number[];
}

/**
* A map of streamed instances, grouped by their unique identifier.
*/
export type StreamedInstances = Map<number, StreamedInstance[]>;

/**
* Settings for the stream loader.
*/
export interface StreamLoaderSettings {
/**
* Array of streamed assets.
*/
assets: OBC.StreamedAsset[];

/**
* Streamed geometries.
*/
geometries: OBC.StreamedGeometries;

/**
* Identifier of the global data file.
*/
globalDataFileId: string;
}

/**
* Settings for the stream properties.
*/
export interface StreamPropertiesSettings {
/**
* Map of identifiers to numbers.
*/
ids: { [id: number]: number };

/**
* Map of types to arrays of numbers.
*/
types: { [type: number]: number[] };

/**
* Identifier of the indexes file.
*/
indexesFile: string;
}

0 comments on commit 988f92e

Please sign in to comment.