class OGR::StyleTable
Attributes
c_pointer[R]
@return [FFI::Pointer] C pointer to the C style table.
Public Class Methods
new(c_pointer = nil)
click to toggle source
@param [FFI::Pointer] c_pointer
# File lib/ogr/style_table.rb, line 19 def initialize(c_pointer = nil) @c_pointer = if c_pointer c_pointer else pointer = FFI::OGR::API.OGR_STBL_Create pointer.autorelease = false FFI::AutoPointer.new(pointer, StyleTable.method(:release)) end raise "Unable to create StyleTable" if @c_pointer.null? end
release(pointer)
click to toggle source
@param pointer [FFI::Pointer]
# File lib/ogr/style_table.rb, line 9 def self.release(pointer) return unless pointer && !pointer.null? FFI::OGR::API.OGR_STBL_Destroy(pointer) end
Public Instance Methods
add_style(name, style)
click to toggle source
@param name [String] Name of the style. @param style [String] @return [Boolean]
# File lib/ogr/style_table.rb, line 40 def add_style(name, style) FFI::OGR::API.OGR_STBL_AddStyle(@c_pointer, name, style) end
destroy!()
click to toggle source
# File lib/ogr/style_table.rb, line 31 def destroy! StyleTable.release(@c_pointer) @c_pointer = nil end
find(style_name)
click to toggle source
@param style_name [String] @return [String, nil]
# File lib/ogr/style_table.rb, line 46 def find(style_name) FFI::OGR::API.OGR_STBL_Find(@c_pointer, style_name) end
last_style_name()
click to toggle source
@return [String, nil] The style name of the last string fetched with next_style
.
# File lib/ogr/style_table.rb, line 51 def last_style_name FFI::OGR::API.OGR_STBL_GetLastStyleName(@c_pointer) end
load!(file_name)
click to toggle source
@param file_name [String] @return [Boolean]
# File lib/ogr/style_table.rb, line 62 def load!(file_name) FFI::OGR::API.OGR_STBL_LoadStyleTable(@c_pointer, file_name) end
next_style()
click to toggle source
@return [String, nil] The next style string from the table.
# File lib/ogr/style_table.rb, line 56 def next_style FFI::OGR::API.OGR_STBL_GetNextStyle(@c_pointer) end
reset_style_string_reading()
click to toggle source
Resets the next_style
to the 0th style.
# File lib/ogr/style_table.rb, line 67 def reset_style_string_reading FFI::OGR::API.OGR_STBL_ResetStyleStringReading(@c_pointer) end
save(file_name)
click to toggle source
@param file_name [String] Path to the file to save to. @return [Boolean]
# File lib/ogr/style_table.rb, line 73 def save(file_name) FFI::OGR::API.OGR_STBL_SaveStyleTable(@c_pointer, file_name) end