# MarkupItem

class Markup.MarkupItem()

  This is a base class for all markup items that are overlayed over the viewer. Inherit from this class or provide an identical interface when creating custom markup items.

Constructors

- `constructor()`

Methods

- `draw()`

- `getClassName()`

- `hit()`

- `hitWithTolerance()`

- `onDeselect()`

- `onSelect()`

- `remove()`

- `toJson()`

## Constructors

MarkupItem.constructor()
  Return type

    MarkupItem

## Methods

### draw

MarkupItem.draw(_renderer, _view)
  Arguments

    - _renderer (`MarkupRenderer()`) – None

    - _view (`View()`) – None

  Called when the markup item should be redrawn on a specific view. This most typically happens when the scene is rendered.

  Return type

    void

### getClassName

MarkupItem.getClassName()

  Gets the fully qualified class name for this markup item. E.g. “Communicator.Markup.Redline.RedlineCircle”

  Returns

    fully qualified class name

  Return type

    string

### hit

MarkupItem.hit(_point, _view)
  Arguments

    - _point (`Point2()`) – None

    - _view (`View()`) – None

  Called when a hit test is performed on this markup item.

  Returns

    boolean value indicating whether this item was picked

  Return type

    boolean

### hitWithTolerance

MarkupItem.hitWithTolerance(_point, _view, _pickTolerance)
  Arguments

    - _point (`Point2()`) – None

    - _view (`View()`) – None

    - _pickTolerance (`number()`) – None

  Called when a hit test is performed on this markup item.

  Returns

    boolean value indicating whether this item was picked

  Return type

    boolean

### onDeselect

MarkupItem.onDeselect()

  Called when this markup item is deselected by the system

  Return type

    void

### onSelect

MarkupItem.onSelect()

  Called when this markup item is selected by the system.

  Return type

    void

### remove

MarkupItem.remove()

  Called when the MarkupItem is removed from the system. Any cleanup that needs to be done should be performed in this method.

  Return type

    void

### toJson

MarkupItem.toJson()

  Creates an object ready for JSON serialization.

  Returns

    The prepared object.

  Return type

    object