Subversion Repositories eFlore/Applications.moissonnage

Compare Revisions

No changes between revisions

Ignore whitespace Rev 28 → Rev 29

/trunk/scripts/bibliotheque/Maille.php
New file
0,0 → 1,76
<?php
 
class Maille {
private $latitudeSud;
private $longitudeOuest;
private $latitudeNord;
private $longitudeEst;
private $indexLatitude;
private $indexLongitude;
private $points = array();
private $observations = array();
public function __construct($sud, $ouest, $nord, $est, $indexLat, $indexLng) {
$this->latitudeSud = $sud;
$this->longitudeOuest = $ouest;
$this->latitudeNord = $nord;
$this->longitudeEst = $est;
$this->indexLatitude = $indexLat;
$this->indexLongitude = $indexLng;
}
public function ajouterPoint($point) {
$this->points[] = $point;
$this->observations[] = $point['observations'];
}
public function getLatitudeNord() {
return $this->latitudeNord;
}
public function getLongitudeOuest() {
return $this->longitudeOuest;
}
public function getLatitudeSud() {
return $this->latitudeSud;
}
public function getLongitudeEst() {
return $this->longitudeEst;
}
public function getIndexLatitude() {
return $this->indexLatitude;
}
public function getIndexLongitude() {
return $this->indexLongitude;
}
public function getPoints() {
return $this->points;
}
public function getNombrePoints() {
return count($this->points);
}
public function getNombreObservations() {
return array_sum($this->observations);
}
public function getPoint($index = 0) {
return (!isset($this->points[$index])) ? NULL : $this->points[$index];
}
public function totalNonNul() {
return count($this->points) > 0;
}
}
 
