Wednesday, 23 May 2007

PAD, small improvements

Since there arent' so many people helping me in inserting the home-delivery pizza shops in the database, I had to realize some improvements:
  • I added also some takeway pizza shops, but the user who wants to see them on the map must express his willing by clicking on a check box.
  • the address that the user has entered in the search box is displayed on the map through this icon: .
  • the zoom is chosen so that at least three pizza shops are visible at the same time.
For realizing the last feature I've used the GMap API function GLatLngBounds.extend(). Here's a snippet:
var bounds = new GLatLngBounds();
bounds.extend(new GLatLng(41.895466, 12.482323)); // searched address
bounds.extend(new GLatLng(41.882694, 12.520852)); // first pizza shop
bounds.extend(new GLatLng(41.921056, 12.457294)); // second pizza shop
bounds.extend(new GLatLng(41.874163, 12.443047)); // third pizza shop
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));

No comments: