summaryrefslogtreecommitdiff
path: root/src/hmi/qml/NavigationBrowseMap.qml
blob: 65431f570c76113db5e5bc5e9070a702a4d18b77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
*
* \file NavigationBrowseMap.qml
*
* \brief This file is part of the navigation hmi.
*
* \author Martin Schaller <martin.schaller@it-schaller.de>
*
* \version 
*
* This Source Code Form is subject to the terms of the
* Mozilla Public License (MPL), v. 2.0.
* If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For further information see http://www.genivi.org/.
*
* List of changes:
* <date>, <name>, <description of change>
*
* @licence end@
*/
import QtQuick 2.1 
import "Core"
import "Core/genivi.js" as Genivi;
import "Core/style-sheets/style-constants.js" as Constants;
import "Core/style-sheets/navigation-browse-map-bottom-css.js" as StyleSheetBottom
import "Core/style-sheets/navigation-browse-map-route-css.js" as StyleSheetRoute
import "Core/style-sheets/navigation-browse-map-guidance-css.js" as StyleSheetGuidance
import "Core/style-sheets/navigation-browse-map-scroll-css.js" as StyleSheetScroll
import "Core/style-sheets/navigation-browse-map-simulation-css.js" as StyleSheetSimulation
import "Core/style-sheets/navigation-browse-map-top-css.js" as StyleSheetTop

import lbs.plugin.dbusif 1.0

