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,
|
Coordinates: coordinates,
|
||||||
BBox: bbox,
|
BBox: bbox,
|
||||||
bboxDefined: bboxDefined,
|
bboxDefined: bboxDefined,
|
||||||
|
polygons: polygons,
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,11 @@ func (g Polygon) WithinBBox(bbox BBox) bool {
|
||||||
if len(g.Coordinates) == 0 {
|
if len(g.Coordinates) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if g.BBox != nil {
|
||||||
|
if !rectBBox(*g.BBox).IntersectsRect(rectBBox(bbox)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
rbbox := rectBBox(bbox)
|
rbbox := rectBBox(bbox)
|
||||||
ext, holes := polyExteriorHoles(g.Coordinates)
|
ext, holes := polyExteriorHoles(g.Coordinates)
|
||||||
if len(holes) > 0 {
|
if len(holes) > 0 {
|
||||||
|
@ -122,6 +127,11 @@ func (g Polygon) IntersectsBBox(bbox BBox) bool {
|
||||||
if len(g.Coordinates) == 0 {
|
if len(g.Coordinates) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if g.BBox != nil {
|
||||||
|
if !rectBBox(*g.BBox).IntersectsRect(rectBBox(bbox)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
rbbox := rectBBox(bbox)
|
rbbox := rectBBox(bbox)
|
||||||
ext, holes := polyExteriorHoles(g.Coordinates)
|
ext, holes := polyExteriorHoles(g.Coordinates)
|
||||||
if len(holes) > 0 {
|
if len(holes) > 0 {
|
||||||
|
|
Loading…
Reference in New Issue