Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Extent [4]float64

/* ========================= ATTRIBUTES ========================= */

// Vertices return the verticies of the Bounding Box. The verticies are ordered in the following maner.
// Vertices return the vertices of the Bounding Box. The vertices are ordered in the following maner.
// (minx,miny), (maxx,miny), (maxx,maxy), (minx,maxy)
func (e *Extent) Vertices() [][2]float64 {
return [][2]float64{
Expand All @@ -34,6 +34,9 @@ func (e *Extent) Vertices() [][2]float64 {
}
}

// Verticies is the misspelled version of Vertices to match the interface
func (e *Extent) Verticies() [][2]float64 { return e.Vertices() }

// ClockwiseFunc returns weather the set of points should be considered clockwise or counterclockwise. The last point is not the same as the first point, and the function should connect these points as needed.
type ClockwiseFunc func(...[2]float64) bool

Expand Down
9 changes: 7 additions & 2 deletions internal/debugger/debugger.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,19 @@ func SetTestName(ctx context.Context, name string) context.Context {
)
}

// Filename returns the filename of the recorder in the ctx if one exists or an empty string
func Filename(ctx context.Context) string {
return GetRecorderFromContext(ctx).Filename
}

// Record records the geom and descriptive attributes into the debugging system
func Record(ctx context.Context, geom interface{}, category string, descriptionFormat string, data ...interface{}) {
RecordFFLOn(GetRecorderFromContext(ctx), FFL(1), geom, category, descriptionFormat, data...)
RecordFFLOn(GetRecorderFromContext(ctx), FFL(0), geom, category, descriptionFormat, data...)
}

// RecordOn records the geom and descriptive attributes into the debugging system
func RecordOn(rec Recorder, geom interface{}, category string, descriptionFormat string, data ...interface{}) {
RecordFFLOn(rec, FFL(1), geom, category, descriptionFormat, data...)
RecordFFLOn(rec, FFL(0), geom, category, descriptionFormat, data...)
}

// RecordFFLOn records the geom and descriptive attributes into the debugging system with the give Func File Line values
Expand Down
5 changes: 5 additions & 0 deletions internal/debugger/recorder/gpkg/debug.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package gpkg

const (
debug = false
)
20 changes: 17 additions & 3 deletions internal/debugger/recorder/gpkg/gpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package gpkg
import (
"database/sql"
"fmt"
"log"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -113,17 +114,29 @@ func (db *DB) Record(geo interface{}, ffl recorder.FuncFileLineType, tblTest rec

gtype := gpkg.TypeForGeometry(geo)
if gtype == gpkg.Geometry {
return fmt.Errorf("error unknown geometry type %t", geo)
err := fmt.Errorf("error unknown geometry type %T", geo)
if debug {
log.Println(ffl, err)
}
return err
}

stm, ok := db.statements[gtype]
if !ok {
return fmt.Errorf("error unsupported geom %s", gtype)
err := fmt.Errorf("error unsupported geom %s", gtype)
if debug {
log.Println(ffl, err)
}
return err
}

sb, err := gpkg.NewBinary(db.srsid, geo)
if err != nil {
return fmt.Errorf("error unsupported geometry %s : %v", gtype, err)
err = fmt.Errorf("error unsupported geometry %s : %v", gtype, err)
if debug {
log.Println(ffl, err)
}
return err
}

_, err = stm.Exec(
Expand All @@ -139,6 +152,7 @@ func (db *DB) Record(geo interface{}, ffl recorder.FuncFileLineType, tblTest rec
sb,
)
if err != nil {
log.Println(err)
return err
}
// update extent
Expand Down
7 changes: 7 additions & 0 deletions internal/debugger/recorder/recorder.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package recorder

import (
"fmt"
"path/filepath"
"runtime"
"strings"
)
Expand All @@ -22,6 +24,11 @@ type FuncFileLineType struct {
LineNumber int
}

func (ffl FuncFileLineType) String() string {
file := filepath.Base(ffl.File)
return fmt.Sprintf("%v@%v:%v", file, ffl.LineNumber, ffl.Func)
}

// FuncFileLine returns the func file and line number of the the number of callers
// above the caller of this function. Zero returns the immediate caller above the
// caller of the FuncFileLine func.
Expand Down