Class: GBTiles::GBM::Map::Objects::MapTileData
- Inherits:
-
GBTiles::GBM::Map::Object
- Object
- GBTiles::GBM::Map::Object
- GBTiles::GBM::Map::Objects::MapTileData
- Defined in:
- lib/gbtiles/gbm/map/objects/map_tile_data.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
Returns the value of attribute records.
Attributes inherited from GBTiles::GBM::Map::Object
#master_id, #object_id, #object_type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MapTileData
constructor
A new instance of MapTileData.
- #row(row, width = 16) ⇒ Object
Constructor Details
#initialize ⇒ MapTileData
9 10 11 12 13 |
# File 'lib/gbtiles/gbm/map/objects/map_tile_data.rb', line 9 def initialize super GBTiles::GBM::Map::OBJECT_TYPE[:map_tile_data] @records = [] end |
Instance Attribute Details
#records ⇒ Object
Returns the value of attribute records.
7 8 9 |
# File 'lib/gbtiles/gbm/map/objects/map_tile_data.rb', line 7 def records @records end |
Class Method Details
.initFromBitString(src) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gbtiles/gbm/map/objects/map_tile_data.rb', line 15 def self.initFromBitString src object = GBTiles::GBM::Map::Objects::MapTileData.new while !src.empty? # Get the record number = src.slice!(0..2) # Get 24-bits (3 bytes) number = 0.chr + number # Convert from 24-bit to 32-bit number = number.unpack("N").first # Unpack integer object.records << GBTiles::GBM::Map::Objects::MapTileDataRecord.initFromBitString(number) end object end |
Instance Method Details
#row(row, width = 16) ⇒ Object
30 31 32 |
# File 'lib/gbtiles/gbm/map/objects/map_tile_data.rb', line 30 def row row, width = 16 @records[(width * (row - 1))..((width * row) - 1)] end |