Class: Kamelopard::Document
- Includes:
- Singleton
- Defined in:
- lib/kamelopard/classes.rb
Overview
Represents KML’s Document class. This is a Singleton object; Kamelopard scripts can (for now) manage only one Document at a time.
Instance Attribute Summary collapse
-
#flyto_mode ⇒ Object
Returns the value of attribute flyto_mode.
-
#folders ⇒ Object
Returns the value of attribute folders.
-
#tours ⇒ Object
Returns the value of attribute tours.
-
#uses_xal ⇒ Object
Returns the value of attribute uses_xal.
Attributes inherited from Feature
#abstractView, #addressDetails, #atom_author, #atom_link, #description, #extendedData, #metadata, #name, #open, #phoneNumber, #region, #snippet, #styleSelector, #styleUrl, #styles, #timeprimitive, #visibility
Attributes inherited from Object
Instance Method Summary collapse
-
#folder ⇒ Object
Returns the current Folder object.
-
#get_kml_document ⇒ Object
def styles_to_kml(elem = nil) end.
-
#initialize ⇒ Document
constructor
A new instance of Document.
- #to_kml ⇒ Object
-
#tour ⇒ Object
Returns the current Tour object.
Methods inherited from Container
Methods inherited from Feature
add_author, #styles_to_kml, #timespan, #timespan=, #timestamp, #timestamp=
Constructor Details
#initialize ⇒ Document
Returns a new instance of Document.
716 717 718 719 720 721 |
# File 'lib/kamelopard/classes.rb', line 716 def initialize super @tours = [] @folders = [] @styles = [] end |
Instance Attribute Details
#flyto_mode ⇒ Object
Returns the value of attribute flyto_mode.
714 715 716 |
# File 'lib/kamelopard/classes.rb', line 714 def flyto_mode @flyto_mode end |
#folders ⇒ Object
Returns the value of attribute folders.
714 715 716 |
# File 'lib/kamelopard/classes.rb', line 714 def folders @folders end |
#tours ⇒ Object
Returns the value of attribute tours.
714 715 716 |
# File 'lib/kamelopard/classes.rb', line 714 def tours @tours end |
#uses_xal ⇒ Object
Returns the value of attribute uses_xal.
714 715 716 |
# File 'lib/kamelopard/classes.rb', line 714 def uses_xal @uses_xal end |
Instance Method Details
#folder ⇒ Object
Returns the current Folder object
730 731 732 733 734 735 |
# File 'lib/kamelopard/classes.rb', line 730 def folder if @folders.size == 0 then Folder.new end @folders.last end |
#get_kml_document ⇒ Object
def styles_to_kml(elem = nil)
end
740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
# File 'lib/kamelopard/classes.rb', line 740 def get_kml_document k = REXML::Document.new k << REXML::XMLDecl.default r = REXML::Element.new('kml') if @uses_xal then r.attributes['xmlns:xal'] = "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" end # XXX Should this be add_namespace instead? r.attributes['xmlns'] = 'http://www.opengis.net/kml/2.2' r.attributes['xmlns:gx'] = 'http://www.google.com/kml/ext/2.2' r.attributes['xmlns:kml'] = 'http://www.opengis.net/kml/2.2' r.attributes['xmlns:atom'] = 'http://www.w3.org/2005/Atom' r.elements << self.to_kml k << r k end |
#to_kml ⇒ Object
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
# File 'lib/kamelopard/classes.rb', line 757 def to_kml d = REXML::Element.new 'Document' super(d) # Print styles first @styles.map do |a| a.to_kml(d) unless a.attached? end # then folders @folders.map do |a| a.to_kml(d) unless a.has_parent? end # then tours @tours.map do |a| a.to_kml(d) end d end |