Sha256: d4cc206d2515193be65837b69da707b931dca0ab78780fa85cc31fa725e1cde1

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

require_relative "line_string"

module OGR
  class LinearRing < LineString
    # @param [FFI::Pointer] geometry_ptr
    def initialize(geometry_ptr = nil, spatial_reference: nil)
      geometry_ptr ||= OGR::Geometry.create(:wkbLinearRing)

      super(geometry_ptr, spatial_reference: spatial_reference)
    end

    def to_line_string
      line_string = OGR::LineString.new
      line_string.spatial_reference = spatial_reference if spatial_reference
      line_string.import_from_wkt(to_wkt.sub("LINEARRING", "LINESTRING"))

      line_string
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ffi-gdal-1.1.0 lib/ogr/geometries/linear_ring.rb
ffi-gdal-1.0.4 lib/ogr/geometries/linear_ring.rb
ffi-gdal-1.0.3 lib/ogr/geometries/linear_ring.rb