Class: PointList
Instance Attribute Summary collapse
-
#epsilon ⇒ Object
Returns the value of attribute epsilon.
-
#passes ⇒ Object
Returns the value of attribute passes.
-
#tuple_array ⇒ Object
Returns the value of attribute tuple_array.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(tuple_array, epsilon = nil, passes = nil) ⇒ PointList
constructor
A new instance of PointList.
- #simplify ⇒ Object
- #size ⇒ Object
Methods included from GPolyline
Constructor Details
#initialize(tuple_array, epsilon = nil, passes = nil) ⇒ PointList
Returns a new instance of PointList.
6 7 8 9 10 |
# File 'lib/kmlbo/pointlist.rb', line 6 def initialize(tuple_array, epsilon=nil, passes=nil) @tuple_array = tuple_array @epsilon = epsilon || 0.000001 @passes = passes || 1 end |
Instance Attribute Details
#epsilon ⇒ Object
Returns the value of attribute epsilon.
4 5 6 |
# File 'lib/kmlbo/pointlist.rb', line 4 def epsilon @epsilon end |
#passes ⇒ Object
Returns the value of attribute passes.
5 6 7 |
# File 'lib/kmlbo/pointlist.rb', line 5 def passes @passes end |
#tuple_array ⇒ Object
Returns the value of attribute tuple_array.
3 4 5 |
# File 'lib/kmlbo/pointlist.rb', line 3 def tuple_array @tuple_array end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 20 21 |
# File 'lib/kmlbo/pointlist.rb', line 17 def ==(other) return true if other.equal?(self) return false unless other.instance_of?(self.class) @tuple_array == other.tuple_array end |
#simplify ⇒ Object
12 13 14 15 |
# File 'lib/kmlbo/pointlist.rb', line 12 def simplify @passes.times{@tuple_array = douglas_peucker(@tuple_array, @epsilon)} return PointList.new(@tuple_array) end |
#size ⇒ Object
23 24 25 |
# File 'lib/kmlbo/pointlist.rb', line 23 def size @tuple_array.size end |