Sunday, February 21, 2010

Custom icons

Just discovered a custom icon collection project on Google Code. There are more than 900 icons this far.

It would be nice if those were provided in sprite format. Happily there are sprite-making services. SpriteMe is the most advanced of those.


Monday, February 08, 2010

clearOverlays() in V3

There is no clearOverlays() in API v3. Some practices have been presented. I think this is the simpliest so far.

Push all the overlays in an array when created (as usual). Following code will clear both map and the array:


pop() method of an array removes the last element of an array, and returns that element. 'while' keeps that happening as long as there are elements in the array. When overlays[0] does not exist anymore, the mission is completed and code will proceed.

Applied in the example of the previous post.

Rectangle() and Circle() of V3

API v3.28 has new constructors

  new google.maps.Rectangle();
  new google.maps.Circle();

Dimensioning and positioning is set by bounds (Rectangle) or by center and radius (Circle). Circle radius is given in meters. Those can be set as options or by special methods setBounds(), setCenter() and setRadius().  They are documented already.

getBounds() for Circle would be a useful method that is missing.

Altogether those are very handy classes and we can forget my boundsbox.js library in most cases. Image overlaying is still a perfect task for boundsbox.

Quickly testing Rectangle().