Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move ContainmentMode to h3api.h #958

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ The public API of this library consists of the functions declared in file

## [Unreleased]

### Changed
- Moved `ContainmentMode` enum for `polygonToCellsExperimental` to `h3api.h`. (#958)

## [4.2.0] - 2024-12-04
### Added
- Added experimental new algorithm for `polygonToCells`, called `polygonToCellsExperimental`, that supports more containment flags and is more memory-efficient (#785, #800, #947)
Expand Down
12 changes: 12 additions & 0 deletions src/h3lib/include/h3api.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ typedef struct {
GeoPolygon *polygons;
} GeoMultiPolygon;

/**
* Values representing polyfill containment modes, to be used in
* the `flags` bit field for `polygonToCellsExperimental`.
*/
typedef enum {
CONTAINMENT_CENTER = 0, ///< Cell center is contained in the shape
CONTAINMENT_FULL = 1, ///< Cell is fully contained in the shape
CONTAINMENT_OVERLAPPING = 2, ///< Cell overlaps the shape at any point
CONTAINMENT_OVERLAPPING_BBOX = 3, ///< Cell bounding box overlaps shape
CONTAINMENT_INVALID = 4 ///< This mode is invalid and should not be used
} ContainmentMode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not blocking, just a thought: do we want to label this like ContainmentModeExperimental?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly we should do so. This does not seem to be part of the experimental API (except maybe overlapping_bbox) and should be easier to change because it is not part of the ABI.


/** @struct LinkedLatLng
* @brief A coordinate node in a linked geo structure, part of a linked list
*/
Expand Down
12 changes: 0 additions & 12 deletions src/h3lib/include/polygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@
/** Macro: Whether a GeoLoop is empty */
#define IS_EMPTY_GEOFENCE(geoloop) geoloop->numVerts == 0

/**
* Values representing polyfill containment modes, to be used in
* the `flags` bit field.
*/
typedef enum {
CONTAINMENT_CENTER = 0, ///< Cell center is contained in the shape
CONTAINMENT_FULL = 1, ///< Cell is fully contained in the shape
CONTAINMENT_OVERLAPPING = 2, ///< Cell overlaps the shape at any point
CONTAINMENT_OVERLAPPING_BBOX = 3, ///< Cell bounding box overlaps shape
CONTAINMENT_INVALID = 4 ///< This mode is invalid and should not be used
} ContainmentMode;

// 1s in the 4 bits defining the polyfill containment mode, 0s elsewhere
#define FLAG_CONTAINMENT_MODE_MASK ((uint32_t)(15))
#define FLAG_GET_CONTAINMENT_MODE(flags) (flags & FLAG_CONTAINMENT_MODE_MASK)
Expand Down
Loading