diff --git a/AideDeJeu/AideDeJeuCmd/Program.cs b/AideDeJeu/AideDeJeuCmd/Program.cs
index f7d66cc2..1bddfd87 100644
--- a/AideDeJeu/AideDeJeuCmd/Program.cs
+++ b/AideDeJeu/AideDeJeuCmd/Program.cs
@@ -400,30 +400,67 @@ namespace AideDeJeuCmd
}
}
+ static string nsSvg = "http://www.w3.org/2000/svg";
static async Task ConvertMapsAsync()
+ {
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\osgild");
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\ferrance");
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\fourche");
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\hauterive");
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\port-sable");
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\vercelise");
+ await ConvertMapAsync(@"..\..\..\..\..\Docs\Osgild\xelys");
+ }
+ static async Task ConvertMapAsync(string basename)
{
HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();
- document.Load(@"..\..\..\..\..\Docs\Osgild\ferrance.map.html");
+ document.Load($"{basename}.map.html");
var svg = new XmlDocument();
- var svgElt = svg.CreateElement("svg", "http://www.w3.org/2000/svg");
+ var svgElt = svg.CreateElement("svg", nsSvg);
+ svgElt.SetAttribute("style", "fill: transparent");
svg.AppendChild(svgElt);
+
+ var img = document.DocumentNode.SelectSingleNode("img");
+ var image = svg.CreateElement("image", nsSvg);
+ image.SetAttribute("href", img.GetAttributeValue("src", ""));
+ var width = img.GetAttributeValue("width","");
+ var height = img.GetAttributeValue("height", "");
+ svgElt.SetAttribute("viewBox", $"0 0 {width} {height}");
+ svgElt.AppendChild(image);
+
var areas = document.DocumentNode.SelectNodes("//area");
foreach(var area in areas)
{
var coords = area.GetAttributeValue("coords", "");
var coordsSplit = coords.Split(",");
- var a = svg.CreateElement("a");
+ var a = svg.CreateElement("a", nsSvg);
a.SetAttribute("href", area.GetAttributeValue("href", ""));
a.SetAttribute("target", area.GetAttributeValue("target", ""));
- var rect = svg.CreateElement("rect");
- rect.SetAttribute("x", coordsSplit[0]);
- var title = svg.CreateElement("title");
+ var shapeAttr = area.GetAttributeValue("shape", "");
+ XmlElement shape = null;
+ if (shapeAttr == "rect")
+ {
+ shape = svg.CreateElement("rect", nsSvg);
+ shape.SetAttribute("x", coordsSplit[0]);
+ shape.SetAttribute("y", coordsSplit[1]);
+ shape.SetAttribute("width", (int.Parse(coordsSplit[2]) - int.Parse(coordsSplit[0])).ToString());
+ shape.SetAttribute("height", (int.Parse(coordsSplit[3]) - int.Parse(coordsSplit[1])).ToString());
+ }
+ if (shapeAttr == "circle")
+ {
+ shape = svg.CreateElement("circle", nsSvg);
+ shape.SetAttribute("cx", coordsSplit[0]);
+ shape.SetAttribute("cy", coordsSplit[1]);
+ shape.SetAttribute("r", coordsSplit[2]);
+ }
+ var title = svg.CreateElement("title", nsSvg);
title.InnerText = area.GetAttributeValue("alt", "");
- rect.AppendChild(title);
- a.AppendChild(rect);
+ shape.AppendChild(title);
+ a.AppendChild(shape);
svgElt.AppendChild(a);
}
+ svg.Save($"{basename}.svg");
}
static async Task ExtractYamlAsync()
diff --git a/Docs/Osgild/ferrance.html b/Docs/Osgild/ferrance.html
index fba7162b..3d9e0bcf 100644
--- a/Docs/Osgild/ferrance.html
+++ b/Docs/Osgild/ferrance.html
@@ -1,8 +1,9 @@
-
+
+
-
+
Ferrance
@@ -13,8 +14,8 @@
Source :Anathazerin p7, S4 Les Faux-Monnayeurs p88
Carte par Romje :
-
-
+
+
diff --git a/Docs/Osgild/ferrance.svg b/Docs/Osgild/ferrance.svg
new file mode 100644
index 00000000..ea752251
--- /dev/null
+++ b/Docs/Osgild/ferrance.svg
@@ -0,0 +1,28 @@
+
\ No newline at end of file
diff --git a/Docs/Osgild/fourche.html b/Docs/Osgild/fourche.html
index 694f122a..c14313f0 100644
--- a/Docs/Osgild/fourche.html
+++ b/Docs/Osgild/fourche.html
@@ -1,8 +1,9 @@
+
-
+
Fourche
@@ -11,8 +12,8 @@
Source : CB02 La course du printemps p149
Carte par Romje :
-
-
+
+
diff --git a/Docs/Osgild/fourche.svg b/Docs/Osgild/fourche.svg
new file mode 100644
index 00000000..937e7d63
--- /dev/null
+++ b/Docs/Osgild/fourche.svg
@@ -0,0 +1,23 @@
+
\ No newline at end of file
diff --git a/Docs/Osgild/hauterive.html b/Docs/Osgild/hauterive.html
index 1bbaf24b..028368ea 100644
--- a/Docs/Osgild/hauterive.html
+++ b/Docs/Osgild/hauterive.html
@@ -1,8 +1,9 @@
+
-
+
Hauterive
@@ -13,8 +14,8 @@
Source : CB01 La fille du seigneur de l’hiver p143
Carte par Romje :
-
-
+
+
diff --git a/Docs/Osgild/hauterive.svg b/Docs/Osgild/hauterive.svg
new file mode 100644
index 00000000..ccb430f2
--- /dev/null
+++ b/Docs/Osgild/hauterive.svg
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/Docs/Osgild/osgild.body.html b/Docs/Osgild/osgild.body.html
new file mode 100644
index 00000000..3a2ca905
--- /dev/null
+++ b/Docs/Osgild/osgild.body.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
Terres d'Osgild
+
+
+
+
diff --git a/Docs/Osgild/osgild.html b/Docs/Osgild/osgild.html
index c7b707a9..02b22532 100644
--- a/Docs/Osgild/osgild.html
+++ b/Docs/Osgild/osgild.html
@@ -3,11 +3,7 @@
Terres d'Osgild
-
\ No newline at end of file
+
diff --git a/Docs/Osgild/osgild.svg b/Docs/Osgild/osgild.svg
new file mode 100644
index 00000000..9e49cc9d
--- /dev/null
+++ b/Docs/Osgild/osgild.svg
@@ -0,0 +1,383 @@
+
\ No newline at end of file
diff --git a/Docs/Osgild/port-sable.html b/Docs/Osgild/port-sable.html
index 33d5edac..087b6388 100644
--- a/Docs/Osgild/port-sable.html
+++ b/Docs/Osgild/port-sable.html
@@ -1,14 +1,15 @@
+
-
+
Port-Sable
Carte par Romje :
-
-
+
+
diff --git a/Docs/Osgild/port-sable.svg b/Docs/Osgild/port-sable.svg
new file mode 100644
index 00000000..c9ff91bd
--- /dev/null
+++ b/Docs/Osgild/port-sable.svg
@@ -0,0 +1,18 @@
+
\ No newline at end of file
diff --git a/Docs/Osgild/scripts.js b/Docs/Osgild/scripts.js
new file mode 100644
index 00000000..0861ac31
--- /dev/null
+++ b/Docs/Osgild/scripts.js
@@ -0,0 +1,8 @@
+function init() {
+ var range = document.getElementById("range");
+ var map = document.getElementById("map");
+ map.style.width = "" + range.value + "%";
+ range.oninput = function() {
+ map.style.width = "" + range.value + "%";
+ }
+}
diff --git a/Docs/Osgild/vercelise.html b/Docs/Osgild/vercelise.html
index cef2c68a..39142d23 100644
--- a/Docs/Osgild/vercelise.html
+++ b/Docs/Osgild/vercelise.html
@@ -1,14 +1,15 @@
+
-
+
Vercelise
Carte par Romje :
-
-
+
+
diff --git a/Docs/Osgild/vercelise.svg b/Docs/Osgild/vercelise.svg
new file mode 100644
index 00000000..0e540961
--- /dev/null
+++ b/Docs/Osgild/vercelise.svg
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/Docs/Osgild/xelys.html b/Docs/Osgild/xelys.html
index b486ac3a..4f604ef9 100644
--- a/Docs/Osgild/xelys.html
+++ b/Docs/Osgild/xelys.html
@@ -1,14 +1,15 @@
+
-
+
Xélys
Carte par Romje :
-
-
+
+
diff --git a/Docs/Osgild/xelys.svg b/Docs/Osgild/xelys.svg
new file mode 100644
index 00000000..bbbb5648
--- /dev/null
+++ b/Docs/Osgild/xelys.svg
@@ -0,0 +1,18 @@
+
\ No newline at end of file