Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Preventing link text from overwriting another (Read 4038 times)
jacohen
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 14th, 2008
Preventing link text from overwriting another
Aug 14th, 2008 at 10:28am
Print Post  
Is there a way to ensure that link text is always legible particularly when there are multiple links in close proximity?


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


tech.support

Posts: 3171
Joined: Oct 19th, 2005
Re: Preventing link text from overwriting another
Reply #1 - Aug 14th, 2008 at 11:19am
Print Post  
there isn't any way to arrange the link labels automatically. you can use nodes attached to links as labels, and let the user move these labels around when they need to make the diagram more legible.
  
Back to top
 
IP Logged
 
jacohen
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 14th, 2008
Re: Preventing link text from overwriting another
Reply #2 - Aug 14th, 2008 at 11:25am
Print Post  
Thanks for the fast response, is there a particular way to do this, or would you just add an additional node and connector?

[A]-------->[B]

effectively becomes:

[A]------->[Label Node]---->[B]

requiring an additional node and an additional connector?

I did read somewhere that it was possible to add a node to an existing link 'point' but can't find exactly how to do that.

Thanks,

Jason.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3171
Joined: Oct 19th, 2005
Re: Preventing link text from overwriting another
Reply #3 - Aug 14th, 2008 at 11:33am
Print Post  
There is, use the AttachTo method. For example

int pc = link.ControlPoints.Count;
Point linkCenter = new Point(link.ControlPoints[pc/2 - 1], link.ControlPoints[pc/2];
ShapeNode label = diag.Factory.CreateShapeNode(linkCenter, labelSize);
label.Text = "link's label";
label.Transparent = true;
label.IgnoreLayout = true;
label.AttachTo(link, AttachToLink.Segment, link.SegmentCount / 2);

HTH
  
Back to top
 
IP Logged
 
jacohen
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 14th, 2008
Re: Preventing link text from overwriting another
Reply #4 - Aug 20th, 2008 at 1:00pm
Print Post  
Slavcho wrote on Aug 14th, 2008 at 11:33am:
There is, use the AttachTo method. For example

int pc = link.ControlPoints.Count;
Point linkCenter = new Point(link.ControlPoints[pc/2 - 1], link.ControlPoints[pc/2];
ShapeNode label = diag.Factory.CreateShapeNode(linkCenter, labelSize);
label.Text = "link's label";
label.Transparent = true;
label.IgnoreLayout = true;
label.AttachTo(link, AttachToLink.Segment, link.SegmentCount / 2);

HTH



Using this method I get the following issue when using the Orthogonal Layout:

Any ideas?

System.ArgumentOutOfRangeException occurred
  Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
  Source="mscorlib"
  ParamName="index"
  StackTrace:
      at System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index)
      at MindFusion.Diagramming.Wpf.PointCollection.get_Item(Int32 index)
      at MindFusion.Diagramming.Wpf.Group.xcac3bd22cf22296d(Attachment xe3b5f8a78f422902)
      at MindFusion.Diagramming.Wpf.Group.x9402138a43a773c1(InteractionState x01b557925841ae51, Boolean xfab68f3923c9249c)
      at MindFusion.Diagramming.Wpf.Group.x9402138a43a773c1(InteractionState x01b557925841ae51)
      at MindFusion.Diagramming.Wpf.DiagramLink.x0d5905a18dc24aa7(Boolean x1c5ff8c3c1ac16ad)
      at MindFusion.Diagramming.Wpf.DiagramLink.UpdateFromPoints(Boolean updateGroups)
      at MindFusion.Diagramming.Wpf.DiagramLink.UpdateFromPoints()
      at MindFusion.Layout.xdb1b7acfd02f3e95.x0360c0152e0fc04b(DiagramLink xe9c763083b68a7ee, PointCollection x6fa2570084b2ad39)
      at MindFusion.Layout.xdb1b7acfd02f3e95.x3d8c55d85ef1a2ec(DiagramLink xe9c763083b68a7ee, Boolean xc2bb3863aee458e5, Boolean x3f77266add946953)
      at MindFusion.Diagramming.Wpf.Layout.OrthogonalLayout.Arrange(Diagram diagram, DiagramItemCollection items)
      at MindFusion.Diagramming.Wpf.Layout.Layout.Arrange(Diagram diagram)
      at Paragon.SSRM.UI.WiringDiagramControl.ApplyLayout() in D:\Local Repositories\Paragon DotNet\SSRM\trunk\Ssrm\UI\WiringDiagramControl.xaml.cs:line 229
  InnerException:

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Preventing link text from overwriting another
Reply #5 - Aug 20th, 2008 at 3:02pm
Print Post  
Hi,

The component expects that the link segment you are attaching the label to is always available, and the exception is thrown if OrtogonalLayout removes some link segments and the index is no longer valid. To work around this, call Detach for all labels before applying the layout, and call Attach again after that.

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


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 14th, 2008
Re: Preventing link text from overwriting another
Reply #6 - Aug 20th, 2008 at 3:34pm
Print Post  
Thanks, very impressed with your responses!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint