Line 74... |
Line 74... |
74 |
return self::$coefficientProfondeurMax;
|
74 |
return self::$coefficientProfondeurMax;
|
75 |
}
|
75 |
}
|
Line 76... |
Line 76... |
76 |
|
76 |
|
77 |
private function calculerProfondeurMax($zoom) {
|
77 |
private function calculerProfondeurMax($zoom) {
|
78 |
if($zoom > self::$zoomDefaut) {
|
78 |
if($zoom > self::$zoomDefaut) {
|
- |
|
79 |
//self::$profondeurMax = round(($zoom - self::$zoomDefaut) * self::calculerCoefficientProfondeurMax() + self::$profondeurMin,0);
|
79 |
self::$profondeurMax = round(($zoom - self::$zoomDefaut) * self::calculerCoefficientProfondeurMax() + self::$profondeurMin,0);
|
80 |
self::$profondeurMax = $zoom-1;
|
80 |
} else {
|
81 |
} else {
|
81 |
self::$profondeurMax = 1;
|
82 |
self::$profondeurMax = 1;
|
82 |
}
|
83 |
}
|
Line 94... |
Line 95... |
94 |
* @param float $swLat Latitude du coin sud ouest de la fenetre
|
95 |
* @param float $swLat Latitude du coin sud ouest de la fenetre
|
95 |
* @param float $swLng Longitude du coin sud ouest de la fenetre
|
96 |
* @param float $swLng Longitude du coin sud ouest de la fenetre
|
96 |
* @param int $profondeur profondeur courante de l'arbre
|
97 |
* @param int $profondeur profondeur courante de l'arbre
|
97 |
*/
|
98 |
*/
|
98 |
private static function attribuerAuCadran(&$noeud, $neLat, $neLng, $swLat, $swLng, $profondeur = 0) {
|
99 |
private static function attribuerAuCadran(&$noeud, $neLat, $neLng, $swLat, $swLng, $profondeur = 0) {
|
99 |
|
- |
|
100 |
$latCentre = round((($neLat+$swLat)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
|
100 |
$latCentre = round((($neLat+$swLat)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
|
101 |
$lngCentre = round((($neLng+$swLng)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
|
101 |
$lngCentre = round((($neLng+$swLng)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
|
Line 102... |
Line 102... |
102 |
|
102 |
|
103 |
foreach ($noeud['points'] as &$point) {
|
103 |
foreach ($noeud['points'] as &$point) {
|
- |
|
104 |
self::$nbElements['observations']++;
|
104 |
self::$nbElements['observations']++;
|
105 |
if (isset($point['type_emplacement'])) {
|
- |
|
106 |
self::$nbElements[$point['type_emplacement']]++;
|
105 |
self::$nbElements[$point['type_emplacement']]++;
|
107 |
}
|
106 |
unset($point['type_emplacement']);
|
108 |
unset($point['type_emplacement']);
|
107 |
$cadran = self::obtenirCadranPourPoint($latCentre, $lngCentre, $point);
|
109 |
$cadran = self::obtenirCadranPourPoint($latCentre, $lngCentre, $point);
|
108 |
self::ajouterFils($noeud,$cadran,$point);
|
110 |
self::ajouterFils($noeud,$cadran,$point);
|
Line 109... |
Line 111... |
109 |
}
|
111 |
}
|
Line 110... |
Line 112... |
110 |
|
112 |
|
111 |
$profondeur++;
|
113 |
$profondeur++;
|
112 |
|
114 |
|
113 |
if($profondeur <= self::$profondeurMax) {
|
115 |
if ($profondeur <= self::$profondeurMax) {
|
114 |
($noeud['A'] != null) ? self::attribuerAuCadran($noeud['A'], $neLat, $lngCentre , $latCentre, $lngSw, $profondeur) : '';
|
116 |
(isset($noeud['A'])) ? self::attribuerAuCadran($noeud['A'], $neLat, $lngCentre , $latCentre, $swLng, $profondeur) : '';
|
115 |
($noeud['B'] != null) ? self::attribuerAuCadran($noeud['B'], $neLat, $neLng, $latCentre, $lngCentre, $profondeur) : '';
|
117 |
(isset($noeud['B'])) ? self::attribuerAuCadran($noeud['B'], $neLat, $neLng, $latCentre, $lngCentre, $profondeur) : '';
|
Line 116... |
Line 118... |
116 |
($noeud['C'] != null) ? self::attribuerAuCadran($noeud['C'], $latCentre, $neLng, $swLat, $lngCentre, $profondeur) : '';
|
118 |
(isset($noeud['C'])) ? self::attribuerAuCadran($noeud['C'], $latCentre, $neLng, $swLat, $lngCentre, $profondeur) : '';
|
117 |
($noeud['D'] != null) ? self::attribuerAuCadran($noeud['D'], $latCentre, $lngCentre, $swLat, $swLng, $profondeur) : '';
|
119 |
(isset($noeud['D'])) ? self::attribuerAuCadran($noeud['D'], $latCentre, $lngCentre, $swLat, $swLng, $profondeur) : '';
|
118 |
}
|
120 |
}
|
Line 138... |
Line 140... |
138 |
}
|
140 |
}
|
139 |
return $cadran;
|
141 |
return $cadran;
|
140 |
}
|
142 |
}
|
Line 141... |
Line 143... |
141 |
|
143 |
|
- |
|
144 |
private static function ajouterFils(&$noeud, $cadran, &$point) {
|
142 |
private static function ajouterFils(&$noeud, $cadran, &$point) {
|
145 |
$fils = array('points' => array(), 'nbrePoints' => 1, 'latMoyenne' => 0, 'lngMoyenne' => 0);
|
143 |
$noeud[$cadran]['points'][] = $point;
|
146 |
$fils['points'][] = $point;
|
144 |
$noeud[$cadran]['nbrePoints']++;
|
147 |
$fils['nbrePoints'] = isset($noeud[$cadran]['nbrePoints']) ? $noeud[$cadran]['nbrePoints']++ : 1;
|
145 |
$noeud[$cadran]['latMoyenne'] += $point['lat'];
|
148 |
$fils['latMoyenne'] += $point['lat'];
|
- |
|
149 |
$fils['lngMoyenne'] += $point['lng'];
|
146 |
$noeud[$cadran]['lngMoyenne'] += $point['lng'];
|
150 |
$noeud[$cadran] = $fils;
|
Line 147... |
Line 151... |
147 |
}
|
151 |
}
|
148 |
|
152 |
|
149 |
private static function ajouterGroupeOuPoint(&$noeud) {
|
153 |
private static function ajouterGroupeOuPoint(&$noeud) {
|
Line 165... |
Line 169... |
165 |
self::estUneFeuille($noeud['C']) &&
|
169 |
self::estUneFeuille($noeud['C']) &&
|
166 |
self::estUneFeuille($noeud['D']);
|
170 |
self::estUneFeuille($noeud['D']);
|
167 |
}
|
171 |
}
|
Line 168... |
Line 172... |
168 |
|
172 |
|
169 |
private static function estUneFeuille(&$noeud) {
|
173 |
private static function estUneFeuille(&$noeud) {
|
170 |
return $noeud == null || ($noeud['A'] == null && $noeud['B'] == null && $noeud['C'] == null && $noeud['D'] == null);
|
174 |
return $noeud == null || (!isset($noeud['A']) && !isset($noeud['B']) && !isset($noeud['C']) && !isset($noeud['D']));
|
171 |
}
|
175 |
}
|
172 |
}
|
176 |
}
|
173 |
?>
|
177 |
?>
|