?>
/trunk/scripts/bibliotheque/Maillage.php
New file
0,0 → 1,228
<?php
 
 
class Maillage {
private $bbox;
private $zoom;
private $indexLongitude;
private $indexLatitude;
private $mailles;
private $origine;
private $bdd = null;
public function __construct($bbox, $zoom) {
$this->bbox = $bbox;
$this->zoom = $zoom;
$this->indexLongitude = array();
$this->indexLatitude = array();
$this->mailles = array();
$this->origine = Config::get('origine');
}
public function __destruct() {
while (count($this->indexLatitude) > 0) {
array_pop($this->indexLatitude);
}
while (count($this->indexLongitude) > 0) {
array_pop($this->indexLongitude);
}
while (count($this->mailles) > 0) {
array_pop($this->mailles);
}
unset($this);
}
public function genererMaillesVides() {
$this->recupererIndexMaillesDansBbox();
foreach ($this->indexLatitude as $indexLat => $intervalleLat) {
$ligne = array();
foreach ($this->indexLongitude as $indexLng => $intervalleLng) {
$ligne[] = new Maille($intervalleLat[0], $intervalleLng[0], $intervalleLat[1],
$intervalleLng[1], $indexLat, $indexLng);
}
$this->mailles[] = $ligne;
}
}
private function recupererIndexMaillesDansBbox() {
$tableIndex = Config::get('table_index_mailles');
$requete =
"SELECT axe, position, debut, fin FROM {$tableIndex} WHERE zoom={$this->zoom} AND (".
"(axe='lat' AND debut<{$this->bbox['nord']} AND fin>{$this->bbox['sud']}) ".
"OR (axe='lng' AND debut<{$this->bbox['est']} AND fin>{$this->bbox['ouest']})".
") ORDER BY axe, position";
$indexMailles = $this->getBdd()->recupererTous($requete);
foreach ($indexMailles as $index) {
if ($index['axe'] == 'lng') {
$this->indexLongitude[$index['position']] = array($index['debut'], $index['fin']);
} else {
$this->indexLatitude[$index['position']] = array($index['debut'], $index['fin']);
}
}
}
private function getBdd() {
if (is_null($this->bdd)) {
$this->bdd = new Bdd();
}
return $this->bdd;
}
public function ajouterPoints($points) {
foreach ($points as $point) {
$longitude = $point['longitude'];
$latitude = $point['latitude'];
list($indexLongitude, $indexLatitude) = $this->rechercherIndexMaille($longitude, $latitude);
$this->mailles[$indexLatitude][$indexLongitude]->ajouterPoint($point);
}
}
private function rechercherIndexMaille($longitude, $latitude) {
$indexLatitude = 0;
$indexLongitude = 0;
while ($indexLatitude < count($this->indexLatitude) - 1
&& $this->mailles[$indexLatitude][0]->getLatitudeNord() < $latitude) {
$indexLatitude ++;
}
while ($indexLongitude < count($this->indexLongitude) - 1
&& $this->mailles[$indexLatitude][$indexLongitude]->getLongitudeEst() < $longitude) {
$indexLongitude ++;
}
return array($indexLongitude, $indexLatitude);
}
 
public function formaterPourInsertionBdd() {
$mailles_resume = array();
foreach ($this->mailles as $ligne) {
foreach ($ligne as $maille) {
if ($maille->getNombrePoints() > 0) {
$mailles_resume[] = array(
'zoom' => $this->zoom,
'sud' => $maille->getLatitudeSud(),
'ouest' => $maille->getLongitudeOuest(),
'nord' => $maille->getLatitudeNord(),
'est' => $maille->getLongitudeEst(),
'indexLat' => $maille->getIndexLatitude(),
'indexLng' => $maille->getIndexLongitude(),
'points' => $maille->getNombrePoints(),
'observations' => $maille->getNombreObservations()
);
}
}
}
return $mailles_resume;
}
private function formaterPourQuadtree() {
$mailles_resume = array();
foreach ($this->mailles as $ligne) {
foreach ($ligne as $maille) {
if ($maille->getNombrePoints() > 0) {
$mailles_resume[] = array(
'zoom' => $this->zoom,
'sud' => $maille->getLatitudeSud(),
'ouest' => $maille->getLongitudeOuest(),
'nord' => $maille->getLatitudeNord(),
'est' => $maille->getLongitudeEst(),
'indexLat' => $maille->getIndexLatitude(),
'indexLng' => $maille->getIndexLongitude(),
'points' => $maille->getPoints()
);
}
}
}
return $mailles_resume;
}
public function redecouperMailles() {
$mailles = $this->formaterPourQuadtree();
$this->viderMailles();
while (count($mailles)>0) {
$nouvellesMailles = $this->genererMaillesParQuadtree($mailles[count($mailles)-1]);
foreach ($nouvellesMailles as $maille) {
$this->ajouterMaille($maille);
}
array_pop($mailles);
}
$this->zoom += 1;
}
private function viderMailles() {
while (count($this->indexLatitude) > 0) {
array_pop($this->indexLatitude);
}
while (count($this->indexLongitude) > 0) {
array_pop($this->indexLongitude);
}
while (count($this->mailles) > 0) {
array_pop($this->mailles);
}
}
private function genererMaillesParQuadtree(& $maille) {
$ouest = $maille['ouest'];
$est = $maille['est'];
$sud = $maille['sud'];
$nord = $maille['nord'];
$indexLat = $maille['indexLat'];
$indexLng = $maille['indexLng'];
$milieuLongitude = $this->convertirFloatToString(($ouest + $est)/2);
$milieuLatitude = $this->calculerMilieuLatitudes($sud, $nord);
// sens des mailles : NordOuest, NordEst, SudOuest, SudEst
$mailles = array();
$mailles[] = new Maille($milieuLatitude, $ouest, $nord, $milieuLongitude, $indexLat*2, $indexLng*2);
$mailles[] = new Maille($milieuLatitude, $milieuLongitude, $nord, $est, $indexLat*2, $indexLng*2+1);
$mailles[] = new Maille($sud, $ouest, $milieuLatitude, $milieuLongitude, $indexLat*2+1, $indexLng*2);
$mailles[] = new Maille($sud, $milieuLongitude, $milieuLatitude, $est, $indexLat*2+1, $indexLng*2+1);
$this->deplacerPoints($maille, $mailles);
return $mailles;
}
private function calculerMilieuLatitudes($latitudeSud, $latitudeNord) {
$ySud = log(tan((90 + $latitudeSud) * M_PI / 360.0 )) / (M_PI / 180.0) * ($this->origine/180.0);
$yNord = log(tan((90 + $latitudeNord) * M_PI / 360.0 )) / (M_PI / 180.0) * ($this->origine/180.0);
$yMilieu = ($ySud+$yNord) / 2;
$latitude = ($yMilieu / $this->origine) * 180.0;
$latitude = 180 / M_PI * (2 * atan(exp($latitude * M_PI / 180.0)) - M_PI / 2.0);
return $this->convertirFloatToString($latitude);
}
private function deplacerPoints(& $maille, & $sousMailles) {
$nombrePoints = count($maille['points']);
for ($index = 0; $index < $nombrePoints; $index ++) {
$position = ($maille['points'][$index]['latitude']>=$sousMailles[0]->getLatitudeSud()) ? 0 : 2;
$position += ($maille['points'][$index]['longitude']<$sousMailles[$position]->getLongitudeEst()) ? 0 : 1;
$sousMailles[$position]->ajouterPoint($maille['points'][$index]);
}
}
private function ajouterMaille($maille) {
$indexLat = $maille->getIndexLatitude();
$indexLng = $maille->getIndexLongitude();
if (!isset($this->indexLongitude[$indexLng])) {
$this->indexLongitude[$indexLng] = array($maille->getLongitudeOuest(), $maille->getLongitudeEst());
$this->mailles[$indexLng] = array();
}
if (!isset($this->indexLongitude[$indexLat])) {
$this->indexLatitude[$indexLat] = array($maille->getLatitudeSud(), $maille->getLatitudeNord());
}
$this->mailles[$indexLng][$indexLat] = $maille;
}
private function convertirFloatToString($float) {
return str_replace(',', '.', strval($float));
}
}
 
