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.



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

def initialize(node)
  @node = node
end

Instance Method Details

#first_pointObject



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

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

#first_point_proxyObject



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

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

#last_pointObject



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

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

#last_point_proxyObject



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

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

#pointsObject



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

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

#to_sObject



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

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