Class: OGR::StyleTable
- Inherits:
-
Object
- Object
- OGR::StyleTable
- Includes:
- Extensions
- Defined in:
- lib/ogr/style_table.rb,
lib/ogr/extensions/style_table/extensions.rb
Defined Under Namespace
Modules: Extensions
Instance Attribute Summary collapse
-
#c_pointer ⇒ FFI::Pointer
readonly
C pointer to the C style table.
Class Method Summary collapse
Instance Method Summary collapse
- #add_style(name, style) ⇒ Boolean
- #destroy! ⇒ Object
- #find(style_name) ⇒ String?
-
#initialize(c_pointer = nil) ⇒ StyleTable
constructor
A new instance of StyleTable.
-
#last_style_name ⇒ String?
The style name of the last string fetched with #next_style.
- #load!(file_name) ⇒ Boolean
-
#next_style ⇒ String?
The next style string from the table.
-
#reset_style_string_reading ⇒ Object
Resets the #next_style to the 0th style.
- #save(file_name) ⇒ Boolean
Methods included from Extensions
Constructor Details
#initialize(c_pointer = nil) ⇒ StyleTable
19 20 21 22 23 24 25 26 27 28 29 |
# 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 |
Instance Attribute Details
#c_pointer ⇒ FFI::Pointer (readonly)
16 17 18 |
# File 'lib/ogr/style_table.rb', line 16 def c_pointer @c_pointer end |
Class Method Details
Instance Method Details
#add_style(name, style) ⇒ Boolean
40 41 42 |
# 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! ⇒ Object
31 32 33 34 35 |
# File 'lib/ogr/style_table.rb', line 31 def destroy! StyleTable.release(@c_pointer) @c_pointer = nil end |
#find(style_name) ⇒ String?
46 47 48 |
# 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 ⇒ String?
51 52 53 |
# File 'lib/ogr/style_table.rb', line 51 def last_style_name FFI::OGR::API.OGR_STBL_GetLastStyleName(@c_pointer) end |
#load!(file_name) ⇒ Boolean
62 63 64 |
# 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 ⇒ String?
56 57 58 |
# File 'lib/ogr/style_table.rb', line 56 def next_style FFI::OGR::API.OGR_STBL_GetNextStyle(@c_pointer) end |