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.



2266
2267
2268
2269
2270
2271
2272
2273
# File 'lib/kamelopard/classes.rb', line 2266

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



2264
2265
2266
# File 'lib/kamelopard/classes.rb', line 2264

def altitudeMode
  @altitudeMode
end

#extrudeObject

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



2264
2265
2266
# File 'lib/kamelopard/classes.rb', line 2264

def extrude
  @extrude
end

#innerObject

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



2264
2265
2266
# File 'lib/kamelopard/classes.rb', line 2264

def inner
  @inner
end

#outerObject

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



2264
2265
2266
# File 'lib/kamelopard/classes.rb', line 2264

def outer
  @outer
end

Instance Method Details

#<<(a) ⇒ Object



2283
2284
2285
# File 'lib/kamelopard/classes.rb', line 2283

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

#to_kml(elem = nil) ⇒ Object



2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
# File 'lib/kamelopard/classes.rb', line 2287

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