Hali-ela
var map, infobox, tooltip;
var tooltipTemplate = '
{title}
';
function GetMap() {
//Create custom Pushpin
var locations= [ ]; var pointsll= [ ];
p=new Microsoft.Maps.Pushpin(ll= new Microsoft.Maps.Location(6.9573974,81.033225), {
title: 'Hali-ela',
subTitle: 'Hali-ela',
//text: '',
icon:'https://common.lithium.lk/images/markers/red.png',
});
p.metadata = {
title: 'Hali-ela',
description: '',
};
Microsoft.Maps.Events.addHandler(p, 'click', pushpinClicked);
//Microsoft.Maps.Events.addHandler(p, 'mouseover', pushpinHovered);
//Microsoft.Maps.Events.addHandler(p, 'mouseout', closeTooltip);
locations.push(p);
pointsll.push(ll);
cred='KPWb5scokYHF9h6u0EAz6UuVFIA0ffGJp_4cWUObFLQTzn4E9p2q';
if(locations.length==1){
var map = new Microsoft.Maps.Map('#cms-std-map', {
credentials: cred,
center: new Microsoft.Maps.Location( 6.9573974,81.033225),
zoom:locations.length==1 ? 15 : 9 ,
});
}else{
var r = Microsoft.Maps.LocationRect.fromLocations(pointsll);
var map = new Microsoft.Maps.Map('#cms-std-map', {
credentials: cred,
bounds : r,
});
}
var center = map.getCenter();
//Create an infobox to use as a tooltip when hovering.
tooltip = new Microsoft.Maps.Infobox(map.getCenter(), {
visible: false,
showPointer: false,
showCloseButton: false,
offset: new Microsoft.Maps.Point(-75, 10)
});
tooltip.setMap(map);
//Create an infobox for displaying detailed information.
infobox = new Microsoft.Maps.Infobox(map.getCenter(), {
visible: false
});
infobox.setMap(map);
//Create random locations in the map bounds.
var randomLocations = Microsoft.Maps.TestDataGenerator.getLocations(5, map.getBounds());
//Add the pushpin to the map
if(locations.length==1) map.entities.push(locations[0]);
else if(locations.length>1) {
Microsoft.Maps.loadModule("Microsoft.Maps.Clustering", function () {
map.layers.insert(new Microsoft.Maps.ClusterLayer(locations ));
});
}
}
function pushpinClicked(e) {
//Hide the tooltip
closeTooltip();
//Make sure the infobox has metadata to display.
if (e.target.metadata) {
//Set the infobox options with the metadata of the pushpin.
infobox.setOptions({
location: e.target.getLocation(),
title: e.target.metadata.title,
description: e.target.metadata.description,
visible: true
});
}
}
function pushpinHovered(e) {
//Hide the infobox
infobox.setOptions({ visible: false });
//Make sure the infobox has metadata to display.
if (e.target.metadata) {
//Set the infobox options with the metadata of the pushpin.
tooltip.setOptions({
location: e.target.getLocation(),
htmlContent: tooltipTemplate.replace('{title}', e.target.metadata.title).replace('{text}', e.target.metadata.description),
visible: true
});
}
}
function closeTooltip() {
//Close the tooltip.
tooltip.setOptions({
visible: false
});
}
{text}
Hali-ela386/4B, 1st Lane,
Open Hours : 9.00 a.m. to 5.00 p.m.
Fax : (94) 55 2 294843
Phone : (94) 55 2 294343, (94) 55 2 294443, (94) 55 2 294543
This is a compressed page. View Original