mirror of https://github.com/tidwall/tile38.git
Merge branch 'master' into collection-optz
This commit is contained in:
commit
4d5b6571da
|
@ -2,6 +2,13 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [1.16.2] - 2019-03-12
|
||||
### Fixes
|
||||
- #432: Ignore SIGHUP signals (@abhit011)
|
||||
- #433: Fixed nearby inaccuracy with geofence (@stcktrce)
|
||||
- #429: Memory optimization, recycle AOF buffer
|
||||
- 95a5556: Added periodic yielding to iterators (@rshura)
|
||||
|
||||
## [1.16.1] - 2019-03-01
|
||||
### Fixes
|
||||
- #421: Nearby with MATCH is returning invalid results (@nithinkota)
|
||||
|
|
|
@ -250,7 +250,11 @@
|
|||
version = "v1.0.2"
|
||||
|
||||
[[projects]]
|
||||
<<<<<<< HEAD
|
||||
digest = "1:ab5e0d19c706286deed5e6ec63a35ee0f2b92d7b9e97083eb67e5d2d76b4bfdb"
|
||||
=======
|
||||
digest = "1:cdab3bce90a53a124ac3982719abde77d779e961d9c180e55c23fb74fc62563a"
|
||||
>>>>>>> master
|
||||
name = "github.com/tidwall/geojson"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -258,8 +262,13 @@
|
|||
"geometry",
|
||||
]
|
||||
pruneopts = ""
|
||||
<<<<<<< HEAD
|
||||
revision = "f9500c7d3da6ce149bf80530c36b1a784dcd0f2b"
|
||||
version = "v1.1.1"
|
||||
=======
|
||||
revision = "eaf6e0a55a79c1e879bbbcc879a3176c720d99cd"
|
||||
version = "v1.1.3"
|
||||
>>>>>>> master
|
||||
|
||||
[[projects]]
|
||||
digest = "1:eade4ea6782f5eed4a6b3138a648f9a332900650804fd206e5daaf99cc5613ea"
|
||||
|
|
|
@ -37,7 +37,7 @@ required = [
|
|||
|
||||
[[constraint]]
|
||||
name = "github.com/tidwall/geojson"
|
||||
version = "1.1.1"
|
||||
version = "1.1.3"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/Shopify/sarama"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</p>
|
||||
<p align="center">
|
||||
<a href="https://join.slack.com/t/tile38/shared_invite/enQtMzQ0OTEwMDUxMzc5LTc0NTJjZmM3YjFhOGZiZGU2NDNjOWEwM2Q5ZWE3MzFiYWZkZDIyN2U2ZmUzZDBmODU0MjI1ZjQ0N2Y1M2I1NTg"><img src="https://img.shields.io/badge/slack-channel-orange.svg" alt="Slack Channel"></a>
|
||||
<a href="https://github.com/tidwall/tile38/releases"><img src="https://img.shields.io/badge/version-1.16.1-green.svg?" alt="Version"></a>
|
||||
<a href="https://github.com/tidwall/tile38/releases"><img src="https://img.shields.io/badge/version-1.16.2-green.svg?" alt="Version"></a>
|
||||
<a href="https://travis-ci.org/tidwall/tile38"><img src="https://travis-ci.org/tidwall/tile38.svg?branch=master" alt="Build Status"></a>
|
||||
<a href="https://hub.docker.com/r/tile38/tile38"><img src="https://img.shields.io/badge/docker-ready-blue.svg" alt="Docker Ready"></a>
|
||||
</p>
|
||||
|
|
2
build.sh
2
build.sh
|
@ -4,7 +4,7 @@ set -e
|
|||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
OD="$(pwd)"
|
||||
|
||||
VERSION=1.16.1
|
||||
VERSION=1.16.2
|
||||
PROTECTED_MODE="no"
|
||||
|
||||
# Hardcode some values to the core package
|
||||
|
|
|
@ -374,23 +374,25 @@ Developer Options:
|
|||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
go func() {
|
||||
s := <-c
|
||||
log.Warnf("signal: %v", s)
|
||||
if pidfile != "" {
|
||||
pidcleanup()
|
||||
}
|
||||
pprofcleanup()
|
||||
switch {
|
||||
default:
|
||||
os.Exit(-1)
|
||||
case s == syscall.SIGHUP:
|
||||
os.Exit(1)
|
||||
case s == syscall.SIGINT:
|
||||
os.Exit(2)
|
||||
case s == syscall.SIGQUIT:
|
||||
os.Exit(3)
|
||||
case s == syscall.SIGTERM:
|
||||
os.Exit(0xf)
|
||||
for s := range c {
|
||||
if s == syscall.SIGHUP {
|
||||
continue
|
||||
}
|
||||
log.Warnf("signal: %v", s)
|
||||
if pidfile != "" {
|
||||
pidcleanup()
|
||||
}
|
||||
pprofcleanup()
|
||||
switch {
|
||||
default:
|
||||
os.Exit(-1)
|
||||
case s == syscall.SIGINT:
|
||||
os.Exit(2)
|
||||
case s == syscall.SIGQUIT:
|
||||
os.Exit(3)
|
||||
case s == syscall.SIGTERM:
|
||||
os.Exit(0xf)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@ func (g *Circle) Contains(obj Object) bool {
|
|||
switch other := obj.(type) {
|
||||
case *Point:
|
||||
return g.containsPoint(other.Center())
|
||||
case *SimplePoint:
|
||||
return g.containsPoint(other.Center())
|
||||
case *Circle:
|
||||
return other.Distance(g) < (other.meters + g.meters)
|
||||
case *LineString:
|
||||
|
@ -244,8 +246,8 @@ func makeCircleObject(center geometry.Point, meters float64, steps int) Object {
|
|||
// generate the
|
||||
for th := 0.0; th <= 360.0; th += 360.0 / float64(steps) {
|
||||
radians := (math.Pi / 180) * th
|
||||
x := center.X + lats*math.Cos(radians)
|
||||
y := center.Y + lons*math.Sin(radians)
|
||||
x := center.X + lons*math.Cos(radians)
|
||||
y := center.Y + lats*math.Sin(radians)
|
||||
points = append(points, geometry.Point{X: x, Y: y})
|
||||
}
|
||||
// add last connecting point, make a total of steps+1
|
||||
|
|
|
@ -171,3 +171,11 @@ func TestCircleIntersects(t *testing.T) {
|
|||
// }
|
||||
// expect(t, true)
|
||||
//}
|
||||
|
||||
func TestPointCircle(t *testing.T) {
|
||||
p := NewPoint(geometry.Point{X: -0.8856761, Y: 52.7563759})
|
||||
c := NewCircle(geometry.Point{X: -0.8838196, Y: 52.7563395}, 200, 20)
|
||||
if !p.Within(c) {
|
||||
t.Fatal("expected true")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,9 @@ func (g *Point) Contains(obj Object) bool {
|
|||
|
||||
// Intersects ...
|
||||
func (g *Point) Intersects(obj Object) bool {
|
||||
if obj, ok := obj.(*Circle); ok {
|
||||
return obj.Contains(g)
|
||||
}
|
||||
return obj.Spatial().IntersectsPoint(g.base)
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ func (g *SimplePoint) Contains(obj Object) bool {
|
|||
|
||||
// Intersects ...
|
||||
func (g *SimplePoint) Intersects(obj Object) bool {
|
||||
if obj, ok := obj.(*Circle); ok {
|
||||
return obj.Contains(g)
|
||||
}
|
||||
return obj.Spatial().IntersectsPoint(g.base)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue