Class: Neo4j::Spatial::OSMWay

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/spatial/osm.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ OSMWay

Returns a new instance of OSMWay.



28
29
30
# File 'lib/neo4j/spatial/osm.rb', line 28

def initialize(node)
  @node = node
end

Instance Method Details

#first_pointObject



31
32
33
# File 'lib/neo4j/spatial/osm.rb', line 31

def first_point
  first_point_proxy.outgoing(:NODE).first
end

#first_point_proxyObject



37
38
39
# File 'lib/neo4j/spatial/osm.rb', line 37

def first_point_proxy
  @node.outgoing(:FIRST_NODE).first
end

#last_pointObject



34
35
36
# File 'lib/neo4j/spatial/osm.rb', line 34

def last_point
  last_point_proxy.outgoing(:NODE).first
end

#last_point_proxyObject



40
41
42
# File 'lib/neo4j/spatial/osm.rb', line 40

def last_point_proxy
  @node.outgoing(:LAST_NODE).first
end

#pointsObject



43
44
45
46
# File 'lib/neo4j/spatial/osm.rb', line 43

def points
  @node.methods.grep(/traver/).join(', ')
  first_point_proxy.outgoing(:NEXT).depth(100000).map{|n| n.outgoing(:NODE).first}
end

#to_sObject



47
48
49
# File 'lib/neo4j/spatial/osm.rb', line 47

def to_s
  @node['name'] || @node.to_s
end