class GeoTreeModule::NodeL

Attributes

overflow[RW]

name of overflow block (or zero)

Public Class Methods

new(name,vertical,bounds) click to toggle source
Calls superclass method GeoTreeModule::Node::new
# File lib/geotree/node.rb, line 87
def initialize(name,vertical,bounds)
  super(name,true,vertical,bounds)
  @data_pts = []
  @used = 0
  @overflow = 0
end

Public Instance Methods

add_data_point(dp) click to toggle source
# File lib/geotree/node.rb, line 110
def add_data_point(dp)
  @data_pts << dp
end
data_point(index) click to toggle source
# File lib/geotree/node.rb, line 106
def data_point(index)
  @data_pts[index]
end
find_point(pt) click to toggle source

Find position of a point, given its name; returns -1 if not found

# File lib/geotree/node.rb, line 119
def find_point(pt)
  ret = -1
  @data_pts.each_with_index do |dp,i|
    if DataPoint.match(dp,pt)
      ret = i
      break
    end
  end
  ret
end
inspect() click to toggle source
# File lib/geotree/node.rb, line 142
def inspect
  to_s
end
pop_last_point() click to toggle source
# File lib/geotree/node.rb, line 114
def pop_last_point
  @data_pts.pop
end
pts() click to toggle source
# File lib/geotree/node.rb, line 98
def pts
  @data_pts
end
set_data_point(index, dp) click to toggle source
# File lib/geotree/node.rb, line 102
def set_data_point(index, dp)
  @data_pts[index] = dp
end
to_s() click to toggle source
# File lib/geotree/node.rb, line 130
def to_s
  s = "LEAF=> ##{name} "
  s << "us=#{used} ov=#{overflow} ["
  used.times do |i|
    dp = data_point(i)
    #        s <<   " #{dp}"
    s <<   " #{dp.name}"
  end
  s << ']'
  s
end
used() click to toggle source
# File lib/geotree/node.rb, line 94
def used
  @data_pts.size
end