Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Serialization of the Outline and ShapeControlPoints (Read 4353 times)
Cyrinael
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 22nd, 2016
Serialization of the Outline and ShapeControlPoints
Aug 5th, 2016 at 9:39am
Print Post  
Hi,

currently I'm having a problem, where nodes with shapes with OutlineFormulas depending on ShapeControlPoints are not stored in the XML-File. Is there any way to save the manipulated shapes in the XML-File?

Sample Code:
Code
Select All
string outline = @"MoveTo(Width * p0.X/100,Height * p0.Y/100);
               LineTo(Width * p1.X/100,Height * p1.Y/100);
               LineTo(Width * p2.X/100,Height * p2.Y/100);
               LineTo(Width * p3.X/100,Height * p3.Y/100);
               LineTo(Width * p0.X/100,Height * p0.Y/100);";

node.Shape = new Shape(outline, "", new List<ShapeControlPoint>
{
    new ShapeControlPoint("p0",
        0, 0, 100, UnitType.Percentage,
        0, 0, 100, UnitType.Percentage) { MaxXRelativeToWidth = true },
    new ShapeControlPoint("p1",
        0, 0, 100, UnitType.Percentage,
        100, 0, 100, UnitType.Percentage) { MaxXRelativeToWidth = true },
    new ShapeControlPoint("p2",
        100, 0, 100, UnitType.Percentage,
        100, 0, 100, UnitType.Percentage) { MaxXRelativeToWidth = true },
    new ShapeControlPoint("p3",
        100, 0, 100, UnitType.Percentage,
        0, 0, 100, UnitType.Percentage) { MaxXRelativeToWidth = true },

},
    "id");
 



Best regards,

Cyrinael
  
Back to top
 
IP Logged
 
Cyrinael
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 22nd, 2016
Re: Serialization of the Outline and ShapeControlPoints
Reply #1 - Aug 5th, 2016 at 11:42am
Print Post  
Hi,

I serialize the Shapes using the ShapeLibrary-Class. But interestingly the ShapeControlPoints are not serialized and therefore when loading the ShapeLibrary and the Diagram, the Shapes are not displayed, because the OutlineFormula depends on the ShapeControlPoints.

How can I serialize the control points as well?

Best Regards,

Cyrinael
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: Serialization of the Outline and ShapeControlPoints
Reply #2 - Aug 5th, 2016 at 12:58pm
Print Post  
Hi,

ShapeNode should be saving ShapeControlPoint parameter values under FormulaParams element in the XML. Control points are not saved in shape libraries indeed, we'll add serialization there for upcoming release.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: Serialization of the Outline and ShapeControlPoints
Reply #3 - Aug 8th, 2016 at 5:53am
Print Post  
Hi,

This build should save control points in shape library -
https://mindfusion.eu/_beta/wpfdiag341.zip

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Cyrinael
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 22nd, 2016
Re: Serialization of the Outline and ShapeControlPoints
Reply #4 - Aug 8th, 2016 at 8:06am
Print Post  
Hi Slavcho,

thank you,
the default control points are now serialized correctly in the ShapeLibrary. Nevertheless when a diagram is loaded, the customized control points of ShapeNodes which are contained in the FormulaPrams section of the xml are not set.

Best regards,

Cyrinael
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: Serialization of the Outline and ShapeControlPoints
Reply #5 - Aug 8th, 2016 at 8:57am
Print Post  
Hi Cyrinael,

Saving and loading a ShapeNode with customized control-point positions works correctly for me. Please attach saved diagram and library files that show the problem, or email them to support@mindfusion.eu

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Cyrinael
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 22nd, 2016
Re: Serialization of the Outline and ShapeControlPoints
Reply #6 - Aug 8th, 2016 at 9:23am
Print Post  
Hi Slavcho,

I attached my ShapeLibrary-File (templates11.tl.sl) and my Diagram (templates11.tl) after the saving process. Since I could not attach more than 3 files, I zipped it. Furthermore I added an image of the original ShapeNode and the loaded ShapeNode.

Best Regards,

Cyrinael
  

Libraries.zip ( 2 KB | 207 Downloads )
Original.PNG ( 1 KB | 72 Downloads )
Original.PNG
AfterLoading.PNG ( 1 KB | 71 Downloads )
AfterLoading.PNG
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: Serialization of the Outline and ShapeControlPoints
Reply #7 - Aug 8th, 2016 at 9:48am
Print Post  
Hi,

I'm getting attached image by just loading the files -

Code
Select All
var lib = new ShapeLibrary();
lib.LoadFromXml("templates11.tl.sl");

Debug.WriteLine(lib.Shapes[0].ControlPoints.Count);

diagram.LoadFromXml("templates11.tl"); 



Are you sure you aren't assigning the shape to a new node after load?

Regards,
Slavcho
Mindfusion
  

Untitled_018.png ( 46 KB | 68 Downloads )
Untitled_018.png
Back to top
 
IP Logged
 
Cyrinael
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 22nd, 2016
Re: Serialization of the Outline and ShapeControlPoints
Reply #8 - Aug 8th, 2016 at 10:43am
Print Post  
Hi Slavcho,

I have found the problem. The shape is not correctly loaded when a new node is created with the following constructor call.
Code
Select All
 ShapeNode node = new ShapeNode(shapeNode); 



I have excluded that call now.

Thank you,

Cyrinael
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: Serialization of the Outline and ShapeControlPoints
Reply #9 - Aug 8th, 2016 at 1:58pm
Print Post  
Actually the copy constructor should clone current parameter values too, because it is used for clipboard operations. This build fixes that -
https://mindfusion.eu/_beta/wpfdiag341.zip

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Cyrinael
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 42
Joined: Jul 22nd, 2016
Re: Serialization of the Outline and ShapeControlPoints
Reply #10 - Aug 9th, 2016 at 6:33am
Print Post  
Works fine!

Thank you,

Cyrinael
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint