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.



2311
2312
2313
2314
2315
# File 'lib/kamelopard/classes.rb', line 2311

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

Instance Attribute Details

#geometriesObject

Returns the value of attribute geometries.



2309
2310
2311
# File 'lib/kamelopard/classes.rb', line 2309

def geometries
  @geometries
end

Instance Method Details

#<<(a) ⇒ Object



2317
2318
2319
# File 'lib/kamelopard/classes.rb', line 2317

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

#to_kml(elem = nil) ⇒ Object



2321
2322
2323
2324
2325
2326
2327
2328
# File 'lib/kamelopard/classes.rb', line 2321

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