Class: Kamelopard::Placemark
Overview
Corresponds to KML’s Placemark objects. The geometry attribute requires a descendant of Geometry
Instance Attribute Summary collapse
Attributes inherited from Feature
#abstractView, #addressDetails, #atom_author, #atom_link, #description, #extendedData, #metadata, #open, #phoneNumber, #region, #snippet, #styleSelector, #styleUrl, #styles, #timeprimitive, #visibility
Attributes inherited from Object
#comment, #id
Instance Method Summary
collapse
Methods inherited from Feature
add_author, #styles_to_kml, #timespan, #timespan=, #timestamp, #timestamp=
Constructor Details
#initialize(name = nil, geo = nil) ⇒ Placemark
Returns a new instance of Placemark.
1159
1160
1161
1162
1163
1164
1165
1166
|
# File 'lib/kamelopard/classes.rb', line 1159
def initialize(name = nil, geo = nil)
super(name)
if geo.respond_to? '[]' then
@geometry = geo
else
@geometry = [ geo ]
end
end
|
Instance Attribute Details
Returns the value of attribute geometry.
1158
1159
1160
|
# File 'lib/kamelopard/classes.rb', line 1158
def geometry
@geometry
end
|
Returns the value of attribute name.
1158
1159
1160
|
# File 'lib/kamelopard/classes.rb', line 1158
def name
@name
end
|
Instance Method Details
1188
1189
1190
|
# File 'lib/kamelopard/classes.rb', line 1188
def altitude
@geometry.altitude
end
|
#altitudeMode ⇒ Object
1192
1193
1194
|
# File 'lib/kamelopard/classes.rb', line 1192
def altitudeMode
@geometry.altitudeMode
end
|
1184
1185
1186
|
# File 'lib/kamelopard/classes.rb', line 1184
def latitude
@geometry.latitude
end
|
#longitude ⇒ Object
1180
1181
1182
|
# File 'lib/kamelopard/classes.rb', line 1180
def longitude
@geometry.longitude
end
|
1196
1197
1198
1199
1200
1201
1202
|
# File 'lib/kamelopard/classes.rb', line 1196
def point
if @geometry[0].kind_of? Point then
@geometry[0]
else
raise "This placemark uses a non-point geometry, but the operation you're trying requires a point object"
end
end
|
#to_kml(elem = nil) ⇒ Object
1168
1169
1170
1171
1172
1173
1174
|
# File 'lib/kamelopard/classes.rb', line 1168
def to_kml(elem = nil)
k = REXML::Element.new 'Placemark'
super k
@geometry.each do |i| i.to_kml(k) unless i.nil? end
elem << k unless elem.nil?
k
end
|
1176
1177
1178
|
# File 'lib/kamelopard/classes.rb', line 1176
def to_s
"Placemark id #{ @id } named #{ @name }"
end
|