Disable traffic map views with HERE JavaScript API

拈花ヽ惹草 提交于 2019-11-28 11:10:41

问题


HERE Map material comes with different map views and possible overlays like 'Traffic conditions', 'Public transport' and 'Incidents'. I do not want to offer these three views at all. Unfortunately, I was only able to deactivate them by the following code:

//disable traffic information
var control = HEREMap.ui.getControl('mapsettings');  
control.getChildren()[1].m[3].setDisabled(true);
control.getChildren()[1].m[2].setDisabled(true);
control.getChildren()[1].m[1].setDisabled(true);

However, this leaves me with gray, unclickable options for like 'Traffic conditions', 'Public transport' and 'Incidents'. Is there a way to show them not at all using the JavaScript API?

Thanks in advance, Team DG7


回答1:


Not pretty but it works. Follow the same approach to remove the hr.

$(".H_btn:contains('Traffic conditions')").hide();
$(".H_btn:contains('Public transport')").hide();
$(".H_btn:contains('Show traffic incidents')").hide();



回答2:


As of 8/2018, there does not appear to be any option in the API to create the default UI without the traffic views.

I used the following code to clean up the default menu:

let mapsettings = ui.getControl('mapsettings');
let menuEntries = mapsettings.getChildren()[1].getChildren();
menuEntries[0].getElement().style.borderBottom = 'none';
for (let i=1; i<menuEntries.length; i++)
    menuEntries[i].setVisibility(false);


来源:https://stackoverflow.com/questions/45859871/disable-traffic-map-views-with-here-javascript-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!