;

Part Class

  • Part
  • class Esri::ArcGISRuntime::Part

    Represents a single part of a multipart builder. More...

    Header: #include <Part>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    Part(const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)
    virtual ~Part() override
    int addPoint(const Esri::ArcGISRuntime::Point &point)
    int addPoint(double x, double y)
    int addPoint(double x, double y, double z)
    void addPoints(const QList<Esri::ArcGISRuntime::Point> &points)
    int addSegment(const Esri::ArcGISRuntime::Segment &segment)
    Esri::ArcGISRuntime::Point endPoint() const
    int endPointIndexFromSegmentIndex(int segmentIndex) const
    bool hasCurves() const
    void insertPoint(int pointIndex, const Esri::ArcGISRuntime::Point &point)
    void insertPoint(int pointIndex, double x, double y)
    void insertPoint(int pointIndex, double x, double y, double z)
    void insertSegment(int segmentIndex, const Esri::ArcGISRuntime::Segment &segment)
    bool isEmpty() const
    Esri::ArcGISRuntime::Point point(int pointIndex) const
    int pointCount() const
    Esri::ArcGISRuntime::ImmutablePointCollection points() const
    void removeAll()
    void removePoint(int pointIndex)
    void removeSegment(int segmentIndex)
    Esri::ArcGISRuntime::Segment segment(int segmentIndex) const
    int segmentCount() const
    int segmentIndexFromEndPointIndex(int pointIndex) const
    void segmentIndexFromPointIndex(int pointIndex, int &outStartPointSegmentIndex, int &outEndPointSegmentIndex) const
    int segmentIndexFromStartPointIndex(int pointIndex) const
    void setPoint(int pointIndex, const Esri::ArcGISRuntime::Point &point)
    void setSegment(int segmentIndex, const Esri::ArcGISRuntime::Segment &segment)
    Esri::ArcGISRuntime::SpatialReference spatialReference() const
    Esri::ArcGISRuntime::Point startPoint() const
    int startPointIndexFromSegmentIndex(int segmentIndex) const

    Detailed Description

    Multipart builder is the base class of PolygonBuilder or PolylineBuilder. A part is made up of a collection of segments making the edge of the multipart. Additionally, access and modification using the points (vertexes) of segments is available. Adjacent segments that share an end point and a start point are connected, and the shared vertex is not duplicated when accessing points.

    The part can represent gaps between one end point and an adjacent start. However, this is only recommended as a temporary state while modifying a multipart builder. When using GeometryBuilder::toGeometry the gaps are closed with line segments.

    Prior to Esri::ArcGISRuntime 100.12, the only supported segment type was LineSegment.

    From Esri::ArcGISRuntime 100.12, curve segments can be added to a Part and used build polygon and polyline geometries. A part may contain a mix of linear and curve segments.

    See also CubicBezierSegment, EllipticArcSegment, and LineSegment.

    Member Function Documentation

    Part::Part(const Esri::ArcGISRuntime::SpatialReference &spatialReference, QObject *parent = nullptr)

    Constructor that takes a spatialReference and an optional parent.

    [override virtual] Part::~Part()

    Destructor.

    int Part::addPoint(const Esri::ArcGISRuntime::Point &point)

    Adds a new point to the end of the part.

    A new line segment will be added to connect the new point to the previous.

    A new line segment will be added to connect the new point to the previous point. The points in the part are the start and end points of segments. If this is the first point in an empty segment, a single closed segment is added using the same start and end point. Adding a second point will update this line segment to gain a distinct end point. Adding a third or more points will add new line segments.

    Returns the index where the point was added or -1 on error.

    int Part::addPoint(double x, double y)

    Add a new point to the end of the part by specifying the point's x, and y coordinates.

    A new line segment will be added to connect the new point to the previous point. The points in the part are the start and end points of segments. If this is the first point in an empty segment, a single closed segment is added using the same start and end point. Adding a second point will update this line segment to gain a distinct end point. Adding a third or more points will add new line segments.

    Returns the index where the point was added or -1 on error.

    int Part::addPoint(double x, double y, double z)

    Adds a new point to the end of the part by specifying the point's x, y, and z coordinates.

    A new line segment will be added to connect the new point to the previous point. The points in the part are the start and end points of segments. If this is the first point in an empty segment, a single closed segment is added using the same start and end point. Adding a second point will update this line segment to gain a distinct end point. Adding a third or more points will add new line segments.

    void Part::addPoints(const QList<Esri::ArcGISRuntime::Point> &points)

    Adds a list of points to the part.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    int Part::addSegment(const Esri::ArcGISRuntime::Segment &segment)

    A new segment to add to the end of a part.

    A new segment is added to the end. If the start point of the segment matches the previous end point, the segment will share this point. The count of points will increase by 1 if the segment connects, or 2 points if it is disconnected. A more efficient way to add a LineSegment to a part is to use one of the point addition methods. For example Part::addPoint(double, double).

    Returns the index where the Segment was added, or -1 on error.

    Esri::ArcGISRuntime::Point Part::endPoint() const

    Gets the end point of this part.

    int Part::endPointIndexFromSegmentIndex(int segmentIndex) const

    Gets the point index of the end point of the segment with the given segmentIndex.

    Returns -1 on error or invalid index.

    bool Part::hasCurves() const

    Returns true if the part contains any curve segments.

    Prior to Esri::ArcGISRuntime 100.12, only LineSegment linear segments were available to be added to mutable parts when building geometries.

    From Esri::ArcGISRuntime 100.12, geometry builders support curve segments. This property returns true if any segments where Segment::isCurve is true have been added to the part.

    This function was introduced in Esri::ArcGISRuntime 100.12.

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

    void Part::insertPoint(int pointIndex, const Esri::ArcGISRuntime::Point &point)

    Inserts a point into the part at the specified pointIndex.

    Line segments will be added to connect the point to adjacent segments. The point index can be equal to the point count and this is equivalent to adding a point to the end of the collection. The points in the part are the start and end points of segments. An existing segment connecting the point before or after the point index is removed. Inserting a new point will insert new line segments connecting the adjacent points.

    void Part::insertPoint(int pointIndex, double x, double y)

    Inserts a point specified by its x and y coordinates into the part at the specified pointIndex.

    Line segments will be added to connect the point to adjacent segments. The point index can be equal to the point count and this is equivalent to adding a point to the end of the collection. The points in the part are the start and end points of segments. An existing segment connecting the point before or after the point index is removed. Inserting a new point will insert new line segments connecting the adjacent points.

    void Part::insertPoint(int pointIndex, double x, double y, double z)

    Inserts a point specified by its x, y, and z coordinates into the part at the specified pointIndex.

    Line segments will be added to connect the point to adjacent segments. The point index can be equal to the point count and this is equivalent to adding a point to the end of the collection. The points in the part are the start and end points of segments. An existing segment connecting the point before or after the point index is removed. Inserting a new point will insert new line segments connecting the adjacent points.

    void Part::insertSegment(int segmentIndex, const Esri::ArcGISRuntime::Segment &segment)

    Inserts a segment at segmentIndex.

    bool Part::isEmpty() const

    Gets whether this Part is empty.

    Returns true if the Part contains no segments or points.

    Esri::ArcGISRuntime::Point Part::point(int pointIndex) const

    Gets the point at pointIndex.

    Returns an empty Point object if the index is not valid.

    See also setPoint().

    int Part::pointCount() const

    Gets the number of points in this Part.

    Esri::ArcGISRuntime::ImmutablePointCollection Part::points() const

    Gets the points of the ImmutablePart as an ImmutablePointCollection.

    This is a copy of the points in the mutable part.

    void Part::removeAll()

    Removes all the points and segments.

    void Part::removePoint(int pointIndex)

    Removes the point at pointIndex.

    void Part::removeSegment(int segmentIndex)

    Removes the segment at segmentIndex.

    Esri::ArcGISRuntime::Segment Part::segment(int segmentIndex) const

    Gets the Segment at segmentIndex.

    Returns the Segment or an empty Segment if the index isn't valid.

    See also setSegment().

    int Part::segmentCount() const

    Gets the segment count of the Part.

    Returns the number of segments.

    int Part::segmentIndexFromEndPointIndex(int pointIndex) const

    Gets the index of the segment whose end point index is pointIndex.

    Returns the segment point index or -1 on error or invalid index.

    void Part::segmentIndexFromPointIndex(int pointIndex, int &outStartPointSegmentIndex, int &outEndPointSegmentIndex) const

    Gets the segment start and end indices from the given pointIndex.

    • outStartPointSegmentIndex - The index of the segment that begins at pointIndex.
    • outEndPointSegmentIndex - The index of the segment that ends at pointIndex.

    On error, the values will be set to -1.

    int Part::segmentIndexFromStartPointIndex(int pointIndex) const

    Gets the segment index from the start point index pointIndex.

    Returns the segment point index or -1 on error or invalid index.

    void Part::setPoint(int pointIndex, const Esri::ArcGISRuntime::Point &point)

    Reassigns the point at pointIndex to point.

    The points in the part correspond to start and end points of segments. Setting a new point will affect 1 or 2 segments using the point at the specified index. The type of affected segment(s) (LineSegment, CubicBezierSegment or EllipticArcSegment) will remain the same.

    For affected cubic bezier segments, the shape of the curve may change because the control points remain the same, as does the unchanged start or end point location. For elliptic arc segments, the arc parameters are adjusted enough to ensure the unchanged start or end point location remains the same.

    See also point().

    void Part::setSegment(int segmentIndex, const Esri::ArcGISRuntime::Segment &segment)

    Reassigns the segment at segmentIndex to segment.

    See also segment().

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

    Gets the spatial reference of this Part.

    Esri::ArcGISRuntime::Point Part::startPoint() const

    Gets the start point of this part.

    int Part::startPointIndexFromSegmentIndex(int segmentIndex) const

    Gets the point index of the start point of the segment with the given segmentIndex.

    Returns -1 on error or invalid index.

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