Mixin WayMixin

This mixin provides additional properties and methods which you can invoke on an instance of Way.

You can access nodes using indexed properties, i.e.

way[i]
, see example below.
Name Description
Properties
first The first node
last The last node
length Replies the number of nodes.
nodes Set or get the nodes of a way.
Methods
contains Checks if a node is part of a way.
remove Removes one or more nodes from the way.

This mixin extends the mixin OsmPrimitiveMixin. Properties and methods of the parent mixin are available for scripting, too.

This mixin provides additional properties and methods for the native Java class Way, whose native public methods are available for scripting, too. If a native method name is hidden by a property name in the mixin, then prefix the native name with $.

Properties

first:Node

The first node or undefined, if this way doesn't have nodes (i.e. because it is a proxy way).

last:Node

The last node or undefined, if this way doesn't have nodes (i.e. because it is a proxy way).

length:number

Replies the number of nodes.

nodes:array

Set or get the nodes of a way.

get
Replies the nodes as array.
set
Set the an array or List of Nodes.

var way = ...       // create the way;
var n1,n2,n3 = ...; // create the nodes 
way.nodes = [n1,n2,n3];
way.nodes;  // -> [n1,n2,n3]

Functions

contains:boolean

Checks if a node is part of a way.

Parameters

Name Type Description
node Node the node to check

remove

Removes one or more nodes from the way.

Signatures
remove(n1,n2, ...)
Removes the nodes. ni are instances of Node.
remove(array|collection)
Removes the nodes. array is a javascript array of Nodes, collection is a java collection of Nodes.