Skip to content

Commit

Permalink
Expose the Bounds package.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdey committed Feb 21, 2019
1 parent fb53436 commit e600572
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Running the following commands should set up a working development environment

docker build -t mbgl .

docker run -it -v it"$(pwd)":/go/src/github.com/go-spatial/go-mbgl
docker run --rm -v "$(pwd)":/go/src/github.com/go-spatial/go-mbgl -it mbgl

```

Expand Down
File renamed without changes.
24 changes: 12 additions & 12 deletions internal/bounds/bounds_test.go → bounds/bounds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestZoom(t *testing.T) {
zoom float64
}

fn := func(tc tcase) func(t *testing.T) {
fn := func(tc tcase) func(*testing.T) {
return func(t *testing.T) {
zoom := Zoom(tc.bounds, tc.width, tc.height)
if !cmp.Float(tc.zoom, zoom) {
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestCenterZoom(t *testing.T) {
center [2]float64
}

fn := func(tc tcase) func(t *testing.T) {
fn := func(tc tcase) func(*testing.T) {
return func(t *testing.T) {

center, zoom := CenterZoom(tc.bounds, tc.width, tc.height)
Expand Down Expand Up @@ -116,14 +116,14 @@ func TestTransform(t *testing.T) {
}

type tcase struct {
prj aProjection
prj AProjection
cases []subcase
}

fn := func(tc tcase) func(t *testing.T) {
return func(t *testing.T) {
fn := func(tc tcase) (string, func(*testing.T)) {
return tc.prj.String(), func(t *testing.T) {

fn := func(prj aProjection, tc subcase) func(t *testing.T) {
fn := func(prj AProjection, tc subcase) func(*testing.T) {
return func(t *testing.T) {
t.Run("transform", func(t *testing.T) {

Expand Down Expand Up @@ -168,7 +168,7 @@ func TestTransform(t *testing.T) {
}

for _, tc := range tests {
t.Run(tc.prj.String(), fn(tc))
t.Run(fn(tc))
}

}
Expand All @@ -180,14 +180,14 @@ func TestProject(t *testing.T) {
}

type tcase struct {
prj aProjection
prj AProjection
cases []subcase
}

fn := func(tc tcase) func(t *testing.T) {
return func(t *testing.T) {
fn := func(tc tcase) (string, func(*testing.T)) {
return tc.prj.String(), func(t *testing.T) {

fn := func(prj aProjection, tc subcase) func(t *testing.T) {
fn := func(prj AProjection, tc subcase) func(t *testing.T) {
return func(t *testing.T) {

t.Run("Project", func(t *testing.T) {
Expand Down Expand Up @@ -232,6 +232,6 @@ func TestProject(t *testing.T) {
},
}
for _, tc := range tests {
t.Run(tc.prj.String(), fn(tc))
t.Run(fn(tc))
}
}
2 changes: 1 addition & 1 deletion cmd/snap/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"github.com/go-spatial/geom"
"github.com/go-spatial/geom/spherical"
"github.com/go-spatial/go-mbgl/bounds"
"github.com/go-spatial/go-mbgl/cmd/snap/generate"
"github.com/go-spatial/go-mbgl/internal/bounds"
mbgl "github.com/go-spatial/go-mbgl/mbgl/simplified"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/snap/cmd/generate_tile.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"

"github.com/go-spatial/geom/slippy"
"github.com/go-spatial/go-mbgl/internal/bounds"
"github.com/go-spatial/go-mbgl/bounds"
mbgl "github.com/go-spatial/go-mbgl/mbgl/simplified"
"github.com/spf13/cobra"
)
Expand Down
11 changes: 5 additions & 6 deletions cmd/snap/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/go-spatial/geom/slippy"
"github.com/go-spatial/geom/spherical"

"github.com/go-spatial/go-mbgl/internal/bounds"
"github.com/go-spatial/go-mbgl/bounds"
mbgl "github.com/go-spatial/go-mbgl/mbgl/simplified"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -56,7 +56,6 @@ var cmdServer = &cobra.Command{
Run: commandServer,
}


var cmdServerAddress string = ":0"

func init() {
Expand All @@ -65,14 +64,14 @@ func init() {

func commandServer(cmd *cobra.Command, args []string) {

listener, err := net.Listen("tcp",cmdServerAddress)
listener, err := net.Listen("tcp", cmdServerAddress)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to bind to address(%v):%v",cmdServerAddress,err)
fmt.Fprintf(os.Stderr, "Unable to bind to address(%v):%v", cmdServerAddress, err)
os.Exit(2)
return
}

fmt.Println("Starting up server on:",listener.Addr())
fmt.Println("Starting up server on:", listener.Addr())
// start our server
router := newRouter()

Expand All @@ -87,7 +86,7 @@ func commandServer(cmd *cobra.Command, args []string) {

err = http.Serve(listener, router)
if err != nil {
fmt.Fprintf(os.Stderr, "Error starting server",err)
fmt.Fprintf(os.Stderr, "Error starting server", err)
os.Exit(2)
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/snap/generate/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"

"github.com/go-spatial/geom"
"github.com/go-spatial/go-mbgl/internal/bounds"
"github.com/go-spatial/go-mbgl/bounds"
mbgl "github.com/go-spatial/go-mbgl/mbgl/simplified"
)

Expand Down

0 comments on commit e600572

Please sign in to comment.