summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-03-17 14:01:52 +0100
committerTor Andersson <tor@ccxvii.net>2024-03-17 14:01:52 +0100
commiteb1b52100cc054f7ddbeb865e8b001828b07704d (patch)
treeb7b8f150bd2831755514ffdf30a85d32ad768fb0 /tools
parent7cc262183757b83ff1a5400f3816389b7f175583 (diff)
downloadmaria-eb1b52100cc054f7ddbeb865e8b001828b07704d.tar.gz
Parse layout and generate map data.
Diffstat (limited to 'tools')
-rw-r--r--tools/layout.svg1234
-rw-r--r--tools/names.txt2
-rw-r--r--tools/parse-layout.js235
3 files changed, 857 insertions, 614 deletions
diff --git a/tools/layout.svg b/tools/layout.svg
index a0c043e..20c77f0 100644
--- a/tools/layout.svg
+++ b/tools/layout.svg
@@ -40,10 +40,10 @@
inkscape:window-height="480"
id="namedview6"
showgrid="false"
- inkscape:zoom="0.96460962"
- inkscape:cx="1030.3441"
- inkscape:cy="834.95823"
- inkscape:current-layer="svg4"
+ inkscape:zoom="2.9584691"
+ inkscape:cx="719.82834"
+ inkscape:cy="902.87542"
+ inkscape:current-layer="g5174"
inkscape:document-rotation="0"
showguides="false">
<inkscape:grid
@@ -53,17 +53,566 @@
<image
sodipodi:absref="/home/tor/src/rally/public/maria/Maria.Gameboard.150.png"
xlink:href="../Maria.Gameboard.150.png"
- style="display:inline"
- x="0"
- y="0"
- width="2485"
- height="1654"
- image-rendering="pixelated"
+ id="image2"
sodipodi:insensitive="true"
- id="image2" />
+ image-rendering="pixelated"
+ height="1654"
+ width="2485"
+ y="0"
+ x="0"
+ style="display:inline" />
+ <g
+ id="g2467"
+ inkscape:label="major_fortress"
+ style="fill:#ffffff"
+ sodipodi:insensitive="true">
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2422"
+ cx="78.936989"
+ cy="730.62244"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2424"
+ cx="201.31735"
+ cy="1418.5251"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2426"
+ cx="482.35126"
+ cy="1155.5575"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2428"
+ cx="595.6712"
+ cy="312.47647"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2430"
+ cx="861.29175"
+ cy="190.86034"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2432"
+ cx="1175.3353"
+ cy="300.33441"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2434"
+ cx="1445.4271"
+ cy="209.21451"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2436"
+ cx="1509.8654"
+ cy="581.40253"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2438"
+ cx="1640.8955"
+ cy="840.84808"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2440"
+ cx="2050.6885"
+ cy="1055.5642"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2442"
+ cx="2075.1187"
+ cy="528.09021"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2444"
+ cx="2006.139"
+ cy="1327.3361"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2446"
+ cx="1627.3788"
+ cy="1320.0774"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2448"
+ cx="1184.2834"
+ cy="1330.5629"
+ r="16" />
+ <circle
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="circle2450"
+ cx="245.14282"
+ cy="937.73083"
+ r="16" />
+ </g>
+ <g
+ id="g2403"
+ inkscape:label="minor_fortress"
+ sodipodi:insensitive="true">
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2211"
+ width="26"
+ height="26"
+ x="270"
+ y="461" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2213"
+ width="26"
+ height="26"
+ x="268"
+ y="569" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2215"
+ width="26"
+ height="26"
+ x="182"
+ y="575" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2217"
+ width="26"
+ height="26"
+ x="384"
+ y="574" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2219"
+ width="26"
+ height="26"
+ x="277"
+ y="725" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:1.03846"
+ id="rect2221"
+ width="27"
+ height="27"
+ x="166"
+ y="764" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2223"
+ width="26"
+ height="26"
+ x="64"
+ y="980" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:1.03846"
+ id="rect2225"
+ width="27"
+ height="27"
+ x="375"
+ y="1019" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2227"
+ width="26"
+ height="26"
+ x="371.01392"
+ y="882.64435" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2229"
+ width="26"
+ height="26"
+ x="501.0282"
+ y="1065.3435" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2231"
+ width="26"
+ height="26"
+ x="533.38898"
+ y="927.52374" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2233"
+ width="26"
+ height="26"
+ x="620.91315"
+ y="971.07019" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2235"
+ width="26"
+ height="26"
+ x="498.40408"
+ y="789.68854" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2237"
+ width="26"
+ height="26"
+ x="425.12064"
+ y="692.22241" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2239"
+ width="26"
+ height="26"
+ x="717.38831"
+ y="708.78241" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2241"
+ width="26"
+ height="26"
+ x="849.22089"
+ y="947.05914" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2243"
+ width="26"
+ height="26"
+ x="865.2486"
+ y="1063.5491" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2245"
+ width="26"
+ height="26"
+ x="731.14117"
+ y="1174.0287" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2247"
+ width="26"
+ height="26"
+ x="684.0929"
+ y="1232.8259" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2249"
+ width="26"
+ height="26"
+ x="582.27399"
+ y="1374.7003" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2251"
+ width="26"
+ height="26"
+ x="497.19083"
+ y="1420.0902" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2253"
+ width="26"
+ height="26"
+ x="305.03281"
+ y="1486.0468" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2255"
+ width="26"
+ height="26"
+ x="263.19327"
+ y="1259.7412" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2257"
+ width="26"
+ height="26"
+ x="310.34464"
+ y="1173.1018" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
+ id="rect2259"
+ width="26"
+ height="26"
+ x="128.80182"
+ y="1159.8348" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2261"
+ width="26"
+ height="26"
+ x="454.17908"
+ y="433.18094" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2263"
+ width="26"
+ height="26"
+ x="527.41046"
+ y="447.88062" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2265"
+ width="26"
+ height="26"
+ x="624.04517"
+ y="433.48523" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2267"
+ width="26"
+ height="26"
+ x="753.31445"
+ y="303.02036" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2269"
+ width="26"
+ height="26"
+ x="1048.9004"
+ y="384.70389" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2271"
+ width="26"
+ height="26"
+ x="1263.3169"
+ y="530.0434" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2273"
+ width="26"
+ height="26"
+ x="1201.8419"
+ y="106.1827" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2275"
+ width="26"
+ height="26"
+ x="1322.778"
+ y="246.24741" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2277"
+ width="26"
+ height="26"
+ x="1549.025"
+ y="52.092632" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2279"
+ width="26"
+ height="26"
+ x="1638.6183"
+ y="182.5576" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2281"
+ width="26"
+ height="26"
+ x="1632.9553"
+ y="263.98206" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2283"
+ width="26"
+ height="26"
+ x="1912.0334"
+ y="394.68832" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2285"
+ width="26"
+ height="26"
+ x="1909.589"
+ y="488.77457" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2287"
+ width="26"
+ height="26"
+ x="2177.282"
+ y="577.66821" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2289"
+ width="26"
+ height="26"
+ x="1628.0166"
+ y="576.09015" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2291"
+ width="26"
+ height="26"
+ x="1339.2861"
+ y="473.21582" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2293"
+ width="26"
+ height="26"
+ x="1268.5806"
+ y="828.63672" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2295"
+ width="26"
+ height="26"
+ x="1365.8672"
+ y="1073.4138" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2297"
+ width="26"
+ height="26"
+ x="1438.8331"
+ y="1033.9116" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2299"
+ width="26"
+ height="26"
+ x="1470.244"
+ y="926.052" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2301"
+ width="26"
+ height="26"
+ x="1664.891"
+ y="1029.7375" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2303"
+ width="26"
+ height="26"
+ x="1841.1085"
+ y="1024.7279" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2305"
+ width="26"
+ height="26"
+ x="1747.2759"
+ y="768.98206" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2307"
+ width="26"
+ height="26"
+ x="1841.9778"
+ y="781.73883" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2309"
+ width="26"
+ height="26"
+ x="2022.9529"
+ y="689.95984" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2311"
+ width="26"
+ height="26"
+ x="2117.7231"
+ y="672.01459" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2313"
+ width="26"
+ height="26"
+ x="2248.9602"
+ y="720.04028" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2315"
+ width="26"
+ height="26"
+ x="2124.9131"
+ y="918.68433" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2317"
+ width="26"
+ height="26"
+ x="2005.8229"
+ y="878.57733" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2319"
+ width="26"
+ height="26"
+ x="1148.3192"
+ y="1185.2131" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2321"
+ width="26"
+ height="26"
+ x="1263.027"
+ y="1246.7566" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2323"
+ width="26"
+ height="26"
+ x="1059.7507"
+ y="1379.9696" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2325"
+ width="26"
+ height="26"
+ x="1625.4631"
+ y="1142.5958" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2327"
+ width="26"
+ height="26"
+ x="1773.0425"
+ y="1214.9004" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2329"
+ width="26"
+ height="26"
+ x="1779.3464"
+ y="1310.1035" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2331"
+ width="26"
+ height="26"
+ x="1773.1526"
+ y="1394.2606" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2333"
+ width="26"
+ height="26"
+ x="2061.053"
+ y="1451.6844" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2335"
+ width="26"
+ height="26"
+ x="2119.8042"
+ y="1308.219" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
+ id="rect2337"
+ width="26"
+ height="26"
+ x="2382.0105"
+ y="1220.9221" />
+ </g>
<g
id="g1382"
- inkscape:label="dots"
+ inkscape:label="city"
sodipodi:insensitive="true">
<circle
style="fill:#ff2f2f;fill-opacity:0.54878;stroke:none;stroke-opacity:1"
@@ -3477,557 +4026,8 @@
r="7" />
</g>
<g
- id="g2403"
- inkscape:label="squares"
- sodipodi:insensitive="true">
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2211"
- width="26"
- height="26"
- x="270"
- y="461" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2213"
- width="26"
- height="26"
- x="268"
- y="569" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2215"
- width="26"
- height="26"
- x="182"
- y="575" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2217"
- width="26"
- height="26"
- x="384"
- y="574" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2219"
- width="26"
- height="26"
- x="277"
- y="725" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:1.03846"
- id="rect2221"
- width="27"
- height="27"
- x="166"
- y="764" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2223"
- width="26"
- height="26"
- x="64"
- y="980" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:1.03846"
- id="rect2225"
- width="27"
- height="27"
- x="375"
- y="1019" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2227"
- width="26"
- height="26"
- x="371.01392"
- y="882.64435" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2229"
- width="26"
- height="26"
- x="501.0282"
- y="1065.3435" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2231"
- width="26"
- height="26"
- x="533.38898"
- y="927.52374" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2233"
- width="26"
- height="26"
- x="620.91315"
- y="971.07019" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2235"
- width="26"
- height="26"
- x="498.40408"
- y="789.68854" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2237"
- width="26"
- height="26"
- x="425.12064"
- y="692.22241" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2239"
- width="26"
- height="26"
- x="717.38831"
- y="708.78241" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2241"
- width="26"
- height="26"
- x="849.22089"
- y="947.05914" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2243"
- width="26"
- height="26"
- x="865.2486"
- y="1063.5491" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2245"
- width="26"
- height="26"
- x="731.14117"
- y="1174.0287" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2247"
- width="26"
- height="26"
- x="684.0929"
- y="1232.8259" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2249"
- width="26"
- height="26"
- x="582.27399"
- y="1374.7003" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2251"
- width="26"
- height="26"
- x="497.19083"
- y="1420.0902" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2253"
- width="26"
- height="26"
- x="305.03281"
- y="1486.0468" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2255"
- width="26"
- height="26"
- x="263.19327"
- y="1259.7412" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2257"
- width="26"
- height="26"
- x="310.34464"
- y="1173.1018" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none;stroke-width:0.999999"
- id="rect2259"
- width="26"
- height="26"
- x="128.80182"
- y="1159.8348" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2261"
- width="26"
- height="26"
- x="454.17908"
- y="433.18094" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2263"
- width="26"
- height="26"
- x="527.41046"
- y="447.88062" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2265"
- width="26"
- height="26"
- x="624.04517"
- y="433.48523" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2267"
- width="26"
- height="26"
- x="753.31445"
- y="303.02036" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2269"
- width="26"
- height="26"
- x="1048.9004"
- y="384.70389" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2271"
- width="26"
- height="26"
- x="1263.3169"
- y="530.0434" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2273"
- width="26"
- height="26"
- x="1201.8419"
- y="106.1827" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2275"
- width="26"
- height="26"
- x="1322.778"
- y="246.24741" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2277"
- width="26"
- height="26"
- x="1549.025"
- y="52.092632" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2279"
- width="26"
- height="26"
- x="1638.6183"
- y="182.5576" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2281"
- width="26"
- height="26"
- x="1632.9553"
- y="263.98206" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2283"
- width="26"
- height="26"
- x="1912.0334"
- y="394.68832" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2285"
- width="26"
- height="26"
- x="1909.589"
- y="488.77457" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2287"
- width="26"
- height="26"
- x="2177.282"
- y="577.66821" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2289"
- width="26"
- height="26"
- x="1628.0166"
- y="576.09015" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2291"
- width="26"
- height="26"
- x="1339.2861"
- y="473.21582" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2293"
- width="26"
- height="26"
- x="1268.5806"
- y="828.63672" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2295"
- width="26"
- height="26"
- x="1365.8672"
- y="1073.4138" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2297"
- width="26"
- height="26"
- x="1438.8331"
- y="1033.9116" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2299"
- width="26"
- height="26"
- x="1470.244"
- y="926.052" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2301"
- width="26"
- height="26"
- x="1664.891"
- y="1029.7375" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2303"
- width="26"
- height="26"
- x="1841.1085"
- y="1024.7279" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2305"
- width="26"
- height="26"
- x="1747.2759"
- y="768.98206" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2307"
- width="26"
- height="26"
- x="1841.9778"
- y="781.73883" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2309"
- width="26"
- height="26"
- x="2022.9529"
- y="689.95984" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2311"
- width="26"
- height="26"
- x="2117.7231"
- y="672.01459" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2313"
- width="26"
- height="26"
- x="2248.9602"
- y="720.04028" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2315"
- width="26"
- height="26"
- x="2124.9131"
- y="918.68433" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2317"
- width="26"
- height="26"
- x="2005.8229"
- y="878.57733" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2319"
- width="26"
- height="26"
- x="1148.3192"
- y="1185.2131" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2321"
- width="26"
- height="26"
- x="1263.027"
- y="1246.7566" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2323"
- width="26"
- height="26"
- x="1059.7507"
- y="1379.9696" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2325"
- width="26"
- height="26"
- x="1625.4631"
- y="1142.5958" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2327"
- width="26"
- height="26"
- x="1773.0425"
- y="1214.9004" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2329"
- width="26"
- height="26"
- x="1779.3464"
- y="1310.1035" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2331"
- width="26"
- height="26"
- x="1773.1526"
- y="1394.2606" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2333"
- width="26"
- height="26"
- x="2061.053"
- y="1451.6844" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2335"
- width="26"
- height="26"
- x="2119.8042"
- y="1308.219" />
- <rect
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="rect2337"
- width="26"
- height="26"
- x="2382.0105"
- y="1220.9221" />
- </g>
- <g
- id="g2467"
- inkscape:label="stars"
- style="fill:#ffffff"
- sodipodi:insensitive="true">
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2422"
- cx="78.936989"
- cy="730.62244"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2424"
- cx="201.31735"
- cy="1418.5251"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2426"
- cx="482.35126"
- cy="1155.5575"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2428"
- cx="595.6712"
- cy="312.47647"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2430"
- cx="861.29175"
- cy="190.86034"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2432"
- cx="1175.3353"
- cy="300.33441"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2434"
- cx="1445.4271"
- cy="209.21451"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2436"
- cx="1509.8654"
- cy="581.40253"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2438"
- cx="1640.8955"
- cy="840.84808"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2440"
- cx="2050.6885"
- cy="1055.5642"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2442"
- cx="2075.1187"
- cy="528.09021"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2444"
- cx="2006.139"
- cy="1327.3361"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2446"
- cx="1627.3788"
- cy="1320.0774"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2448"
- cx="1184.2834"
- cy="1330.5629"
- r="16" />
- <circle
- style="fill:#ffffff;fill-opacity:0.809893;stroke:none"
- id="circle2450"
- cx="245.14282"
- cy="937.73083"
- r="16" />
- </g>
- <g
id="g3273"
- inkscape:label="major roads"
+ inkscape:label="major_road"
sodipodi:insensitive="true">
<path
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;stop-opacity:1"
@@ -5043,7 +5043,7 @@
</g>
<g
id="g5326"
- inkscape:label="roads"
+ inkscape:label="road"
sodipodi:insensitive="true">
<path
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#e5e5e5;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;stop-opacity:1"
@@ -7793,7 +7793,7 @@
<g
id="g5174"
inkscape:label="names"
- sodipodi:insensitive="true">
+ style="display:inline">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none"
@@ -13367,9 +13367,9 @@
y="987.9718"
id="text3699"><tspan
sodipodi:role="line"
- id="tspan3697"
x="636.53473"
- y="987.9718">Trietr</tspan></text>
+ y="987.9718"
+ id="tspan3040">Trier</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;stop-opacity:1"
@@ -14035,7 +14035,7 @@
<g
id="g2869"
inkscape:label="$HEARTS"
- style="fill:#ff2a2a">
+ style="display:none;fill:#ff2a2a">
<rect
style="fill:#ff2a2a;fill-opacity:0.54878"
id="rect2836"
@@ -14116,7 +14116,8 @@
</g>
<g
id="g2974"
- inkscape:label="$DIAMONDS">
+ inkscape:label="$DIAMONDS"
+ style="display:none">
<rect
style="fill:#ffff00;fill-opacity:0.54878"
id="rect2938"
@@ -14205,7 +14206,8 @@
</g>
<g
id="g2904"
- inkscape:label="$SPADES">
+ inkscape:label="$SPADES"
+ style="display:none">
<rect
style="fill:#000080;fill-opacity:0.54878"
id="rect2871"
@@ -14286,7 +14288,8 @@
</g>
<g
id="g2936"
- inkscape:label="$CLUBS">
+ inkscape:label="$CLUBS"
+ style="display:none">
<rect
style="fill:#008000;fill-opacity:0.54878"
id="rect2906"
@@ -14361,7 +14364,7 @@
<g
id="g2897"
inkscape:label="$France"
- style="display:inline">
+ style="display:none">
<rect
style="fill:#ff2f2f;fill-opacity:0.54878"
id="rect2870"
@@ -14428,8 +14431,8 @@
</g>
<g
id="g3734"
- inkscape:label="$Nederland"
- style="display:inline">
+ inkscape:label="$Netherlands"
+ style="display:none">
<rect
style="fill:#808080;fill-opacity:0.54878"
id="rect2899"
@@ -14461,8 +14464,8 @@
</g>
<g
id="g3754"
- inkscape:label="$Preussen"
- style="display:inline">
+ inkscape:label="$Prussia"
+ style="display:none">
<rect
style="fill:#0000ff;fill-opacity:0.54878"
id="rect3736"
@@ -14508,8 +14511,8 @@
</g>
<g
id="g3777"
- inkscape:label="$Polska"
- style="display:inline">
+ inkscape:label="$Poland"
+ style="display:none">
<rect
style="fill:#ffff00;fill-opacity:0.54878"
id="rect3756"
@@ -14562,15 +14565,8 @@
</g>
<g
id="g3800"
- inkscape:label="$Schlesien"
- style="display:inline">
- <rect
- style="fill:#808000;fill-opacity:0.54878"
- id="rect3779"
- width="275.84698"
- height="276.13602"
- x="1829.4836"
- y="385.8418" />
+ inkscape:label="$Silesia"
+ style="display:none">
<rect
style="fill:#808000;fill-opacity:0.54878"
id="rect3781"
@@ -14613,11 +14609,18 @@
height="47.593063"
x="1732.1372"
y="450.37595" />
+ <rect
+ style="fill:#808000;fill-opacity:0.54878;stroke-width:1.90983"
+ id="rect2967"
+ width="294.16193"
+ height="293.64902"
+ x="1823.5614"
+ y="378.36554" />
</g>
<g
id="g3847"
- inkscape:label="$Sachsen"
- style="display:inline">
+ inkscape:label="$Saxony"
+ style="display:none">
<rect
style="fill:#008000;fill-opacity:0.54878"
id="rect3802"
@@ -14726,8 +14729,8 @@
</g>
<g
id="g3872"
- inkscape:label="$Bayern"
- style="display:inline">
+ inkscape:label="$Bavaria"
+ style="display:none">
<rect
style="fill:#ff6600;fill-opacity:0.54878"
id="rect3849"
@@ -14780,8 +14783,8 @@
</g>
<g
id="g3912"
- inkscape:label="$Austria.East"
- style="display:inline">
+ inkscape:label="$Austria_E"
+ style="display:none">
<rect
style="fill:#ffffff;fill-opacity:0.54878"
id="rect3937"
@@ -14873,18 +14876,25 @@
height="65.829742"
x="1975.6816"
y="770.68939" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.54878"
+ id="rect2971"
+ width="55.772087"
+ height="44.279659"
+ x="1258.4211"
+ y="821.7088" />
</g>
<g
id="g3931"
- inkscape:label="$Austria.West"
+ inkscape:label="$Austria_W"
style="display:none">
<rect
style="fill:#ffffff;fill-opacity:0.54878"
id="rect3914"
- width="135.73157"
- height="117.65475"
- x="462.2421"
- y="813.98218" />
+ width="149.80991"
+ height="173.32671"
+ x="457.45102"
+ y="783.26971" />
<rect
style="fill:#ffffff;fill-opacity:0.54878"
id="rect3918"
@@ -14913,10 +14923,32 @@
height="108.76128"
x="255.17949"
y="554.64777" />
+ <rect
+ style="fill:#ffffff;fill-opacity:0.54878"
+ id="rect2973"
+ width="38.871456"
+ height="29.069088"
+ x="578.33966"
+ y="707.1225" />
</g>
<g
id="g3974"
- inkscape:label="$HRR.East">
+ inkscape:label="$HRE_E"
+ style="display:none">
+ <rect
+ style="fill:#ffff00;fill-opacity:0.54878"
+ id="rect2963"
+ width="66.250481"
+ height="45.63171"
+ x="1224.9579"
+ y="1104.2874" />
+ <rect
+ style="fill:#ffff00;fill-opacity:0.54878"
+ id="rect2961"
+ width="54.999489"
+ height="42.070503"
+ x="1235.2311"
+ y="952.84564" />
<rect
style="fill:#ffff00;fill-opacity:0.54878"
id="rect3933"
@@ -15004,9 +15036,9 @@
</g>
<g
id="g4011"
- inkscape:label="$HRR.West"
- inkscape:groupmode="layer"
- sodipodi:insensitive="true">
+ inkscape:label="$HRE_W"
+ sodipodi:insensitive="true"
+ style="display:none">
<rect
style="fill:#ffff00;fill-opacity:0.54878"
id="rect3976"
diff --git a/tools/names.txt b/tools/names.txt
index a008331..22aa225 100644
--- a/tools/names.txt
+++ b/tools/names.txt
@@ -2222,7 +2222,7 @@
<tspan x="579.256" y="887.654">Wiltz</tspan>
</text>
<text xml:space="preserve" x="636.535" y="987.972" style="font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:8px;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000;stop-opacity:1">
-<tspan x="636.535" y="987.972">Trietr</tspan>
+<tspan x="636.535" y="987.972">Trier</tspan>
</text>
<text xml:space="preserve" x="614.853" y="1036.836" style="font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:8px;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000;stop-opacity:1">
<tspan x="614.853" y="1036.836">Saarlouis</tspan>
diff --git a/tools/parse-layout.js b/tools/parse-layout.js
index 5219705..e3a76fd 100644
--- a/tools/parse-layout.js
+++ b/tools/parse-layout.js
@@ -2,7 +2,7 @@ const fs = require("fs")
let points = {}
let rects = {}
-let edges = []
+let edges = {}
let mode, name, x, y, w, h, cx, cy, rx, ry, x2, y2
function add_point(x, y) {
@@ -19,9 +19,16 @@ function add_rect(x, y, w, h) {
rects[name] = [ [x,y,x+w,y+h] ]
}
+function add_edge(x1, y1, x2, y2) {
+ if (name in edges)
+ edges[name].push({x1,y1,x2,y2})
+ else
+ edges[name] = [ {x1,y1,x2,y2} ]
+}
+
function flush() {
if (mode === 'path') {
- edges.push([ x, y, x2, y2 ])
+ add_edge(x, y, x2, y2)
}
if (mode === 'rect') {
if (name.startsWith("$"))
@@ -180,6 +187,21 @@ function find_closest_node(list, x, y) {
return [ nn, nd ]
}
+function find_closest_city(x, y) {
+ let nd = Infinity, nn = -1
+
+ for (let i = 0; i < cities.length; ++i) {
+ let n = cities[i]
+ let d = Math.hypot(n.x - x, n.y - y)
+ if (d < nd) {
+ nd = d
+ nn = i
+ }
+ }
+
+ return nn
+}
+
function find_enclosing_rect(list, x, y) {
for (let [x1, y1, x2, y2] of list) {
if (x >= x1 && x <= x2)
@@ -189,36 +211,225 @@ function find_enclosing_rect(list, x, y) {
return false
}
+const FLANDERS = "Flanders"
+const BOHEMIA = "Bohemia"
+
+const CLUBS = "clubs"
+const HEARTS = "hearts"
+const SPADES = "spades"
+const DIAMONDS = "diamonds"
+
+const FRANCE = "France"
+const BAVARIA = "Bavaria"
+const PRUSSIA = "Prussia"
+const SAXONY = "Saxony"
+const AUSTRIA = "Austria"
+const AUSTRIAN_NETHERLANDS = "Austrian Netherlands"
+const HRE = "Holy Roman Empire"
+const NETHERLANDS = "Netherlands"
+const SILESIA = "Silesia"
+const POLAND = "Poland"
+
+const PRAGMATIC_ARMY = "Pragmatic Army"
+
// FIND and label all points!
let all_labels = labels.slice()
-let out = {}
+let cities = []
for (let key in points) {
- out = {}
for (let [x, y] of points[key]) {
let [ node, dist ] = find_closest_node(labels, x, y)
if (dist > 10) {
console.log(key,x,y, dist)
}
if (node) {
- if (node.name in out)
- console.log("DUPLICATE", node.name, x, y, out[node.name])
labels = labels.filter(x => x !== node)
let suit = "UNKNOWN"
+
if (find_enclosing_rect(rects.$CLUBS, x, y))
- suit = "clubs"
+ suit = CLUBS
else if (find_enclosing_rect(rects.$HEARTS, x, y))
- suit = "hearts"
+ suit = HEARTS
else if (find_enclosing_rect(rects.$DIAMONDS, x, y))
- suit = "diamonds"
+ suit = DIAMONDS
else if (find_enclosing_rect(rects.$SPADES, x, y))
- suit = "spades"
+ suit = SPADES
else
console.log("NOT ASSIGNED SUIT", x, y)
- out[node.name] = [x, y, dist, suit]
+
+ let map = "UNKNOWN"
+ let country = "UNKNOWN"
+ if (find_enclosing_rect(rects.$HRE_W, x, y)) {
+ map = FLANDERS
+ country = HRE
+ }
+ else if (find_enclosing_rect(rects.$HRE_E, x, y)) {
+ map = BOHEMIA
+ country = HRE
+ }
+ else if (find_enclosing_rect(rects.$Austria_W, x, y)) {
+ map = FLANDERS
+ country = AUSTRIA
+ }
+ else if (find_enclosing_rect(rects.$Austria_E, x, y)) {
+ map = BOHEMIA
+ country = AUSTRIA
+ }
+ else if (find_enclosing_rect(rects.$Bavaria, x, y)) {
+ map = BOHEMIA
+ country = BAVARIA
+ }
+ else if (find_enclosing_rect(rects.$Saxony, x, y)) {
+ map = BOHEMIA
+ country = SAXONY
+ }
+ else if (find_enclosing_rect(rects.$Silesia, x, y)) {
+ map = BOHEMIA
+ country = SILESIA
+ }
+ else if (find_enclosing_rect(rects.$Poland, x, y)) {
+ map = BOHEMIA
+ country = POLAND
+ }
+ else if (find_enclosing_rect(rects.$Prussia, x, y)) {
+ map = BOHEMIA
+ country = PRUSSIA
+ }
+ else if (find_enclosing_rect(rects.$Netherlands, x, y)) {
+ map = FLANDERS
+ country = NETHERLANDS
+ }
+ else if (find_enclosing_rect(rects.$France, x, y)) {
+ map = FLANDERS
+ country = FRANCE
+ }
+
+ if (country === "UNKNOWN")
+ console.log("no country:", node)
+
+ cities.push({
+ name: node.name,
+ map,
+ country,
+ suit,
+ type: key,
+ x: Math.round(x),
+ y: Math.round(y),
+ major_roads: [],
+ roads: [],
+ })
} else {
let [ dupname, dupdist ] = find_closest_node(all_labels, x, y)
- console.log("ALREADY USED", dupname, dupdist, x, y, "OLD", out[dupname])
+ console.log("ALREADY USED", dupname, dupdist, x, y)
}
}
}
+cities.sort((a,b) => {
+ if (a.map < b.map) return 1
+ if (a.map > b.map) return -1
+ if (a.country < b.country) return -1
+ if (a.country > b.country) return 1
+ if (a.suit < b.suit) return -1
+ if (a.suit > b.suit) return 1
+ if (a.type === "major_fortress" && b.type !== "major_fortress") return -1
+ if (a.type !== "major_fortress" && b.type === "major_fortress") return 1
+ if (a.type === "minor_fortress" && b.type !== "minor_fortress") return -1
+ if (a.type !== "minor_fortress" && b.type === "minor_fortress") return 1
+ if (a.name < b.name) return -1
+ if (a.name > b.name) return 1
+ return b.y - a.y
+})
+
+for (let e of edges.major_road) {
+ let a = find_closest_city(e.x1, e.y1)
+ let b = find_closest_city(e.x2, e.y2)
+ cities[a].major_roads.push(b)
+ cities[b].major_roads.push(a)
+}
+
+for (let e of edges.road) {
+ let a = find_closest_city(e.x1, e.y1)
+ let b = find_closest_city(e.x2, e.y2)
+ cities[a].roads.push(b)
+ cities[b].roads.push(a)
+}
+
+let arrays = {
+ name: [],
+ // map: [],
+ // country: [],
+ // suit: [],
+ // type: [],
+ x: [],
+ y: [],
+ major_roads: [],
+ roads: [],
+}
+
+let sets = {
+ type: {
+ major_fortress: [],
+ minor_fortress: [],
+ city: [],
+ },
+ suit: {
+ clubs: [],
+ diamonds: [],
+ hearts: [],
+ spades: [],
+ },
+ map: {
+ Flanders: [],
+ Bohemia: [],
+ },
+ country: {
+ Austria: [],
+ Bavaria: [],
+ France: [],
+ Netherlands: [],
+ Poland: [],
+ Prussia: [],
+ Saxony: [],
+ Silesia: [],
+ "Holy Roman Empire": [],
+ },
+}
+
+for (let i = 0; i < cities.length; ++i) {
+ let city = cities[i]
+ for (let key in city) {
+ if (arrays[key])
+ arrays[key].push(city[key])
+ if (sets[key])
+ sets[key][city[key]].push(i)
+ }
+}
+
+function map_to_range(x) {
+ let pairs = []
+ let a = 0, b = 1
+ for (; b < x.length; ++b) {
+ if (x[b-1] + 1 === x[b])
+ continue
+ pairs.push([x[a],x[b-1]])
+ a = b
+ }
+ pairs.push([x[a],x[b-1]])
+ return pairs
+}
+
+function remap_to_range(obj) {
+ for (let key in obj)
+ obj[key] = map_to_range(obj[key])
+}
+
+remap_to_range(sets.map)
+remap_to_range(sets.suit)
+remap_to_range(sets.country)
+
+delete sets.type.city
+
+sets.cities = arrays
+
+console.log("const data = " + JSON.stringify(sets))
+console.log("if (typeof module === 'object') module.exports = data")