-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Bindings for Vertex-Related Functions (#388)
* Update CHANGELOG.md * Update h3lib.pxd * Update latlng.pxd * Update latlng.pyx * Update util.pxd * Update util.pyx * Update _version.py * Update __init__.py * Update __init__.py * Update test_h3.py * Update __init__.py * Update test_h3.py * Update CHANGELOG.md * Update __init__.py * Update test_h3.py * Update _version.py * Update test_h3.py * Update __init__.py * Update CMakeLists.txt * Update latlng.pxd * Update latlng.pyx * Create vertex.pxd * Create vertex.pyx * Update __init__.py * Update test_h3.py * Update __init__.py * Update api_quick.md
- Loading branch information
1 parent
f9d4f24
commit 9a7442b
Showing
12 changed files
with
218 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ install( | |
memory.pyx | ||
util.pxd | ||
util.pyx | ||
vertex.pxd | ||
vertex.pyx | ||
DESTINATION | ||
${SKBUILD_PROJECT_NAME}/_cy | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .h3lib cimport bool, H3int | ||
|
||
cpdef H3int cell_to_vertex(H3int h, int vertex_num) except 1 | ||
cpdef H3int[:] cell_to_vertexes(H3int h) | ||
cpdef (double, double) vertex_to_latlng(H3int v) except * | ||
cpdef bool is_valid_vertex(H3int v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
cimport h3lib | ||
from h3lib cimport bool, H3int | ||
|
||
from .util cimport ( | ||
check_cell, | ||
check_vertex, | ||
coord2deg | ||
) | ||
|
||
from .error_system cimport check_for_error | ||
|
||
from .memory cimport H3MemoryManager | ||
|
||
|
||
cpdef H3int cell_to_vertex(H3int h, int vertex_num) except 1: | ||
cdef: | ||
H3int out | ||
|
||
check_cell(h) | ||
|
||
check_for_error( | ||
h3lib.cellToVertex(h, vertex_num, &out) | ||
) | ||
|
||
return out | ||
|
||
cpdef H3int[:] cell_to_vertexes(H3int h): | ||
cdef: | ||
H3int out | ||
|
||
check_cell(h) | ||
|
||
hmm = H3MemoryManager(6) | ||
check_for_error( | ||
h3lib.cellToVertexes(h, hmm.ptr) | ||
) | ||
mv = hmm.to_mv() | ||
|
||
return mv | ||
|
||
cpdef (double, double) vertex_to_latlng(H3int v) except *: | ||
cdef: | ||
h3lib.LatLng c | ||
|
||
check_vertex(v) | ||
|
||
check_for_error( | ||
h3lib.vertexToLatLng(v, &c) | ||
) | ||
|
||
return coord2deg(c) | ||
|
||
cpdef bool is_valid_vertex(H3int v): | ||
return h3lib.isValidVertex(v) == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters