Subversion Repositories eFlore/Applications.cel

Compare Revisions

Regard whitespace Rev 1020 → Rev 1032

/trunk/jrest/services/CelWidgetMap.php
71,7 → 71,7
extract($this->parametres);
 
//TODO: changer ceci pour une adresse indiquée dans un fichier de config
$img = imagecreatefrompng("/home/jpm/web/serveur/commun/icones/carto/groupe/g$type.png");
$img = imagecreatefrompng("/home/aurelien/web/cel_GWT2/widget/documents/icones/carto/groupe/g$type.png");
 
$noir = imagecolorallocate($img, 0, 0, 0);
$texte = (String) $nbre;
/trunk/jrest/lib/CartoGroupage.php
1,7 → 1,7
<?php
class CartoGroupage {
 
private static $seuilClusterisation = 100;
private static $seuilClusterisation = 200;
private static $zoomDefaut = 3;
private static $zoomMaxClustering = 12;
private static $pasZoomDefaut = 1;
35,13 → 35,14
*/
public static function creerGroupesQuadtree(&$markers, $neLat, $neLng, $swLat, $swLng, $zoom = 3) {
if (count($markers) > self::$seuilClusterisation) {
self::calculerProfondeurMax($zoom);
self::calculerPasCorrectionCentre($zoom);
 
$noeudRacine = array('nbrePoints' => count($markers), 'points' => $markers);
self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);
} else {
 
foreach($markers as $marker) {
$points = array($marker);
$noeudSimple = array('points' => $points, 'nbrePoints' => 1);
74,8 → 75,7
 
private function calculerProfondeurMax($zoom) {
if($zoom > self::$zoomDefaut) {
//self::$profondeurMax = round(($zoom - self::$zoomDefaut) * self::calculerCoefficientProfondeurMax() + self::$profondeurMin,0);
self::$profondeurMax = $zoom-1;
self::$profondeurMax = round(($zoom - self::$zoomDefaut) * self::calculerCoefficientProfondeurMax() + self::$profondeurMin,0);
} else {
self::$profondeurMax = 1;
}
95,14 → 95,14
* @param int $profondeur profondeur courante de l'arbre
*/
private static function attribuerAuCadran(&$noeud, $neLat, $neLng, $swLat, $swLng, $profondeur = 0) {
$latCentre = round((($neLat+$swLat)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
$lngCentre = round((($neLng+$swLng)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
 
foreach ($noeud['points'] as &$point) {
self::$nbElements['observations']++;
if (isset($point['type_emplacement'])) {
self::$nbElements[$point['type_emplacement']]++;
}
$emplacement = isset($point['type_emplacement']) ? $point['type_emplacement'] : self::obtenirTypeEmplacementParId(&$point);
self::$nbElements[$emplacement]++;
unset($point['type_emplacement']);
$cadran = self::obtenirCadranPourPoint($latCentre, $lngCentre, $point);
self::ajouterFils($noeud,$cadran,$point);
111,10 → 111,10
$profondeur++;
 
if ($profondeur <= self::$profondeurMax) {
(isset($noeud['A'])) ? self::attribuerAuCadran($noeud['A'], $neLat, $lngCentre , $latCentre, $swLng, $profondeur) : '';
(isset($noeud['B'])) ? self::attribuerAuCadran($noeud['B'], $neLat, $neLng, $latCentre, $lngCentre, $profondeur) : '';
(isset($noeud['C'])) ? self::attribuerAuCadran($noeud['C'], $latCentre, $neLng, $swLat, $lngCentre, $profondeur) : '';
(isset($noeud['D'])) ? self::attribuerAuCadran($noeud['D'], $latCentre, $lngCentre, $swLat, $swLng, $profondeur) : '';
(isset($noeud['A']) && $noeud['A'] != null) ? self::attribuerAuCadran($noeud['A'], $neLat, $lngCentre , $latCentre, $swLng, $profondeur) : '';
(isset($noeud['B']) && $noeud['B'] != null) ? self::attribuerAuCadran($noeud['B'], $neLat, $neLng, $latCentre, $lngCentre, $profondeur) : '';
(isset($noeud['C']) && $noeud['C'] != null) ? self::attribuerAuCadran($noeud['C'], $latCentre, $neLng, $swLat, $lngCentre, $profondeur) : '';
(isset($noeud['D']) && $noeud['D'] != null) ? self::attribuerAuCadran($noeud['D'], $latCentre, $lngCentre, $swLat, $swLng, $profondeur) : '';
}
 
if(self::estUnParentFeuilles($noeud)) {
122,6 → 122,19
}
}
 
private static function obtenirTypeEmplacementParId($point) {
$tableau_point_id = explode(':',$point['id'],2);
switch($tableau_point_id[0]) {
case 'STATION':
$type_emplacement = 'stations';
break;
case 'COMMUNE':
$type_emplacement = 'communes';
break;
}
return $type_emplacement;
}
private function obtenirCadranPourPoint($latCentre,$lngCentre, &$point) {
if ($point['lng'] < $lngCentre) {
if ($point['lat'] > $latCentre) {
140,16 → 153,13
}
 
private static function ajouterFils(&$noeud, $cadran, &$point) {
$fils = array('points' => array(), 'nbrePoints' => 0, 'latMoyenne' => 0, 'lngMoyenne' => 0);
if (isset($noeud[$cadran])) {
$fils = $noeud[$cadran];
if(!isset($noeud[$cadran])) {
$noeud[$cadran] = array('points' => array(),'nbrePoints' => 0, 'latMoyenne' => 0, 'lngMoyenne' => 0);
}
 
$fils['points'][] = $point;
$fils['nbrePoints']++;
$fils['latMoyenne'] += $point['lat'];
$fils['lngMoyenne'] += $point['lng'];
$noeud[$cadran] = $fils;
$noeud[$cadran]['points'][] = $point;
$noeud[$cadran]['nbrePoints']++;
$noeud[$cadran]['latMoyenne'] += $point['lat'];
$noeud[$cadran]['lngMoyenne'] += $point['lng'];
}
 
private static function ajouterGroupeOuPoint(&$noeud) {
173,7 → 183,11
}
 
private static function estUneFeuille(&$noeud) {
return $noeud == null || (!isset($noeud['A']) && !isset($noeud['B']) && !isset($noeud['C']) && !isset($noeud['D']));
return $noeud == null ||
(!isset($noeud['A']) || $noeud['A'] == null) &&
(!isset($noeud['B']) || $noeud['B'] == null) &&
(!isset($noeud['C']) || $noeud['C'] == null) &&
(!isset($noeud['D']) || $noeud['D'] == null);
}
}
?>