Class: Kamelopard::MultiGeometry

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

Overview

Abstract class corresponding to KML’s MultiGeometry object

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(a = nil, options = {}) ⇒ MultiGeometry

Returns a new instance of MultiGeometry.



2348
2349
2350
2351
2352
# File 'lib/kamelopard/classes.rb', line 2348

def initialize(a = nil, options = {})
    @geometries = []
    @geometries << a unless a.nil?
    super options
end

Instance Attribute Details

#geometriesObject

Returns the value of attribute geometries.



2346
2347
2348
# File 'lib/kamelopard/classes.rb', line 2346

def geometries
  @geometries
end

Instance Method Details

#<<(a) ⇒ Object



2354
2355
2356
# File 'lib/kamelopard/classes.rb', line 2354

def <<(a)
    @geometries << a
end

#to_kml(elem = nil) ⇒ Object



2358
2359
2360
2361
2362
2363
2364
2365
# File 'lib/kamelopard/classes.rb', line 2358

def to_kml(elem = nil)
    e = XML::Node.new 'MultiGeometry'
    @geometries.each do |g|
        g.to_kml e
    end
    elem << e unless elem.nil?
    e
end