Subversion Repositories eFlore/Applications.cel

Rev

Rev 1003 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1003 Rev 1004
Line 32... Line 32...
32
 
32
 
33
	  Quatres cadrans sont considérés par le quad tree
33
	  Quatres cadrans sont considérés par le quad tree
34
	  * = centre de la fenetre
34
	  * = centre de la fenetre
35
	 */
35
	 */
36
	public static function creerGroupesQuadtree(&$markers, $neLat, $neLng, $swLat, $swLng, $zoom = 3) {
-
 
37
 
36
	public static function creerGroupesQuadtree(&$markers, $neLat, $neLng, $swLat, $swLng, $zoom = 3) {
38
		if(count($markers) > self::$seuilClusterisation) {
-
 
39
 
37
		if (count($markers) > self::$seuilClusterisation) {
40
			self::calculerProfondeurMax($zoom);
38
			self::calculerProfondeurMax($zoom);
Line 41... Line 39...
41
			self::calculerPasCorrectionCentre($zoom);
39
			self::calculerPasCorrectionCentre($zoom);
42
 
40
 
43
			$noeudRacine = array('nbrePoints' => count($markers), 'points' => $markers);
-
 
44
			self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);
41
			$noeudRacine = array('nbrePoints' => count($markers), 'points' => $markers);
-
 
42
			self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);
45
 
43
		} else {
46
		} else {
44
 
47
			foreach($markers as $marker) {
45
			foreach($markers as $marker) {
48
				$points = array($marker);
46
				$points = array($marker);
49
				$noeudSimple = array('points' => $points, 'nbrePoints' => 1);
47
				$noeudSimple = array('points' => $points, 'nbrePoints' => 1);
Line 140... Line 138...
140
		}
138
		}
141
		return $cadran;
139
		return $cadran;
142
	}
140
	}
Line 143... Line 141...
143
 
141
 
144
	private static function ajouterFils(&$noeud, $cadran, &$point) {
142
	private static function ajouterFils(&$noeud, $cadran, &$point) {
-
 
143
		$fils = array('points' => array(), 'nbrePoints' => 0, 'latMoyenne' => 0, 'lngMoyenne' => 0);
-
 
144
		if (isset($noeud[$cadran])) {
-
 
145
			$fils = $noeud[$cadran];
-
 
146
		}
145
		$fils = array('points' => array(), 'nbrePoints' => 1, 'latMoyenne' => 0, 'lngMoyenne' => 0);
147
 
146
		$fils['points'][] = $point;
148
		$fils['points'][] = $point;
147
		$fils['nbrePoints'] = isset($noeud[$cadran]['nbrePoints']) ? $noeud[$cadran]['nbrePoints']++ : 1;
149
		$fils['nbrePoints']++;
148
		$fils['latMoyenne'] += $point['lat'];
150
		$fils['latMoyenne'] += $point['lat'];
149
		$fils['lngMoyenne'] += $point['lng'];
151
		$fils['lngMoyenne'] += $point['lng'];
150
		$noeud[$cadran] = $fils;
152
		$noeud[$cadran] = $fils;