GeometryBuilder Class

  • GeometryBuilder
  • class Esri::ArcGISRuntime::GeometryBuilder

    Base class for classes used to create immutable geometries. More...

    Public Functions

    virtual ~GeometryBuilder() override
    Esri::ArcGISRuntime::Envelope extent() const
    virtual Esri::ArcGISRuntime::GeometryBuilderType geometryBuilderType() const
    bool hasCurves() const
    bool hasM() const
    bool hasZ() const
    bool isEmpty() const
    bool isSketchValid() const
    void replaceGeometry(const Esri::ArcGISRuntime::Geometry &geometry)
    Esri::ArcGISRuntime::SpatialReference spatialReference() const
    virtual Esri::ArcGISRuntime::Geometry toGeometry() const

    Static Public Members

    Esri::ArcGISRuntime::GeometryBuilder *create(const Esri::ArcGISRuntime::Geometry &geometry, QObject *parent = nullptr)
    Esri::ArcGISRuntime::GeometryBuilder *create(Esri::ArcGISRuntime::GeometryType geometryType, const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)

    Detailed Description

    Each type of Geometry has a corresponding builder class. For example, PolygonBuilder creates Polygons. Create a new empty builder in order to build up the shape of a geometry step by step. Alternatively for editing workflows, initialize the builder by passing the existing Geometry to be edited into the builder constructor, and then make the required changes. In both cases, call toGeometry to return a new immutable Geometry based on the current state of the geometry in the builder. The state of a builder can be completely overwritten by calling replaceGeometry.

    Set the spatial reference of a builder either explicitly by specifying a SpatialReference object in the constructor, or is set implicitly from other constructor arguments. Once set, the spatial reference cannot be changed. When building geometries, the spatial reference of any objects or coordinates added to the builder must be compatible with the spatial reference of the builder; added items are not reprojected. The spatial reference of added objects may be null, in which case the added object is assumed to have the same spatial reference as the builder it is added to.

    A number of other methods provide information about the geometry currently being constructed. A new builder will be empty (isEmpty is true). The hasZ and hasM methods indicate if the builder allows adding z and m-values for each coordinate in the geometry.

    See also GeometryEditor.

    Member Function Documentation

    [override virtual] GeometryBuilder::~GeometryBuilder()


    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::GeometryBuilder *GeometryBuilder::create(const Esri::ArcGISRuntime::Geometry &geometry, QObject *parent = nullptr)

    Creates and returns a geometry builder from a geometry.

    • geometry - The geometry to be used as the starting point for further modifications.
    • parent - An optional parent.

    Prior to Esri::ArcGISRuntime 100.12, only geometries without curves could be used; passing in a geometry where Geometry::hasCurves is true would throw an exception.

    From Esri::ArcGISRuntime 100.12, geometries with curves are supported.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also hasCurves.

    [static, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::GeometryBuilder *GeometryBuilder::create(Esri::ArcGISRuntime::GeometryType geometryType, const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)

    Creates and returns a geometry builder from a geometry type and spatial reference.

    • geometryType - The geometry type of the builder.
    • spatialReference - The spatial reference of the builder.
    • parent - An optional parent.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also hasCurves.

    Esri::ArcGISRuntime::Envelope GeometryBuilder::extent() const

    Returns the extent of the builder's geometry.

    The extent for the geometry in the builder which is a envelope and contains the same spatial reference as the input geometry.

    [virtual] Esri::ArcGISRuntime::GeometryBuilderType GeometryBuilder::geometryBuilderType() const

    Returns the type of this geometry builder.

    [since Esri::ArcGISRuntime 100.12] bool GeometryBuilder::hasCurves() const

    Returns a value indicating whether the geometry builder currently contains any curve segments.

    The ArcGIS Platform supports polygon and polyline geometries that contain (where Segment::isCurve is true, sometimes known as true curves or nonlinear segments). Curves may be present in certain types of data - for example Mobile Map Packages (MMPKs), or geometry JSON.

    Prior to Esri::ArcGISRuntime 100.12, only LineSegment instances were supported when creating new geometries using a MultipartBuilder. Attempting to add curve geometries to a MultipartBuilder would cause an error.

    From Esri::ArcGISRuntime 100.12, you can use curves in a MultipartBuilder. New segment types CubicBezierSegment and EllipticArcSegment represent different types of curve that can be added to polygon and polyline geometries.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also Part::hasCurves, Geometry::hasCurves, and Segment::isCurve.

    bool GeometryBuilder::hasM() const

    Returns whether the builder's geometry contains m-values.

    bool GeometryBuilder::hasZ() const

    Returns whether the builder's geometry contains z-coordinate values.

    bool GeometryBuilder::isEmpty() const

    Returns whether the builder's geometry is empty.

    bool GeometryBuilder::isSketchValid() const

    Returns whether the builder's geometry contains sufficient points to show a valid graphical sketch.

    This can be used as an initial lightweight check to see if the current state of a builder produces a non-empty geometry; for example, it may be used to enable or disable functionality in an editing user interface. The exact requirements vary depending on the type of geometry produced by the builder:

    Note that this is not equivalent to topological simplicity, which is enforced by GeometryEngine::simplify(Geometry) and checked using GeometryEngine::isSimple(Geometry). Geometries must be topologically simple to be successfully saved in a geodatabase or used in some service operations.

    Does not check the spatial reference. Returns false if an error occurs.

    Prior to Esri.ArcGISRuntime 100.8, only one part of a multipart polygon or polyline was required to have the minimum number (2 for a polyline, 3 for a polygon) of Points, and only LineSegment instances were supported in builders.

    Prior to Esri.ArcGISRuntime 100.12, a PolygonBuilder required at least three valid Points in each Part, and at least one Part.

    void GeometryBuilder::replaceGeometry(const Esri::ArcGISRuntime::Geometry &geometry)

    Replaces the content of an existing geometry with the geometry in this builder.

    An empty Geometry may be passed to reset the builder's geometry. Note that this won't change the SpatialReference.

    Esri::ArcGISRuntime::SpatialReference GeometryBuilder::spatialReference() const

    The spatial reference associated with the builder's geometry.

    If the geometry does not have a spatial reference null is returned.

    [virtual] Esri::ArcGISRuntime::Geometry GeometryBuilder::toGeometry() const

    Returns the geometry this builder is constructing or modifying.

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