PolylineBuilder Class

  • PolylineBuilder
  • class Esri::ArcGISRuntime::PolylineBuilder

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

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

    Public Functions

    PolylineBuilder(const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)
    PolylineBuilder(const Esri::ArcGISRuntime::Polyline &polyline, QObject *parent = nullptr)
    virtual ~PolylineBuilder() override
    Esri::ArcGISRuntime::Polyline toPolyline() const

    Reimplemented Public Functions

    virtual Esri::ArcGISRuntime::GeometryBuilderType geometryBuilderType() const override
    virtual Esri::ArcGISRuntime::Geometry toGeometry() const override

    Detailed Description

    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

    [explicit] PolylineBuilder::PolylineBuilder(const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)

    Constructor that takes a spatialReference and an optional parent.

    [explicit] PolylineBuilder::PolylineBuilder(const Esri::ArcGISRuntime::Polyline &polyline, QObject *parent = nullptr)

    Constructor that takes a polyline and an optional parent.

    [override virtual] PolylineBuilder::~PolylineBuilder()

    Destructor.

    [override virtual] Esri::ArcGISRuntime::GeometryBuilderType PolylineBuilder::geometryBuilderType() const

    Reimplements: GeometryBuilder::geometryBuilderType() const.

    Gets the GeometryBuilderType of this builder.

    [override virtual] Esri::ArcGISRuntime::Geometry PolylineBuilder::toGeometry() const

    Reimplements: GeometryBuilder::toGeometry() const.

    Returns the polyline geometry this builder is constructing or modifying.

    Esri::ArcGISRuntime::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.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.