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?

Constructor Details

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

Returns a new instance of Polygon.



2303
2304
2305
2306
2307
2308
2309
2310
# File 'lib/kamelopard/classes.rb', line 2303

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



2301
2302
2303
# File 'lib/kamelopard/classes.rb', line 2301

def altitudeMode
  @altitudeMode
end

#extrudeObject

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



2301
2302
2303
# File 'lib/kamelopard/classes.rb', line 2301

def extrude
  @extrude
end

#innerObject

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



2301
2302
2303
# File 'lib/kamelopard/classes.rb', line 2301

def inner
  @inner
end

#outerObject

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



2301
2302
2303
# File 'lib/kamelopard/classes.rb', line 2301

def outer
  @outer
end

Instance Method Details

#<<(a) ⇒ Object



2320
2321
2322
# File 'lib/kamelopard/classes.rb', line 2320

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

#to_kml(elem = nil) ⇒ Object



2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
# File 'lib/kamelopard/classes.rb', line 2324

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