1,4 → 1,20 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe de groupage des obs par quadtree pour la carto. |
* |
* @internal Mininum PHP version : 5.2 |
* @category CEL |
* @package Services |
* @subpackage Bibliothèques |
* @version 0.1 |
* @author Mathias CHOUET <mathias@tela-botanica.org> |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Aurelien PERONNET <aurelien@tela-botanica.org> |
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt> |
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt> |
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org> |
*/ |
class CartoGroupage { |
const MARQUEUR_GROUPE = 'GROUPE'; |
const MARQUEUR_COMMUNE = 'COMMUNE'; |
36,16 → 52,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) { |
if(!self::estUnPointAExclure($marker)) { |
foreach ($markers as &$marker) { |
if (!self::estUnPointAExclure($marker)) { |
$emplacement = self::formaterPointPourAjout($marker); |
self::mettreAJourBornes($marker); |
$points = array($marker); |
60,10 → 74,9 |
} |
|
private function calculerCoefficientReductionPas() { |
if(self::$coefficientReductionPas == null) { |
if (self::$coefficientReductionPas == null) { |
self::$coefficientReductionPas = (self::$pasZoomMaxClustering - self::$pasZoomDefaut)/(self::$zoomMaxClustering - self::$zoomDefaut); |
} |
|
return self::$coefficientReductionPas; |
} |
|
72,15 → 85,14 |
} |
|
private function calculerCoefficientProfondeurMax() { |
if(self::$coefficientProfondeurMax == null) { |
if (self::$coefficientProfondeurMax == null) { |
self::$coefficientProfondeurMax = (self::$profondeurMax - self::$profondeurMin)/(self::$zoomMaxClustering - self::$zoomDefaut); |
} |
|
return self::$coefficientProfondeurMax; |
} |
|
private function calculerProfondeurMax($zoom) { |
if($zoom > self::$zoomDefaut) { |
if ($zoom > self::$zoomDefaut) { |
self::$profondeurMax = round(($zoom - self::$zoomDefaut) * self::calculerCoefficientProfondeurMax() + self::$profondeurMin,0); |
} else { |
self::$profondeurMax = 1; |
158,11 → 170,11 |
|
private static function coordonneesSontNulles(&$point) { |
$coord_nulles = ($point['latitude'] == '000null' || |
$point['latitude'] == 0 || |
$point['latitude'] == '' || |
$point['longitude'] == '000null' || |
$point['longitude'] == 0 || |
$point['longitude'] == ''); |
$point['latitude'] == 0 || |
$point['latitude'] == '' || |
$point['longitude'] == '000null' || |
$point['longitude'] == 0 || |
$point['longitude'] == ''); |
return $coord_nulles; |
} |
|
173,7 → 185,7 |
|
private static function formaterNomStation(&$point, $type_emplacement) { |
$station = ''; |
if($type_emplacement == 'stations' && $point['station'] != '' && $point['station'] != '000null') { |
if ($type_emplacement == 'stations' && $point['station'] != '' && $point['station'] != '000null') { |
$station = $point['station']; |
} else { |
$id_zone_geo = $point['ce_zone_geo']; |
190,11 → 202,11 |
} |
|
private static function formaterPointPourAjout(&$point) { |
if(isset($point['type_emplacement'])) { |
if (isset($point['type_emplacement'])) { |
return $point['type_emplacement']; |
} |
|
if(self::coordonneesSontNulles($point) || self::estSensible($point)) { |
if (self::coordonneesSontNulles($point) || self::estSensible($point)) { |
$point_allege = array(); |
$point_allege['id'] = self::MARQUEUR_COMMUNE.':'.$point['wgs84_latitude'].'|'.$point['wgs84_longitude']; |
$point_allege['type_emplacement'] = 'communes'; |
215,7 → 227,6 |
|
$point = $point_allege; |
} |
|
return $point['type_emplacement']; |
} |
|
259,7 → 270,6 |
return $groupe; |
} |
|
|
private static function estUnParentFeuilles(&$noeud) { |
return self::estUneFeuille($noeud['A']) && |
self::estUneFeuille($noeud['B']) && |
274,5 → 284,4 |
(!isset($noeud['C']) || $noeud['C'] == null) && |
(!isset($noeud['D']) || $noeud['D'] == null); |
} |
} |
?> |
} |