Class: Rectangle

OSDPaperjsAnnotation.Rectangle(geoJSON)

Represents a rectangle annotation item.

Constructor

new Rectangle(geoJSON)

The `Rectangle` class represents a rectangle annotation item. It inherits from the `AnnotationItem` class and provides methods to work with rectangle annotations.
Parameters:
Name Type Description
geoJSON Object The GeoJSON object containing annotation data.
Properties:
Name Type Description
_paperItem paper.CompoundPath The associated paper item representing the rectangle.
Source:
Throws:
Throws an error if the GeoJSON type or subtype is invalid.
Type
string

Extends

  • AnnotationItem

Methods

getCoordinates() → {Array}

This method returns an array containing the x and y coordinates of the rectangle.
Source:
Returns:
An array containing the x and y coordinates of the rectangle.
Type
Array

getGeoJSONType() → {Object}

Get the type of this object.
Source:
Returns:
with fields `type === 'Point'` and `subtype === 'Rectangle'`
Type
Object

getProperties() → {Object}

This method returns an object containing the width, height, and angle properties of the rectangle.
Source:
Returns:
An object containing the width, height, and angle of the rectangle.
Type
Object

(static) onTransform(operation, arguments)

This static method performs transformation on the rectangle based on the specified operation and arguments.
Parameters:
Name Type Description
operation string The transformation operation to perform (rotate or scale).
arguments * The arguments specific to the operation.
Source:

(static) supportsGeoJSONType(type, subtypeopt) → {Boolean}

Retrieves the supported types by the Rectangle annotation item.
Parameters:
Name Type Attributes Description
type String
subtype String <optional>
Source:
Returns:
Whether this constructor supports the requested type/subtype
Type
Boolean