services

package
v1.3.5 Latest Latest
Warning

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

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

Documentation

Overview

service/file_service.go

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 FileController added in v1.3.4

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

func NewFileController added in v1.3.4

func NewFileController(fileService *FileService) *FileController

func (*FileController) GetDirectoryContent added in v1.3.4

func (c *FileController) GetDirectoryContent(ctx *gin.Context)

GetDirectoryContent 获取目录内容(懒加载)

func (*FileController) GetRootPath added in v1.3.4

func (c *FileController) GetRootPath(ctx *gin.Context)

GetRootPath 获取根目录路径

type FileNode added in v1.3.4

type FileNode struct {
	Name    string    `json:"name"`
	Path    string    `json:"path"` // 绝对路径
	IsDir   bool      `json:"isDir"`
	Size    int64     `json:"size"`
	Ext     string    `json:"ext"` // 文件扩展名
	ModTime time.Time `json:"modTime"`
}

type FileService added in v1.3.4

type FileService struct {
	RootPath string // 限制访问的根目录
}

func NewFileService added in v1.3.4

func NewFileService(rootPath string) *FileService

func (*FileService) GetDirectoryContent added in v1.3.4

func (s *FileService) GetDirectoryContent(requestPath string) ([]FileNode, error)

GetDirectoryContent 获取指定目录下的直接子项(非递归)

func (*FileService) GetRootPath added in v1.3.4

func (s *FileService) GetRootPath() string

GetRootPath 获取根目录信息

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