Documentation ¶
Index ¶
- func DistanceOnEarth(location1, location2 GeoLocation) float64
- func EuclideanDistance(location1, location2 GeoLocation) float64
- func NewMap() *concurrentMap
- type GeoLocation
- type Position
- type QuadTree
- func (q *QuadTree) Delete(locationID string) error
- func (q *QuadTree) Get(locationID string) (QuadTreeLeaf, error)
- func (q QuadTree) GetAllLocations() QuadTreeSnapshot
- func (q *QuadTree) GetNearbyLocations(location Position, radiusInMetres, limit int) []QuadTreeNeighborResult
- func (q *QuadTree) Insert(locationID string, location Position, data map[string]interface{})
- func (q *QuadTree) Update(locationID string, location Position, data map[string]interface{}) error
- func (q *QuadTree) UpdateData(locationID string, data map[string]interface{}) error
- func (q *QuadTree) UpdateLocation(locationID string, location Position) error
- type QuadTreeLeaf
- type QuadTreeNeighborResult
- type QuadTreeNode
- type QuadTreeSnapshot
- type Quadrille
- type Rectangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DistanceOnEarth ¶
func DistanceOnEarth(location1, location2 GeoLocation) float64
func EuclideanDistance ¶
func EuclideanDistance(location1, location2 GeoLocation) float64
Types ¶
type GeoLocation ¶
type Position ¶
type Position struct {
Latitude, Longitude float64
}
func NewPosition ¶
func (Position) DistanceTo ¶
func (p Position) DistanceTo(location GeoLocation) float64
func (Position) IntersectsRectangle ¶
type QuadTree ¶
type QuadTree struct {
// contains filtered or unexported fields
}
func NewQuadTree ¶
func (QuadTree) GetAllLocations ¶
func (q QuadTree) GetAllLocations() QuadTreeSnapshot
func (*QuadTree) GetNearbyLocations ¶
func (q *QuadTree) GetNearbyLocations(location Position, radiusInMetres, limit int) []QuadTreeNeighborResult
func (*QuadTree) UpdateData ¶
type QuadTreeLeaf ¶
type QuadTreeLeaf struct { Location Position `json:"location"` LocationID string `json:"locationID"` Data map[string]interface{} `json:"data"` }
func NewQuadTreeLeaf ¶
func NewQuadTreeLeaf(location Position, locationID string, data map[string]interface{}) *QuadTreeLeaf
func (QuadTreeLeaf) GetLocation ¶
func (q QuadTreeLeaf) GetLocation() Position
func (QuadTreeLeaf) GetLocationID ¶
func (q QuadTreeLeaf) GetLocationID() string
type QuadTreeNeighborResult ¶
type QuadTreeNeighborResult struct { Leaf QuadTreeLeaf `json:"Leaf"` Distance float64 `json:"Distance"` }
func NewQuadTreeNeighborResult ¶
func NewQuadTreeNeighborResult(leaf QuadTreeLeaf, distance float64) *QuadTreeNeighborResult
type QuadTreeNode ¶
type QuadTreeNode struct {
// contains filtered or unexported fields
}
func NewQuadTreeNode ¶
func NewQuadTreeNode(boundingBox Rectangle, children *[4]*QuadTreeNode, isLeaf bool, leaves *map[string]*QuadTreeLeaf, parent *QuadTreeNode) *QuadTreeNode
type QuadTreeSnapshot ¶
type QuadTreeSnapshot map[string]QuadTreeLeaf
type Quadrille ¶
type Quadrille interface { Insert(string, Position, map[string]interface{}) Delete(string) error Update(string, Position, map[string]interface{}) error UpdateLocation(string, Position) error UpdateData(string, map[string]interface{}) error GetNearbyLocations(Position, int, int) []QuadTreeNeighborResult Get(string) (QuadTreeLeaf, error) GetAllLocations() QuadTreeSnapshot }
type Rectangle ¶
type Rectangle interface { Corner1() GeoLocation Corner2() GeoLocation GetAllCorners() [4]GeoLocation GetNearestCorner(location GeoLocation) GeoLocation GetQuadrants() [4]Rectangle }
func NewRectangle ¶
func NewRectangle(corner1, corner2 GeoLocation) Rectangle
Click to show internal directories.
Click to hide internal directories.