34,16 → 34,14 |
* = centre de la fenetre |
*/ |
public static function creerGroupesQuadtree(&$markers, $neLat, $neLng, $swLat, $swLng, $zoom = 3) { |
|
if(count($markers) > self::$seuilClusterisation) { |
|
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 { |
|
} else { |
foreach($markers as $marker) { |
$points = array($marker); |
$noeudSimple = array('points' => $points, 'nbrePoints' => 1); |
142,9 → 140,13 |
} |
|
private static function ajouterFils(&$noeud, $cadran, &$point) { |
$fils = array('points' => array(), 'nbrePoints' => 1, 'latMoyenne' => 0, 'lngMoyenne' => 0); |
$fils = array('points' => array(), 'nbrePoints' => 0, 'latMoyenne' => 0, 'lngMoyenne' => 0); |
if (isset($noeud[$cadran])) { |
$fils = $noeud[$cadran]; |
} |
|
$fils['points'][] = $point; |
$fils['nbrePoints'] = isset($noeud[$cadran]['nbrePoints']) ? $noeud[$cadran]['nbrePoints']++ : 1; |
$fils['nbrePoints']++; |
$fils['latMoyenne'] += $point['lat']; |
$fils['lngMoyenne'] += $point['lng']; |
$noeud[$cadran] = $fils; |