Class: Model
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 KMLObject
Instance Method Summary collapse
-
#initialize(link, location, orientation, scale, resourceMap) ⇒ Model
constructor
location should be a KMLPoint, or some object that can behave like one, including a Placemark.
- #to_kml(indent = 0) ⇒ Object
Constructor Details
#initialize(link, location, orientation, scale, resourceMap) ⇒ Model
location should be a KMLPoint, or some object that can behave like one, including a Placemark. Model will get its Location and altitudeMode data from this attribute
1678 1679 1680 1681 1682 1683 1684 1685 |
# File 'lib/kamelopard/classes.rb', line 1678 def initialize(link, location, orientation, scale, resourceMap) super() @link = link @location = location @orientation = orientation @scale = scale @resourceMap = resourceMap end |
Instance Attribute Details
#link ⇒ Object
Returns the value of attribute link.
1673 1674 1675 |
# File 'lib/kamelopard/classes.rb', line 1673 def link @link end |
#location ⇒ Object
Returns the value of attribute location.
1673 1674 1675 |
# File 'lib/kamelopard/classes.rb', line 1673 def location @location end |
#orientation ⇒ Object
Returns the value of attribute orientation.
1673 1674 1675 |
# File 'lib/kamelopard/classes.rb', line 1673 def orientation @orientation end |
#resourceMap ⇒ Object
Returns the value of attribute resourceMap.
1673 1674 1675 |
# File 'lib/kamelopard/classes.rb', line 1673 def resourceMap @resourceMap end |
#scale ⇒ Object
Returns the value of attribute scale.
1673 1674 1675 |
# File 'lib/kamelopard/classes.rb', line 1673 def scale @scale end |
Instance Method Details
#to_kml(indent = 0) ⇒ Object
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 |
# File 'lib/kamelopard/classes.rb', line 1687 def to_kml(indent = 0) k = "#{ ' ' * indent }<Model id=\"#{ @id }\">\n" k << @link.to_kml(indent + 4) if @location.altitudeMode == :clampToGround or @location.altitudeMode == :relativeToGround or @location.altitudeMode == :absolute then k << "#{ ' ' * indent } <altitudeMode>#{ @location.altitudeMode }</altitudeMode>\n" else k << "#{ ' ' * indent } <gx:altitudeMode>#{ @location.altitudeMode }</gx:altitudeMode>\n" end k << "#{ ' ' * indent } <Location>\n" k << "#{ ' ' * indent } <longitude>#{ @location.longitude }</longitude>\n" k << "#{ ' ' * indent } <latitude>#{ @location.latitude }</latitude>\n" k << "#{ ' ' * indent } <altitude>#{ @location.altitude }</altitude>\n" k << "#{ ' ' * indent } </Location>\n" k << @orientation.to_kml(indent + 4) k << @scale.to_kml(indent + 4) k << @resourceMap.to_kml(indent + 4) k << "#{ ' ' * indent }</Model>\n" k end |