Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1483 Rev 1585
Line 1... Line 1...
1
<?php
1
<?php
2
class CartoGroupage {
2
class CartoGroupage {
3
 
-
 
4
	const MARQUEUR_GROUPE = 'GROUPE';
3
	const MARQUEUR_GROUPE = 'GROUPE';
5
	const MARQUEUR_COMMUNE = 'COMMUNE';
4
	const MARQUEUR_COMMUNE = 'COMMUNE';
6
	const MARQUEUR_STATION = 'STATION';
5
	const MARQUEUR_STATION = 'STATION';
Line 7... Line 6...
7
	
6
 
Line 45... Line 44...
45
			self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);	
44
			self::attribuerAuCadran($noeudRacine, $neLat, $neLng, $swLat, $swLng);
Line 46... Line 45...
46
			
45
 
47
		} else {
46
		} else {
48
			foreach($markers as &$marker) {	
47
			foreach($markers as &$marker) {
49
				if(!self::estUnPointAExclure($marker)) {
48
				if(!self::estUnPointAExclure($marker)) {
50
					$emplacement = self::formaterPointPourAjout(&$marker);
49
					$emplacement = self::formaterPointPourAjout($marker);
51
					self::mettreAJourBornes(&$marker);
50
					self::mettreAJourBornes($marker);
52
					$points = array($marker);
51
					$points = array($marker);
53
					$noeudSimple = array('points' => $points, 'nbrePoints' => 1);
52
					$noeudSimple = array('points' => $points, 'nbrePoints' => 1);
54
					self::$nbElements[$emplacement]++;
53
					self::$nbElements[$emplacement]++;
55
					self::$listeNoeudsSelectionnes[] = self::ajouterGroupeOuPoint($noeudSimple);
54
					self::$listeNoeudsSelectionnes[] = self::ajouterGroupeOuPoint($noeudSimple);
Line 91... Line 90...
91
	public static function getNbElements() {
90
	public static function getNbElements() {
92
		return self::$nbElements;
91
		return self::$nbElements;
93
	}
92
	}
Line 94... Line 93...
94
	
93
 
95
	public static function mettreAJourBornes(&$point) {
-
 
96
		
94
	public static function mettreAJourBornes(&$point) {
97
		if(!is_numeric($point['lat']) || abs($point['lat']) > 90) return;
95
		if (!is_numeric($point['lat']) || abs($point['lat']) > 90) return;
Line 98... Line 96...
98
		if(!is_numeric($point['lng']) || abs($point['lng']) > 180) return;
96
		if (!is_numeric($point['lng']) || abs($point['lng']) > 180) return;
99
		
97
 
Line 115... Line 113...
115
	 * @param float $swLat Latitude du coin sud ouest de la fenetre 
113
	 * @param float $swLat Latitude du coin sud ouest de la fenetre
116
	 * @param float $swLng Longitude du coin sud ouest de la fenetre 
114
	 * @param float $swLng Longitude du coin sud ouest de la fenetre
117
	 * @param int $profondeur profondeur courante de l'arbre
115
	 * @param int $profondeur profondeur courante de l'arbre
118
	 */
116
	 */
119
	private static function attribuerAuCadran(&$noeud, $neLat, $neLng, $swLat, $swLng, $profondeur = 0) {
117
	private static function attribuerAuCadran(&$noeud, $neLat, $neLng, $swLat, $swLng, $profondeur = 0) {
120
			
-
 
121
		$latCentre = round((($neLat+$swLat)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
118
		$latCentre = round((($neLat+$swLat)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
122
		$lngCentre = round((($neLng+$swLng)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
119
		$lngCentre = round((($neLng+$swLng)/2)/self::$pasCorrectionCentre,0)*self::$pasCorrectionCentre;
Line 123... Line 120...
123
						
120
 
124
		foreach ($noeud['points'] as &$point) {			
121
		foreach ($noeud['points'] as &$point) {
125
			if(!self::estUnPointAExclure($point)) {
122
			if(!self::estUnPointAExclure($point)) {
126
				$emplacement = self::formaterPointPourAjout(&$point);
123
				$emplacement = self::formaterPointPourAjout($point);
127
				self::mettreAJourBornes(&$point);
124
				self::mettreAJourBornes($point);
128
				$cadran = self::obtenirCadranPourPoint($latCentre, $lngCentre, $point);
125
				$cadran = self::obtenirCadranPourPoint($latCentre, $lngCentre, $point);
129
				self::ajouterFils($noeud,$cadran,$point);
126
				self::ajouterFils($noeud,$cadran,$point);
130
				self::$nbElements[$emplacement]++;
127
				self::$nbElements[$emplacement]++;
131
			}
128
			}
Line 158... Line 155...
158
		$point['wgs84_longitude'] == '');
155
		$point['wgs84_longitude'] == '');
159
		return $coord_nulles;
156
		return $coord_nulles;
160
	}
157
	}
Line 161... Line 158...
161
	
158
 
162
	private static function coordonneesSontNulles(&$point) {
-
 
163
		
159
	private static function coordonneesSontNulles(&$point) {
164
		$coord_nulles = ($point['latitude'] == '000null' ||
160
		$coord_nulles = ($point['latitude'] == '000null' ||
165
				$point['latitude'] == 0 ||
161
				$point['latitude'] == 0 ||
166
				$point['latitude'] == '' ||
162
				$point['latitude'] == '' ||
167
				$point['longitude'] == '000null' ||
163
				$point['longitude'] == '000null' ||
Line 192... Line 188...
192
		$zone_geo = strlen($zone_geo) >= 2 ? substr($zone_geo, 0, 2) : $zone_geo;
188
		$zone_geo = strlen($zone_geo) >= 2 ? substr($zone_geo, 0, 2) : $zone_geo;
193
		return $zone_geo;
189
		return $zone_geo;
194
	}
190
	}
Line 195... Line 191...
195
	
191
 
196
	private static function formaterPointPourAjout(&$point) {
-
 
197
		
192
	private static function formaterPointPourAjout(&$point) {
198
		if(isset($point['type_emplacement'])) {
193
		if(isset($point['type_emplacement'])) {
199
			return $point['type_emplacement'];
194
			return $point['type_emplacement'];
Line 200... Line 195...
200
		}
195
		}