Class: LineString
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to the KML LineString object
Instance Attribute Summary collapse
-
#altitude ⇒ Object
Returns the value of attribute altitude.
-
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
-
#altitudeOffset ⇒ Object
Returns the value of attribute altitudeOffset.
-
#coordinates ⇒ Object
readonly
Returns the value of attribute coordinates.
-
#drawOrder ⇒ Object
Returns the value of attribute drawOrder.
-
#extrude ⇒ Object
Returns the value of attribute extrude.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#tessellate ⇒ Object
Returns the value of attribute tessellate.
Attributes inherited from KMLObject
Instance Method Summary collapse
-
#<<(a) ⇒ Object
Appends an element to this LineString’s CoordinateList.
-
#initialize(coords, altMode = :clampToGround) ⇒ LineString
constructor
A new instance of LineString.
-
#set_coords(a) ⇒ Object
Sets @coordinates element.
- #to_kml(indent = 0) ⇒ Object
Constructor Details
#initialize(coords, altMode = :clampToGround) ⇒ LineString
Returns a new instance of LineString.
234 235 236 237 238 |
# File 'lib/kamelopard/classes.rb', line 234 def initialize(coords, altMode = :clampToGround) super() @altitudeMode = altMode set_coords coords end |
Instance Attribute Details
#altitude ⇒ Object
Returns the value of attribute altitude.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def altitude @altitude end |
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def altitudeMode @altitudeMode end |
#altitudeOffset ⇒ Object
Returns the value of attribute altitudeOffset.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def altitudeOffset @altitudeOffset end |
#coordinates ⇒ Object (readonly)
Returns the value of attribute coordinates.
232 233 234 |
# File 'lib/kamelopard/classes.rb', line 232 def coordinates @coordinates end |
#drawOrder ⇒ Object
Returns the value of attribute drawOrder.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def drawOrder @drawOrder end |
#extrude ⇒ Object
Returns the value of attribute extrude.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def extrude @extrude end |
#latitude ⇒ Object
Returns the value of attribute latitude.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def longitude @longitude end |
#tessellate ⇒ Object
Returns the value of attribute tessellate.
231 232 233 |
# File 'lib/kamelopard/classes.rb', line 231 def tessellate @tessellate end |
Instance Method Details
#<<(a) ⇒ Object
Appends an element to this LineString’s CoordinateList. See CoordinateList#add_element
250 251 252 |
# File 'lib/kamelopard/classes.rb', line 250 def <<(a) @coordinates << a end |
#set_coords(a) ⇒ Object
Sets @coordinates element
241 242 243 244 245 246 247 |
# File 'lib/kamelopard/classes.rb', line 241 def set_coords(a) if a.kind_of? CoordinateList then @coordinates = a else @coordinates = CoordinateList.new(a) end end |
#to_kml(indent = 0) ⇒ Object
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/kamelopard/classes.rb', line 254 def to_kml(indent = 0) k = super(indent + 4) + "#{ ' ' * indent }<LineString id =\"#{ @id }\">\n" k << kml_array([ [@altitudeOffset, 'gx:altitudeOffset', true], [@extrude, 'extrude', true], [@tessellate, 'tessellate', true], [@drawOrder, 'gx:drawOrder', true] ], indent + 4) k << @coordinates.to_kml(indent + 4) unless @coordinates.nil? if @altitudeMode == :clampToGround or @altitudeMode == :relativeToGround or @altitudeMode == :absolute then k << "#{ ' ' * indent } <altitudeMode>#{ @altitudeMode }</altitudeMode>\n" else k << "#{ ' ' * indent } <gx:altitudeMode>#{ @altitudeMode }</gx:altitudeMode>\n" end k << "#{ ' ' * indent }</LineString>\n" k end |