Class: ActiveRoad::OsmPbfImporter::Node

Inherits:
Object
  • Object
show all
Defined in:
app/models/active_road/osm_pbf_importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, lon, lat, addr_housenumber = "", ways = [], end_of_way = false, tags = {}) ⇒ Node

Returns a new instance of Node.



233
234
235
236
237
238
239
240
241
# File 'app/models/active_road/osm_pbf_importer.rb', line 233

def initialize(id, lon, lat, addr_housenumber = "", ways = [], end_of_way = false, tags = {} )
  @id = id
  @lon = lon
  @lat = lat
  @addr_housenumber = addr_housenumber
  @ways = ways
  @end_of_way = end_of_way
  @tags = tags
end

Instance Attribute Details

#addr_housenumberObject

Returns the value of attribute addr_housenumber.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def addr_housenumber
  @addr_housenumber
end

#end_of_wayObject

Returns the value of attribute end_of_way.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def end_of_way
  @end_of_way
end

#idObject

Returns the value of attribute id.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def id
  @id
end

#latObject

Returns the value of attribute lat.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def lon
  @lon
end

#tagsObject

Returns the value of attribute tags.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def tags
  @tags
end

#waysObject

Returns the value of attribute ways.



231
232
233
# File 'app/models/active_road/osm_pbf_importer.rb', line 231

def ways
  @ways
end

Instance Method Details

#add_way(id) ⇒ Object



243
244
245
# File 'app/models/active_road/osm_pbf_importer.rb', line 243

def add_way(id)
  @ways << id
end

#marshal_dumpObject



247
248
249
# File 'app/models/active_road/osm_pbf_importer.rb', line 247

def marshal_dump
  [@id, @lon, @lat, @addr_housenumber, @ways, @end_of_way, @tags]
end

#marshal_load(array) ⇒ Object



251
252
253
# File 'app/models/active_road/osm_pbf_importer.rb', line 251

def marshal_load array
  @id, @lon, @lat, @addr_housenumber, @ways, @end_of_way, @tags = array
end

#used?Boolean

Returns:

  • (Boolean)


255
256
257
# File 'app/models/active_road/osm_pbf_importer.rb', line 255

def used?
  ( ways.present? && ways.size > 1 ) || end_of_way
end