Subversion Repositories Applications.papyrus

Rev

Rev 612 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 612 Rev 642
Line 27... Line 27...
27
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
27
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
28
*@copyright     Tela-Botanica 2000-2003
28
*@copyright     Tela-Botanica 2000-2003
29
*@version       01 juillet 2002
29
*@version       01 juillet 2002
30
// +-----------------------------------------------------------------------------------------------+
30
// +-----------------------------------------------------------------------------------------------+
31
//
31
//
32
// $Id: lib.carto.php,v 1.2 2005-11-24 16:17:52 florian Exp $
32
// $Id: lib.carto.php,v 1.3 2005-12-07 14:59:14 alexandre_tb Exp $
33
// FICHIER : $RCSfile: lib.carto.php,v $
33
// FICHIER : $RCSfile: lib.carto.php,v $
34
// AUTEUR  : $Author: florian $
34
// AUTEUR  : $Author: alexandre_tb $
35
// VERSION : $Revision: 1.2 $
35
// VERSION : $Revision: 1.3 $
36
// DATE    : $Date: 2005-11-24 16:17:52 $
36
// DATE    : $Date: 2005-12-07 14:59:14 $
37
//
37
//
38
// +-----------------------------------------------------------------------------------------------+
38
// +-----------------------------------------------------------------------------------------------+
39
// A FAIRE :
39
// A FAIRE :
40
// 1.-Rendre cette classe indépendante de l'arborescence du site.
40
// 1.-Rendre cette classe indépendante de l'arborescence du site.
41
//      On trouve encore des urls ou des chemins d'accé au fichier codé en dur dans l'appli
41
//      On trouve encore des urls ou des chemins d'accé au fichier codé en dur dans l'appli
Line 597... Line 597...
597
    // Les informations qui lui sont necessaires sont déjà données à l'objet carte (fond, info_table_couleur).
597
    // Les informations qui lui sont necessaires sont déjà données à l'objet carte (fond, info_table_couleur).
598
    //==============================================================================
598
    //==============================================================================
Line 599... Line 599...
599
    
599
    
600
    function _lancerColoriage ($id_image = '_00', $nom_fichier = '', $id_zone_a_reperer = '') 
600
    function _lancerColoriage ($id_image = '_00', $nom_fichier = '', $id_zone_a_reperer = '') 
-
 
601
    {
601
    {
602
    	
-
 
603
        $this->image = imagecreatefrompng($this->fond);
602
        $this->image = imagecreatefrompng($this->fond);
604
        
603
        $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'],
605
        $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'],
604
                                        $this->_info_table_zg['nom_chp_vert'], $this->_info_table_zg['nom_chp_bleu'], $this->_info_table_zg['nom_chp_zone_sup'],
606
                                        $this->_info_table_zg['nom_chp_vert'], $this->_info_table_zg['nom_chp_bleu'], $this->_info_table_zg['nom_chp_zone_sup'],
605
                                        $this->_info_table_zg['tableau_valeurs_zone'], $id_zone_a_reperer) ;
607
                                        $this->_info_table_zg['tableau_valeurs_zone'], $id_zone_a_reperer) ;
606
        if ($nom_fichier != '') {
608
        if ($nom_fichier != '') {
607
            imagepng(&$this->image, INS_CHEMIN_APPLI.'bibliotheque/tmp/carto/'.$nom_fichier.'.png');
-
 
-
 
609
            imagepng(&$this->image, INS_CHEMIN_APPLI.'bibliotheque/tmp/carto/'.$nom_fichier.'.png');
608
	    echo $nom_fichier;
610
	    
609
            //$this->image = imagepng(&$this->image);
611
            //$this->image = imagepng(&$this->image);
610
        }
612
        }
611
        else {
613
        else {
612
            imagepng(&$this->image, INS_CHEMIN_APPLI.'bibliotheque/tmp/carto/'.$this->id.$id_image.'.png');
614
            imagepng(&$this->image, INS_CHEMIN_APPLI.'bibliotheque/tmp/carto/'.$this->id.$id_image.'.png');
Line 783... Line 785...
783
    {
785
    {
784
        // Nous récupérons le nombre de couleur différentes contenues dans l'image.
786
        // Nous récupérons le nombre de couleur différentes contenues dans l'image.
785
        //echo $this->fond.'<BR>';
787
        //echo $this->fond.'<BR>';
786
        $image_fond = imagecreatefrompng($this->fond);
788
        $image_fond = imagecreatefrompng($this->fond);
787
        $taille_palette = imagecolorstotal ($image_fond);
789
        $taille_palette = imagecolorstotal ($image_fond);
788
        //echo $taille_palette.'<br>';
790
        if (!$image_fond) echo 'erreur fond';
789
        // Pour chaque couleur contenue dans l'image, nous cherchons l'objet correspondant
791
        // Pour chaque couleur contenue dans l'image, nous cherchons l'objet correspondant
790
        // dans le tableau $att, qui contient des informations sur chaque zone de l'image,
792
        // dans le tableau $att, qui contient des informations sur chaque zone de l'image,
791
        // et nous attribuons à l'objet la valeur de l'index de sa couleur dans l'image.
793
        // et nous attribuons à l'objet la valeur de l'index de sa couleur dans l'image.
Line 792... Line 794...
792
        
794
        
793
        for ($i = 0; $i < $taille_palette; $i++) {
795
        for ($i = 0; $i < $taille_palette; $i++) {
794
            $valeurs_RVB = array();
796
            $valeurs_RVB = array();
-
 
797
            $valeurs_RVB = imagecolorsforindex ($image_fond, $i);
795
            $valeurs_RVB = imagecolorsforindex ($image_fond, $i);
798
            
Line 796... Line 799...
796
            for ($j = 0; $j < count ($att); $j++) {
799
            for ($j = 0; $j < count ($att); $j++) {
797
                
800
                
798
                if (($att[$j]->rouge == $valeurs_RVB['red']) && ($att[$j]->vert == $valeurs_RVB['green']) && ($att[$j]->bleu == $valeurs_RVB['blue'])) {
801
                if (($att[$j]->rouge == $valeurs_RVB['red']) && ($att[$j]->vert == $valeurs_RVB['green']) && ($att[$j]->bleu == $valeurs_RVB['blue'])) {
Line 1181... Line 1184...
1181
}
1184
}
Line 1182... Line 1185...
1182
 
1185
 
1183
//-- Fin du code source  ------------------------------------------------------------
1186
//-- Fin du code source  ------------------------------------------------------------
1184
/*
1187
/*
-
 
1188
* $Log: not supported by cvs2svn $
-
 
1189
* Revision 1.2  2005/11/24 16:17:52  florian
-
 
1190
* changement template inscription + modifs carto
1185
* $Log: not supported by cvs2svn $
1191
*
1186
* Revision 1.1  2005/09/22 14:02:49  ddelon
1192
* Revision 1.1  2005/09/22 14:02:49  ddelon
1187
* nettoyage annuaire et php5
1193
* nettoyage annuaire et php5
1188
*
1194
*
1189
* Revision 1.2  2005/09/22 13:30:49  florian
1195
* Revision 1.2  2005/09/22 13:30:49  florian