X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fgooglemap%2Fstatic%2Fjs%2Fgooglemap.js;h=3d1875717376d16164437374d7b9f445fa9a46ee;hb=dfa0e7671a6c8363cc0531bace287d638bc1d510;hp=c9d392322bfef8fd7a9f766b1266522865db6382;hpb=d1e5d12b2b9519801f7b981a2177b3f36115714a;p=myslice.git diff --git a/plugins/googlemap/static/js/googlemap.js b/plugins/googlemap/static/js/googlemap.js index c9d39232..3d187571 100644 --- a/plugins/googlemap/static/js/googlemap.js +++ b/plugins/googlemap/static/js/googlemap.js @@ -1,341 +1,426 @@ /** - * Description: display a query result in a googlemap - * Copyright (c) 2012 UPMC Sorbonne Universite - INRIA + * Description: display a query result in a Google map + * Copyright (c) 2012-2013 UPMC Sorbonne Universite - INRIA * License: GPLv3 */ -/* - * It's a best practice to pass jQuery to an IIFE (Immediately Invoked Function - * Expression) that maps it to the dollar sign so it can't be overwritten by - * another library in the scope of its execution. +/* BUGS: + * - infowindow is not properly reopened when the maps does not have the focus */ -(function($){ - - var PLUGIN_NAME = 'GoogleMap'; +GOOGLEMAP_BGCOLOR_RESET = 0; +GOOGLEMAP_BGCOLOR_ADDED = 1; +GOOGLEMAP_BGCOLOR_REMOVED = 2; - // routing calls - jQuery.fn.GoogleMap = function( method ) { - if ( methods[method] ) { - return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); - } else if ( typeof method === 'object' || ! method ) { - return methods.init.apply( this, arguments ); - } else { - jQuery.error( 'Method ' + method + ' does not exist on jQuery.' + PLUGIN_NAME ); - } - }; +(function($){ - /*************************************************************************** - * Public methods - ***************************************************************************/ + // events that happen in the once-per-view range + var debug=false; + debug=true; - var methods = { + // this now should be obsolete, rather use plugin_debug in plugin.js + // more on a on-per-record basis + var debug_deep=false; + // debug_deep=true; - /** - * @brief Plugin initialization - * @param options : an associative array of setting values - * @return : a jQuery collection of objects on which the plugin is - * applied, which allows to maintain chainability of calls - */ - init : function( options ) { + var GoogleMap = Plugin.extend({ - return this.each(function(){ - - var $this = $(this); + /************************************************************************** + * CONSTRUCTOR + **************************************************************************/ - /* An object that will hold private variables and methods */ - var plugin = new GoogleMaps(options); - $this.data('Manifold', plugin); + init: function(options, element) + { + this._super(options, element); + + /* Member variables */ + + /* we keep a couple of global hashes + * lat_lon --> { marker,