services

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Overview

service/file_service.go

texture_service.go

views/tile_server_manager.go

services/track_service.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImg added in v1.3.10

func GetImg(ImgMap []ImgMap, LayerName string) []byte

func ParseBounds added in v1.7.4

func ParseBounds(boundsStr string) (minLon, minLat, maxLon, maxLat float64, err error)

ParseBounds 解析边界字符串

func ParseCenter added in v1.7.4

func ParseCenter(centerStr string) (lon, lat float64, err error)

ParseCenter 解析中心点字符串

Types

type DocumentBuilder added in v1.3.10

type DocumentBuilder struct {
	Geo    *geojson.FeatureCollection
	IMGMap []ImgMap
	// contains filtered or unexported fields
}

DocumentBuilder Word文档构建器

func NewDocumentBuilderFromBytes added in v1.3.10

func NewDocumentBuilderFromBytes(data []byte) (*DocumentBuilder, error)

在 services 包中添加

func NewDocumentBuilderFromFile added in v1.3.10

func NewDocumentBuilderFromFile(filename string) (*DocumentBuilder, error)

NewDocumentBuilderFromFile 从现有文件创建文档构建器

func (*DocumentBuilder) AddAnalysisParagraphConfig added in v1.3.10

func (db *DocumentBuilder) AddAnalysisParagraphConfig(config models.AnalysisParagraphConfig) *DocumentBuilder

AddParagraph 插入正文

func (*DocumentBuilder) AddContentItem added in v1.3.10

func (db *DocumentBuilder) AddContentItem(item models.ContentItem) error

AddContentItem 根据ContentItem配置添加单个内容

func (*DocumentBuilder) AddContentItems added in v1.3.10

func (db *DocumentBuilder) AddContentItems(items []models.ContentItem) error

AddContentItems 批量添加内容

func (*DocumentBuilder) AddHeading1 added in v1.3.10

func (db *DocumentBuilder) AddHeading1(config models.Heading1Config) *DocumentBuilder

AddHeading1 插入1级标题

func (*DocumentBuilder) AddHeading2 added in v1.3.10

func (db *DocumentBuilder) AddHeading2(config models.Heading2Config) *DocumentBuilder

AddHeading2 插入2级标题

func (*DocumentBuilder) AddHeading3 added in v1.3.10

func (db *DocumentBuilder) AddHeading3(config models.Heading3Config) *DocumentBuilder

AddHeading3 插入3级标题

func (*DocumentBuilder) AddImage added in v1.3.10

func (db *DocumentBuilder) AddImage(config models.ImageConfig, Img []byte) error

AddImage 插入图片

func (*DocumentBuilder) AddParagraph added in v1.3.10

func (db *DocumentBuilder) AddParagraph(config models.ParagraphConfig) *DocumentBuilder

AddParagraph 插入正文

func (*DocumentBuilder) AddTable added in v1.3.10

func (db *DocumentBuilder) AddTable(config models.TableConfig) error

AddTable 插入表格

func (*DocumentBuilder) Close added in v1.3.10

func (db *DocumentBuilder) Close() error

Close 关闭文档

func (*DocumentBuilder) GetDocument added in v1.3.10

func (db *DocumentBuilder) GetDocument() *document.Document

GetDocument 获取底层文档对象

func (*DocumentBuilder) Save added in v1.3.10

func (db *DocumentBuilder) Save(filename string) error

Save 保存文档

func (*DocumentBuilder) SaveAndClose added in v1.3.10

func (db *DocumentBuilder) SaveAndClose(filename string) error

SaveAndClose 保存并关闭文档

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 ImgMap added in v1.3.10

type ImgMap struct {
	IMG       []byte
	LayerName string
}

type Item added in v1.3.2

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

优先队列实现

type LayerSymbolSetting added in v1.5.3

type LayerSymbolSetting struct {
	LayerName  string      `json:"layer_name"`
	AttName    string      `json:"att_name"`
	SymbolSets []SymbolSet `json:"symbol_sets"`
}

LayerSymbolSetting 图层图标设置

type LayerTextureSetting added in v1.4.12

type LayerTextureSetting struct {
	LayerName   string       `json:"layer_name"`
	AttName     string       `json:"attribute_name"`
	TextureSets []TextureSet `json:"texture_sets"`
}

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 // 投影参数 (0-1),表示在该 segment 上的位置
}

SplitResult 存储线段打断的结果

type SymbolDetail added in v1.5.3

