Class: Kamelopard::Link

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

Overview

Corresponds to KML’s Link 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(href = '', options = {}) ⇒ Link

Returns a new instance of Link.



2416
2417
2418
2419
# File 'lib/kamelopard/classes.rb', line 2416

def initialize(href = '', options = {})
    super options
    @href = href unless href == ''
end

Instance Attribute Details

#hrefObject

Returns the value of attribute href.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def href
  @href
end

#httpQueryObject

Returns the value of attribute httpQuery.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def httpQuery
  @httpQuery
end

#refreshIntervalObject

Returns the value of attribute refreshInterval.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def refreshInterval
  @refreshInterval
end

#refreshModeObject

Returns the value of attribute refreshMode.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def refreshMode
  @refreshMode
end

#viewBoundScaleObject

Returns the value of attribute viewBoundScale.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def viewBoundScale
  @viewBoundScale
end

#viewFormatObject

Returns the value of attribute viewFormat.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def viewFormat
  @viewFormat
end

#viewRefreshModeObject

Returns the value of attribute viewRefreshMode.



2414
2415
2416
# File 'lib/kamelopard/classes.rb', line 2414

def viewRefreshMode
  @viewRefreshMode
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
# File 'lib/kamelopard/classes.rb', line 2421

def to_kml(elem = nil)
    x = XML::Node.new 'Link'
    super x
    {
        :href => @href,
        :refreshMode => @refreshMode,
        :viewRefreshMode => @viewRefreshMode,
    }.each do |k, v|
        d = XML::Node.new k.to_s
        d << v.to_s
            # Don't escape links, because Earth doesn't like that.
        d.first.output_escaping = false
        x << d
    end
    Kamelopard.kml_array(x, [
        [ @refreshInterval, 'refreshInterval' ],
        [ @viewBoundScale, 'viewBoundScale' ],
        [ @viewFormat, 'viewFormat' ],
        [ @httpQuery, 'httpQuery' ]
    ])
    elem << x unless elem.nil?
    x
end