Hide menu
Loading...
Searching...
No Matches
Layer

Provides logical grouping of Element objects.

Layers are commonly used to group objects in the drawing by function (for example, walls or furniture), but in principle they can represent any type of virtual grouping. All objects in a layer share appearance and can be shown and hidden together. A drawing element can belong to only one layer.

The drawing layer holds an isVisible attribute, which is true by default.

Extends

Constructors

Constructor

new Layer(name?): Layer

Creates a layer.

Parameters

name?

string

Optional name assigned to the layer.

Returns

Layer

Overrides

BaseObject.constructor

Properties

isVisible

isVisible: boolean = true

Indicates whether the drawing layer is visible.

Accessors

id

Get Signature

get id(): bigint

Returns the unique identifier of the object.

Returns

bigint

Inherited from

BaseObject.id


name

Get Signature

get name(): string | null

Name of the drawing layer.

The value is null if the layer has no name.

Returns

string | null

Set Signature

set name(name): void

Sets the name of the drawing layer.

Parameters

name

string | null

Name to assign to the drawing layer.

Returns

void


uuid

Get Signature

get uuid(): `${string}-${string}-${string}-${string}-${string}` | null

UUID of the drawing layer.

The value is null if no UUID is assigned.

Returns

`${string}-${string}-${string}-${string}-${string}` | null

Set Signature

set uuid(uuid): void

Sets the UUID of the drawing layer.

Parameters

uuid

`${string}-${string}-${string}-${string}-${string}` | null

UUID to assign to the drawing layer.

Returns

void

Methods

accept()

accept(visitor): void

Accepts an element visitor.

Calls the visitor for each element in the drawing layer.

Parameters

visitor

ElementVisitor

Element visitor to accept.

Returns

void


add()

add(element): void

Adds an element to the drawing layer.

If the element has already been added or belongs to another layer, the method does nothing.

Parameters

element

Element

Drawing element to add.

Returns

void


isContaining()

isContaining(element): boolean

Returns true if the element belongs to the drawing layer.

Parameters

element

Element

Drawing element.

Returns

boolean


remove()

remove(element): boolean

Removes an element from the drawing layer.

Returns true if the element was removed.

Parameters

element

Element

Drawing element to remove.

Returns

boolean