new geo.lineAnnotation(args)
Line annotation class.
Name | Type | Description |
---|---|---|
args |
geo.lineAnnotation.spec |
optional
nullable
Options for the annotation. |
Extends
Type Definitions
-
geo.lineAnnotation.specobject
-
Line annotation specification. Extends
geo.annotation.spec
.Properties:
Name Type Argument Default Description vertices
Array.<geo.geoPosition> <optional>
A list of vertices in map gcs coordinates.
coordinates
Array.<geo.geoPosition> <optional>
An alternate name for
vertices
.style
geo.lineFeature.styleSpec <optional>
The style to apply to a finished line. This uses styles for
geo.lineFeature
.editStyle
geo.lineFeature.styleSpec <optional>
The style to apply to a line in edit mode.
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
geo.annotation.state
values.showLabel
boolean | Array.<string> <optional>
true true
to show the annotation label on annotations in done or edit states. Alternately, a list of states in which to show the label. Falsy to not show the label.allowBooleanOperations
boolean <optional>
This defaults to
true
for annotations that have area andfalse
for those without area (e.g., false for lines and points). If it is truthy, then, when the annotation is being created, it checks the metakeys on the first click that defines a coordinate to determine what boolean polygon operation should be performaned on the completion of the annotation.
Static Members
-
staticgeo.lineAnnotation.defaults
-
This object contains the default options to initialize the class.
Methods
-
actions(state){Array.<geo.actionRecord>}
-
Return actions needed for the specified state of this annotation.
Name Type Description state
string optional The state to return actions for. Defaults to the current state.
Returns:
Type Description Array.<geo.actionRecord> A list of actions. -
inherited coordinates(gcs){Array.<geo.geoPosition>}
-
Get coordinates associated with this annotation.
Name Type Description gcs
string | geo.transform | null optional undefined
to use the interface gcs,null
to use the map gcs, or any other transform.Returns:
Type Description Array.<geo.geoPosition> An array of coordinates. -
inherited createStyle()
-
Calls
geo.annotation#style
withstyleType='createStyle'
. -
inherited cursorStyle()
-
Calls
geo.annotation#style
withstyleType='cursorStyle'
. -
inherited description(arg){this|string}
-
Get or set the description of this annotation.
Name Type Description arg
string | undefined If
undefined
, return the description, otherwise change it.Returns:
Type Description this | string The current description or this annotation. -
inherited draw(){this}
-
Draw this annotation. This just updates and draws the parent layer.
Returns:
Type Description this The annotation. -
inherited editHandleStyle()
-
Calls
geo.annotation#style
withstyleType='editHandleStyle'
. -
inherited editStyle()
-
Calls
geo.annotation#style
withstyleType='editStyle'
. -
features(){array}
-
Get a list of renderable features for this annotation.
Returns:
Type Description array An array of features. -
inherited geojson(gcs, includeCrs){object}
-
Return the annotation as a geojson object.
Name Type Description gcs
string | geo.transform | null optional undefined
to use the interface gcs,null
to use the map gcs, or any other transform.includeCrs
boolean optional If truthy, include the coordinate system.
Returns:
Type Description object The annotation as a geojson object, or undefined
if it should not be represented (for instance, while it is being created). -
inherited highlightStyle()
-
Calls
geo.annotation#style
withstyleType='highlightStyle'
. -
inherited id(){number}
-
Get a unique annotation id.
Returns:
Type Description number The annotation id. -
inherited label(arg, noFallback){this|string}
-
Get or set the label of this annotation.
Name Type Description arg
string | null | undefined optional If
undefined
, return the label, otherwise change it.null
to clear the label.noFallback
boolean optional If not truthy and the label is
null
, return the name, otherwise return the actual value for label.Returns:
Type Description this | string The current label or this annotation. -
inherited labelRecord(){geo.annotationLayer.labelRecord|undefined}
-
If the label should be shown, get a record of the label that can be used in a
geo.textFeature
.Returns:
Type Description geo.annotationLayer.labelRecord | undefined A label record, or undefined
if it should not be shown. -
inherited labelStyle()
-
Calls
geo.annotation#style
withstyleType='labelStyle'
. -
inherited layer(arg){this|geo.annotationLayer}
-
Get or set the annotation layer associated with this annotation.
Name Type Description arg
geo.annotationLayer | undefined if undefined, return the layer, otherwise change it.
Returns:
Type Description this | geo.annotationLayer the current layer or this annotation. -
inherited modified(){this}
-
Mark this annotation as modified. This just marks the parent layer as modified.
Returns:
Type Description this The annotation. -
mouseClick(evt){boolean|string}
-
Handle a mouse click on this annotation. If the event is processed, evt.handled should be set to
true
to prevent further processing.Name Type Description evt
geo.event The mouse click event.
Returns:
Type Description boolean | string 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. -
mouseClickEdit(evt){boolean|string}
-
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.Name Type Description evt
geo.event The mouse click event.
Returns:
Type Description boolean | string 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. -
mouseMove(evt){boolean}
-
Handle a mouse move on this annotation.
Name Type Description evt
geo.event The mouse move event.
Returns:
Type Description boolean Truthy to update the annotation, falsy to not update anything. -
inherited name(arg){this|string}
-
Get or set the name of this annotation.
Name Type Description arg
string | undefined optional If
undefined
, return the name, otherwise change it. When setting the name, the value is trimmed of whitespace. The name will not be changed to an empty string.Returns:
Type Description this | string The current name or this annotation. -
inherited newId(){this}
-
Assign a new id to this annotation.
Returns:
Type Description this -
inherited options(arg1, arg2){object|this}
-
Get or set options.
Name Type Description arg1
string | object optional If
undefined
, return the options object. If a string, either set or return the option of that name. If an object, update the options with the object's values.arg2
object optional If
arg1
is a string and this is defined, set the option to this value.Fires:
Returns:
Type Description object | this If options are set, return the annotation, otherwise return the requested option or the set of options. -
processAction(evt){boolean|string}
-
Process any actions for this annotation.
Name Type Description evt
geo.event The action event.
Returns:
Type Description boolean | string 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. -
processEditAction(evt){boolean|string}
-
Process any edit actions for this annotation.
Name Type Description evt
geo.event The action event.
Returns:
Type Description boolean | string true
to update the annotation, falsy to not update anything. -
inherited selectEditHandle(handle, enable){this}
-
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.
Name Type Description handle
object The data for the edit handle.
enable
boolean True to enable the handle, false to disable.
Fires:
Returns:
Type Description this -
inherited state(arg){this|string}
-
Get or set the state of this annotation.
Name Type Description arg
string | undefined optional If
undefined
, return the state, otherwise change it. This should be one of thegeo.annotation.state
values.Fires:
Returns:
Type Description this | string The current state or this annotation. -
inherited style(arg1, arg2, styleType){object|this}
-
Get or set style.
Name Type Default Description arg1
string | object optional If
undefined
, return the current style object. If a string andarg2
is undefined, return the style associated with the specified key. If a string andarg2
is defined, set the named style to the specified value. Otherwise, extend the current style with the values in the specified object.arg2
* optional If
arg1
is a string, the new value for that style.styleType
string 'style' optional The name of the style type, such as
createStyle
,editStyle
,editHandleStyle
,labelStyle
,highlightStyle
, orcursorStyle
.Returns:
Type Description object | this Either the entire style object, the value of a specific style, or the current class instance. -
inherited styleForState(state){object}
-
Return the style dictionary for a particular state.
Name Type Description state
string optional The state to return styles for. Defaults to the current state.
Returns:
Type Description object The style object for the state. If there is no such style defined, the default style is used. -
inherited type(){string}
-
Get the type of this annotation.
Returns:
Type Description string The annotation type.