Class: Rosemary::BoundingBox
- Defined in:
- lib/rosemary/bounding_box.rb
Overview
OpenStreetMap Boundary Box.
Instance Attribute Summary collapse
-
#maxlat ⇒ Object
Returns the value of attribute maxlat.
-
#maxlon ⇒ Object
Returns the value of attribute maxlon.
-
#minlat ⇒ Object
Returns the value of attribute minlat.
-
#minlon ⇒ Object
Returns the value of attribute minlon.
-
#nodes ⇒ Object
Returns the value of attribute nodes.
-
#relations ⇒ Object
Returns the value of attribute relations.
-
#ways ⇒ Object
Returns the value of attribute ways.
Attributes inherited from Element
#changeset, #id, #tags, #timestamp, #uid, #user, #version
Instance Method Summary collapse
-
#attribute_list ⇒ Object
List of attributes for a bounds element.
-
#initialize(attrs = {}) ⇒ BoundingBox
constructor
Create new Node object.
- #to_xml(options = {}) ⇒ Object
- #type ⇒ Object
Methods inherited from Element
#<=>, #[], #[]=, #add_tags, #attributes, from_api, from_xml, #get_history_from_api, #get_relations_from_api, #initialize_copy, #is_tagged?, #method_missing, #shape, #update_attributes
Constructor Details
#initialize(attrs = {}) ⇒ BoundingBox
Create new Node object.
If id
is nil
a new unique negative ID will be allocated.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rosemary/bounding_box.rb', line 13 def initialize(attrs = {}) attrs = attrs.dup.stringify_keys! @minlat = attrs['minlat'].to_f @minlon = attrs['minlon'].to_f @maxlat = attrs['maxlat'].to_f @maxlon = attrs['maxlon'].to_f @nodes = [] @ways = [] @relations = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rosemary::Element
Instance Attribute Details
#maxlat ⇒ Object
Returns the value of attribute maxlat.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def maxlat @maxlat end |
#maxlon ⇒ Object
Returns the value of attribute maxlon.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def maxlon @maxlon end |
#minlat ⇒ Object
Returns the value of attribute minlat.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def minlat @minlat end |
#minlon ⇒ Object
Returns the value of attribute minlon.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def minlon @minlon end |
#nodes ⇒ Object
Returns the value of attribute nodes.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def nodes @nodes end |
#relations ⇒ Object
Returns the value of attribute relations.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def relations @relations end |
#ways ⇒ Object
Returns the value of attribute ways.
8 9 10 |
# File 'lib/rosemary/bounding_box.rb', line 8 def ways @ways end |
Instance Method Details
#attribute_list ⇒ Object
List of attributes for a bounds element
31 32 33 |
# File 'lib/rosemary/bounding_box.rb', line 31 def attribute_list [:minlat, :minlon, :maxlat, :maxlon] end |
#to_xml(options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rosemary/bounding_box.rb', line 35 def to_xml( = {}) xml = [:builder] ||= Builder::XmlMarkup.new xml.instruct! unless [:skip_instruct] xml.osm(:generator => "rosemary v#{Rosemary::VERSION}", :version => Rosemary::Api::API_VERSION) do xml.bounds(attributes) [ nodes, ways, relations].each do |elements| elements.each { |e| e.to_xml(:builder => xml, :skip_instruct => true) } end end end |
#type ⇒ Object
26 27 28 |
# File 'lib/rosemary/bounding_box.rb', line 26 def type 'BoundingBoxBox' end |