Class: KMLObject
- Inherits:
-
Object
- Object
- KMLObject
- Defined in:
- lib/kamelopard/classes.rb
Overview
Base class for all Kamelopard objects. Manages object ID and a single comment string associated with the object
Direct Known Subclasses
AbstractView, ColorStyle, Feature, Geometry, Link, Region, StyleSelector, TimePrimitive, Tour, TourPrimitive
Instance Attribute Summary (collapse)
-
- (Object) comment
Returns the value of attribute comment.
-
- (Object) id
Returns the value of attribute id.
Instance Method Summary (collapse)
-
- (KMLObject) initialize(comment = nil)
constructor
A new instance of KMLObject.
-
- (Object) to_kml(indent = 0)
Returns KML string for this object.
Constructor Details
- (KMLObject) initialize(comment = nil)
A new instance of KMLObject
87 88 89 90 |
# File 'lib/kamelopard/classes.rb', line 87 def initialize(comment = nil) @id = "#{self.class.name}_#{ get_next_id }" @comment = comment.gsub(/</, '<') unless comment.nil? end |
Instance Attribute Details
- (Object) comment
Returns the value of attribute comment
85 86 87 |
# File 'lib/kamelopard/classes.rb', line 85 def comment @comment end |
- (Object) id
Returns the value of attribute id
85 86 87 |
# File 'lib/kamelopard/classes.rb', line 85 def id @id end |
Instance Method Details
- (Object) to_kml(indent = 0)
Returns KML string for this object. Objects should override this method
93 94 95 96 97 98 99 |
# File 'lib/kamelopard/classes.rb', line 93 def to_kml(indent = 0) if @comment.nil? or @comment == '' then '' else "#{ ' ' * indent }<!-- #{ @comment } -->\n" end end |