?>
/trunk/scripts/cli.php
New file
0,0 → 1,37
<?php
// Encodage : UTF-8
// +-------------------------------------------------------------------------------------------------------------------+
/**
* Initialise le chargement et l'exécution des scripts
*
* Lancer ce fichier en ligne de commande avec :
* <code>/opt/lampp/bin/php cli.php mon_script -a test</code>
*
//Auteur original :
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @copyright Tela-Botanica 1999-2008
* @licence GPL v3 & CeCILL v2
* @version $Id$
*/
// +-------------------------------------------------------------------------------------------------------------------+
 
// Le fichier Framework.php du Framework de Tela Botanica doit être appelée avant tout autre chose dans l'application.
// Sinon, rien ne sera chargé.
// Chemin du fichier chargeant le framework requis
$framework = dirname(__FILE__).DIRECTORY_SEPARATOR.'framework.php';
if (!file_exists($framework)) {
$e = "Veuillez paramétrer l'emplacement et la version du Framework dans le fichier $framework";
trigger_error($e, E_USER_ERROR);
} else {
// Inclusion du Framework
require_once $framework;
 
// Ajout d'information concernant cette application
Framework::setCheminAppli(__FILE__);// Obligatoire
Framework::setInfoAppli(Config::get('info'));
 
// Initialisation et lancement du script appelé en ligne de commande
Cli::executer();
}
?>
/trunk/scripts/modules/tuilage/Tuilage.php
New file
0,0 → 1,139
<?php
 
/**
* Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/moissonnage/scripts/cli.php tuilage -a genererMaillage
*
* @author alex
*
*/
 
class Tuilage extends Script {
 
private $bdd = null;
private $resolution = 0;
private $resolutionInitiale = 0;
private $origine = 0;
private $longueurMaille;
 
public function executer() {
try {
$this->initialiserScript();
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'genererMaillage' :
$this->genererTuilage();
break;
default :
throw new Exception("Erreur : la commande '{$cmd}' n'existe pas!");
}
} catch(Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
private function initialiserScript() {
$fichierIni = $this->getScriptChemin().'tuilage.ini';
if (file_exists($fichierIni)) {
Config::charger($fichierIni);
} else {
$m = "Veuillez configurer le projet en créant le fichier '{$this->projetNom}.ini' ".
"dans le dossier du module de script du projet à partir du fichier '{$this->projetNom}.defaut.ini'.";
throw new Exception($m);
}
$this->longueurMaille = Config::get('taille_mailles_px');
$this->resolutionInitiale = 2 * M_PI * Config::get('rayon_terre') / 256;
$this->origine = 2 * M_PI * Config::get('rayon_terre') / 2.0;
}
private function genererTuilage() {
if (!$this->estTableCreee()) {
$this->creerStructureTable();
}
$niveauxZoom = range(Config::get('zoom_minimal'), Config::get('zoom_maximal'), 1);
foreach ($niveauxZoom as $zoom) {
print("Génération des mailles au niveau de zoom {$zoom}...\n");
$this->resolution = $this->resolutionInitiale / pow(2, $zoom);
$coordonneesLng = $this->calculerCoordonneesLimitesTuiles($zoom, 'lng');
$coordonneesLat = $this->calculerCoordonneesLimitesTuiles($zoom, 'lat');
$this->ajouterMaillesDansBdd($zoom, $coordonneesLng, $coordonneesLat);
}
}
private function estTableCreee() {
$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 ++);
return $index < count($tables);
}
private function creerStructureTable() {
$table = Config::get('eflore_table_mailles');
print("Table {$table} non trouvée dans la base de données, création de sa structure...\n");
$requete =
"CREATE TABLE {$table} (".
"zoom TINYINT UNSIGNED NOT NULL,".
"axe ENUM('lat','lng') NOT NULL,".
"position SMALLINT UNSIGNED NOT NULL,".
"debut DECIMAL(9,6) NOT NULL,".
"fin DECIMAL(9,6) NOT NULL,".
"PRIMARY KEY (zoom, axe, position)".
") ENGINE=MyISAM, CHARACTER SET utf8";
$this->getBdd()->requeter($requete);
$requete = "ALTER TABLE {$table} ADD INDEX (debut), ADD INDEX(fin)";
$this->getBdd()->requeter($requete);
}
private function calculerCoordonneesLimitesTuiles($zoom, $axe) {
$variableConfigLimite = $axe == 'lng' ? 'carte.limite_est' : 'carte.limite_nord';
$limiteCalcul = Config::get($variableConfigLimite);
$nombrePixels = pow(2, $zoom+8);
$tailleTableau = $nombrePixels / $this->longueurMaille;
$valeurs = array();
for ($index = 0; $index <= $tailleTableau; $index ++) {
$valeur = $this->convertirPixelEnLatLng($index * $this->longueurMaille, $axe);
$valeurs[] = $this->convertirFloatToString($valeur);
}
return $valeurs;
}
private function convertirPixelEnLatLng($pixel, $axe) {
$coord_metrique = $pixel * $this->resolution - $this->origine;
$coord_lnglat = ($coord_metrique / $this->origine) * 180.0;
if ($axe == 'lat') {
$coord_lnglat = 180 / M_PI * (2 * atan(exp($coord_lnglat * M_PI / 180.0)) - M_PI / 2.0);
}
return $coord_lnglat;
}
private function ajouterMaillesDansBdd($zoom, $coordonneesLng, $coordonneesLat) {
$table = Config::get('eflore_table_mailles');
$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].")";
}
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() {
if (is_null($this->bdd)) {
$this->bdd = new Bdd();
}
return $this->bdd;
}
private function convertirFloatToString($float) {
return str_replace(',', '.', strval($float));
}
}
 
