Class: Kamelopard::Polygon

Inherits:
Geometry show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to the KML Polygon class

Instance Attribute Summary collapse

Attributes inherited from Object

#comment, #kml_id

Instance Method Summary collapse

Methods inherited from Object

#change

Constructor Details

#initialize(outer, options = {}) ⇒ Polygon

Returns a new instance of Polygon.



1930
1931
1932
1933
1934
1935
1936
# File 'lib/kamelopard/classes.rb', line 1930

def initialize(outer, options = {})
  #extrude = 0, altitudeMode = :clampToGround)
    @extrude = 0
    @altitudeMode = :clampToGround
    @inner = []
    super options
end

Instance Attribute Details

#altitudeModeObject

NB! No support for tessellate, because Google Earth doesn’t support it, it seems



1928
1929
1930
# File 'lib/kamelopard/classes.rb', line 1928

def altitudeMode
  @altitudeMode
end

#extrudeObject

NB! No support for tessellate, because Google Earth doesn’t support it, it seems



1928
1929
1930
# File 'lib/kamelopard/classes.rb', line 1928

def extrude
  @extrude
end

#innerObject

NB! No support for tessellate, because Google Earth doesn’t support it, it seems



1928
1929
1930
# File 'lib/kamelopard/classes.rb', line 1928

def inner
  @inner
end

#outerObject

NB! No support for tessellate, because Google Earth doesn’t support it, it seems



1928
1929
1930
# File 'lib/kamelopard/classes.rb', line 1928

def outer
  @outer
end

Instance Method Details

#<<(a) ⇒ Object



1946
1947
1948
# File 'lib/kamelopard/classes.rb', line 1946

def <<(a)
    @inner << a
end

#to_kml(elem = nil) ⇒ Object



1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
# File 'lib/kamelopard/classes.rb', line 1950

def to_kml(elem = nil)
    k = XML::Node.new 'Polygon'
    super k
    e = XML::Node.new 'extrude'
    e << @extrude.to_s
    k << e
    Kamelopard.add_altitudeMode @altitudeMode, k
    e = XML::Node.new('outerBoundaryIs')
    e << @outer.to_kml
    k << e
    @inner.each do |i|
        e = XML::Node.new('innerBoundaryIs')
        e << i.to_kml
        k << e
    end
    elem << k unless elem.nil?
    k
end