mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-08 03:00:26 +01:00
Added 'websocket' branch. Added mechanism to forward the coords of the updated base tiles.
This commit is contained in:
parent
003d8cc785
commit
3e0e909a69
|
@ -78,6 +78,9 @@ func main() {
|
|||
subBaseLine := newSubBaseLine(mapDir)
|
||||
router.Path("/map/{z:[0-9]+}/{x:[0-9]+}/{y:[0-9]+}.png").Handler(subBaseLine)
|
||||
|
||||
// TODO: Implement me!
|
||||
var btu baseTilesUpdates
|
||||
|
||||
if redisHost != "" {
|
||||
var colors *common.Colors
|
||||
var err error
|
||||
|
@ -92,7 +95,13 @@ func main() {
|
|||
}
|
||||
|
||||
tu := newTileUpdater(
|
||||
mapDir, redisAddress, allowedUpdateIps, colors, transparent, workers)
|
||||
mapDir,
|
||||
redisAddress,
|
||||
allowedUpdateIps,
|
||||
colors,
|
||||
transparent,
|
||||
workers,
|
||||
btu)
|
||||
go tu.doUpdates()
|
||||
router.Path("/update").Methods("POST").Handler(tu)
|
||||
}
|
||||
|
|
|
@ -24,8 +24,13 @@ import (
|
|||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
)
|
||||
|
||||
type baseTilesUpdates interface {
|
||||
BaseTilesUpdated(map[xz]bool)
|
||||
}
|
||||
|
||||
type tileUpdater struct {
|
||||
changes map[xz]bool
|
||||
btu baseTilesUpdates
|
||||
mapDir string
|
||||
redisAddress string
|
||||
ips []net.IP
|
||||
|
@ -67,9 +72,11 @@ func newTileUpdater(
|
|||
ips []net.IP,
|
||||
colors *common.Colors,
|
||||
transparent bool,
|
||||
workers int) *tileUpdater {
|
||||
workers int,
|
||||
btu baseTilesUpdates) *tileUpdater {
|
||||
|
||||
tu := tileUpdater{
|
||||
btu: btu,
|
||||
mapDir: mapDir,
|
||||
redisAddress: redisAddress,
|
||||
ips: ips,
|
||||
|
@ -166,7 +173,7 @@ func (tu *tileUpdater) doUpdates() {
|
|||
|
||||
parentJobs := make(map[xz]uint16)
|
||||
|
||||
for c, _ := range changes {
|
||||
for c := range changes {
|
||||
//log.Printf("job: %+v", c)
|
||||
jobs <- c
|
||||
pxz := c.parent()
|
||||
|
@ -191,6 +198,10 @@ func (tu *tileUpdater) doUpdates() {
|
|||
done.Wait()
|
||||
parentJobs = ppJobs
|
||||
}
|
||||
|
||||
if tu.btu != nil {
|
||||
tu.btu.BaseTilesUpdated(changes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user