示例#1
0
文件: qtree.go 项目: jbeda/geom
func (me *Tree) RemoveInside(bounds geom.Rect, collection map[Item]bool) {
	if !geom.RectsIntersect(bounds, me.UpperBounds) {
		return
	}
	if me.BigElements != nil {
		for elem := range me.BigElements {
			if bounds.ContainsRect(elem.Bounds()) {
				delete(me.BigElements, elem)
				if collection != nil {
					collection[elem] = true
				}
			}
		}
	}
	if me.Elements != nil {
		for elem := range me.Elements {
			if bounds.ContainsRect(elem.Bounds()) {
				delete(me.Elements, elem)
				if collection != nil {
					collection[elem] = true
				}
			}
		}
	}

	for _, t := range me.Subtrees {
		if t == nil {
			continue
		}
		t.RemoveInside(bounds, collection)
	}

	return
}
示例#2
0
文件: qtree.go 项目: jbeda/geom
func (me *Tree) IsBig(bounds geom.Rect) bool {
	return bounds.Width() >= me.cfg.SplitSizeRatio*me.UpperBounds.Width() ||
		bounds.Height() >= me.cfg.SplitSizeRatio*me.UpperBounds.Height()
}