mirror of https://github.com/tidwall/tile38.git
Fix packages not vendoring on build
This commit is contained in:
parent
6ffdf7b0ef
commit
c567512600
1
go.sum
1
go.sum
|
@ -61,6 +61,7 @@ github.com/tidwall/geoindex v1.1.0 h1:d/pGCgKUonfQINd1235kKqx9gWBU4N7GjDS9WvbPvL
|
||||||
github.com/tidwall/geoindex v1.1.0/go.mod h1:3gTa91BW+eiVIipuR6aU1Y9Sa0q75b1teE/NP2vfsTc=
|
github.com/tidwall/geoindex v1.1.0/go.mod h1:3gTa91BW+eiVIipuR6aU1Y9Sa0q75b1teE/NP2vfsTc=
|
||||||
github.com/tidwall/geojson v1.1.8 h1:n/WT/PG0OEHrxUJQoeqkupWDt3pwbHMynl6OF9xKIM0=
|
github.com/tidwall/geojson v1.1.8 h1:n/WT/PG0OEHrxUJQoeqkupWDt3pwbHMynl6OF9xKIM0=
|
||||||
github.com/tidwall/geojson v1.1.8/go.mod h1:tBjfxeALRFLc25LLpjtWzy2nIrNmW1ze1EAhLtd8+QQ=
|
github.com/tidwall/geojson v1.1.8/go.mod h1:tBjfxeALRFLc25LLpjtWzy2nIrNmW1ze1EAhLtd8+QQ=
|
||||||
|
github.com/tidwall/geojson v1.1.10 h1:ALzsrTn62pq65DudSQpYDjjCUaq6dP1XQm51GVYgJyo=
|
||||||
github.com/tidwall/geojson v1.1.10/go.mod h1:tBjfxeALRFLc25LLpjtWzy2nIrNmW1ze1EAhLtd8+QQ=
|
github.com/tidwall/geojson v1.1.10/go.mod h1:tBjfxeALRFLc25LLpjtWzy2nIrNmW1ze1EAhLtd8+QQ=
|
||||||
github.com/tidwall/gjson v1.3.2 h1:+7p3qQFaH3fOMXAJSrdZwGKcOO/lYdGS0HqGhPqDdTI=
|
github.com/tidwall/gjson v1.3.2 h1:+7p3qQFaH3fOMXAJSrdZwGKcOO/lYdGS0HqGhPqDdTI=
|
||||||
github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
|
github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
|
||||||
|
|
|
@ -34,6 +34,7 @@ export CGO_ENABLED=0
|
||||||
if [ "$NOMODULES" != "1" ]; then
|
if [ "$NOMODULES" != "1" ]; then
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
export GOFLAGS=-mod=vendor
|
export GOFLAGS=-mod=vendor
|
||||||
|
go mod vendor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build and store objects into original directory.
|
# Build and store objects into original directory.
|
||||||
|
|
|
@ -103,13 +103,6 @@ func (g *Circle) Contains(obj Object) bool {
|
||||||
return g.containsPoint(other.Center())
|
return g.containsPoint(other.Center())
|
||||||
case *Circle:
|
case *Circle:
|
||||||
return other.Distance(g) < (other.meters + g.meters)
|
return other.Distance(g) < (other.meters + g.meters)
|
||||||
case *LineString:
|
|
||||||
for i := 0; i < other.base.NumPoints(); i++ {
|
|
||||||
if !g.containsPoint(other.base.PointAt(i)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
case Collection:
|
case Collection:
|
||||||
for _, p := range other.Children() {
|
for _, p := range other.Children() {
|
||||||
if !g.Contains(p) {
|
if !g.Contains(p) {
|
||||||
|
@ -123,36 +116,6 @@ func (g *Circle) Contains(obj Object) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// intersectsSegment returns true if the circle intersects a given segment
|
|
||||||
func (g *Circle) intersectsSegment(seg geometry.Segment) bool {
|
|
||||||
start, end := seg.A, seg.B
|
|
||||||
|
|
||||||
// These are faster checks.
|
|
||||||
// If they succeed there's no need do complicate things.
|
|
||||||
if g.containsPoint(start) || g.containsPoint(end) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Distance between start and end
|
|
||||||
l := geo.DistanceTo(start.Y, start.X, end.Y, end.X)
|
|
||||||
|
|
||||||
// Unit direction vector
|
|
||||||
dx := (end.X - start.X) / l
|
|
||||||
dy := (end.Y - start.Y) / l
|
|
||||||
|
|
||||||
// Point of the line closest to the center
|
|
||||||
t := dx*(g.center.X-start.X) + dy*(g.center.Y-start.Y)
|
|
||||||
px := t*dx + start.X
|
|
||||||
py := t*dy + start.Y
|
|
||||||
if px < start.X || px > end.X || py < start.Y || py > end.Y {
|
|
||||||
// closest point is outside the segment
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Distance from the closest point to the center
|
|
||||||
return g.containsPoint(geometry.Point{X: px, Y: py})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Intersects returns true the circle intersects other object
|
// Intersects returns true the circle intersects other object
|
||||||
func (g *Circle) Intersects(obj Object) bool {
|
func (g *Circle) Intersects(obj Object) bool {
|
||||||
switch other := obj.(type) {
|
switch other := obj.(type) {
|
||||||
|
@ -160,13 +123,6 @@ func (g *Circle) Intersects(obj Object) bool {
|
||||||
return g.containsPoint(other.Center())
|
return g.containsPoint(other.Center())
|
||||||
case *Circle:
|
case *Circle:
|
||||||
return other.Distance(g) <= (other.meters + g.meters)
|
return other.Distance(g) <= (other.meters + g.meters)
|
||||||
case *LineString:
|
|
||||||
for i := 0; i < other.base.NumSegments(); i++ {
|
|
||||||
if g.intersectsSegment(other.base.SegmentAt(i)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
case Collection:
|
case Collection:
|
||||||
for _, p := range other.Children() {
|
for _, p := range other.Children() {
|
||||||
if g.Intersects(p) {
|
if g.Intersects(p) {
|
||||||
|
@ -174,6 +130,8 @@ func (g *Circle) Intersects(obj Object) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
case *Feature:
|
||||||
|
return g.Intersects(other.base)
|
||||||
default:
|
default:
|
||||||
// No simple cases, so using polygon approximation.
|
// No simple cases, so using polygon approximation.
|
||||||
return g.getObject().Intersects(obj)
|
return g.getObject().Intersects(obj)
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (g *Feature) Within(obj Object) bool {
|
||||||
|
|
||||||
// Contains ...
|
// Contains ...
|
||||||
func (g *Feature) Contains(obj Object) bool {
|
func (g *Feature) Contains(obj Object) bool {
|
||||||
return obj.Within(g.base)
|
return g.base.Within(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithinRect ...
|
// WithinRect ...
|
||||||
|
@ -135,7 +135,7 @@ func (g *Feature) WithinPoly(poly *geometry.Poly) bool {
|
||||||
|
|
||||||
// Intersects ...
|
// Intersects ...
|
||||||
func (g *Feature) Intersects(obj Object) bool {
|
func (g *Feature) Intersects(obj Object) bool {
|
||||||
return obj.Intersects(g.base)
|
return g.base.Intersects(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntersectsPoint ...
|
// IntersectsPoint ...
|
||||||
|
|
|
@ -165,7 +165,7 @@ func parseJSONPoint(keys *parseKeys, opts *ParseOptions) (Object, error) {
|
||||||
}
|
}
|
||||||
if extra == nil && opts.AllowSimplePoints {
|
if extra == nil && opts.AllowSimplePoints {
|
||||||
var g SimplePoint
|
var g SimplePoint
|
||||||
g.base = base
|
g.Point = base
|
||||||
o = &g
|
o = &g
|
||||||
} else {
|
} else {
|
||||||
var g Point
|
var g Point
|
||||||
|
|
|
@ -4,12 +4,12 @@ import "github.com/tidwall/geojson/geometry"
|
||||||
|
|
||||||
// SimplePoint ...
|
// SimplePoint ...
|
||||||
type SimplePoint struct {
|
type SimplePoint struct {
|
||||||
base geometry.Point
|
geometry.Point
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSimplePoint ...
|
// NewSimplePoint returns a new SimplePoint object.
|
||||||
func NewSimplePoint(point geometry.Point) *SimplePoint {
|
func NewSimplePoint(point geometry.Point) *SimplePoint {
|
||||||
return &SimplePoint{base: point}
|
return &SimplePoint{Point: point}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForEach ...
|
// ForEach ...
|
||||||
|
@ -19,17 +19,17 @@ func (g *SimplePoint) ForEach(iter func(geom Object) bool) bool {
|
||||||
|
|
||||||
// Empty ...
|
// Empty ...
|
||||||
func (g *SimplePoint) Empty() bool {
|
func (g *SimplePoint) Empty() bool {
|
||||||
return g.base.Empty()
|
return g.Point.Empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid ...
|
// Valid ...
|
||||||
func (g *SimplePoint) Valid() bool {
|
func (g *SimplePoint) Valid() bool {
|
||||||
return g.base.Valid()
|
return g.Point.Valid()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rect ...
|
// Rect ...
|
||||||
func (g *SimplePoint) Rect() geometry.Rect {
|
func (g *SimplePoint) Rect() geometry.Rect {
|
||||||
return g.base.Rect()
|
return g.Point.Rect()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spatial ...
|
// Spatial ...
|
||||||
|
@ -39,18 +39,18 @@ func (g *SimplePoint) Spatial() Spatial {
|
||||||
|
|
||||||
// Center ...
|
// Center ...
|
||||||
func (g *SimplePoint) Center() geometry.Point {
|
func (g *SimplePoint) Center() geometry.Point {
|
||||||
return g.base
|
return g.Point
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base ...
|
// Base ...
|
||||||
func (g *SimplePoint) Base() geometry.Point {
|
func (g *SimplePoint) Base() geometry.Point {
|
||||||
return g.base
|
return g.Point
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendJSON ...
|
// AppendJSON ...
|
||||||
func (g *SimplePoint) AppendJSON(dst []byte) []byte {
|
func (g *SimplePoint) AppendJSON(dst []byte) []byte {
|
||||||
dst = append(dst, `{"type":"Point","coordinates":`...)
|
dst = append(dst, `{"type":"Point","coordinates":`...)
|
||||||
dst = appendJSONPoint(dst, g.base, nil, 0)
|
dst = appendJSONPoint(dst, g.Point, nil, 0)
|
||||||
dst = append(dst, '}')
|
dst = append(dst, '}')
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ func (g *SimplePoint) Within(obj Object) bool {
|
||||||
|
|
||||||
// Contains ...
|
// Contains ...
|
||||||
func (g *SimplePoint) Contains(obj Object) bool {
|
func (g *SimplePoint) Contains(obj Object) bool {
|
||||||
return obj.Spatial().WithinPoint(g.base)
|
return obj.Spatial().WithinPoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intersects ...
|
// Intersects ...
|
||||||
|
@ -85,47 +85,47 @@ func (g *SimplePoint) Intersects(obj Object) bool {
|
||||||
if obj, ok := obj.(*Circle); ok {
|
if obj, ok := obj.(*Circle); ok {
|
||||||
return obj.Contains(g)
|
return obj.Contains(g)
|
||||||
}
|
}
|
||||||
return obj.Spatial().IntersectsPoint(g.base)
|
return obj.Spatial().IntersectsPoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithinRect ...
|
// WithinRect ...
|
||||||
func (g *SimplePoint) WithinRect(rect geometry.Rect) bool {
|
func (g *SimplePoint) WithinRect(rect geometry.Rect) bool {
|
||||||
return rect.ContainsPoint(g.base)
|
return rect.ContainsPoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithinPoint ...
|
// WithinPoint ...
|
||||||
func (g *SimplePoint) WithinPoint(point geometry.Point) bool {
|
func (g *SimplePoint) WithinPoint(point geometry.Point) bool {
|
||||||
return point.ContainsPoint(g.base)
|
return point.ContainsPoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithinLine ...
|
// WithinLine ...
|
||||||
func (g *SimplePoint) WithinLine(line *geometry.Line) bool {
|
func (g *SimplePoint) WithinLine(line *geometry.Line) bool {
|
||||||
return line.ContainsPoint(g.base)
|
return line.ContainsPoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithinPoly ...
|
// WithinPoly ...
|
||||||
func (g *SimplePoint) WithinPoly(poly *geometry.Poly) bool {
|
func (g *SimplePoint) WithinPoly(poly *geometry.Poly) bool {
|
||||||
return poly.ContainsPoint(g.base)
|
return poly.ContainsPoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntersectsPoint ...
|
// IntersectsPoint ...
|
||||||
func (g *SimplePoint) IntersectsPoint(point geometry.Point) bool {
|
func (g *SimplePoint) IntersectsPoint(point geometry.Point) bool {
|
||||||
return g.base.IntersectsPoint(point)
|
return g.Point.IntersectsPoint(point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntersectsRect ...
|
// IntersectsRect ...
|
||||||
func (g *SimplePoint) IntersectsRect(rect geometry.Rect) bool {
|
func (g *SimplePoint) IntersectsRect(rect geometry.Rect) bool {
|
||||||
return g.base.IntersectsRect(rect)
|
return g.Point.IntersectsRect(rect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntersectsLine ...
|
// IntersectsLine ...
|
||||||
func (g *SimplePoint) IntersectsLine(line *geometry.Line) bool {
|
func (g *SimplePoint) IntersectsLine(line *geometry.Line) bool {
|
||||||
return g.base.IntersectsLine(line)
|
return g.Point.IntersectsLine(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IntersectsPoly ...
|
// IntersectsPoly ...
|
||||||
func (g *SimplePoint) IntersectsPoly(poly *geometry.Poly) bool {
|
func (g *SimplePoint) IntersectsPoly(poly *geometry.Poly) bool {
|
||||||
return g.base.IntersectsPoly(poly)
|
return g.Point.IntersectsPoly(poly)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NumPoints ...
|
// NumPoints ...
|
||||||
|
@ -135,7 +135,7 @@ func (g *SimplePoint) NumPoints() int {
|
||||||
|
|
||||||
// Distance ...
|
// Distance ...
|
||||||
func (g *SimplePoint) Distance(obj Object) float64 {
|
func (g *SimplePoint) Distance(obj Object) float64 {
|
||||||
return obj.Spatial().DistancePoint(g.base)
|
return obj.Spatial().DistancePoint(g.Point)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DistancePoint ...
|
// DistancePoint ...
|
||||||
|
|
|
@ -81,7 +81,7 @@ github.com/tidwall/buntdb
|
||||||
# github.com/tidwall/geoindex v1.1.0
|
# github.com/tidwall/geoindex v1.1.0
|
||||||
github.com/tidwall/geoindex
|
github.com/tidwall/geoindex
|
||||||
github.com/tidwall/geoindex/child
|
github.com/tidwall/geoindex/child
|
||||||
# github.com/tidwall/geojson v1.1.8
|
# github.com/tidwall/geojson v1.1.10
|
||||||
github.com/tidwall/geojson
|
github.com/tidwall/geojson
|
||||||
github.com/tidwall/geojson/geo
|
github.com/tidwall/geojson/geo
|
||||||
github.com/tidwall/geojson/geometry
|
github.com/tidwall/geojson/geometry
|
||||||
|
|
Loading…
Reference in New Issue