Class: Kamelopard::Feature
- Includes:
- Snippet
- Defined in:
- lib/kamelopard/classes.rb
Overview
Abstract class corresponding to KML’s Feature object. – XXX Make this support alternate namespaces ++
Direct Known Subclasses
Instance Attribute Summary collapse
-
#abstractView ⇒ Object
Returns the value of attribute abstractView.
-
#addressDetails ⇒ Object
Returns the value of attribute addressDetails.
-
#atom_author ⇒ Object
Returns the value of attribute atom_author.
-
#atom_link ⇒ Object
Returns the value of attribute atom_link.
-
#description ⇒ Object
Returns the value of attribute description.
-
#extendedData ⇒ Object
Returns the value of attribute extendedData.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#name ⇒ Object
Returns the value of attribute name.
-
#open ⇒ Object
Returns the value of attribute open.
-
#phoneNumber ⇒ Object
Returns the value of attribute phoneNumber.
-
#region ⇒ Object
Returns the value of attribute region.
-
#snippet ⇒ Object
readonly
Returns the value of attribute snippet.
-
#styles ⇒ Object
Returns the value of attribute styles.
-
#styleSelector ⇒ Object
Returns the value of attribute styleSelector.
-
#styleUrl ⇒ Object
Returns the value of attribute styleUrl.
-
#timeprimitive ⇒ Object
Returns the value of attribute timeprimitive.
-
#visibility ⇒ Object
Returns the value of attribute visibility.
Attributes included from Snippet
Attributes inherited from Object
#comment, #kml_id, #master_only
Class Method Summary collapse
Instance Method Summary collapse
- #extended_data_to_kml(elem) ⇒ Object
-
#hide ⇒ Object
Hides the object.
-
#initialize(name = nil, options = {}) ⇒ Feature
constructor
A new instance of Feature.
-
#show ⇒ Object
Shows the object.
- #styles_to_kml(elem) ⇒ Object
- #timespan ⇒ Object
- #timespan=(t) ⇒ Object
- #timestamp ⇒ Object
- #timestamp=(t) ⇒ Object
- #to_kml(elem = nil) {|elem| ... } ⇒ Object
Methods included from Snippet
Methods inherited from Object
#_alternate_to_kml, #change, #master_only?, parse
Constructor Details
#initialize(name = nil, options = {}) ⇒ Feature
Returns a new instance of Feature.
890 891 892 893 894 895 896 |
# File 'lib/kamelopard/classes.rb', line 890 def initialize (name = nil, = {}) @visibility = true @open = false @styles = [] super @name = name unless name.nil? end |
Instance Attribute Details
#abstractView ⇒ Object
Returns the value of attribute abstractView.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def abstractView @abstractView end |
#addressDetails ⇒ Object
Returns the value of attribute addressDetails.
886 887 888 |
# File 'lib/kamelopard/classes.rb', line 886 def addressDetails @addressDetails end |
#atom_author ⇒ Object
Returns the value of attribute atom_author.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def @atom_author end |
#atom_link ⇒ Object
Returns the value of attribute atom_link.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def atom_link @atom_link end |
#description ⇒ Object
Returns the value of attribute description.
886 887 888 |
# File 'lib/kamelopard/classes.rb', line 886 def description @description end |
#extendedData ⇒ Object
Returns the value of attribute extendedData.
886 887 888 |
# File 'lib/kamelopard/classes.rb', line 886 def extendedData @extendedData end |
#metadata ⇒ Object
Returns the value of attribute metadata.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def @metadata end |
#name ⇒ Object
Returns the value of attribute name.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def name @name end |
#open ⇒ Object
Returns the value of attribute open.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def open @open end |
#phoneNumber ⇒ Object
Returns the value of attribute phoneNumber.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def phoneNumber @phoneNumber end |
#region ⇒ Object
Returns the value of attribute region.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def region @region end |
#snippet ⇒ Object (readonly)
Returns the value of attribute snippet.
886 887 888 |
# File 'lib/kamelopard/classes.rb', line 886 def snippet @snippet end |
#styles ⇒ Object
Returns the value of attribute styles.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def styles @styles end |
#styleSelector ⇒ Object
Returns the value of attribute styleSelector.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def styleSelector @styleSelector end |
#styleUrl ⇒ Object
Returns the value of attribute styleUrl.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def styleUrl @styleUrl end |
#timeprimitive ⇒ Object
Returns the value of attribute timeprimitive.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def timeprimitive @timeprimitive end |
#visibility ⇒ Object
Returns the value of attribute visibility.
883 884 885 |
# File 'lib/kamelopard/classes.rb', line 883 def visibility @visibility end |
Class Method Details
.add_author(o, a) ⇒ Object
971 972 973 974 975 976 977 |
# File 'lib/kamelopard/classes.rb', line 971 def self.(o, a) e = XML::Node.new 'atom:name' e << a.to_s f = XML::Node.new 'atom:author' f << e o << f end |
Instance Method Details
#extended_data_to_kml(elem) ⇒ Object
1006 1007 1008 1009 1010 1011 1012 1013 |
# File 'lib/kamelopard/classes.rb', line 1006 def extended_data_to_kml(elem) v = XML::Node.new 'ExtendedData' @extendedData.each do |f| v << f.to_kml end elem << v unless elem.nil? v end |
#hide ⇒ Object
Hides the object. Note that this governs only whether the object is initially visible or invisible; to show or hide the feature dynamically during a tour, use an AnimatedUpdate object
925 926 927 |
# File 'lib/kamelopard/classes.rb', line 925 def hide @visibility = false end |
#show ⇒ Object
Shows the object. See note for hide() method
930 931 932 |
# File 'lib/kamelopard/classes.rb', line 930 def show @visibility = true end |
#styles_to_kml(elem) ⇒ Object
1015 1016 1017 1018 1019 1020 1021 |
# File 'lib/kamelopard/classes.rb', line 1015 def styles_to_kml(elem) # XXX Remove this raise "done here" if elem.class == Array @styles.each do |a| a.to_kml(elem) # unless a.attached? end end |
#timespan ⇒ Object
938 939 940 |
# File 'lib/kamelopard/classes.rb', line 938 def timespan @timeprimitive end |
#timespan=(t) ⇒ Object
946 947 948 |
# File 'lib/kamelopard/classes.rb', line 946 def timespan=(t) @timeprimitive = t end |
#timestamp ⇒ Object
934 935 936 |
# File 'lib/kamelopard/classes.rb', line 934 def @timeprimitive end |
#timestamp=(t) ⇒ Object
942 943 944 |
# File 'lib/kamelopard/classes.rb', line 942 def (t) @timeprimitive = t end |
#to_kml(elem = nil) {|elem| ... } ⇒ Object
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
# File 'lib/kamelopard/classes.rb', line 979 def to_kml(elem = nil) elem = XML::Node.new 'Feature' if elem.nil? super elem Kamelopard.kml_array(elem, [ [@name, 'name'], [(@visibility.nil? || @visibility) ? 1 : 0, 'visibility'], [(! @open.nil? && @open) ? 1 : 0, 'open'], [@atom_author, lambda { |o| Feature.(o, @atom_author) }], [@atom_link, 'atom:link'], [@address, 'address'], [@addressDetails, 'xal:AddressDetails'], [@phoneNumber, 'phoneNumber'], [@description, 'description'], [@styleUrl, 'styleUrl'], [@styleSelector, lambda { |o| @styleSelector.to_kml(o) }], [@metadata, 'Metadata' ] ]) styles_to_kml(elem) snippet_to_kml(elem) unless @snippet_text.nil? extended_data_to_kml(elem) unless @extendedData.nil? @abstractView.to_kml(elem) unless @abstractView.nil? @timeprimitive.to_kml(elem) unless @timeprimitive.nil? @region.to_kml(elem) unless @region.nil? yield(elem) if block_given? elem end |