示例#1
0
 /**
  * @dataProvider providerTextBinary
  *
  * @param string $text               The WKT of the geometry under test.
  * @param string $bigEndianBinary    The big endian WKB of the geometry under test.
  * @param string $littleEndianBinary The little endian WKB of the geometry under test.
  */
 public function testAsBinary($text, $bigEndianBinary, $littleEndianBinary)
 {
     $machineByteOrder = WKBTools::getMachineByteOrder();
     if ($machineByteOrder === WKBTools::BIG_ENDIAN) {
         $binary = $bigEndianBinary;
     } else {
         $binary = $littleEndianBinary;
     }
     $this->assertSame($binary, bin2hex(Geometry::fromText($text)->asBinary()));
 }
示例#2
0
文件: WKBBuffer.php 项目: brick/geo
 /**
  * Class constructor.
  *
  * @param string $wkb
  */
 public function __construct($wkb)
 {
     $this->wkb = $wkb;
     $this->length = strlen($wkb);
     $this->machineByteOrder = WKBTools::getMachineByteOrder();
 }
示例#3
0
 /**
  * @param integer $byteOrder The byte order, one of the BIG_ENDIAN or LITTLE_ENDIAN constants.
  *
  * @return void
  *
  * @throws \InvalidArgumentException If the byte order is invalid.
  */
 public function setByteOrder($byteOrder)
 {
     WKBTools::checkByteOrder($byteOrder);
     $this->byteOrder = $byteOrder;
 }