Class: KML::Document

Inherits:
Container show all
Defined in:
lib/kml/document.rb

Overview

A document contains 0 or more features and 0 or more schemas.

Instance Attribute Summary collapse

Attributes inherited from Container

#features, #plain_children

Attributes inherited from Feature

#address, #address_details, #description, #look_at, #metadata, #name, #phone_number, #region, #snippet, #style_selector, #style_url, #time_primitive

Attributes inherited from Object

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Feature

#open, #open=, #open?, #visibility, #visibility=, #visibility?

Methods inherited from Object

#initialize

Constructor Details

This class inherits a constructor from KML::Object

Instance Attribute Details

#schemasObject

Returns the value of attribute schemas.



4
5
6
# File 'lib/kml/document.rb', line 4

def schemas
  @schemas
end

#stylesObject

Shared styles



7
8
9
# File 'lib/kml/document.rb', line 7

def styles
  @styles
end

Class Method Details

.parse(node) ⇒ Object



26
27
28
# File 'lib/kml/document.rb', line 26

def self.parse(node)
  self.new.parse(node)
end

Instance Method Details

#parse(node) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/kml/document.rb', line 30

def parse(node)
  super(node) do |cld|
    case cld.name
    when 'Style'
      # TODO
    when 'Schema'
      # TODO
    else
      puts "Document"
      p cld
      puts
    end
  end
  self
end

#render(xm = Builder::XmlMarkup.new(:indent => 2)) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/kml/document.rb', line 17

def render(xm=Builder::XmlMarkup.new(:indent => 2))
  xm.Document {
    super
    styles.each { |style| style.render(xm) }
    features.each { |feature| feature.render(xm) }
    schemas.each { |schema| schema.render(xm) }
  }
end