Jun 30, 2007

Skype API (Skype4COM) + Google MAPS API = ? [3]

As a part of my Google Maps and Skype API I wanted to add custom icons to represent different objects on the map (currently I made it for the bus stations).

The picture bellow is the result :



It was again easy - we simply create GIcon object. Then we assign the URL of the image to be used, size of the icon and point, where the info window will appear :


Code


icon = new GIcon();
icon.image = 'BusFine.gif';
icon.iconSize = new GSize(39, 60);
icon.iconAnchor = new GPoint(5, 34);
icon.infoWindowAnchor = new GPoint(5, 2);




Then we only need to add this object as a second parameter in the GMarker object constructor.



Code


// point is a GPoint object, representing the location the marker
should be
// displayed.
marker = new GMarker(point, icon);



Note : Some browsers may need some more settings in order to display the custom icon correctly, the example above is for IE.