Class: Neo4j::Spatial::OSMLayer
Constant Summary
Constants inherited from Layer
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
- #add_dynamic_layer(options = {}) ⇒ Object
-
#initialize(layer_name, options = {}) ⇒ OSMLayer
constructor
A new instance of OSMLayer.
-
#list ⇒ Object
List dynamic layers associated with this layer.
- #remove_dynamic_layer(options = {}) ⇒ Object
Methods inherited from Layer
#describe, #empty?, exist?, find, #geometry, list, #method_missing, names, #parent, #respond_to?, #to_s, #type_name
Methods included from Database
#batch_inserter, #database, #list_all, #normal_database, #spatial
Constructor Details
#initialize(layer_name, options = {}) ⇒ OSMLayer
Returns a new instance of OSMLayer.
69 70 71 72 73 74 |
# File 'lib/neo4j/spatial/osm.rb', line 69 def initialize(layer_name,={}) super(layer_name, .merge({ :type => org.neo4j.gis.spatial.osm.OSMLayer, :encoder => OSMGeometryEncoder })) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Neo4j::Spatial::Layer
Instance Method Details
#add_dynamic_layer(options = {}) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/neo4j/spatial/osm.rb', line 78 def add_dynamic_layer(={}) delete = .delete(:delete) [:default] ||= :linestring geometry = Geometry.new() .delete :default name ||= .delete(:layer_name) || !.empty? && .to_a.flatten.compact.join('-').gsub(/\-+$/,'') || geometry.to_s if list.grep(name).length > 0 if delete puts "Deleting dynamic layer '#{name}'[Geometry:#{geometry}]: #{.inspect}" layer.remove_dynamic_layer(name.to_s) else puts "We already have a dynamic layer called '#{name}'" end else if delete puts "No such dynamic layer found for OSM-layer '#{self}': #{name}" else puts "Creating new dynamic layer '#{name}'[Geometry:#{geometry}]: #{.inspect}" layer.(name.to_s, geometry.gtype, java.util.HashMap.new()) end end end |
#list ⇒ Object
List dynamic layers associated with this layer
103 104 105 |
# File 'lib/neo4j/spatial/osm.rb', line 103 def list @layer.layer_names end |
#remove_dynamic_layer(options = {}) ⇒ Object
75 76 77 |
# File 'lib/neo4j/spatial/osm.rb', line 75 def remove_dynamic_layer(={}) add_dynamic_layer(.merge(:delete => true)) end |