Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Exporting Shape Nodes with Decorations (Read 6075 times)
BudMan
YaBB Newbies
*
Offline


Credidi me felem vidisse

Posts: 45
Joined: Jul 14th, 2007
Exporting Shape Nodes with Decorations
May 11th, 2010 at 3:27pm
Print Post  
I see there was a 4/22/08 post about issues with exporting to PDF a diagram that contains shape nodes with decorations. In that case, the problem was solved by setting "the decorations argument to null, instead of passing an empty array to the Shape constructor".

My problem is my shapes have decorations and when I try to export to PDF I get dinged with a  "Parameter is not valid" exception thrown in System.Drawing. Do you guys have a suggestion for a workaround?

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exporting Shape Nodes with Decorations
Reply #1 - May 11th, 2010 at 3:38pm
Print Post  
I've tried exporting a few predefined shapes with decorations but that worked for me. Could you copy your shape definition code or xml here?

Stoyan
  
Back to top
 
IP Logged
 
BudMan
YaBB Newbies
*
Offline


Credidi me felem vidisse

Posts: 45
Joined: Jul 14th, 2007
Re: Exporting Shape Nodes with Decorations
Reply #2 - May 11th, 2010 at 9:37pm
Print Post  
Gladly. Here is an example of one such shape:

               shpNew = New Shape( _
                   New ElementTemplate() _
                   {New LineTemplate(100, 20, 100, 80), _
                       New BezierTemplate(100, 80, 100, 95, 70, 100, 50, 100), _
                       New BezierTemplate(50, 100, 30, 100, 0, 95, 0, 80), _
                       New LineTemplate(0, 80, 0, 20), _
                       New BezierTemplate(0, 20, 0, 5, 30, 0, 50, 0), _
                       New BezierTemplate(50, 0, 70, 0, 100, 5, 100, 20)}, _
                   New ElementTemplate() _
                   {New BezierTemplate(100, 20, 100, 35, 70, 40, 50, 40), _
                       New BezierTemplate(50, 40, 30, 40, 0, 35, 0, 20), _
                       New BezierTemplate(100, 30, 100, 45, 70, 50, 50, 50), _
                       New BezierTemplate(50, 50, 30, 50, 0, 45, 0, 30), _
                       New LineTemplate(100, 30, 100, 80), _
                       New BezierTemplate(100, 80, 100, 95, 70, 100, 50, 100), _
                       New BezierTemplate(50, 100, 30, 100, 0, 95, 0, 80), _
                       New LineTemplate(0, 80, 0, 30)}, _
                   Nothing, FillMode.Winding, "ChangeOF")
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exporting Shape Nodes with Decorations
Reply #3 - May 12th, 2010 at 7:02am
Print Post  
I can't get any errors exporting this shape. The problem might happen not because of the shape definition but some property of the nodes. What kind of pen and brush are you using?

Stoyan
  
Back to top
 
IP Logged
 
BudMan
YaBB Newbies
*
Offline


Credidi me felem vidisse

Posts: 45
Joined: Jul 14th, 2007
Re: Exporting Shape Nodes with Decorations
Reply #4 - May 24th, 2010 at 4:51pm
Print Post  
I figured out the problem. Some of the shapes I was exporting had decorations while others did not. I instantiated the shapes without decorations using an empty array. When I changed the empty arrays to Null—oops Nothing—it exported OK.

This took me a while to figure out because I used this constructor to initialize the shape to be exported:

mfn.Shape = New MindFusion.Diagramming.Shape(Outline, FillMode)

I then added the Decorations in a subsequent statement:

mfn.Shape.Decorations = SomeShapeObject.Shape.Decorations



When I used the following constructor which includes the Decorations argument the export worked fine.

mfn.Shape = New MindFusion.Diagramming.Shape(Outline, Decorations, Nothing, FillMode)


Incidentally, I had all kinds of trouble when I started experimenting with exporting to different file formats because the shapes were actually subclasses of the Shape class. This happened even though I called the RegisterItemCall method:

MindFusion.Diagramming.Diagram.RegisterItemClass(GetType(DiagramNode), "DiagramNode", 1)

To fix, I just created a new 'hidden' Diagram object and copied all the nodes and links to it from the original. When I copied the (subclassed) shape nodes, I just converted them on-the-fly to 'real' Shape objects. What actually got exported then was the 'cloned' diagram, not the original.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Exporting Shape Nodes with Decorations
Reply #5 - May 24th, 2010 at 6:54pm
Print Post  
Yes, you must specify null instead of an empty array when not using decorations. If the value is different than null/nothing, the control creates a GraphicsPath to draw the decoration elements, but GraphicsPaths do not work that well when empty.

Is your derived node class called DiagramNode?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint