Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1031 → Rev 1032

/trunk/widget/modules/carto/squelettes/scripts/carto.js
4,7 → 4,7
var DEBUG = false;
var communeImageUrl = 'http://www.tela-botanica.org/commun/icones/carto/commune.png';
var pointImageUrl = 'http://www.tela-botanica.org/commun/icones/carto/point2.png';
var groupeImageUrlTpl = 'http://localhost/cel-jrest/CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var groupeImageUrlTpl = 'http://localhost/jrest/CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
62,7 → 62,8
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
rafraichirCarte();
attribuerListenerCarte();
programmerRafraichissementCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
140,22 → 141,25
}
var listener = null;
var timer = null;
function rafraichirCarte() {
function attribuerListenerCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', function(){
if(timer != null) {
window.clearTimeout(timer);
}
timer = window.setTimeout(function() {
var zoom = map.getZoom();
var NELatLng = map.getBounds().getNorthEast().lat()+'|'+map.getBounds().getNorthEast().lng();
var SWLatLng = map.getBounds().getSouthWest().lat()+'|'+map.getBounds().getSouthWest().lng();
chargerMarqueurs(zoom, NELatLng, SWLatLng);
}, 300);
programmerRafraichissementCarte();
});
listener = google.maps.event.addListener(map, 'zoom_changed', function(){
programmerRafraichissementCarte();
});
}
function programmerRafraichissementCarte() {
if(timer != null) {
window.clearTimeout(timer);
}
timer = window.setTimeout(function() {
var zoom = map.getZoom();
var NELatLng = map.getBounds().getNorthEast().lat()+'|'+map.getBounds().getNorthEast().lng();
var SWLatLng = map.getBounds().getSouthWest().lat()+'|'+map.getBounds().getSouthWest().lng();
chargerMarqueurs(zoom, NELatLng, SWLatLng);
}, 400);
}
 
function collecterBorduresEtChargerMarqueurs() {
 
164,12 → 168,15
var premierChargement = true;
var marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
google.maps.event.removeListener(listener);
var url = stationsUrl+
'&zoom='+zoom+
'&ne='+NELatLng+
'&sw='+SWLatLng;
if(infoBulleOuverte) {
return;
}
$.getJSON(url, function(data) {
$.each(marqueurs, function(index, marqueur) {
179,28 → 186,12
stations = data;
afficherTitreCarte();
/*if(premierChargement) {
var bounds = new google.maps.LatLngBounds();
}*/
$.each(stations.points, function (index, station) {
/*if(premierChargement) {
var maLatLng = null;
maLatLng = new google.maps.LatLng(station['lat'], station['lng']);
bounds.extend(maLatLng);
}*/
$.each(stations.points, function (index, station) {
if(station != null) {
marqueurs.push(creerMarqueur(station));
}
});
/*if(premierChargement) {
map.fitBounds(bounds);
premierChargement = false;
}*/
rafraichirCarte();
});
}
 
220,7 → 211,7
return marqueur;
}
 
function rafraichirCarteSauv() {
function programmerRafraichissementCarteSauv() {
var points = [];
var bounds = new google.maps.LatLngBounds();
295,13 → 286,12
}
}
 
function surClickMarqueur() {
function surClickMarqueur(event) {
pointClique = this;
infoBulle.open(map, this);
//centrerInfoBulle();
actualiserPagineur();
afficherInfoBulle();
chargerObs(0, 0);
programmerRafraichissementCarte();
}
 
function surClickGroupe() {
352,7 → 342,7
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
 
var infoBulleOuverte = false;
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
360,7 → 350,8
}
 
function surFermetureInfoBulle() {
//deplacerCarteSurPointClique();
infoBulleOuverte = false;
programmerRafraichissementCarte();
}
 
function centrerInfoBulle() {
376,6 → 367,7
var largeur = definirLargeurInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
infoBulle.setContent(obsHtml);
infoBulleOuverte = true;
}
 
function definirLargeurInfoBulle() {
601,12 → 593,12
'<\/div>';
return tpl;
}
}).live('click', function(e) {
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
});
}).live('click', function(e) {
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
});
}
 
function ajouterFomulaireContact(element) {
821,7 → 813,6
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirCarte();
});
}
};