Skip to content
Browse files

v.1

  • Loading branch information...
1 parent 3ca63ed commit f0ce7ead2b32e9fd5c02364de38d8f137edf8610 @FabFab committed Mar 7, 2012
Showing with 34 additions and 33 deletions.
  1. 0 README
  2. +3 −0 README.md
  3. +20 −22 js/GoogleRadar.js
  4. +11 −11 js/demo.js
View
0 README
No changes.
View
3 README.md
@@ -0,0 +1,3 @@
+See a description and the demo there : [there](http://www.blackspotradish.com/wp/google-maps-radar/)
+
+See the documentation [here](https://github.com/FabFab/Google-Maps-Radar/wiki/Documentation)
View
42 js/GoogleRadar.js
@@ -48,9 +48,9 @@ GoogleRadar.prototype.setCenter = function(lat,lng) {
*/
GoogleRadar.prototype.drawAxis = function(opts) {
- if(typeof (this.axis) == 'undefined') {
+ if(typeof (this.axis) == "undefined") {
this.axis = {};
- this.axis.radius = opts.radius || 1000; //m
+ this.axis.radius = (opts && opts.radius) || 1000; //m
this.axis.n = (opts && opts.n) || 10;
}
@@ -90,7 +90,7 @@ GoogleRadar.prototype.undrawAxis = function() {
*/
GoogleRadar.prototype.addRadarLine = function(opts) {
- if( typeof (this.radarLine) == 'undefined') {
+ if( typeof (this.radarLine) == "undefined") {
this.radarLine = {};
this.radarLine.id = (opts && opts.id) || "line_" + Math.random();
@@ -154,7 +154,7 @@ GoogleRadar.prototype.rotateLine = function() {
}
// Count the laps.
- this.lapsAndLoops(this.radarLine, 'rotateLine');
+ this.lapsAndLoops(this.radarLine, "rotateLine");
}
@@ -175,7 +175,7 @@ GoogleRadar.prototype.showLine = function() {
* Polygon
*/
GoogleRadar.prototype.addRadarPolygon = function(opts) {
- if( typeof (this.radarPolygon) == 'undefined') {
+ if( typeof (this.radarPolygon) == "undefined") {
this.radarPolygon = {};
this.radarPolygon.id = (opts && opts.id) || "polygon_" + Math.random();
this.radarPolygon.radius = (opts && opts.radius) || 1;//km
@@ -241,10 +241,10 @@ GoogleRadar.prototype.rotateInArray = function() {
this.detectMarkers(this.radarPolygon);
// Count the laps.
- this.lapsAndLoops(this.radarPolygon, 'rotateInArray');
+ this.lapsAndLoops(this.radarPolygon, "rotateInArray");
}
-GoogleRadar.prototype.stopRotatePolygon = function() {
+GoogleRadar.prototype.stopPolygon = function() {
window.clearTimeout(this.radarPolygon.callback);
this.radarPolygon.callback = null;
}
@@ -265,7 +265,7 @@ GoogleRadar.prototype.lapsAndLoops = function(radar, funcName) {
{
radar.angle = (radar.angle + radar.angleIncrease) % 360;
- if(typeof(GoogleRadar.aRadars) == 'object')
+ if(typeof(GoogleRadar.aRadars) == "object")
{
//mmmh, let's see...
}
@@ -310,25 +310,25 @@ GoogleRadar.prototype.detectMarkers = function (radar){
}
}
-GoogleRadar.prototype.addMarker = function(aMarker) {
+GoogleRadar.prototype.addMarker = function(marker) {
- if(aMarker.lat == null || aMarker.lng == null || aMarker.id == null || aMarker.iconUrl == null)
+ if(marker.lat == null || marker.lng == null || marker.id == null || marker.iconUrl == null)
return false;
if( typeof (this.aMarkers) === "undefined")
return false;
- var marker = new google.maps.Marker({
+ var gMarker = new google.maps.Marker({
map : this.map,
draggable : false,
- position : new google.maps.LatLng(aMarker.lat, aMarker.lng),
- icon : aMarker.iconUrl || null,
- handle : aMarker.handle || null,
- id : aMarker.id,
- visible : (aMarker.visible == null) && true
+ position : new google.maps.LatLng(marker.lat, marker.lng),
+ icon : marker.iconUrl || null,
+ handle : marker.handle || null,
+ id : marker.id,
+ visible : (marker.visible == null) && true
});
- this.aMarkers.push(marker);
+ this.aMarkers.push(gMarker);
}
GoogleRadar.prototype.removeMarker = function(marker) {
@@ -378,8 +378,7 @@ if( typeof (Number.prototype.toDeg) === "undefined") {
*/
GoogleRadar.prototype.distanceFrom = function(LatLng1, LatLng2) {
- var R = this.EarthRadius;
- // km
+ var R = this.EarthRadius; // km
var dLat = (LatLng2.lat() - LatLng1.lat()).toRad();
var dLon = (LatLng2.lng() - LatLng1.lng()).toRad();
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(LatLng1.lat().toRad()) * Math.cos(LatLng2.lat().toRad()) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
@@ -390,13 +389,12 @@ GoogleRadar.prototype.distanceFrom = function(LatLng1, LatLng2) {
// Huge thanks to http://www.movable-type.co.uk/scripts/latlong.html
GoogleRadar.prototype.destinationPoint = function(initLatLon, dist, brng) {
- dist = typeof (dist) == 'number' ? dist : typeof (dist) == 'string' && dist.trim() != '' ? +dist : NaN;
+ dist = typeof (dist) == "number" ? dist : typeof (dist) == "string" && dist.trim() != "" ? +dist : NaN;
dist = dist / this.EarthRadius;
// convert dist to angular distance in radians
brng = brng.toRad();
- //
- var lat1 = initLatLon.lat().toRad(), lon1 = initLatLon.lng().toRad();
+ var lat1 = initLatLon.lat().toRad(), lon1 = initLatLon.lng().toRad();
var lat2 = Math.asin(Math.sin(lat1) * Math.cos(dist) + Math.cos(lat1) * Math.sin(dist) * Math.cos(brng));
var lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(dist) * Math.cos(lat1), Math.cos(dist) - Math.sin(lat1) * Math.sin(lat2));
lon2 = (lon2 + 3 * Math.PI) % (2 * Math.PI) - Math.PI;
View
22 js/demo.js
@@ -48,7 +48,7 @@
oPictoInit = {
lat : oPicto.latitude,
lng : oPicto.longitude,
- iconUrl : "./img/multi-agents.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/multi-agents.png",
id : "meeting",
name : "The Meeting Point",
content : "Hachiko, the most famous meeting point in Tokyo"
@@ -103,7 +103,7 @@
function stopRadarPolygon() {
if( typeof (myGoogleRadar) != 'undefined') {
- myGoogleRadar.stopRotatePolygon();
+ myGoogleRadar.stopPolygon();
}
};
@@ -121,7 +121,7 @@
var oPicto0 = {
lat : 35.662872,
lng : 139.700448,
- iconUrl : "./img/jack_32.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/jack_32.png",
id : "trump",
handle : function() {
Notifier.success("One of the Best Club in Tokyo", "The Trump Room");
@@ -138,7 +138,7 @@
var oPicto1 = {
lat : 35.65920,
lng : 139.70080,
- iconUrl : "./img/male-user.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/male-user.png",
id : "male-user",
handle : function() {
Notifier.info("Several Floors of Shopping for him", "Shopping for him");
@@ -154,7 +154,7 @@
var oPicto2 = {
lat : 35.66147,
lng : 139.70045,
- iconUrl : "./img/female-user.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/female-user.png",
id : "female-user",
visible : false,
handle : function() {
@@ -170,7 +170,7 @@
var oPicto3 = {
lat : 35.66111,
lng : 139.69786,
- iconUrl : "./img/star.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/star.png",
id : "bar",
handle : function() {
Notifier.success("Nice DJs, Good drinks, but a bit expensive", "Nice Bar, Rock 'n roll!");
@@ -185,7 +185,7 @@
var oPicto4 = {
lat : 35.660733,
lng : 139.698608,
- iconUrl : "./img/recycle-full.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/recycle-full.png",
id : "stupid",
handle : function() {
Notifier.warning("Hey bro, wanna come to my bar and meet my girlz?", "Bar for stupid");
@@ -200,7 +200,7 @@
var oPicto5 = {
lat : 35.65941,
lng : 139.70800,
- iconUrl : "./img/lock.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/lock.png",
id : "unknown1",
visible : false,
handle : function() {
@@ -219,7 +219,7 @@
var oPicto6 = {
lat : 35.6485,
lng : 139.7045,
- iconUrl : "./img/line-globe.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/line-globe.png",
id : "unknown2",
handle : function() {
Notifier.info("Too far away to be triggered");
@@ -234,7 +234,7 @@
var oPicto7 = {
lat : 35.6567,
lng : 139.6954,
- iconUrl : "./img/heart.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/heart.png",
id : "love",
visible : false,
handle : function() {
@@ -253,7 +253,7 @@
var oPicto8 = {
lat : 35.6564,
lng : 139.7009,
- iconUrl : "./img/lookup.png",
+ iconUrl : "https://github.com/FabFab/Google-Maps-Radar/raw/master/img/lookup.png",
id : "unknow3",
visible : false,
handle : function() {

0 comments on commit f0ce7ea

Please sign in to comment.
Something went wrong with that request. Please try again.