# Class MarkupSheet2D

Class representing a markup sheet in the markup API.

#### Hierarchy (View Summary)

- MarkupEntityBase
  - MarkupSheet2D

##### Index

### Properties

id
isEnabled
parent
properties

### Methods

[iterator]
add
clone
duplicate
entites
get
isEqual
markAsDeleted
markAsUpdated
onAdded
onDelete
onUpdate

## Properties

### `Readonly` id

id: string

Inherited from MarkupEntityBase.id

### isEnabled

isEnabled: boolean = true

Returns `true` if the entity and the sheet it belongs to are both enabled, otherwise `false`.

Overrides MarkupEntityBase.isEnabled

### `Readonly` parent

parent: MarkupSheet2DCollection

### `Readonly` properties

properties: Map<string, MarkupProperty> = ...

Inherited from MarkupEntityBase.properties

## Methods

### [iterator]

- "[iterator]"(): IterableIterator<MarkupEntity>

  #### Returns IterableIterator<MarkupEntity>

### add

- add<ARG, RET extends MarkupEntity>(
  ctor: new (args: MarkupEntityConstructorArgs & ARG) => RET,
  entitySpecifics: ARG,
  properties?: Map<string, MarkupProperty>,
  ): RET

  #### Type Parameters

  - ARG
  - RET extends MarkupEntity

  #### Parameters

  - ctor: new (args: MarkupEntityConstructorArgs & ARG) => RET

    Entity type to add to the sheet

  - entitySpecifics: ARG

    specific parameters for that entity type.

  - properties: Map<string, MarkupProperty> = ...

  #### Returns RET

  a new entity that has been added to the sheet.

### clone

- clone(): MarkupSheet2D

  Makes a deep copy of this entity

  #### Returns MarkupSheet2D

  Overrides MarkupEntityBase.clone

### duplicate

- duplicate(id: string): MarkupSheet2D

  Duplicates the sheet and all its entities.

  #### Parameters

  - id: string

    Id of the new duplicate sheet.

  #### Returns MarkupSheet2D

  The new duplicate sheet.

### entites

- entites(states?: MergableObjectState[]): IterableIterator<MarkupEntity>

  #### Parameters

  - states: MergableObjectState[] = []

    Array of states used to filter out entities, default is [MergableObjectState.Added, MergableObjectState.Modified, MergableObjectState.Unchanged].

  #### Returns IterableIterator<MarkupEntity>

  #### Example

      // Loops all modified entities in this sheet.
      for(const modifiedEntity of sheet.entities([MergableObjectState.Modified])) {
       modifiedEntity.x = 10;
       modifiedEntity.update();
      }

### get

- get(
  entityOrId: string | Pick<MarkupEntity, "id">,
  ): undefined | MergableObjectWithState<MarkupEntity>

  Get a markup entity based on an id.

  #### Parameters

  - entityOrId: string | Pick<MarkupEntity, "id">

    id of markup entity you want to get.

  #### Returns undefined | MergableObjectWithState<MarkupEntity>

  The markup entity corralating to the id if it exists in the sheet.

### isEqual

- isEqual(o: MarkupSheet2D): boolean

  Compares if this entity is equal to another entity

  #### Parameters

  - o: MarkupSheet2D

  #### Returns boolean

  Overrides MarkupEntityBase.isEqual

### markAsDeleted

- markAsDeleted(): boolean

  Mark this sheet to be deleted on the next MarkupSheet2DCollection.saveAndMergeSheets.

  #### Returns boolean

  true if sheet was deleted, false if it failed to delete.

  Overrides MarkupEntityBase.markAsDeleted

### markAsUpdated

- markAsUpdated(): boolean

  Marks the sheet as updated in the MarkupSheet2DCollection.

  #### Returns boolean

  Overrides MarkupEntityBase.markAsUpdated

### onAdded

- onAdded(o: MergableObjectEventArgs<MarkupSheet2D>): void

  Called when this entity is added

  #### Parameters

  - o: MergableObjectEventArgs<MarkupSheet2D>

  #### Returns void

  Overrides MarkupEntityBase.onAdded

### onDelete

- onDelete(o: MergableObjectEventArgs<MarkupSheet2D>): void

  Called when this entity is deleted

  #### Parameters

  - o: MergableObjectEventArgs<MarkupSheet2D>

  #### Returns void

  Overrides MarkupEntityBase.onDelete

### onUpdate

- onUpdate(o: MergableObjectEventArgs<MarkupSheet2D>): void

  Called when this entity is updated

  #### Parameters

  - o: MergableObjectEventArgs<MarkupSheet2D>

  #### Returns void

  Overrides MarkupEntityBase.onUpdate