Skip to content
Snippets Groups Projects
Commit d215538c authored by Brandon Bergren's avatar Brandon Bergren
Browse files

JSLint run.

parent e98e2026
No related branches found
No related tags found
No related merge requests found
/* $Id$ */
/**
* @file
* GMap Markers
* GMap API version -- No manager
*/
/*global Drupal, GMarker */
// Replace to override marker creation
Drupal.gmap.factory.marker = function(loc,opts) {
return new GMarker(loc,opts);
Drupal.gmap.factory.marker = function (loc, opts) {
return new GMarker(loc, opts);
};
Drupal.gmap.addHandler('gmap', function(elem) {
Drupal.gmap.addHandler('gmap', function (elem) {
var obj = this;
obj.bind('addmarker',function(marker) {
obj.bind('addmarker', function (marker) {
obj.map.addOverlay(marker.marker);
});
obj.bind('delmarker',function(marker) {
obj.bind('delmarker', function (marker) {
obj.map.removeOverlay(marker.marker);
});
obj.bind('clearmarkers',function() {
obj.bind('clearmarkers', function () {
// @@@ Maybe don't nuke ALL overlays?
obj.map.clearOverlays();
});
......
/* $Id$ */
/**
* @file
* GPolyLine / GPolygon manager
*/
/*global Drupal, GLatLng, GPoint */
Drupal.gmap.map.prototype.poly = {};
/**
* Distance in pixels between 2 points.
*/
Drupal.gmap.map.prototype.poly.distance = function(point1,point2) {
return Math.sqrt(Math.pow(point2.x - point1.x,2)+Math.pow(point2.y - point1.y,2));
Drupal.gmap.map.prototype.poly.distance = function (point1, point2) {
return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
};
/**
* Circle -- Following projection.
*/
Drupal.gmap.map.prototype.poly.computeCircle = function(obj,center,point2) {
Drupal.gmap.map.prototype.poly.computeCircle = function (obj, center, point2) {
var numSides = 36;
var sideInc = 10; // 360 / 20 = 18 degrees
var convFactor = Math.PI/180;
var convFactor = Math.PI / 180;
var points = [];
var radius = obj.poly.distance(center,point2);
var radius = obj.poly.distance(center, point2);
// 36 sided poly ~= circle
for (var i = 0; i <= numSides; i++) {
var rad = i*sideInc*convFactor;
var rad = i * sideInc * convFactor;
var x = center.x + radius * Math.cos(rad);
var y = center.y + radius * Math.sin(rad);
//points.push(obj.map.getCurrentMapType().getProjection().fromPixelToLatLng(new GPoint(x,y),obj.map.getZoom()));
points.push(new GPoint(x,y));
points.push(new GPoint(x, y));
}
return points;
};
Drupal.gmap.map.prototype.poly.calcPolyPoints = function(center, radM, numPoints, sAngle) {
if(!numPoints) {numPoints = 32;}
if(!sAngle) {sAngle = 0;}
Drupal.gmap.map.prototype.poly.calcPolyPoints = function (center, radM, numPoints, sAngle) {
if (!numPoints) {
numPoints = 32;
}
if (!sAngle) {
sAngle = 0;
}
var d2r = Math.PI / 180.0;
var r2d = 180.0 / Math.PI;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment