From 5f142613cbedafd37098e390d5dff61f0ef8c46a Mon Sep 17 00:00:00 2001 From: lindsay Date: Mon, 29 Jul 2024 01:25:09 +0200 Subject: [PATCH] Documentation --- packages/bcf/src/SaveBCFViewpointParams.ts | 44 ++++++++++++++++++++-- packages/bcf/src/index.ts | 20 +++++----- packages/bcf/src/loadBCFViewpoint.ts | 2 +- packages/bcf/src/saveBCFViewpoint.ts | 2 +- packages/bcf/tsconfig.json | 2 +- packages/scene/src/SceneTile.ts | 30 +++++++++++++-- packages/scene/src/SceneTransformParams.ts | 4 +- 7 files changed, 83 insertions(+), 21 deletions(-) diff --git a/packages/bcf/src/SaveBCFViewpointParams.ts b/packages/bcf/src/SaveBCFViewpointParams.ts index 7c001cf1a..11c6743ba 100644 --- a/packages/bcf/src/SaveBCFViewpointParams.ts +++ b/packages/bcf/src/SaveBCFViewpointParams.ts @@ -8,27 +8,65 @@ import type {View} from "@xeokit/viewer"; export interface SaveBCFViewpointParams { defaultInvisible?: boolean; + + /** + * Whether to capture a snapshot image in the BCF viewpoint. + * + * The snapshot would be saved in {@link @xeokit/bcf!BCFViewpoint.snapshot | BCFViewpoint.snapshot}. + */ snapshot?: boolean; + + /** + * Identifies the system that authors this BCF viewpoint. + */ originatingSystem?: string; + + /** + * Whether to flip the direction of the {@link @xeokit/viewer!SectionPlane | SectionPlanes} captured in the BCF viewpoint. + */ reverseClippingPlanes?: boolean; + + /** + * Value to set on {@link @xeokit/bcf!BCFSetupHints.openings_translucent | BCFSetupHints.openings_translucent} within the BCF viewpoint. + */ openings_translucent?: boolean; + + /** + * Value to set on {@link @xeokit/bcf!BCFSetupHints.space_boundaries_translucent | BCFSetupHints.space_boundaries_translucent} within the BCF viewpoint. + */ space_boundaries_translucent?: boolean; + + /** + * Value to set on {@link @xeokit/bcf!BCFSetupHints.spaces_translucent | BCFSetupHints.spaces_translucent} within the BCF viewpoint. + */ spaces_translucent?: boolean; + + /** + * Value to set on {@link @xeokit/bcf!BCFSetupHints.openingsVisible | BCFSetupHints.openingsVisible} within the BCF viewpoint. + */ openingsVisible?: boolean; + + /** + * Value to set on {@link @xeokit/bcf!BCFSetupHints.spaceBoundariesVisible | BCFSetupHints.spaceBoundariesVisible} within the BCF viewpoint. + */ spaceBoundariesVisible?: boolean; + + /** + * Value to set on {@link @xeokit/bcf!BCFSetupHints.spacesVisible | BCFSetupHints.spacesVisible} within the BCF viewpoint. + */ spacesVisible?: boolean; /** - * A {@link @xeokit/viewer!View | View} to save as a BCF viewpoint. + * The {@link @xeokit/viewer!View | View} to save as a BCF viewpoint. * * This will save component states in the BCF (see {@link @xeokit/bcf!BCFComponents}) for all - * {@link @xeokit/viewer!ViewObject | ViewObjects} in the given target View. + * {@link @xeokit/viewer!ViewObject | ViewObjects} in this View. */ view: View; /** * Only save BCF viewpoint components if their corresponding {@link @xeokit/viewer!ViewObject | ViewObjects} - * are in {@link @xeokit/viewer!ViewLayer | ViewLayers} that have the given IDs. + * are in {@link @xeokit/viewer!ViewLayer | ViewLayers} that match these IDs. * * The {@link @xeokit/bcf!saveBCFViewpoint} function will silently ignore each component state that has no corresponding * ViewObject in any of these ViewLayers. diff --git a/packages/bcf/src/index.ts b/packages/bcf/src/index.ts index f18ff2ef4..3b21f73cb 100644 --- a/packages/bcf/src/index.ts +++ b/packages/bcf/src/index.ts @@ -1,7 +1,7 @@ /** * [![npm version](https://badge.fury.io/js/%40xeokit%2Fbcf.svg)](https://badge.fury.io/js/%40xeokit%2Fbcf) * [![](https://data.jsdelivr.com/v1/package/npm/@xeokit/bcf/badge)](https://www.jsdelivr.com/package/npm/@xeokit/bcf) - * + * * * * # xeokit BCF Viewpoint Importer and Exporter @@ -48,7 +48,7 @@ * * create a {@link @xeokit/scene!Scene | Scene} and a {@link @xeokit/data!Data | Data}, * * initialize a Viewer with the Scene and a {@link @xeokit/webglrenderer!WebGLRenderer | WebGLRenderer}, * * create a new {@link @xeokit/viewer!View | View}, {@link @xeokit/scene!SceneModel | SceneModel} and {@link @xeokit/data!DataModel | DataModel}, - * * load a [DTX](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#dtx) file using the {@link @xeokit/dtx!loadDTX | loadDTX} function, and + * * load a [XKT](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#xkt) file using the {@link @xeokit/xkt!loadXKT | loadXKT} function, and * * build the Scene and Data models, rendering the 3D model in the web browser. * * ````javascript @@ -56,7 +56,7 @@ * import {Data} from "@xeoki/data"; * import {Viewer} from "@xeokit/viewer"; * import {WebGLRenderer} from "@xeokit/webglrenderer"; - * import {loadDTX} from "@xeokit/loadDTX"; + * import {loadXKT} from "@xeokit/xkt"; * import {saveBCFViewpoint, loadBCFViewpoint} from "@xeokit/bcf"; * import * as ifcTypes from "@xeokit/ifctypes"; * @@ -81,10 +81,10 @@ * id: "myModel" * }); * - * fetch("myModel.dtx").then(response => { + * fetch("myModel.xkt").then(response => { * response.arrayBuffer().then(data => { * - * loadDTX({ data, sceneModel, dataModel }); + * loadXKT({ data, sceneModel, dataModel }); * * sceneModel.build(); * dataModel.build(); @@ -92,20 +92,20 @@ * }); * ```` * - * When our [DTX](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#dtx) has loaded, that call to {@link @xeokit/scene!SceneModel.build | SceneModel.build} will finalize our SceneModel + * When our [XKT](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#xkt) has loaded, that call to {@link @xeokit/scene!SceneModel.build | SceneModel.build} will finalize our SceneModel * and cause it to immediately appear in the View's canvas. * * That call will also trigger {@link @xeokit/scene!SceneModel.onBuilt | SceneModel.onBuilt} and * {@link @xeokit/data!DataModel.onBuilt | DataModel.onBuilt} events. * - * On the DataModel.onBuilt event, we'll customize the View by arranging the {@link @xeokit/viewer!Camera} and applying + * On the SceneModel.onBuilt event, we'll customize the View by arranging the {@link @xeokit/viewer!Camera} and applying * an X-ray effect tp a couple of objects, then we'll use {@link @xeokit/bcf!saveBCFViewpoint} to save the state of the View to * a BCF viewpoint. * * Once the SceneModel and DataModel have been built, we can no longer add anything to them. * * ````javascript - * dataModel.onBuilt.one(()=>{ + * sceneModel.onBuilt.one(()=>{ * * view.camera.eye = [0,0,-33]; * view.camera.look = [0,0,0]; @@ -174,7 +174,7 @@ * layerId: "foreground" * }); * - * //...create some objects, load DTX etc + * //...create some objects, load XKT etc * * sceneModel.build(); * @@ -183,7 +183,7 @@ * layerId: "background" * }); * - * //...create some objects, load DTX etc + * //...create some objects, load XKT etc * * myOtherSceneModel.build(); * ```` diff --git a/packages/bcf/src/loadBCFViewpoint.ts b/packages/bcf/src/loadBCFViewpoint.ts index 9da9594d5..0ed498be0 100644 --- a/packages/bcf/src/loadBCFViewpoint.ts +++ b/packages/bcf/src/loadBCFViewpoint.ts @@ -14,7 +14,7 @@ const tempVec3b = createVec3(); const tempVec3c = createVec3(); /** - * Loads a {@link @xeokit/bcf!BCFViewpoint} into a {@link @xeokit/viewer!View | View} or a {@link @xeokit/viewer!ViewLayer | ViewLayer}. + * Loads a {@link @xeokit/bcf!BCFViewpoint} into a {@link @xeokit/viewer!View | View}. * * See {@link "@xeokit/bcf" | @xeokit/bcf} for usage. * diff --git a/packages/bcf/src/saveBCFViewpoint.ts b/packages/bcf/src/saveBCFViewpoint.ts index 3cc106108..49631f5c8 100644 --- a/packages/bcf/src/saveBCFViewpoint.ts +++ b/packages/bcf/src/saveBCFViewpoint.ts @@ -6,7 +6,7 @@ import {OrthoProjectionType} from "@xeokit/constants"; import {ViewObject} from "@xeokit/viewer"; /** - * Saves a {@link @xeokit/viewer!View | View} or a {@link @xeokit/viewer!ViewLayer | ViewLayer} to a {@link @xeokit/bcf!BCFViewpoint}. + * Saves a {@link @xeokit/viewer!View | View} to a {@link @xeokit/bcf!BCFViewpoint}. * * See {@link "@xeokit/bcf" | @xeokit/bcf} for usage. * diff --git a/packages/bcf/tsconfig.json b/packages/bcf/tsconfig.json index 6c652a39a..9c2f271ca 100644 --- a/packages/bcf/tsconfig.json +++ b/packages/bcf/tsconfig.json @@ -16,4 +16,4 @@ "path": "../viewer" } ] -} \ No newline at end of file +} diff --git a/packages/scene/src/SceneTile.ts b/packages/scene/src/SceneTile.ts index ce9e2615f..4ab0b7969 100644 --- a/packages/scene/src/SceneTile.ts +++ b/packages/scene/src/SceneTile.ts @@ -6,16 +6,34 @@ import {SceneObject} from "./SceneObject"; /** * A tile in a {@link @xeokit/scene!SceneModel}. * + * + * * {@link @xeokit/scene!SceneMeshParams.origin | SceneMeshParams.origin} * * Stored in {@link @xeokit/scene!SceneModel.tiles | SceneModel.tiles} - * * Created with {@link @xeokit/scene!SceneModel.createTile | SceneModel.createTile} + * * Created automatically for each distinct value of {@link @xeokit/scene!SceneMeshParams.origin | SceneMeshParams.origin} given to {@link @xeokit/scene!SceneMeshParams.createMesh | SceneMeshParams.createMesh} + * * Each SceneTile is destroyed as soon all {@link @xeokit/scene!SceneTile | SceneTiles} with that origin heve been destroyed * * See {@link "@xeokit/scene" | @xeokit/scene} for usage. */ export class SceneTile { - public readonly scene: Scene; + /** + * Unique ID of this SceneTile. + */ public readonly id: string; + + /** + * The Scene that owns this SceneTile. + */ + public readonly scene: Scene; + + /** + * The 3D World-space origin of this SceneTile. + */ public readonly origin: FloatArrayParam; + + /** + * The number of {@link @xeokit/scene!SceneMesh | SceneMeshes} associated with this SceneTile. + */ public numObjects: number; /** @@ -27,13 +45,19 @@ export class SceneTile { public readonly models: { [key: string]: SceneModel }; /** - * The {@link @xeokit/scene!SceneObject | SceneObjects} in this TiSceneTilele, + * The {@link @xeokit/scene!SceneObject | SceneObjects} in this SceneTile, * mapped to {@link @xeokit/scene!SceneObject.id | SceneObject.id}. * * A SceneObject can belong to more than one SceneTile. */ public readonly objects: { [key: string]: SceneObject }; + /** + * @private + * @param scene + * @param id + * @param origin + */ constructor(scene: Scene, id: string, origin: FloatArrayParam) { this.scene = scene; this.id = id; diff --git a/packages/scene/src/SceneTransformParams.ts b/packages/scene/src/SceneTransformParams.ts index eaa23b8b5..15e0def28 100755 --- a/packages/scene/src/SceneTransformParams.ts +++ b/packages/scene/src/SceneTransformParams.ts @@ -1,7 +1,7 @@ import type {FloatArrayParam} from "@xeokit/math"; /** - * {@link Transform} creation parameters for {@link @xeokit/scene!SceneModel.createTransform | SceneModel.createTransform}. + * Parameters for {@link @xeokit/scene!SceneModel.createTransform | SceneModel.createTransform}. */ export interface SceneTransformParams { @@ -19,4 +19,4 @@ export interface SceneTransformParams { * 4x4 matrix that defines the transformation. */ matrix: FloatArrayParam, -} \ No newline at end of file +}