X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fgooglemap%2Fstatic%2Fjs%2Fgooglemap.js;h=0c511a08df1529241868cebc3ad154f1378174c2;hb=8e47d1e76551223a1997d9383ac0bb987e04dfad;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..0c511a08 100644 --- a/plugins/googlemap/static/js/googlemap.js +++ b/plugins/googlemap/static/js/googlemap.js @@ -1,341 +1,314 @@ /** - * 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'; - - // 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 ); - } - }; - - /*************************************************************************** - * Public methods - ***************************************************************************/ - - var methods = { - - /** - * @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 ) { - - return this.each(function(){ - - var $this = $(this); - - /* An object that will hold private variables and methods */ - var plugin = new GoogleMaps(options); - $this.data('Manifold', plugin); - - plugin.initialize(); +// events that happen in the once-per-view range +googlemap_debug=false; +// more on a on-per-record basis +googlemap_debug_detailed=false; - /* Events */ - $this.on('show.' + PLUGIN_NAME, methods.show); - - $this.set_query_handler(options.query_uuid, plugin.query_handler); - $this.set_record_handler(options.query_uuid, plugin.record_handler); - $this.set_record_handler(options.query_all_uuid, plugin.record_handler_all); +(function($){ - }); // this.each + var GoogleMap = Plugin.extend({ + + init: function(options, element) { + this._super(options, element); + + /* Member variables */ + // query status + this.received_all = false; + this.received_set = false; + this.in_set_backlog = []; + + // we keep a couple of global hashes + // lat_lon --> { marker,