InstanceGraphAPI

Interface InstanceGraphAPI

With the InstanceGraphAPI the content of webvis can be controlled and manipulated. It resembles a scene graph like tree structure of Nodes. Every Node can contain links to 3D geometry and/or group other Nodes.

The get- and set-Property functions allow setting and retrieving properties of arbitrary type on the Nodes. Properties are used to modify any Node dependent data like color, local transformation, etc. There is a set of predefined Node properties that webvis will react on, but the surrounding application might add any other property to the Nodes.

interface InstanceGraphAPI {
    add(options: AddNodeOptions): number;
    add(
        dataURI: string,
        parentID?: number,
        usage?: UsageString,
        label?: string,
        contentType?: string,
        initialProperties?: InitialNodeProperties,
        cacheStrategy?: CacheStrategy,
    ): number;
    addCustomNode(
        customNodeType: string,
        data: any,
        dataType?: AttachmentType,
    ): number;
    collectRuntimeNodesOfType(nodeType: NodeType, subType?: string): number[];
    getEnabledAuxNodes(nodeID?: number): Promise<number[]>;
    getMetadata(nodeID: number): Promise<{ [key: string]: string }>;
    getProperties<T extends string>(
        nodeID: number,
        properties: T[],
    ): Promise<PropertyType<T>[]>;
    getProperty<T extends string>(
        nodeID: number,
        property: T,
    ): Promise<PropertyType<T>>;
    getRootNodeId(
        target: number | TopologyHandle,
        includeTarget?: boolean,
    ): number;
    getStatistics(
        nodeType?: NodeType,
        nodeID?: number,
        recursive?: boolean,
    ): Promise<any>;
    invertEnabledStates(): void;
    isNodeDeletable(nodeID: number): boolean;
    isNodeType(nodeID: number, nodeType: NodeType): boolean;
    registerCustomProperty(
        name: string,
        defaultValue: any,
        recursive?: boolean,
    ): void;
    remove(nodeID?: number | number[], safe?: boolean): Promise<RemoveState>;
    requestActiveSceneVolume(): Promise<BoxVolume>;
    requestAuxRootNodeIds(scopeNodeId?: number): Promise<number[]>;
    requestFullSceneVolume(): Promise<BoxVolume>;
    requestL3DInformation(targetNodeId: number): Promise<any>;
    requestNodeIdsByBoxVolume(
        boxVolume: BoxVolume,
        includeOverlappingNodes?: boolean,
        includeDisabledNodes?: boolean,
        forceExpand?: boolean,
        scopeNodeId?: number,
    ): Promise<number[]>;
    requestRootNodeIds(
        scopeNodeId?: number,
        recursive?: boolean,
    ): Promise<number[]>;
    resetProperties<T extends string>(
        nodeID: number,
        properties: T[],
        recursive?: boolean,
    ): Promise<void>;
    resetProperty<T extends string>(
        nodeID: number,
        property: T,
        recursive?: boolean,
    ): Promise<void>;
    setParent(nodeID: number, newParentID: number): void;
    setProperty<T extends string>(
        nodeID: number | number[],
        property: T,
        value: PropertyType<T>,
        silent?: boolean,
    ): Promise<void>;
}

Hierarchy (View Summary)

