Ejemplo n.º 1
0
 /**
  * @covers h4kuna\DataType\Location\Gps::fromString
  * @todo   Implement testFromString().
  */
 public function testFromString()
 {
     // Praha
     $expected = array('50.0835494', '14.4341414');
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494N, 14.4341414E')));
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494, 14.4341414')));
     $this->assertSame($expected, self::round7(Gps::fromString("N 50°5.012965', E 14°26.048485'")));
     $this->assertSame($expected, self::round7(Gps::fromString('50°5\'0.778"N, 14°26\'2.909"E')));
     $this->assertSame($expected, self::round7(Gps::fromString('N50.0835494° E14.4341414°')));
     // no whitespace
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494N,14.4341414E')));
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494,14.4341414')));
     $this->assertSame($expected, self::round7(Gps::fromString("N50°5.012965',E14°26.048485'")));
     $this->assertSame($expected, self::round7(Gps::fromString('50°5\'0.778"N,14°26\'2.909"E')));
     $this->assertSame($expected, self::round7(Gps::fromString('N50.0835494°E14.4341414°')));
     $expected = array('-50.0835494', '14.4341414');
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494S, 14.4341414E')));
     $expected = array('50.0835494', '-14.4341414');
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494N, 14.4341414W')));
     $expected = array('-50.0835494', '-14.4341414');
     $this->assertSame($expected, self::round7(Gps::fromString('50.0835494S, 14.4341414W')));
 }
Ejemplo n.º 2
0
 /**
  * @param string $value
  * @return Floats[]
  */
 public static function toGps($value)
 {
     return Location\Gps::fromString($value);
 }