The polygon builder allows you to create and modify Polygon geometries incrementally. More...
Public Functions PolygonBuilder(const Esri::ArcGISRuntime::Polygon &polygon, QObject *parent = nullptr) PolygonBuilder(const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr) virtual ~PolygonBuilder() override Esri::ArcGISRuntime::Polygon toPolygon() const Esri::ArcGISRuntime::Polyline toPolyline() const Reimplemented Public Functions virtual Esri::ArcGISRuntime::GeometryBuilderType geometryBuilderType() const override virtual Esri::ArcGISRuntime::Geometry toGeometry() const override Detailed DescriptionPolygon geometries are immutable and cannot be changed directly once created. A polygon is a closed area shape defined by one or more parts. Each part in a polygon is a connected sequence of Segment instances that start and end at the same point (a closed ring). If a polygon has more than one ring, the rings may be separate from one another or they may nest inside one another, but they should not overlap. Note: interior rings, to make donut polygons, should be counter-clockwise in direction to be topology correct. If there is ever a doubt about the topological correctness of a polygon, call GeometryEngine::simplify(const Esri::ArcGISRuntime::Geometry&) to correct any issues.
The polygon builder allows you to change the contents of the shape using the PartCollection that you can access from the MultipartBuilder::parts. Each Part, in this PartCollection, comprises a collection of segments that make edges of the Part. You can add or remove a Part from the PartCollection, or you can create a new or edit the segment vertices of an existing Part. Use GeometryBuilder::toGeometry to return the new Polygon from the builder.
// create a polygon builder auto* polygonBuilder = new PolygonBuilder(SpatialReference(3857), this); // create a single-part polygon using x/y polygonBuilder->addPoint(-18.0, 34.0); polygonBuilder->addPoint(-18.0, 35.0); polygonBuilder->addPoint(-17.0, 34.0); Polygon singlePartPolygonXY(polygonBuilder->toGeometry()); // create a multi-part polygon with same PolygonBuilder auto* partCollection = new PartCollection(polygonBuilder->spatialReference(), this); // create outer poly 1 Part* part1 = new Part(polygonBuilder->spatialReference(), this); part1->addPoint(2.123456789, 3.123456789); part1->addPoint(1.123456789, 3.123456789); part1->addPoint(1.123456789, 1.123456789); partCollection->addPart(part1); // create outer poly 2 Part* part2 = new Part(polygonBuilder->spatialReference(), this); part2->addPoint(3.123456789, 3.123456789); part2->addPoint(4.123456789, 3.123456789); part2->addPoint(4.123456789, 1.123456789); partCollection->addPart(part2); polygonBuilder->setParts(partCollection); Polygon multipartPolygon = polygonBuilder->toPolygon();
Relevant samples:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4