Class: KML::Placemark

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

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

#geometryObject

Returns the value of attribute geometry.



27
28
29
# File 'lib/kml/placemark.rb', line 27

def geometry
  @geometry
end

Class Method Details

.parse(node) ⇒ Object



38
39
40
# File 'lib/kml/placemark.rb', line 38

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

Instance Method Details

#parse(node) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/kml/placemark.rb', line 42

def parse(node)
  super(node) do |cld|
    case cld.name
    when 'MultiGeometry'
      self.geometry = KML::MultiGeometry.parse(cld)
    when 'Polygon'
      self.geometry = KML::Polygon.parse(cld)
    when 'Point'
      self.geometry = KML::Point.parse(cld)
    else
      puts "Placemark"
      p cld
      puts
    end
  end
  self
end

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



29
30
31
32
33
34
35
36
# File 'lib/kml/placemark.rb', line 29

def render(xm=Builder::XmlMarkup.new(:indent => 2))
  xm.Placemark {
    super
    features.each { |f| f.render(xm) }
    plain_children.each { |c| xm << c }
    geometry.render(xm) unless geometry.nil?
  }
end