Class: GeoTreeModule::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/geotree/node.rb

Overview

Base class for KDTree nodes

Direct Known Subclasses

NodeI, NodeL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, leaf, vertical, bounds) ⇒ Node

Returns a new instance of Node.



70
71
72
73
74
75
76
# File 'lib/geotree/node.rb', line 70

def initialize(name,leaf,vertical,bounds)
  @name = name
  @leaf = leaf
  @vertical = vertical
  @bounds = bounds
  @modified = false
end

Instance Attribute Details

#boundsObject

Returns the value of attribute bounds.



68
69
70
# File 'lib/geotree/node.rb', line 68

def bounds
  @bounds
end

#leafObject

Returns the value of attribute leaf.



63
64
65
# File 'lib/geotree/node.rb', line 63

def leaf
  @leaf
end

#modifiedObject

Returns the value of attribute modified.



69
70
71
# File 'lib/geotree/node.rb', line 69

def modified
  @modified
end

#nameObject

Returns the value of attribute name.



64
65
66
# File 'lib/geotree/node.rb', line 64

def name
  @name
end

#next_nodeObject

Returns the value of attribute next_node.



68
69
70
# File 'lib/geotree/node.rb', line 68

def next_node
  @next_node
end

#prev_nodeObject

Returns the value of attribute prev_node.



68
69
70
# File 'lib/geotree/node.rb', line 68

def prev_node
  @prev_node
end

#verticalObject

If true, the slabs are stacked vertically; otherwise, they’re arranged horizontally



67
68
69
# File 'lib/geotree/node.rb', line 67

def vertical
  @vertical
end

Instance Method Details

#splittableObject



78
79
80
81
# File 'lib/geotree/node.rb', line 78

def splittable
  s = [@bounds.w,@bounds.h].max
  s >= SPLITTABLE_LINEAR_SIZE
end