51,6 → 51,7 |
private function genererTuilage() { |
if (!$this->estTableCreee()) { |
$this->creerStructureTable(); |
print("Table créée"); |
} |
$niveauxZoom = range(Config::get('zoom_minimal'), Config::get('zoom_maximal'), 1); |
foreach ($niveauxZoom as $zoom) { |
58,14 → 59,16 |
$this->resolution = $this->resolutionInitiale / pow(2, $zoom); |
$coordonneesLng = $this->calculerCoordonneesLimitesTuiles($zoom, 'lng'); |
$coordonneesLat = $this->calculerCoordonneesLimitesTuiles($zoom, 'lat'); |
print("mailles calculées\n"); |
$this->ajouterMaillesDansBdd($zoom, $coordonneesLng, $coordonneesLat); |
} |
} |
|
private function estTableCreee() { |
print("test table"); |
$tables = $this->getBdd()->recupererTous("SHOW TABLES FROM ".Config::get('bdd_nom')); |
$table = Config::get('eflore_table_mailles'); |
for ($index = 0; $index < count($tables) && $tables[$index]['Tables_in_tb_eflore'] != $table; $index ++); |
for ($index = 0; $index < count($tables) && $tables[$index]['Tables_in_tb_eflore_test'] != $table; $index ++); |
return $index < count($tables); |
} |
|
113,14 → 116,35 |
$nomsChamps = Config::get('eflore_champs_table'); |
$this->getBdd()->requeter("DELETE FROM {$table} WHERE zoom=$zoom"); |
$insertions = array(); |
for ($index = 0; $index < count($coordonneesLng)-1; $index ++) { |
$insertions[] = "({$zoom},'lng',{$index},".$coordonneesLng[$index].",".$coordonneesLng[$index+1].")"; |
$j = 10000; |
if (count($coordonneesLng) > $j) { |
for ($i=0; $i < count($coordonneesLng); $i=$i+$j) { |
$insertions = array();print($i." ".$j." "); |
if ($i+$j > count($coordonneesLng)) { |
$k =count($coordonneesLng) - 1; |
} else { |
$k = $i+$j; |
} print_r($k."\n"); |
for ($index = $i; $index < $k; $index ++) { |
$insertions[] = "({$zoom},'lng',{$index},".$coordonneesLng[$index].",".$coordonneesLng[$index+1].")"; |
} |
for ($index = $i; $index < $k; $index ++) { |
$insertions[] = "({$zoom},'lat',{$index},".$coordonneesLat[$index].",".$coordonneesLat[$index+1].")"; |
} |
$requete = "INSERT INTO {$table}({$nomsChamps}) VALUES ".implode(',', $insertions); |
$this->getBdd()->requeter($requete); |
} |
} else { |
for ($index = 0; $index < count($coordonneesLng)-1; $index ++) { |
$insertions[] = "({$zoom},'lng',{$index},".$coordonneesLng[$index].",".$coordonneesLng[$index+1].")"; |
} |
for ($index = 0; $index < count($coordonneesLat)-1; $index ++) { |
$insertions[] = "({$zoom},'lat',{$index},".$coordonneesLat[$index].",".$coordonneesLat[$index+1].")"; |
} |
$requete = "INSERT INTO {$table}({$nomsChamps}) VALUES ".implode(',', $insertions); |
$this->getBdd()->requeter($requete); |
} |
for ($index = 0; $index < count($coordonneesLat)-1; $index ++) { |
$insertions[] = "({$zoom},'lat',{$index},".$coordonneesLat[$index].",".$coordonneesLat[$index+1].")"; |
} |
$requete = "INSERT INTO {$table}({$nomsChamps}) VALUES ".implode(',', $insertions); |
$this->getBdd()->requeter($requete); |
|
} |
|
private function getBdd() { |