type SymbolDetail struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	MimeType    string `json:"mime_type"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	Description string `json:"description"`
	Category    string `json:"category"`
	ImageBase64 string `json:"image_base64"`
	ImageURL    string `json:"image_url"`
	CreatedAt   int64  `json:"created_at"`
	UpdatedAt   int64  `json:"updated_at"`
}

SymbolDetail 详情(含Base64图片数据)

type SymbolListItem added in v1.5.3

type SymbolListItem struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	MimeType    string `json:"mime_type"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	Description string `json:"description"`
	Category    string `json:"category"`
	ImageURL    string `json:"image_url"`
	CreatedAt   int64  `json:"created_at"`
	UpdatedAt   int64  `json:"updated_at"`
}

SymbolListItem 列表项(不含图片数据)

type SymbolService added in v1.5.3

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

func NewSymbolService added in v1.5.3

func NewSymbolService() *SymbolService

func (*SymbolService) BatchUpload added in v1.5.3

func (s *SymbolService) BatchUpload(files []*multipart.FileHeader, category string) ([]models.Symbol, []error)

BatchUpload 批量上传图标

func (*SymbolService) Delete added in v1.5.3

func (s *SymbolService) Delete(id uint) error

Delete 删除图标

func (*SymbolService) GetByID added in v1.5.3

func (s *SymbolService) GetByID(id uint) (*SymbolDetail, error)

GetByID 根据ID获取图标详情

func (*SymbolService) GetCategories added in v1.5.3

func (s *SymbolService) GetCategories() ([]string, error)

GetCategories 获取所有图标分类

func (*SymbolService) GetImageData added in v1.5.3

func (s *SymbolService) GetImageData(id uint) ([]byte, string, error)

GetImageData 获取原始图片数据

func (*SymbolService) GetLayerSymbol added in v1.5.3

func (s *SymbolService) GetLayerSymbol(layerName string) (*LayerSymbolSetting, error)

GetLayerSymbol 获取图层图标设置

func (*SymbolService) GetUsedSymbols added in v1.5.3

func (s *SymbolService) GetUsedSymbols(host string) ([]SymbolListItem, error)

GetUsedSymbols 获取所有已配置使用的图标

func (*SymbolService) List added in v1.5.3

func (s *SymbolService) List(page, pageSize int, category string) ([]SymbolListItem, int64, error)

List 获取图标列表(分页)

func (*SymbolService) Search added in v1.5.3

func (s *SymbolService) Search(query string, page, pageSize int, host string, category string) ([]SymbolListItem, int64, error)

Search 搜索图标

func (*SymbolService) SetLayerSymbol added in v1.5.3

func (s *SymbolService) SetLayerSymbol(layerName string, setting LayerSymbolSetting) error

SetLayerSymbol 设置图层图标

func (*SymbolService) Update added in v1.5.3

func (s *SymbolService) Update(id uint, name, description, category string) error

Update 更新图标信息

func (*SymbolService) Upload added in v1.5.3

func (s *SymbolService) Upload(req *SymbolUploadRequest) (*models.Symbol, error)

Upload 上传图标

type SymbolSet added in v1.5.3

type SymbolSet struct {
	AttValue   string  `json:"att_value"`
	SymbolID   string  `json:"symbol_id"`
	SymbolName string  `json:"symbol_name"`
	Scale      float64 `json:"scale,omitempty"`    // 图标缩放比例
	Rotation   float64 `json:"rotation,omitempty"` // 图标旋转角度
	OffsetX    float64 `json:"offset_x,omitempty"` // X偏移
	OffsetY    float64 `json:"offset_y,omitempty"` // Y偏移
}

type SymbolUploadRequest added in v1.5.3

type SymbolUploadRequest struct {
	Name        string
	Description string
	Category    string
	File        *multipart.FileHeader
}

SymbolUploadRequest 上传请求参数

type TextureListItem added in v1.4.11

