mirror of https://github.com/tidwall/tile38.git
Removed unneeded params
This commit is contained in:
parent
1a5ab9fb78
commit
a4986d9cf8
|
@ -370,22 +370,21 @@ func (server *Server) cmdNearby(msg *Message) (res resp.Value, err error) {
|
||||||
}
|
}
|
||||||
sw.writeHead()
|
sw.writeHead()
|
||||||
if sw.col != nil {
|
if sw.col != nil {
|
||||||
var matched uint32
|
iter := func(id string, o geojson.Object, fields []float64, dist float64) bool {
|
||||||
iter := func(id string, o geojson.Object, fields []float64, dist *float64) bool {
|
meters := 0.0
|
||||||
distance := 0.0
|
|
||||||
if s.distance {
|
if s.distance {
|
||||||
distance = geo.DistanceFromHaversine(*dist)
|
meters = geo.DistanceFromHaversine(dist)
|
||||||
}
|
}
|
||||||
return sw.writeObject(ScanWriterParams{
|
return sw.writeObject(ScanWriterParams{
|
||||||
id: id,
|
id: id,
|
||||||
o: o,
|
o: o,
|
||||||
fields: fields,
|
fields: fields,
|
||||||
distance: distance,
|
distance: meters,
|
||||||
noLock: true,
|
noLock: true,
|
||||||
ignoreGlobMatch: true,
|
ignoreGlobMatch: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
server.nearestNeighbors(&s, sw, s.obj.(*geojson.Circle), &matched, iter)
|
server.nearestNeighbors(&s, sw, s.obj.(*geojson.Circle), iter)
|
||||||
}
|
}
|
||||||
sw.writeFoot()
|
sw.writeFoot()
|
||||||
if msg.OutputType == JSON {
|
if msg.OutputType == JSON {
|
||||||
|
@ -403,8 +402,8 @@ type iterItem struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) nearestNeighbors(
|
func (server *Server) nearestNeighbors(
|
||||||
s *liveFenceSwitches, sw *scanWriter, target *geojson.Circle, matched *uint32,
|
s *liveFenceSwitches, sw *scanWriter, target *geojson.Circle,
|
||||||
iter func(id string, o geojson.Object, fields []float64, dist *float64,
|
iter func(id string, o geojson.Object, fields []float64, dist float64,
|
||||||
) bool) {
|
) bool) {
|
||||||
limit := int(sw.cursor + sw.limit)
|
limit := int(sw.cursor + sw.limit)
|
||||||
maxDist := target.Haversine()
|
maxDist := target.Haversine()
|
||||||
|
@ -434,7 +433,7 @@ func (server *Server) nearestNeighbors(
|
||||||
return items[i].dist < items[j].dist
|
return items[i].dist < items[j].dist
|
||||||
})
|
})
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if !iter(item.id, item.o, item.fields, &item.dist) {
|
if !iter(item.id, item.o, item.fields, item.dist) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue