class Geos::BufferParams

Constants

VALID_PARAMETERS

Public Class Methods

new(params = {}) click to toggle source

The defaults for the params according to GEOS are as found in Geos::Constants::BUFFER_PARAMS_DEFAULTS. Note that when setting the :quad_segs value that you should set it before setting other values like :join and :mitre_limit, as GEOS contains logic concerning how the :quad_segs value affects these parameters and vice versa. For details, refer to src/operation/buffer/BufferParameters.cpp and the BufferParameters::setQuadrantSegments(int) method in the GEOS source code for details.

# File lib/ffi-geos/buffer_params.rb, line 24
def initialize(params = {})
  params = Geos::Constants::BUFFER_PARAM_DEFAULTS.merge(params)

  ptr = FFIGeos.GEOSBufferParams_create_r(Geos.current_handle_pointer)
  @ptr = FFI::AutoPointer.new(
    ptr,
    self.class.method(:release)
  )

  @params = {}
  VALID_PARAMETERS.each do |param|
    send("#{param}=", params[param])
  end
end

Public Instance Methods

endcap=(value) click to toggle source
# File lib/ffi-geos/buffer_params.rb, line 43
def endcap=(value)
  check_enum_value(Geos::BufferCapStyles, value)

  @params[:endcap] = symbol_for_enum(Geos::BufferCapStyles, value) if bool_result(FFIGeos.GEOSBufferParams_setEndCapStyle_r(Geos.current_handle_pointer, ptr, value))
end
join=(value) click to toggle source
# File lib/ffi-geos/buffer_params.rb, line 49
def join=(value)
  check_enum_value(Geos::BufferJoinStyles, value)

  @params[:join] = symbol_for_enum(Geos::BufferJoinStyles, value) if bool_result(FFIGeos.GEOSBufferParams_setJoinStyle_r(Geos.current_handle_pointer, ptr, value))
end
mitre_limit=(value) click to toggle source
# File lib/ffi-geos/buffer_params.rb, line 55
def mitre_limit=(value)
  @params[:mitre_limit] = value if bool_result(FFIGeos.GEOSBufferParams_setMitreLimit_r(Geos.current_handle_pointer, ptr, value))
end
quad_segs=(value) click to toggle source
# File lib/ffi-geos/buffer_params.rb, line 59
def quad_segs=(value)
  @params[:quad_segs] = value if bool_result(FFIGeos.GEOSBufferParams_setQuadrantSegments_r(Geos.current_handle_pointer, ptr, value))
end
single_sided=(value) click to toggle source
# File lib/ffi-geos/buffer_params.rb, line 63
def single_sided=(value)
  @params[:single_sided] = value if bool_result(FFIGeos.GEOSBufferParams_setSingleSided_r(Geos.current_handle_pointer, ptr, Geos::Tools.bool_to_int(value)))
end