type TextureListItem struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	MimeType    string `json:"mime_type"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	Description string `json:"description"`
	Url         string `json:"url"`
}

TextureListItem 列表项(不包含图片数据)

type TextureService added in v1.4.11

type TextureService struct{}

func NewTextureService added in v1.4.11

func NewTextureService() *TextureService

func (*TextureService) ConvertToPNG added in v1.6.1

func (s *TextureService) ConvertToPNG(file *multipart.FileHeader) ([]byte, error)

func (*TextureService) Delete added in v1.4.11

func (s *TextureService) Delete(id uint) error

Delete 删除纹理

func (*TextureService) GetByID added in v1.4.11

func (s *TextureService) GetByID(id uint) (*models.Texture, error)

GetByID 根据ID获取纹理(包含图片数据)

func (*TextureService) GetImageData added in v1.4.11

func (s *TextureService) GetImageData(id uint) ([]byte, error)

GetImageData 获取原始图片数据

func (*TextureService) GetLayerTexture added in v1.4.13

func (s *TextureService) GetLayerTexture(layerName string) (*LayerTextureSetting, error)

GetLayerTexture 获取图层纹理设置

func (*TextureService) GetRawImage added in v1.4.11

func (s *TextureService) GetRawImage(id uint) (image.Image, error)

GetRawImage 获取可直接显示的图片(返回PNG解码后的image.Image)

func (*TextureService) GetUsedTextures added in v1.4.13

func (s *TextureService) GetUsedTextures(host string) ([]TextureListItem, error)

GetUsedTextures 获取所有已配置的纹理(从MySchema表的TextureSet中提取并去重)

func (*TextureService) List added in v1.4.11

func (s *TextureService) List(page, pageSize int) ([]TextureListItem, int64, error)

List 获取纹理列表(不包含图片数据)

func (*TextureService) Search added in v1.4.15

func (s *TextureService) Search(query string, page, pageSize int, host string) ([]TextureListItem, int64, error)

Search 搜索纹理(支持ID、名称、描述的模糊匹配)

func (*TextureService) SetLayerTexture added in v1.4.12

func (s *TextureService) SetLayerTexture(layerName string, textureSets LayerTextureSetting) error

func (*TextureService) Upload added in v1.4.11

func (s *TextureService) Upload(req *UploadRequest) (*models.Texture, error)

Upload 上传纹理图片

type TextureSet added in v1.4.12

type TextureSet struct {
	Property    string `json:"property"`
	TextureID   string `json:"texture_id"`
	TextureName string `json:"texture_name"`
}

type TileServerManager added in v1.7.4

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

TileServerManager 瓦片服务管理器

func GetTileServerManager added in v1.7.4

func GetTileServerManager() *TileServerManager

GetTileServerManager 获取单例管理器

func InitTileServerManager added in v1.7.4

func InitTileServerManager(db *gorm.DB) *TileServerManager

InitTileServerManager 初始化管理器(在程序启动时调用)

func (*TileServerManager) AddService added in v1.7.4

func (m *TileServerManager) AddService(raster *models.DynamicRaster) error

AddService 添加新的服务配置

func (*TileServerManager) CloseAll added in v1.7.4

func (m *TileServerManager) CloseAll()

CloseAll 关闭所有服务

func (*TileServerManager) DeleteService added in v1.7.4

func (m *TileServerManager) DeleteService(name string) error

DeleteService 删除服务

func (*TileServerManager) GetServer added in v1.7.4

GetServer 获取服务实例

func (*TileServerManager) GetServiceConfig added in v1.7.4

func (m *TileServerManager) GetServiceConfig(name string) (*models.DynamicRaster, error)

GetServiceConfig 获取服务配置

func (*TileServerManager) ListRunningServices added in v1.7.4

func (m *TileServerManager) ListRunningServices() []string

ListRunningServices 列出运行中的服务

func (*TileServerManager) ListServices added in v1.7.4

func (m *TileServerManager) ListServices() ([]models.DynamicRaster, error)

ListServices 列出所有服务

func (*TileServerManager) LoadAllServices added in v1.7.4

func (m *TileServerManager) LoadAllServices()

LoadAllServices 从数据库加载所有服务配置并启动

func (*TileServerManager) RefreshService added in v1.7.4

func (m *TileServerManager) RefreshService(name string) error

RefreshService 刷新服务(重新加载)

func (*TileServerManager) StartServer added in v1.7.4

func (m *TileServerManager) StartServer(name string) error

StartServer 启动服务

func (*TileServerManager) StopServer added in v1.7.4

func (m *TileServerManager) StopServer(name string)

StopServer 停止服务

func (*TileServerManager) UpdateService added in v1.7.4

func (m *TileServerManager) UpdateService(name string, updates map[string]interface{}) error

UpdateService 更新服务配置

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)

type UploadRequest added in v1.4.11

type UploadRequest struct {
	Name        string
	Description string
	File        *multipart.FileHeader
}

UploadRequest 上传请求参数

Jump to

Keyboard shortcuts

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