Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 290 → Rev 291

/trunk/metier/api_0.1/Cartes.php
14,61 → 14,36
*/
class Cartes extends Eflore {
 
private $numero;
private $type; //nt taxonomique ou nn nomenclatural
private $id;
private $largeur;
public function __construct($projet, $numero, $type = 'nt', $largeur = 630) {
parent::__construct($projet);
$this->type = $type;
$this->numero = $numero;
 
public function setId($id) {
$this->id = $id;
}
 
public function setLargeur($largeur) {
$this->largeur = $largeur;
}
 
public function getUrlDataSvg() {
switch ($this->type) {
case 'nn' :
$nomTemplate = 'cartesParNnTpl';
break;
case 'nt' :
$nomTemplate = 'cartesParNtTpl';
break;
}
$tpl = Config::get($nomTemplate);
$params = array($this->type => $this->numero, 'largeur' => $this->largeur, 'mime-type' => 'image/svg+xml');
$tpl = Config::get('carteTpl');
$params = array('id' => $this->id, 'largeur' => $this->largeur, 'mime-type' => 'image/svg+xml');
$url = $this->formaterUrl($tpl, $params);
return $url;
}
 
public function getUrlPng() {
switch ($this->type) {
case 'nn' :
$nomTemplate = 'cartesParNnTpl';
break;
case 'nt' :
$nomTemplate = 'cartesParNtTpl';
break;
}
$tpl = Config::get($nomTemplate);
$params = array($this->type => $this->numero, 'largeur' => $this->largeur, 'mime-type' => 'image/png');
$tpl = Config::get('carteTpl');
$params = array('id' => $this->id, 'largeur' => $this->largeur, 'mime-type' => 'image/png');
$url = $this->formaterUrl($tpl, $params);
return $url;
}
 
public function getLegende() {
switch ($this->type) {
case 'nn' :
$nomTemplate = 'legendeCartesParNnTpl';
break;
case 'nt' :
$nomTemplate = 'legendeCartesParNtTpl';
break;
}
$tpl = Config::get($nomTemplate);
$params = array($this->type => $this->numero);
$tpl = Config::get('legendeCarteTpl');
$params = array('id' => $this->id);
$url = $this->formaterUrl($tpl, $params);
$donnees = $this->chargerDonnees($url);
return $donnees;
}