Represents a single part of a multipart builder. More...
Header: | #include <Part.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | Esri::ArcGISRuntime::Object |
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
[explicit]
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 is added to connect the new point to the previous.
- point - The point to add.
The points in the part are the start and end points of segments. A new line segment is added to connect the new point to the previous point. 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 updates this line segment to gain a distinct end point. Adding subsequent points adds new line segments.
int Part::addPoint (double x, double y)
Adds a new point to the end of the part by specifying the points x,y coordinates.
A new line segment is added to connect the new point to the previous.
- x - The x-coordinate of the new point.
- y - The y-coordinate of the new point.
The points in the part are the start and end points of segments. A new line segment is added to connect the new point to the previous point. 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 updates this line segment to gain a distinct end point. Adding subsequent points adds new line segments.
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.
int Part::addPoint (double x, double y, double z)
Adds a new point to the end of the part by specifying the points x,y,z coordinates.
A new line segment is added to connect the new point to the previous.
- x - The x-coordinate of the new point.
- y - The y-coordinate of the new point.
- z - The z-coordinate of the new point.
The points in the part are the start and end points of segments. A new line segment is added to connect the new point to the previous point. 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 updates this line segment to gain a distinct end point. Adding subsequent points adds new line segments.
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.
[since Esri::ArcGISRuntime 100.1]
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)
Adds a segment to the end of the part.
- segment - The segment.
A new segment is added to the end. If the start point of the segment matches the previous end point, the segment shares this point. The count of points increases 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 addPoint(double, double).
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.
[since Esri::ArcGISRuntime 100.12]
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 point index.
Line segments are added to connect the point to adjacent segments.
- pointIndex - Zero-based index of the point.
- point - The point to insert.
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 connection the point before or after the point index is removed. Inserting a new point inserts new line segments connecting the adjacent points.
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,y coordinates into the part at the specified point index.
Line segments are added to connect the point to adjacent segments.
- pointIndex - Zero-based index of the point.
- x - The x-coordinate of the new point.
- y - The y-coordinate of the new point.
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 connection the point before or after the point index is removed. Inserting a new point inserts new line segments connecting the adjacent points.
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,z coordinate into the part at the specified point index.
Line segments are added to connect the point to adjacent segments.
- pointIndex - Zero-based index of the point.
- x - The x-coordinate of the new point.
- y - The y-coordinate of the new point.
- z - The z-coordinate of the new point.
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 connection the point before or after the point index is removed. Inserting a new point inserts new line segments connecting the adjacent points.
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 into the part at the specified index.
- segmentIndex - Zero-based index of the segment.
- segment - The segment to insert.
The new segment is inserted at the specified segment_index. This index may be equal to the segment count which is equivalent to adding to the end of the collection. The number of points in the part increases to connect in the new segment.
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
Returns a point at a specified point index.
- pointIndex - Zero-based index of the point.
The points in the part are the start and end points of segments. Segments can share a point if the end point of one segment matches the start point of the next.
See also setPoint().
int Part::pointCount () const
Returns the count of points in the part.
The points in the part are the start and end points of segments. Segments can share a point if the end point of one segment matches the start point of the next.
Esri::ArcGISRuntime::ImmutablePointCollection Part::points() const
Returns all the points that are the vertexes of the part.
This is a copy of the points in the mutable part.
void Part::removeAll ()
emove all segments from the part.
After calling this method the part is empty.
void Part::removePoint (int pointIndex )
Removes a point from the part.
Segments connecting to this point are removed and the gap filled with a new line segment.
- pointIndex - Zero-based index of the point.
The points in the part are the start and end points of segments. Removing a point can remove the two adjacent segments. A new line segment reconnects the gap.
void Part::removeSegment (int segmentIndex )
Remove a segment at the specified index from the part.
- segmentIndex - Zero-based index of the segment.
If the segment connected to adjacent segments, then after a segment is removed a gap can be left behind.
Esri::ArcGISRuntime::Segment Part::segment(int segmentIndex ) const
Returns a segment at a specified segment index.
- segmentIndex - Zero-based index of the segment.
See also setSegment().
int Part::segmentCount () const
Returns the count of segments in the part.
int Part::segmentIndexFromEndPointIndex (int pointIndex ) const
Returns converts from a point index to a segment index that uses the given point as an end point.
If the point is not an end point, then -1 is returned.
- pointIndex - Zero-based index of the point.
void Part::segmentIndexFromPointIndex (int pointIndex , int &outStartPointSegmentIndex , int &outEndPointSegmentIndex ) const
Converts from a point index to a segment index of the start point and another segment index containing the end point.
If the point is not a start or end point, then -1 is set.
- pointIndex - Zero-based index of the point.
- outStartPointSegmentIndex - This is set to the segment index using the point as a start point. Can be empty.
- outEndPointSegmentIndex - This is set to the segment index using the point as an end point. Can be empty.
int Part::segmentIndexFromStartPointIndex (int pointIndex ) const
Converts from a point index to a segment index that uses the given point as a start point.
If the point is not a start point, then -1 is returned.
- pointIndex - Zero-based index of the point.
void Part::setPoint (int pointIndex , const Esri::ArcGISRuntime::Point &point)
Replace a point in the part at the specified point index.
Segments that use this point are changed.
- pointIndex - Zero-based index of the point.
- point - The point.
The points in the part correspond to start and end points of segments. Setting a new point affects 1 or 2 segments using the point at the specified index. The type of affected segment(s) (LineSegment, CubicBezierSegment or EllipticArcSegment) remains 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)
Replaces a segment at the specified index in the part.
- segmentIndex - Zero-based index of the segment.
- segment - The segment to be set into the collection.
The points of the part can change if the input segment is not coincident with the start and end points of the segment that's being replaced.
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
Returns the point index of the segment's start point.
- segmentIndex - Zero-based index of the segment.