Constructor
new AnnotationItem(feature)
This constructor initializes a new annotation item based on the provided GeoJSON feature. It validates the GeoJSON geometry type and sets up the associated paper item and properties.
Parameters:
Name | Type | Description |
---|---|---|
feature |
Object | The GeoJSON feature containing annotation data. |
Properties:
Name | Type | Description |
---|---|---|
_paperItem |
paper.Item | null | The associated paper item of the annotation. |
_props |
Object | The properties of the annotation. |
- Source:
Throws:
-
Throws an error if the GeoJSON geometry type is invalid.
- Type
- string
Members
paperItem
This method sets the associated paper item of the annotation item. It also applies special properties
to the paper item to convert it into an annotation item.
- Source:
subtype :string
This property returns the subtype from the supported types associated with the annotation item.
Type:
- string
- Source:
type :string
This property returns the type from the supported types associated with the annotation item.
Type:
- string
- Source:
Methods
_supportsGeoJSONObj(obj) → {Boolean}
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | the GeoJSON object to test |
- Source:
Returns:
whether this object is supported
- Type
- Boolean
getCoordinates() → {Array}
This method returns an array of coordinates representing the position of the annotation item.
- Source:
Returns:
An array of coordinates.
- Type
- Array
getGeoJSONType() → {Object}
- Source:
Returns:
object with fields 'type' and optionally 'subtype'
- Type
- Object
getLabel() → {string}
This method returns the label associated with the annotation item. It looks for the
display name of the associated paper item or falls back to the subtype or type from supported types.
- Source:
Returns:
The label.
- Type
- string
getProperties() → {Object}
This method returns the properties associated with the annotation item.
- Source:
Returns:
The properties object.
- Type
- Object
getStyleProperties() → {Object}
This method returns the style properties of the annotation item in JSON format.
- Source:
Returns:
The style properties in JSON format.
- Type
- Object
setStyle(properties)
This method sets the style properties of the annotation item using the provided properties object.
Parameters:
Name | Type | Description |
---|---|---|
properties |
Object | The style properties to set. |
- Source:
supportsGeoJSONType(type, subtypeopt)
Tests whether a given GeoJSON geometry type and optional `properties.subtype` are supported
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
String | ||
subtype |
String |
<optional> |
- Source:
toGeoJSONFeature() → {Object}
This method converts the annotation item into a GeoJSON feature object. It includes the geometry,
properties, style, and other relevant information.
- Source:
Returns:
The GeoJSON feature.
- Type
- Object
toGeoJSONGeometry() → {Object}
This method converts the annotation item into a GeoJSON geometry object, which includes the type,
properties, and coordinates of the annotation.
- Source:
Returns:
The GeoJSON geometry.
- Type
- Object
(static) supportsGeoJSONType(type, subtypeopt) → {Boolean}
Tests whether the geojson type and (optional) subtype are supported by this type of annotation item
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
String | ||
subtype |
String |
<optional> |
- Source:
Returns:
The base class always returns false; inheritinc classes override this with class-specific logic
- Type
- Boolean