Class: Kamelopard::LinearRing

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

Overview

Corresponds to KML’s LinearRing object

Instance Attribute Summary collapse

Attributes included from CoordinateList

#coordinates

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods included from CoordinateList

#<<, #add_element, #coordinates_to_kml

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

#initialize(coordinates = [], options = {}) ⇒ LinearRing

Returns a new instance of LinearRing.



506
507
508
509
510
511
512
513
514
# File 'lib/kamelopard/classes.rb', line 506

def initialize(coordinates = [], options = {})
    @tessellate = 0
    @extrude = 0
    @altitudeMode = :clampToGround
    @coordinates = []

    super options
    self.coordinates=(coordinates) unless coordinates.nil?
end

Instance Attribute Details

#altitudeModeObject

Returns the value of attribute altitudeMode.



503
504
505
# File 'lib/kamelopard/classes.rb', line 503

def altitudeMode
  @altitudeMode
end

#altitudeOffsetObject

Returns the value of attribute altitudeOffset.



503
504
505
# File 'lib/kamelopard/classes.rb', line 503

def altitudeOffset
  @altitudeOffset
end

#extrudeObject

Returns the value of attribute extrude.



503
504
505
# File 'lib/kamelopard/classes.rb', line 503

def extrude
  @extrude
end

#tessellateObject

Returns the value of attribute tessellate.



503
504
505
# File 'lib/kamelopard/classes.rb', line 503

def tessellate
  @tessellate
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/kamelopard/classes.rb', line 516

def to_kml(elem = nil)
    k = XML::Node.new 'LinearRing'
    super(k)
    Kamelopard.kml_array(k, [
        [ @altitudeOffset, 'gx:altitudeOffset' ],
        [ @tessellate, 'tessellate' ],
        [ @extrude, 'extrude' ]
    ])
    Kamelopard.add_altitudeMode(@altitudeMode, k)
    coordinates_to_kml(k) unless @coordinates.nil?
    elem << k unless elem.nil?
    k
end