Class: 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 KMLObject
Instance Method Summary collapse
-
#folder ⇒ Object
Returns the current Folder object.
-
#initialize ⇒ Document
constructor
A new instance of Document.
- #styles_to_kml(indent) ⇒ Object
- #to_kml ⇒ Object
-
#tour ⇒ Object
Returns the current Tour object.
Methods inherited from Container
Methods inherited from Feature
#timespan, #timespan=, #timestamp, #timestamp=
Constructor Details
#initialize ⇒ Document
Returns a new instance of Document.
684 685 686 687 688 |
# File 'lib/kamelopard/classes.rb', line 684 def initialize @tours = [] @folders = [] @styles = [] end |
Instance Attribute Details
#flyto_mode ⇒ Object
Returns the value of attribute flyto_mode.
682 683 684 |
# File 'lib/kamelopard/classes.rb', line 682 def flyto_mode @flyto_mode end |
#folders ⇒ Object
Returns the value of attribute folders.
682 683 684 |
# File 'lib/kamelopard/classes.rb', line 682 def folders @folders end |
#tours ⇒ Object
Returns the value of attribute tours.
682 683 684 |
# File 'lib/kamelopard/classes.rb', line 682 def tours @tours end |
#uses_xal ⇒ Object
Returns the value of attribute uses_xal.
682 683 684 |
# File 'lib/kamelopard/classes.rb', line 682 def uses_xal @uses_xal end |
Instance Method Details
#folder ⇒ Object
Returns the current Folder object
697 698 699 700 701 702 |
# File 'lib/kamelopard/classes.rb', line 697 def folder if @folders.size == 0 then Folder.new end @folders.last end |
#styles_to_kml(indent) ⇒ Object
704 705 706 |
# File 'lib/kamelopard/classes.rb', line 704 def styles_to_kml(indent) '' end |
#to_kml ⇒ Object
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
# File 'lib/kamelopard/classes.rb', line 708 def to_kml xal = '' if @uses_xal then xal = ' xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"' end h = <<-doc_header <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"#{ xal }> <Document> doc_header h << super(4) # Print styles first @styles.map do |a| h << a.to_kml(4) unless a.attached? end # then folders @folders.map do |a| h << a.to_kml(4) unless a.has_parent? end # then tours @tours.map do |a| h << a.to_kml(4) end h << "</Document>\n</kml>\n" h end |