Class: Orientation
- Inherits:
-
Object
- Object
- Orientation
- Defined in:
- lib/kamelopard/classes.rb
Overview
Sub-object in the KML Model class
Instance Attribute Summary collapse
-
#heading ⇒ Object
Returns the value of attribute heading.
-
#roll ⇒ Object
Returns the value of attribute roll.
-
#tilt ⇒ Object
Returns the value of attribute tilt.
Instance Method Summary collapse
-
#initialize(heading, tilt, roll) ⇒ Orientation
constructor
A new instance of Orientation.
- #to_kml(indent = 0) ⇒ Object
Constructor Details
#initialize(heading, tilt, roll) ⇒ Orientation
Returns a new instance of Orientation.
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 |
# File 'lib/kamelopard/classes.rb', line 1567 def initialize(heading, tilt, roll) @heading = heading # Although the KML reference by Google is clear on these ranges, Google Earth # supports values outside the ranges, and sometimes it's useful to use # them. So I'm turning off this error checking # raise "Heading should be between 0 and 360 inclusive; you gave #{ heading }" unless @heading <= 360 and @heading >= 0 @tilt = tilt # raise "Tilt should be between 0 and 180 inclusive; you gave #{ tilt }" unless @tilt <= 180 and @tilt >= 0 @roll = roll # raise "Roll should be between 0 and 180 inclusive; you gave #{ roll }" unless @roll <= 180 and @roll >= 0 end |
Instance Attribute Details
#heading ⇒ Object
Returns the value of attribute heading.
1566 1567 1568 |
# File 'lib/kamelopard/classes.rb', line 1566 def heading @heading end |
#roll ⇒ Object
Returns the value of attribute roll.
1566 1567 1568 |
# File 'lib/kamelopard/classes.rb', line 1566 def roll @roll end |
#tilt ⇒ Object
Returns the value of attribute tilt.
1566 1567 1568 |
# File 'lib/kamelopard/classes.rb', line 1566 def tilt @tilt end |
Instance Method Details
#to_kml(indent = 0) ⇒ Object
1579 1580 1581 1582 1583 1584 1585 1586 |
# File 'lib/kamelopard/classes.rb', line 1579 def to_kml(indent = 0) k = "#{ ' ' * indent }<Orientation>\n" k << "#{ ' ' * indent } <heading>#{ @heading }</heading>\n" k << "#{ ' ' * indent } <tilt>#{ @tilt }</tilt>\n" k << "#{ ' ' * indent } <roll>#{ @roll }</roll>\n" k << "#{ ' ' * indent }</Orientation>\n" k end |