Method: Navaid#getVORs

Defined in:
lib/navaid.rb

#getVORs(box) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/navaid.rb', line 124

def getVORs(box)
	i = @latSort.bsearch_lower_boundary {|x| x[0] <=> box[1][0]}
	j = @latSort.bsearch_upper_boundary {|x| x[0] <=> box[1][1]}
	latCandidates = @latSort[i...j].collect do |a|
		a[1] # return its array index
	end
	# protect against excessive CPU load
	return [] if j-i > 2000

	i = @lonSort.bsearch_lower_boundary {|x| x[0] <=> box[0][0]}
	j = @lonSort.bsearch_upper_boundary {|x| x[0] <=> box[0][1]}
	lonCandidates = @lonSort[i...j].collect do |a|
		a[1] # return its array index
	end
	# protect against excessive CPU load
	return [] if j-i > 2000
	
	cross=latCandidates.find_all do |a|
		lonCandidates.include?(a)
	end

	cross.collect do |a|
		@vors[a]
	end
end