fgmapping 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/LICENSE +340 -0
- data/Manifest +22 -0
- data/README +40 -0
- data/Rakefile +13 -0
- data/bin/flightgear-mapping +18 -0
- data/fgmap.gemspec +32 -0
- data/fgmapping.gemspec +32 -0
- data/lib/LICENSE +340 -0
- data/lib/README +40 -0
- data/lib/bsearch.rb +120 -0
- data/lib/hud-impl.rb +20 -0
- data/lib/hud-widget.rb +172 -0
- data/lib/init.rb +18 -0
- data/lib/main-dlg-impl.rb +1117 -0
- data/lib/main-dlg.rb +224 -0
- data/lib/navaid.rb +177 -0
- data/lib/nodeinfo-impl.rb +46 -0
- data/lib/nodeinfo-widget.rb +152 -0
- data/lib/resources.rb +5206 -0
- data/lib/tile.rb +216 -0
- data/lib/waypoint.rb +29 -0
- metadata +106 -0
data/lib/main-dlg.rb
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
=begin
|
2
|
+
** Form generated from reading ui file 'main-dlg.ui'
|
3
|
+
**
|
4
|
+
** Created: Fr. Jun 11 14:41:10 2010
|
5
|
+
** by: Qt User Interface Compiler version 4.6.2
|
6
|
+
**
|
7
|
+
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
|
+
=end
|
9
|
+
|
10
|
+
class Ui_MainDlg
|
11
|
+
attr_reader :horizontalLayout_3
|
12
|
+
attr_reader :verticalLayout
|
13
|
+
attr_reader :pBrecordTrack
|
14
|
+
attr_reader :cBautocenter
|
15
|
+
attr_reader :cBtoorigin
|
16
|
+
attr_reader :cBvor
|
17
|
+
attr_reader :cBndb
|
18
|
+
attr_reader :cBrw
|
19
|
+
attr_reader :fRcurrentwp
|
20
|
+
attr_reader :gridLayout
|
21
|
+
attr_reader :label_2
|
22
|
+
attr_reader :lBcurrentwp
|
23
|
+
attr_reader :verticalSpacer
|
24
|
+
attr_reader :horizontalLayout
|
25
|
+
attr_reader :pBminus
|
26
|
+
attr_reader :pBplus
|
27
|
+
attr_reader :horizontalLayout_2
|
28
|
+
attr_reader :label
|
29
|
+
attr_reader :lBzoom
|
30
|
+
attr_reader :line_2
|
31
|
+
attr_reader :pBexit
|
32
|
+
attr_reader :gVmap
|
33
|
+
|
34
|
+
def setupUi(mainDlg)
|
35
|
+
if mainDlg.objectName.nil?
|
36
|
+
mainDlg.objectName = "mainDlg"
|
37
|
+
end
|
38
|
+
mainDlg.resize(588, 389)
|
39
|
+
@horizontalLayout_3 = Qt::HBoxLayout.new(mainDlg)
|
40
|
+
@horizontalLayout_3.objectName = "horizontalLayout_3"
|
41
|
+
@verticalLayout = Qt::VBoxLayout.new()
|
42
|
+
@verticalLayout.objectName = "verticalLayout"
|
43
|
+
@pBrecordTrack = Qt::PushButton.new(mainDlg)
|
44
|
+
@pBrecordTrack.objectName = "pBrecordTrack"
|
45
|
+
@pBrecordTrack.checkable = true
|
46
|
+
|
47
|
+
@verticalLayout.addWidget(@pBrecordTrack)
|
48
|
+
|
49
|
+
@cBautocenter = Qt::CheckBox.new(mainDlg)
|
50
|
+
@cBautocenter.objectName = "cBautocenter"
|
51
|
+
|
52
|
+
@verticalLayout.addWidget(@cBautocenter)
|
53
|
+
|
54
|
+
@cBtoorigin = Qt::CheckBox.new(mainDlg)
|
55
|
+
@cBtoorigin.objectName = "cBtoorigin"
|
56
|
+
|
57
|
+
@verticalLayout.addWidget(@cBtoorigin)
|
58
|
+
|
59
|
+
@cBvor = Qt::CheckBox.new(mainDlg)
|
60
|
+
@cBvor.objectName = "cBvor"
|
61
|
+
@cBvor.checked = true
|
62
|
+
|
63
|
+
@verticalLayout.addWidget(@cBvor)
|
64
|
+
|
65
|
+
@cBndb = Qt::CheckBox.new(mainDlg)
|
66
|
+
@cBndb.objectName = "cBndb"
|
67
|
+
|
68
|
+
@verticalLayout.addWidget(@cBndb)
|
69
|
+
|
70
|
+
@cBrw = Qt::CheckBox.new(mainDlg)
|
71
|
+
@cBrw.objectName = "cBrw"
|
72
|
+
|
73
|
+
@verticalLayout.addWidget(@cBrw)
|
74
|
+
|
75
|
+
@fRcurrentwp = Qt::Frame.new(mainDlg)
|
76
|
+
@fRcurrentwp.objectName = "fRcurrentwp"
|
77
|
+
@fRcurrentwp.frameShape = Qt::Frame::StyledPanel
|
78
|
+
@fRcurrentwp.frameShadow = Qt::Frame::Raised
|
79
|
+
@gridLayout = Qt::GridLayout.new(@fRcurrentwp)
|
80
|
+
@gridLayout.objectName = "gridLayout"
|
81
|
+
@gridLayout.setContentsMargins(2, 2, 0, 0)
|
82
|
+
@label_2 = Qt::Label.new(@fRcurrentwp)
|
83
|
+
@label_2.objectName = "label_2"
|
84
|
+
|
85
|
+
@gridLayout.addWidget(@label_2, 0, 0, 1, 1)
|
86
|
+
|
87
|
+
@lBcurrentwp = Qt::Label.new(@fRcurrentwp)
|
88
|
+
@lBcurrentwp.objectName = "lBcurrentwp"
|
89
|
+
@sizePolicy = Qt::SizePolicy.new(Qt::SizePolicy::Preferred, Qt::SizePolicy::Preferred)
|
90
|
+
@sizePolicy.setHorizontalStretch(1)
|
91
|
+
@sizePolicy.setVerticalStretch(0)
|
92
|
+
@sizePolicy.heightForWidth = @lBcurrentwp.sizePolicy.hasHeightForWidth
|
93
|
+
@lBcurrentwp.sizePolicy = @sizePolicy
|
94
|
+
|
95
|
+
@gridLayout.addWidget(@lBcurrentwp, 0, 1, 1, 1)
|
96
|
+
|
97
|
+
|
98
|
+
@verticalLayout.addWidget(@fRcurrentwp)
|
99
|
+
|
100
|
+
@verticalSpacer = Qt::SpacerItem.new(106, 28, Qt::SizePolicy::Minimum, Qt::SizePolicy::Expanding)
|
101
|
+
|
102
|
+
@verticalLayout.addItem(@verticalSpacer)
|
103
|
+
|
104
|
+
@horizontalLayout = Qt::HBoxLayout.new()
|
105
|
+
@horizontalLayout.objectName = "horizontalLayout"
|
106
|
+
@pBminus = Qt::PushButton.new(mainDlg)
|
107
|
+
@pBminus.objectName = "pBminus"
|
108
|
+
@sizePolicy1 = Qt::SizePolicy.new(Qt::SizePolicy::Ignored, Qt::SizePolicy::Preferred)
|
109
|
+
@sizePolicy1.setHorizontalStretch(0)
|
110
|
+
@sizePolicy1.setVerticalStretch(0)
|
111
|
+
@sizePolicy1.heightForWidth = @pBminus.sizePolicy.hasHeightForWidth
|
112
|
+
@pBminus.sizePolicy = @sizePolicy1
|
113
|
+
@pBminus.minimumSize = Qt::Size.new(0, 32)
|
114
|
+
|
115
|
+
@horizontalLayout.addWidget(@pBminus)
|
116
|
+
|
117
|
+
@pBplus = Qt::PushButton.new(mainDlg)
|
118
|
+
@pBplus.objectName = "pBplus"
|
119
|
+
@sizePolicy1.heightForWidth = @pBplus.sizePolicy.hasHeightForWidth
|
120
|
+
@pBplus.sizePolicy = @sizePolicy1
|
121
|
+
@pBplus.minimumSize = Qt::Size.new(0, 32)
|
122
|
+
|
123
|
+
@horizontalLayout.addWidget(@pBplus)
|
124
|
+
|
125
|
+
|
126
|
+
@verticalLayout.addLayout(@horizontalLayout)
|
127
|
+
|
128
|
+
@horizontalLayout_2 = Qt::HBoxLayout.new()
|
129
|
+
@horizontalLayout_2.objectName = "horizontalLayout_2"
|
130
|
+
@label = Qt::Label.new(mainDlg)
|
131
|
+
@label.objectName = "label"
|
132
|
+
|
133
|
+
@horizontalLayout_2.addWidget(@label)
|
134
|
+
|
135
|
+
@lBzoom = Qt::Label.new(mainDlg)
|
136
|
+
@lBzoom.objectName = "lBzoom"
|
137
|
+
@sizePolicy.heightForWidth = @lBzoom.sizePolicy.hasHeightForWidth
|
138
|
+
@lBzoom.sizePolicy = @sizePolicy
|
139
|
+
|
140
|
+
@horizontalLayout_2.addWidget(@lBzoom)
|
141
|
+
|
142
|
+
|
143
|
+
@verticalLayout.addLayout(@horizontalLayout_2)
|
144
|
+
|
145
|
+
@line_2 = Qt::Frame.new(mainDlg)
|
146
|
+
@line_2.objectName = "line_2"
|
147
|
+
@line_2.setFrameShape(Qt::Frame::HLine)
|
148
|
+
@line_2.setFrameShadow(Qt::Frame::Sunken)
|
149
|
+
|
150
|
+
@verticalLayout.addWidget(@line_2)
|
151
|
+
|
152
|
+
@pBexit = Qt::PushButton.new(mainDlg)
|
153
|
+
@pBexit.objectName = "pBexit"
|
154
|
+
|
155
|
+
@verticalLayout.addWidget(@pBexit)
|
156
|
+
|
157
|
+
|
158
|
+
@horizontalLayout_3.addLayout(@verticalLayout)
|
159
|
+
|
160
|
+
@gVmap = Qt::GraphicsView.new(mainDlg)
|
161
|
+
@gVmap.objectName = "gVmap"
|
162
|
+
@sizePolicy2 = Qt::SizePolicy.new(Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding)
|
163
|
+
@sizePolicy2.setHorizontalStretch(3)
|
164
|
+
@sizePolicy2.setVerticalStretch(1)
|
165
|
+
@sizePolicy2.heightForWidth = @gVmap.sizePolicy.hasHeightForWidth
|
166
|
+
@gVmap.sizePolicy = @sizePolicy2
|
167
|
+
@gVmap.verticalScrollBarPolicy = Qt::ScrollBarAlwaysOff
|
168
|
+
@gVmap.horizontalScrollBarPolicy = Qt::ScrollBarAlwaysOff
|
169
|
+
brush = Qt::Brush.new(Qt::Color.new(0, 0, 0, 0))
|
170
|
+
brush.style = Qt::NoBrush
|
171
|
+
@gVmap.backgroundBrush = brush
|
172
|
+
brush1 = Qt::Brush.new(Qt::Color.new(0, 0, 0, 0))
|
173
|
+
brush1.style = Qt::NoBrush
|
174
|
+
@gVmap.foregroundBrush = brush1
|
175
|
+
@gVmap.viewportUpdateMode = Qt::GraphicsView::FullViewportUpdate
|
176
|
+
|
177
|
+
@horizontalLayout_3.addWidget(@gVmap)
|
178
|
+
|
179
|
+
|
180
|
+
retranslateUi(mainDlg)
|
181
|
+
Qt::Object.connect(@pBexit, SIGNAL('clicked()'), mainDlg, SLOT('pBexit_clicked()'))
|
182
|
+
Qt::Object.connect(@cBtoorigin, SIGNAL('clicked()'), mainDlg, SLOT('cBpointorigin_clicked()'))
|
183
|
+
Qt::Object.connect(@pBrecordTrack, SIGNAL('toggled(bool)'), mainDlg, SLOT('pBrecordTrack_toggled(bool)'))
|
184
|
+
Qt::Object.connect(@pBplus, SIGNAL('clicked()'), mainDlg, SLOT('pBplus_clicked()'))
|
185
|
+
Qt::Object.connect(@pBminus, SIGNAL('clicked()'), mainDlg, SLOT('pBminus_clicked()'))
|
186
|
+
Qt::Object.connect(@cBvor, SIGNAL('clicked(bool)'), mainDlg, SLOT('cBvor_clicked()'))
|
187
|
+
Qt::Object.connect(@cBndb, SIGNAL('clicked(bool)'), mainDlg, SLOT('cBndb_clicked()'))
|
188
|
+
Qt::Object.connect(@cBrw, SIGNAL('clicked(bool)'), mainDlg, SLOT('cBrw_clicked()'))
|
189
|
+
|
190
|
+
Qt::MetaObject.connectSlotsByName(mainDlg)
|
191
|
+
end # setupUi
|
192
|
+
|
193
|
+
def setup_ui(mainDlg)
|
194
|
+
setupUi(mainDlg)
|
195
|
+
end
|
196
|
+
|
197
|
+
def retranslateUi(mainDlg)
|
198
|
+
mainDlg.windowTitle = Qt::Application.translate("MainDlg", "Voc-Trainer", nil, Qt::Application::UnicodeUTF8)
|
199
|
+
@pBrecordTrack.text = Qt::Application.translate("MainDlg", "Record Track 1", nil, Qt::Application::UnicodeUTF8)
|
200
|
+
@cBautocenter.text = Qt::Application.translate("MainDlg", "Autocenter", nil, Qt::Application::UnicodeUTF8)
|
201
|
+
@cBtoorigin.text = Qt::Application.translate("MainDlg", "Point to Origin", nil, Qt::Application::UnicodeUTF8)
|
202
|
+
@cBvor.text = Qt::Application.translate("MainDlg", "Display VOR", nil, Qt::Application::UnicodeUTF8)
|
203
|
+
@cBndb.text = Qt::Application.translate("MainDlg", "Display NDB", nil, Qt::Application::UnicodeUTF8)
|
204
|
+
@cBrw.text = Qt::Application.translate("MainDlg", "Display Rws", nil, Qt::Application::UnicodeUTF8)
|
205
|
+
@label_2.text = Qt::Application.translate("MainDlg", "Current WP: ", nil, Qt::Application::UnicodeUTF8)
|
206
|
+
@lBcurrentwp.text = ''
|
207
|
+
@pBminus.text = Qt::Application.translate("MainDlg", "-", nil, Qt::Application::UnicodeUTF8)
|
208
|
+
@pBplus.text = Qt::Application.translate("MainDlg", "+", nil, Qt::Application::UnicodeUTF8)
|
209
|
+
@label.text = Qt::Application.translate("MainDlg", "Zoom:", nil, Qt::Application::UnicodeUTF8)
|
210
|
+
@lBzoom.text = ''
|
211
|
+
@pBexit.text = Qt::Application.translate("MainDlg", "Exit", nil, Qt::Application::UnicodeUTF8)
|
212
|
+
end # retranslateUi
|
213
|
+
|
214
|
+
def retranslate_ui(mainDlg)
|
215
|
+
retranslateUi(mainDlg)
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
module Ui
|
221
|
+
class MainDlg < Ui_MainDlg
|
222
|
+
end
|
223
|
+
end # module Ui
|
224
|
+
|
data/lib/navaid.rb
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'zlib'
|
2
|
+
require 'bsearch'
|
3
|
+
begin
|
4
|
+
require "ap"
|
5
|
+
rescue LoadError
|
6
|
+
def ap(*k)
|
7
|
+
p k
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
#NAVAID_FILE = "/usr/share/games/FlightGear/Navaids/nav.dat.gz"
|
13
|
+
NAVAID_FILE = "/home/chief/dev/nav.dat.gz"
|
14
|
+
|
15
|
+
class Navaid
|
16
|
+
Vor = Struct.new( :lat, :lon, :freq, :shortName, :longName, :type, :sceneItem )
|
17
|
+
Runway = Struct.new( :lat, :lon, :freq, :alt, :direction, :airportName, :runwayName, :sceneItem )
|
18
|
+
|
19
|
+
def initialize(arg=nil)
|
20
|
+
@vors = Array.new
|
21
|
+
@runways = Array.new
|
22
|
+
@lonSort = Array.new
|
23
|
+
@latSort = Array.new
|
24
|
+
@rwlatSort = Array.new
|
25
|
+
@rwlonSort = Array.new
|
26
|
+
@navaidFile = NAVAID_FILE
|
27
|
+
|
28
|
+
vorCount = 0
|
29
|
+
rwCount = 0
|
30
|
+
|
31
|
+
checkForNavaidFile(arg)
|
32
|
+
|
33
|
+
begin
|
34
|
+
Zlib::GzipReader.open(@navaidFile) {|gz|
|
35
|
+
gz.each_line do |l|
|
36
|
+
vordata=[]
|
37
|
+
if l[0,2] == "2 " or l[0,2] == "3 " then
|
38
|
+
vordata = l.split(" ")
|
39
|
+
# is it a NDB?
|
40
|
+
if l[0,2] == "2 " then
|
41
|
+
freq = vordata[4].to_i
|
42
|
+
type = "NDB"
|
43
|
+
else
|
44
|
+
# freq is in MHz * 100
|
45
|
+
freq = vordata[4].to_i / 100.0
|
46
|
+
type = vordata[-1]
|
47
|
+
end
|
48
|
+
@vors << Vor.new( vordata[1], vordata[2], freq, vordata[7], vordata[8..-2].join(" "), type, nil)
|
49
|
+
@latSort << [vordata[1].to_f, vorCount]
|
50
|
+
@lonSort << [vordata[2].to_f, vorCount]
|
51
|
+
vorCount += 1
|
52
|
+
end
|
53
|
+
|
54
|
+
# check for runways
|
55
|
+
if l[0,2] == "4 " then
|
56
|
+
rwdata = l.split(" ")
|
57
|
+
# freq is in MHz * 100
|
58
|
+
@runways << Runway.new( rwdata[1], rwdata[2], rwdata[4].to_i / 100.0, rwdata[3].to_i,
|
59
|
+
rwdata[6].to_f, rwdata[8], rwdata[9], nil)
|
60
|
+
@rwlatSort << [rwdata[1].to_f, rwCount]
|
61
|
+
@rwlonSort << [rwdata[2].to_f, rwCount]
|
62
|
+
rwCount += 1
|
63
|
+
end
|
64
|
+
end
|
65
|
+
}
|
66
|
+
|
67
|
+
@runways.sort! do |a,b|
|
68
|
+
a.airportName <=> b.airportName
|
69
|
+
end
|
70
|
+
|
71
|
+
Zlib::GzipReader.open(@navaidFile) {|gz|
|
72
|
+
mmdata = nil
|
73
|
+
range = nil
|
74
|
+
gz.each_line do |l|
|
75
|
+
# check for MiddleMarker used for placement of cone peak
|
76
|
+
if l[0,2] == "8 " then
|
77
|
+
mmdata = l.split(" ")
|
78
|
+
range = @runways.bsearch_range {|rw| rw.airportName <=> mmdata[8]}
|
79
|
+
rwMod = @runways[range].find do |rw|
|
80
|
+
rw.runwayName == mmdata[9]
|
81
|
+
end
|
82
|
+
# exchange lat and lon with position of corresponding MiddleMarker
|
83
|
+
if !rwMod.nil? then
|
84
|
+
rwMod.lat = mmdata[1]
|
85
|
+
rwMod.lon = mmdata[2]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
@latSort.sort! do |a,b|
|
93
|
+
a[0] <=> b[0]
|
94
|
+
end
|
95
|
+
@lonSort.sort! do |a,b|
|
96
|
+
a[0] <=> b[0]
|
97
|
+
end
|
98
|
+
@rwlatSort.sort! do |a,b|
|
99
|
+
a[0] <=> b[0]
|
100
|
+
end
|
101
|
+
@rwlonSort.sort! do |a,b|
|
102
|
+
a[0] <=> b[0]
|
103
|
+
end
|
104
|
+
rescue Errno::ENOENT
|
105
|
+
puts "Warning. Could not find data file for VORs."
|
106
|
+
end
|
107
|
+
# ap @vors
|
108
|
+
end
|
109
|
+
|
110
|
+
def checkForNavaidFile(arg)
|
111
|
+
root = ENV['FG_ROOT']
|
112
|
+
root = "" if root.nil?
|
113
|
+
arg="" if arg.nil?
|
114
|
+
paths=[ arg, root + "/Navaids", "/usr/share/games/FlightGear/Navaids", "%ProgramFiles%/FlightGear/data/Navaids" ]
|
115
|
+
paths.each do |path|
|
116
|
+
if FileTest.exist?(path) then
|
117
|
+
@navaidFile = path + "/nav.dat.gz"
|
118
|
+
puts "Found \"#{path}\" for loading navigation aids."
|
119
|
+
break
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def getVORs(box)
|
125
|
+
i = @latSort.bsearch_lower_boundary {|x| x[0] <=> box[1][0]}
|
126
|
+
j = @latSort.bsearch_upper_boundary {|x| x[0] <=> box[1][1]}
|
127
|
+
latCandidates = @latSort[i...j].collect do |a|
|
128
|
+
a[1] # return its array index
|
129
|
+
end
|
130
|
+
# protect against excessive CPU load
|
131
|
+
return [] if j-i > 2000
|
132
|
+
|
133
|
+
i = @lonSort.bsearch_lower_boundary {|x| x[0] <=> box[0][0]}
|
134
|
+
j = @lonSort.bsearch_upper_boundary {|x| x[0] <=> box[0][1]}
|
135
|
+
lonCandidates = @lonSort[i...j].collect do |a|
|
136
|
+
a[1] # return its array index
|
137
|
+
end
|
138
|
+
# protect against excessive CPU load
|
139
|
+
return [] if j-i > 2000
|
140
|
+
|
141
|
+
cross=latCandidates.find_all do |a|
|
142
|
+
lonCandidates.include?(a)
|
143
|
+
end
|
144
|
+
|
145
|
+
cross.collect do |a|
|
146
|
+
@vors[a]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def getRunways(box)
|
151
|
+
i = @rwlatSort.bsearch_lower_boundary {|x| x[0] <=> box[1][0]}
|
152
|
+
j = @rwlatSort.bsearch_upper_boundary {|x| x[0] <=> box[1][1]}
|
153
|
+
latCandidates = @rwlatSort[i...j].collect do |a|
|
154
|
+
a[1] # return its array index
|
155
|
+
end
|
156
|
+
# protect against excessive CPU load
|
157
|
+
return [] if j-i > 1000
|
158
|
+
|
159
|
+
i = @rwlonSort.bsearch_lower_boundary {|x| x[0] <=> box[0][0]}
|
160
|
+
j = @rwlonSort.bsearch_upper_boundary {|x| x[0] <=> box[0][1]}
|
161
|
+
lonCandidates = @rwlonSort[i...j].collect do |a|
|
162
|
+
a[1] # return its array index
|
163
|
+
end
|
164
|
+
# protect against excessive CPU load
|
165
|
+
return [] if j-i > 1000
|
166
|
+
|
167
|
+
cross=latCandidates.find_all do |a|
|
168
|
+
lonCandidates.include?(a)
|
169
|
+
end
|
170
|
+
|
171
|
+
cross.collect do |a|
|
172
|
+
@runways[a]
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "nodeinfo-widget"
|
2
|
+
begin
|
3
|
+
require "ap"
|
4
|
+
rescue LoadError
|
5
|
+
def ap(*k)
|
6
|
+
p k
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# Class MainDlg ############################################
|
11
|
+
class NodeinfoWidget < Qt::Widget
|
12
|
+
slots "hoverTimer()"
|
13
|
+
attr_reader :w, :hovertimer, :hover_on, :hover_widget_pos
|
14
|
+
attr_writer :hover_on, :hover_widget_pos
|
15
|
+
|
16
|
+
def initialize parent=nil
|
17
|
+
super()
|
18
|
+
@w=Ui::NodeinfoWidget.new
|
19
|
+
@w.setupUi(self)
|
20
|
+
@parent=parent
|
21
|
+
|
22
|
+
@hovertimer = Qt::Timer.new()
|
23
|
+
@hovertimer.setSingleShot(true)
|
24
|
+
Qt::Object.connect( @hovertimer, SIGNAL('timeout()'), self, SLOT('hoverTimer()') )
|
25
|
+
|
26
|
+
@hover_on=false
|
27
|
+
@hover_widget_pos=nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def hoverTimer()
|
31
|
+
p "timer fired"
|
32
|
+
if @hover_on then
|
33
|
+
@parent.scene.items.each {|item|
|
34
|
+
if item.kind_of? Qt::GraphicsRectItem then
|
35
|
+
if item == @parent then
|
36
|
+
item.setVisible(false)
|
37
|
+
break
|
38
|
+
end
|
39
|
+
end
|
40
|
+
}
|
41
|
+
@hover_widget_pos = nil
|
42
|
+
@hover_on = false
|
43
|
+
end
|
44
|
+
p "timer fired out"
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
=begin
|
2
|
+
** Form generated from reading ui file 'nodeinfo-widget.ui'
|
3
|
+
**
|
4
|
+
** Created: Fr. Jun 11 14:41:10 2010
|
5
|
+
** by: Qt User Interface Compiler version 4.6.2
|
6
|
+
**
|
7
|
+
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
|
+
=end
|
9
|
+
|
10
|
+
class Ui_NodeinfoWidget
|
11
|
+
attr_reader :gridLayout_3
|
12
|
+
attr_reader :frame
|
13
|
+
attr_reader :gridLayout_2
|
14
|
+
attr_reader :gridLayout
|
15
|
+
attr_reader :label_4
|
16
|
+
attr_reader :lBalt
|
17
|
+
attr_reader :label_3
|
18
|
+
attr_reader :lBspeed
|
19
|
+
attr_reader :label_6
|
20
|
+
attr_reader :lBlat
|
21
|
+
attr_reader :label_5
|
22
|
+
attr_reader :lBlon
|
23
|
+
|
24
|
+
def setupUi(nodeinfoWidget)
|
25
|
+
if nodeinfoWidget.objectName.nil?
|
26
|
+
nodeinfoWidget.objectName = "nodeinfoWidget"
|
27
|
+
end
|
28
|
+
nodeinfoWidget.resize(146, 58)
|
29
|
+
@sizePolicy = Qt::SizePolicy.new(Qt::SizePolicy::MinimumExpanding, Qt::SizePolicy::MinimumExpanding)
|
30
|
+
@sizePolicy.setHorizontalStretch(0)
|
31
|
+
@sizePolicy.setVerticalStretch(0)
|
32
|
+
@sizePolicy.heightForWidth = nodeinfoWidget.sizePolicy.hasHeightForWidth
|
33
|
+
nodeinfoWidget.sizePolicy = @sizePolicy
|
34
|
+
@palette = Qt::Palette.new
|
35
|
+
brush = Qt::Brush.new(Qt::Color.new(255, 255, 255, 0))
|
36
|
+
brush.style = Qt::SolidPattern
|
37
|
+
@palette.setBrush(Qt::Palette::Active, Qt::Palette::Base, brush)
|
38
|
+
brush1 = Qt::Brush.new(Qt::Color.new(224, 223, 222, 200))
|
39
|
+
brush1.style = Qt::SolidPattern
|
40
|
+
@palette.setBrush(Qt::Palette::Active, Qt::Palette::Window, brush1)
|
41
|
+
@palette.setBrush(Qt::Palette::Inactive, Qt::Palette::Base, brush)
|
42
|
+
brush2 = Qt::Brush.new(Qt::Color.new(224, 223, 222, 100))
|
43
|
+
brush2.style = Qt::SolidPattern
|
44
|
+
@palette.setBrush(Qt::Palette::Inactive, Qt::Palette::Window, brush2)
|
45
|
+
@palette.setBrush(Qt::Palette::Disabled, Qt::Palette::Base, brush2)
|
46
|
+
@palette.setBrush(Qt::Palette::Disabled, Qt::Palette::Window, brush2)
|
47
|
+
nodeinfoWidget.palette = @palette
|
48
|
+
@gridLayout_3 = Qt::GridLayout.new(nodeinfoWidget)
|
49
|
+
@gridLayout_3.margin = 1
|
50
|
+
@gridLayout_3.objectName = "gridLayout_3"
|
51
|
+
@frame = Qt::Frame.new(nodeinfoWidget)
|
52
|
+
@frame.objectName = "frame"
|
53
|
+
@frame.frameShape = Qt::Frame::StyledPanel
|
54
|
+
@frame.frameShadow = Qt::Frame::Raised
|
55
|
+
@gridLayout_2 = Qt::GridLayout.new(@frame)
|
56
|
+
@gridLayout_2.margin = 1
|
57
|
+
@gridLayout_2.objectName = "gridLayout_2"
|
58
|
+
@gridLayout = Qt::GridLayout.new()
|
59
|
+
@gridLayout.objectName = "gridLayout"
|
60
|
+
@label_4 = Qt::Label.new(@frame)
|
61
|
+
@label_4.objectName = "label_4"
|
62
|
+
@font = Qt::Font.new
|
63
|
+
@font.pointSize = 7
|
64
|
+
@label_4.font = @font
|
65
|
+
|
66
|
+
@gridLayout.addWidget(@label_4, 0, 0, 1, 1)
|
67
|
+
|
68
|
+
@lBalt = Qt::Label.new(@frame)
|
69
|
+
@lBalt.objectName = "lBalt"
|
70
|
+
@lBalt.font = @font
|
71
|
+
@lBalt.frameShape = Qt::Frame::Panel
|
72
|
+
@lBalt.frameShadow = Qt::Frame::Sunken
|
73
|
+
|
74
|
+
@gridLayout.addWidget(@lBalt, 0, 1, 1, 1)
|
75
|
+
|
76
|
+
@label_3 = Qt::Label.new(@frame)
|
77
|
+
@label_3.objectName = "label_3"
|
78
|
+
@label_3.font = @font
|
79
|
+
|
80
|
+
@gridLayout.addWidget(@label_3, 0, 2, 1, 1)
|
81
|
+
|
82
|
+
@lBspeed = Qt::Label.new(@frame)
|
83
|
+
@lBspeed.objectName = "lBspeed"
|
84
|
+
@lBspeed.font = @font
|
85
|
+
@lBspeed.frameShape = Qt::Frame::Panel
|
86
|
+
@lBspeed.frameShadow = Qt::Frame::Sunken
|
87
|
+
|
88
|
+
@gridLayout.addWidget(@lBspeed, 0, 3, 1, 1)
|
89
|
+
|
90
|
+
@label_6 = Qt::Label.new(@frame)
|
91
|
+
@label_6.objectName = "label_6"
|
92
|
+
@label_6.font = @font
|
93
|
+
|
94
|
+
@gridLayout.addWidget(@label_6, 1, 0, 1, 1)
|
95
|
+
|
96
|
+
@lBlat = Qt::Label.new(@frame)
|
97
|
+
@lBlat.objectName = "lBlat"
|
98
|
+
@lBlat.font = @font
|
99
|
+
@lBlat.frameShape = Qt::Frame::Panel
|
100
|
+
@lBlat.frameShadow = Qt::Frame::Sunken
|
101
|
+
|
102
|
+
@gridLayout.addWidget(@lBlat, 1, 1, 1, 1)
|
103
|
+
|
104
|
+
@label_5 = Qt::Label.new(@frame)
|
105
|
+
@label_5.objectName = "label_5"
|
106
|
+
@label_5.font = @font
|
107
|
+
|
108
|
+
@gridLayout.addWidget(@label_5, 1, 2, 1, 1)
|
109
|
+
|
110
|
+
@lBlon = Qt::Label.new(@frame)
|
111
|
+
@lBlon.objectName = "lBlon"
|
112
|
+
@lBlon.font = @font
|
113
|
+
@lBlon.frameShape = Qt::Frame::Panel
|
114
|
+
@lBlon.frameShadow = Qt::Frame::Sunken
|
115
|
+
|
116
|
+
@gridLayout.addWidget(@lBlon, 1, 3, 1, 1)
|
117
|
+
|
118
|
+
|
119
|
+
@gridLayout_2.addLayout(@gridLayout, 0, 0, 1, 1)
|
120
|
+
|
121
|
+
|
122
|
+
@gridLayout_3.addWidget(@frame, 0, 0, 1, 1)
|
123
|
+
|
124
|
+
|
125
|
+
retranslateUi(nodeinfoWidget)
|
126
|
+
|
127
|
+
Qt::MetaObject.connectSlotsByName(nodeinfoWidget)
|
128
|
+
end # setupUi
|
129
|
+
|
130
|
+
def setup_ui(nodeinfoWidget)
|
131
|
+
setupUi(nodeinfoWidget)
|
132
|
+
end
|
133
|
+
|
134
|
+
def retranslateUi(nodeinfoWidget)
|
135
|
+
nodeinfoWidget.windowTitle = Qt::Application.translate("NodeinfoWidget", "Form", nil, Qt::Application::UnicodeUTF8)
|
136
|
+
@label_4.text = Qt::Application.translate("NodeinfoWidget", "Alt:", nil, Qt::Application::UnicodeUTF8)
|
137
|
+
@label_3.text = Qt::Application.translate("NodeinfoWidget", "Speed", nil, Qt::Application::UnicodeUTF8)
|
138
|
+
@label_6.text = Qt::Application.translate("NodeinfoWidget", "Lat:", nil, Qt::Application::UnicodeUTF8)
|
139
|
+
@label_5.text = Qt::Application.translate("NodeinfoWidget", "Lon:", nil, Qt::Application::UnicodeUTF8)
|
140
|
+
end # retranslateUi
|
141
|
+
|
142
|
+
def retranslate_ui(nodeinfoWidget)
|
143
|
+
retranslateUi(nodeinfoWidget)
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
module Ui
|
149
|
+
class NodeinfoWidget < Ui_NodeinfoWidget
|
150
|
+
end
|
151
|
+
end # module Ui
|
152
|
+
|