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, #master_only

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

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

Returns a new instance of Polygon.



2425
2426
2427
2428
2429
2430
2431
2432
# File 'lib/kamelopard/classes.rb', line 2425

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

Instance Attribute Details

#altitudeModeObject

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



2423
2424
2425
# File 'lib/kamelopard/classes.rb', line 2423

def altitudeMode
  @altitudeMode
end

#extrudeObject

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



2423
2424
2425
# File 'lib/kamelopard/classes.rb', line 2423

def extrude
  @extrude
end

#innerObject

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



2423
2424
2425
# File 'lib/kamelopard/classes.rb', line 2423

def inner
  @inner
end

#outerObject

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



2423
2424
2425
# File 'lib/kamelopard/classes.rb', line 2423

def outer
  @outer
end

Instance Method Details

#<<(a) ⇒ Object



2442
2443
2444
# File 'lib/kamelopard/classes.rb', line 2442

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

#to_kml(elem = nil) ⇒ Object



2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
# File 'lib/kamelopard/classes.rb', line 2446

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