Skip to content

Commit d3790dd

Browse files
Added common interface and killed logging.
1 parent 849ed49 commit d3790dd

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

rtree/hilbert/node.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@ limitations under the License.
1717
package hilbert
1818

1919
import (
20-
"log"
2120
"sort"
2221

2322
"github.com/Workiva/go-datastructures/rtree"
2423
)
2524

26-
func init() {
27-
log.Printf(`I HATE THIS.`)
28-
}
29-
3025
type hilbert int64
3126

3227
type hilberts []hilbert

rtree/hilbert/tree.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,8 @@ func newTree(bufferSize, ary uint64) *tree {
424424
tree.init(bufferSize, ary)
425425
return tree
426426
}
427+
428+
// New will construct a new Hilbert R-Tree and return it.
429+
func New(bufferSize, ary uint64) rtree.RTree {
430+
return newTree(bufferSize, ary)
431+
}

rtree/interface.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,19 @@ type Rectangle interface {
2626
// UpperRight describes the upper right coordinate of this rectangle.
2727
UpperRight() (int32, int32)
2828
}
29+
30+
// RTree defines an object that can be returned from any subpackage
31+
// of this package.
32+
type RTree interface {
33+
// Search will perform an intersection search of the given
34+
// rectangle and return any rectangles that intersect.
35+
Search(Rectangle) Rectangles
36+
// Len returns in the number of items in the RTree.
37+
Len() uint64
38+
// Dispose will clean up any objects used by the RTree.
39+
Dispose()
40+
// Delete will remove the provided rectangles from the RTree.
41+
Delete(...Rectangle)
42+
// Insert will add the provided rectangles to the RTree.
43+
Insert(...Rectangle)
44+
}

0 commit comments

Comments
 (0)