| Line 51... |
Line 51... |
| 51 |
|
51 |
|
| Line 52... |
Line 52... |
| 52 |
// TODO : CSS specifique (id)
|
52 |
// TODO : CSS specifique (id)
|
| 53 |
|
53 |
|
| 54 |
class Cartes {
|
54 |
class Cartes {
|
| - |
|
55 |
private $tab_code_insee = array();
|
| Line 55... |
Line 56... |
| 55 |
private $tab_code_insee = array();
|
56 |
public $src_map;
|
| - |
|
57 |
private $cartesFormateur = null;
|
| 56 |
private $src_map;
|
58 |
|
| 57 |
|
59 |
public function consulter($ressources, $param) {
|
| 58 |
public function consulter($ressources, $param) {
|
- |
|
| 59 |
$this->ressources = $ressources;
|
60 |
// Initialisation des variables
|
| 60 |
$this->param = $param;
|
61 |
$this->ressources = $ressources;
|
| 61 |
|
62 |
$this->param = $param;
|
| Line -... |
Line 63... |
| - |
|
63 |
$this->traiterParametres();
|
| - |
|
64 |
$this->creerFormateur();
|
| - |
|
65 |
$this->cartesFormateur->initialiserImage();
|
| - |
|
66 |
|
| - |
|
67 |
$inventories = $this->cartesFormateur->chargerDonnees();
|
| - |
|
68 |
$retour = '';
|
| - |
|
69 |
if (is_array($inventories) && $inventories !== array()){
|
| - |
|
70 |
// Connection referentiel communes
|
| - |
|
71 |
$this->chargerVille();
|
| - |
|
72 |
list($text, $merge) = $this->calculerRepartition($inventories);
|
| - |
|
73 |
// D�finition des couleurs des points
|
| - |
|
74 |
$couleurs = $this->cartesFormateur->definirCouleurs();
|
| - |
|
75 |
if ($text) {
|
| - |
|
76 |
$usemap = $this->cartesFormateur->dessinerPoint($text, $merge, $couleurs);
|
| - |
|
77 |
}
|
| - |
|
78 |
if (isset($usemap)) {
|
| - |
|
79 |
$this->cartesFormateur->img();
|
| - |
|
80 |
|
| - |
|
81 |
if ($this->info['miniature'] !== 'min') {
|
| - |
|
82 |
$retour = $this->cartesFormateur->formaterCartes($usemap);
|
| - |
|
83 |
} else { // miniature
|
| - |
|
84 |
$retour = $this->cartesFormateur->formaterCarteMiniature($retour, $usemap);
|
| - |
|
85 |
}
|
| - |
|
86 |
}
|
| - |
|
87 |
} else {
|
| - |
|
88 |
$retour = $this->formaterCarteVide();
|
| Line -... |
Line 89... |
| - |
|
89 |
}
|
| - |
|
90 |
if ($retour == '') {
|
| - |
|
91 |
$retour = $this->formaterCarteVide();
|
| - |
|
92 |
}
|
| - |
|
93 |
|
| - |
|
94 |
print_r($retour);
|
| - |
|
95 |
}
|
| - |
|
96 |
|
| - |
|
97 |
public function creerFormateur(){
|
| - |
|
98 |
$projet = ucwords($this->param['projet']);
|
| - |
|
99 |
$Classe = $projet.'Formateur';
|
| - |
|
100 |
$chemin = dirname(__FILE__).DS.'cartes'.DS;
|
| - |
|
101 |
$cheminClasse = $chemin.$Classe.'.php';
|
| 62 |
$this->traiterParametres();
|
102 |
$cheminInterface = $chemin.'Formateur.php';
|
| - |
|
103 |
if (file_exists($cheminInterface)) {
|
| - |
|
104 |
include_once $cheminInterface;
|
| 63 |
// Initialisation des variables
|
105 |
if (file_exists($cheminClasse)) {
|
| - |
|
106 |
include_once $cheminClasse;
|
| - |
|
107 |
$this->cartesFormateur = new $Classe($this->param, $this->info);
|
| 64 |
$tab_retour = array();
|
108 |
} else {
|
| Line 65... |
Line 109... |
| 65 |
|
109 |
$message = "La classe '$Classe' est introuvable.";Debug::printr($message);
|
| - |
|
110 |
throw new Exception($message);
|
| 66 |
|
111 |
}
|
| 67 |
$tab_retour['contenu_page'] = $this->calculerRepartition($this->info);
|
112 |
}
|
| 68 |
print_r($this->calculerRepartition($this->info));
|
113 |
}
|
| 69 |
}
|
114 |
|
| 70 |
|
115 |
private function traiterParametres() {
|
| 71 |
private function traiterParametres() {
|
- |
|
| 72 |
if ($this->param['retour.format'] == 'min') {
|
116 |
$this->info['miniature'] = (isset($this->param['retour.format'])) ? $this->param['retour.format'] : false;
|
| 73 |
$this->src_map = 'france_utm_miniature.jpg';
|
117 |
if ($this->info['miniature'] == 'min') {
|
| - |
|
118 |
$this->info['src_map'] = 'france_utm_miniature.jpg';
|
| - |
|
119 |
} else {
|
| - |
|
120 |
$this->info['src_map'] = 'france_utm_600x564.jpg';
|
| - |
|
121 |
}
|
| 74 |
} else {
|
122 |
// Ajout du code du r�f�rentiel
|
| - |
|
123 |
$this->info['referentiel'] = 'bdtfx';
|
| 75 |
$this->src_map = 'france_utm_600x564.jpg';
|
124 |
$projets = array('cenlr', 'cel', 'cbnmed', 'sophy');
|
| - |
|
125 |
if (isset($this->param['projet'])) {
|
| 76 |
}
|
126 |
if (!in_array($this->param['projet'], $projets)) {
|
| 77 |
// +-----------------------------------------------------------------------------------------------------------+
|
- |
|
| 78 |
// Ajout du code du r�f�rentiel
|
- |
|
| 79 |
$this->info['referentiel'] = 'bdtfx';
|
- |
|
| 80 |
|
127 |
$this->param['projet'] = 'general';
|
| 81 |
// +-----------------------------------------------------------------------------------------------------------+
|
128 |
}
|
| 82 |
// R�cup�ration d'infos g�n�rales
|
129 |
} else {
|
| 83 |
/*$this->info['nn'] = 141;
|
130 |
$this->param['projet'] = 'general';
|
| 84 |
$this->info['nt'] = 8522;
|
131 |
}
|
| 85 |
$this->info['nom'] = 'Acer campestre L.';
|
- |
|
| 86 |
$this->info['nom_ss_auteur'] = 'Acer campestre';*/
|
132 |
// R�cup�ration d'infos g�n�rales
|
| Line -... |
Line 133... |
| - |
|
133 |
// donnees exemple nn = 141; nt = 8522; nom = 'Acer campestre L.'; nom_ss_auteur = 'Acer campestre';
|
| - |
|
134 |
$this->info['nn'] = $this->param['masque.nn'];
|
| - |
|
135 |
$this->info['nt'] = $this->param['masque.nt'];
|
| - |
|
136 |
$this->info['nom'] = $this->param['masque.ns'].' '.$this->param['masque.au'];
|
| - |
|
137 |
$this->info['nom_ss_auteur'] = $this->param['masque.ns'];
|
| - |
|
138 |
}
|
| - |
|
139 |
|
| - |
|
140 |
private function chargerVille() {
|
| 87 |
$this->info['nn'] = $this->param['masque.nn'];
|
141 |
$requete = "SELECT * FROM tb_cel.locations";
|
| 88 |
$this->info['nt'] = $this->param['masque.nt'];
|
142 |
$villes = $this->getBdd()->recupererTous($requete);
|
| 89 |
$this->info['nom'] = $this->param['masque.ns'].' '.$this->param['masque.au'];
|
143 |
foreach ($villes as $ville) {
|
| 90 |
$this->info['nom_ss_auteur'] = $this->param['masque.ns'];
|
144 |
$this->tab_code_insee[$ville['insee_code']] = $ville;
|
| 91 |
$this->info['miniature'] = $this->param['retour.format'];
|
145 |
}
|
| 92 |
}
|
146 |
}
|
| 93 |
|
- |
|
| 94 |
private function calculerRepartition($param) {
|
- |
|
| 95 |
$text = '';
|
- |
|
| 96 |
// Lecture commentaires embarqu�s dans la page
|
- |
|
| 97 |
$jpg_txt = file_get_contents(Config::get('Cartes.chemin').str_replace('jpg', 'txt', $this->src_map));
|
- |
|
| 98 |
parse_str($jpg_txt);
|
- |
|
| 99 |
// Rappel : Pixel : O,0 en haut gauche
|
- |
|
| 100 |
|
- |
|
| 101 |
// X Coin inferieur gauche en Pixel
|
- |
|
| 102 |
//$Px_echelle_X1['31T'] = 0;
|
- |
|
| 103 |
$Px_echelle_X1['31T'] = $X131T;
|
- |
|
| 104 |
// Y Coin inferieur gauche en Pixel
|
- |
|
| 105 |
//$Px_echelle_Y1['31T'] = 539;
|
- |
|
| 106 |
$Px_echelle_Y1['31T'] = $Y131T;
|
- |
|
| 107 |
|
- |
|
| 108 |
// Pour calcul Resolution
|
- |
|
| 109 |
// X Coin inferieur droit en Pixel
|
- |
|
| 110 |
//$Px_echelle_X2['31T'] = 805;
|
- |
|
| 111 |
$Px_echelle_X2['31T'] = $X231T;
|
- |
|
| 112 |
// Y Coin inferieur droit en Pixel
|
- |
|
| 113 |
//$Px_echelle_Y2['31T'] = 539;
|
- |
|
| 114 |
$Px_echelle_Y2['31T'] = $Y231T;
|
- |
|
| 115 |
|
- |
|
| 116 |
// X Coin inferieur gauche en UTM
|
- |
|
| 117 |
//$M_UTM_X1['31T'] = 300092;
|
- |
|
| 118 |
$M_UTM_X1['31T'] = $X131TUTM;
|
- |
|
| 119 |
// Y Coin inferieur gauche en UTM
|
- |
|
| 120 |
//$M_UTM_Y1['31T'] = 4536867;
|
- |
|
| 121 |
$M_UTM_Y1['31T'] = $Y131TUTM;
|
- |
|
| 122 |
|
- |
|
| 123 |
// Pour calcul "resolution"
|
- |
|
| 124 |
|
- |
|
| 125 |
// X Coin inferieur droit en UTM
|
- |
|
| 126 |
//$M_UTM_X2['31T'] = 105371; //
|
147 |
|
| 127 |
$M_UTM_X2['31T'] = $X231TUTM;
|
- |
|
| 128 |
// Y Coin inferieur droit en UTM
|
- |
|
| 129 |
//$M_UTM_Y2['31T'] = 5042332;
|
- |
|
| 130 |
$M_UTM_Y2['31T'] = $Y231TUTM;
|
- |
|
| 131 |
|
- |
|
| 132 |
// "Resolution"
|
- |
|
| 133 |
$p['31T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T']) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
|
- |
|
| 134 |
|
- |
|
| 135 |
// Fuseau 32T :
|
- |
|
| 136 |
|
- |
|
| 137 |
// Pixel : O,0 en haut gauche
|
- |
|
| 138 |
|
- |
|
| 139 |
// X Coin inferieur gauche en Pixel
|
- |
|
| 140 |
//$Px_echelle_X1['32T'] = 483;
|
- |
|
| 141 |
$Px_echelle_X1['32T'] = $X132T;
|
- |
|
| 142 |
|
- |
|
| 143 |
// Y Coin inferieur gauche en Pixel
|
- |
|
| 144 |
//$Px_echelle_Y1['32T'] = 536;
|
- |
|
| 145 |
$Px_echelle_Y1['32T'] = $Y132T;
|
- |
|
| 146 |
|
- |
|
| 147 |
// X Coin inferieur droit en Pixel
|
- |
|
| 148 |
//$Px_echelle_X2['32T'] = 805;
|
- |
|
| 149 |
$Px_echelle_X2['32T'] = $X232T;
|
- |
|
| 150 |
// Y Coin inferieur droit en Pixel
|
- |
|
| 151 |
//$Px_echelle_Y2['32T'] = 536;
|
- |
|
| 152 |
$Px_echelle_Y2['32T'] = $Y232T;
|
- |
|
| 153 |
|
- |
|
| 154 |
|
- |
|
| 155 |
// X Coin inferieur gauche en UTM
|
- |
|
| 156 |
//$M_UTM_X1['32T'] = 247615;
|
- |
|
| 157 |
$M_UTM_X1['32T'] = $X132TUTM;
|
- |
|
| 158 |
// Y Coin inferieur gauche en UTM
|
148 |
private function calculerRepartition($inventories) {
|
| 159 |
//$M_UTM_Y1['32T'] = 4540000;
|
- |
|
| 160 |
$M_UTM_Y1['32T'] = $Y132TUTM;
|
- |
|
| 161 |
|
- |
|
| 162 |
//$angle3132;
|
- |
|
| 163 |
|
- |
|
| 164 |
// "Resolution"
|
- |
|
| 165 |
$p['32T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T'] ) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
|
- |
|
| 166 |
|
- |
|
| 167 |
// Fuseau 30T :
|
- |
|
| 168 |
|
- |
|
| 169 |
// X Coin inferieur gauche en Pixel
|
- |
|
| 170 |
//$Px_echelle_X1['30T'] = 483;
|
- |
|
| 171 |
$Px_echelle_X1['30T'] = $X130T;
|
- |
|
| 172 |
|
- |
|
| 173 |
// Y Coin inferieur gauche en Pixel
|
- |
|
| 174 |
//$Px_echelle_Y1['30T'] = 536;
|
- |
|
| 175 |
$Px_echelle_Y1['30T'] = $Y130T;
|
- |
|
| 176 |
|
- |
|
| 177 |
// X Coin inferieur droit en Pixel
|
- |
|
| 178 |
//$Px_echelle_X2['30T'] = 805;
|
- |
|
| 179 |
$Px_echelle_X2['30T'] = $X230T;
|
- |
|
| 180 |
// Y Coin inferieur droit en Pixel
|
- |
|
| 181 |
//$Px_echelle_Y2['30T'] = 536;
|
- |
|
| 182 |
$Px_echelle_Y2['30T'] = $Y230T;
|
- |
|
| 183 |
|
- |
|
| 184 |
// X Coin inferieur gauche en UTM
|
- |
|
| 185 |
//$M_UTM_X1['30T'] = 247615;
|
- |
|
| 186 |
$M_UTM_X1['30T'] = $X130TUTM;
|
- |
|
| 187 |
// Y Coin inferieur gauche en UTM
|
- |
|
| 188 |
//$M_UTM_Y1['30T'] = 4540000;
|
149 |
$text = '';
|
| 189 |
$M_UTM_Y1['30T'] = $Y130TUTM;
|
- |
|
| 190 |
|
- |
|
| 191 |
// angle
|
- |
|
| 192 |
//$a = 356.0; // (-4 degre)
|
- |
|
| 193 |
|
- |
|
| 194 |
// "Resolution"
|
- |
|
| 195 |
$p['30T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T'] ) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
|
- |
|
| 196 |
|
- |
|
| 197 |
// Nom du fichier image en sortie
|
- |
|
| 198 |
$this->cheminCartesBase = Config::get('Cartes.chemin');
|
- |
|
| 199 |
$dest_map = 'nt'.$this->info['nt'].'_'.$this->src_map;
|
- |
|
| 200 |
$dest_map_cel = 'cel_nt'.$this->info['nt'].'_'.$this->src_map;
|
- |
|
| 201 |
$dest_map_cenlr = 'cenlr_nt'.$this->info['nt'].'_'.$this->src_map;
|
- |
|
| 202 |
$dest_map_cbnmed = 'cbnmed_nt'.$this->info['nt'].'_'.$this->src_map;
|
- |
|
| 203 |
$dest_map_sophy = 'sophy_nt'.$this->info['nt'].'_'.$this->src_map;
|
- |
|
| 204 |
$img = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
|
- |
|
| 205 |
$img_cel = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
|
- |
|
| 206 |
$img_cenlr = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
|
- |
|
| 207 |
$img_cbnmed = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
|
- |
|
| 208 |
$img_sophy = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
|
- |
|
| 209 |
|
- |
|
| 210 |
$retour = '<a name="topmap"></a>';
|
- |
|
| 211 |
|
- |
|
| 212 |
/*
|
- |
|
| 213 |
* Les donnees issues du carnet en ligne sont recuperes directement, sans passer par le mecanisme de moissonage car :
|
- |
|
| 214 |
* - pour l'instant le service de moissonage n'est pas automatise et donc il y a un decalage dans l'affichage des donnees transmises
|
- |
|
| 215 |
* - la table contenant les donnees moissonees ne reprend pas tous les champs necessaires a l'exploitation par eflore (notamment pas de code localite, pas d'identifiant libre)
|
150 |
// Recuperation du positionnement de la carte
|
| 216 |
*
|
- |
|
| 217 |
* A terme, utilser vraiment le moissonage, y compris pour les donnees issues du CEL, en utilisant ABCD et en modifiant le programme d'harvesting.
|
- |
|
| 218 |
*/
|
- |
|
| 219 |
$inventories = $this->recupererDonnees();
|
- |
|
| 220 |
|
- |
|
| 221 |
|
- |
|
| 222 |
|
- |
|
| 223 |
if (is_array($inventories)){
|
- |
|
| 224 |
// D�finition des couleurs des points
|
- |
|
| 225 |
// green
|
- |
|
| 226 |
$green = imagecolorallocate($img, 0, 255, 0);
|
- |
|
| 227 |
// red
|
- |
|
| 228 |
$red = imagecolorallocate($img, 255, 0, 0);
|
- |
|
| 229 |
// blue
|
- |
|
| 230 |
$blue = imagecolorallocate($img, 0, 0, 255);
|
151 |
$jpg_txt = file_get_contents(Config::get('Cartes.chemin').str_replace('jpg', 'txt', $this->info['src_map']));
|
| 231 |
// purple
|
152 |
parse_str($jpg_txt);
|
| 232 |
$purple = imagecolorallocate($img, 255, 0, 255);
|
- |
|
| 233 |
// black
|
- |
|
| 234 |
$black = imagecolorallocate($img, 0, 0, 0);
|
- |
|
| 235 |
|
- |
|
| 236 |
$i = 0;
|
153 |
// "Resolution" calculer à partir du fichier $jpg_txt par fuseau
|
| 237 |
$text = array();
|
- |
|
| 238 |
$merge = array();
|
- |
|
| 239 |
|
154 |
$p['31T'] = ($X231T - $X131T) / ($X231TUTM - $X131TUTM);
|
| 240 |
// Connection referentiel communes
|
- |
|
| 241 |
$this->chargerVille();
|
- |
|
| 242 |
|
- |
|
| 243 |
foreach ($inventories as $inventory){
|
- |
|
| 244 |
// On ne tient pas compte des coordonn�es x, y , positionnement en fonction de la commune uniquement
|
- |
|
| 245 |
$location_protege = $this->getBdd()->proteger($inventory['location']);
|
- |
|
| 246 |
$id_location_protege = $this->getBdd()->proteger($inventory['id_location']);
|
- |
|
| 247 |
|
- |
|
| 248 |
if ($inventory['collection_code'] == 'FLORE - VAR') {
|
- |
|
| 249 |
if (isset($this->tab_code_insee[$location_protege])) {
|
- |
|
| 250 |
$utm = array(0 => $this->tab_code_insee[$location_protege]);
|
- |
|
| 251 |
}
|
- |
|
| 252 |
} elseif ($inventory['collection_code'] == 'sophy') {
|
- |
|
| 253 |
if (isset($this->tab_code_insee[$id_location_protege])) {
|
- |
|
| 254 |
$utm = array(0 => $this->tab_code_insee[$id_location_protege]);
|
- |
|
| 255 |
}
|
- |
|
| 256 |
|
- |
|
| 257 |
} else {
|
- |
|
| 258 |
if ($inventory['id_location'] != 'null') {
|
- |
|
| 259 |
$requete = "SELECT * ".
|
- |
|
| 260 |
"FROM tb_cel.locations ".
|
- |
|
| 261 |
"WHERE name LIKE $location_protege ".
|
- |
|
| 262 |
" AND code = $id_location_protege ";
|
155 |
$p['32T'] = ($X231T - $X131T ) / ($X231TUTM - $X131TUTM);
|
| 263 |
$utm = $this->getBdd()->recupererTous($requete);
|
156 |
$p['30T'] = ($X231T - $X131T ) / ($X231TUTM - $X131TUTM);
|
| 264 |
} else {
|
157 |
|
| 265 |
$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE $location_protege ";
|
158 |
$text = array();
|
| 266 |
$utm = $this->getBdd()->recupererTous($requete);
|
159 |
$merge = array();
|
| Line 267... |
Line 160... |
| 267 |
}
|
160 |
foreach ($inventories as $inventory){
|
| 268 |
}
|
161 |
$utm = $this->cartesFormateur->chercherVille($inventory, $this->tab_code_insee);
|
| 269 |
// Ultime tentative
|
- |
|
| 270 |
if (!$utm) {
|
162 |
// Ultime tentative
|
| 271 |
$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE $location_protege ";
|
163 |
if (!$utm) {
|
| 272 |
$utm = $this->getBdd()->recupererTous($requete);
|
164 |
$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE ".$this->getBdd()->proteger($inventory['location']);
|
| 273 |
}
|
- |
|
| 274 |
|
- |
|
| 275 |
// Si des doublons sur la commune : pas d'affichage , il vaut mieux ne rien afficher que d'afficher des erreurs.
|
- |
|
| 276 |
if (sizeof($utm) == 1) {
|
- |
|
| 277 |
|
- |
|
| 278 |
$utm = $utm[0];
|
- |
|
| 279 |
|
- |
|
| 280 |
// On centre le point au milieu de la maille 10x10 par defaut ...
|
- |
|
| 281 |
$pad = str_repeat ('0' ,(7 - strlen( $utm['x_utm'])));
|
- |
|
| 282 |
$utm['x_utm'] = $pad.$utm['x_utm'];
|
165 |
$utm = $this->getBdd()->recupererTous($requete);
|
| 283 |
|
- |
|
| 284 |
$pad = str_repeat ('0' ,(7 - strlen( $utm['y_utm'])));
|
- |
|
| 285 |
$utm['y_utm'] = $pad.$utm['y_utm'];
|
166 |
}
|
| 286 |
|
167 |
|
| 287 |
$utm['x_utm'] = substr($utm['x_utm'] ,0,3);
|
- |
|
| 288 |
$utm['x_utm'] = $utm['x_utm'].'5000';
|
168 |
// Si des doublons sur la commune : pas d'affichage , il vaut mieux ne rien afficher que d'afficher des erreurs.
|
| 289 |
|
169 |
if (sizeof($utm) == 1) {
|
| 290 |
$utm['y_utm'] = substr($utm['y_utm'] ,0,3);
|
170 |
$utm = $utm[0];
|
| 291 |
$utm['y_utm'] = $utm['y_utm'].'5000';
|
171 |
|
| 292 |
|
172 |
// On centre le point au milieu de la maille 10x10 par defaut ...
|
| 293 |
|
173 |
$utm = $this->chercherCentreMaille($utm);
|
| 294 |
// Calcul coordonnes x, y sur l'image
|
- |
|
| 295 |
// Fuseau 31 T
|
174 |
|
| 296 |
if ($utm['sector']=='31T') {
|
175 |
// Calcul coordonnes x, y sur l'image
|
| 297 |
$x = (($utm['x_utm'] - $M_UTM_X1['31T']) * $p['31T'] ) + $Px_echelle_X1['31T'];
|
176 |
if ($utm['sector']=='31T') {// Fuseau 31 T
|
| 298 |
$y = $Px_echelle_Y2['31T'] - (($utm['y_utm'] - $M_UTM_Y1['31T']) * $p['31T'] );
|
177 |
$x = (($utm['x_utm'] - $X131TUTM) * $p['31T'] ) + $X131T;
|
| 299 |
} elseif ($utm['sector'] == '32T') {// Fuseau 32 T : une rotation + translation est appliqu�e
|
178 |
$y = $Y231T - (($utm['y_utm'] - $Y131TUTM) * $p['31T'] );
|
| 300 |
$cosa = cos(deg2rad($angle3132));
|
179 |
} elseif ($utm['sector'] == '32T') {// Fuseau 32 T : une rotation + translation est appliqu�e
|
| 301 |
$sina = sin(deg2rad($angle3132));
|
180 |
$cosa = cos(deg2rad($angle3132));
|
| 302 |
|
- |
|
| 303 |
$xp = (($utm['x_utm'] - $M_UTM_X1['32T']) * $cosa) + (($utm['y_utm']- $M_UTM_Y1['32T']) * $sina);
|
181 |
$sina = sin(deg2rad($angle3132));
|
| 304 |
$yp = (-($utm['x_utm'] - $M_UTM_X1['32T'])* $sina) + (($utm['y_utm'] - $M_UTM_Y1['32T']) * $cosa);
|
182 |
$xp = (($utm['x_utm'] - $X132TUTM) * $cosa) + (($utm['y_utm']- $Y132TUTM) * $sina);
|
| 305 |
$x = ($xp * $p['32T'] ) + $Px_echelle_X1['32T'];
|
183 |
$yp = (-($utm['x_utm'] - $X132TUTM)* $sina) + (($utm['y_utm'] - $Y132TUTM) * $cosa);
|
| 306 |
$y = $Px_echelle_Y2['32T']-($yp * $p['32T'] );
|
184 |
$x = ($xp * $p['32T'] ) + $X132T;
|
| 307 |
} elseif ($utm['sector'] == '30T') {// Fuseau 30 T : une rotation + translation est appliqu�e
|
185 |
$y = $Y232T-($yp * $p['32T'] );
|
| 308 |
$cosa = cos(deg2rad($angle3031));
|
186 |
} elseif ($utm['sector'] == '30T') {// Fuseau 30 T : une rotation + translation est appliqu�e
|
| 309 |
$sina = sin(deg2rad($angle3031));
|
187 |
$cosa = cos(deg2rad($angle3031));
|
| 310 |
|
- |
|
| 311 |
$xp = (($utm['x_utm'] - $M_UTM_X1['30T']) * $cosa) + (($utm['y_utm'] - $M_UTM_Y1['30T']) * $sina);
|
- |
|
| 312 |
$yp = (-($utm['x_utm'] - $M_UTM_X1['30T']) * $sina) + (($utm['y_utm'] - $M_UTM_Y1['30T']) * $cosa);
|
- |
|
| 313 |
$x = ($xp * $p['30T'] ) + $Px_echelle_X1['30T'];
|
- |
|
| 314 |
$y = $Px_echelle_Y2['30T'] - ($yp * $p['30T'] );
|
- |
|
| 315 |
}
|
- |
|
| 316 |
$x = round($x);
|
- |
|
| 317 |
$y = round($y);
|
- |
|
| 318 |
|
- |
|
| 319 |
$comment = '';
|
- |
|
| 320 |
if ($utm['name'] != null) {
|
- |
|
| 321 |
$name = utf8_decode($utm['name']);
|
- |
|
| 322 |
}
|
- |
|
| 323 |
|
- |
|
| 324 |
if ($inventory['date_observation'] != '0000-00-00 00:00:00') {
|
- |
|
| 325 |
if ($inventory['collection_code'] == 'sophy') {
|
- |
|
| 326 |
$comment .= ', en '.$inventory['date_observation'];
|
- |
|
| 327 |
} else {
|
- |
|
| 328 |
list($year, $month, $day) = explode ('-',$inventory['date_observation']);
|
- |
|
| Line 329... |
Line -... |
| 329 |
list($day) = explode (' ',$day);
|
- |
|
| 330 |
if ($month == '00') {
|
- |
|
| 331 |
$comment .= ', en '.$year;
|
- |
|
| 332 |
} else {
|
- |
|
| 333 |
$comment .= ', le '.$day.'/'.$month.'/'.$year;
|
- |
|
| 334 |
}
|
- |
|
| 335 |
}
|
- |
|
| 336 |
}
|
- |
|
| 337 |
|
- |
|
| 338 |
if ($inventory['collection_code'] == 'cel') {
|
- |
|
| Line 339... |
Line -... |
| 339 |
list($identifiant) = explode("@", $inventory['identifiant']);
|
- |
|
| - |
|
188 |
$sina = sin(deg2rad($angle3031));
|
| - |
|
189 |
$xp = (($utm['x_utm'] - $X130TUTM) * $cosa) + (($utm['y_utm'] - $Y130TUTM) * $sina);
|
| 340 |
$comment .= " par ".$identifiant."@...";
|
190 |
$yp = (-($utm['x_utm'] - $X130TUTM) * $sina) + (($utm['y_utm'] - $Y130TUTM) * $cosa);
|
| 341 |
} else {
|
- |
|
| - |
|
191 |
$x = ($xp * $p['30T'] ) + $X130T;
|
| - |
|
192 |
$y = $Y230T - ($yp * $p['30T'] );
|
| 342 |
$comment .= " par ".utf8_decode($inventory['identifiant']);
|
193 |
}
|
| - |
|
194 |
$x = round($x);
|
| 343 |
}
|
195 |
$y = round($y);
|
| 344 |
// On stocke les commentaires pour affichage dans les tooltips
|
- |
|
| 345 |
// Commentaire deja pr�sent ? : on ajoute � la suite
|
- |
|
| 346 |
|
- |
|
| 347 |
list($text, $merge) = $this->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y);
|
- |
|
| 348 |
|
- |
|
| 349 |
|
- |
|
| 350 |
}
|
- |
|
| 351 |
|
- |
|
| 352 |
$i++;
|
- |
|
| 353 |
}
|
- |
|
| 354 |
|
- |
|
| 355 |
//print_r($text);
|
- |
|
| 356 |
|
- |
|
| 357 |
|
- |
|
| 358 |
$usemap = '';
|
- |
|
| 359 |
$usemap_cel = '';
|
- |
|
| 360 |
$usemap_cenlr = '';
|
- |
|
| 361 |
$usemap_cbnmed = '';
|
- |
|
| 362 |
$usemap_sophy = '';
|
- |
|
| 363 |
|
- |
|
| 364 |
if ($text) {
|
- |
|
| 365 |
foreach ($text as $coord => $origines ) {
|
- |
|
| 366 |
foreach ($origines as $origine => $maptext ) {
|
- |
|
| 367 |
$maptext = preg_replace("/\"/", "\'", $maptext);
|
- |
|
| 368 |
|
- |
|
| 369 |
list($x,$y) = explode('|', $coord);
|
- |
|
| 370 |
|
- |
|
| 371 |
$tpl_area = '<area shape="%s" alt="" class="tooltip" coords="%s" title="%s"/>';
|
- |
|
| 372 |
$rayon = 2;
|
- |
|
| 373 |
$type = 'circle';
|
- |
|
| 374 |
$coords = "$x,$y,5";
|
- |
|
| 375 |
$on_mouseover = "this.ttBgColor='#99C242';this.ttFontColor='#000000';this.T_OFFSETX=-200;this.T_OFFSETY=-50;this.T_STICKY=1;return escape('$maptext')";
|
- |
|
| 376 |
|
- |
|
| 377 |
switch ($origine) {
|
- |
|
| 378 |
case 'FLORE - VAR': // cbnmed
|
- |
|
| 379 |
imagefilledellipse($img_cbnmed, $x, $y, 7, 7, $blue);
|
- |
|
| 380 |
$usemap_cbnmed = $usemap_cbnmed.sprintf($tpl_area, $type, $coords, $maptext);
|
- |
|
| 381 |
break;
|
- |
|
| 382 |
case 'cel':
|
- |
|
| 383 |
imagefilledrectangle($img_cel, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $green);
|
- |
|
| 384 |
$coords = ($x - $rayon).','.($y - $rayon).','.($x + $rayon).','.($y + $rayon);
|
- |
|
| 385 |
$usemap_cel = $usemap_cel.sprintf($tpl_area, 'rect', $coords, $maptext);
|
- |
|
| 386 |
break;
|
- |
|
| 387 |
case 'flore': // cenlr
|
- |
|
| 388 |
imagefilledellipse($img_cenlr, $x, $y, 7, 7, $red);
|
- |
|
| 389 |
$usemap_cenlr = $usemap_cenlr.sprintf($tpl_area, $type, $coords, $maptext);
|
- |
|
| 390 |
break;
|
- |
|
| 391 |
case 'sophy':
|
- |
|
| 392 |
imagefilledrectangle($img_sophy, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $purple);
|
- |
|
| 393 |
$coords = ($x - $rayon).','.($y - $rayon).','.($x + $rayon).','.($y + $rayon);
|
- |
|
| 394 |
$usemap_sophy = $usemap_sophy.sprintf($tpl_area, 'rect', $coords, $maptext);
|
- |
|
| 395 |
break;
|
- |
|
| 396 |
case 'tout':
|
- |
|
| 397 |
if (isset($merge[$coord]) && $merge[$coord]) {
|
- |
|
| 398 |
imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $black);
|
- |
|
| 399 |
} elseif (isset ($text[$coord]['cel']) && ($text[$coord]['cel'])) {
|
- |
|
| 400 |
imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $green);
|
- |
|
| 401 |
} elseif (isset ($text[$coord]['flore']) && ($text[$coord]['flore'])) {
|
- |
|
| 402 |
imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $red);
|
- |
|
| 403 |
} elseif (isset ($text[$coord]['FLORE - VAR']) && ($text[$coord]['FLORE - VAR'])) {
|
- |
|
| 404 |
imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $blue);
|
- |
|
| 405 |
} elseif (isset ($text[$coord]['sophy']) && ($text[$coord]['sophy'])) {
|
- |
|
| 406 |
imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $purple);
|
196 |
|
| 407 |
}
|
- |
|
| 408 |
$usemap = $usemap.sprintf($tpl_area, $type, $coords, $maptext);
|
- |
|
| 409 |
break;
|
- |
|
| 410 |
|
- |
|
| 411 |
}
|
- |
|
| 412 |
//imagestring($img, 1, $x, $y, 7, 7, "hello", $fill);
|
- |
|
| 413 |
// pas de double quote dans le texte
|
- |
|
| 414 |
}
|
- |
|
| 415 |
}
|
- |
|
| 416 |
}
|
- |
|
| 417 |
|
- |
|
| 418 |
//imageinterlace($img,1);
|
- |
|
| 419 |
$qualite = 90;
|
- |
|
| 420 |
imagejpeg($img, Config::get('cache.stockageChemin').$dest_map, $qualite);
|
- |
|
| 421 |
imagejpeg($img_cel, Config::get('cache.stockageChemin').$dest_map_cel, $qualite);
|
- |
|
| 422 |
imagejpeg($img_cenlr, Config::get('cache.stockageChemin').$dest_map_cenlr, $qualite);
|
- |
|
| 423 |
imagejpeg($img_cbnmed, Config::get('cache.stockageChemin').$dest_map_cbnmed, $qualite);
|
- |
|
| 424 |
imagejpeg($img_sophy, Config::get('cache.stockageChemin').$dest_map_sophy, $qualite);
|
- |
|
| 425 |
|
- |
|
| 426 |
//imagedestroy($img);
|
- |
|
| 427 |
|
- |
|
| 428 |
$retour = '';
|
- |
|
| 429 |
if ($this->info['miniature'] !== 'min') {
|
- |
|
| 430 |
$retour.="<div id=\"descriptions\">";
|
- |
|
| 431 |
$retour.="<h2 id=\"titre_description_general\">Données disponibles : </h2>";
|
- |
|
| 432 |
$retour.= "<div id=\"description_defaut\" class=\"description\">";
|
- |
|
| 433 |
$retour.= "<h3 style='display:none'><span class=\"affichage\">Toutes observations</span></h3>";
|
- |
|
| 434 |
$retour.= "<div id =\"cartowikimap\" style=\"position:relative;\">";
|
- |
|
| 435 |
$retour.= "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n";
|
- |
|
| 436 |
$retour.= "<map name=\"themap\" id=\"themap\">";
|
- |
|
| 437 |
$retour.= $usemap;
|
- |
|
| 438 |
$retour.= "</map>";
|
- |
|
| 439 |
$retour.= "</map>";
|
- |
|
| 440 |
|
- |
|
| 441 |
$retour.= "</div>";
|
- |
|
| 442 |
$retour.= "</div>";
|
- |
|
| 443 |
|
- |
|
| 444 |
|
- |
|
| 445 |
$retour.= "<div id=\"description_1\" class=\"description\">";
|
- |
|
| Line 446... |
Line -... |
| 446 |
$retour.= "<h3 style='display:none;background-color:rgb(0,255,0);color:black;'><span class=\"affichage\">Observations issues du Carnet en ligne</span></h3>";
|
- |
|
| 447 |
$retour.= "<div id =\"cartowikimap\" style=\"position:relative;\">";
|
- |
|
| 448 |
$retour.= "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cel)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcel\"></img><br />\n";
|
- |
|
| 449 |
$retour.= "<map name=\"themapcel\" id=\"themapcel\">";
|
- |
|
| 450 |
$retour.= $usemap_cel;
|
- |
|
| 451 |
$retour.= "</map>";
|
- |
|
| 452 |
$retour.= "</div>";
|
- |
|
| 453 |
$retour.= "</div>";
|
197 |
|
| 454 |
|
- |
|
| 455 |
|
- |
|
| 456 |
|
- |
|
| 457 |
|
198 |
if ($utm['name'] != null) {
|
| Line 458... |
Line -... |
| 458 |
$retour.= "<div id=\"description_2\" class=\"description\">";
|
- |
|
| 459 |
|
- |
|
| 460 |
$retour.= "<h3 style='display:none;background-color:rgb(255,0,0);color:white;'><span class=\"affichage\">Prospection flore du CEN LR</span></h3>";
|
- |
|
| 461 |
$retour.= "<div id =\"cartowikimapcenlr\" style=\"position:relative;\">";
|
- |
|
| 462 |
$retour.= "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cenlr)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcenlr\"></img><br />\n";
|
- |
|
| 463 |
$retour.= "<map name=\"themapcenlr\" id=\"themapcenlr\">";
|
- |
|
| 464 |
$retour.= $usemap_cenlr;
|
- |
|
| 465 |
$retour.= "</map>";
|
- |
|
| 466 |
$retour.= "</div>";
|
- |
|
| 467 |
$retour.= "</div>";
|
- |
|
| 468 |
|
- |
|
| 469 |
|
- |
|
| 470 |
|
- |
|
| 471 |
$retour.= "<div id=\"description_3\" class=\"description\">";
|
- |
|
| 472 |
|
- |
|
| 473 |
$retour.= "<h3 style='display:none;background-color:rgb(0,0,255);color:white;'><span class=\"affichage\">Flore Silene</span></h3>";
|
- |
|
| 474 |
$retour.= "<div id =\"cartowikimapcbnmed\" style=\"position:relative;\">";
|
- |
|
| 475 |
$retour.= "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cbnmed)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcbnmed\"></img><br />\n";
|
- |
|
| 476 |
$retour.= "<map name=\"themapcbnmed\" id=\"themapcbnmed\">";
|
- |
|
| 477 |
$retour.= $usemap_cbnmed;
|
- |
|
| 478 |
$retour.= "</map>";
|
- |
|
| 479 |
$retour.= "</div>";
|
- |
|
| 480 |
$retour.= "</div>";
|
- |
|
| Line 481... |
Line -... |
| 481 |
|
- |
|
| - |
|
199 |
$name = utf8_decode($utm['name']);
|
| 482 |
|
200 |
}
|
| 483 |
$retour.= "<div id=\"description_4\" class=\"description\">";
|
201 |
$comment = $this->cartesFormateur->formerCommentaire($utm, $inventory);
|
| 484 |
|
202 |
// On stocke les commentaires pour affichage dans les tooltips
|
| 485 |
$retour.= "<h3 style='display:none;background-color:rgb(255,0,255);color:white;'><span class=\"affichage\">Observations issues de la base SOPHY</span></h3>";
|
- |
|
| 486 |
$retour.= "<div id =\"cartowikimapsophy\" style=\"position:relative;\">";
|
- |
|
| 487 |
$retour.= "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_sophy)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapsophy\"></img><br />\n";
|
203 |
// Commentaire deja pr�sent ? : on ajoute � la suite
|
| 488 |
$retour.= "<map name=\"themapsophy\" id=\"themapsophy\">";
|
- |
|
| 489 |
$retour.= $usemap_sophy;
|
- |
|
| 490 |
$retour.= "</map>";
|
- |
|
| 491 |
$retour.= "</div>";
|
- |
|
| 492 |
$retour.= "</div>";
|
- |
|
| 493 |
|
204 |
list($text, $merge) = $this->cartesFormateur->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y);
|
| 494 |
$retour.= "</div>";
|
205 |
}
|
| 495 |
} else { // miniature
|
- |
|
| 496 |
$retour.= "<div id =\"cartowikimap\" style=\"position:relative;\">";
|
- |
|
| 497 |
//$retour.= "<a href=".$param['url_onglet_cel'].">"; //lien vers grande image
|
206 |
}
|
| 498 |
$retour.= "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\"></img><br />\n";
|
207 |
|
| Line 499... |
Line -... |
| 499 |
//$retour.= "</a>";
|
- |
|
| 500 |
$retour.= "<map name=\"themap\" id=\"themap\">";
|
- |
|
| 501 |
$retour.= $usemap;
|
- |
|
| 502 |
$retour.= "</map>";
|
- |
|
| 503 |
$retour.= "</div>";
|
- |
|
| 504 |
}
|
- |
|
| 505 |
} else {
|
- |
|
| 506 |
$retour.= "<map name=\"themap\" id=\"themap\">";
|
- |
|
| 507 |
$retour.= "<img src=\"".Config.get('cartes.chemin').$this->src_map."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
|
- |
|
| 508 |
$retour.= "</map>";
|
- |
|
| 509 |
}
|
- |
|
| 510 |
return $retour;
|
- |
|
| 511 |
}
|
- |
|
| 512 |
|
- |
|
| 513 |
|
- |
|
| 514 |
|
- |
|
| 515 |
/*
|
- |
|
| 516 |
* Stockage commentaire associe a un point :
|
- |
|
| 517 |
*
|
- |
|
| 518 |
* Param :
|
- |
|
| 519 |
* @text : texte cumule
|
- |
|
| 520 |
* @merge : indicateur de commentaire fusionne
|
- |
|
| 521 |
* @name : commune associee
|
- |
|
| 522 |
* @comment : commentaire
|
- |
|
| 523 |
* @origine : origine de la donnee
|
- |
|
| 524 |
*
|
- |
|
| 525 |
*
|
- |
|
| 526 |
* TODO : rendre cette fonction independante des valeurs d'origine passee en parametre
|
- |
|
| 527 |
*/
|
- |
|
| 528 |
private function stockerCommentaire($text, $merge, $name, $comment, $origine, $x, $y) {
|
- |
|
| 529 |
if ($origine == 'cel') {
|
- |
|
| 530 |
$prefix = 'CEL : ';
|
- |
|
| 531 |
} elseif ($origine == 'flore') {
|
- |
|
| 532 |
$prefix = 'CEN LR : ';
|
- |
|
| 533 |
} elseif ($origine == 'FLORE - VAR') {
|
- |
|
| 534 |
$prefix = 'CBN MED : ';
|
- |
|
| 535 |
} elseif ($origine == 'sophy') {
|
- |
|
| 536 |
$prefix = 'SOPHY : ';
|
- |
|
| 537 |
}
|
- |
|
| 538 |
|
- |
|
| 539 |
// Cumul toute origine :
|
- |
|
| 540 |
if (isset($text[$x.'|'.$y]['tout']) && ($text[$x.'|'.$y])) {
|
- |
|
| 541 |
$text[$x.'|'.$y]['tout'] = $text[$x.'|'.$y]['tout'].'<br>'.$prefix.$name.$comment;
|
- |
|
| 542 |
} else {
|
- |
|
| 543 |
// Nouveau commentaire
|
- |
|
| 544 |
$text[$x.'|'.$y]['tout']=$prefix.$name.$comment;
|
- |
|
| 545 |
}
|
- |
|
| 546 |
|
- |
|
| 547 |
// Deja present pour cette origine ? on ajoute
|
- |
|
| 548 |
if (isset ($text[$x.'|'.$y][$origine]) && ($text[$x.'|'.$y][$origine])) {
|
- |
|
| 549 |
$text[$x.'|'.$y][$origine] = $text[$x.'|'.$y][$origine].'<br>'.$name.$comment;
|
- |
|
| 550 |
} else { // Nouveau commentaire
|
- |
|
| 551 |
$text[$x.'|'.$y][$origine] = $name.$comment;
|
- |
|
| 552 |
}
|
- |
|
| 553 |
|
- |
|
| 554 |
|
- |
|
| 555 |
// Detection superposition de donnee
|
- |
|
| 556 |
if ($origine == 'cel') {
|
- |
|
| 557 |
if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore']))
|
- |
|
| 558 |
|| (isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
|
- |
|
| 559 |
$merge[$x.'|'.$y]=true;
|
- |
|
| 560 |
}
|
- |
|
| 561 |
} elseif ($origine == 'flore') {
|
- |
|
| 562 |
if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) ||(isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) ||
|
- |
|
| 563 |
(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
|
- |
|
| 564 |
$merge[$x.'|'.$y]=true;
|
- |
|
| Line 565... |
Line -... |
| 565 |
}
|
- |
|
| Line 566... |
Line 208... |
| 566 |
} elseif ($origine == 'FLORE - VAR') {
|
208 |
return array($text, $merge);
|
| - |
|
209 |
}
|
| - |
|
210 |
|
| - |
|
211 |
|
| - |
|
212 |
|
| - |
|
213 |
private function formaterCarteVide() {
|
| - |
|
214 |
$this->cheminCartesBase = Config::get('Cartes.chemin');
|
| - |
|
215 |
$dest_map['vide'] = 'vide_'.$this->info['src_map'];
|
| - |
|
216 |
$img['vide'] = imagecreatefromjpeg($this->cheminCartesBase.$this->info['src_map']);
|
| - |
|
217 |
imagejpeg($img['vide'], Config::get('cache.stockageChemin').$dest_map['vide'], 90);
|
| - |
|
218 |
$retour = "<img src=\"".Config::get('cel_dst').$dest_map['vide']."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
|
| - |
|
219 |
return $retour;
|
| - |
|
220 |
}
|
| - |
|
221 |
|
| - |
|
222 |
|
| - |
|
223 |
|
| - |
|
224 |
|
| - |
|
225 |
//+----------------------------------------------------------------------------------------------------------------+
|
| - |
|
226 |
// sous fonction de calculer répartition
|
| - |
|
227 |
|
| 567 |
if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) ||
|
228 |
|
| 568 |
(isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore']))) {
|
229 |
private function chercherCentreMaille($utm) {
|
| 569 |
$merge[$x.'|'.$y]=true;
|
230 |
$pad = str_repeat ('0' ,(7 - strlen( $utm['x_utm'])));
|
| 570 |
}
|
231 |
$utm['x_utm'] = $pad.$utm['x_utm'];
|
| 571 |
} elseif ($origine == 'sophy') {
|
232 |
|
| 572 |
if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])||
|
233 |
$pad = str_repeat ('0' ,(7 - strlen( $utm['y_utm'])));
|
| 573 |
(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
|
234 |
$utm['y_utm'] = $pad.$utm['y_utm'];
|
| 574 |
$merge[$x.'|'.$y]=true;
|
235 |
|
| 575 |
}
|
- |
|
| 576 |
}
|
- |
|
| 577 |
|
- |
|
| 578 |
return array($text, $merge);
|
- |
|
| 579 |
}
|
- |
|
| 580 |
|
- |
|
| 581 |
|
- |
|
| 582 |
|
- |
|
| 583 |
//+------------------------------------------------------------------------------------------------------+
|
- |
|
| 584 |
// Méthodes d'accès aux objets du Framework
|
236 |
$utm['x_utm'] = substr($utm['x_utm'] ,0,3);
|
| - |
|
237 |
$utm['x_utm'] = $utm['x_utm'].'5000';
|
| 585 |
/**
|
238 |
|
| Line 586... |
Line -... |
| 586 |
* Méthode de connection à la base de données sur demande.
|
- |
|
| 587 |
* Tous les services web n'ont pas besoin de s'y connecter.
|
- |
|
| 588 |
*/
|
- |
|
| 589 |
protected function getBdd() {
|
- |
|
| 590 |
if (! isset($this->Bdd)) {
|
- |
|
| 591 |
$this->Bdd = new Bdd();
|
- |
|
| 592 |
}
|
- |
|
| 593 |
return $this->Bdd;
|
- |
|
| 594 |
}
|
- |
|
| 595 |
|
- |
|
| 596 |
private function chargerVille() {
|
- |
|
| 597 |
$requete = "SELECT * FROM tb_cel.locations";
|
- |
|
| 598 |
$villes = $this->getBdd()->recupererTous($requete);
|
- |
|
| 599 |
foreach ($villes as $ville) {
|
- |
|
| 600 |
$this->tab_code_insee[$ville['insee_code']] = $ville;
|
- |
|
| 601 |
}
|
- |
|
| 602 |
}
|
- |
|
| 603 |
|
- |
|
| 604 |
public function recupererDonnees() {
|
- |
|
| 605 |
// Recherche nom correspondant au numero nomenclatural en cours (pour etablir le lien avec les donnees moissonnes).
|
- |
|
| 606 |
|
- |
|
| 607 |
// R�cuperation donn�e inventaire
|
- |
|
| 608 |
$queryCel = "SELECT 'cel' as collection_code, location, id_location, date_observation, ".
|
- |
|
| 609 |
" coord_y as y_utm, coord_x as x_utm, ref_geo as sector, identifiant FROM tb_cel.cel_inventory ".
|
- |
|
| 610 |
"WHERE num_taxon = '".$this->info['nt']."' ".
|
- |
|
| 611 |
" AND transmission = 1";
|
- |
|
| 612 |
$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
|
- |
|
| 613 |
|
- |
|
| 614 |
// Recuperation des donnees de moissonage
|
- |
|
| 615 |
// Collection code = 'flore' (Cenlr)
|
- |
|
| 616 |
$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
|
- |
|
| 617 |
" STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ".
|
- |
|
| 618 |
" longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
|
- |
|
| 619 |
"FROM tb_hit_indexation.raw_occurrence_record ".
|
- |
|
| 620 |
"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
|
- |
|
| 621 |
" AND collection_code = 'flore' ".
|
- |
|
| 622 |
" AND deleted IS NULL";
|
- |
|
| 623 |
$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
|
- |
|
| 624 |
|
- |
|
| 625 |
|
239 |
$utm['y_utm'] = substr($utm['y_utm'] ,0,3);
|
| 626 |
// Collection code = 'FLORE - VAR' (Cbnmed)
|
- |
|
| 627 |
$queryCbnmed = "SELECT collection_code, locality as location, county as id_location, ".
|
- |
|
| Line 628... |
Line 240... |
| 628 |
" STR_TO_DATE(concat(ifnull(year,0),'/', ifnull(month,0), '/',ifnull(day,0)), '%Y/%m/%d') as date_observation, ".
|
240 |
$utm['y_utm'] = $utm['y_utm'].'5000';
|
| 629 |
" latitude as y_utm , longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
|
241 |
return $utm;
|
| 630 |
"FROM tb_hit_indexation.raw_occurrence_record ".
|
242 |
}
|