PolygonBuilder QML Type

Helper type for building immutable Polygon geometries. More...

Import Statement: import Esri.ArcGISRuntime 100.15
Since: Esri.ArcGISRuntime 100.0
Inherits:

MultipartBuilder

Properties

Signals

Detailed Description

The spatial reference must be set before using the builder and cannot be changed after the builder contains points.

The initial shape stored in the builder can be assigned by using the geometry property. Change the contents of the shape by using the mutable PartCollection accessible from the parts property. Use the geometry property to get the immutable Polygon from the current state of this builder.

You can declare a PolygonBuilder and specify its spatial reference.

PolygonBuilder {
    id: polygonBuilderWGS84
    spatialReference: SpatialReference { wkid: 4326 }
}

Then, use the builder to create as many polygons as you wish. Here, it is used to create a mulipart polygon.

var part1 = ArcGISRuntimeEnvironment.createObject("Part");
part1.spatialReference = polygonBuilderWGS84.spatialReference;
var part2 = ArcGISRuntimeEnvironment.createObject("Part");
part2.spatialReference = polygonBuilderWGS84.spatialReference;
var pCollection = ArcGISRuntimeEnvironment.createObject("PartCollection");
pCollection.spatialReference = polygonBuilderWGS84.spatialReference;

part1.addPointXY(0.0, 0.0);
part1.addPointXY(0.0, 1.0);
part1.addPointXY(1.0, 1.0);
pCollection.addPart(part1);

part2.addPointXY(0.0, 2.0);
part2.addPointXY(0.0, 3.0);
part2.addPointXY(1.0, 3.0);
pCollection.addPart(part2);

polygonBuilderWGS84.parts = pCollection;

var polygon1 = polygonBuilderWGS84.geometry

Property Documentation

parts : PartCollection

The part collection that this builder is constructing or modifying.


polyline : Polyline

Returns a polyline with the values in the polygon builder (read-only).


Signal Documentation

polylineChanged()

Emitted when the polyline property changes.

Note: The corresponding handler is onPolylineChanged.


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