Skip to main content

ClipStyler

A component that can style Clipping Planes by adding edges and fills. 📕 Tutorial. 📘 API.

Extends​

  • Component

Implements​

  • Disposable_2

Properties​

enabled​

enabled: boolean = true

OBC.Component.enabled

Overrides​

OBC.Component.enabled


onDisposed​

readonly onDisposed: Event_2<unknown>

OBC.Disposable.onDisposed

Implementation of​

OBC.Disposable.onDisposed


world​

world: null | World = null

Represents the current world instance used by the ClipStyler. This can be an instance of OBC.World or null if no world is set. You can still specify other world during the ClipEdges creation.


uuid​

static readonly uuid: "24dfc306-a3c4-410f-8071-babc4afa5e4d"

A unique identifier for the component. This UUID is used to register the component within the Components system.

Accessors​

visible​

get visible(): boolean

Gets the visibility state of the edges.

set visible(active): void

Sets the visibility state of the edges.

Parameters​

ParameterTypeDescription
activebooleanThe new visibility state.

Returns​

boolean

Methods​

create()​

create(plane, config?): ClipEdges

Creates a new instance of ClipEdges using the specified plane and optional configuration.

Parameters​

ParameterTypeDescription
planePlaneThe THREE.Plane object used to define the clipping plane.
config?ClipEdgesCreationConfigOptional configuration for the edges creation.

Returns​

ClipEdges

A new instance of ClipEdges initialized with the specified plane and configuration.

Remarks​

The given plane won't be copied during the ClipEdges creation.


createFromClipping()​

createFromClipping(id, config?): ClipEdges

Creates and returns styled edges from a clipping plane identified by its ID. Optionally, a configuration object can be provided to customize the creation process.

Parameters​

ParameterTypeDescription
idstringThe unique identifier of the clipping plane to create edges from.
config?ClipEdgesCreationConfigOptional configuration for edge creation, including visibility and linking behavior.

Returns​

ClipEdges

The created edges styled from the clipping plane.

Remarks​

  • If config.link is true (default), the edges will automatically update when the clipping plane's dragging ends and will be disposed of when the clipping plane is disposed.

createFromView()​

createFromView(view, config?): ClipEdges

Creates and configures clip edges from a given view.

This method generates clip edges based on the provided view's plane and optional configuration. If the link option in the configuration is enabled (default is true), the clip edges are dynamically linked to the view's lifecycle events, ensuring proper disposal, updates, and visibility synchronization with the view's state.

Parameters​

ParameterTypeDescription
viewViewThe view object from which the clip edges are created.
config?ClipEdgesCreationConfigOptional configuration for clip edge creation.

Returns​

ClipEdges

The created clip edges object, configured and optionally linked to the view's lifecycle.


dispose()​

dispose(): void

OBC.Disposable.dispose

Returns​

void

Implementation of​

OBC.Disposable.dispose


updateStyle()​

updateStyle(name): void

Re-applies the current properties of a style (color, opacity, line width) to every section currently using it. Each section renders with a per-instance clone of the style material (so sections can carry their own clipping planes and be disposed without breaking other sections sharing the style): after mutating a style's material (e.g. changing its color from a UI control), call this so the change shows on the rendered sections.

Parameters​

ParameterTypeDescription
namestringThe name of the style to re-apply.

Returns​

void