Skip To Content ArcGIS for Developers Sign In Dashboard

PolylineBuilder Class

(Esri::ArcGISRuntime::PolylineBuilder)

Helper class for building immutable polyline geometries. More...

Header: #include <PolylineBuilder>
Since: Esri::ArcGISRuntime 100.0
Inherits: MultipartBuilder

Public Functions

PolylineBuilder(const SpatialReference &spatialReference, QObject *parent = nullptr)
PolylineBuilder(const Polyline &polyline, QObject *parent = nullptr)
~PolylineBuilder()
Polyline toPolyline() const

Reimplemented Public Functions

virtual GeometryBuilderType geometryBuilderType() const
virtual Geometry toGeometry() const

Additional Inherited Members

Detailed Description

Helper class for building immutable polyline geometries.

Use the constructors to initialize the builder with a spatial reference. After it is set, the spatial reference cannot be changed. The initial shape stored in the builder can also be initialized in the constructors, by passing in existing geometries or collections. Change the contents of the shape by using the mutable PartCollection accessible from the parts() getter. Call the toGeometry method to create a new immutable polyline from the current state of this builder.

// create a PolylineBuilder and a single-part polyline
PolylineBuilder* builder = new PolylineBuilder(SpatialReference(4326), this);
builder->addPoint(-117.0, 34.0);
builder->addPoint(-118.0, 34.0);
Polyline singleLine = builder->toPolyline();

// create a multi-part polyline using the same PolylineBuilder
Part* part1 = new Part(builder->spatialReference(), this);
Part* part2 = new Part(builder->spatialReference(), this);
part1->addPoint(-116.0, 33.0);
part1->addPoint(-116.5, 33.5);
part2->addPoint(-115.0, 33.0);
part2->addPoint(-115.5, 33.5);
PartCollection* pCollection = new PartCollection(builder->spatialReference(), this);
pCollection->addPart(part1);
pCollection->addPart(part2);
builder->setParts(pCollection);
Polyline multiPart = builder->toPolyline();

Member Function Documentation

PolylineBuilder::PolylineBuilder(const SpatialReference &spatialReference, QObject *parent = nullptr)

Constructor that takes a spatialReference and an optional parent.

PolylineBuilder::PolylineBuilder(const Polyline &polyline, QObject *parent = nullptr)

Constructor that takes a polyline and an optional parent.

PolylineBuilder::~PolylineBuilder()

Destructor.

[virtual] GeometryBuilderType PolylineBuilder::geometryBuilderType() const

Reimplemented from GeometryBuilder::geometryBuilderType().

Gets the GeometryBuilderType of this builder.

[virtual] Geometry PolylineBuilder::toGeometry() const

Reimplemented from GeometryBuilder::toGeometry().

Returns the polyline geometry this builder is constructing or modifying.

Polyline PolylineBuilder::toPolyline() const

Returns the polyline geometry this builder is constructing or modifying. This is a convenience method to avoid having to cast the return value.


Feedback on this topic?