@@ -7,57 +7,71 @@ module Bindings
77 module Private
88 extend H3 ::Bindings ::Base
99
10- attach_function :compact , [ H3IndexesIn , H3IndexesOut , :size_t ] , :bool
11- attach_function :destroy_linked_polygon , :destroyLinkedPolygon , [ LinkedGeoPolygon ] , :void
12- attach_function :geo_to_h3 , :geoToH3 , [ GeoCoord , Resolution ] , :h3_index
13- attach_function :get_pentagon_indexes , :getPentagonIndexes , [ :int , H3IndexesOut ] , :void
14- attach_function :h3_faces , :h3GetFaces , %i[ h3_index buffer_out ] , :void
15- attach_function :h3_indexes_from_unidirectional_edge ,
16- :getH3IndexesFromUnidirectionalEdge ,
17- [ :h3_index , H3IndexesOut ] , :void
18- attach_function :h3_line , :h3Line , [ :h3_index , :h3_index , H3IndexesOut ] , :int
19- attach_function :h3_unidirectional_edges_from_hexagon ,
20- :getH3UnidirectionalEdgesFromHexagon ,
21- [ :h3_index , H3IndexesOut ] , :void
22- attach_function :h3_set_to_linked_geo ,
23- :h3SetToLinkedGeo ,
24- [ H3IndexesIn , :size_t , LinkedGeoPolygon ] ,
25- :void
26- attach_function :h3_to_children , :h3ToChildren , [ :h3_index , Resolution , H3IndexesOut ] , :void
27- attach_function :h3_to_geo , :h3ToGeo , [ :h3_index , GeoCoord ] , :void
28- attach_function :h3_to_string , :h3ToString , %i[ h3_index buffer_out size_t ] , :void
10+ def self . safe_call ( out_type , method , *in_args )
11+ out = FFI ::MemoryPointer . new ( out_type )
12+ send ( method , *in_args + [ out ] ) . tap do |code |
13+ Error ::raise_error ( code ) unless code . zero?
14+ end
15+ out . send ( "read_#{ out_type } " . to_sym )
16+ end
17+
18+ attach_function :cellToParent , [ :h3_index , Resolution , H3Index ] , :h3_error_code
19+ attach_function :compactCells , [ H3IndexesIn , H3IndexesOut , :int64 ] , :h3_error_code
20+ # attach_function :destroy_linked_polygon, :destroyLinkedPolygon, [LinkedGeoPolygon], :void
21+ attach_function :edge_length_km , :getHexagonEdgeLengthAvgKm , [ Resolution , :pointer ] , :h3_error_code
22+ attach_function :from_string , :stringToH3 , %i[ string pointer ] , :h3_error_code
23+ attach_function :geo_to_h3 , :latLngToCell , [ LatLng , Resolution , :pointer ] , :h3_error_code
24+ # attach_function :get_pentagon_indexes, :getPentagonIndexes, [:int, H3IndexesOut], :void
25+ attach_function :hexagon_count , :getNumCells , [ Resolution , :pointer ] , :h3_error_code
26+ attach_function :h3_faces , :getIcosahedronFaces , %i[ h3_index buffer_out ] , :h3_error_code
27+ # attach_function :h3_indexes_from_unidirectional_edge,
28+ # :getH3IndexesFromUnidirectionalEdge,
29+ # [:h3_index, H3IndexesOut], :void
30+ # attach_function :h3_line, :h3Line, [:h3_index, :h3_index, H3IndexesOut], :int
31+ # attach_function :h3_unidirectional_edges_from_hexagon,
32+ # :getH3UnidirectionalEdgesFromHexagon,
33+ # [:h3_index, H3IndexesOut], :void
34+ # attach_function :h3_set_to_linked_geo,
35+ # :h3SetToLinkedGeo,
36+ # [H3IndexesIn, :size_t, LinkedGeoPolygon],
37+ # :void
38+ attach_function :h3_to_children , :cellToChildren , [ :h3_index , Resolution , H3IndexesOut ] , :h3_error_code
39+ attach_function :h3_to_geo , :cellToLatLng , [ :h3_index , LatLng ] , :h3_error_code
40+ attach_function :h3_to_string , :h3ToString , %i[ h3_index buffer_out size_t ] , :h3_error_code
2941 attach_function :h3_to_geo_boundary ,
30- :h3ToGeoBoundary ,
31- [ :h3_index , GeoBoundary ] ,
32- :void
33- attach_function :h3_unidirectional_edge_boundary ,
34- :getH3UnidirectionalEdgeBoundary ,
35- [ :h3_index , GeoBoundary ] , :void
36- attach_function :hex_range , :hexRange , [ :h3_index , :k_distance , H3IndexesOut ] , :bool
37- attach_function :hex_range_distances ,
38- :hexRangeDistances ,
39- [ :h3_index , :k_distance , H3IndexesOut , :buffer_out ] , :bool
40- attach_function :hex_ranges ,
41- :hexRanges ,
42- [ H3IndexesIn , :size_t , :k_distance , H3IndexesOut ] ,
43- :bool
44- attach_function :hex_ring , :hexRing , [ :h3_index , :k_distance , H3IndexesOut ] , :bool
45- attach_function :k_ring , :kRing , [ :h3_index , :k_distance , H3IndexesOut ] , :void
46- attach_function :k_ring_distances ,
47- :kRingDistances ,
48- [ :h3_index , :k_distance , H3IndexesOut , :buffer_out ] ,
49- :bool
50- attach_function :max_polyfill_size ,
51- :maxPolyfillSize ,
52- [ GeoPolygon , Resolution ] ,
53- :int
54- attach_function :max_uncompact_size , :maxUncompactSize , [ H3IndexesIn , :size_t , Resolution ] , :int
55- attach_function :point_distance_rads , :pointDistRads , [ GeoCoord , GeoCoord ] , :double
56- attach_function :point_distance_km , :pointDistKm , [ GeoCoord , GeoCoord ] , :double
57- attach_function :point_distance_m , :pointDistM , [ GeoCoord , GeoCoord ] , :double
58- attach_function :polyfill , [ GeoPolygon , Resolution , H3IndexesOut ] , :void
59- attach_function :res_0_indexes , :getRes0Indexes , [ H3IndexesOut ] , :void
60- attach_function :uncompact , [ H3IndexesIn , :size_t , H3IndexesOut , :size_t , Resolution ] , :bool
42+ :cellToBoundary ,
43+ [ :h3_index , CellBoundary ] ,
44+ :h3_error_code
45+ # attach_function :h3_unidirectional_edge_boundary,
46+ # :getH3UnidirectionalEdgeBoundary,
47+ # [:h3_index, CellBoundary], :void
48+ # attach_function :hex_range, :hexRange, [:h3_index, :k_distance, H3IndexesOut], :bool
49+ # attach_function :hex_range_distances,
50+ # :hexRangeDistances,
51+ # [:h3_index, :k_distance, H3IndexesOut, :buffer_out], :bool
52+ # attach_function :hex_ranges,
53+ # :hexRanges,
54+ # [H3IndexesIn, :size_t, :k_distance, H3IndexesOut],
55+ # :bool
56+ # attach_function :hex_ring, :hexRing, [:h3_index, :k_distance, H3IndexesOut], :bool
57+ attach_function :k_ring , :gridDisk , [ :h3_index , :k_distance , H3IndexesOut ] , :h3_error_code
58+ # attach_function :k_ring_distances,
59+ # :kRingDistances,
60+ # [:h3_index, :k_distance, H3IndexesOut, :buffer_out],
61+ # :bool
62+ attach_function :max_children , :cellToChildrenSize , [ :h3_index , Resolution , :pointer ] , :h3_error_code
63+ attach_function :max_face_count , :maxFaceCount , %i[ h3_index pointer ] , :h3_error_code
64+ # attach_function :max_polyfill_size,
65+ # :maxPolyfillSize,
66+ # [GeoPolygon, Resolution],
67+ # :int
68+ attach_function :max_uncompact_size , :uncompactCellsSize , [ H3IndexesIn , :int64 , Resolution , :pointer ] , :h3_error_code
69+ # attach_function :point_distance_rads, :pointDistRads, [GeoCoord, GeoCoord], :double
70+ # attach_function :point_distance_km, :pointDistKm, [GeoCoord, GeoCoord], :double
71+ # attach_function :point_distance_m, :pointDistM, [GeoCoord, GeoCoord], :double
72+ # attach_function :polyfill, [GeoPolygon, Resolution, H3IndexesOut], :void
73+ attach_function :res_0_indexes , :getRes0Cells , [ H3IndexesOut ] , :h3_error_code
74+ attach_function :uncompactCells , [ H3IndexesIn , :size_t , H3IndexesOut , :size_t , Resolution ] , :h3_error_code
6175 end
6276 end
6377end
0 commit comments