File tree Expand file tree Collapse file tree 6 files changed +65
-2
lines changed Expand file tree Collapse file tree 6 files changed +65
-2
lines changed Original file line number Diff line number Diff line change 17
17
*/
18
18
final readonly class EwkbReader extends AbstractWkbReader
19
19
{
20
+ public function __construct (
21
+ bool $ supportEmptyPointWithNan = true ,
22
+ ) {
23
+ parent ::__construct ($ supportEmptyPointWithNan );
24
+ }
25
+
20
26
/**
21
27
* @throws GeometryIoException
22
28
*/
Original file line number Diff line number Diff line change 4
4
5
5
namespace Brick \Geo \Io ;
6
6
7
+ use Brick \Geo \Exception \GeometryIoException ;
7
8
use Brick \Geo \Geometry ;
8
9
use Brick \Geo \Io \Internal \AbstractWkbWriter ;
10
+ use Brick \Geo \Io \Internal \WkbByteOrder ;
9
11
use Brick \Geo \Io \Internal \WkbTools ;
10
12
use Override ;
11
13
14
16
*/
15
17
final readonly class EwkbWriter extends AbstractWkbWriter
16
18
{
19
+ /**
20
+ * @param bool $supportEmptyPointWithNan Whether to support PostGIS-style empty points with NaN coordinates.
21
+ *
22
+ * @throws GeometryIoException
23
+ */
24
+ public function __construct (
25
+ ?WkbByteOrder $ byteOrder = null ,
26
+ bool $ supportEmptyPointWithNan = true ,
27
+ ) {
28
+ parent ::__construct ($ byteOrder , $ supportEmptyPointWithNan );
29
+ }
30
+
17
31
#[Override]
18
32
protected function packHeader (Geometry $ geometry , bool $ outer ) : string
19
33
{
Original file line number Diff line number Diff line change 29
29
*/
30
30
abstract readonly class AbstractWkbReader
31
31
{
32
+ /**
33
+ * Whether to support PostGIS-style empty points with NaN coordinates.
34
+ * This is not part of the WKB standard.
35
+ * This will be disabled by default in WKB, but enabled by default in EWKB.
36
+ */
37
+ private bool $ supportEmptyPointWithNan ;
38
+
39
+ public function __construct (
40
+ bool $ supportEmptyPointWithNan ,
41
+ ) {
42
+ $ this ->supportEmptyPointWithNan = $ supportEmptyPointWithNan ;
43
+ }
44
+
32
45
/**
33
46
* @throws GeometryIoException
34
47
*/
Original file line number Diff line number Diff line change 26
26
private WkbByteOrder $ byteOrder ;
27
27
private WkbByteOrder $ machineByteOrder ;
28
28
29
+ /**
30
+ * Whether to support PostGIS-style empty points with NaN coordinates.
31
+ * This is not part of the WKB standard.
32
+ * This will be disabled by default in WKB, but enabled by default in EWKB.
33
+ */
34
+ private bool $ supportEmptyPointWithNan ;
35
+
29
36
/**
30
37
* @throws GeometryIoException
31
38
*/
32
- public function __construct (?WkbByteOrder $ byteOrder = null )
33
- {
39
+ public function __construct (
40
+ ?WkbByteOrder $ byteOrder = null ,
41
+ bool $ supportEmptyPointWithNan ,
42
+ ) {
34
43
$ this ->machineByteOrder = WkbTools::getMachineByteOrder ();
35
44
$ this ->byteOrder = $ byteOrder ?? $ this ->machineByteOrder ;
45
+ $ this ->supportEmptyPointWithNan = $ supportEmptyPointWithNan ;
36
46
}
37
47
38
48
/**
Original file line number Diff line number Diff line change 17
17
*/
18
18
final readonly class WkbReader extends AbstractWkbReader
19
19
{
20
+ public function __construct (
21
+ bool $ supportEmptyPointWithNan = false ,
22
+ ) {
23
+ parent ::__construct ($ supportEmptyPointWithNan );
24
+ }
25
+
20
26
/**
21
27
* @param string $wkb The WKB to read.
22
28
* @param int $srid The optional SRID of the geometry.
Original file line number Diff line number Diff line change 4
4
5
5
namespace Brick \Geo \Io ;
6
6
7
+ use Brick \Geo \Exception \GeometryIoException ;
7
8
use Brick \Geo \Geometry ;
8
9
use Brick \Geo \Io \Internal \AbstractWkbWriter ;
10
+ use Brick \Geo \Io \Internal \WkbByteOrder ;
9
11
use Override ;
10
12
11
13
/**
12
14
* Writes geometries in the WKB format.
13
15
*/
14
16
final readonly class WkbWriter extends AbstractWkbWriter
15
17
{
18
+ /**
19
+ * @param bool $supportEmptyPointWithNan Whether to support PostGIS-style empty points with NaN coordinates.
20
+ *
21
+ * @throws GeometryIoException
22
+ */
23
+ public function __construct (
24
+ ?WkbByteOrder $ byteOrder = null ,
25
+ bool $ supportEmptyPointWithNan = false ,
26
+ ) {
27
+ parent ::__construct ($ byteOrder , $ supportEmptyPointWithNan );
28
+ }
29
+
16
30
#[Override]
17
31
protected function packHeader (Geometry $ geometry , bool $ outer ) : string
18
32
{
You can’t perform that action at this time.
0 commit comments