Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1038 → Rev 1039

/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/service:cel:CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var groupeImageUrlTpl = 'http://www.tela-botanica.org/service:cel:CelWidgetMap/icone-groupe?type={type}&nbre={nbre}'
var pointsOrigine = null;
var boundsOrigine = null;
var markerClusterer = null;
72,15 → 72,18
 
function afficherTitreCarte() {
if (stations != null && taxonsCarte.length > 0) {
var obsNbre = stations.stats.observations.formaterNombre();
var plteNbre = taxonsCarte.length.formaterNombre();
var communeNbre = stations.stats.communes.formaterNombre();
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 titre = obsNbre+' observation';
var titre = obsNbreFormate+' observation';
titre += (obsNbre > 1) ? 's' : '' ;
if (nt == '*') {
titre += ' de '+plteNbre+' plante';
titre += ' de '+plteNbreFormate+' plante';
titre += (plteNbre > 1) ? 's' : '' ;
} else {
if (taxonsCarte[0]) {
89,7 → 92,7
}
}
titre += ' sur '+communeNbre+' commune';
titre += ' sur '+communeNbreFormate+' commune';
titre += (communeNbre > 1) ? 's' : '' ;
$('#carte-titre-infos').text(titre);
135,11 → 138,12
if (urlsLimitesCommunales != null) {
for (urlId in urlsLimitesCommunales) {
var url = urlsLimitesCommunales[urlId];
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: true});
ctaLayer = new google.maps.KmlLayer(url, {preserveViewport: false});
ctaLayer.setMap(map);
}
}
}
 
var listener = null;
var timer = null;
function attribuerListenerCarte() {
159,16 → 163,12
}
timer = window.setTimeout(function() {
var zoom = map.getZoom();
// 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);
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);
}
 
var premierChargement = true;
var marqueurs = new Array();
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
var url = stationsUrl+
211,7 → 211,8
$.each(stations.points, function (index, station) {
if(station != null) {
marqueurs.push(creerMarqueur(station));
var nouveauMarqueur = creerMarqueur(station);
marqueurs.push(nouveauMarqueur);
}
});
}
240,6 → 241,12
return marqueur;
}
 
function rendrePointsVisibles(bounds) {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
map.panToBounds(bounds);
}
 
function programmerRafraichissementCarteSauv() {
var points = [];
316,7 → 323,11
}
 
function surClickMarqueur(event) {
 
if(infoBulleOuverte) {
infoBulle.close();
}
pointClique = this;
infoBulle.open(map, this);
actualiserPagineur();
467,9 → 478,7
surClicPagePagination(0, null);
}
if (pagineur.limite < total) {
afficherPagination();
}
afficherPagination();
actualiserPagineur();
}
 
/trunk/jrest/services/CelWidgetMap.php
188,12 → 188,45
$this->construireWhereTag();
 
$resultats_emplacements = $this->executerRequete($requete);
$emplacements = $this->traiterEmplacements($resultats_emplacements);
$emplacements = $this->traiterEmplacements($resultats_emplacements, $this->compterObservations($params));
 
return $emplacements;
}
 
private function traiterEmplacements(&$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) {
$zoom = (int) array_key_exists('zoom', $this->parametres) ? $this->parametres['zoom'] : 11;
$distance = (int) array_key_exists('distance', $this->parametres) ? $this->parametres['distance'] : 20;
 
213,7 → 246,7
 
$marqueurs['stats']['stations'] = $nb_elements['stations'];
$marqueurs['stats']['communes'] = $nb_elements['communes'];
$marqueurs['stats']['observations'] = $nb_elements['observations'];
$marqueurs['stats']['observations'] = (int)$nb_total_observation;
} else {
$marqueurs['points'] = $emplacements;
}
369,8 → 402,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;