Class: Kamelopard::Model
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to the KML Model class
Instance Attribute Summary collapse
-
#link ⇒ Object
Returns the value of attribute link.
-
#location ⇒ Object
Returns the value of attribute location.
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#resourceMap ⇒ Object
Returns the value of attribute resourceMap.
-
#scale ⇒ Object
Returns the value of attribute scale.
Attributes inherited from Object
#comment, #kml_id, #master_only
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Model
constructor
location should be a Point, or some object that can behave like one, including a Placemark.
- #to_kml(elem = nil) ⇒ Object
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
2283 2284 2285 2286 |
# File 'lib/kamelopard/classes.rb', line 2283 def initialize( = {}) #link, location, orientation, scale, resourceMap) super end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
2278 2279 2280 |
# File 'lib/kamelopard/classes.rb', line 2278 def link @link end |
#location ⇒ Object
Returns the value of attribute location.
2278 2279 2280 |
# File 'lib/kamelopard/classes.rb', line 2278 def location @location end |
#orientation ⇒ Object
Returns the value of attribute orientation.
2278 2279 2280 |
# File 'lib/kamelopard/classes.rb', line 2278 def orientation @orientation end |
#resourceMap ⇒ Object
Returns the value of attribute resourceMap.
2278 2279 2280 |
# File 'lib/kamelopard/classes.rb', line 2278 def resourceMap @resourceMap end |
#scale ⇒ Object
Returns the value of attribute scale.
2278 2279 2280 |
# File 'lib/kamelopard/classes.rb', line 2278 def scale @scale end |
Instance Method Details
#to_kml(elem = nil) ⇒ Object
2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 |
# File 'lib/kamelopard/classes.rb', line 2288 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 |