Skip to content

Commit

Permalink
BCF refactor, plus tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Jan 9, 2024
1 parent 29404a6 commit c1d1133
Show file tree
Hide file tree
Showing 28 changed files with 1,244 additions and 609 deletions.
90 changes: 56 additions & 34 deletions packages/bcf/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,64 @@ module.exports = {
transform: {
"^.+\\.(t|j)sx?$": ["@swc/jest"],
},
moduleNameMapper: {

moduleNameMapper: {
"@xeokit/basictypes/(.*)$": path.join(__dirname, "../basictypes/src/$1"),
"@xeokit/bcf/(.*)$": path.join(__dirname, "../bcf/src/$1"),
"@xeokit/boundaries/(.*)$": path.join(__dirname, "../boundaries/src/$1"),
"@xeokit/bundle/(.*)$": path.join(__dirname, "../bundle/src/$1"),
"@xeokit/cameracontrol/(.*)$": path.join(__dirname, "../cameracontrol/src/$1"),
"@xeokit/cityjson/(.*)$": path.join(__dirname, "../cityjson/src/$1"),
"@xeokit/cityjson2xkt/(.*)$": path.join(__dirname, "../cityjson2xkt/src/$1"),
"@xeokit/cityjsontypes_1_1_3/(.*)$": path.join(__dirname, "../cityjsontypes_1_1_3/src/$1"),
"@xeokit/compression(.*)$": path.join(__dirname, "../compression/src/$1"),
"@xeokit/constants(.*)$": path.join(__dirname, "../constants/src/$1"),
"@xeokit/core(.*)$": path.join(__dirname, "../core/src/$1"),
"@xeokit/curves(.*)$": path.join(__dirname, "../curves/src/$1"),
"@xeokit/data/(.*)$": path.join(__dirname, "../data/src/$1"),
"@xeokit/core(.*)$": path.join(__dirname, "../core/src/components$1"),
"@xeokit/utils(.*)$": path.join(__dirname, "../core/src/utils$1"),
"@xeokit/constants(.*)$": path.join(__dirname, "../core/src/constants$1"),
"@xeokit/math(.*)$": path.join(__dirname, "../math/src/math$1"),
"@xeokit/boundaries(.*)$": path.join(__dirname, "../math/src/boundaries$1"),
"@xeokit/curves(.*)$": path.join(__dirname, "../math/src/curves$1"),
"@xeokit/frustum(.*)$": path.join(__dirname, "../math/src/frustum$1"),
"@xeokit/compression(.*)$": path.join(__dirname, "../math/src/compression$1"),
"@xeokit/matrix(.*)$": path.join(__dirname, "../math/src/matrix$1"),
"@xeokit/ray(.*)$": path.join(__dirname, "../math/src/ray$1"),
"@xeokit/rtc(.*)$": path.join(__dirname, "../math/src/rtc$1"),

//
// "@xeokit/rtc": ["math/src/rtc"],
// "@xeokit/viewer": ["viewer/src"],
// "@xeokit/webglutils": ["webglutils/src"],
// "@xeokit/webglrenderer": ["webglrenderer/src"],

"@xeokit/basictypes/basicTypes": path.join(__dirname, "../datatypes/src/basicTypes"),
"@xeokit/ifctypes(.*)$": path.join(__dirname, "../datatypes/src/ifcTypes"),
//
// "@xeokit/xkt": ["xkt/src"],
// "@xeokit/las": ["las/src"],
// "@xeokit/gltf": ["gltf/src"],
// "@xeokit/locale": ["locale/src"],
// "@xeokit/compression": ["compression/src"],
// "@xeokit/procgen": ["procgen/src/geometry"],
// "@xeokit/ktx2": ["ktx2/src"],
// "@xeokit/bcf": ["bcf/src"],
// "@xeokit/controls": ["controls/src"],
// "@xeokit/scene": ["scene/src"],
// "@xeokit/treeview": ["treeview/src"]
"@xeokit/dotbim/(.*)$": path.join(__dirname, "../data/src/$1"),
"@xeokit/gltf/(.*)$": path.join(__dirname, "../gltf/src/$1"),
"@xeokit/gltf2xkt/(.*)$": path.join(__dirname, "../gltf2xkt/src/$1"),
"@xeokit/ifc2xkt/(.*)$": path.join(__dirname, "../ifc2xkt/src/$1"),
"@xeokit/kdtree2/(.*)$": path.join(__dirname, "../kdtree2/src/$1"),
"@xeokit/kdtree3/(.*)$": path.join(__dirname, "../kdtree3/src/$1"),
"@xeokit/ktx2/(.*)$": path.join(__dirname, "../ktx2/src/$1"),
"@xeokit/las/(.*)$": path.join(__dirname, "../las/src/$1"),
"@xeokit/las2xkt/(.*)$": path.join(__dirname, "../las2xkt/src/$1"),
"@xeokit/locale/(.*)$": path.join(__dirname, "../locale/src/$1"),
"@xeokit/math(.*)$": path.join(__dirname, "../math/src/$1"),
"@xeokit/matrix(.*)$": path.join(__dirname, "../matrix/src/$1"),
"@xeokit/mockrenderer(.*)$": path.join(__dirname, "../mockrenderer/src/$1"),
"@xeokit/pick(.*)$": path.join(__dirname, "../pick/src/$1"),
"@xeokit/procgen(.*)$": path.join(__dirname, "../procgen/src/$1"),
"@xeokit/rtc(.*)$": path.join(__dirname, "../rtc/src/$1"),
"@xeokit/scene(.*)$": path.join(__dirname, "../scene/src/$1"),
"@xeokit/threedxml(.*)$": path.join(__dirname, "../threedxml/src/$1"),
"@xeokit/treeview(.*)$": path.join(__dirname, "../treeview/src/$1"),
"@xeokit/utils(.*)$": path.join(__dirname, "../utils/src/$1"),
"@xeokit/viewer(.*)$": path.join(__dirname, "../viewer/src/$1"),
"@xeokit/webglrenderer(.*)$": path.join(__dirname, "../webglrenderer/src/$1"),
"@xeokit/webglutils(.*)$": path.join(__dirname, "../webglutils/src/$1"),
"@xeokit/webgpu(.*)$": path.join(__dirname, "../webgpu/src/$1"),
"@xeokit/webgpurenderer(.*)$": path.join(__dirname, "../webgpurenderer/src/$1"),
"@xeokit/webifc(.*)$": path.join(__dirname, "../webifc/src/$1"),
"@xeokit/ifcviewer(.*)$": path.join(__dirname, "../ifcviewer/src/$1")
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
resolver: undefined
resolver: undefined,
silent: false,

"runner": "@kayahr/jest-electron-runner",
"testEnvironment": "@kayahr/jest-electron-runner/environment",
"testEnvironmentOptions": {
"electron": {
"options": [
"no-sandbox",
"ignore-certificate-errors",
"force-device-scale-factor=1"
],
"disableHardwareAcceleration": false
}
}

};
5 changes: 4 additions & 1 deletion packages/bcf/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@xeokit/bcf",
"private": true,
"type": "module",
"version": "1.0.1-alpha.0",
"description": "Loads and saves xeokit Viewer snapshots as JSON-encoded BIM Collaboration Format (BCF) Viewpoints",
"main": "src/index.ts",
Expand All @@ -24,5 +23,9 @@
"keywords": [],
"dependencies": {
"@xeokit/viewer": "^1.0.1-alpha.0"
},
"devDependencies": {
"jest-electron": "^0.1.12",
"@kayahr/jest-electron-runner": "^29.11.0"
}
}
37 changes: 37 additions & 0 deletions packages/bcf/src/BCFBitmap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {BCFVector} from "./BCFVector";

/**
* BCF bitmap.
*/
export interface BCFBitmap {

/**
* BCF bitmap type.
*/
bitmap_type: string,

/**
* BCF bitmap data.
*/
bitmap_data: string,

/**
* BCF bitmap location.
*/
location: BCFVector,

/**
* BCF bitmap normal direction.
*/
normal: { x: 0, y: 0, z: -1 },

/**
* BCF bitmap up direction.
*/
up: { x: 0, y: -1, z: 0 },

/**
* BCF bitmap height.
*/
height: 24
}
37 changes: 37 additions & 0 deletions packages/bcf/src/BCFClippingPlane.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {BCFVector} from "./BCFVector";

/**
* BCF clipping plane.
*/
export interface BCFClippingPlane {

/**
* BCF clipping plane bitmap MIME type.
*/
bitmap_type?: string,

/**
* BCF clipping plane bitmap data.
*/
bitmap_data?: string,

/**
* BCF clipping plane location.
*/
location: BCFVector,

/**
* BCF clipping plane direction.
*/
direction: BCFVector,

/**
* BCF clipping plane up direction.
*/
up: BCFVector,

/**
* BCF clipping plane height.
*/
height: number
}
18 changes: 18 additions & 0 deletions packages/bcf/src/BCFColoringComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {BCFComponent} from "./BCFComponent";

/**
* TODO
*/
export interface BCFColoringComponent {

/**
* TODO
*/
components: BCFComponent[];

/**
* TODO
*/
color: string;

}
20 changes: 20 additions & 0 deletions packages/bcf/src/BCFComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* TODO
*/
export interface BCFComponent {

/**
* TODO
*/
"ifc_guid": string,

/**
* TODO
*/
"originating_system"?: string,

/**
* TODO
*/
"authoring_tool_id"?: string
}
29 changes: 29 additions & 0 deletions packages/bcf/src/BCFComponents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {BCFColoringComponent} from "./BCFColoringComponent";
import {BCFVisibilityComponent} from "./BCFVisibilityComponent";
import {BCFComponent} from "./BCFComponent";

/**
* TODO
*/
export interface BCFComponents {

/**
* TODO
*/
coloring: BCFColoringComponent[];

/**
* TODO
*/
visibility?: BCFVisibilityComponent;

/**
* TODO
*/
selection?: BCFComponent[];

/**
* TODO
*/
translucency: BCFComponent[];
}
17 changes: 17 additions & 0 deletions packages/bcf/src/BCFLine.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {BCFVector} from "./BCFVector";

/**
* BCF line segment.
*/
export interface BCFLine {

/**
* BCF line segment start point.
*/
"start_point": BCFVector,

/**
* BCF line segment end point.
*/
"end_point": BCFVector
}
28 changes: 28 additions & 0 deletions packages/bcf/src/BCFOrthogonalCamera.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {BCFVector} from "./BCFVector";

/**
* BCF orthogonal camera.
*/
export interface BCFOrthogonalCamera {

/**
* BCF orthogonal camera viewpoint.
*/
camera_view_point: BCFVector;

/**
* BCF orthogonal camera direction.
*/
camera_direction: BCFVector;

/**
* BCF orthogonal camera "up".
*/
camera_up_vector: BCFVector;

/**
* BCF orthogonal camera view-to-world scale.
*/
view_to_world_scale: number;

}
27 changes: 27 additions & 0 deletions packages/bcf/src/BCFPerspectiveCamera.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {BCFVector} from "./BCFVector";

/**
* BCF perspective camera.
*/
export interface BCFPerspectiveCamera {

/**
* BCF perspective camera viewpoint.
*/
camera_view_point: BCFVector,

/**
* BCF perspective camera direction.
*/
camera_direction: BCFVector,

/**
* BCF perspective camera "up".
*/
camera_up_vector: BCFVector,

/**
* BCF perspective camera field-of-view.
*/
field_of_view: number
}
17 changes: 17 additions & 0 deletions packages/bcf/src/BCFSelectionComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {BCFComponent} from "./BCFComponent";

/**
* TODO
*/
export interface BCFSelectionComponent {

/**
* TODO
*/
default_selection: boolean,

/**
* TODO
*/
exceptions: BCFComponent[]
}
15 changes: 15 additions & 0 deletions packages/bcf/src/BCFSnapshot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* TODO
*/
export interface BCFSnapshot {

/**
* TODO
*/
snapshot_type: "png" | "jpeg",

/**
* TODO
*/
snapshot_data: string
}
Loading

0 comments on commit c1d1133

Please sign in to comment.