Sha256: 2d0009e196fbc1a33a8cc78a9a8a1dec9a1e6a7d2f26ef3de2e4b4a70b72649e

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 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, [:double, 20] # 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

1 entries across 1 versions & 1 rubygems

Version Path
h3-3.2.0 lib/h3/bindings/structs.rb