Documentation
¶
Overview ¶
Package map2wxx converts an hmz2map hex map into a Worldographer map.
Index ¶
- Constants
- func Check(m *hmz2map.Map) error
- func CheckApp(app string) error
- func ResolveApp(app string) string
- func RiverWidth(size hmz2map.RiverSize) (float64, error)
- func Rivers(m *hmz2map.Map, wetlandsAsLand bool) ([]RiverPath, RiverReport, error)
- func Tile(h *hmz2map.Hex) (string, error)
- func Version() semver.Version
- type Options
- type RiverEdge
- type RiverPath
- type RiverReport
- type TileCount
- type Vertex
Constants ¶
const ( TileFlatDesertCactus = "Classic/Flat Desert Cactus" TileFlatDesertHardClay = "Classic/Flat Desert Hard Clay" TileFlatDesertRocky = "Classic/Flat Desert Rocky" TileFlatFen = "Classic/Flat Fen" TileFlatForestDeciduous = "Classic/Flat Forest Deciduous" TileFlatForestEvergreen = "Classic/Flat Forest Evergreen" TileFlatForestEvergreenH = "Classic/Flat Forest Evergreen Heavy" TileFlatForestJungle = "Classic/Flat Forest Jungle" TileFlatForestMixed = "Classic/Flat Forest Mixed" TileFlatGrassland = "Classic/Flat Grassland" TileFlatMarsh = "Classic/Flat Marsh" TileFlatSavanna = "Classic/Flat Savanna" TileFlatShrubland = "Classic/Flat Shrubland" TileFlatSnowfields = "Classic/Flat Snowfields" TileFlatSteppe = "Classic/Flat Steppe" TileFlatSwamp = "Classic/Flat Swamp" TileFlatTundra = "Classic/Flat Tundra" TileFlatWetlandsJungle = "Classic/Flat Wetlands Jungle" TileHills = "Classic/Hills" TileHillsForestDeciduous = "Classic/Hills Forest Deciduous" TileHillsForestEvergreen = "Classic/Hills Forest Evergreen" TileHillsForestJungle = "Classic/Hills Forest Jungle" TileHillsForestMixed = "Classic/Hills Forest Mixed" TileHillsGrassland = "Classic/Hills Grassland" TileHillsGrassy = "Classic/Hills Grassy" TileHillsShrubland = "Classic/Hills Shrubland" TileMountainVolcano = "Classic/Mountain Volcano" TileMountains = "Classic/Mountains" TileMountainsForestDeciduous = "Classic/Mountains Forest Deciduous" TileMountainsForestEvergreen = "Classic/Mountains Forest Evergreen" TileMountainsForestJungle = "Classic/Mountains Forest Jungle" TileMountainsForestMixed = "Classic/Mountains Forest Mixed" TileMountainsGlacier = "Classic/Mountains Glacier" TileOtherBadlands = "Classic/Other Badlands" TileOtherBrokenLands = "Classic/Other Broken Lands" TileWaterOcean = "Classic/Water Ocean" TileWaterSea = "Classic/Water Sea" TileWaterSeaDeep = "Classic/Water Sea Deep" TileWaterShoals = "Classic/Water Shoals" )
Tile names are Worldographer 2.x's classic tiles, as its generator-data/terrain.properties names them.
const AppCurrent = "current"
AppCurrent is the -app value that names the newest application version wxx writes (xmlio.CurrentApp).
const RiverLayer = "Above Terrain"
RiverLayer is the map layer rivers are drawn on: above the tiles, whose background colors show the terrain, as Worldographer's own lines are.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check returns an error if m is not a map map2wxx can convert: the wrong schema version or layout, or a hex list that doesn't match the map's size.
func ResolveApp ¶
ResolveApp returns the application version an -app value names: app itself, or xmlio.CurrentApp() for AppCurrent. Whether wxx writes that version is checked by Convert.
func RiverWidth ¶ added in v0.2.0
RiverWidth returns the stroke width of a river of the given size, in the units of a shape's @strokeWidth (issue #1). Streams are drawn at the width of a line drawn in the app (0.05); rivers and great rivers are two and three times as wide, map2png's proportions.
func Tile ¶ added in v0.4.0
Tile returns the name of the Worldographer tile that draws h. The first rule that applies picks it:
- Water: by depth, or Water Sea for a lake.
- Cliffs and badlands: Other Broken Lands and Other Badlands.
- The volcano flag: Mountain Volcano.
- A surface other than clear: the surface's tile.
- Otherwise the biome's tile for the landform's relief.
Types ¶
type Options ¶ added in v0.2.0
type Options struct {
// App is the application version whose new-map defaults are used: a
// registered version such as "2.08" (see ResolveApp).
App string
// WetlandsAsLand treats marshes, swamps, and mangroves as land for
// rivers, as map2png's -wetlands-as-land does.
WetlandsAsLand bool
// TileColors leaves each tile in Worldographer's color for the tile,
// instead of coloring its background as map2png fills the hex.
TileColors bool
}
Options configures Convert.
type RiverEdge ¶ added in v0.2.0
RiverEdge is a hex side that a river is drawn along, from its upstream vertex to its downstream one.
func RiverEdges ¶ added in v0.2.0
RiverEdges returns the river edges to draw, as map2png draws them: each edge once, and only between two land hexes (or a land hex and the map's edge), so no river runs along a coast or lake shore.
An edge is taken from the hex that owns it, by its n, ne, or se side, or by its s, sw, or nw side when the hex across is off the map.
type RiverPath ¶ added in v0.2.0
RiverPath is a run of edges of one size class, drawn as one shape. Vertices are in flow order; a path of n edges has n + 1 vertices.
func RiverPaths ¶ added in v0.2.0
func RiverPaths(edges []RiverEdge, rep *RiverReport) ([]RiverPath, error)
RiverPaths joins edges into paths. An edge continues the path of the edge flowing into its upstream vertex when that edge is the same size and is the largest (by drainage) of the edges flowing in there; every other edge starts a path. So a tributary ends where it joins, the main stem runs through, and a path breaks where the size class changes.
It is an error for two edges to flow out of one vertex: rivers don't split.
type RiverReport ¶ added in v0.2.0
type RiverReport struct {
Edges map[hmz2map.RiverSize]int // edges drawn, by size
ShoreEdges int // skipped: a wet hex on one side, land on the other
WaterEdges int // skipped: no land on either side
Paths map[hmz2map.RiverSize]int // paths, by size
Confluences int // vertices where two or more drawn edges flow in
}
RiverReport counts what RiverEdges and RiverPaths did.
func Convert ¶
Convert returns m as a Worldographer map with the new-map defaults of application version opt.App, with a report of the rivers drawn.
The Worldographer map is COLUMNS, which is hmz2map's odd-q layout: hex (col, row) is tile [col][row]. Each tile is the classic Worldographer tile Tile picks for the hex, with its background colored as map2png fills the hex, or in the tile's own color if opt.TileColors is set. Each river path (see Rivers) is a line along hex edges on RiverLayer, RiverWidth wide.
type TileCount ¶ added in v0.4.0
TileCount is the number of hexes drawn with one tile.
func CountTiles ¶ added in v0.4.0
CountTiles returns the tiles w's hexes use, most-used first, then by name.