PolygonKey

class HPS::PolygonKey : public HPS::GeometryKey

The PolygonKey class is a smart pointer to a database object. It is a handle to a polygon created by SegmentKey::InsertPolygon.

Public Functions

void Consume(PolygonKit &in_kit)

Completely replaces all settings on this PolygonKit with those set on the specified kit and resets the kit.

Parameters

in_kit – The kit from which to get the settings to replace on this PolygonKit.

PolygonKey &EditPointsByDeletion(size_t in_offset, size_t in_count)

Remove the specified number of points from this PolygonKey at the specified offset.

Parameters
  • in_offset – The offset into the points for PolygonKey at which to remove points.

  • in_count – The number of points to remove.

Returns

A reference to this PolygonKey.

PolygonKey &EditPointsByInsertion(size_t in_offset, PointArray const &in_points)

Add points to this PolygonKey at the specified offset.

Parameters
  • in_offset – The offset into the points for PolygonKey at which to add points.

  • in_points – The points to add to this PolygonKey.

Returns

A reference to this PolygonKey.

PolygonKey &EditPointsByInsertion(size_t in_offset, size_t in_count, Point const in_points[])

Add points to this PolygonKey at the specified offset.

Parameters
  • in_offset – The offset into the points for PolygonKey at which to add points.

  • in_count – Size of the following array.

  • in_points – The points to add to this PolygonKey.

Returns

A reference to this PolygonKey.

PolygonKey &EditPointsByReplacement(size_t in_offset, PointArray const &in_points)

Replace the specified number of points for this PolygonKey at the specified offset.

Parameters
  • in_offset – The offset into the points for PolygonKey at which to start replacing points.

  • in_points – The points to use to replace those on this PolygonKey.

Returns

A reference to this PolygonKey.

PolygonKey &EditPointsByReplacement(size_t in_offset, size_t in_count, Point const in_points[])

Replace the specified number of points for this PolygonKey at the specified offset.

Parameters
  • in_offset – The offset into the points for PolygonKey at which to start replacing points.

  • in_count – Size of the following array.

  • in_points – The points to use to replace those on this PolygonKey.

Returns

A reference to this PolygonKey.

size_t GetPointCount() const

Retrieves the number of points in this polygon.

Returns

The number of points in this polygon.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

PolygonKey &operator=(PolygonKey &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this PolygonKey thereby avoiding a copy.

Parameters

in_that – An rvalue reference to a PolygonKey to take the impl from.

Returns

A reference to this PolygonKey.

PolygonKey &operator=(PolygonKey const &in_that)

Associate this PolygonKey with the same underlying impl as the source PolygonKey.

Parameters

in_that – The source PolygonKey for the assignment.

Returns

A reference to this PolygonKey.

PolygonKey()

The default constructor creates an uninitialized PolygonKey object. The Type() function will return Type::None.

explicit PolygonKey(Key const &in_that)

This constructor creates an PolygonKey object that shares the underlying smart-pointer of the source Key. The copy will only be successful if the source key is really an upcast of a polygon key. Otherwise the copy will fail and the resulting PolygonKey will be invalid.

Parameters

in_key – The source Key to copy.

PolygonKey(PolygonKey &&in_that)

The move constructor creates a PolygonKey by transferring the underlying impl of the rvalue reference to this PolygonKey thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to a PolygonKey to take the impl from.

PolygonKey(PolygonKey const &in_that)

The copy constructor creates a PolygonKey object that shares the underlying smart-pointer of the source PolygonKey.

Parameters

in_that – The source PolygonKey to copy.

void Set(PolygonKit const &in_kit)

Replace those settings on this PolygonKey with those set on the specified kit.

Parameters

in_kit – The kit from which to get the settings to replace on this PolygonKey.

PolygonKey &SetPoints(PointArray const &in_points)

Replace the points on this PolygonKey with the specified points.

Parameters

in_points – The points to use to replace those on this PolygonKey.

Returns

A reference to this PolygonKey.

PolygonKey &SetPoints(size_t in_count, Point const in_points[])

Replace the points on this PolygonKey with the specified points.

Parameters
  • in_count – Size of the following array.

  • in_points – The points to use to replace those on this PolygonKey.

Returns

A reference to this PolygonKey.

void Show(PolygonKit &out_kit) const

Copy the contents of this PolygonKey into the specified kit.

Parameters

out_kit – The kit to populate with the contents of this PolygonKey.

bool ShowPoints(PointArray &out_points) const

Show the points for this PolygonKey.

Parameters

out_points – The points for this PolygonKey.

Returns

true if points were set, false otherwise.

bool ShowPointsByList(size_t in_count, size_t const in_indices[], PointArray &out_points) const

Show a subset of the points for this PolygonKey by list.

Parameters
  • in_count – The number of points to show.

  • in_indices – The list of point indices to show.

  • out_points – The requested points for this PolygonKey.

Returns

true if all requested points were set, false otherwise.

bool ShowPointsByList(SizeTArray const &in_indices, PointArray &out_points) const

Show a subset of the points for this PolygonKey by list.

Parameters
  • in_indices – The list of point indices to show.

  • out_points – The requested points for this PolygonKey.

Returns

true if all requested points were set, false otherwise.

bool ShowPointsByRange(size_t in_start_index, size_t in_count, PointArray &out_points) const

Show a subset of the points for this PolygonKey by range.

Parameters
  • in_start_index – The first point to show.

  • in_count – The number of points to show.

  • out_points – The requested points for this PolygonKey.

Returns

true if all requested points were set, false otherwise.

PointArray Triangulate() const

Divides the polygon into triangles. Note that the data associated with this polygon is left untouched. If the polygon is self-intersecting, the intersection points will be calculated and taken into account If an error is encountered while triangulating the polygon, the returned array will be empty.

Returns

An array of points. Each triplet of points represents one of the triangle that was computed. For example, the returned values 0th, 1st and 2nd points represent the first triangle, and the 3rd, 4th and 5th points represent second one, and so forth.

~PolygonKey()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::PolygonKey