clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

feat: let a region carry its ground

Dami committed ef7a9d2
The pipeline has read regions out of MapGenie captures since the
beginning, but the translated sources could only ever say they had
none: mgdoc spelled Regions as a slice of nothing. It is now a real
type -- title, subtitle, and GeoJSON-shaped polygon features in the
same synthetic coordinates a pin speaks -- matching what the
generator's decoder already reads. The three existing translators
still emit the empty slice they always did, byte for byte, so no
stamp moves; the difference is that the next source can name ground.
commit
ef7a9d21ab4dc5a99e453afddb9c03986171fdf8
parent
56800ad9766c00d03313103e32be1b3e737b20af
author
Dami <dami.etoile@gmail.com>
4 files changed, +31 -4
Minternal/ignmap/ignmap.go2+-
Minternal/mgdoc/mgdoc.go29++++++++++++++++++++++++++++-
Minternal/pbmap/pbmap.go2+-
Minternal/trekmap/trekmap.go2+-
M internal/ignmap/ignmap.go +1 -1
M internal/mgdoc/mgdoc.go +28 -1
@@ -8,6 +8,7 @@
88 package mgdoc99 1010 import (11+ "encoding/json"1112 "fmt"1213 "hash/fnv"1314 "math"
@@ -39,10 +40,36 @@ type Map struct {
3940 Config Config `json:"config"`4041 Game Game `json:"game"`4142 Groups []Group `json:"groups"`42- Regions []struct{} `json:"regions"`43+ Regions []Region `json:"regions"`4344 Attrs map[string]string `json:"atlas_attrs,omitempty"`4445 }4546 47+// Region is a named piece of ground: the generator reads it into a zone, and48+// its features carry GeoJSON-shaped polygon geometry whose positions are the49+// same synthetic longitude and latitude a pin speaks. Sources without ground50+// to name leave the slice empty rather than absent, which is the shape a real51+// MapGenie capture spells.52+type Region struct {53+ ID int64 `json:"id"`54+ Title string `json:"title"`55+ Subtitle string `json:"subtitle,omitempty"`56+ ParentRegionID *int64 `json:"parent_region_id,omitempty"`57+ CenterX *float64 `json:"center_x,omitempty"`58+ CenterY *float64 `json:"center_y,omitempty"`59+ Features []RegionFeature `json:"features,omitempty"`60+}61+62+type RegionFeature struct {63+ Geometry Geometry `json:"geometry"`64+}65+66+// Geometry is the GeoJSON slice of a region feature: Polygon or MultiPolygon,67+// coordinates kept raw because the generator passes them through verbatim.68+type Geometry struct {69+ Type string `json:"type"`70+ Coordinates json.RawMessage `json:"coordinates"`71+}72+4673 type Game struct {4774 ID int64 `json:"id"`4875 Title string `json:"title"`
M internal/pbmap/pbmap.go +1 -1
M internal/trekmap/trekmap.go +1 -1