Methods

  • Adds a new Node to the InstanceGraph.

    Parameters

    Returns number

    The id of added Node

  • Parameters

    • dataURI: string

      Specifies the URI to the data resource.

    • OptionalparentID: number

      Specifies the parent Node ID of the added Node.

    • Optionalusage: UsageString

      The usage parameter allows to define how the resource should be inserted in the InstanceGraph.

    • Optionallabel: string

      Specifies a custom label for the added Node.

    • OptionalcontentType: string

      Specifies the MimeType of the data resource.

    • OptionalinitialProperties: InitialNodeProperties

      Specifies initialProperties of the added Node.

    • OptionalcacheStrategy: CacheStrategy

      Specifies the strategy which is used when a data cache is requested from the Hub.

    Returns number

    The id of added Node

    Adds a new Node to the InstanceGraph.

  • Creates a custom Node with custom data which is stored in an Attachment.

    Parameters

    • customNodeType: string

      {string} Specifies the custom Node type.

    • data: any

      {any} Specifies the data of the custom Node.

    • OptionaldataType: AttachmentType

      {AttachmentType="json"} Specifies the type of the data.

    Returns number

  • Returns a list of all existing runtime Node ids of a specified type.

    Parameters

    • nodeType: NodeType

      The Node type to collect.

    • OptionalsubType: string

      The sub type to collect. Only used for Custom-Nodes.

    Returns number[]

    A list of runtime Node ids of the specified type.

  • Parameters

    • OptionalnodeID: number

      Specifies the entry point of the subtree traversal (default: 0)

    Returns Promise<number[]>

    An Array of all enabled aux Node id's

    This function will no longer be available in future webvis releases

    Traverses the subtree of a given nodeID and collects all enabled aux Nodes.

  • Returns a JSON object containing the metadata for the given nodeID.

    Parameters

    • nodeID: number

      The id of a Node.

    Returns Promise<{ [key: string]: string }>

    A JSON object containing the requested metadata.

  • Returns the values of the properties on the Node with the matching id.

    Type Parameters

    • T extends string

    Parameters

    • nodeID: number

      The id of the Node whose properties should be read.

    • properties: T[]

      The names of the properties whose value should be read.

    Returns Promise<PropertyType<T>[]>

    The retrieved values of the Node's properties.

  • Returns the value of the property on the Node with the matching id.

    Type Parameters

    • T extends string

    Parameters

    • nodeID: number

      The id of the Node whose property should be read.

    • property: T

      The name of the property whose value should be read.

    Returns Promise<PropertyType<T>>

    The retrieved value of the Node property.

  • Returns the root Node id of the given Node or Topology Element.

    Parameters

    • target: number | TopologyHandle

      Specifies the target Node or Topology Element.

    • OptionalincludeTarget: boolean

      Controls if the target Node itself can be returned as root Node. If set to false and a root Node id is passed in, it returns the next higher root Node id.

    Returns number

    • The root Node id of the given Node id or Topology handle.
  • Traverses the subtree of a given nodeID and collects all statistics (currently only available for AUX-Nodes).

    Parameters

    • OptionalnodeType: NodeType

      Specifies the target Node type.

    • OptionalnodeID: number

      Specifies the entry point of the subtree traversal (default: 0).

    • Optionalrecursive: boolean

    Returns Promise<any>

    An Object of Type/Count pairs.

  • Inverts all enabled states.

    Returns void

  • Parameters

    • nodeID: number

    Returns boolean

    Returns true if a Node is deletable.

  • Parameters

    Returns boolean

    Checks the Node's type for the given Node id.

  • Registering a new custom property.

    Parameters

    • name: string

      The name of the new property.

    • defaultValue: any

      Specifies the default value.

    • Optionalrecursive: boolean

      Defines whether the property is recursive.

    Returns void

  • Removes the Node for the given nodeID from the Scene and all related Snapshots. If no nodeID is supplied all Nodes are deleted.

    Parameters

    • OptionalnodeID: number | number[]

      The id of the Node that should be removed.

    • Optionalsafe: boolean

      Performs a safe remove which interrupt the removal process if the Node is part of one or more Snapshots.

    Returns Promise<RemoveState>

  • Returns the active volume of currently loaded scene.

    Returns Promise<BoxVolume>

    The active volume of currently loaded scene.

  • Returns a list of all existing aux root Node ids below the specified subtree.

    Parameters

    • OptionalscopeNodeId: number

      Specifies the top one Node id of the subtree to be searched.

    Returns Promise<number[]>

    A list of aux root Node ids.

  • Returns the full volume of currently loaded scene.

    Returns Promise<BoxVolume>

    • The full volume of currently loaded scene.
  • Returns the L3D information of the specified Node.

    Parameters

    • targetNodeId: number

      Specifies the target Node id.

    Returns Promise<any>

    The L3D information of the specified Node

  • Returns a List of all Node ids which are included or overlapped by the specified 3D world space Bounding Volume.

    Parameters

    • boxVolume: BoxVolume

      Specifies the 3D world space Bounding Volume.

    • OptionalincludeOverlappingNodes: boolean

      Specifies that the result should include Nodes which overlap the specified 3D world space Bounding Volume as well.

    • OptionalincludeDisabledNodes: boolean

      Specifies that the result should include Nodes which are disabled as well.

    • OptionalforceExpand: boolean
    • OptionalscopeNodeId: number

      Specifies the top one Node id of the subtree to be searched.

    Returns Promise<number[]>

    List of all NodeIds which are included or overlapped by the specified 3D world space Bounding Volume.

  • Returns a list of all existing root Node ids below the specified subtree.

    Parameters

    • OptionalscopeNodeId: number

      Specifies the top one Node id of the subtree to be searched.

    • Optionalrecursive: boolean

      Specifies if the subtree is traversed recursively.

    Returns Promise<number[]>

    A list of root Node ids.

  • Resets the value of the specified properties on the given Node.

    Type Parameters

    • T extends string

    Parameters

    • nodeID: number

      The id of the Node whose property should be reset.

    • properties: T[]

      List of properties which should be reset.

    • Optionalrecursive: boolean

      If set to true, the properties are reset recursively.

    Returns Promise<void>

  • Resets the value of the property on the Node with the matching id.

    Type Parameters

    • T extends string

    Parameters

    • nodeID: number

      The id of the Node whose property should be reset.

    • property: T

      Property which should be reset.

    • Optionalrecursive: boolean

      If set to true, the properties are reset recursively.

    Returns Promise<void>

  • Parameters

    • nodeID: number
    • newParentID: number

    Returns void

  • Sets the property named property to value on the Node with id nodeID.

    Type Parameters

    • T extends string

    Parameters

    • nodeID: number | number[]

      The id of the Node whose property has to be set.

    • property: T

      The name of the property that has to be set.

    • value: PropertyType<T>

      The new value of the specified property.

    • Optionalsilent: boolean

      The silent flag indicates that no NODE_CHANGED event is fired.

    Returns Promise<void>


Did you find this page useful? Please give it a rating:
Thank you for rating this page!
Any issues or feedback?
What kind of problem would you like to report?
Please tell us more about what's wrong: