mirror of https://github.com/tidwall/tile38.git
use poly bboxes
This commit is contained in:
parent
70bdd49acb
commit
86887ae60f
|
@ -29,6 +29,7 @@ func fillMultiPolygon(coordinates [][][]Position, bbox *BBox, err error) (MultiP
|
|||
Coordinates: coordinates,
|
||||
BBox: bbox,
|
||||
bboxDefined: bboxDefined,
|
||||
polygons: polygons,
|
||||
}, err
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,11 @@ func (g Polygon) WithinBBox(bbox BBox) bool {
|
|||
if len(g.Coordinates) == 0 {
|
||||
return false
|
||||
}
|
||||
if g.BBox != nil {
|
||||
if !rectBBox(*g.BBox).IntersectsRect(rectBBox(bbox)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
rbbox := rectBBox(bbox)
|
||||
ext, holes := polyExteriorHoles(g.Coordinates)
|
||||
if len(holes) > 0 {
|
||||
|
@ -122,6 +127,11 @@ func (g Polygon) IntersectsBBox(bbox BBox) bool {
|
|||
if len(g.Coordinates) == 0 {
|
||||
return false
|
||||
}
|
||||
if g.BBox != nil {
|
||||
if !rectBBox(*g.BBox).IntersectsRect(rectBBox(bbox)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
rbbox := rectBBox(bbox)
|
||||
ext, holes := polyExteriorHoles(g.Coordinates)
|
||||
if len(holes) > 0 {
|
||||
|
|
Loading…
Reference in New Issue