Sha256: 11c5e70dccdc85a87112d7d887b95fc8ba4827c174067fb7936a4e49d70361ab

Contents?: true

Size: 1.54 KB

Versions: 10

Compression:

Stored size: 1.54 KB

Contents

module H3
  module Bindings
    # FFI Structs.
    #
    # These match the structs defined in H3's header file and are required
    # to correctly interact with the library's functions.
    module Structs
      extend FFI::Library

      class GeoCoord < FFI::Struct
        layout :lat, :double,
               :lon, :double
      end

      class GeoBoundary < FFI::Struct
        layout :num_verts, :int,
               :verts, [GeoCoord, 10] # array of GeoCoord structs (must be fixed length)
      end

      class GeoFence < FFI::Struct
        layout :num_verts, :int,
               :verts, :pointer # array of GeoCoord structs
      end

      class GeoPolygon < FFI::Struct
        layout :geofence, GeoFence,
               :num_holes, :int,
               :holes, :pointer # array of GeoFence structs
      end

      class GeoMultiPolygon < FFI::Struct
        layout :num_polygons, :int,
               :polygons, :pointer # array of GeoPolygon structs
      end

      class LinkedGeoCoord < FFI::Struct
        layout :vertex, GeoCoord,
               :next, LinkedGeoCoord.ptr
      end

      class LinkedGeoLoop < FFI::Struct
        layout :first, LinkedGeoCoord.ptr,
               :last, LinkedGeoCoord.ptr,
               :next, LinkedGeoLoop.ptr
      end

      class LinkedGeoPolygon < FFI::Struct
        layout :first, LinkedGeoLoop.ptr,
               :last, LinkedGeoLoop.ptr,
               :next, LinkedGeoPolygon.ptr
      end

      class CoordIJ < FFI::Struct
        layout :i, :int,
               :j, :int
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
h3-3.7.2 lib/h3/bindings/structs.rb
h3-3.7.1 lib/h3/bindings/structs.rb
h3-3.6.2 lib/h3/bindings/structs.rb
h3-3.6.1 lib/h3/bindings/structs.rb
h3-3.6.0 lib/h3/bindings/structs.rb
h3-3.5.1 lib/h3/bindings/structs.rb
h3-3.5.0 lib/h3/bindings/structs.rb
h3-3.4.4 lib/h3/bindings/structs.rb
h3-3.4.0 lib/h3/bindings/structs.rb
h3-3.3.1 lib/h3/bindings/structs.rb