Exemple #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()));
 }
Exemple #2
0
 /**
  * Class constructor.
  *
  * @param string $wkb
  */
 public function __construct($wkb)
 {
     $this->wkb = $wkb;
     $this->length = strlen($wkb);
     $this->machineByteOrder = WKBTools::getMachineByteOrder();
 }
Exemple #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;
 }