Subversion Repositories eFlore/Applications.cel

Rev

Rev 2459 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2459 Rev 2460
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// declare(encoding='UTF-8');
-
 
3
/**
-
 
4
 * Classe de groupage des obs par quadtree pour la carto.
-
 
5
 *
-
 
6
 * @internal   Mininum PHP version : 5.2
-
 
7
 * @category   CEL
-
 
8
 * @package    Services
-
 
9
 * @subpackage Bibliothèques
-
 
10
 * @version    0.1
-
 
11
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
-
 
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
-
 
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
-
 
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
-
 
15
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
-
 
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
-
 
17
 */
2
class CartoGroupage {
18
class CartoGroupage {
3
	const MARQUEUR_GROUPE = 'GROUPE';
19
	const MARQUEUR_GROUPE = 'GROUPE';
4
	const MARQUEUR_COMMUNE = 'COMMUNE';
20
	const MARQUEUR_COMMUNE = 'COMMUNE';
5
	const MARQUEUR_STATION = 'STATION';
21
	const MARQUEUR_STATION = 'STATION';
Line 34... Line 50...
34
	  Quatres cadrans sont considérés par le quad tree
50
	  Quatres cadrans sont considérés par le quad tree
35
	  * = centre de la fenetre
51
	  * = centre de la fenetre
36
	 */
52
	 */
37
	public static function creerGroupesQuadtree(&$markers, $neLat, $neLng, $swLat, $swLng, $zoom = 3) {
53
	public static function creerGroupesQuadtree(&$markers, $neLat, $neLng, $swLat, $swLng, $zoom = 3) {
38
		if (count($markers) > self::$seuilClusterisation) {
54
		if (count($markers) > self::$seuilClusterisation) {
39
 
-
 
40
			self::calculerProfondeurMax($zoom);
55
			self::calculerProfondeurMax($zoom);
41
			self::calculerPasCorrectionCentre($zoom);
56
			self::calculerPasCorrectionCentre($zoom);
Line 42... Line 57...
42
 
57
 
43
			$noeudRacine = array('nbrePoints' => count($markers), 'points' => $markers);
58
			$noeudRacine = array('nbrePoints' => count($markers), 'points' => $markers);
44
			self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);
-
 
45
 
59
			self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);
46
		} else {
60
		} else {
47
			foreach($markers as &$marker) {
61
			foreach ($markers as &$marker) {
48
				if(!self::estUnPointAExclure($marker)) {
62
				if (!self::estUnPointAExclure($marker)) {
49
					$emplacement = self::formaterPointPourAjout($marker);
63
					$emplacement = self::formaterPointPourAjout($marker);
Line 61... Line 75...
61
 
75
 
62
	private function calculerCoefficientReductionPas() {
76
	private function calculerCoefficientReductionPas() {
63
		if(self::$coefficientReductionPas == null) {
77
		if (self::$coefficientReductionPas == null) {
64
			self::$coefficientReductionPas = (self::$pasZoomMaxClustering - self::$pasZoomDefaut)/(self::$zoomMaxClustering - self::$zoomDefaut);
78
			self::$coefficientReductionPas = (self::$pasZoomMaxClustering - self::$pasZoomDefaut)/(self::$zoomMaxClustering - self::$zoomDefaut);
65
		}
-
 
66
 
79
		}
67
		return self::$coefficientReductionPas;
80
		return self::$coefficientReductionPas;
Line 68... Line 81...
68
	}
81
	}
69
 
82
 
Line 73... Line 86...
73
 
86
 
74
	private function calculerCoefficientProfondeurMax() {
87
	private function calculerCoefficientProfondeurMax() {
75
		if(self::$coefficientProfondeurMax == null) {
88
		if (self::$coefficientProfondeurMax == null) {
76
			self::$coefficientProfondeurMax = (self::$profondeurMax - self::$profondeurMin)/(self::$zoomMaxClustering - self::$zoomDefaut);
89
			self::$coefficientProfondeurMax = (self::$profondeurMax - self::$profondeurMin)/(self::$zoomMaxClustering - self::$zoomDefaut);
77
		}
-
 
78
 
90
		}
79
		return self::$coefficientProfondeurMax;
91
		return self::$coefficientProfondeurMax;
Line 80... Line 92...
80
	}
92
	}
81
 
93
 
Line 213... Line 225...
213
			$point_allege['lng'] = (float)$point['longitude'];
225
			$point_allege['lng'] = (float)$point['longitude'];
214
			$point_allege['zonegeo'] = $point['ce_zone_geo'];
226
			$point_allege['zonegeo'] = $point['ce_zone_geo'];
Line 215... Line 227...
215
 
227
 
216
			$point = $point_allege;
228
			$point = $point_allege;
217
		}
-
 
218
 
229
		}
219
		return $point['type_emplacement'];
230
		return $point['type_emplacement'];
Line 220... Line 231...
220
	}
231
	}
221
 
232
 
Line 257... Line 268...
257
			$groupe = $noeud['points'][0];
268
			$groupe = $noeud['points'][0];
258
		}
269
		}
259
		return $groupe;
270
		return $groupe;
260
	}
271
	}
Line 261... Line -...
261
 
-
 
262
 
272
 
263
	private static function estUnParentFeuilles(&$noeud) {
273
	private static function estUnParentFeuilles(&$noeud) {
264
		return  self::estUneFeuille($noeud['A']) &&
274
		return  self::estUneFeuille($noeud['A']) &&
265
				self::estUneFeuille($noeud['B']) &&
275
				self::estUneFeuille($noeud['B']) &&
266
				self::estUneFeuille($noeud['C']) &&
276
				self::estUneFeuille($noeud['C']) &&
Line 273... Line 283...
273
		(!isset($noeud['B']) || $noeud['B'] == null) &&
283
		(!isset($noeud['B']) || $noeud['B'] == null) &&
274
		(!isset($noeud['C']) || $noeud['C'] == null) &&
284
		(!isset($noeud['C']) || $noeud['C'] == null) &&
275
		(!isset($noeud['D']) || $noeud['D'] == null);
285
		(!isset($noeud['D']) || $noeud['D'] == null);
276
	}
286
	}
277
}
287
}
278
?>
-
 
279
288