?>
/trunk/scripts/modules/tuilage/tuilage.ini
New file
0,0 → 1,14
[carte]
carte.limite_ouest = -180
carte.limite_est = 180
carte.limite_sud = -85.051129
carte.limite_nord = 85.051129
 
rayon_terre = 6378137
zoom_minimal = 3
zoom_maximal = 13
taille_mailles_px = 32
 
[bdd]
eflore_table_mailles = 'mailles_index'
eflore_champs_table = 'zoom,axe,position,debut,fin'
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/scripts/modules/maillage_projet/maillage_projet.ini
New file
0,0 → 1,10
[database]
 
table_index_mailles = "mailles_index"
suffixe_table_interrogation = "_tapir"
sources_disponibles = "sophy,baznat"
champs_table_mailles = "code_maille,zoom,position_longitude,position_latitude,limite_ouest,limite_sud,limite_est,limite_nord,nombre_sites,nombre_observations"
 
origine = 20037508.342789244
zoom_minimal = 3
zoom_maximal = 13
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/scripts/modules/maillage_projet/sources/sophy.ini
New file
0,0 → 1,5
[champs]
 
tbl.champ_longitude = 'lieu_station_longitude'
tbl.champ_latitude = 'lieu_station_latitude'
tbl.champ_id = 'guid'
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/scripts/modules/maillage_projet/sources/baznat.ini
New file
0,0 → 1,5
[champs]
 
tbl.champ_longitude = 'longitude'
tbl.champ_latitude = 'latitude'
tbl.champ_id = 'guid'
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/scripts/modules/maillage_projet/MaillageProjet.php
New file
0,0 → 1,195
<?php
 
/**
* Exemple lancement:
* /opt/lampp/bin/php -d memory_limit=3500M ~/web/moissonnage/scripts/cli.php maillage_projet
* -a source=nom_source
*
* @author alex
*
*/
 
