* @author Jean-Pascal MILCENT * @author Aurelien PERONNET * @license GPL v3 * @license CECILL v2 * @copyright 1999-2014 Tela Botanica */ class Point { private $parametres = array(); private $ressources = array(); private $coordonnees = array(); public function consulter($ressources, $parametres) { $this->ressources = $ressources; $this->parametres = $parametres; $retour = null; try { $this->transformerCoordonnees(); $retour = $this->coordonnees; } catch (Exception $erreur) { $retour = $erreur->getMessage(); } return $retour; } private function transformerCoordonnees() { $proj4 = new Proj4php(); $projSource = new Proj4phpProj('EPSG:'.$this->parametres['epsg-src'], $proj4); $projDestination = new Proj4phpProj('EPSG:'.$this->parametres['epsg-dest'], $proj4); $pointSrc = new proj4phpPoint($this->parametres['x'], $this->parametres['y']); $pointDest = $proj4->transform($projSource, $projDestination, $pointSrc); $this->coordonnees['x'] = round($pointDest->x, 5); $this->coordonnees['y'] = round($pointDest->y, 5); $this->coordonnees['EPSG'] = $this->parametres['epsg-dest']; } }