Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Strange behaviour with AttachToLink (Read 3071 times)
DKHMM
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 7th, 2009
Strange behaviour with AttachToLink
Dec 7th, 2009 at 12:01pm
Print Post  
Hi Mindfusion.

I'm trying to add a shape to links, and in most cases it works with success, but some of them are unfortunately misplaced.

Please see the example below:

[code]
ShapeNode newShape1 = diagram.Factory.CreateShapeNode(40, 40, 20, 20, Shapes.Rectangle);



newShape1.Expandable = true;




for (int a=0; a<10; a++)



{




ShapeNode newShape = diagram.Factory.CreateShapeNode(0, 0, 20, 20, Shapes.Rectangle);





DiagramLink link = diagram.Factory.CreateDiagramLink(newShape1, newShape);




ShapeNode label = diagram.Factory.CreateShapeNode(0, 0, 10, 10, Shapes.Star);




label.AttachTo(link, AttachToLink.LongestHSegment, 1);




link.SubordinateGroup.Expandable = true;



}




TreeLayout layout = new TreeLayout { Type = TreeLayoutType.Centered, Direction = TreeLayoutDirections.TopToBottom, LevelDistance = 100 };



layout.Arrange(diagram);
[/code]

[img]http://i736.photobucket.com/albums/xx8/DKHMM/mindfusionError1.jpg[/img]

If I try to change the link with the mouse pointer, it is working, but as soon as I rearrange the layout, some of the shapes are misplaced.

Looking forward to see your reply.

Best regards
Henrik
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Strange behaviour with AttachToLink
Reply #1 - Dec 7th, 2009 at 12:48pm
Print Post  
Hi,

Set label.IgnoreLayout = true and it will work as expected. Otherwise each label is considered a graph on its own, and the code that places multiple graphs will move these one-node graphs to the right.

Just FYI, the next WpfDiagram release will use Shape objects as arrowhead shapes, so there you will be able to set link.IntermediateShape = Shape.Star instead of using attached nodes. This will help if you are using the stars only as decorations.

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


I love YaBB 1G - SP1!

Posts: 4
Joined: Dec 7th, 2009
Re: Strange behaviour with AttachToLink
Reply #2 - Dec 7th, 2009 at 1:03pm
Print Post  
Hi Stoyan

Thanks for your quick reply

It now works as expected.

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