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?, parse

Constructor Details

#initialize(a = nil, options = {}) ⇒ MultiGeometry

Returns a new instance of MultiGeometry.



2532
2533
2534
2535
2536
# File 'lib/kamelopard/classes.rb', line 2532

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

Instance Attribute Details

#geometriesObject

Returns the value of attribute geometries.



2530
2531
2532
# File 'lib/kamelopard/classes.rb', line 2530

def geometries
  @geometries
end

Instance Method Details

#<<(a) ⇒ Object



2538
2539
2540
# File 'lib/kamelopard/classes.rb', line 2538

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

#to_kml(elem = nil) ⇒ Object



2542
2543
2544
2545
2546
2547
2548
2549
# File 'lib/kamelopard/classes.rb', line 2542

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