# DiffExtension

The default diffing functionality expose as an extension.

#

Methods

diff undiff updateVisualDiff

#

Typedefs

DiffResult VisualDiffMode

#

Methods

# diff

async diff(
    urlA: string,
    urlB: string,
    mode: VisualDiffMode,
    authToken?: string
  ): Promise<DiffResult>
1
2
3
4
5
6

Diffs the two speckle models provided as URLs. If the models are not yet loaded, they are also loaded.

Parameters

  • urlA: The 'current' model
  • urlB: The 'incoming' model
  • mode: The VisualDiffMode
  • optional authToken Used for potentially loading models

Returns: Promise <DiffResult>

# undiff

async undiff(): Promise<void>
1

Undos any visual diffing and unloads any loaded models previously loaded b diffing.

Returns: Promise< void >

# updateVisualDiff

updateVisualDiff(time?: number, mode?: VisualDiffMode): void
1

Updates the current visual diff.

Parameters:

  • optional time: A value between 0 and 1 which that is used to interpolate opacity between 'current' and 'incoming' objects
  • optional model: VisualDiffMode

Returns: void

#

Typedefs

# DiffResult

interface DiffResult {
  unchanged: Array<TreeNode>;
  added: Array<TreeNode>;
  removed: Array<TreeNode>;
  modified: Array<Array<TreeNode>>;
}
1
2
3
4
5
6
  • unchanged: All the nodes considered unchanged
  • added: All the nodes considered added
  • removed: All the nodes considered removed
  • modified: All the nodes considered modified by pairs, where the first node is from the 'current' model and second one is from the 'incoming' model

# VisualDiffMode

enum VisualDiffMode {
  PLAIN,
  COLORED,
}
1
2
3
4

With PLAIN, original materials are kept, and only made transparent. With COLORED the materials are replaced with typical diff colored materials:

  • red for removed
  • yellow for modified
  • green for added
  • no change for unchanged