12 import org.kde.edu.marble 0.11
41 question:
"Tom Sawyer paints aunt Polly's fence. Where was that?"
46 question:
"Jonathan Harker meets Count Dracula. Where?"
51 question:
"Henry Jekyll becomes Edward Hyde in...?"
56 question:
"Where did Quasimodo ring the bells?"
68 font { pointSize: 12; bold:
true }
79 width: banner.width - button.width - 30
86 delegate: questionDelegate
93 anchors.left: questionView.right
94 font { pointSize: 12; bold:
true }
100 if ( screen.state ==
"moving" ) {
101 screen.state =
"solving"
102 }
else if ( screen.state ==
"solving" ) {
103 if ( questionView.currentIndex < questionView.count - 1 ) {
104 questionView.visible =
true
105 questionView.currentIndex = questionView.currentIndex + 1
106 screen.state =
"selecting"
107 messages.text =
"Select the target in the map"
109 screen.state =
"finished"
112 }
else if ( screen.state ==
"finished" ) {
113 questionView.currentIndex = 0
114 screen.state =
"selecting"
117 screen.state =
"selecting"
126 anchors.top: banner.bottom
128 height: screen.height - banner.height
132 if ( screen.state ==
"selecting" || screen.state ==
"moving" ) {
133 screen.state =
"selecting"
137 pointer.x = area.mouseX
138 pointer.y = area.mouseY
139 selection.x = pointer.x;
140 selection.y = pointer.y - selection.height
141 screen.state =
"moving"
142 messages.text =
"Done? Click 'Solve'"
144 var diff = (pointer.x-opx) * (pointer.x-opx);
145 diff += (pointer.y-opy) * (pointer.y-opy);
147 animation.duration = 500
150 animation.duration = 100
160 projection:
"Mercator"
161 mapThemeId:
"earth/plain/plain.dgml"
169 source:
"fixing-pin.svg"
184 id: solutionanimation
203 y: parent.height - 40
215 text:
"Where is that?"
216 font { pointSize: 12; bold:
true }
231 function calculateSolution()
233 var lon = questionModel.get(questionView.currentIndex).lon
234 var lat = questionModel.get(questionView.currentIndex).lat
235 var pixel = map.pixel( lon, lat )
237 solution.y = pixel.y - solution.height
242 var flon = questionModel.get(questionView.currentIndex).lon
243 var flat = questionModel.get(questionView.currentIndex).lat
244 var
coordinate = map.coordinate( pointer.x, pointer.y )
245 var dist = coordinate.distance( flon, flat ) / 1000
246 messages.text =
"Target distance: " + dist.toFixed(1) +
" km"
252 PropertyChanges { target: questionView; visible:
true }
253 PropertyChanges { target: button; label:
"Solve" }
254 PropertyChanges { target: button; visible:
false }
255 PropertyChanges { target: solution; visible:
false }
256 PropertyChanges { target: map; inputEnabled:
false }
257 PropertyChanges { target: selection; visible:
false }
258 StateChangeScript{ script: calculateSolution(); }
262 PropertyChanges { target: questionView; visible:
true }
263 PropertyChanges { target: button; label:
"Solve" }
264 PropertyChanges { target: button; visible:
true }
265 PropertyChanges { target: solution; visible:
false }
266 PropertyChanges { target: map; inputEnabled:
false }
267 PropertyChanges { target: selection; visible:
true; }
271 PropertyChanges { target: questionView; visible:
true }
272 PropertyChanges { target: button; label:
"Next" }
273 PropertyChanges { target: button; visible:
true }
274 PropertyChanges { target: solution; visible:
true }
275 PropertyChanges { target: map; inputEnabled:
false }
276 PropertyChanges { target: selection; visible:
true }
277 StateChangeScript{ script: solutionanimation.start(); }
278 StateChangeScript{ script: solve(); }
282 PropertyChanges { target: questionView; visible:
true }
283 PropertyChanges { target: button; label:
"Try Again" }
284 PropertyChanges { target: button; visible:
true }
285 PropertyChanges { target: solution; visible:
false }
286 PropertyChanges { target: messages; text:
"" }
287 PropertyChanges { target: map; inputEnabled:
true }
288 PropertyChanges { target: selection; visible:
false }
301 duration: animation.duration
static qreal radius(qreal zoom)