From 3859e04d3e8866bf6f6337031bd39647f52e6881 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 17 Mar 2024 02:34:42 +0100 Subject: WIP layout 2 --- tools/layout.svg | 1163 ++++++++++++++++++++++++++++++- tools/names.txt | 1814 ++++++++++++++++++++++++++++++++++++++++++++++++- tools/parse-layout.js | 224 ++++++ 3 files changed, 3170 insertions(+), 31 deletions(-) create mode 100644 tools/parse-layout.js (limited to 'tools') diff --git a/tools/layout.svg b/tools/layout.svg index d84d0ef..a0c043e 100644 --- a/tools/layout.svg +++ b/tools/layout.svg @@ -40,9 +40,9 @@ inkscape:window-height="480" id="namedview6" showgrid="false" - inkscape:zoom="3.0901692" - inkscape:cx="1605.2365" - inkscape:cy="1273.1331" + inkscape:zoom="0.96460962" + inkscape:cx="1030.3441" + inkscape:cy="834.95823" inkscape:current-layer="svg4" inkscape:document-rotation="0" showguides="false"> @@ -53,7 +53,7 @@ + inkscape:label="roads" + sodipodi:insensitive="true"> + inkscape:label="names" + sodipodi:insensitive="true"> - Komorn - Neuhäusel Vittel + + Reppen + Eisleben + Neuhäusel + Zwittau + Zwettl + Komorn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/names.txt b/tools/names.txt index d5ff787..a008331 100644 --- a/tools/names.txt +++ b/tools/names.txt @@ -1,613 +1,2423 @@ -Komorn -Neuhäusel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gran + + Tatabanya + + + Raab + + Gols + + Pápa + + Weißbrunn + + Stuhlweißenburg + + Galanta + + Neutra + + Levice + + Tyrnau + + Pistyan + + Kremnitz + + Schemnitz + + Trentschin + + Luhatschowitz + + Zliny + + Vsetin + + Sillein + + Prerau + + Neutitschein + + Friedek Mistek + + Sternberg + + Troppau + + Ostrau + + Teschen + + Tichan + + Rybnik + + Ratibor + + Freudenthal + + Cosel + + Gleiwitz + + Kattowitz + + Ziegenhals + + Beuthen + + Groß Strehlitz + + Oppeln + + Czestochowa + + Krzepice + + Lublinitz + + Rosenberg + + Brieg + + Wielun + + Kreuzburg + + Namslau + + + Kępno + + Złoczew + + Bełchatów + + Lask + + Zduńska Wola + + Warta + + Sieradz + + Ostrów + + Kalisz + + Pleszew + + Turek + + Aleksandrów + + Koło + + Konin + + Krotoszyn + + Gostýn + + Rawicz + + Wschowa + + Leszno + + Jarocin + + Srem + + Kościan + + Wolztyn + + Grodzisk + + Poznań + + Szamotuły + + Wronki + + Miedzyzecz + + Skwierzyna + + Miedzychód + + Krzyż + + Woldenburg + + Berlinchen + + Friedeberg + + Landsberg + + Neudamm + + Küstrin + + Frankfurt + + Drossen + + Zielenzig + + Schwiebus + + Züllichau + + Krossen + + Seelow + + Soldin + + Pyritz + + Schwedt + + Angermünde + + Eberswalde + + Freienwalde + + Fürstenwalde + + Bernau + + Oranienburg + + Templin + + Zehdenick + + Spandau + + Potsdam + + Zossen + + Beeskow + + Barath + + Luckenwalde + + Treuenbrietzen + + Belzig + + Genthin + + Rathenow + + Tangermünde + + Burg + + Schönebeck + + Brandenburg + + Fehrbellin + + Neuruppin + + Kyritz + + Pritzwalk + + Havelberg + + Stendal + + Königs Wusterhausen + + Gardelegen + + Wittenberge + + Salzwedel + + Oebisfelde + + Haldensleben + + Schöningen + + Oschersleben + + Halbenstadt + + Quedlinburg + + Aschersleben + + Sangerhausen + + Artern + + Querfurt + + Naumburg + + Borna + + Merseburg + + Halle + + Bitterfeld + + Leipzig + + Torgau + + Bernburg + + Köthen + + Dessau + + Staßfurt + + + Wittenberg + + Jüterbog + + Dahme + + Luckau + + Lübben + + Finsterwalde + + Herzberg + + Falkenberg + + Elsterwerda + + Oschatz + + Grimma + + Riesa + + Meißsen + + Dresden + + Radeberg + + Bautzen + + Großenhain + + Senftenberg + + Hoyerswerda + + Weißwasser + + Görlitz + + Lauban + + Hirschberg + + Löwenberg + + Penzig + + Priebus + + Sorau + + Muskau + + Forst + + Guben + + Cottbus + + Spremberg + + Sprottau + + Grünberg + + Glogau + + Liegnitz + + Striegau + + Schweidnitz + + Wohlau + + Neumarkt + + Steinau + + Guhrau + + Trebnitz + + Militsch + + Oels + + Breslau + + Ohlau + + Strehlen + + Erfurt + + Weimar + + Arnstadt + + Jena + + Gera + + Altenburg + + Zwickau + + Greiz + + Plauen + + Eger + + Hof + + Naila + + Saalfeld + + Rudolstadt + + Sonneberg + + Coburg + + Kronach + + Karlsbad + + Kaaden + + Aue + + Chemnitz + + Rochlitz + + Döbeln + + Freiberg + + Marienberg + + Brüx + + Laun + + Schlan + + Saaz + + Teplitz + + Aussig + + Dippoldiswalde + + Deuben + + Pirna + + Tetschen + + Leipa + + Leitmeritz + + Raudnitz + + Melnik + + Jungbunzlau + + Reichenberg + + Zittau + + Rumburg + + Friedland + + Hohenelbe + + Turnau + + Jitschin + + Königgrätz + + Pardubitz + + Kolin + + Prag + + Waldenburg + + Reichenbach + + Trautenau + + Nachod + + Kosteletz + + Wildenschwert + + Trübau + + Schönberg + + Freiwaldau + + Habelschwerdt + + Glatz + + Neisse + + Grottkau + + Frankenstein + + Olmütz + + Proßnitz + + Brünn + + Austerlitz + + Trebitsch + + Boskowitz + + Brod + + Hlinsko + + Schiltern + + Fratres + + Wittingau + + Iglau + + Pilgram + + Tschaslau + + Beneschau + + Wotitz + + Slapy + + Orlik + + Tabor + + Beraun + + Pribram + + Pisek + + Prachatitz + + Schüttenhofen + + Klattau + + Prestitz + + Pilsen + + Rakonitz + + Tepl + + Mies + + Nürschan + + Marienbad + + Hostau + + Cham + + Tirschenreuth + + Weiden + + Marktredwitz + + Sulzbach + + Schwandorf + + Amberg + + Neumarkt + + Schwabach + + Nürnberg + + Erlangen + + Bamberg + + Bayreuth + + Kulmbach + + Magdeburg + + Berlin + + Nimburg + + Donauwörth + + Eichstätt + + Ingolstadt + + Landshut + + Pfaffenhofen + + Freising + + München + + Dachau + + Augsburg + + Schrobenhausen + + Ergoldsbach + + Kelheim + + Beilngries + + Regensburg + + Falkenstein + + Straubing + + Landau + + Wasserburg + + Mühldorf + + Pfarrkirchen + + Deggendorf + + Regen + + Freyung + + Passau + + Schärding + + Braunau + + Wels + + Aschach + + Rohrbach + + Krummau + + Budweis + + Unter Haid + + Linz + + Enns + + Melk + + St. Pölten + + Krems + + Horn + + Waidhofen + + Gmünd + + Znaim + + Wostitz + + Nikolsburg + + Hollabrunn + + Abasdorf + + Korneuburg + + Mistelbach + + Lundenburg + + Gairing + + Orth + + Wien + + Pressburg + + Steinamanger + + Güns + + Ödenburg + + Purb + + Baden + + Gloggnitz + + Krieglach + + Rohr + + Mariazell + + Bruck + + Leoben + + Trieben + + Liezen + + Hieflau + + Frankenfels + + Amstetten + + Steyr + + Gmunden + + Bad Ischl + + Kulm + + Schneegattern + + Salzburg + + Hallein + + Werfen + + Berchtesgaden + + Traunstein + + Kufstein + + Tegernsee + + Rosenheim + + Starnberg + + Tölz + + Murnau + + Partenkirchen + + Füssen + + Landsberg + + Ravensburg + + Biberach + + Ehingen + + Pfullendorf + + Reichenbach + + Stühlingen + + Rottweil + + Freiburg + + Wolfach + + Tübingen + + Reutlingen + + Göppingen + + Heilbronn + + Bruchsal + + Stuttgart + + Offenburg + + Baden + + Karlsruhe + + Speyer + + Heidelberg + + Landau + + Pirmasens + + Haguenau + + Strasbourg + + Lörrach + + Mülheim + + Mannheim + + Miltenberg + + Darmstadt + + Aschaffenburg + + Frankfurt + + Mainz + + Worms + + Kaiserslautern + + Zweibrücken + + Idar Oberstein + + Bingen + + Wittlich + + Cochem + + Wiesbaden + + Nauheim + + Wetzlar + + Limburg + + Koblenz + + Gerolstein + + Bonn + + Euskirchen + + Betzdorf + + Siegen + + Olpe + + Gimborn + + Waldbröl + + Köln + + Jülich + + Barmen + + Düsseldorf + + Hagen + + Iserlohn + + Hamm + + Essen + + Dortmund + + Ahlen + + Münster + + Wesel + + Krefeld + + Geldern + + Kleve + + Bocholt + + Coesfeld + + Tecklenburg + + Rheine + + Lingen + + Meppen + + Enschede + + Deventer + + Arnhem + + Apeldoorn + + Almelo + + Emmen + + Zwolle + + Meppel + + Assen + + Groningen + + Delfzijl + + Dokkum + + Leeuwarden + + Heerenveen + + Alkmaar + + Haarlem + + Amsterdam + + Leiden + + Den Haag + + Rotterdam + + Utrecht + + Dordrecht + + Nijmegen + + Breda + + Bergen + + Terneuzen + + Antwerpen + + Mecheln + + Brüssel + + Geel + + Tilburg + + Eindhoven + + Hertogenbosch + + Venlo + + Eeklo + + Gent + + Tournai + + Roeselare + + Brügge + + Poperinge + + Dunkerque + + Calais + + St. Omer + + Armientières + + Lille + + Perne + + Doullens + + Lens + + Douai + + Valenciennes + + Ath + + Mans + + Maubeuge + + Cambrai + + Arras + + Amiens + + Péronne + + St. Quentin + + Guise + + Vervins + + Laon + + Noyon + + Mondidier + + Compiègne + + Charleville-Mézieres + + Bouillon + + Givet + + Charleroi + + Namur + + Nivelles + + Löwen + + Tienen + + Genk + + Roermond + + Aachen + + Maastricht + + Lüttich + + Verviers + + Malmedy + + Rochefort + + Bastogne + + Prüm + + Wiltz + + Trietr + + Saarlouis + + Saarbrücken + + Metz + + St. Avold + + Thionville + + Luxembourg + + Arlon + + Sedan + + Beaumont + + Montmédy + + Longuyon + + Verdun + + Valmy + + Epernay + + Reims + + Rethel + + Soissons + + Créspy-en-V. + + Meaux + + Château-Thierry + + Sezianne + + Provins + + Romilly s. S. + + Châlons-en-Champ. + + Vitry + + Sens + + Troyes + + St. Dizier + + Chaumont + + Langres + + Châtillon s. S. + + Tonnere + + Chaource + + Bar-s.-Aube + + Avallon + + Montbard + + Dijon + + Gray + + Vesoul + + Autun + + Beaune + + Dole + + Besançon + + Omans + + Valdahon + + Montbeliard + + Belfort + + Mulhouse + + Colmar + + Jussey + + Epinal + + St. Die + + Toul + + Bar-le-Duc + + Nancy + + Lunéville + + Sarrebourg + + Sarreguemines + + Vittel + + + +Reppen + + +Eisleben + + +Neuhäusel + + +Zwittau + + +Zwettl + + +Komorn + + diff --git a/tools/parse-layout.js b/tools/parse-layout.js new file mode 100644 index 0000000..5219705 --- /dev/null +++ b/tools/parse-layout.js @@ -0,0 +1,224 @@ +const fs = require("fs") + +let points = {} +let rects = {} +let edges = [] +let mode, name, x, y, w, h, cx, cy, rx, ry, x2, y2 + +function add_point(x, y) { + if (name in points) + points[name].push([x,y]) + else + points[name] = [ [x,y] ] +} + +function add_rect(x, y, w, h) { + if (name in rects) + rects[name].push([x,y,x+w,y+h]) + else + rects[name] = [ [x,y,x+w,y+h] ] +} + +function flush() { + if (mode === 'path') { + edges.push([ x, y, x2, y2 ]) + } + if (mode === 'rect') { + if (name.startsWith("$")) + add_rect(x, y, w, h) + else + add_point( x + w/2, y + h/2 ) + } + if (mode === 'circle') { + add_point( cx, cy ) + } + x = y = x2 = y2 = w = h = cx = cy = rx = ry = 0 +} + +function parse_path_data(path) { + let cx = 0 + let cy = 0 + let abs = 0 + for (let i = 0; i < path.length;) { + switch (path[i]) { + case 'M': + x = cx = Number(path[i+1]) + y = cy = Number(path[i+2]) + i += 3 + abs = true + break + case 'm': + x = cx = cx + Number(path[i+1]) + y = cy = cy + Number(path[i+2]) + i += 3 + abs = false + break + case 'C': + x2 = cx = Number(path[i+5]) + y2 = cy = Number(path[i+6]) + i += 7 + abs = true + break + case 'L': + i += 1 + abs = true + break + case 'H': + x2 = cx = Number(path[i+1]) + i += 2 + abs = true + break + case 'V': + y2 = cy = Number(path[i+1]) + i += 2 + abs = true + break + case 'c': + x2 = cx = cx + Number(path[i+5]) + y2 = cy = cy + Number(path[i+6]) + i += 7 + break + case 'l': + i += 1 + abs = false + break + case 'h': + x2 = cx = cx + Number(path[i+1]) + i += 2 + abs = false + break + case 'v': + y2 = cy = cy + Number(path[i+1]) + i += 2 + abs = false + break + default: + if (abs) { + x2 = cx = Number(path[i+0]) + y2 = cy = Number(path[i+1]) + } else { + x2 = cx = cx + Number(path[i+0]) + y2 = cy = cy + Number(path[i+1]) + } + i += 2 + break + } + } +} + +for (let line of fs.readFileSync("tools/layout.svg", "utf-8").split("\n")) { + line = line.trim() + if (line.startsWith("([^<]*)= x1 && x <= x2) + if (y >= y1 && y <= y2) + return true + } + return false +} + +// FIND and label all points! +let all_labels = labels.slice() +let out = {} +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" + else if (find_enclosing_rect(rects.$HEARTS, x, y)) + suit = "hearts" + else if (find_enclosing_rect(rects.$DIAMONDS, x, y)) + suit = "diamonds" + else if (find_enclosing_rect(rects.$SPADES, x, y)) + suit = "spades" + else + console.log("NOT ASSIGNED SUIT", x, y) + out[node.name] = [x, y, dist, suit] + } else { + let [ dupname, dupdist ] = find_closest_node(all_labels, x, y) + console.log("ALREADY USED", dupname, dupdist, x, y, "OLD", out[dupname]) + } + } +} + -- cgit v1.2.3