dojo.require("esri.geometry.Polyline")
Description
(Added at v1.0)
An array of paths where each path is an array of points.
Samples
Search for
samples that use this class.
Class hierarchy
esri/geometry.Geometry
|_esri/geometry.Polyline
Constructors
Properties
Methods
Constructor Details
Creates a new Polyline object.
Sample:
new esri.geometry.Polyline(new esri.SpatialReference({wkid:4326}));
Creates a new Polyline object using a JSON object.
Parameters:
<Object > json |
Required |
JSON object representing the geometry. |
Sample:
var polylineJson = {
"paths":[[[-122.68,45.53], [-122.58,45.55],
[-122.57,45.58],[-122.53,45.6]]],
"spatialReference":{"wkid":4326}
};
var polyline = new esri.geometry.Polyline(polylineJson);
Create a new polyline by providing an array of geographic coordinates. For a single path polyline provide an array of coordinate pairs. For a multi-path polyline provide an array of array coordinate pairs. (Added at v3.6)
Property Details
The cache is used to store values computed from geometries that need to cleared or recomputed upon mutation. An example is the extent of a polygon. The default value is undefined
. (Added at v3.13)
Default value: undefined
An array of paths. Each path is made up of an array of two or more points.
The type of geometry.
Known values: point
| multipoint
| polyline
| polygon
| extent
Method Details
Adds a path to the Polyline. When added the index of the path is incremented by one.
Parameters:
<Point[] | Number[][] > path |
Required |
Path to add to the Polyline. Can be one of the following: an array of numbers or an array of points. |
Sample: Adding a path using Points:
polyline.addPath([new esri.geometry.Point(10,10), new esri.geometry.Point(20,20), new esri.geometry.Point(30,30)]);
Adding a path using an array of x,y coordinate pairs:
polyline.addPath([[-122.68,45.53], [-122.58,45.55], [-122.57,45.58],[-122.53,45.60]]);
Sets the cache property to undefined
. (Added at v3.13)
Returns the value for a named property stored in the cache. (Added at v3.13)
Parameters:
<String > name |
Required |
The property name of the value to retrieve from the cache. |
Returns the extent of the Polyline.
Returns a point specified by a path and point in the path.
Parameters:
<Number > pathIndex |
Required |
The index of a path in a polyline. |
<Number > pointIndex |
Required |
The index of a point in a path. |
Inserts a new point into a polyline. (Added at v1.4)
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. |
Removes a path from the Polyline. The index specifies which path to remove.
Parameters:
<Number > pathIndex |
Required |
The index of a path to remove. |
Remove a point from the polyline at the given pointIndex within the path identified by the given pathIndex. (Added at v2.0)
Parameters:
<Number > pathIndex |
Required |
The index of the path containing the point. |
<Number > pointIndex |
Required |
The index of the point within the path. |
Sets the value for a named property stored in the cache. (Added at v3.13)
Parameters:
<String > name |
Required |
The property name for the value Object to store in the cache. |
<Object > value |
Required |
The value Object for a named property to store in the cache. |
Updates a point in a polyline. (Added at v1.4)
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. |
Sets the spatial reference.