geotree 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ require 'fileutils'
7
7
  # A string containing a single zero, with ASCII 8-bit encoding (i.e., plain old bytes)
8
8
  ZERO_CHAR = "\0".force_encoding("ASCII-8BIT")
9
9
 
10
+
10
11
  def zero_bytes(count)
11
12
  ZERO_CHAR * count
12
13
  end
@@ -113,7 +113,7 @@ class TestBlockFile < Test::Unit::TestCase #< MyTestSuite
113
113
 
114
114
  end
115
115
 
116
- if true && __FILE__ == $0
116
+ if false && __FILE__ == $0
117
117
 
118
118
  pth = '__foo__.bin'
119
119
  remove_file_or_dir(pth)
@@ -25,7 +25,21 @@ class TestExternalSort < MyTestSuite
25
25
  @@test_dir = "workdir"
26
26
  mkdir(@@test_dir)
27
27
 
28
- @@path = File.join(@@test_dir,"_input_.dat")
28
+ @@path = File.join(@@test_dir,"_input_.txt")
29
+ if !File.file?(@@path)
30
+ pr("\nConstructing test file #{@@path}...\n")
31
+ srand(42)
32
+ q = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
33
+
34
+ s = ''
35
+ while s.size < 100000
36
+ m = q.shuffle
37
+ m = m[0..rand(q.size)]
38
+ s << m.join << "\n"
39
+ end
40
+ write_text_file(@@path,s)
41
+ end
42
+
29
43
  raise Exception,"no test file found" if !File.file?(@@path)
30
44
 
31
45
  @@path3 = File.join(@@test_dir,"_largefile_.dat")
@@ -218,7 +218,7 @@ class TestGeoTree < MyTestSuite
218
218
 
219
219
  def test_buffering
220
220
  db = false
221
- # db = true
221
+ # db = true
222
222
 
223
223
  return if !db
224
224
 
@@ -341,8 +341,9 @@ class TestGeoTree < MyTestSuite
341
341
 
342
342
  tree = GeoTree.new
343
343
  ps1 = prepare_tree(tree)
344
- w = prepare_ws("tree.ps")
345
- # ps1,w = prepare_ws(tree,"tree.ps")
344
+ w = prepare_ws("geo_tree.ps")
345
+
346
+ bgnd = nil
346
347
 
347
348
  50.times do |i|
348
349
  w.new_page("GeoTree")
@@ -356,15 +357,23 @@ class TestGeoTree < MyTestSuite
356
357
 
357
358
  width = (200 * (20+i)) / 25
358
359
  height = (width * 2)/3
360
+
359
361
  r = Bounds.new(x-width/2,y-height/2,width,height)
360
362
  pts = tree.find(r)
361
363
  w.push(w.set_gray(0))
362
364
  w.draw_rect(r.x,r.y,r.w,r.h )
363
365
  w.pop
364
366
 
365
- w.push(w.set_rgb(0.4,0.4,0.9))
366
- plot_pts_colored(w,ps1)
367
- w.pop
367
+ if !bgnd
368
+ w.start_buffer
369
+
370
+ w.push(w.set_rgb(0.4,0.4,0.9))
371
+ plot_pts_colored(w,ps1)
372
+ w.pop
373
+ bgnd = w.stop_buffer
374
+ w.add_element('bgnd',bgnd)
375
+ end
376
+ w.draw_element('bgnd')
368
377
 
369
378
  w.push(w.set_rgb(0.75,0,0))
370
379
  plot_pts_colored(w,pts,1.5)
@@ -386,6 +395,8 @@ class TestGeoTree < MyTestSuite
386
395
 
387
396
  ps1 = nil
388
397
 
398
+ bgnd = nil
399
+
389
400
  [0,1].each do |pass|
390
401
 
391
402
  if pass == 0
@@ -416,7 +427,13 @@ class TestGeoTree < MyTestSuite
416
427
  w.draw_rect(r.x,r.y,r.w,r.h )
417
428
  w.pop
418
429
 
419
- plot_pts(w,ps1,0.8)
430
+ if !bgnd
431
+ w.start_buffer
432
+ plot_pts(w,ps1,0.8)
433
+ bgnd = w.stop_buffer
434
+ w.add_element('bgnd',bgnd)
435
+ end
436
+ w.draw_element('bgnd')
420
437
 
421
438
  w.push(w.set_rgb(0.75,0,0))
422
439
  plot_pts_colored(w,pts,1.2)
@@ -11,7 +11,7 @@ if defined? SINGLETEST
11
11
  end
12
12
  end
13
13
 
14
- class TestBlockFile < Test::Unit::TestCase #< MyTestSuite
14
+ class TestPSWriter < MyTestSuite
15
15
 
16
16
  # --------------- tests --------------------------
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geotree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Sember
@@ -17,8 +17,7 @@ description: " \nA GeoTree is a variant of a k-d tree, and stores data points
17
17
  trees can be constructed instead.\n\nThe gem includes MultiTree, a GeoTree variant
18
18
  that supports queries at \nmultiple levels of detail. For example, when focusing
19
19
  on a \nsmall region it can return points that would be omitted when querying a much
20
- larger region.\n\nAnimations illustrating GeoTrees and MultiTrees in action can
21
- be found in the doc directory.\n\n"
20
+ larger region.\n\n"
22
21
  email: jpsember@gmail.com
23
22
  executables: []
24
23
  extensions: []
@@ -37,8 +36,6 @@ files:
37
36
  - lib/geotree/pswriter.rb
38
37
  - lib/geotree/ptbuffer.rb
39
38
  - lib/geotree/tools.rb
40
- - lib/fig/geo_tree.pdf
41
- - lib/fig/multi_tree.pdf
42
39
  - CHANGELOG.txt
43
40
  - README.txt
44
41
  - test/test_blockfile.rb
Binary file
Binary file