-
Notifications
You must be signed in to change notification settings - Fork 104
/
location.go
56 lines (50 loc) · 1.5 KB
/
location.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 location
import "fmt"
// Type enumerates the different topological locations which can occur in a {@link Geometry}.
// The constants are also used as the row and column indices of DE-9IM {@link IntersectionMatrix}es.
type Type int
const (
// Interior is the location value for the interior of a geometry.
// Also, DE-9IM row index of the interior of the first geometry and column index of
// the interior of the second geometry.
Interior Type = iota
// Boundary is the location value for the boundary of a geometry.
// Also, DE-9IM row index of the boundary of the first geometry and column index of
// the boundary of the second geometry.
Boundary
// Exterior is the location value for the exterior of a geometry.
// Also, DE-9IM row index of the exterior of the first geometry and column index of
// the exterior of the second geometry.
Exterior
// None is used for uninitialized location values.
None
)
func (t Type) String() string {
switch t {
case Exterior:
return "Exterior"
case Boundary:
return "Boundary"
case Interior:
return "Interior"
case None:
return "None"
}
panic(fmt.Sprintf("Unknown location value: %v", int(t)))
}
// Symbol converts the location value to a location symbol, for example, Exterior => 'e'
// locationValue
// Returns either 'e', 'b', 'i' or '-'
func (t Type) Symbol() rune {
switch t {
case Exterior:
return 'e'
case Boundary:
return 'b'
case Interior:
return 'i'
case None:
return '-'
}
panic(fmt.Sprintf("Unknown location value: %v", int(t)))
}