Skip to content

Commit 591df7b

Browse files
authored
A Line is actually a LineString, which accepts two or more Points (#268)
1 parent 4a06840 commit 591df7b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/library/cbor/geometry.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ export class GeometryPoint extends Geometry {
3434
}
3535

3636
export class GeometryLine extends Geometry {
37-
readonly line: [GeometryPoint, GeometryPoint];
37+
readonly line: [GeometryPoint, GeometryPoint, ...GeometryPoint[]];
3838

39-
constructor(line: [GeometryPoint, GeometryPoint] | GeometryLine) {
39+
// SurrealDB only has the context of a "Line", which is two points.
40+
// SurrealDB's "Line" is actually a "LineString" under the hood, which accepts two or more points
41+
constructor(
42+
line: [GeometryPoint, GeometryPoint, ...GeometryPoint[]] | GeometryLine,
43+
) {
4044
super();
4145
line = line instanceof GeometryLine ? line.line : line;
4246
this.line = [new GeometryPoint(line[0]), new GeometryPoint(line[1])];

0 commit comments

Comments
 (0)