class MaillageProjet extends Script {
private $nomProjet = 'maillage_projet';
private $nomSource = '';
private $bdd = null;
private $tableRequetage = '';
private $mailles = array();
private $points = array();
public function executer() {
try {
$this->initialiserScript();
$cmd = $this->getParametre('a');
$parametre = explode('=', $cmd);
if (count($parametre) != 2 && $parametre[0] != 'source') {
throw new Exception("Parametre passé incorrect : attendu source=nom_de_la_source\n");
} else {
if (!$this->estSourceDisponible($parametre[1])) {
$sourcesDispo = Config::get('sources_disponibles');
$message =
"Erreur lors de l'éxécution du script : la soruce demandée n'est pas disponible.\n".
"Les sources dont le maillage est réalisable sont les suivantes : {$sourcesDispo}.\n";
throw new Exception($message);
} else {
$this->nomSource = $parametre[1];
$this->chargerConfigurationSource($parametre[1]);
$this->tableRequetage = $parametre[1].Config::get('suffixe_table_interrogation');
$this->genererMaillage();
}
}
} catch(Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
private function initialiserScript() {
$fichierIni = $this->getScriptChemin().'maillage_projet.ini';
if (file_exists($fichierIni)) {
Config::charger($fichierIni);
} else {
$m = "Veuillez configurer le projet en créant le fichier '{$this->nomProjet}.ini' ".
"dans le dossier du module de script du projet à partir du fichier '{$this->nomProjet}.defaut.ini'.";
throw new Exception($m);
}
}
private function estSourceDisponible($nomSource) {
$sourcesDispo = explode(',', Config::get('sources_disponibles'));
return (in_array($nomSource, $sourcesDispo));
}
private function chargerConfigurationSource($nomSource) {
$fichierIni = $this->getScriptChemin()."sources".DIRECTORY_SEPARATOR."{$nomSource}.ini";
if (file_exists($fichierIni)) {
Config::charger($fichierIni);
} else {
$m = "Veuillez configurer les champs specifiques à la source en créant le fichier ".
"'{$nomSource}.ini' dans le dossier sources de script du projet {$this->nomProjet}.";
throw new Exception($m);
}
}
private function genererMaillage() {
if (!$this->estTableCreee()) {
$this->creerStructureTable();
}
$zoomMinimal = Config::get('zoom_minimal');
$niveauxZoom = range($zoomMinimal, Config::get('zoom_maximal'), 1);
foreach ($niveauxZoom as $zoom) {
print("Génération des mailles au niveau de zoom {$zoom}...\n");
if ($zoom == $zoomMinimal) {
$this->initialiserMailles();
$this->genererMaillesPourZoomMinimal();
} else {
$this->mailles->redecouperMailles();
$this->ajouterMaillesDansBdd();
}
}
}
private function estTableCreee() {
$tables = $this->getBdd()->recupererTous("SHOW TABLES FROM ".Config::get('bdd_nom'));
$tableInsertion = 'mailles_'.$this->nomSource;
for ($index = 0; $index < count($tables) && $tables[$index]['Tables_in_tb_eflore'] != $tableInsertion;
$index ++);
return $index < count($tables);
}
private function creerStructureTable() {
$tableInsertion = 'mailles_'.$this->nomSource;
print("Table {$tableInsertion} non trouvée dans la base de données, création de sa structure...\n");
$requete =
"CREATE TABLE {$tableInsertion} (".
"code_maille VARCHAR(25) NOT NULL PRIMARY KEY,".
"zoom TINYINT UNSIGNED NOT NULL,".
"position_latitude SMALLINT UNSIGNED NOT NULL,".
"position_longitude SMALLINT UNSIGNED NOT NULL,".
"limite_sud DECIMAL(9,6) NOT NULL,".
"limite_est DECIMAL(9,6) NOT NULL,".
"limite_nord DECIMAL(9,6) NOT NULL,".
"limite_ouest DECIMAL(9,6) NOT NULL,".
"nombre_sites MEDIUMINT UNSIGNED NOT NULL,".
"nombre_observations MEDIUMINT UNSIGNED NOT NULL".
") ENGINE=MyISAM, CHARACTER SET utf8";
$this->getBdd()->requeter($requete);
$requete = "ALTER TABLE {$tableInsertion} ADD INDEX bbox(zoom, limite_sud, ".
"limite_nord, limite_ouest, limite_est)";
$this->getBdd()->requeter($requete);
}
private function initialiserMailles() {
$limitesEspaceMaillage = $this->recupererExtremesCoordonnees();
$this->recupererIndexMailles($limitesEspaceMaillage, Config::get('zoom_minimal'));
}
private function recupererExtremesCoordonnees() {
$champLongitude = Config::get('tbl.champ_longitude');
$champLatitude = Config::get('tbl.champ_latitude');
$requete = "SELECT Min({$champLongitude}) AS lng_min, Max({$champLongitude}) AS lng_max, ".
"Min({$champLatitude}) AS lat_min, Max({$champLatitude}) AS lat_max FROM {$this->tableRequetage}";
$limites = $this->getBdd()->recuperer($requete);
return $limites;
}
private function getBdd() {
if (is_null($this->bdd)) {
$this->bdd = new Bdd();
}
return $this->bdd;
}
private function recupererIndexMailles($limites, $zoom) {
$bbox = array(
'sud' => $limites['lat_min'],
'ouest' => $limites['lng_min'],
'est' => $limites['lng_max'],
'nord' => $limites['lat_max']
);
$this->mailles = new Maillage($bbox, $zoom);
$this->mailles->genererMaillesVides();
}
private function genererMaillesPourZoomMinimal() {
$this->points = $this->recupererPoints();
$this->mailles->ajouterPoints($this->points);
$this->ajouterMaillesDansBdd();
}
private function recupererPoints() {
print("Récupération des points dans la base de données...\n");
$champLongitude = Config::get('tbl.champ_longitude');
$champLatitude = Config::get('tbl.champ_latitude');
$id = Config::get('tbl.champ_id');
$requete = "SELECT COUNT({$id}) AS observations, {$champLatitude} AS latitude, {$champLongitude} ".
"AS longitude FROM {$this->tableRequetage} GROUP BY {$champLongitude},{$champLatitude}";
$points = $this->getBdd()->recupererTous($requete);
return $points;
print("Points chargés\n");
}
private function ajouterMaillesDansBdd() {
$aInserer = $this->mailles->formaterPourInsertionBdd();
$champsTable = Config::get('champs_table_mailles');
$tableInsertion = 'mailles_'.$this->nomSource;
$ordresInsertion = [];
$this->getBdd()->requeter("DELETE FROM {$tableInsertion} WHERE zoom={$aInserer[0]['zoom']}");
foreach ($aInserer as $ligne) {
$codeMaille = $this->nomSource.'.'.$ligne['zoom'].'-'.$ligne['indexLat'].'-'.$ligne['indexLng'];
$sql = "('{$codeMaille}',{$ligne['zoom']},{$ligne['indexLng']},{$ligne['indexLat']},".
"{$ligne['ouest']},{$ligne['sud']},{$ligne['est']},{$ligne['nord']},".
"{$ligne['points']},{$ligne['observations']})";
$ordresInsertion[] = $sql;
}
$requete = "INSERT INTO {$tableInsertion} ({$champsTable}) VALUES ".implode(',', $ordresInsertion);
$this->getBdd()->requeter($requete);
}
}
 
?>
/trunk/scripts/configurations/config.defaut.ini
New file
0,0 → 1,42
; Encodage : UTF-8
; +------------------------------------------------------------------------------------------------------+
; Info sur l'application
info.nom = Scripts de tests
; Abréviation de l'application
info.abr = SCRIPTS
; Version du Framework nécessaire au fonctionnement de cette application
info.framework.version = 0.3
; Encodage de l'application
encodage_appli = "UTF-8"
; Chemin de l'application (pour l'utiliser dans ce fichier)
chemin_scripts = "php:Framework::getCheminAppli()"
; +------------------------------------------------------------------------------------------------------+
; Débogage
; Indique si oui ou non on veut afficher le débogage.
debogage = true
; Indique si oui ou non on veut lancer le chronométrage
chronometrage = false
 
+------------------------------------------------------------------------------------------------------+
; Paramètrage de la base de données.
; bdd_abstraction : abstraction de la base de données.
; bdd_protocole : Protocole de la base de données.
; bdd_serveur : Nom du serveur de bases de données.
; bdd_utilisateur : Nom de l'utilisateur de la base de données.
; bdd_mot_de_passe : Mot de passe de l'utilisateur de la base de données.
; bdd_nom : Nom de la base de données principale.
; bdd_encodage : Encodage de la base de données principale. Normalement le même que l'application mais au format base de
; données : voir ici : http://dev.mysql.com/doc/refman/5.0/en/charset-charsets.html
; et là: http://www.postgresql.org/docs/8.1/static/multibyte.html pour les correspondances
bdd_abstraction = pdo
bdd_protocole = mysql
bdd_serveur = localhost
bdd_utilisateur = ""
bdd_mot_de_passe = ""
bdd_nom = "tb_eflore_test"
bdd_encodage = "utf8"
 
 
; Dossier de base contenant les données d'eFlore (Fichiers TSV et SQL)
dossierDonneesEflore = "/home/telabotap/www/eflore/donnees/"
Property changes:
Added: svn:mime-type
+text/plain
\ No newline at end of property
/trunk/scripts/configurations
New file
Property changes:
Added: svn:ignore
+config.ini
/trunk/scripts/framework.defaut.php
New file
0,0 → 1,6
<?php
// Inclusion du Framework
// Renomer ce fichier en "framework.php"
// Indiquer ci-dessous le chemin absolu vers le fichier autoload.inc.php de la bonne version du Framework
require_once '/home/www/commun/framework/0.3/Framework.php';
?>
/trunk/scripts
New file
Property changes:
Added: svn:ignore
+framework.php