Class: LinearRing
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s LinearRing object
Instance Attribute Summary collapse
-
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
-
#altitudeOffset ⇒ Object
Returns the value of attribute altitudeOffset.
-
#coordinates ⇒ Object
Returns the value of attribute coordinates.
-
#extrude ⇒ Object
Returns the value of attribute extrude.
-
#tessellate ⇒ Object
Returns the value of attribute tessellate.
Attributes inherited from KMLObject
Instance Method Summary collapse
-
#<<(a) ⇒ Object
Appends an element to this LinearRing’s CoordinateList.
-
#initialize(coordinates = nil, tessellate = 0, extrude = 0, altitudeMode = :clampToGround, altitudeOffset = nil) ⇒ LinearRing
constructor
A new instance of LinearRing.
-
#set_coords(a) ⇒ Object
Sets @coordinates element.
- #to_kml(indent = 0) ⇒ Object
Constructor Details
#initialize(coordinates = nil, tessellate = 0, extrude = 0, altitudeMode = :clampToGround, altitudeOffset = nil) ⇒ LinearRing
Returns a new instance of LinearRing.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/kamelopard/classes.rb', line 278 def initialize(coordinates = nil, tessellate = 0, extrude = 0, altitudeMode = :clampToGround, altitudeOffset = nil) super() if coordinates.nil? then @coordinates = nil elsif coordinates.kind_of? CoordinateList then @coordinates = coordinates else @coordinates = CoordinateList.new(coordinates) end @tessellate = tessellate @extrude = extrude @altitudeMode = altitudeMode @altitudeOffset = altitudeOffset end |
Instance Attribute Details
#altitudeMode ⇒ Object
Returns the value of attribute altitudeMode.
276 277 278 |
# File 'lib/kamelopard/classes.rb', line 276 def altitudeMode @altitudeMode end |
#altitudeOffset ⇒ Object
Returns the value of attribute altitudeOffset.
276 277 278 |
# File 'lib/kamelopard/classes.rb', line 276 def altitudeOffset @altitudeOffset end |
#coordinates ⇒ Object
Returns the value of attribute coordinates.
276 277 278 |
# File 'lib/kamelopard/classes.rb', line 276 def coordinates @coordinates end |
#extrude ⇒ Object
Returns the value of attribute extrude.
276 277 278 |
# File 'lib/kamelopard/classes.rb', line 276 def extrude @extrude end |
#tessellate ⇒ Object
Returns the value of attribute tessellate.
276 277 278 |
# File 'lib/kamelopard/classes.rb', line 276 def tessellate @tessellate end |
Instance Method Details
#<<(a) ⇒ Object
Appends an element to this LinearRing’s CoordinateList. See CoordinateList#add_element
303 304 305 |
# File 'lib/kamelopard/classes.rb', line 303 def <<(a) @coordinates << a end |
#set_coords(a) ⇒ Object
Sets @coordinates element
294 295 296 297 298 299 300 |
# File 'lib/kamelopard/classes.rb', line 294 def set_coords(a) if a.kind_of? CoordinateList then @coordinates = a else @coordinates = CoordinateList.new(a) end end |
#to_kml(indent = 0) ⇒ Object
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/kamelopard/classes.rb', line 307 def to_kml(indent = 0) k = super(indent + 4) + "#{ ' ' * indent }<LinearRing id=\"#{ @id }\">\n" k << "#{ ' ' * indent } <gx:altitudeOffset>#{ @altitudeOffset }</gx:altitudeOffset>\n" unless @altitudeOffset.nil? k << "#{ ' ' * indent } <tessellate>#{ @tessellate }</tessellate>\n" unless @tessellate.nil? k << "#{ ' ' * indent } <extrude>#{ @extrude }</extrude>\n" unless @extrude.nil? if not @altitudeMode.nil? then 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 end k << @coordinates.to_kml(indent + 4) k << "#{ ' ' * indent }</LinearRing>\n" k end |