Class: Kamelopard::AnimatedUpdate
- Inherits:
-
TourPrimitive
- Object
- Object
- TourPrimitive
- Kamelopard::AnimatedUpdate
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s gx:AnimatedUpdate object. For now at least, this isn’t very intelligent; you’ve got to manually craft the <Change> tag(s) within the object.
Instance Attribute Summary collapse
-
#delayedStart ⇒ Object
XXX For now, the user has to specify the change / create / delete elements in the <Update> manually, rather than creating objects.
-
#duration ⇒ Object
XXX For now, the user has to specify the change / create / delete elements in the <Update> manually, rather than creating objects.
-
#target ⇒ Object
XXX For now, the user has to specify the change / create / delete elements in the <Update> manually, rather than creating objects.
-
#updates ⇒ Object
Returns the value of attribute updates.
Attributes inherited from TourPrimitive
Attributes inherited from Object
#comment, #kml_id, #master_only
Instance Method Summary collapse
-
#<<(a) ⇒ Object
Adds another update string, presumably containing a <Change> element.
-
#initialize(updates, options = {}) ⇒ AnimatedUpdate
constructor
The updates argument is an array of strings containing <Change> elements.
- #to_kml(elem = nil) ⇒ Object
Methods inherited from Object
#_alternate_to_kml, #change, #master_only?
Constructor Details
#initialize(updates, options = {}) ⇒ AnimatedUpdate
The updates argument is an array of strings containing <Change> elements
1660 1661 1662 1663 1664 1665 |
# File 'lib/kamelopard/classes.rb', line 1660 def initialize(updates, = {}) #duration = 0, target = '', delayedstart = nil) @updates = [] super @updates = updates unless updates.nil? or updates.size == 0 end |
Instance Attribute Details
#delayedStart ⇒ Object
XXX For now, the user has to specify the change / create / delete elements in the <Update> manually, rather than creating objects.
1656 1657 1658 |
# File 'lib/kamelopard/classes.rb', line 1656 def delayedStart @delayedStart end |
#duration ⇒ Object
XXX For now, the user has to specify the change / create / delete elements in the <Update> manually, rather than creating objects.
1656 1657 1658 |
# File 'lib/kamelopard/classes.rb', line 1656 def duration @duration end |
#target ⇒ Object
XXX For now, the user has to specify the change / create / delete elements in the <Update> manually, rather than creating objects.
1656 1657 1658 |
# File 'lib/kamelopard/classes.rb', line 1656 def target @target end |
#updates ⇒ Object
Returns the value of attribute updates.
1657 1658 1659 |
# File 'lib/kamelopard/classes.rb', line 1657 def updates @updates end |
Instance Method Details
#<<(a) ⇒ Object
Adds another update string, presumably containing a <Change> element
1680 1681 1682 |
# File 'lib/kamelopard/classes.rb', line 1680 def <<(a) @updates << a end |
#to_kml(elem = nil) ⇒ Object
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 |
# File 'lib/kamelopard/classes.rb', line 1684 def to_kml(elem = nil) k = XML::Node.new 'gx:AnimatedUpdate' super(k) d = XML::Node.new 'gx:duration' d << @duration.to_s k << d if not @delayedStart.nil? then d = XML::Node.new 'gx:delayedStart' d << @delayedStart.to_s k << d end d = XML::Node.new 'Update' q = XML::Node.new 'targetHref' q << @target.to_s d << q @updates.each do |i| if i.is_a? XML::Node then d << i else parser = reader = XML::Parser.string(i) doc = parser.parse node = doc.child n = node.copy true d << n end end k << d elem << k unless elem.nil? k end |