/** * @covers InputConverter::setPoint * @covers InputConverter::getPoint */ public function testSetPoint() { $point = \GeomPoint::fromXY(12, 21); $map = array(); $this->converter->setPoint($map, "key", $point); $expected = array("key_X" => 12, "key_Y" => 21, "key" => $point); $this->assertEquals($expected, $map); $actual = $this->converter->getPoint($map, "key"); $this->assertEquals($point, $actual); }
/** * @covers GeomPoint::getHemisphere */ public function testGetHemisphere() { $point = \GeomPoint::fromXY(21, 3.32); $this->assertEquals(\GeomPoint::NORTHERN_HEMISPHERE, $point->getHemisphere()); $point = \GeomPoint::fromXY(21, -3.32); $this->assertEquals(\GeomPoint::SOUTHERN_HEMISPHERE, $point->getHemisphere()); }
/** * Create a string (with WKT format) from longitude and latitude * WKT format for point type: POINT(X Y) * * @return GeomPoint|null if values are not set properly in the map. */ public function getPoint($map, $key) { $x = $this->getValue($map, $key . '_X'); $y = $this->getValue($map, $key . '_Y'); if (!is_numeric($x) && !is_numeric($y)) { return null; } return GeomPoint::fromXY($x, $y); }