-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
对原项目github.com/dhconnelly/rtreego进行了精度更改,准备测试
- Loading branch information
Showing
8 changed files
with
3,078 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# rtreego | ||
对https://github.com/dhconnelly/rtreego 精度进行了更改 | ||
对https://github.com/dhconnelly/rtreego 精度进行了更改,改为float32 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package rtreego | ||
|
||
// Filter is an interface for filtering leaves during search. The parameters | ||
// should be treated as read-only. If refuse is true, the current entry will | ||
// not be added to the result set. If abort is true, the search is aborted and | ||
// the current result set will be returned. | ||
type Filter func(results []Spatial, object Spatial) (refuse, abort bool) | ||
|
||
// ApplyFilters applies the given filters and returns whether the entry is | ||
// refused and/or the search should be aborted. If a filter refuses an entry, | ||
// the following filters are not applied for the entry. If a filter aborts, the | ||
// search terminates without further applying any filter. | ||
func applyFilters(results []Spatial, object Spatial, filters []Filter) (bool, bool) { | ||
for _, filter := range filters { | ||
refuse, abort := filter(results, object) | ||
if refuse || abort { | ||
return refuse, abort | ||
} | ||
} | ||
return false, false | ||
} | ||
|
||
// LimitFilter checks if the results have reached the limit size and aborts if so. | ||
func LimitFilter(limit int) Filter { | ||
return func(results []Spatial, object Spatial) (refuse, abort bool) { | ||
if len(results) >= limit { | ||
return true, true | ||
} | ||
|
||
return false, false | ||
} | ||
} |
Oops, something went wrong.