Skip to content

Commit

Permalink
move ContainmentMode to h3api.h (#958)
Browse files Browse the repository at this point in the history
* move ContainmentMode to h3api.h

* changelog
  • Loading branch information
isaacbrodsky authored Dec 31, 2024
1 parent d5af234 commit 0e515cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
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;

/** @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

0 comments on commit 0e515cf

Please sign in to comment.