Class: Kamelopard::Placemark
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s Placemark objects. The geometry attribute requires a descendant of Geometry
Instance Attribute Summary collapse
-
#balloonVisibility ⇒ Object
Returns the value of attribute balloonVisibility.
-
#geometry ⇒ Object
Returns the value of attribute geometry.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Feature
#abstractView, #addressDetails, #atom_author, #atom_link, #description, #extendedData, #metadata, #open, #phoneNumber, #region, #snippet, #styleSelector, #styleUrl, #styles, #timeprimitive, #visibility
Attributes included from Snippet
Attributes inherited from Object
#comment, #kml_id, #master_only
Instance Method Summary collapse
- #altitude ⇒ Object
- #altitudeMode ⇒ Object
-
#initialize(name = nil, options = {}) ⇒ Placemark
constructor
A new instance of Placemark.
- #latitude ⇒ Object
- #longitude ⇒ Object
- #point ⇒ Object
- #to_kml(elem = nil) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Feature
add_author, #extended_data_to_kml, #hide, #show, #styles_to_kml, #timespan, #timespan=, #timestamp, #timestamp=
Methods included from Snippet
Methods inherited from Object
#_alternate_to_kml, #change, #master_only?, parse
Constructor Details
#initialize(name = nil, options = {}) ⇒ Placemark
Returns a new instance of Placemark.
1692 1693 1694 1695 |
# File 'lib/kamelopard/classes.rb', line 1692 def initialize(name = nil, = {}) super @name = name unless name.nil? end |
Instance Attribute Details
#balloonVisibility ⇒ Object
Returns the value of attribute balloonVisibility.
1690 1691 1692 |
# File 'lib/kamelopard/classes.rb', line 1690 def balloonVisibility @balloonVisibility end |
#geometry ⇒ Object
Returns the value of attribute geometry.
1690 1691 1692 |
# File 'lib/kamelopard/classes.rb', line 1690 def geometry @geometry end |
#name ⇒ Object
Returns the value of attribute name.
1690 1691 1692 |
# File 'lib/kamelopard/classes.rb', line 1690 def name @name end |
Instance Method Details
#altitude ⇒ Object
1722 1723 1724 |
# File 'lib/kamelopard/classes.rb', line 1722 def altitude @geometry.altitude end |
#altitudeMode ⇒ Object
1726 1727 1728 |
# File 'lib/kamelopard/classes.rb', line 1726 def altitudeMode @geometry.altitudeMode end |
#latitude ⇒ Object
1718 1719 1720 |
# File 'lib/kamelopard/classes.rb', line 1718 def latitude @geometry.latitude end |
#longitude ⇒ Object
1714 1715 1716 |
# File 'lib/kamelopard/classes.rb', line 1714 def longitude @geometry.longitude end |
#point ⇒ Object
1730 1731 1732 1733 1734 1735 1736 1737 1738 |
# File 'lib/kamelopard/classes.rb', line 1730 def point if @geometry.kind_of? Point then @geometry elsif @geometry.respond_to? :point then @geometry.point else raise "This placemark uses a non-point geometry, but the operation you're trying requires a point object" end end |
#to_kml(elem = nil) ⇒ Object
1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 |
# File 'lib/kamelopard/classes.rb', line 1697 def to_kml(elem = nil) k = XML::Node.new 'Placemark' super k @geometry.to_kml(k) unless @geometry.nil? if ! @balloonVisibility.nil? then x = XML::Node.new 'gx:balloonVisibility' x << ( @balloonVisibility ? 1 : 0 ) k << x end elem << k unless elem.nil? k end |
#to_s ⇒ Object
1710 1711 1712 |
# File 'lib/kamelopard/classes.rb', line 1710 def to_s "Placemark id #{ @kml_id } named #{ @name }" end |