This commit is contained in:
Kathy Ruffing 2011-07-29 13:31:42 +00:00
parent 3a7be58c6e
commit ec9b80d6a3
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace fmtxml
{
public partial class RtfToSvg
{
public void AppendPlantSpecific(string genFileName, XmlDocument myDoc)
{
string genName = genFileName.Substring(genFileName.LastIndexOf('\\') + 1);
genName = genName.Substring(0, genName.IndexOf('.'));
switch (genName.ToUpper())
{
case "WCN2":
AddWCN2(myDoc);
break;
}
}
private void AddWCN2(XmlDocument myDoc)
{
XmlDocument xd = new XmlDocument();
// include the svg level so that the xmlns can be set to be the same as the generated document.
xd.LoadXml("<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"B9\">\r\n" +
"<rect x=\"4\" y=\"-3\" width=\"352.5\" height=\"120\" fill=\"none\" stroke=\"black\" stroke-width=\"1.2\" />\r\n" +
"<line x1=\"4\" y1=\"21\" x2=\"355.5\" y2=\"21\" stroke-width=\"1.2\" />\r\n" +
"<line x1=\"4\" y1=\"45\" x2=\"355.5\" y2=\"45\" stroke-width=\"1.2\" />\r\n" +
"<line x1=\"4\" y1=\"69\" x2=\"355.5\" y2=\"69\" stroke-width=\"1.2\" />\r\n" +
"<line x1=\"4\" y1=\"93\" x2=\"355.5\" y2=\"93\" stroke-width=\"1.2\" />\r\n" +
"<line x1=\"263\" y1=\"-3\" x2=\"263\" y2=\"118\" stroke-width=\"1.2\" />\r\n" +
"</g></svg>");
myDoc.DocumentElement.AppendChild(myDoc.ImportNode(xd.DocumentElement.ChildNodes[0], true));
}
}
}

View File

@ -8,7 +8,7 @@ using System.Xml;
namespace fmtxml
{
public class RtfToSvg
public partial class RtfToSvg
{
public RtfToSvg(string rtfFileName)
{
@ -334,6 +334,7 @@ namespace fmtxml
if (outFile.Exists) outFile.Delete();
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(Svg);
AppendPlantSpecific(svgFileName, xDoc);
xDoc.Save(outFile.FullName);
}
}