Documentation
¶
Overview ¶
service/file_service.go
texture_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 LayerSymbolSetting
- type LayerTextureSetting
- type Node
- type PriorityQueue
- type SplitResult
- type SymbolDetail
- type SymbolListItem
- type SymbolService
- func (s *SymbolService) BatchUpload(files []*multipart.FileHeader, category string) ([]models.Symbol, []error)
- func (s *SymbolService) Delete(id uint) error
- func (s *SymbolService) GetByID(id uint) (*SymbolDetail, error)
- func (s *SymbolService) GetCategories() ([]string, error)
- func (s *SymbolService) GetImageData(id uint) ([]byte, string, error)
- func (s *SymbolService) GetLayerSymbol(layerName string) (*LayerSymbolSetting, error)
- func (s *SymbolService) GetUsedSymbols(host string) ([]SymbolListItem, error)
- func (s *SymbolService) List(page, pageSize int, category string) ([]SymbolListItem, int64, error)
- func (s *SymbolService) Search(query string, page, pageSize int, host string, category string) ([]SymbolListItem, int64, error)
- func (s *SymbolService) SetLayerSymbol(layerName string, setting LayerSymbolSetting) error
- func (s *SymbolService) Update(id uint, name, description, category string) error
- func (s *SymbolService) Upload(req *SymbolUploadRequest) (*models.Symbol, error)
- type SymbolSet
- type SymbolUploadRequest
- type TextureListItem
- type TextureService
- func (s *TextureService) ConvertToPNG(file *multipart.FileHeader) ([]byte, error)
- 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)
- 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 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 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 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 上传请求参数