Documentation ¶
Index ¶
- func ToolDot() error
- func ToolInit() error
- func ToolNoise(noise float64) error
- func ToolNormalize() error
- func ToolSplit(maxDist float64) error
- func ToolSvg() error
- type ClientCLI
- func (c *ClientCLI) GetCities(ctx context.Context, args PathArgs) error
- func (c *ClientCLI) GetPath(ctx context.Context, args PathArgs) error
- func (c *ClientCLI) GetPositions(ctx context.Context, args PathArgs) error
- func (c *ClientCLI) GetRoads(ctx context.Context, args PathArgs) error
- func (c *ClientCLI) GetStep(ctx context.Context, args PathArgs) error
- func (c *ClientCLI) ListMaps(ctx context.Context, args PathArgs) error
- type MapRaw
- type MapSeed
- type PathArgs
- type RoadRaw
- type RoadSeed
- type SiteRaw
- type SiteSeed
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToolDot ¶
func ToolDot() error
ToolDot consumes a MapRaw on os.Stdin, parses it and dumps to os.Stdout a dot representation (cf. graphviz.org) of it.
func ToolInit ¶
func ToolInit() error
ToolInit consumes a MapSeed on os.Stdin, parses it, extrapolates the MapRaw from it and then dumps that MapRaw to os.Stdout.
func ToolNoise ¶
ToolNoise consumes a MapRaw on os.Stdin, parses it then alter each node position (with a configurable statistical noise) and the dumps the new MapRaw on os.Stdout.
func ToolNormalize ¶
func ToolNormalize() error
ToolNormalize consumes a MapRaw on os.Stdin, parses it a remap each node position (keeping the same aspect ratio to fit the whole map into a given bounded box.
Types ¶
type ClientCLI ¶
type ClientCLI struct{}
ClientCLI gathers the command line interface actions related to the Map API service. It wraps the main gRPC client calls and dumps all the output as JSON on os.Stdout.
func (*ClientCLI) GetCities ¶
GetCities produces to os.Stdout a JSON array of cities, where each City is an <id,name> tuple.
func (*ClientCLI) GetPath ¶
GetPath produces to os.Stdout a JSON array of integers, all fields being the unique ID of a position involved in the path from the given source to the given destination.
func (*ClientCLI) GetPositions ¶
GetPositions produces to os.Stdout a JSON array of <id,x,y> tuples, all fields being integers, with one tuple for each position on the map, i.e. one tuple per vertex in the graph.
func (*ClientCLI) GetRoads ¶
GetRoads produces to os.Stdout a JSON stream of <int,int> pairs objects, with one pair for a road in place on the given map.
type MapRaw ¶
type MapRaw struct { ID string `json:"id"` Sites []SiteRaw `json:"sites"` Roads []RoadRaw `json:"roads"` }
MapRaw is a human-unfriendly representation of a Map - The Sites are indexed by a unique number - The presence of a non-empty name on the site makes it an established City when the map is instantiated. - The roads are unidirectional (the MapRaw is a digraph). - A road might be duplicated, without effect
type MapSeed ¶
type MapSeed struct { ID string `json:"id"` Sites []SiteSeed `json:"sites"` Roads []RoadSeed `json:"roads"` }
MapSeed is a handy representation of a map where nearly each node of the graph carries a city. - The sites are identified by a textual name, typically decided by a content creator that will name the cities in a meaningful way. - Each site name MUST be unique - The reads bidirectional. - Duplicated roads are treated as is, no simplification is done.
type PathArgs ¶
PathArgs gathers the possible arguments for the map-related calls. Hopefully they are always the same.
type RoadSeed ¶
RoadSeed is the minimal representation of a diriectional graph edge in a map for Hegemonie.
type SiteRaw ¶
type SiteRaw struct { ID uint64 `json:"id"` X uint64 `json:"x"` Y uint64 `json:"y"` // City is the name of the city that should exist at the instanciation a region based on the current map. // The presence of a City is achieved by a non-empty string in the City field, that will be the name of the city City string `json:"city"` }
SiteRaw is the information of a node in the graph representation on a map by MapRaw.