I'm using this code to show all info bubbles on map, but it's not showing any. They remain as markers.
var pois = map.pois;
for(var poi in pois)
map.showInfoBubble(poi);
Any ideas?
Thanks
Tom
I'm using this code to show all info bubbles on map, but it's not showing any. They remain as markers.
var pois = map.pois;
for(var poi in pois)
map.showInfoBubble(poi);
Any ideas?
Thanks
Tom
Hi Tom,
Either your array is empty or the poi data structure is incompatible. Do you have "name" property in pois?
Leo
Hi Leo,
The array is not empty and the "name" property is there. I noticed that it was complaining about a "listener", so after I added this to the map control, the showInfoBubble started to work:
infoBubble: {
content: ["title"],
listeners: {
click: function () {
SelectedPlaceID = poi.data.tag.toString();
$("#map_marker_popup" ).popup( "open" );
}
}
},
However, when I try to hide the infoBubble using the same code and markers, it complains with the message "cannot convert a null to object" (on line 357 of mh5.js)
The code is now:
var pois = window.map.pois;
guide_obj.map_control.showMarkerNames = !guide_obj.map_control.showMarkerNames;
for(i=0;i<pois.length;i++)
{
poi = pois[i];
if(guide_obj.map_control.showMarkerNames == true)
window.map.showInfoBubble(poi);
else
window.map.hideInfoBubble(poi);
}
The pois are created like this:
var poi = map.createPoi(nokia.mh5.assetsPath + "img/categories/12.icon.mh5.basic.png", { longitude: Place.Longi, latitude: Place.Lat });
poi.name = Place.Name;
poi.tag = Place.ID;
pois[j] = poi;
j = j + 1;
...
map.pois = pois;
Thanks
Tom
Last edited by tomgiam; 2013-01-12 at 16:44.
Hi Tom,
hideInfoBubble doesn't accept the poi but the infobubble you want to hide (please look at the documentation). You get all the shown infobubbles by accessing map.infoBubbles array. Every infoBubble object has "poi" property which is the reference to the actual poi.
Leo
Hi,
What parameters need to be passed to hideInfoBubble to close it? Looked over docs can not find the information needed.
Thanks again!
To close it is easy, but I still can't figure out how to open it.
This code will close all displayed infoBubbles:
var infobs = window.map.infoBubbles;
for(i=0;i<infobs.length;i++)
window.map.hideInfoBubble(infobs[i]);
When they are closed the window.map.infoBubbles array is empty so you can only see the pois, when I try:
var pois= window.map.pois;
for(i=0;i<pois.length;i++)
window.map.showInfoBubble(pois[i]);
it doesn't work.
Tom