| Line 19... |
Line 19... |
| 19 |
// | |
|
19 |
// | |
|
| 20 |
// | You should have received a copy of the GNU General Public License |
|
20 |
// | You should have received a copy of the GNU General Public License |
|
| 21 |
// | along with Foobar; if not, write to the Free Software |
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
| 22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
// +------------------------------------------------------------------------------------------------------+
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
| 24 |
// CVS : $Id: carto_carte.class.php,v 1.1 2005-02-22 12:02:57 jpm Exp $
|
24 |
// CVS : $Id: carto_carte.class.php,v 1.2 2005-02-22 16:35:16 jpm Exp $
|
| 25 |
/**
|
25 |
/**
|
| 26 |
* Classe Carto_Carte.
|
26 |
* Classe Carto_Carte.
|
| 27 |
*
|
27 |
*
|
| 28 |
* Calsse permettant de réaliser des cartes.
|
28 |
* Calsse permettant de réaliser des cartes.
|
| 29 |
*
|
29 |
*
|
| Line 32... |
Line 32... |
| 32 |
*@author Nicolas MATHIEU
|
32 |
*@author Nicolas MATHIEU
|
| 33 |
//Autres auteurs :
|
33 |
//Autres auteurs :
|
| 34 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
34 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 35 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
35 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
| 36 |
*@copyright Tela-Botanica 2000-2004
|
36 |
*@copyright Tela-Botanica 2000-2004
|
| 37 |
*@version $Revision: 1.1 $ $Date: 2005-02-22 12:02:57 $
|
37 |
*@version $Revision: 1.2 $ $Date: 2005-02-22 16:35:16 $
|
| 38 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
| 39 |
*/
|
39 |
*/
|
| Line 40... |
Line 40... |
| 40 |
|
40 |
|
| 41 |
// +------------------------------------------------------------------------------------------------------+
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 46... |
Line 46... |
| 46 |
require 'carto_historique.class.php';
|
46 |
require 'carto_historique.class.php';
|
| Line 47... |
Line 47... |
| 47 |
|
47 |
|
| 48 |
// +------------------------------------------------------------------------------------------------------+
|
48 |
// +------------------------------------------------------------------------------------------------------+
|
| 49 |
// | CORPS du PROGRAMME |
|
49 |
// | CORPS du PROGRAMME |
|
| - |
|
50 |
// +------------------------------------------------------------------------------------------------------+
|
| - |
|
51 |
/**
|
| 50 |
// +------------------------------------------------------------------------------------------------------+
|
52 |
* Classe Carto_Carte() - Classe principale de la cartographie.
|
| - |
|
53 |
*
|
| - |
|
54 |
* La classe Carto_Carte permet de travailler les fichiers images des cartes.
|
| 51 |
|
55 |
*/
|
| 52 |
class Carto_Carte
|
56 |
class Carto_Carte
|
| - |
|
57 |
{
|
| - |
|
58 |
// +--------------------------------------------------------------------------------------------------+
|
| 53 |
{
|
59 |
// LES ATTRIBUTS DE LA CLASSE
|
| 54 |
var $id;
|
60 |
var $id;
|
| 55 |
var $_id_zone_geo_carte;
|
61 |
var $_id_zone_geo_carte;
|
| 56 |
var $nom;
|
62 |
var $nom;
|
| 57 |
var $masque;
|
63 |
var $masque;
|
| Line 84... |
Line 90... |
| 84 |
var $_maxiB;
|
90 |
var $_maxiB;
|
| 85 |
//Le type de formule mathématique permettant de colorier la carte
|
91 |
//Le type de formule mathématique permettant de colorier la carte
|
| 86 |
var $_formule_coloriage;
|
92 |
var $_formule_coloriage;
|
| 87 |
//L'action à réaliser
|
93 |
//L'action à réaliser
|
| 88 |
var $_action;
|
94 |
var $_action;
|
| - |
|
95 |
|
| 89 |
// +--------------------------------------------------------------------------------------------------+
|
96 |
// +--------------------------------------------------------------------------------------------------+
|
| 90 |
// Conifugration de la carto
|
97 |
// Conifugration de la carto
|
| 91 |
var $_maxiB;
|
98 |
var $_maxiB;
|
| Line 92... |
Line 99... |
| 92 |
|
99 |
|
| - |
|
100 |
|
| 93 |
|
101 |
// +--------------------------------------------------------------------------------------------------+
|
| 94 |
// +--------------------------------------------------------------------------------------------------+
|
102 |
// LE CONSTRUCTEUR DE LA CLASSE
|
| 95 |
function Carto_Carte($id, $id_zone_geo_carte, $nom, $masque, $fond, $chemin, $info_table)
|
103 |
function Carto_Carte($id, $id_zone_geo_carte, $nom, $masque, $fond, $chemin, $info_table_zg, $info_table_action)
|
| 96 |
{
|
104 |
{
|
| 97 |
$this->id = $id;
|
105 |
$this->id = $id;
|
| 98 |
$this->_id_zone_geo_carte = $id_zone_geo_carte;
|
106 |
$this->_id_zone_geo_carte = $id_zone_geo_carte;
|
| 99 |
$this->nom = $nom;
|
107 |
$this->nom = $nom;
|
| 100 |
$this->masque = $chemin.$masque;
|
108 |
$this->masque = $chemin.$masque;
|
| 101 |
$this->fond = $chemin.$fond;
|
109 |
$this->fond = $chemin.$fond;
|
| Line 102... |
Line 110... |
| 102 |
$this->chemin = $chemin;
|
110 |
$this->chemin = $chemin;
|
| 103 |
$this->_info_table_zg = $info_table;
|
- |
|
| 104 |
|
111 |
$this->_info_table_zg = $info_table_zg;
|
| 105 |
$this->_action = new Carto_Action($info_table['nom_table_zone'],$info_table['nom_chp_id_zone'], $info_table['nom_chp_rouge'], $info_table['nom_chp_vert'], $info_table['nom_chp_bleu'],
|
112 |
|
| 106 |
'carto_ACTION', 'CA_ID_Carte', 'CA_ID_Zone_geo', 'CA_Type_zone', 'CA_Action', 'CA_ID_Carte_destination');
|
113 |
$this->_action = new Carto_Action($info_table_zg, $info_table_action);
|
| 107 |
$this->fils = array();
|
114 |
$this->fils = array();
|
| 108 |
$this->filiation = $id;
|
115 |
$this->filiation = $id;
|
| 109 |
$this->historique_cartes = '';
|
116 |
$this->historique_cartes = '';
|
| 110 |
$this->liste_zone_carte = '';
|
117 |
$this->liste_zone_carte = '';
|
| 111 |
$this->definirCouleurs();
|
- |
|
| Line -... |
Line 118... |
| - |
|
118 |
$this->definirCouleurs();
|
| - |
|
119 |
$this->definirFormuleColoriage();
|
| 112 |
$this->definirFormuleColoriage();
|
120 |
}
|
| 113 |
}
|
121 |
|
| 114 |
// +--------------------------------------------------------------------------------------------------+
|
122 |
// +--------------------------------------------------------------------------------------------------+
|
| 115 |
|
123 |
// LES METHODES PUBLIQUES
|
| 116 |
function definirCouleurs (
|
124 |
function definirCouleurs (
|
| Line 178... |
Line 186... |
| 178 |
// -soit il a sélectionné une zone géographique dans la liste déroulante.
|
186 |
// -soit il a sélectionné une zone géographique dans la liste déroulante.
|
| 179 |
// Elle renvoit a la fin:
|
187 |
// Elle renvoit a la fin:
|
| 180 |
// -soit une nouvelle carte coloriée
|
188 |
// -soit une nouvelle carte coloriée
|
| 181 |
// -soit false.
|
189 |
// -soit false.
|
| 182 |
//**********************************************************************************************************
|
190 |
//**********************************************************************************************************
|
| 183 |
|
- |
|
| 184 |
function donnerFormulaireImage ()
|
191 |
function donnerFormulaireImage ()
|
| 185 |
{
|
192 |
{
|
| 186 |
global $GS_GLOBAL;
|
193 |
//global $GS_GLOBAL;
|
| 187 |
$res = '';
|
194 |
$res = '';
|
| Line 188... |
Line 195... |
| 188 |
|
195 |
|
| 189 |
// Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
|
196 |
// Nous commençons par tester tout d'abords si nous venons d'une autre carte. Pour cela nous vérifions,
|
| 190 |
// si les attributs $this->image_x et $this->image_y de la classe Carte existe ou ne sont pas null.
|
197 |
// si les attributs $this->image_x et $this->image_y de la classe Carte existe ou ne sont pas null.
|
| Line 200... |
Line 207... |
| 200 |
// en fonction des coordonnées du clic l'action à entreprendre.
|
207 |
// en fonction des coordonnées du clic l'action à entreprendre.
|
| Line 201... |
Line 208... |
| 201 |
|
208 |
|
| 202 |
|
209 |
|
| 203 |
// Quoi qu'il arrive, on ouvre la balise formulaire
|
210 |
// Quoi qu'il arrive, on ouvre la balise formulaire
|
| 204 |
$res = '<form action="'.$this->url.'" method="post">'."\n";
|
211 |
$res = '<form action="'.$this->url.'" method="post">'."\n";
|
| 205 |
$res .= '<p>'.CAR_CLIQUER_ACCEDER ;
|
212 |
$res .= '<p>';
|
| 206 |
if (isset ($this->image_x) && ($this->image_x != '') && isset ($this->image_y) && ($this->image_y != '')) {
|
213 |
if (isset ($this->image_x) && ($this->image_x != '') && isset ($this->image_y) && ($this->image_y != '')) {
|
| Line 207... |
Line 214... |
| 207 |
// on regarde ici si l'on a pas un objet de plus bas niveau présent dans la variable de session carte
|
214 |
// on regarde ici si l'on a pas un objet de plus bas niveau présent dans la variable de session carte
|
| Line 208... |
Line 215... |
| 208 |
//a charger a la place de l'objet de plus haut niveau
|
215 |
//a charger a la place de l'objet de plus haut niveau
|
| 209 |
|
216 |
|
| 210 |
$var_session_retour = $_SESSION['carte'] ;
|
217 |
$var_session_retour = $_SESSION['carte'];
|
| 211 |
|
218 |
|
| Line 222... |
Line 229... |
| 222 |
}
|
229 |
}
|
| 223 |
}
|
230 |
}
|
| 224 |
$this->image_x = $image_x;
|
231 |
$this->image_x = $image_x;
|
| 225 |
$this->image_y = $image_y;
|
232 |
$this->image_y = $image_y;
|
| 226 |
$this->liste_zone_carte = $liste_zone_carte;
|
233 |
$this->liste_zone_carte = $liste_zone_carte;
|
| 227 |
unset ($_SESSION['carte']) ;
|
234 |
unset($_SESSION['carte']) ;
|
| 228 |
}
|
235 |
}
|
| Line 229... |
Line 236... |
| 229 |
|
236 |
|
| Line 230... |
Line 237... |
| 230 |
// on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
|
237 |
// on regarde qu'est-ce qu'on doit faire grace a la methode _consulterAction() de l'objet Carto_Action
|
| Line 240... |
Line 247... |
| 240 |
$res .= ''.$this->fils[$id_carte_destination]->_donnerListeZoneCarte()."<br />\n";
|
247 |
$res .= ''.$this->fils[$id_carte_destination]->_donnerListeZoneCarte()."<br />\n";
|
| 241 |
$res .= '<input type="image" src="';
|
248 |
$res .= '<input type="image" src="';
|
| 242 |
$id_image = $this->_donnerIdUnique();
|
249 |
$id_image = $this->_donnerIdUnique();
|
| 243 |
$this->fils[$id_carte_destination]->_lancerColoriage($id_image);
|
250 |
$this->fils[$id_carte_destination]->_lancerColoriage($id_image);
|
| 244 |
$obj = serialize($this->fils[$id_carte_destination]);
|
251 |
$obj = serialize($this->fils[$id_carte_destination]);
|
| 245 |
$_SESSION['carte'] = $obj ;
|
252 |
$_SESSION['carte'] = $obj;
|
| 246 |
$this->historique = $this->fils[$id_carte_destination]->filiation;
|
253 |
$this->historique = $this->fils[$id_carte_destination]->filiation;
|
| 247 |
$this->id = $this->fils[$id_carte_destination]->id;
|
254 |
$this->id = $this->fils[$id_carte_destination]->id;
|
| 248 |
$this->nom = $this->fils[$id_carte_destination]->nom;
|
255 |
$this->nom = $this->fils[$id_carte_destination]->nom;
|
| 249 |
}
|
256 |
}
|
| 250 |
//Dans le cas où l'on veut rappeler une nouvelle carte, il se peut que la nouvelle carte à rappeler
|
257 |
//Dans le cas où l'on veut rappeler une nouvelle carte, il se peut que la nouvelle carte à rappeler
|
| Line 319... |
Line 326... |
| 319 |
$this->historique = $this->id;
|
326 |
$this->historique = $this->id;
|
| 320 |
$obj = serialize($this);
|
327 |
$obj = serialize($this);
|
| Line 321... |
Line 328... |
| 321 |
|
328 |
|
| 322 |
$_SESSION['carte'] = $obj ;
|
329 |
$_SESSION['carte'] = $obj ;
|
| 323 |
}
|
330 |
}
|
| 324 |
$res .= CAR_CHEMIN_LIBRAIRIE.'/lib.carto.extractimg.php?fichier='.$this->id.$id_image.'"';
|
331 |
$res .= sprintf(CAR_CHEMIN_CARTE, urlencode(CAR_CHEMIN_TMP), $this->id.$id_image).'"';
|
| 325 |
$res .= ' name="image" onmouseover="javascript:show(\'d\');" onmouseout="javascript:show(\'d\');" />'."\n";
|
332 |
$res .= ' name="image" onmouseover="javascript:show(\'d\');" onmouseout="javascript:show(\'d\');" />'."\n";
|
| 326 |
$res .= '<input type="hidden" name="historique_cartes" value="'.$this->historique.'" /></p>';
|
333 |
$res .= '<input type="hidden" name="historique_cartes" value="'.$this->historique.'" /></p>';
|
| 327 |
$res .= '</form>'."\n";
|
334 |
$res .= '</form>'."\n";
|
| 328 |
return $res;
|
335 |
return $res;
|
| Line 329... |
Line 336... |
| 329 |
}
|
336 |
}
|
| 330 |
|
337 |
|
| 331 |
/*|=============================================================================================|*/
|
- |
|
| 332 |
/*| LES METHODES PRIVEES |*/
|
338 |
// +--------------------------------------------------------------------------------------------------+
|
| 333 |
/*|---------------------------------------------------------------------------------------------|*/
|
339 |
// LES METHODES PRIVÉES
|
| 334 |
function _donnerListeZoneCarte($zone_par_defaut = '')
|
340 |
function _donnerListeZoneCarte($zone_par_defaut = '')
|
| Line 335... |
Line 341... |
| 335 |
{
|
341 |
{
|
| Line 348... |
Line 354... |
| 348 |
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
|
354 |
' WHERE '.$this->_info_table_zg['nom_chp_zone_sup'].' = '.$this->_id_zone_geo_carte;
|
| 349 |
}
|
355 |
}
|
| 350 |
}
|
356 |
}
|
| 351 |
$requete .=
|
357 |
$requete .=
|
| 352 |
' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
|
358 |
' ORDER BY '.$this->_info_table_zg['nom_chp_nom_zone'].' ASC';
|
| 353 |
echo $requete;
|
- |
|
| - |
|
359 |
|
| 354 |
$resultat = mysql_query ($requete) or die('
|
360 |
$resultat = mysql_query ($requete) or die('
|
| 355 |
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
|
361 |
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
|
| 356 |
'<b>Requete : </b>'.$requete.
|
362 |
'<b>Requete : </b>'.$requete.
|
| 357 |
'<br/><br/><b>Erreur : </b>'.mysql_error());
|
363 |
'<br/><br/><b>Erreur : </b>'.mysql_error());
|
| Line 391... |
Line 397... |
| 391 |
$this->image = imagecreatefrompng($this->fond);
|
397 |
$this->image = imagecreatefrompng($this->fond);
|
| 392 |
$this->_colorierImage ($this->image, $this->_info_table_zg['nom_table_zone'], $this->_info_table_zg['nom_chp_id_zone'], $this->_info_table_zg['nom_chp_rouge'],
|
398 |
$this->_colorierImage ($this->image, $this->_info_table_zg['nom_table_zone'], $this->_info_table_zg['nom_chp_id_zone'], $this->_info_table_zg['nom_chp_rouge'],
|
| 393 |
$this->_info_table_zg['nom_chp_vert'], $this->_info_table_zg['nom_chp_bleu'], $this->_info_table_zg['nom_chp_zone_sup'],
|
399 |
$this->_info_table_zg['nom_chp_vert'], $this->_info_table_zg['nom_chp_bleu'], $this->_info_table_zg['nom_chp_zone_sup'],
|
| 394 |
$this->_info_table_zg['tableau_valeurs_zone'], $id_zone_a_reperer) ;
|
400 |
$this->_info_table_zg['tableau_valeurs_zone'], $id_zone_a_reperer) ;
|
| 395 |
if ($nom_fichier != '') {
|
401 |
if ($nom_fichier != '') {
|
| 396 |
imagepng(&$this->image,'tmp/carto/'.$nom_fichier.'.png');
|
402 |
imagepng(&$this->image, CAR_CHEMIN_TMP.$nom_fichier.'.png');
|
| 397 |
//$this->image = imagepng(&$this->image);
|
403 |
//$this->image = imagepng(&$this->image);
|
| 398 |
}
|
404 |
}
|
| 399 |
else {
|
405 |
else {
|
| 400 |
imagepng(&$this->image,'tmp/carto/'.$this->id.$id_image.'.png');
|
406 |
imagepng(&$this->image, CAR_CHEMIN_TMP.$this->id.$id_image.'.png');
|
| 401 |
//imagepng(&$this->image);
|
407 |
//imagepng(&$this->image);
|
| 402 |
}
|
408 |
}
|
| 403 |
}
|
409 |
}
|
| Line 404... |
Line 410... |
| 404 |
|
410 |
|
| Line 778... |
Line 784... |
| 778 |
}//Fin de la méthode _donnerIdUnique()
|
784 |
}//Fin de la méthode _donnerIdUnique()
|
| Line 779... |
Line 785... |
| 779 |
|
785 |
|
| Line 780... |
Line -... |
| 780 |
|
- |
|
| 781 |
}//Fin de la classe Carto_Carte()
|
- |
|
| 782 |
|
- |
|
| 783 |
|
- |
|
| 784 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 785 |
|
- |
|
| 786 |
|
- |
|
| 787 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 788 |
// | LISTE de FONCTIONS |
|
- |
|
| 789 |
// +------------------------------------------------------------------------------------------------------+
|
- |
|
| 790 |
|
- |
|
| 791 |
|
786 |
|
| 792 |
|
787 |
}//Fin de la classe Carto_Carte()
|
| 793 |
|
788 |
|