1
0
forked from MTSR/mapserver
This commit is contained in:
Thomas Rudin 2019-01-13 16:37:03 +01:00
parent 7503c2c281
commit bc223722af
28 changed files with 209 additions and 210 deletions

View File

@ -1,14 +1,14 @@
package colormapping
import (
"mapserver/vfs"
"bufio"
"errors"
"bytes"
"strings"
"strconv"
"errors"
"github.com/sirupsen/logrus"
"image/color"
"mapserver/vfs"
"strconv"
"strings"
)
type ColorMapping struct {

View File

@ -5,6 +5,7 @@ import (
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "colormapping"})
}

View File

@ -9,7 +9,6 @@ const (
maxValue = 1<<(numBitsPerComponent-1) - 1
)
func CoordToPlain(c MapBlockCoords) int64 {
return int64(c.Z)<<(2*numBitsPerComponent) +
int64(c.Y)<<numBitsPerComponent +

View File

@ -1,11 +1,12 @@
package coords
import (
"testing"
"github.com/sirupsen/logrus"
"testing"
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "coords/convert_test"})
}
@ -19,7 +20,6 @@ func testCoordConvert(t *testing.T, mb MapBlockCoords){
mb2 := PlainToCoord(p)
log.WithFields(logrus.Fields{"coords2": mb2}).Info("MapblockCoords")
if mb.X != mb2.X {
t.Fatal("X mismatch")
}

View File

@ -4,7 +4,6 @@ const (
MAX_ZOOM = 13
)
func GetTileCoordsFromMapBlock(mbc MapBlockCoords) TileCoords {
return TileCoords{X:mbc.X, Y:(mbc.Z + 1) * -1, Zoom:MAX_ZOOM};
return TileCoords{X: mbc.X, Y: (mbc.Z + 1) * -1, Zoom: MAX_ZOOM}
}

View File

@ -5,6 +5,7 @@ import (
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "db"})
}

View File

@ -100,7 +100,6 @@ func (db *Sqlite3Accessor) GetBlock(pos coords.MapBlockCoords) (*Block, error) {
return nil, nil
}
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
db, err := sql.Open("sqlite3", filename+"?mode=ro")
if err != nil {

View File

@ -1,15 +1,14 @@
package db
import (
_ "github.com/mattn/go-sqlite3"
"io/ioutil"
"mapserver/coords"
"mapserver/testutils"
"os"
"testing"
"mapserver/testutils"
_ "github.com/mattn/go-sqlite3"
)
func TestMigrateEmpty(t *testing.T) {
tmpfile, err := ioutil.TempFile("", "TestMigrateEmpty.*.sqlite")
if err != nil {

View File

@ -5,6 +5,7 @@ import (
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "mapblockaccessor"})
}

View File

@ -1,12 +1,12 @@
package mapblockaccessor
import (
"fmt"
"github.com/patrickmn/go-cache"
"mapserver/coords"
"mapserver/db"
"mapserver/mapblockparser"
"github.com/patrickmn/go-cache"
"time"
"fmt"
)
type MapBlockAccessor struct {

View File

@ -1,13 +1,13 @@
package mapblockaccessor
import (
"os"
"github.com/sirupsen/logrus"
"io/ioutil"
"mapserver/coords"
"testing"
"mapserver/testutils"
"mapserver/db"
"github.com/sirupsen/logrus"
"mapserver/testutils"
"os"
"testing"
)
func TestSimpleAccess(t *testing.T) {

View File

@ -5,6 +5,7 @@ import (
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "mapblockaccessor"})
}

View File

@ -5,10 +5,10 @@ import (
"bytes"
"compress/zlib"
"errors"
"github.com/sirupsen/logrus"
"io"
"strconv"
"strings"
"github.com/sirupsen/logrus"
)
const (

View File

@ -5,6 +5,7 @@ import (
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "mapblockrenderer"})
}

View File

@ -1,14 +1,14 @@
package mapblockrenderer
import (
"errors"
"github.com/sirupsen/logrus"
"image"
"image/draw"
"mapserver/colormapping"
"mapserver/coords"
"mapserver/mapblockaccessor"
"image"
"image/draw"
"errors"
"time"
"github.com/sirupsen/logrus"
)
type MapBlockRenderer struct {

View File

@ -1,17 +1,15 @@
package testutils
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
"io"
"path/filepath"
"os"
"fmt"
"path/filepath"
"runtime"
)
const emptyBlocksScript = `
create table blocks (
pos int,
@ -44,7 +42,6 @@ func CreateTestDatabase(filename string) error {
return copy(filepath.Dir(currentfilename)+"/testdata/map.sqlite", filename)
}
func CreateEmptyDatabase(filename string) {
db, err := sql.Open("sqlite3", filename)
if err != nil {

View File

@ -5,6 +5,7 @@ import (
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "tilerenderer"})
}

View File

@ -1,10 +1,10 @@
package tilerenderer
import (
"image"
"mapserver/coords"
"mapserver/mapblockrenderer"
"mapserver/tiledb"
"image"
)
type TileRenderer struct {

View File

@ -1,11 +1,11 @@
package worldconfig
import (
"fmt"
"bufio"
"fmt"
"os"
"strings"
"strconv"
"strings"
)
const (

View File

@ -1,8 +1,8 @@
package worldconfig
import (
"testing"
"fmt"
"testing"
)
func TestParseSqlite(t *testing.T) {