Class: KML
- Inherits:
-
Object
- Object
- KML
- Defined in:
- lib/kmlbo/kml.rb
Instance Method Summary collapse
-
#initialize(kml_file) ⇒ KML
constructor
A new instance of KML.
- #simplify!(epsilon = nil, passes = nil) ⇒ Object
- #to_a ⇒ Object
- #to_encoded ⇒ Object
- #to_kml ⇒ Object
Constructor Details
Instance Method Details
#simplify!(epsilon = nil, passes = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/kmlbo/kml.rb', line 21 def simplify!(epsilon=nil, passes=nil) original_number_of_coords = @point_list.size @point_list = PointList.new(@point_list.tuple_array, epsilon, passes).simplify puts "Simplified path from #{original_number_of_coords} to #{@point_list.size} points" self end |
#to_a ⇒ Object
13 14 15 |
# File 'lib/kmlbo/kml.rb', line 13 def to_a @point_list.tuple_array end |
#to_encoded ⇒ Object
17 18 19 |
# File 'lib/kmlbo/kml.rb', line 17 def to_encoded @point_list.to_s end |
#to_kml ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kmlbo/kml.rb', line 28 def to_kml kml = "No Result." template = File.(File.join(File.dirname(__FILE__), "output.kml.erb")) File.open(template, "r") do |file| mapname = "Kmlbo output" template = ERB.new file.read kml = template.result(binding) end kml end |