-
-
Notifications
You must be signed in to change notification settings - Fork 191
/
geom.go
56 lines (46 loc) · 1.51 KB
/
geom.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Package geom describes geometry interfaces.
package geom
import "errors"
// ErrUnknownGeometry is returned when the geometry type is unknown or unsupported.
var ErrUnknownGeometry = errors.New("unknown geometry")
// Geometry is an object with a spatial reference.
// if a method accepts a Geometry type it's only expected to support the geom types in this package
type Geometry interface{}
// Pointer is a point with two dimensions.
type Pointer interface {
Geometry
XY() [2]float64
}
// MultiPointer is a geometry with multiple points.
type MultiPointer interface {
Geometry
Points() [][2]float64
}
// LineStringer is a line of two or more points.
type LineStringer interface {
Geometry
Verticies() [][2]float64
}
// MultiLineStringer is a geometry with multiple LineStrings.
type MultiLineStringer interface {
Geometry
LineStrings() [][][2]float64
}
// Polygoner is a geometry consisting of multiple Linear Rings.
// There must be only one exterior LineString with a clockwise winding order.
// There may be one or more interior LineStrings with a counterclockwise winding orders.
// It is assumed that the last point is connected to the first point, and the first point is NOT duplicated at the end.
type Polygoner interface {
Geometry
LinearRings() [][][2]float64
}
// MultiPolygoner is a geometry of multiple polygons.
type MultiPolygoner interface {
Geometry
Polygons() [][][][2]float64
}
// Collectioner is a collections of different geometries.
type Collectioner interface {
Geometry
Geometries() []Geometry
}