Esempio n. 1
0
 public function prepare($template)
 {
     $formatter = new Coordinate_Formatter();
     $coordinate = $this->getCoordinate();
     $template->assign(self::lat_hem, $formatter->formatLatHem($coordinate));
     $template->assign(self::lat_deg, $formatter->formatLatDeg($coordinate));
     $template->assign(self::lat_min, $formatter->formatLatMin($coordinate));
     $template->assign(self::lon_hem, $formatter->formatLonHem($coordinate));
     $template->assign(self::lon_deg, $formatter->formatLonDeg($coordinate));
     $template->assign(self::lon_min, $formatter->formatLonMin($coordinate));
     if (!$this->valid) {
         $template->assign(self::coord_error, $this->translator->translate('Invalid coordinate'));
     }
 }
 function testFormatLatitudeDegree()
 {
     $formatter = new Coordinate_Formatter();
     $this->assertIdentical('00', $formatter->formatLatDeg(new Coordinate_Coordinate(0, 2)));
     $this->assertIdentical('01', $formatter->formatLatDeg(new Coordinate_Coordinate(1, 2)));
     $this->assertIdentical('10', $formatter->formatLatDeg(new Coordinate_Coordinate(10, 2)));
     $this->assertIdentical('00', $formatter->formatLatDeg(new Coordinate_Coordinate(-0.1, 2)));
     $this->assertIdentical('01', $formatter->formatLatDeg(new Coordinate_Coordinate(-1, 2)));
     $this->assertIdentical('10', $formatter->formatLatDeg(new Coordinate_Coordinate(-10, 2)));
 }