Skip To Content ArcGIS for Developers Sign In Dashboard

Part Class

(Esri::ArcGISRuntime::Part)

A mutable collection of Segments that together define the shape of a part in a multipart geometry under construction. More...

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

Public Functions

Part(const SpatialReference &spatialReference, QObject *parent = nullptr)
~Part()
int addPoint(const Point &point)
int addPoint(double x, double y)
int addPoint(double x, double y, double z)
void addPoints(const QList<Point> &points)
int addSegment(const Segment &segment)
Point endPoint() const
int endPointIndexFromSegmentIndex(int segmentIndex) const
void insertPoint(int pointIndex, const 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 Segment &segment)
bool isEmpty() const
Point point(int pointIndex) const
int pointCount() const
ImmutablePointCollection points() const
void removeAll()
void removePoint(int pointIndex)
void removeSegment(int segmentIndex)
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 Point &point)
void setSegment(int segmentIndex, const Segment &segment)
SpatialReference spatialReference() const
Point startPoint() const
int startPointIndexFromSegmentIndex(int segmentIndex) const
  • 31 public functions inherited from QObject

Additional Inherited Members

Detailed Description

A mutable collection of Segments that together define the shape of a part in a multipart geometry under construction.

This class is used in Polygon and Polyline constructors, and by the MultipartBuilder parts() method.

Use the inherited methods to define and change the shape of the geometry by adding, removing, or changing its segments. Additionally, the addPoint and removePoint point-based helper methods allow you to work with points that represent the vertices of the part, instead of working with segments.

The spatial reference of any geometry added to a part must match that of the part, or be unspecified (in which case the geometry is assumed to have the same SpatialReference as the part). Added geometries are not reprojected.

Member Function Documentation

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

Constructor that takes a spatialReference and an optional parent.

Part::~Part()

Destructor.

int Part::addPoint(const Point &point)

Adds a point.

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

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

Adds a point with the given x and y coordinates.

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

The coordinates must be in the spatial reference of the Part.

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

Adds a point with the given x, y and z coordinates.

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

The coordinates must be in the spatial reference of the Part.

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

Adds a list of points to the part.

This function was introduced in Esri::ArcGISRuntime 100.1.

int Part::addSegment(const Segment &segment)

Adds a segment.

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

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.

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

Inserts a point at pointIndex.

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

Inserts a point at pointIndex from x and y values.

Note: The coordinates must be in the spatial reference of the Part.

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

Inserts a point at pointIndex from x, y and z values.

Note: The coordinates must be in the spatial reference of the Part.

void Part::insertSegment(int segmentIndex, const 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.

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.

ImmutablePointCollection Part::points() const

Gets the points of the ImmutablePart as an ImmutablePointCollection.

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.

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 Point &point)

Reassigns the point at pointIndex to point.

See also point().

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

Reassigns the segment at segmentIndex to segment.

See also segment().

SpatialReference Part::spatialReference() const

Gets the spatial reference of this Part.

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.


Feedback on this topic?