fgmapping 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v1.1.3 better z-order for display-elements, -added error handling for http connection losses
2
+
1
3
  v1.1.2 Bug fix: path handling fixed while pressing button repeatedly
2
4
 
3
5
  v1.1.1 Bug fix: corrected altitude handling and HUD display
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fgmapping}
5
- s.version = "1.1.2"
5
+ s.version = "1.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael Meltner"]
9
- s.date = %q{2010-06-13}
9
+ s.date = %q{2010-06-14}
10
10
  s.default_executable = %q{flightgear-mapping}
11
11
  s.description = %q{Flightgear live mapping}
12
12
  s.email = %q{mmeltner @nospamplease@ gmail.com}
@@ -42,11 +42,11 @@ Z_VALUE_TILES = 0
42
42
  Z_VALUE_TRACK = 1
43
43
  Z_VALUE_TRACK_COLORED = 2
44
44
  Z_VALUE_WAYPOINT = 3
45
- Z_VALUE_ORIGIN = 4
46
- Z_VALUE_ROSE = 5
47
- Z_VALUE_POINTERTOORIGIN = 6
48
- Z_VALUE_POINTER = 7
49
- Z_VALUE_NAV = 8
45
+ Z_VALUE_NAV = 4
46
+ Z_VALUE_ORIGIN = 5
47
+ Z_VALUE_ROSE = 6
48
+ Z_VALUE_POINTERTOORIGIN = 7
49
+ Z_VALUE_POINTER = 8
50
50
  Z_VALUE_HUD = 10
51
51
  SCALE_SVG = 0.3
52
52
 
@@ -495,15 +495,18 @@ class MainDlg < Qt::Widget
495
495
  end
496
496
 
497
497
  fn = node.getfilenames(@w.gVmap.size, @offset_x, @offset_y)
498
-
498
+
499
499
  fn.each{|f|
500
500
  if !@scene_tiles.include?(f)
501
501
  if FileTest.exist?(f+".png") then
502
502
  addTileToScene(f, origin_x, origin_y)
503
503
  elsif downloadTiles and (@timeNoInternet.nil? or (Time.now - @timeNoInternet) > 60) then
504
+ # Thread.abort_on_exception = true
504
505
  @httpThreads << Thread.new {
505
506
  @remainingTiles += 1
506
507
  @httpMutex.synchronize {
508
+ h = Net::HTTP.new('tile.openstreetmap.org')
509
+ h.open_timeout = 10
507
510
  @warningText = Qt::GraphicsSimpleTextItem.new("#{@remainingTiles} remaining tiles")
508
511
  @warningText.setBrush(Qt::Brush.new(Qt::Color.new("red")))
509
512
  @scene.addItem(@warningText)
@@ -511,29 +514,34 @@ class MainDlg < Qt::Widget
511
514
  @warningText.setPos(@w.gVmap.mapToScene((@w.gVmap.size.width - @warningText.boundingRect.width)/2,
512
515
  @w.gVmap.size.height - fontInfo.pixelSize - 10))
513
516
 
514
- h = Net::HTTP.new('tile.openstreetmap.org')
515
517
  f =~ /\/\d+\/\d+\/\d+$/
516
518
  f = $&
517
- resp, data = h.get(f + ".png", nil)
518
- if resp.kind_of?(Net::HTTPOK) then
519
- maindir = Dir.pwd
520
- Dir.chdir($MAPSHOME)
521
- f.split("/")[0..-2].each do |dir|
522
- if !dir.empty? then
523
- begin
524
- Dir.mkdir(dir)
525
- rescue Errno::EEXIST
526
- # just swallow error
519
+ begin
520
+ resp, data = h.get(f + ".png", nil)
521
+ if resp.kind_of?(Net::HTTPOK) then
522
+ maindir = Dir.pwd
523
+ Dir.chdir($MAPSHOME)
524
+ f.split("/")[0..-2].each do |dir|
525
+ if !dir.empty? then
526
+ begin
527
+ Dir.mkdir(dir)
528
+ rescue Errno::EEXIST
529
+ # just swallow error
530
+ end
531
+ Dir.chdir(dir)
527
532
  end
528
- Dir.chdir(dir)
529
533
  end
534
+ Dir.chdir(maindir)
535
+ File.open($MAPSHOME + f + ".png", "w") do |file|
536
+ file.write(data)
537
+ end
538
+ addTileToScene($MAPSHOME + f, origin_x, origin_y)
539
+ else
540
+ puts "Could not download tile. Internet connection alive?"
541
+ @timeNoInternet=Time.now
530
542
  end
531
- Dir.chdir(maindir)
532
- File.open($MAPSHOME + f + ".png", "w") do |file|
533
- file.write(data)
534
- end
535
- addTileToScene($MAPSHOME + f, origin_x, origin_y)
536
- else
543
+ # NoMethodError because of bug, see http://redmine.ruby-lang.org/issues/show/2708
544
+ rescue NoMethodError, Errno::ECONNREFUSED, SocketError, Timeout::Error
537
545
  puts "Could not download tile. Internet connection alive?"
538
546
  @timeNoInternet=Time.now
539
547
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 2
9
- version: 1.1.2
8
+ - 3
9
+ version: 1.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Meltner
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-13 00:00:00 +02:00
17
+ date: 2010-06-14 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20