function testFormatLongitudeDegree() { $formatter = new Coordinate_Formatter(); $this->assertIdentical('000', $formatter->formatLonDeg(new Coordinate_Coordinate(2, 0))); $this->assertIdentical('001', $formatter->formatLonDeg(new Coordinate_Coordinate(2, 1))); $this->assertIdentical('010', $formatter->formatLonDeg(new Coordinate_Coordinate(2, 10))); $this->assertIdentical('100', $formatter->formatLonDeg(new Coordinate_Coordinate(2, 100))); $this->assertIdentical('000', $formatter->formatLonDeg(new Coordinate_Coordinate(2, -0.1))); $this->assertIdentical('001', $formatter->formatLonDeg(new Coordinate_Coordinate(2, -1))); $this->assertIdentical('010', $formatter->formatLonDeg(new Coordinate_Coordinate(2, -10))); $this->assertIdentical('100', $formatter->formatLonDeg(new Coordinate_Coordinate(2, -100))); }
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')); } }