diff --git a/bbox.go b/bbox.go index 027281d4..cdc0fcfb 100644 --- a/bbox.go +++ b/bbox.go @@ -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{ @@ -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 diff --git a/internal/debugger/debugger.go b/internal/debugger/debugger.go index 962be9fa..d6c80289 100644 --- a/internal/debugger/debugger.go +++ b/internal/debugger/debugger.go @@ -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 diff --git a/internal/debugger/recorder/gpkg/debug.go b/internal/debugger/recorder/gpkg/debug.go new file mode 100644 index 00000000..8107b0e5 --- /dev/null +++ b/internal/debugger/recorder/gpkg/debug.go @@ -0,0 +1,5 @@ +package gpkg + +const ( + debug = false +) diff --git a/internal/debugger/recorder/gpkg/gpkg.go b/internal/debugger/recorder/gpkg/gpkg.go index b4cb45f1..ed4efbbe 100644 --- a/internal/debugger/recorder/gpkg/gpkg.go +++ b/internal/debugger/recorder/gpkg/gpkg.go @@ -5,6 +5,7 @@ package gpkg import ( "database/sql" "fmt" + "log" "os" "path/filepath" "strings" @@ -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( @@ -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 diff --git a/internal/debugger/recorder/recorder.go b/internal/debugger/recorder/recorder.go index b02abda0..a34ab493 100644 --- a/internal/debugger/recorder/recorder.go +++ b/internal/debugger/recorder/recorder.go @@ -1,6 +1,8 @@ package recorder import ( + "fmt" + "path/filepath" "runtime" "strings" ) @@ -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.