class OGR::GeometryFieldDefinition
Attributes
c_pointer[R]
@return [FFI::Pointer]
read_only[W]
@param value [Boolean]
Public Class Methods
new(name_or_pointer, type = :wkbUnknown)
click to toggle source
@param name_or_pointer [String, FFI::Pointer] @param type [FFI::OGR::API::WKBGeometryType]
# File lib/ogr/geometry_field_definition.rb, line 20 def initialize(name_or_pointer, type = :wkbUnknown) pointer = if name_or_pointer.is_a? String FFI::OGR::API.OGR_GFld_Create(name_or_pointer, type) else name_or_pointer end if !pointer.is_a?(FFI::Pointer) || pointer.null? raise OGR::InvalidGeometryFieldDefinition, "Unable to create #{self.class.name} from #{name_or_pointer}" end @c_pointer = FFI::AutoPointer.new(pointer, GeometryFieldDefinition.method(:release)) @c_pointer.autorelease = false @read_only = false end
release(pointer)
click to toggle source
@param pointer [FFI::Pointer]
# File lib/ogr/geometry_field_definition.rb, line 6 def self.release(pointer) return unless pointer && !pointer.null? FFI::OGR::API.OGR_GFld_Destroy(pointer) end
Public Instance Methods
destroy!()
click to toggle source
# File lib/ogr/geometry_field_definition.rb, line 42 def destroy! GeometryFieldDefinition.release(@c_pointer) @c_pointer = nil end
ignore=(value)
click to toggle source
@param value [Boolean]
# File lib/ogr/geometry_field_definition.rb, line 110 def ignore=(value) raise OGR::ReadOnlyObject if @read_only FFI::OGR::API.OGR_GFld_SetIgnored(@c_pointer, value) end
ignored?()
click to toggle source
@return [Boolean]
# File lib/ogr/geometry_field_definition.rb, line 105 def ignored? FFI::OGR::API.OGR_GFld_IsIgnored(@c_pointer) end
name()
click to toggle source
@return [String]
# File lib/ogr/geometry_field_definition.rb, line 49 def name name, ptr = FFI::OGR::API.OGR_GFld_GetNameRef(@c_pointer) ptr.autorelease = false name end
name=(new_name)
click to toggle source
@param new_name [String]
# File lib/ogr/geometry_field_definition.rb, line 57 def name=(new_name) raise OGR::ReadOnlyObject if @read_only FFI::OGR::API.OGR_GFld_SetName(@c_pointer, new_name) end
read_only?()
click to toggle source
@return [Boolean]
# File lib/ogr/geometry_field_definition.rb, line 38 def read_only? @read_only || false end
spatial_reference()
click to toggle source
@return [OGR::SpatialReference]
# File lib/ogr/geometry_field_definition.rb, line 76 def spatial_reference spatial_ref_ptr = FFI::OGR::API.OGR_GFld_GetSpatialRef(@c_pointer) if spatial_ref_ptr.nil? || spatial_ref_ptr.null? nil else auto_ptr = FFI::AutoPointer.new(spatial_ref_ptr, OGR::SpatialReference.method(:release)) OGR::SpatialReference.new(auto_ptr) end end
spatial_reference=(new_spatial_reference)
click to toggle source
This function drops the reference of the previously set SRS object and acquires a new reference on the passed object (if non-NULL).
@param new_spatial_reference [OGR::SpatialReference, FFI::Pointer]
# File lib/ogr/geometry_field_definition.rb, line 92 def spatial_reference=(new_spatial_reference) raise OGR::ReadOnlyObject if @read_only spatial_ref_ptr = GDAL._pointer(OGR::SpatialReference, new_spatial_reference, autorelease: false) raise if spatial_ref_ptr.null? FFI::OGR::API.OGR_GFld_SetSpatialRef( @c_pointer, spatial_ref_ptr ) end
type()
click to toggle source
@return [FFI::OGR::API::WKBGeometryType]
# File lib/ogr/geometry_field_definition.rb, line 64 def type FFI::OGR::API.OGR_GFld_GetType(@c_pointer) end
type=(new_type)
click to toggle source
@param new_type [FFI::OGR::API::WKBGeometryType]
# File lib/ogr/geometry_field_definition.rb, line 69 def type=(new_type) raise OGR::ReadOnlyObject if @read_only FFI::OGR::API.OGR_GFld_SetType(@c_pointer, new_type) end