Documentation
¶
Overview ¶
service/file_service.go
services/track_service.go
Index ¶
- func GetImg(ImgMap []ImgMap, LayerName string) []byte
- type DocumentBuilder
- func (db *DocumentBuilder) AddAnalysisParagraphConfig(config models.AnalysisParagraphConfig) *DocumentBuilder
- func (db *DocumentBuilder) AddContentItem(item models.ContentItem) error
- func (db *DocumentBuilder) AddContentItems(items []models.ContentItem) error
- func (db *DocumentBuilder) AddHeading1(config models.Heading1Config) *DocumentBuilder
- func (db *DocumentBuilder) AddHeading2(config models.Heading2Config) *DocumentBuilder
- func (db *DocumentBuilder) AddHeading3(config models.Heading3Config) *DocumentBuilder
- func (db *DocumentBuilder) AddImage(config models.ImageConfig, Img []byte) error
- func (db *DocumentBuilder) AddParagraph(config models.ParagraphConfig) *DocumentBuilder
- func (db *DocumentBuilder) AddTable(config models.TableConfig) error
- func (db *DocumentBuilder) Close() error
- func (db *DocumentBuilder) GetDocument() *document.Document
- func (db *DocumentBuilder) Save(filename string) error
- func (db *DocumentBuilder) SaveAndClose(filename string) error
- type Edge
- type FileController
- type FileNode
- type FileService
- type Graph
- type ImgMap
- type Item
- type LayerTextureSetting
- type Node
- type PriorityQueue
- type SplitResult
- type TextureListItem
- type TextureService
- func (s *TextureService) Delete(id uint) error
- func (s *TextureService) GetByID(id uint) (*models.Texture, error)
- func (s *TextureService) GetImageData(id uint) ([]byte, error)
- func (s *TextureService) GetLayerTexture(layerName string) (*LayerTextureSetting, error)
- func (s *TextureService) GetRawImage(id uint) (image.Image, error)
- func (s *TextureService) GetUsedTextures(host string) ([]TextureListItem, error)
- func (s *TextureService) List(page, pageSize int) ([]TextureListItem, int64, error)
- func (s *TextureService) Search(query string, page, pageSize int, host string) ([]TextureListItem, int64, error)
- func (s *TextureService) SetLayerTexture(layerName string, textureSets LayerTextureSetting) error
- func (s *TextureService) Upload(req *UploadRequest) (*models.Texture, error)
- func (s *TextureService) ValidatePNG(file *multipart.FileHeader) error
- type TextureSet
- type TrackService
- func (s *TrackService) CalculateShortestPath(ctx context.Context, linesGeoJSON *geojson.FeatureCollection, ...) (*geojson.FeatureCollection, error)
- func (s *TrackService) FindNearestPointOnLines(ctx context.Context, linesGeoJSON *geojson.FeatureCollection, ...) (snappedPoint []float64, distance float64, lineID int, err error)
- func (s *TrackService) GetAndBreakGeometries(ctx context.Context, layerNames []string, bbox geojson.FeatureCollection) (*geojson.FeatureCollection, error)
- type UploadRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 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 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 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 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 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) 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 上传纹理图片
func (*TextureService) ValidatePNG ¶ added in v1.4.11
func (s *TextureService) ValidatePNG(file *multipart.FileHeader) error
ValidatePNG 验证文件是否为PNG格式
type TextureSet ¶ added in v1.4.12
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 上传请求参数