Class: PolylineE-mail This Topic Printable Version Give Us Feedback

Description

An array of paths where each path is an array of points.

Class hierarchy

esri.geometry.Geometry
  |_ esri.geometry.Polyline

Constructor

Constructor Description
esri.geometry.Polyline(spatialReference) Creates a new Polyline object.
esri.geometry.Polyline(json) Creates a new Polyline object using a JSON object.

Properties

Property Type Description
paths Number[][][] An array of paths. Each path is made up of an array of two or more points.

Methods

Method Return Value Description
addPath(points or path or pointJson) Polyline Adds a path to the Polyline. The path can be one of the following: an array of numbers, an array of points, or a JSON object. When added the index of the path is incremented by one.

The return value of Polyline was added at v1.4.
getExtent() Extent Returns the extent of the Polyline.
getPoint(pathIndex, pointIndex) Point Returns a point specified by a path and point in the path.
insertPoint(pathIndex, pointIndex, point) Polyline Inserts a new point into a polyline.
removePath(pathIndex) Point[] Removes a path from the Polyline. The index specifies which path to remove.
setPoint(pathIndex, pointIndex, point) Polyline Updates a point in a polyline.
Constructor Detail

esri.geometry.Polyline(spatialReference)

Creates a new Polyline object.
Parameters:
<SpatialReference> spatialReference Required Spatial reference of the geometry.

esri.geometry.Polyline(json)

Creates a new Polyline object using a JSON object.
Parameters:
<Object> json Required JSON object representing the geometry.
Properties Detail

<Number[][][]> paths

An array of paths. Each path is made up of an array of two or more points.
See also:
addPath  
Methods Detail

addPath(points or path or pointJson)

Adds a path to the Polyline. The path can be one of the following: an array of numbers, an array of points, or a JSON object. When added the index of the path is incremented by one.

The return value of Polyline was added at v1.4.
Return value: Polyline
Input Parameters:
<Point[]> points Required An array of ESRI points to create a path.
<Number[][]> path Required An array of x,y coordinate pairs to create a path.
<Object> pointJson Required A JSON object representing a path.
Code snippets:
polyline.addPath([new esri.geometry.Point(10,10), new esri.geometry.Point(20,20), new esri.geometry.Point(30,30)]);

getExtent()

Returns the extent of the Polyline.
Return value: Extent

getPoint(pathIndex, pointIndex)

Returns a point specified by a path and point in the path.
Return value: Point
Input Parameters:
<Number> pathIndex Required The index of a path in a polyline.
<Number> pointIndex Required The index of a point in a path.

insertPoint(pathIndex, pointIndex, point)

Inserts a new point into a polyline. (As of v1.4)
Return value: Polyline
Input Parameters:
<Number> pathIndex Required Path index to insert point.
<Number> pointIndex Required The index of the inserted point in the path.
<Point> point Required Point to insert into the path.

removePath(pathIndex)

Removes a path from the Polyline. The index specifies which path to remove.
Return value: Point[]
Input Parameters:
<Number> pathIndex Required The index of a path to remove.

setPoint(pathIndex, pointIndex, point)

Updates a point in a polyline. (As of v1.4)
Return value: Polyline
Input Parameters:
<Number> pathIndex Required Path index for updated point.
<Number> pointIndex Required The index of the updated point in the path.
<Point> point Required Point to update in the path.