Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1039 → Rev 1038

/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://www.tela-botanica.org/service:cel:CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var groupeImageUrlTpl = 'http://localhost/service:cel:CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
72,18 → 72,15
 
function afficherTitreCarte() {
if (stations != null && taxonsCarte.length > 0) {
var obsNbre = stations.stats.observations;
var obsNbreFormate = stations.stats.observations.formaterNombre();
var plteNbre = taxonsCarte.length;
var plteNbreFormate = taxonsCarte.length.formaterNombre();
var communeNbre = stations.stats.communes;
var communeNbreFormate = stations.stats.communes.formaterNombre();
var obsNbre = stations.stats.observations.formaterNombre();
var plteNbre = taxonsCarte.length.formaterNombre();
var communeNbre = stations.stats.communes.formaterNombre();
var titre = obsNbreFormate+' observation';
var titre = obsNbre+' observation';
titre += (obsNbre > 1) ? 's' : '' ;
if (nt == '*') {
titre += ' de '+plteNbreFormate+' plante';
titre += ' de '+plteNbre+' plante';
titre += (plteNbre > 1) ? 's' : '' ;
} else {
if (taxonsCarte[0]) {
92,7 → 89,7
}
}
titre += ' sur '+communeNbreFormate+' commune';
titre += ' sur '+communeNbre+' commune';
titre += (communeNbre > 1) ? 's' : '' ;
$('#carte-titre-infos').text(titre);
138,12 → 135,11
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: false});
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: true});
ctaLayer.setMap(map);
}
}
}
 
var listener = null;
var timer = null;
function attribuerListenerCarte() {
163,12 → 159,16
}
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());
// ajout d'un facteur de correction pour charger légerement plus que nécessaire pour stabiliser les points
// à voir si c'est efficace
var facteurCorrection = 0.5;
var NELatLng = (map.getBounds().getNorthEast().lat()+facteurCorrection)+'|'+(map.getBounds().getNorthEast().lng()+facteurCorrection);
var SWLatLng = (map.getBounds().getSouthWest().lat()-facteurCorrection)+'|'+(map.getBounds().getSouthWest().lng()-facteurCorrection);
chargerMarqueurs(zoom, NELatLng, SWLatLng);
}, 400);
}
 
var premierChargement = true;
var marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
var url = stationsUrl+
211,8 → 211,7
$.each(stations.points, function (index, station) {
if(station != null) {
var nouveauMarqueur = creerMarqueur(station);
marqueurs.push(nouveauMarqueur);
marqueurs.push(creerMarqueur(station));
}
});
}
241,12 → 240,6
return marqueur;
}
 
function rendrePointsVisibles(bounds) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
map.panToBounds(bounds);
}
 
function programmerRafraichissementCarteSauv() {
var points = [];
323,11 → 316,7
}
 
function surClickMarqueur(event) {
 
if(infoBulleOuverte) {
infoBulle.close();
}
pointClique = this;
infoBulle.open(map, this);
actualiserPagineur();
478,7 → 467,9
surClicPagePagination(0, null);
}
afficherPagination();
if (pagineur.limite < total) {
afficherPagination();
}
actualiserPagineur();
}
 
/trunk/jrest/services/CelWidgetMap.php
188,45 → 188,12
$this->construireWhereTag();
 
$resultats_emplacements = $this->executerRequete($requete);
$emplacements = $this->traiterEmplacements($resultats_emplacements, $this->compterObservations($params));
$emplacements = $this->traiterEmplacements($resultats_emplacements);
 
return $emplacements;
}
 
private $nb_obs = 0;
 
private function compterObservations($params) {
$requete = 'SELECT COUNT(*) AS nb '.
'FROM cel_inventory AS i '.
' LEFT JOIN locations AS l '.
' ON (l.name = i.location AND l.code = i.id_location) '.
"WHERE transmission = '1' ".
" AND (".
"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : '').
" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ".
")".
" OR ".
" ( ".
"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' Or ' : '').
" mots_cles_texte LIKE '%sensible%' ".
")".
" ) ".
") ".
$this->construireWhereDept().
$this->construireWhereCommune().
$this->construireWhereUtilisateur().
$this->construireWhereNumTaxon().
$this->construireWhereNomTaxon().
$this->construireWhereDate().
$this->construireWhereCommentaire().
$this->construireWhereProjet().
$this->construireWhereTag();
 
$resultats_nb_obs = $this->executerRequete($requete);
return $resultats_nb_obs[0]['nb'];
}
 
private function traiterEmplacements(&$emplacements, $nb_total_observation) {
private function traiterEmplacements(&$emplacements) {
$zoom = (int) array_key_exists('zoom', $this->parametres) ? $this->parametres['zoom'] : 11;
$distance = (int) array_key_exists('distance', $this->parametres) ? $this->parametres['distance'] : 20;
 
246,7 → 213,7
 
$marqueurs['stats']['stations'] = $nb_elements['stations'];
$marqueurs['stats']['communes'] = $nb_elements['communes'];
$marqueurs['stats']['observations'] = (int)$nb_total_observation;
$marqueurs['stats']['observations'] = $nb_elements['observations'];
} else {
$marqueurs['points'] = $emplacements;
}
402,8 → 369,8
 
// Post-traitement
$observations = $this->traiterObservations($resultats, $total);
$observations = $this->ajouterImagesAuxObs($observations);
$observations = $this->ajouterAuteursAuxObs($observations);
//$observations = $this->ajouterImagesAuxObs($observations);
//$observations = $this->ajouterAuteursAuxObs($observations);
$observations = $this->supprimerIdDesObs($observations);
 
return $observations;