Allow for INTERSECTS command for points

Thanks to @rbastian for finding this bug.

fixes #26
This commit is contained in:
Josh Baker 2016-12-06 06:20:47 -07:00
parent 0afdf67c90
commit 3c8b9b4110
1 changed files with 8 additions and 0 deletions

View File

@ -224,6 +224,10 @@ func withinObjectShared(g Object, o Object, pin func(v Polygon) bool, mpin func(
switch v := o.(type) { switch v := o.(type) {
default: default:
return false return false
case Point:
return g.WithinBBox(v.CalculatedBBox())
case SimplePoint:
return g.WithinBBox(v.CalculatedBBox())
case Polygon: case Polygon:
if len(v.Coordinates) == 0 { if len(v.Coordinates) == 0 {
return false return false
@ -267,6 +271,10 @@ func intersectsObjectShared(g Object, o Object, pin func(v Polygon) bool, mpin f
switch v := o.(type) { switch v := o.(type) {
default: default:
return false return false
case Point:
return g.IntersectsBBox(v.CalculatedBBox())
case SimplePoint:
return g.IntersectsBBox(v.CalculatedBBox())
case Polygon: case Polygon:
if len(v.Coordinates) == 0 { if len(v.Coordinates) == 0 {
return false return false