Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BCFViewpointsPlugin

Viewer plugin that saves and loads BCF viewpoints as JSON objects.

Hierarchy

Index

Constructors

Properties

authoringTool: string

Identifies the authoring tool to include in BCF viewpoints saved by this plugin.

id: string

ID for this Plugin, unique within its Viewer.

originatingSystem: string

Identifies the originating system to include in BCF viewpoints saved by this plugin.

viewer: Viewer

The Viewer that contains this Plugin.

Methods

  • destroy(): void
  • error(msg: string): void
  • Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

    Parameters

    • msg: string

      The error message

    Returns void

  • fire(event: string, value: any): void
  • Fires an event at this Plugin.

    Parameters

    • event: string

      The event type name

    • value: any

      The event parameters

    Returns void

  • getViewpoint(options?: any): any
  • Saves viewer state to a BCF viewpoint.

    Note that xeokit's Camera.look is the point-of-interest, whereas the BCF camera_direction is a direction vector. Therefore, we save camera_direction as the vector from Camera.eye to Camera.look.

    example

    const viewer = new Viewer();

    const bcfPlugin = new BCFPlugin(viewer, { //... });

    const viewpoint = bcfPlugin.getViewpoint({ // Options - see constructor spacesVisible: false, // Default spaceBoundariesVisible: false, // Default openingsVisible: false // Default });

    // viewpoint will resemble the following:

    { perspective_camera: { camera_view_point: { x: 0.0, y: 0.0, z: 0.0 }, camera_direction: { x: 1.0, y: 1.0, z: 2.0 }, camera_up_vector: { x: 0.0, y: 0.0, z: 1.0 }, field_of_view: 90.0 }, lines: [], clipping_planes: [{ location: { x: 0.5, y: 0.5, z: 0.5 }, direction: { x: 1.0, y: 0.0, z: 0.0 } }], bitmaps: [], snapshot: { snapshot_type: png, snapshot_data: "data:image/png;base64,......" }, components: { visibility: { default_visibility: false, exceptions: [{ ifc_guid: 4$cshxZO9AJBebsni$z9Yk, originating_system: xeokit.io, authoring_tool_id: xeokit/v1.0 }] }, selection: [{ ifc_guid: "4$cshxZO9AJBebsni$z9Yk", }] } }

    Parameters

    • Optional options: any

    Returns any

    BCF JSON viewpoint object

  • log(msg: string): void
  • Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

    Parameters

    • msg: string

      The error message

    Returns void

  • on(event: string, callback: () => void): void
  • Subscribes to an event fired at this Plugin.

    Parameters

    • event: string

      The event

    • callback: () => void

      Callback fired on the event

        • (): void
        • Returns void

    Returns void

  • setViewpoint(bcfViewpoint: any, options?: any): void
  • Sets viewer state to the given BCF viewpoint.

    Note that xeokit's Camera.look is the point-of-interest, whereas the BCF camera_direction is a direction vector. Therefore, when loading a BCF viewpoint, we set Camera.look to the absolute position obtained by offsetting the BCF camera_view_point along camera_direction.

    When loading a viewpoint, we also have the option to find Camera.look as the closest point of intersection (on the surface of any visible and pickable Entity) with a 3D ray fired from camera_view_point in the direction of camera_direction.

    Parameters

    • bcfViewpoint: any

      BCF JSON viewpoint object, shows default visible entities and restores camera to initial default position.

    • Optional options: any

    Returns void

  • warn(msg: string): void
  • Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

    Parameters

    • msg: string

      The error message

    Returns void

Generated using TypeDoc