services

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

services/track_service.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge added in v1.3.2

type Edge struct {
	ID         int
	From       *Node
	To         *Node
	LineString orb.LineString
	Cost       float64
}

Edge 表示图中的边

type Graph added in v1.3.2

type Graph struct {
	Nodes map[string]*Node
	Edges []*Edge
}

Graph 表示路网图

type Item added in v1.3.2

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

优先队列实现

type Node added in v1.3.2

type Node struct {
	ID    string
	Point orb.Point
	Edges []*Edge
}

Node 表示图中的节点

type PriorityQueue added in v1.3.2

type PriorityQueue []*Item

func (PriorityQueue) Len added in v1.3.2

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less added in v1.3.2

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop added in v1.3.2

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push added in v1.3.2

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap added in v1.3.2

func (pq PriorityQueue) Swap(i, j int)

type SplitResult added in v1.3.2

type SplitResult struct {
	Feature      *geojson.Feature
	SplitPoint   orb.Point
	SegmentIndex int     // 在哪个线段上打断
	T            float64 // 投影参数
}

SplitResult 存储线段打断的结果

type TrackService

type TrackService struct{}

func NewTrackService

func NewTrackService() *TrackService

func (*TrackService) CalculateShortestPath

func (s *TrackService) CalculateShortestPath(
	ctx context.Context,
	linesGeoJSON *geojson.FeatureCollection,
	startPoint []float64,
	endPoint []float64,
) (*geojson.FeatureCollection, error)

func (*TrackService) FindNearestPointOnLines added in v1.3.2

func (s *TrackService) FindNearestPointOnLines(
	ctx context.Context,
	linesGeoJSON *geojson.FeatureCollection,
	targetPoint []float64,
	maxDistance float64,
) (snappedPoint []float64, distance float64, lineID int, err error)

FindNearestPointOnLines 修改签名,添加 maxDistance 参数

func (*TrackService) GetAndBreakGeometries

func (s *TrackService) GetAndBreakGeometries(
	ctx context.Context,
	layerNames []string,
	bbox geojson.FeatureCollection,
) (*geojson.FeatureCollection, error)

Jump to

Keyboard shortcuts

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