HAYASHI Kentaro
null+****@clear*****
Tue Oct 30 18:34:36 JST 2012
HAYASHI Kentaro 2012-10-30 18:34:36 +0900 (Tue, 30 Oct 2012) New Revision: f609753d08006fc50af97362e10d91f8b2496aeb https://github.com/groonga/groonga/commit/f609753d08006fc50af97362e10d91f8b2496aeb Log: geo: support to generate calculated distance from 1st quadrant to 4th one Modified files: test/command/tools/geo/generate-grntest-data.rb Modified: test/command/tools/geo/generate-grntest-data.rb (+25 -0) =================================================================== --- test/command/tools/geo/generate-grntest-data.rb 2012-10-30 16:27:40 +0900 (7501ce5) +++ test/command/tools/geo/generate-grntest-data.rb 2012-10-30 18:34:36 +0900 (fec43d4) @@ -569,6 +569,31 @@ class GrnTestData @longitude_end.to_i, @latitude_end.to_i) (east_distance + west_distance).floor + when "1st_to_4th" + longitude_delta = @longitude_end_degree - @longitude_start_degree + latitude_delta = @latitude_end_degree - @latitude_start_degree + if longitude_delta.to_f == 0 + north_distance = calculate_distance(@longitude_start.to_i, + @latitude_start.to_i, + @longitude_start.to_i, + 0) + south_distance = calculate_distance(@longitude_end.to_i, + 0, + @longitude_end.to_i, + @latitude_end.to_i) + else + slope = latitude_delta / longitude_delta.to_f + intercept = -latitude_delta / slope + north_distance = calculate_distance(intercept * GRN_GEO_RESOLUTION, + 0, + @longitude_start.to_i, + @latitude_start.to_i) + south_distance = calculate_distance(intercept * GRN_GEO_RESOLUTION, + 0, + @longitude_end.to_i, + @latitude_end.to_i) + end + (north_distance + south_distance).floor when "equator" if point_or_line == "point" 0 -------------- next part -------------- HTML����������������������������... Download