Class: KML::Container

Inherits:
Feature show all
Defined in:
lib/kml/container.rb

Overview

A Container is an abstract base class that holds one or more Features and allows the creation of nested hierarchies.

Direct Known Subclasses

Document, Folder, Geometry, Placemark

Instance Attribute Summary collapse

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

Instance Method Summary collapse

Methods inherited from Feature

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

Methods inherited from Object

#initialize

Constructor Details

This class inherits a constructor from KML::Object

Instance Attribute Details

#featuresObject

Get the features in the container



6
7
8
# File 'lib/kml/container.rb', line 6

def features
  @features
end

#plain_childrenObject

Returns the value of attribute plain_children.



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

def plain_children
  @plain_children
end

Instance Method Details

#parse(node) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kml/container.rb', line 18

def parse(node)
  super(node) do |cld|
    case cld.name
    when 'Document'
      self.features << KML::Document.parse(cld)
    when 'Folder'
      self.features << KML::Folder.parse(cld)
    when 'NetworkLink'
    when 'Placemark'
      self.features << KML::Placemark.parse(cld)
    when 'GroundOverlay'
    when 'PhotoOverlay'
    when 'ScreenOverlay'
    else
      yield cld
    end
  end
  self
end