Line 54... |
Line 54... |
54 |
class Cartes {
|
54 |
class Cartes {
|
55 |
private $tab_code_insee = array();
|
55 |
private $tab_code_insee = array();
|
56 |
public $src_map;
|
56 |
public $src_map;
|
57 |
private $cartesFormateur = null;
|
57 |
private $cartesFormateur = null;
|
58 |
const MIME_MAP = 'text/html';
|
58 |
const MIME_MAP = 'text/html';
|
59 |
const MIME_JPG = 'image/jpeg';
|
59 |
const MIME_PNG = 'image/png';
|
Line 60... |
Line 60... |
60 |
|
60 |
|
61 |
public function consulter($ressources, $param) {
|
61 |
public function consulter($ressources, $param) {
|
62 |
// Initialisation des variables
|
62 |
// Initialisation des variables
|
63 |
$this->ressources = $ressources;
|
63 |
$this->ressources = $ressources;
|
Line 70... |
Line 70... |
70 |
$retour = '';
|
70 |
$retour = '';
|
71 |
if (is_array($inventories) && $inventories !== array()){
|
71 |
if (is_array($inventories) && $inventories !== array()){
|
72 |
// Connection referentiel communes
|
72 |
// Connection referentiel communes
|
73 |
$this->chargerVille();
|
73 |
$this->chargerVille();
|
74 |
list($text, $merge) = $this->calculerRepartition($inventories);
|
74 |
list($text, $merge) = $this->calculerRepartition($inventories);
|
75 |
// D�finition des couleurs des points
|
75 |
// Définition des couleurs des points
|
76 |
$couleurs = $this->cartesFormateur->definirCouleurs();
|
76 |
$couleurs = $this->cartesFormateur->definirCouleurs();
|
77 |
if ($text) {
|
77 |
if ($text) {
|
78 |
$usemap = $this->cartesFormateur->dessinerPoint($text, $merge, $couleurs);
|
78 |
$usemap = $this->cartesFormateur->dessinerPoint($text, $merge, $couleurs);
|
79 |
}
|
79 |
}
|
80 |
if (isset($usemap)) {
|
80 |
if (isset($usemap)) {
|
Line 85... |
Line 85... |
85 |
if ($retour == '') {
|
85 |
if ($retour == '') {
|
86 |
$retour = $this->formaterCarteVide();
|
86 |
$retour = $this->formaterCarteVide();
|
87 |
}
|
87 |
}
|
88 |
$resultat = new ResultatService();
|
88 |
$resultat = new ResultatService();
|
89 |
$resultat->corps = ($this->info['retour'] == self::MIME_MAP) ? $retour : file_get_contents($retour);
|
89 |
$resultat->corps = ($this->info['retour'] == self::MIME_MAP) ? $retour : file_get_contents($retour);
|
90 |
$resultat->mime = ($this->info['retour'] == self::MIME_MAP) ? self::MIME_MAP : self::MIME_JPG;
|
90 |
$resultat->mime = ($this->info['retour'] == self::MIME_MAP) ? self::MIME_MAP : self::MIME_PNG;
|
91 |
return $resultat;
|
91 |
return $resultat;
|
92 |
}
|
92 |
}
|
Line 93... |
Line 93... |
93 |
|
93 |
|
94 |
public function creerFormateur(){
|
94 |
public function creerFormateur(){
|
Line 109... |
Line 109... |
109 |
}
|
109 |
}
|
110 |
}
|
110 |
}
|
Line 111... |
Line 111... |
111 |
|
111 |
|
112 |
private function traiterParametres() {
|
112 |
private function traiterParametres() {
|
113 |
$this->info['miniature'] = (isset($this->param['retour.format'])) ? $this->param['retour.format'] : false;
|
113 |
$this->info['miniature'] = (isset($this->param['retour.format'])) ? $this->param['retour.format'] : false;
|
114 |
$this->info['src_map'] = ($this->info['miniature'] == 'min') ? 'france_utm_miniature.jpg' : 'france_utm_600x564.jpg';
|
114 |
$this->info['src_map'] = ($this->info['miniature'] == 'min') ? 'france_utm_miniature.png' : 'france_utm_600x564.png';
|
115 |
$this->info['retour'] = (isset($this->param['retour'])) ? $this->param['retour'] : self::MIME_JPG ;
|
115 |
$this->info['retour'] = (isset($this->param['retour'])) ? $this->param['retour'] : self::MIME_PNG ;
|
116 |
// Ajout du code du r�f�rentiel
|
116 |
// Ajout du code du référentiel
|
117 |
$this->info['referentiel'] = 'bdtfx';
|
117 |
$this->info['referentiel'] = 'bdtfx';
|
118 |
$projets = array('cenlr', 'cel', 'cbnmed', 'sophy', 'general');
|
118 |
$projets = array('cenlr', 'cel', 'cbnmed', 'sophy', 'general');
|
119 |
if (isset($this->param['projet']) && in_array($this->param['projet'], $projets)) {
|
119 |
if (isset($this->param['projet']) && in_array($this->param['projet'], $projets)) {
|
120 |
$this->info['projet'] = $this->param['projet'];
|
120 |
$this->info['projet'] = $this->param['projet'];
|
121 |
} else {
|
121 |
} else {
|
122 |
$this->info['projet'] = 'general';
|
122 |
$this->info['projet'] = 'general';
|
123 |
}
|
123 |
}
|
124 |
// R�cup�ration d'infos g�n�rales
|
124 |
// Récupération d'infos générales
|
125 |
// donnees exemple nn = 141; nt = 8522; nom = 'Acer campestre L.'; nom_ss_auteur = 'Acer campestre';
|
125 |
// donnees exemple nn = 141; nt = 8522; nom = 'Acer campestre L.'; nom_ss_auteur = 'Acer campestre';
|
126 |
$this->info['nn'] = $this->param['masque.nn'];
|
126 |
$this->info['nn'] = $this->param['masque.nn'];
|
127 |
$this->info['nt'] = $this->param['masque.nt'];
|
127 |
$this->info['nt'] = $this->param['masque.nt'];
|
128 |
$this->info['nom'] = $this->param['masque.ns'].' '.$this->param['masque.au'];
|
128 |
$this->info['nom'] = $this->param['masque.ns'].' '.$this->param['masque.au'];
|
Line 138... |
Line 138... |
138 |
}
|
138 |
}
|
Line 139... |
Line 139... |
139 |
|
139 |
|
140 |
private function calculerRepartition($inventories) {
|
140 |
private function calculerRepartition($inventories) {
|
141 |
$text = '';
|
141 |
$text = '';
|
142 |
// Recuperation du positionnement de la carte
|
142 |
// Recuperation du positionnement de la carte
|
143 |
$jpg_txt = file_get_contents(Config::get('Cartes.chemin').str_replace('jpg', 'txt', $this->info['src_map']));
|
143 |
$png_txt = file_get_contents(Config::get('Cartes.chemin').str_replace('png', 'txt', $this->info['src_map']));
|
144 |
parse_str($jpg_txt);
|
144 |
parse_str($png_txt);
|
145 |
// "Resolution" calculer à partir du fichier $jpg_txt par fuseau
|
145 |
// "Resolution" calculer à partir du fichier $png_txt par fuseau
|
146 |
$p['31T'] = ($X231T - $X131T) / ($X231TUTM - $X131TUTM);
|
146 |
$p['31T'] = ($X231T - $X131T) / ($X231TUTM - $X131TUTM);
|
147 |
$p['32T'] = ($X231T - $X131T ) / ($X231TUTM - $X131TUTM);
|
147 |
$p['32T'] = ($X231T - $X131T ) / ($X231TUTM - $X131TUTM);
|
Line 148... |
Line 148... |
148 |
$p['30T'] = ($X231T - $X131T ) / ($X231TUTM - $X131TUTM);
|
148 |
$p['30T'] = ($X231T - $X131T ) / ($X231TUTM - $X131TUTM);
|
Line 190... |
Line 190... |
190 |
if ($utm['name'] != null) {
|
190 |
if ($utm['name'] != null) {
|
191 |
$name = utf8_decode($utm['name']);
|
191 |
$name = utf8_decode($utm['name']);
|
192 |
}
|
192 |
}
|
193 |
$comment = ($this->info['retour'] == self::MIME_MAP) ? $this->cartesFormateur->formerCommentaire($utm, $inventory) : '';
|
193 |
$comment = ($this->info['retour'] == self::MIME_MAP) ? $this->cartesFormateur->formerCommentaire($utm, $inventory) : '';
|
194 |
// On stocke les commentaires pour affichage dans les tooltips
|
194 |
// On stocke les commentaires pour affichage dans les tooltips
|
195 |
// Commentaire deja pr�sent ? : on ajoute � la suite
|
195 |
// Commentaire deja présent ? : on ajoute à la suite
|
196 |
list($text, $merge) = $this->cartesFormateur->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y);
|
196 |
list($text, $merge) = $this->cartesFormateur->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y);
|
197 |
}
|
197 |
}
|
198 |
}
|
198 |
}
|
Line 199... |
Line 199... |
199 |
|
199 |
|
Line 204... |
Line 204... |
204 |
|
204 |
|
205 |
private function formaterCarteVide() {
|
205 |
private function formaterCarteVide() {
|
206 |
$this->cheminCartesBase = Config::get('Cartes.chemin');
|
206 |
$this->cheminCartesBase = Config::get('Cartes.chemin');
|
207 |
$dest_map['vide'] = 'vide_'.$this->info['src_map'];
|
207 |
$dest_map['vide'] = 'vide_'.$this->info['src_map'];
|
208 |
$img['vide'] = imagecreatefromjpeg($this->cheminCartesBase.$this->info['src_map']);
|
208 |
$img['vide'] = imagecreatefromjpeg($this->cheminCartesBase.$this->info['src_map']);
|
209 |
imagejpeg($img['vide'], Config::get('cache.stockageChemin').$dest_map['vide'], 90);
|
209 |
imagepng($img['vide'], Config::get('cache.stockageChemin').$dest_map['vide'], 9);
|
210 |
$retour = Config::get('cel_dst').$dest_map['vide'];
|
210 |
$retour = Config::get('cel_dst').$dest_map['vide'];
|
211 |
if ($this->info['retour'] == self::MIME_MAP) {
|
211 |
if ($this->info['retour'] == self::MIME_MAP) {
|
212 |
$retour = "<img src=\"".$retour."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
|
212 |
$retour = "<img src=\"".$retour."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
|
213 |
}
|
213 |
}
|