Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 263 | Rev 291 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 263 Rev 276
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe gérant les images.
4
 * Classe gérant les images.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Cartes extends Eflore {
15
class Cartes extends Eflore {
16
 
16
 
17
	private $numero;
17
	private $numero;
18
	private $type; //nt taxonomique ou nn nomenclatural
18
	private $type; //nt taxonomique ou nn nomenclatural
19
	private $largeur;
19
	private $largeur;
20
	
20
	
21
	public function __construct($projet, $numero, $type = 'nt', $largeur = 630) {
21
	public function __construct($projet, $numero, $type = 'nt', $largeur = 630) {
22
		parent::__construct($projet);
22
		parent::__construct($projet);
23
		$this->type = $type;
23
		$this->type = $type;
24
		$this->numero = $numero;
24
		$this->numero = $numero;
25
		$this->largeur = $largeur;
25
		$this->largeur = $largeur;
26
	}
26
	}
27
	
27
	
28
	public function getUrlDataSvg() {
28
	public function getUrlDataSvg() {
29
		switch ($this->type) {
29
		switch ($this->type) {
30
			case 'nn' :
30
			case 'nn' :
31
				$nomTemplate = 'cartesParNnTpl';
31
				$nomTemplate = 'cartesParNnTpl';
32
			break;
32
			break;
33
			case 'nt' : 
33
			case 'nt' : 
34
				$nomTemplate = 'cartesParNtTpl';
34
				$nomTemplate = 'cartesParNtTpl';
35
			break;
35
			break;
36
		}
36
		}
37
		$tpl = Config::get($nomTemplate);
37
		$tpl = Config::get($nomTemplate);
38
		$params = array($this->type => $this->numero, 'largeur' => $this->largeur, 'mime-type' => 'image/svg+xml');
38
		$params = array($this->type => $this->numero, 'largeur' => $this->largeur, 'mime-type' => 'image/svg+xml');
39
		$url = $this->formaterUrl($tpl, $params);
39
		$url = $this->formaterUrl($tpl, $params);
40
		return $url;
40
		return $url;
41
	}
41
	}
42
	
42
	
43
	public function getUrlPng() {
43
	public function getUrlPng() {
44
		switch ($this->type) {
44
		switch ($this->type) {
45
			case 'nn' :
45
			case 'nn' :
46
				$nomTemplate = 'cartesParNnTpl';
46
				$nomTemplate = 'cartesParNnTpl';
47
				break;
47
				break;
48
			case 'nt' :
48
			case 'nt' :
49
				$nomTemplate = 'cartesParNtTpl';
49
				$nomTemplate = 'cartesParNtTpl';
50
				break;
50
				break;
51
		}
51
		}
52
		$tpl = Config::get($nomTemplate);
52
		$tpl = Config::get($nomTemplate);
53
		$params = array($this->type => $this->numero, 'largeur' => $this->largeur, 'mime-type' => 'image/png');
53
		$params = array($this->type => $this->numero, 'largeur' => $this->largeur, 'mime-type' => 'image/png');
54
		$url = $this->formaterUrl($tpl, $params);
54
		$url = $this->formaterUrl($tpl, $params);
55
		return $url;
55
		return $url;
56
	}
56
	}
57
 
57
 
58
	public function getLegende() {
58
	public function getLegende() {
59
		switch ($this->type) {
59
		switch ($this->type) {
60
			case 'nn' :
60
			case 'nn' :
61
				$nomTemplate = 'legendeCartesParNnTpl';
61
				$nomTemplate = 'legendeCartesParNnTpl';
62
			break;
62
			break;
63
			case 'nt' : 
63
			case 'nt' : 
64
				$nomTemplate = 'legendeCartesParNtTpl';
64
				$nomTemplate = 'legendeCartesParNtTpl';
65
			break;
65
			break;
66
		}
66
		}
67
		$tpl = Config::get($nomTemplate);
67
		$tpl = Config::get($nomTemplate);
68
		$params = array($this->type => $this->numero);
68
		$params = array($this->type => $this->numero);
69
		$url = $this->formaterUrl($tpl, $params);
69
		$url = $this->formaterUrl($tpl, $params);
70
		$donnees = $this->chargerDonnees($url);
70
		$donnees = $this->chargerDonnees($url);
-
 
71
		
71
		return $donnees;
72
		return $donnees;
72
	}
73
	}
73
 
74
 
74
}
75
}
75
?>
76
?>