Class Polyline
- java.lang.Object
-
- com.esri.arcgisruntime.geometry.Geometry
-
- com.esri.arcgisruntime.geometry.Multipart
-
- com.esri.arcgisruntime.geometry.Polyline
-
- All Implemented Interfaces:
JsonSerializable
public final class Polyline extends Multipart
A multipart linear shape.Polyline
geometries represent the shape and location of linear features such as a street in a road network, a contour line representing an elevation value, or a hiking trail. They can be used to define geometry for features and graphics, or as input or output for tasks or geoprocessing operations, such as the output of a network trace.A
Polyline
is composed of a series of connected segments, where each segment defines a continuous line between a start and an end point. You can define a newPolyline
from a collection ofPoint
to create a series of straightLineSegment
connecting the points you specified. You can usePolylineBuilder
to build a polyline one point at a time or to modify an existingPolyline
.Additionally,
Polyline
can have multiple parts. Each part is a series of connected segments, but the parts can be disjoint. For example, a polyline representing a street that ends and then starts again a block later. Parts can also intersect at one or more vertices. For example, in a polyline representing a river and its tributaries. ThePolyline
class inherits fromMultipart
, which provides members for iterating the segments and points of each part in aPolyline
.Polyline
inherits fromGeometry
.Geometry
is immutable, meaning that its shape cannot be changed after it is created. If you need to modify aPolyline
after it has been created, usePolylineBuilder
instead.GeometryBuilder.toGeometry()
provides the polyline object.A
Polyline
can be used as the geometry of a feature or graphic. To obtain the geometry, useFeature.getGeometry()
orGraphic.getGeometry()
.- Since:
- 100.0.0
- See Also:
Geometry
,PolylineBuilder
-
-
Constructor Summary
Constructors Constructor Description Polyline(Part part)
Creates a new immutable Polyline containing a copy of the given Part.Polyline(PartCollection parts)
Creates a new immutable Polyline containing a copy of the given PartCollection.Polyline(PartCollection parts, SpatialReference spatialReference)
Creates a new Polyline containing a copy of the given PartCollection, and with the given SpatialReference.Polyline(Part part, SpatialReference spatialReference)
Creates a new Polyline containing a copy of the given Part, and with the given SpatialReference.Polyline(PointCollection points)
Creates a new immutable Polyline containing a copy of the Points in the given PointCollection.Polyline(PointCollection points, SpatialReference spatialReference)
Creates a new Polyline containing a copy of the Points in the given PointCollection, and with the given SpatialReference.
-
Method Summary
-
Methods inherited from class com.esri.arcgisruntime.geometry.Geometry
equals, equals, fromJson, fromJson, getDimension, getExtent, getGeometryType, getSpatialReference, getUnknownJson, getUnsupportedJson, hasCurves, hashCode, hasM, hasZ, isEmpty, toJson
-
-
-
-
Constructor Detail
-
Polyline
public Polyline(PointCollection points)
Creates a new immutable Polyline containing a copy of the Points in the given PointCollection. The SpatialReference of the new Polyline will match that of the given PointCollection.- Parameters:
points
- the PointCollection used to initialise the new Polyline- Since:
- 100.0.0
-
Polyline
public Polyline(PointCollection points, SpatialReference spatialReference)
Creates a new Polyline containing a copy of the Points in the given PointCollection, and with the given SpatialReference.This overload can be used to create a new Polyline with a specific SpatialReference from an existing PointCollection that has a null SpatialReference (the points are assigned the given SpatialReference-they are not projected).
- Parameters:
points
- the PointCollection containing points copied to the new PolylinespatialReference
- the SpatialReference of the new Polyline- Throws:
ArcGISRuntimeException
- if the SpatialReference ofpoints
does not match the match thespatialReference
argument.- Since:
- 100.0.0
-
Polyline
public Polyline(Part part)
Creates a new immutable Polyline containing a copy of the given Part. The SpatialReference of the new Polyline will match that of the given Part.- Parameters:
part
- the Part used to initialise the new Polyline- Since:
- 100.0.0
-
Polyline
public Polyline(Part part, SpatialReference spatialReference)
Creates a new Polyline containing a copy of the given Part, and with the given SpatialReference.- Parameters:
part
- the Part to copy to the new PolylinespatialReference
- the SpatialReference of the new Polyline- Throws:
ArcGISRuntimeException
- if the SpatialReference ofpart
does not match the match thespatialReference
argument.- Since:
- 100.0.0
-
Polyline
public Polyline(PartCollection parts)
Creates a new immutable Polyline containing a copy of the given PartCollection. The SpatialReference of the new Polyline will match that of the given PartCollection.- Parameters:
parts
- the PartCollection used to initialise the new Polyline- Since:
- 100.0.0
-
Polyline
public Polyline(PartCollection parts, SpatialReference spatialReference)
Creates a new Polyline containing a copy of the given PartCollection, and with the given SpatialReference.- Parameters:
parts
- the PartCollection to be copied to the new PolylinespatialReference
- the SpatialReference of the new Polyline- Throws:
ArcGISRuntimeException
- if the SpatialReference ofparts
does not match the match thespatialReference
argument.- Since:
- 100.0.0
-
-