HMIMenu {
	id: menu
    headlineFg: "grey"
    headlineBg: "blue"
    text: Genivi.gettext("NavigationBrowseMap")
    next: scrollup
	prev: menub
	property Item guidanceWaypointReachedSignal;
	property Item guidanceManeuverChangedSignal;
    property Item guidancePositionOnRouteChangedSignal;
	property Item mapmatchedpositionPositionUpdateSignal;
	property Item mapmatchedpositionAddressUpdateSignal;
	property Item fuelStopAdvisorSignal;
	property bool north:false;
	
	DBusIf {
		id:dbusIf
	}

	function guidanceManeuverChanged(args)
	{
		// TODO: Create possibility to poll information?
		// console.log("guidanceManeuverChanged");
		// Genivi.dump("",args);
        maneuverAdvice.text=Genivi.Maneuver[args[1]];
	}

	function guidanceWaypointReached(args)
	{
		// console.log("guidanceWaypointReached");
		// Genivi.dump("",args);
		if (args[2]) {
            maneuverAdvice.text="Destination reached";
		} else {
            maneuverAdvice.text="Waypoint reached";
		}

	}

    function guidancePositionOnRouteChanged(args)
	{
		updateGuidance();
	}
	
	function mapmatchedpositionPositionUpdate(args)
	{
		var res=Genivi.nav_message(dbusIf,"MapMatchedPosition","GetPosition",["array",["uint16",Genivi.NAVIGATIONCORE_SPEED]]);
		if (res[0] == "map" && res[1][0] == "uint16" && res[1][1] == Genivi.NAVIGATIONCORE_SPEED && res[1][2] == "variant" && res[1][3][0] == "double") {
            speedValue.text=res[1][3][1];
		} else {
			console.log("Unexpected result from GetPosition:");
			Genivi.dump("",res);
		}
	}

	function updateAddress()
	{
		var res=Genivi.nav_message(dbusIf,"MapMatchedPosition","GetAddress",["array",["uint16",Genivi.NAVIGATIONCORE_STREET]]);
		if (res[0] == "map" && res[1][0] == "uint16" && res[1][1] == Genivi.NAVIGATIONCORE_STREET && res[1][2] == "variant" && res[1][3][0] == "string") {
            currentroad.text=res[1][3][1];
		} else {
            currentroad.text="";
		}
	}

	function mapmatchedpositionAddressUpdate(args)
	{
		updateAddress();
	}

	function showZoom()
	{
		var res=Genivi.mapviewercontrol_message(dbusIf, "GetMapViewScale", []);
		if (res[0] == "uint8" && res[2] == "uint16") {
			var text=res[1];
			if (res[3])
				text+="*";
			zoomlevel.text=text;
		} else {
			console.log("Unexpected Result from GetMapViewScale:");
			Genivi.dump("",res);
		}
	}

	function fuelStopAdvisorWarning(args)
	{
        if (args[0] == 'bool')
        {
            if (args[1] == 1)
            {
                fsamessageText.text=Genivi.gettext("FSAWarning");
            }
            else
            {
                fsamessageText.text=" ";
             }
        }
        else
        {
            console.log("Unexpected result from fuelStopAdvisorWarning:");
            Genivi.dump("",args);
        }

	}

	function connectSignals()
    {
        guidanceWaypointReachedSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.Guidance","WaypointReached",menu,"guidanceWaypointReached");
        guidanceManeuverChangedSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.Guidance","ManeuverChanged",menu,"guidanceManeuverChanged");
        guidancePositionOnRouteChangedSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.Guidance","PositionOnRouteChanged",menu,"guidancePositionOnRouteChanged");
        mapmatchedpositionPositionUpdateSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.MapMatchedPosition","PositionUpdate",menu,"mapmatchedpositionPositionUpdate");
        mapmatchedpositionAddressUpdateSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.MapMatchedPosition","AddressUpdate",menu,"mapmatchedpositionAddressUpdate");
        fuelStopAdvisorSignal=dbusIf.connect("","/org/genivi/demonstrator/FuelStopAdvisor","org.genivi.demonstrator.FuelStopAdvisor","FuelStopAdvisorWarning",menu,"fuelStopAdvisorWarning");
    }

    function disconnectSignals()
    {
        guidanceWaypointReachedSignal.destroy();
        guidanceManeuverChangedSignal.destroy();
        guidancePositionOnRouteChangedSignal.destroy();
        mapmatchedpositionPositionUpdateSignal.destroy();
        mapmatchedpositionAddressUpdateSignal.destroy();
        fuelStopAdvisorSignal.destroy();
    }

	function showSurfaces()
	{
		Genivi.lm_message(dbusIf,"ServiceConnect",["uint32",dbusIf.pid()]);
		if (Genivi.g_map_handle2) {
			Genivi.lm_message(dbusIf,"SetSurfaceDestinationRegion",["uint32",2000+Genivi.g_map_handle[1],"uint32",map.x,"uint32",map.y,"uint32",map.width/2,"uint32",map.height]);
			Genivi.lm_message(dbusIf,"SetSurfaceSourceRegion",["uint32",2000+Genivi.g_map_handle[1],"uint32",0,"uint32",0,"uint32",map.width/2,"uint32",map.height]);
			Genivi.lm_message(dbusIf,"SetSurfaceDestinationRegion",["uint32",2000+Genivi.g_map_handle2[1],"uint32",map.x+map.width/2,"uint32",map.y,"uint32",map.width/2,"uint32",map.height]);
			Genivi.lm_message(dbusIf,"SetSurfaceSourceRegion",["uint32",2000+Genivi.g_map_handle2[1],"uint32",0,"uint32",0,"uint32",map.width/2,"uint32",map.height]);
			Genivi.lm_message(dbusIf,"SetSurfaceVisibility",["uint32",2000+Genivi.g_map_handle[1],"boolean",true]);
			Genivi.lm_message(dbusIf,"SetSurfaceVisibility",["uint32",2000+Genivi.g_map_handle2[1],"boolean",true]);
		} else {
			Genivi.lm_message(dbusIf,"SetSurfaceDestinationRegion",["uint32",2000+Genivi.g_map_handle[1],"uint32",map.x,"uint32",map.y,"uint32",map.width,"uint32",map.height]);
			Genivi.lm_message(dbusIf,"SetSurfaceSourceRegion",["uint32",2000+Genivi.g_map_handle[1],"uint32",0,"uint32",0,"uint32",map.width,"uint32",map.height]);
			Genivi.lm_message(dbusIf,"SetSurfaceVisibility",["uint32",2000+Genivi.g_map_handle[1],"boolean",true]);
		}
		Genivi.lm_message(dbusIf,"CommitChanges",[]);
		Genivi.lm_message(dbusIf,"ServiceDisconnect",["uint32",dbusIf.pid()]);
	}

	function hideSurfaces()
	{
		Genivi.lm_message(dbusIf,"ServiceConnect",["uint32",dbusIf.pid()]);
		if (Genivi.g_map_handle2) {
			Genivi.lm_message(dbusIf,"SetSurfaceVisibility",["uint32",2000+Genivi.g_map_handle2[1],"boolean",false]);
		}
		Genivi.lm_message(dbusIf,"SetSurfaceVisibility",["uint32",2000+Genivi.g_map_handle[1],"boolean",false]);
		Genivi.lm_message(dbusIf,"CommitChanges",[]);
		Genivi.lm_message(dbusIf,"ServiceDisconnect",["uint32",dbusIf.pid()]);
	}

	function routeOverview()
	{
		if (!split.disabled) {
			disconnectSignals();
			hideSurfaces();
			pageOpen("NavigationCalculatedRoute");
		}
	}

	function toggleOrientation()
	{
		north=!north;
		if (north) {
			Genivi.mapviewercontrol_message(dbusIf, "SetCameraHeadingAngle", ["int32",0]);
            orientation.setState("D");
		} else {
			Genivi.mapviewercontrol_message(dbusIf, "SetCameraHeadingTrackUp", []);
            orientation.setState("N");
		}
	}

	function updateGuidance()
	{
        var res=Genivi.guidance_message_get(dbusIf,"GetGuidanceStatus",[]);
		if (res[0] != "uint16") {
			console.log("Unexpected result from GetGuidanceStatus:");
			Genivi.dump("",res);
			return;
		}
		if (res[1] == Genivi.NAVIGATIONCORE_INACTIVE) {
            //Guidance inactive, so inform the trip computer
            Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",0,"uint8",0]);
            maneuverAdvice.text=Genivi.gettext("NoGuidance");
            maneuverValue.text=Genivi.gettext("NoManeuver");
            distancetomaneuverValue.text="----";
            distancetodestinationValue.text="----";
            timetodestinationValue.text="----";
            roadaftermaneuverValue.text="----";
			return;
		} else {
            //Guidance active, so inform the trip computer (refresh)
            Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",1,"uint8",50]);
		}

        var res=Genivi.guidance_message_get(dbusIf,"GetManeuversList",["uint16",1,"uint32",0]);

        if (res[0] == "uint16" && res[2] == "array") {
            var array=res[3];
            for (var i = 0 ; i < array.length ; i+=2) {
                if (array[i] == "structure" && array[i+1][0] == "string" && array[i+1][2] == "string" && array[i+1][4] == "uint16" && array[i+1][6] == "uint16" && array[i+1][8] == "uint32" && array[i+1][10] == "array") {
                    var structure=array[i+1];
                    var subarray=structure[11];
                    for (var j = 0 ; j < subarray.length ; j+=2) {
                        //multiple maneuvers are not managed !
                        if (subarray[j] == "structure" && subarray[j+1][0] == "uint32" && subarray[j+1][2] == "uint32" && subarray[j+1][4] == "int32" && subarray[j+1][6] == "uint16" && subarray[j+1][8] == "array") {
                            var substructure=subarray[j+1];
                            var subsubarray=subarray[j+1][9];
                            if (subsubarray[0] == "structure" && subsubarray[1][0] == "uint16")
                            {
                               if (subsubarray[1][1] == Genivi.NAVIGATIONCORE_DIRECTION && subsubarray[1][2] == "variant" && subsubarray[1][3][0] == "uint16")
                               {
                                   maneuverValue.text=Genivi.ManeuverDirection[subsubarray[1][3][1]];
                                   //Genivi.ManeuverType[subarray[j+1][7]] contains CROSSROAD and is removed for the moment
                                   distancetomaneuverValue.text=Genivi.distance(substructure[1]);
                                   roadaftermaneuverValue.text=structure[3];

                               }
                            }
                        }
                    }
                }
            }

        } else {
            console.log("Unexpected result from GetManeuversList");
            Genivi.dump("",res);
        }

        res=Genivi.guidance_message_get(dbusIf,"GetDestinationInformation",[]);

        if (res[0] == "uint32")
        {
            distancetodestinationValue.text = Genivi.distance(res[1]);
        }
        else
        {
            console.log("Unexpected result from GetDestinationInformation");
            Genivi.dump("",res);
        }
        if (res[2] == "uint32")
        {
            timetodestinationValue.text = Genivi.time(res[3]);
        }
        else
        {
            console.log("Unexpected result from GetDestinationInformation");
            Genivi.dump("",res);
        }

    }

	function stopGuidance()
	{
		Genivi.guidance_message(dbusIf,"StopGuidance",[]);
		updateGuidance();
	}

    Rectangle {
        id:map
        x:0
        y:0
        height:menu.height
        width:menu.width
        color:"#ffff7e"

        Rectangle {
            opacity: 0.8
            width: StyleSheetTop.navigation_browse_map_top_background[Constants.WIDTH]
            height: StyleSheetTop.navigation_browse_map_top_background[Constants.HEIGHT]
            x: Constants.MENU_BROWSE_MAP_TOP_X
            y: Constants.MENU_BROWSE_MAP_TOP_Y
            HMIBgImage {
                id: top
                image:StyleSheetTop.navigation_browse_map_top_background[Constants.SOURCE];
                anchors { fill: parent; topMargin: parent.headlineHeight}

                Text {
                    x:StyleSheetTop.fsamessageText[Constants.X]; y:StyleSheetTop.fsamessageText[Constants.Y]; width:StyleSheetTop.fsamessageText[Constants.WIDTH]; height:StyleSheetTop.fsamessageText[Constants.HEIGHT];color:StyleSheetTop.fsamessageText[Constants.TEXTCOLOR];styleColor:StyleSheetTop.fsamessageText[Constants.STYLECOLOR]; font.pixelSize:StyleSheetTop.fsamessageText[Constants.PIXELSIZE];
                    id:fsamessageText
                    visible: true
                    style: Text.Sunken
                    smooth: true
                    text:""
                }

                StdButton {
                    source:StyleSheetTop.select_search_for_refill_in_top[Constants.SOURCE]; x:StyleSheetTop.select_search_for_refill_in_top[Constants.X]; y:StyleSheetTop.select_search_for_refill_in_top[Constants.Y]; width:StyleSheetTop.select_search_for_refill_in_top[Constants.WIDTH]; height:StyleSheetTop.select_search_for_refill_in_top[Constants.HEIGHT];
                    id:select_search_for_refill_in_top
                    explode: false
                    onClicked: {
                        disconnectSignals();
                        hideSurfaces();
                        pageOpen("POI");
                                }
                        }

                Text {
                    x:StyleSheetTop.speedValue[Constants.X]; y:StyleSheetTop.speedValue[Constants.Y]; width:StyleSheetTop.speedValue[Constants.WIDTH]; height:StyleSheetTop.speedValue[Constants.HEIGHT];color:StyleSheetTop.speedValue[Constants.TEXTCOLOR];styleColor:StyleSheetTop.speedValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheetTop.speedValue[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:speedValue
                    text: "---"
                }

                Text {
                    x:StyleSheetTop.speedUnit[Constants.X]; y:StyleSheetTop.speedUnit[Constants.Y]; width:StyleSheetTop.speedUnit[Constants.WIDTH]; height:StyleSheetTop.speedUnit[Constants.HEIGHT];color:StyleSheetTop.speedUnit[Constants.TEXTCOLOR];styleColor:StyleSheetTop.speedUnit[Constants.STYLECOLOR]; font.pixelSize:StyleSheetTop.speedUnit[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:speedUnit
                    text: "km/h"
                }
            }
        }

        Rectangle {
            opacity: 0.8
            width: StyleSheetBottom.navigation_browse_map_bottom_background[Constants.WIDTH]
            height: StyleSheetBottom.navigation_browse_map_bottom_background[Constants.HEIGHT]
            x: Constants.MENU_BROWSE_MAP_BOTTOM_X
            y: Constants.MENU_BROWSE_MAP_BOTTOM_Y
            HMIBgImage {
                id: bottom
                image:StyleSheetBottom.navigation_browse_map_bottom_background[Constants.SOURCE];
                anchors { fill: parent; topMargin: parent.headlineHeight}

                StdButton {
                    source:StyleSheetBottom.menub[Constants.SOURCE]; x:StyleSheetBottom.menub[Constants.X]; y:StyleSheetBottom.menub[Constants.Y]; width:StyleSheetBottom.menub[Constants.WIDTH]; height:StyleSheetBottom.menub[Constants.HEIGHT];textColor:StyleSheetBottom.menubText[Constants.TEXTCOLOR]; pixelSize:StyleSheetBottom.menubText[Constants.PIXELSIZE];
                    id:menub; text:Genivi.gettext("Menu"); next:orientation; prev:settings;
                    onClicked: {
                        disconnectSignals();
                        hideSurfaces();
                        pageOpen("MainMenu");
                    }
                }

                StdButton {
                    x:StyleSheetBottom.directiondestination[Constants.X]; y:StyleSheetBottom.directiondestination[Constants.Y]; width:StyleSheetBottom.directiondestination[Constants.WIDTH]; height:StyleSheetBottom.directiondestination[Constants.HEIGHT];
                    id:orientation; next:zoomin; prev:menub; explode:false; disabled:false;
                    source:StyleSheetBottom.directionnorth[Constants.SOURCE]; //todo call get status
                    property int status: 0;
                    function setState(name)
                    {
                        if (name=="D")
                        {
                            status=1;
                            source=StyleSheetBottom.directionnorth[Constants.SOURCE];
                        }
                        else
                        {
                            status=0;
                            source=StyleSheetBottom.directiondestination[Constants.SOURCE];
                        }
                    }
                    onClicked:
                    {
                        toggleOrientation();
                    }
                }

                Text {
                    x:StyleSheetBottom.currentroad[Constants.X]; y:StyleSheetBottom.currentroad[Constants.Y]; width:StyleSheetBottom.currentroad[Constants.WIDTH]; height:StyleSheetBottom.currentroad[Constants.HEIGHT];color:StyleSheetBottom.currentroad[Constants.TEXTCOLOR];styleColor:StyleSheetBottom.currentroad[Constants.STYLECOLOR]; font.pixelSize:StyleSheetBottom.currentroad[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:currentroad
                    text: "-------"
                }

                StdButton {
                    source:StyleSheetBottom.zoomin[Constants.SOURCE]; x:StyleSheetBottom.zoomin[Constants.X]; y:StyleSheetBottom.zoomin[Constants.Y]; width:StyleSheetBottom.zoomin[Constants.WIDTH]; height:StyleSheetBottom.zoomin[Constants.HEIGHT];
                    id:zoomin; explode:false; next:zoomout; prev:orientation;
                    onClicked: {
                        Genivi.mapviewercontrol_message(dbusIf, "SetMapViewScaleByDelta", ["int16",1]);
                        showZoom();
                    }
                }

                Text {
                    x:StyleSheetBottom.zoomlevel[Constants.X]; y:StyleSheetBottom.zoomlevel[Constants.Y]; width:StyleSheetBottom.zoomlevel[Constants.WIDTH]; height:StyleSheetBottom.zoomlevel[Constants.HEIGHT];color:StyleSheetBottom.zoomlevel[Constants.TEXTCOLOR];styleColor:StyleSheetBottom.zoomlevel[Constants.STYLECOLOR]; font.pixelSize:StyleSheetBottom.zoomlevel[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:zoomlevel
                    text: " "
                }

                StdButton {
                    source:StyleSheetBottom.zoomout[Constants.SOURCE]; x:StyleSheetBottom.zoomout[Constants.X]; y:StyleSheetBottom.zoomout[Constants.Y]; width:StyleSheetBottom.zoomout[Constants.WIDTH]; height:StyleSheetBottom.zoomout[Constants.HEIGHT];
                    id:zoomout; explode:false; next:settings; prev:zoomin;
                    onClicked: {
                        Genivi.mapviewercontrol_message(dbusIf, "SetMapViewScaleByDelta", ["int16",-1]);
                        showZoom();
                    }
                }

                StdButton {
                    source:StyleSheetBottom.settings[Constants.SOURCE]; x:StyleSheetBottom.settings[Constants.X]; y:StyleSheetBottom.settings[Constants.Y]; width:StyleSheetBottom.settings[Constants.WIDTH]; height:StyleSheetBottom.settings[Constants.HEIGHT];
                    id:settings; explode:false; next:menub; prev:zoomout;
                    onClicked: {
                        disconnectSignals();
                        hideSurfaces();
                        pageOpen("CameraSettings");
                    }
                }
            }
        }

        Rectangle {
            opacity: 0.8
            width: StyleSheetRoute.navigation_browse_map_route_background[Constants.WIDTH]
            height: StyleSheetRoute.navigation_browse_map_route_background[Constants.HEIGHT]
            x: Constants.MENU_BROWSE_MAP_ROUTE_X
            y: Constants.MENU_BROWSE_MAP_ROUTE_Y
            HMIBgImage {
                id: route
                image:StyleSheetRoute.navigation_browse_map_route_background[Constants.SOURCE]
                anchors { fill: parent; topMargin: parent.headlineHeight}
                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        routeOverview();
                                }
                }

                Text {
                    x:StyleSheetRoute.timetodestinationValue[Constants.X]; y:StyleSheetRoute.timetodestinationValue[Constants.Y]; width:StyleSheetRoute.timetodestinationValue[Constants.WIDTH]; height:StyleSheetRoute.timetodestinationValue[Constants.HEIGHT];color:StyleSheetRoute.timetodestinationValue[Constants.TEXTCOLOR];styleColor:StyleSheetRoute.timetodestinationValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheetRoute.timetodestinationValue[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:timetodestinationValue
                    text: "-------"
                }

                Text {
                    x:StyleSheetRoute.distancetodestinationValue[Constants.X]; y:StyleSheetRoute.distancetodestinationValue[Constants.Y]; width:StyleSheetRoute.distancetodestinationValue[Constants.WIDTH]; height:StyleSheetRoute.distancetodestinationValue[Constants.HEIGHT];color:StyleSheetRoute.distancetodestinationValue[Constants.TEXTCOLOR];styleColor:StyleSheetRoute.distancetodestinationValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheetRoute.distancetodestinationValue[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:distancetodestinationValue
                    text: "----"
                }

            }
        }

        Rectangle {
            opacity: 0.8
            width: StyleSheetGuidance.navigation_browse_map_guidance_background[Constants.WIDTH]
            height: StyleSheetGuidance.navigation_browse_map_guidance_background[Constants.HEIGHT]
            x: Constants.MENU_BROWSE_MAP_GUIDANCE_X
            y: Constants.MENU_BROWSE_MAP_GUIDANCE_Y
            HMIBgImage {
                id: guidance
                image:StyleSheetGuidance.navigation_browse_map_guidance_background[Constants.SOURCE]
                anchors { fill: parent; topMargin: parent.headlineHeight}
                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        var res=Genivi.guidance_message(dbusIf,"GetGuidanceStatus",[]);
                        if (res[0] == "uint16") {
                            if (res[1] != Genivi.NAVIGATIONCORE_INACTIVE) {
                                disconnectSignals();
                                hideSurfaces();
                                pageOpen("NavigationManeuversList");
                            }
                        }
                    }
                }

                Text {
                    x:StyleSheetGuidance.maneuverValue[Constants.X]; y:StyleSheetGuidance.maneuverValue[Constants.Y]; width:StyleSheetGuidance.maneuverValue[Constants.WIDTH]; height:StyleSheetGuidance.maneuverValue[Constants.HEIGHT];color:StyleSheetGuidance.maneuverValue[Constants.TEXTCOLOR];styleColor:StyleSheetGuidance.maneuverValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheetGuidance.maneuverValue[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:maneuverValue
                    text: " "
                }

                Text {
                    x:StyleSheetGuidance.distancetomaneuverValue[Constants.X]; y:StyleSheetGuidance.distancetomaneuverValue[Constants.Y]; width:StyleSheetGuidance.distancetomaneuverValue[Constants.WIDTH]; height:StyleSheetGuidance.distancetomaneuverValue[Constants.HEIGHT];color:StyleSheetGuidance.distancetomaneuverValue[Constants.TEXTCOLOR];styleColor:StyleSheetGuidance.distancetomaneuverValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheetGuidance.distancetomaneuverValue[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:distancetomaneuverValue
                    text: " "
                }

                Text {
                    x:StyleSheetGuidance.roadaftermaneuverValue[Constants.X]; y:StyleSheetGuidance.roadaftermaneuverValue[Constants.Y]; width:StyleSheetGuidance.roadaftermaneuverValue[Constants.WIDTH]; height:StyleSheetGuidance.roadaftermaneuverValue[Constants.HEIGHT];color:StyleSheetGuidance.roadaftermaneuverValue[Constants.TEXTCOLOR];styleColor:StyleSheetGuidance.roadaftermaneuverValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheetGuidance.roadaftermaneuverValue[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:roadaftermaneuverValue
                    text: " "
                }

                Text {
                    x:StyleSheetGuidance.maneuverAdvice[Constants.X]; y:StyleSheetGuidance.maneuverAdvice[Constants.Y]; width:StyleSheetGuidance.maneuverAdvice[Constants.WIDTH]; height:StyleSheetGuidance.maneuverAdvice[Constants.HEIGHT];color:StyleSheetGuidance.maneuverAdvice[Constants.TEXTCOLOR];styleColor:StyleSheetGuidance.maneuverAdvice[Constants.STYLECOLOR]; font.pixelSize:StyleSheetGuidance.maneuverAdvice[Constants.PIXELSIZE];
                    visible: true
                    style: Text.Sunken;
                    smooth: true
                    id:maneuverAdvice
                    text: " "
                }

            }
        }

        Rectangle {
            opacity: 0.8
            width: StyleSheetScroll.navigation_browse_map_scroll_background[Constants.WIDTH]
            height: StyleSheetScroll.navigation_browse_map_scroll_background[Constants.HEIGHT]
            x: Constants.MENU_BROWSE_MAP_SCROLL_X
            y: Constants.MENU_BROWSE_MAP_SCROLL_Y
            HMIBgImage {
                property real panX: 40 //delta in pixel for x panning
                property real panY: 40 //delta in pixel for y panning
                id: scroll
                image:StyleSheetScroll.navigation_browse_map_scroll_background[Constants.SOURCE];
                anchors { fill: parent; topMargin: parent.headlineHeight}

                StdButton {
                    source:StyleSheetScroll.scrollup[Constants.SOURCE]; x:StyleSheetScroll.scrollup[Constants.X]; y:StyleSheetScroll.scrollup[Constants.Y]; width:StyleSheetScroll.scrollup[Constants.WIDTH]; height:StyleSheetScroll.scrollup[Constants.HEIGHT];
                    id:scrollup; explode:false; next:scrollleft; prev:scrolldown;
                    onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);}
                    onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2,"uint16",map.height/2 + scroll.panY]]]);}
                }

                StdButton {
                    source:StyleSheetScroll.scrollleft[Constants.SOURCE]; x:StyleSheetScroll.scrollleft[Constants.X]; y:StyleSheetScroll.scrollleft[Constants.Y]; width:StyleSheetScroll.scrollleft[Constants.WIDTH]; height:StyleSheetScroll.scrollleft[Constants.HEIGHT];
                    id:scrollleft; explode:false; next:scrollright; prev:scrollup;
                    onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);}
                    onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2 + scroll.panX,"uint16",map.height/2]]]);}
                }

                StdButton {
                    source:StyleSheetScroll.scrollright[Constants.SOURCE]; x:StyleSheetScroll.scrollright[Constants.X]; y:StyleSheetScroll.scrollright[Constants.Y]; width:StyleSheetScroll.scrollright[Constants.WIDTH]; height:StyleSheetScroll.scrollright[Constants.HEIGHT];
                    id:scrollright; explode:false; next:scrolldown; prev:scrollleft;
                    onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);}
                    onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2 - scroll.panX,"uint16",map.height/2]]]);}
                }

                StdButton {
                    source:StyleSheetScroll.scrolldown[Constants.SOURCE]; x:StyleSheetScroll.scrolldown[Constants.X]; y:StyleSheetScroll.scrolldown[Constants.Y]; width:StyleSheetScroll.scrolldown[Constants.WIDTH]; height:StyleSheetScroll.scrolldown[Constants.HEIGHT];
                    id:scrolldown; explode:false; next:scrollup; prev:scrollright;
                    onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);}
                    onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2,"uint16",map.height/2 - scroll.panY]]]);}
                }
            }
        }

        Rectangle {
            opacity: 0.8
            width: StyleSheetSimulation.navigation_browse_map_simulation_background[Constants.WIDTH]
            height: StyleSheetSimulation.navigation_browse_map_simulation_background[Constants.HEIGHT]
            x: Constants.MENU_BROWSE_MAP_SIMULATION_X
            y: Constants.MENU_BROWSE_MAP_SIMULATION_Y
            HMIBgImage {
                id: simulation
                image:StyleSheetSimulation.navigation_browse_map_simulation_background[Constants.SOURCE];
                anchors { fill: parent; topMargin: parent.headlineHeight}
            }
        }
    }

    Component.onCompleted: {
        Genivi.map_handle(dbusIf,menu.width,menu.height,Genivi.MAPVIEWER_MAIN_MAP);
		showSurfaces();
		if (Genivi.data['show_route_handle']) {
			Genivi.mapviewercontrol_message(dbusIf, "DisplayRoute", Genivi.data['show_route_handle'].concat("boolean",false));
			delete(Genivi.data['show_route_handle']);
		}
		if (Genivi.data['zoom_route_handle']) {
			var res=Genivi.nav_message(dbusIf, "Routing", "GetRouteBoundingBox", Genivi.nav_session(dbusIf).concat(Genivi.data['zoom_route_handle']));
			if (res[0] == "structure") {
				Genivi.mapviewercontrol_message(dbusIf, "SetMapViewBoundingBox", res);
			} else {
                console.log("Unexpected result from GetRouteBoundingBox:");
				Genivi.dump("",res);
			}
			delete(Genivi.data['zoom_route_handle']);
		}
		if (Genivi.data['show_position']) {
			Genivi.mapviewercontrol_message(dbusIf, "SetFollowCarMode", ["boolean",false]);
			Genivi.mapviewercontrol_message(dbusIf, "SetTargetPoint", ["structure",[
				"double",Genivi.data['show_position']['lat'],
				"double",Genivi.data['show_position']['lon'],
				"int32",Genivi.data['show_position']['alt']
				]]
			);
			delete(Genivi.data['show_position']);
		}
		if (Genivi.data['show_current_position']) {
			Genivi.mapviewercontrol_message(dbusIf, "SetFollowCarMode", ["boolean",true]);
			delete(Genivi.data['show_current_position']);
		}
		connectSignals();
		updateGuidance();
        showZoom();
		updateAddress();
	}
}