Class: Kamelopard::Model

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

Overview

Corresponds to the KML Model class

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(options = {}) ⇒ Model

location should be a Point, or some object that can behave like one, including a Placemark. Model will get its Location and altitudeMode data from this attribute



2391
2392
2393
2394
# File 'lib/kamelopard/classes.rb', line 2391

def initialize(options = {})
 #link, location, orientation, scale, resourceMap)
    super
end

Instance Attribute Details

Returns the value of attribute link.



2386
2387
2388
# File 'lib/kamelopard/classes.rb', line 2386

def link
  @link
end

#locationObject

Returns the value of attribute location.



2386
2387
2388
# File 'lib/kamelopard/classes.rb', line 2386

def location
  @location
end

#orientationObject

Returns the value of attribute orientation.



2386
2387
2388
# File 'lib/kamelopard/classes.rb', line 2386

def orientation
  @orientation
end

#resourceMapObject

Returns the value of attribute resourceMap.



2386
2387
2388
# File 'lib/kamelopard/classes.rb', line 2386

def resourceMap
  @resourceMap
end

#scaleObject

Returns the value of attribute scale.



2386
2387
2388
# File 'lib/kamelopard/classes.rb', line 2386

def scale
  @scale
end

Instance Method Details

#to_kml(elem = nil) ⇒ Object



2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
# File 'lib/kamelopard/classes.rb', line 2396

def to_kml(elem = nil)
    x = XML::Node.new 'Model'
    super x
    loc = XML::Node.new 'Location'
    {
        :longitude => @location.longitude,
        :latitude => @location.latitude,
        :altitude => @location.altitude,
    }.each do |k, v|
        d = XML::Node.new k.to_s
        d << v.to_s
        loc << d
    end
    x << loc
    Kamelopard.add_altitudeMode(@location.altitudeMode, x)
    @link.to_kml x unless @link.nil?
    @orientation.to_kml x unless @orientation.nil?
    @scale.to_kml x unless @scale.nil?
    @resourceMap.to_kml x unless @resourceMap.nil?
    elem << x unless elem.nil?
    x
end