Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1032 → Rev 980

/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/jrest/CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var groupeImageUrlTpl = 'http://localhost/cel-jrest/CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
62,8 → 62,7
initialiserInfoBulle();
initialiserFormulaireContact();
chargerLimitesCommunales();
attribuerListenerCarte();
programmerRafraichissementCarte();
rafraichirCarte();
}
 
/*+--------------------------------------------------------------------------------------------------------+*/
141,25 → 140,22
}
var listener = null;
var timer = null;
function attribuerListenerCarte() {
function rafraichirCarte() {
listener = google.maps.event.addListener(map, 'bounds_changed', 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);
}, 300);
});
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() {
 
168,15 → 164,12
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) {
186,12 → 179,28
stations = data;
afficherTitreCarte();
/*if(premierChargement) {
var bounds = new google.maps.LatLngBounds();
}*/
$.each(stations.points, function (index, station) {
$.each(stations.points, function (index, station) {
/*if(premierChargement) {
var maLatLng = null;
maLatLng = new google.maps.LatLng(station['lat'], station['lng']);
bounds.extend(maLatLng);
}*/
if(station != null) {
marqueurs.push(creerMarqueur(station));
}
});
/*if(premierChargement) {
map.fitBounds(bounds);
premierChargement = false;
}*/
rafraichirCarte();
});
}
 
211,7 → 220,7
return marqueur;
}
 
function programmerRafraichissementCarteSauv() {
function rafraichirCarteSauv() {
var points = [];
var bounds = new google.maps.LatLngBounds();
286,12 → 295,13
}
}
 
function surClickMarqueur(event) {
function surClickMarqueur() {
pointClique = this;
infoBulle.open(map, this);
//centrerInfoBulle();
actualiserPagineur();
afficherInfoBulle();
programmerRafraichissementCarte();
chargerObs(0, 0);
}
 
function surClickGroupe() {
342,7 → 352,7
 
/*+--------------------------------------------------------------------------------------------------------+*/
// INFO BULLE
var infoBulleOuverte = false;
 
function initialiserInfoBulle() {
google.maps.event.addListener(infoBulle, 'domready', initialiserContenuInfoBulle);
google.maps.event.addListener(infoBulle, 'closeclick', surFermetureInfoBulle);
350,8 → 360,7
}
 
function surFermetureInfoBulle() {
infoBulleOuverte = false;
programmerRafraichissementCarte();
//deplacerCarteSurPointClique();
}
 
function centrerInfoBulle() {
367,7 → 376,6
var largeur = definirLargeurInfoBulle();
obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
infoBulle.setContent(obsHtml);
infoBulleOuverte = true;
}
 
function definirLargeurInfoBulle() {
593,12 → 601,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) {
813,6 → 821,7
stations = stationsFiltrees;
nt = ntAFiltrer;
$('#taxon-'+nt).addClass('taxon-actif');
rafraichirCarte();
});
}
};