/* $Id: highlight.js,v 1.1.2.1 2010/04/08 13:40:19 rooby Exp $ */ /** * @file * Common marker highlighting routines. */ /** * Highlights marker on rollover. * Removes highlight on previous marker. * * Creates a "circle" using 20-sided GPolygon at the given point * Circle polygon object is global variable as there is only one highlighted marker at a time * and we want to remove the previously placed polygon before placing a new one. * * Original code "Google Maps JavaScript API Example" */ highlightMarker = function (map, currentMarker, highlightID, color) { var markerPoint = currentMarker.marker.getPoint(); var polyPoints = Array(); var mapNormalProj = G_NORMAL_MAP.getProjection(); var mapZoom = map.getZoom(); var clickedPixel = mapNormalProj.fromLatLngToPixel(markerPoint, mapZoom); var polySmallRadius = 20; var polyNumSides = 20; var polySideLength = 18; for (var a = 0; a < (polyNumSides + 1); a++) { var aRad = polySideLength * a * (Math.PI/180); var polyRadius = polySmallRadius; var pixelX = clickedPixel.x + polyRadius * Math.cos(aRad); var pixelY = clickedPixel.y + polyRadius * Math.sin(aRad); var polyPixel = new GPoint(pixelX, pixelY); var polyPoint = mapNormalProj.fromPixelToLatLng(polyPixel, mapZoom); polyPoints.push(polyPoint); } // Using GPolygon(points, strokeColor?, strokeWeight?, strokeOpacity?, fillColor?, fillOpacity?) map.highlightID = new GPolygon(polyPoints, color, 2, 0, color, 0.5); map.addOverlay(map.highlightID); }; unHighlightMarker = function (map, currentMarker, highlightID) { if (map.highlightID) { map.removeOverlay(map.highlightID); delete map.highlightID; } }; /* playback timings (ms): LoadShardBlock: 223.685 (3) esindex: 0.011 captures_list: 239.809 CDXLines.iter: 11.009 (3) PetaboxLoader3.datanode: 119.871 (4) exclusion.robots: 0.322 exclusion.robots.policy: 0.306 RedisCDXSource: 1.773 PetaboxLoader3.resolve: 163.227 load_resource: 206.663 */