Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can shapenode be converted to SVGNode? (Read 1609 times)
irix
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Aug 1st, 2013
Can shapenode be converted to SVGNode?
Sep 13th, 2013 at 11:34am
Print Post  
Hello, we used shapenodes in our  application, and now we prepare to use svgnode to display svg images. But we find a new problem: the old serialized xml file is for shapenode, so when deserialized can shapenode be converted to SVGNode?
Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Can shapenode be converted to SVGNode?
Reply #1 - Sep 13th, 2013 at 12:20pm
Print Post  
Hi,

You could modify the XML document at runtime to change the node types, and then set the Content of SvgNodes after loading:

Code
Select All
var doc = new XmlDocument();
doc.Load(file_path);

var nodeElements = doc.SelectNodes(@"/Diagram/Nodes/Node");
if (nodeElements != null)
{
	foreach (XmlElement element in nodeElements)
		if (element.Attributes["Class"].Value == "std:ShapeNode")
			element.Attributes["Class"].Value = "std:SvgNode";
}

diagram.LoadFromXml(doc);

foreach (var node in diagram.Nodes)
{
	var svgNode = node as SvgNode;
	if (svgNode != null & svgNode.Content == null)
		svgNode.Content = ...;
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
irix
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Aug 1st, 2013
Re: Can shapenode be converted to SVGNode?
Reply #2 - Sep 14th, 2013 at 1:46pm
Print Post  
thanks very much,  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint