Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1172 Rev 1339
Line 159... Line 159...
159
		return $coord_nulles;
159
		return $coord_nulles;
160
	}
160
	}
Line 161... Line 161...
161
	
161
	
Line 162... Line 162...
162
	private static function coordonneesSontNulles(&$point) {
162
	private static function coordonneesSontNulles(&$point) {
163
		
163
		
164
		$coord_nulles = ($point['coord_x'] == '000null' || 
164
		$coord_nulles = ($point['latitude'] == '000null' || 
165
				$point['coord_x'] == '' ||
165
				$point['latitude'] == '' ||
166
				$point['coord_y'] == '000null' ||
166
				$point['longitude'] == '000null' ||
167
				$point['coord_y'] == '');
167
				$point['longitude'] == '');
Line 168... Line 168...
168
		return $coord_nulles;
168
		return $coord_nulles;
169
	}
169
	}
Line 176... Line 176...
176
	private static function formaterNomStation(&$point) {
176
	private static function formaterNomStation(&$point) {
177
		$station = '';
177
		$station = '';
178
		if($point['station'] != '' && $point['station'] != '000null') {
178
		if($point['station'] != '' && $point['station'] != '000null') {
179
			$station = $point['station'];
179
			$station = $point['station'];
180
		} else {
180
		} else {
181
			$station = $point['location'].(($point['id_location'] != '' && $point['id_location'] != '000null') ? '('.$point['id_location'].')' : '');
181
			$station = $point['zone_geo'].(($point['id_zone_geo'] != '' && $point['id_zone_geo'] != '000null') ? ' ('.self::formaterNomZoneGeo($point['id_zone_geo']).')' : '');
182
		}
182
		}
Line 183... Line 183...
183
		
183
		
184
		return $station;
184
		return $station;
Line -... Line 185...
-
 
185
	}
-
 
186
	
-
 
187
	private static function formaterNomZoneGeo($zone_geo) {
-
 
188
		$zone_geo = str_replace('INSEE-C:', '', $zone_geo);
-
 
189
		$zone_geo = strlen($zone_geo) >= 2 ? substr($zone_geo, 0, 2) : $zone_geo;
-
 
190
		return $zone_geo;
185
	}
191
	}
Line 186... Line 192...
186
	
192
	
187
	private static function formaterPointPourAjout(&$point) {
193
	private static function formaterPointPourAjout(&$point) {
188
		
194
		
Line 189... Line 195...
189
		if(isset($point['type_emplacement'])) {
195
		if(isset($point['type_emplacement'])) {
190
			return $point['type_emplacement'];
196
			return $point['type_emplacement'];
191
		}
197
		}
192
		
198
		
-
 
199
		if(self::coordonneesSontNulles($point) || self::estSensible($point)) {
193
		if(self::coordonneesSontNulles($point) || self::estSensible($point)) {
200
			$point_allege = array();
194
			$point_allege = array();
201
			$point_allege['id'] = self::MARQUEUR_COMMUNE.':'.$point['wgs84_latitude'].'|'.$point['wgs84_longitude'];
Line 195... Line 202...
195
			$point_allege['id'] = self::MARQUEUR_COMMUNE.':'.$point['wgs84_latitude'].'|'.$point['wgs84_longitude'];
202
			$point_allege['type_emplacement'] = 'communes';
196
			$point_allege['type_emplacement'] = 'communes';
203
			$point_allege['nom'] = self::formaterNomStation($point);
197
			$point_allege['lat'] = (float)$point['wgs84_latitude'];
204
			$point_allege['lat'] = (float)$point['wgs84_latitude'];
198
			$point_allege['lng'] = (float)$point['wgs84_longitude'];
205
			$point_allege['lng'] = (float)$point['wgs84_longitude'];
199
			
206
			
200
			$point = $point_allege;
207
			$point = $point_allege;
201
		} else {
208
		} else {
202
			$point_allege = array();
209
			$point_allege = array();
Line 203... Line 210...
203
			$point_allege['id'] = self::MARQUEUR_STATION.':'.$point['coord_x'].'|'.$point['coord_y'];
210
			$point_allege['id'] = self::MARQUEUR_STATION.':'.$point['latitude'].'|'.$point['longitude'];
204
			$point_allege['type_emplacement'] = 'stations';
211
			$point_allege['type_emplacement'] = 'stations';
Line 205... Line 212...
205
			$point_allege['nom'] = self::formaterNomStation($point);
212
			$point_allege['nom'] = self::formaterNomStation($point);