Пример #1
0
 /**
  * Encoded WKB from blob
  *
  * This method will copy the given blob to memory descriptor. There's better
  * ways to do this.
  *
  * @param string $blob - Binary safe string
  * @return string
  */
 public function encodeFromBlob($blob)
 {
     $this->fd = fopen('php://memory', 'wb');
     fwrite($this->fd, $blob);
     fseek($this->fd, 0);
     $points = $this->parseWkb();
     fclose($this->fd);
     return parent::Encode($points);
 }
Пример #2
0
 public function testRounding()
 {
     $originalPoints = array(48.000006, 2.000004, 48.00001, 2.0);
     $encoded = Polyline::Encode($originalPoints);
     $this->assertEquals('a_~cH_seK??', $encoded);
     $decodedPoints = Polyline::Decode($encoded);
     $this->assertTrue($decodedPoints[0] === $decodedPoints[2]);
     $this->assertTrue($decodedPoints[1] === $decodedPoints[3]);
 }
Пример #3
0
 /**
  * @covers Polyline::Encode
  * @covers Polyline::Flatten
  */
 public function testEncode()
 {
     // Remove the following lines when you implement this test.
     $this->assertEquals($this->encoded, Polyline::Encode($this->points));
 }