new rectangleAnnotation(argsopt, nullable, annotationNameopt)
- Description:
Rectangle annotation class.
Rectangles are always rendered as polygons. This could be changed -- if no stroke is specified, the quad feature would be sufficient and work on more renderers.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
args |
geo.rectangleAnnotation.spec |
<optional> <nullable> |
Options for the annotation. |
|
annotationName |
string |
<optional> |
'rectangle'
|
Override the annotation name. |
Extends
Members
(static) defaults
- Description:
This object contains the default options to initialize the class.
- Source:
This object contains the default options to initialize the class.
Methods
actions(stateopt) → {Array.<geo.actionRecord>}
- Description:
Return actions needed for the specified state of this annotation.
- Source:
- Overrides:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
state |
string |
<optional> |
The state to return actions for. Defaults to the current state. |
Returns:
A list of actions.
- Type
- Array.<geo.actionRecord>
coordinates(gcsopt) → {Array.<geo.geoPosition>}
- Description:
Get coordinates associated with this annotation.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
gcs |
string | geo.transform | null |
<optional> |
|
Returns:
An array of coordinates.
- Type
- Array.<geo.geoPosition>
createStyle()
- Description:
Calls
geo.annotation#style
withstyleType='createStyle'
.
- Source:
- Inherited From:
cursorStyle()
- Description:
Calls
geo.annotation#style
withstyleType='cursorStyle'
.
- Source:
- Inherited From:
description(arg) → {this|string}
- Description:
Get or set the description of this annotation.
- Source:
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
arg |
string | undefined | If |
Returns:
The current description or this annotation.
- Type
- this | string
draw() → {this}
- Description:
Draw this annotation. This just updates and draws the parent layer.
- Source:
- Inherited From:
Returns:
The annotation.
- Type
- this
editHandleStyle()
- Description:
Calls
geo.annotation#style
withstyleType='editHandleStyle'
.
- Source:
- Inherited From:
editStyle()
- Description:
Calls
geo.annotation#style
withstyleType='editStyle'
.
- Source:
- Inherited From:
features() → {array}
- Description:
Get a list of renderable features for this annotation.
- Source:
- Overrides:
Returns:
An array of features.
- Type
- array
geojson(gcsopt, includeCrsopt) → {object}
- Description:
Return the annotation as a geojson object.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
gcs |
string | geo.transform | null |
<optional> |
|
includeCrs |
boolean |
<optional> |
If truthy, include the coordinate system. |
Returns:
The annotation as a geojson object, or undefined
if it
should not be represented (for instance, while it is being created).
- Type
- object
highlightStyle()
- Description:
Calls
geo.annotation#style
withstyleType='highlightStyle'
.
- Source:
- Inherited From:
id() → {number}
- Description:
Get a unique annotation id.
- Source:
- Inherited From:
Returns:
The annotation id.
- Type
- number
label(argopt, noFallbackopt) → {this|string}
- Description:
Get or set the label of this annotation.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arg |
string | null | undefined |
<optional> |
If |
noFallback |
boolean |
<optional> |
If not truthy and the label is |
Returns:
The current label or this annotation.
- Type
- this | string
labelRecord() → {geo.annotationLayer.labelRecord|undefined}
- Description:
If the label should be shown, get a record of the label that can be used in a
geo.textFeature
.
- Source:
- Inherited From:
Returns:
A label record, or
undefined
if it should not be shown.
- Type
- geo.annotationLayer.labelRecord | undefined
labelStyle()
- Description:
Calls
geo.annotation#style
withstyleType='labelStyle'
.
- Source:
- Inherited From:
layer(arg) → {this|geo.annotationLayer}
- Description:
Get or set the annotation layer associated with this annotation.
- Source:
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
arg |
geo.annotationLayer | undefined | if undefined, return the layer, otherwise change it. |
Returns:
the current layer or this annotation.
- Type
- this | geo.annotationLayer
modified() → {this}
- Description:
Mark this annotation as modified. This just marks the parent layer as modified.
- Source:
- Inherited From:
Returns:
The annotation.
- Type
- this
mouseClick(evt) → {boolean|string}
- Description:
Handle a mouse click on this annotation. If the event is processed, evt.handled should be set to
true
to prevent further processing.
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
geo.event | The mouse click event. |
Returns:
true
to update the annotation, 'done'
if
the annotation was completed (changed from create to done state),
'remove'
if the annotation should be removed, falsy to not update
anything.
- Type
- boolean | string
mouseClickEdit(evt) → {boolean|string}
- Description:
Handle a mouse click on this annotation when in edit mode. If the event is processed, evt.handled should be set to
true
to prevent further processing.
- Source:
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
evt |
geo.event | The mouse click event. |
Returns:
true
to update the annotation, 'done'
if
the annotation was completed (changed from create to done state),
'remove'
if the annotation should be removed, falsy to not update
anything.
- Type
- boolean | string
mouseMove(evt) → {boolean}
- Description:
Handle a mouse move on this annotation.
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
geo.event | The mouse move event. |
Returns:
Truthy to update the annotation, falsy to not update anything.
- Type
- boolean
name(argopt) → {this|string}
- Description:
Get or set the name of this annotation.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arg |
string | undefined |
<optional> |
If |
Returns:
The current name or this annotation.
- Type
- this | string
newId() → {this}
- Description:
Assign a new id to this annotation.
- Source:
- Inherited From:
Returns:
- Type
- this
options(arg1opt, arg2opt) → {object|this}
- Description:
Get or set options.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arg1 |
string | object |
<optional> |
If |
arg2 |
object |
<optional> |
If |
Fires:
Returns:
If options are set, return the annotation, otherwise return the requested option or the set of options.
- Type
- object | this
processAction(evt) → {boolean|string}
- Description:
Process any actions for this annotation.
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
geo.event | The action event. |
Returns:
true
to update the annotation, 'done'
if the
annotation was completed (changed from create to done state),
'remove'
if the annotation should be removed, falsy to not update
anything.
- Type
- boolean | string
processEditAction(evt) → {boolean|string}
- Description:
Process any edit actions for this annotation.
- Source:
- Overrides:
Parameters:
Name | Type | Description |
---|---|---|
evt |
geo.event | The action event. |
Returns:
true
to update the annotation, falsy to not
update anything.
- Type
- boolean | string
selectEditHandle(handle, enable) → {this}
- Description:
When an edit handle is selected or deselected (for instance, by moving the mouse on or off of it), mark if it is selected and record the current coordinates.
- Source:
- Inherited From:
Parameters:
Name | Type | Description |
---|---|---|
handle |
object | The data for the edit handle. |
enable |
boolean | True to enable the handle, false to disable. |
Fires:
Returns:
- Type
- this
state(argopt) → {this|string}
- Description:
Get or set the state of this annotation.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arg |
string | undefined |
<optional> |
If |
Fires:
Returns:
The current state or this annotation.
- Type
- this | string
style(arg1opt, arg2opt, styleTypeopt) → {object|this}
- Description:
Get or set style.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
arg1 |
string | object |
<optional> |
If |
|
arg2 |
* |
<optional> |
If |
|
styleType |
string |
<optional> |
'style'
|
The name of the style type, such as
|
Returns:
Either the entire style object, the value of a specific style, or the current class instance.
- Type
- object | this
styleForState(stateopt) → {object}
- Description:
Return the style dictionary for a particular state.
- Source:
- Inherited From:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
state |
string |
<optional> |
The state to return styles for. Defaults to the current state. |
Returns:
The style object for the state. If there is no such style defined, the default style is used.
- Type
- object
toPolygonList(optsopt) → {geo.polygonList}
- Description:
Return this annotation as a polygon list.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
geo.util.polyop.spec |
<optional> |
Ignored. |
Returns:
A list of polygons.
- Type
- geo.polygonList
type() → {string}
- Description:
Get the type of this annotation.
- Source:
- Inherited From:
Returns:
The annotation type.
- Type
- string
Type Definitions
spec
- Description:
Rectangle annotation specification. Extends
geo.annotation.spec
.
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
corners |
Array.<geo.geoPosition> |
<optional> |
A list of four corners in map gcs coordinates. These must be in order around the perimeter of the rectangle (in either direction). |
|
coordinates |
Array.<geo.geoPosition> |
<optional> |
An alternate name for |
|
style |
geo.polygonFeature.styleSpec |
<optional> |
The style to apply to a
finished rectangle. This uses styles for |
|
editStyle |
geo.polygonFeature.styleSpec |
<optional> |
The style to apply to a rectangle in edit mode. |
|
constraint |
number | Array.<number> | function |
<optional> |
If specified, an aspect ratio or list of aspect ratios to constraint the rectangle to. If a function, a selection constraint function to call to adjust the rectangle. |
|
name |
string |
<optional> |
A name for the annotation. This defaults to the type with a unique ID suffixed to it. |
|
layer |
geo.annotationLayer |
<optional> |
A reference to the controlling layer. This is used for coordinate transforms. |
|
state |
string |
<optional> |
Initial annotation state. One of the
|
|
showLabel |
boolean | Array.<string> |
<optional> |
true
|
|
allowBooleanOperations |
boolean |
<optional> |
This defaults to |
Rectangle annotation specification. Extends geo.annotation.spec
.
Type:
- object