hprtree

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2022 License: LGPL-2.1 Imports: 6 Imported by: 0

Documentation

Overview

Package hprtree a hprtree is a spatial index structure . This is a static R-tree which is packed by using the Hilbert ordering of the tree items.

Index

Constants

View Source
const (
	EnvSize             = 4
	HilbertLevel        = 12
	DefaultNodeCapacity = 16
)

HPRTree const parameter.

View Source
const MaxLevel = 16

MaxLevel ...

Variables

This section is empty.

Functions

This section is empty.

Types

type HPRTree

type HPRTree struct {
	Items []interface{}
	// contains filtered or unexported fields
}

HPRTree A Hilbert-Packed R-tree. This is a static R-tree which is packed by using the Hilbert ordering of the tree items. The tree is constructed by sorting the items by the Hilbert code of the midpoint of their envelope.

func NewHPRTree

func NewHPRTree() *HPRTree

NewHPRTree return default NewHPRTree.

func (*HPRTree) Insert

func (h *HPRTree) Insert(itemEnv *envelope.Envelope, item interface{}) error

Insert Adds a spatial item with an extent specified by the given Envelope to the index

func (*HPRTree) Query

func (h *HPRTree) Query(searchEnv *envelope.Envelope) interface{}

Query Queries the index for all items whose extents intersect the given search Envelope Note that some kinds of indexes may also return objects which do not in fact

intersect the query envelope.

func (*HPRTree) QueryVisitor

func (h *HPRTree) QueryVisitor(searchEnv *envelope.Envelope, visitor index.ItemVisitor) error

QueryVisitor Queries the index for all items whose extents intersect the given search Envelope, and applies an ItemVisitor to them. Note that some kinds of indexes may also return objects which do not in fact intersect the query envelope.

func (*HPRTree) Remove

func (h *HPRTree) Remove(itemEnv *envelope.Envelope, item interface{}) bool

Remove Removes a single item from the tree.

func (*HPRTree) Size

func (h *HPRTree) Size() int

Size Gets the number of items in the index.

type HilbertEncoder

type HilbertEncoder struct {
	// contains filtered or unexported fields
}

HilbertEncoder ...

func NewHilbertEncoder

func NewHilbertEncoder(level int, extent *envelope.Envelope) *HilbertEncoder

NewHilbertEncoder ...

type Item

type Item struct {
	Env  *envelope.Envelope
	Item interface{}
}

Item ...

func (*Item) ToString

func (it *Item) ToString() string

ToString ...

type ItemComparator

type ItemComparator struct {
	// contains filtered or unexported fields
}

ItemComparator sort items by HilbertEncoder

func (*ItemComparator) Len

func (it *ItemComparator) Len() int

Len ...

func (*ItemComparator) Less

func (it *ItemComparator) Less(i, j int) bool

Less ...

func (ItemComparator) Swap

func (it ItemComparator) Swap(i, j int)

Swap ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL