Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Force links to honour the grid and the borders (Read 1844 times)
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Force links to honour the grid and the borders
Mar 10th, 2009 at 4:17pm
Print Post  
Hi,

Is it possible?

We have some "aesthetic" issues with the links, it's impossible put the thumbs in a good position dragging&dropping:





Is there a way to force the links to honour the grid and honour the borders of the DiagramNodes?

In the other hand, I'm trying to write a method that gets rid of the redundant control points in a link. I mean, sometimes a straight link is splitted in two segments, and the central thumb is close to the final thumb, then the text appears very close to the element, like this:



So I want to execute a function that clean those redundant points every time a link is modified. I've tried:

Code
Select All
private void DatabaseDiagram_LinkModified( object sender, LinkEventArgs e )
{
    List<Int32> redundantPointsIndex = new List<Int32>();
    Point? lastPoint = null;
    for(Int32 i=0;i<e.Link.ControlPoints.Count;i++)
    {

  Point controlPoints = e.Link.ControlPoints[ i ];

  if ( lastPoint.HasValue && lastPoint == controlPoints )


redundantPointsIndex.Add( i);


  lastPoint = controlPoints;
    }

    foreach ( Int32 p in redundantPointsIndex.OrderBy( i => i ) )
    {

  e.Link.ControlPoints.RemoveAt( p );

  // Problem: SegmentCount never changes...

  e.Link.SegmentCount = (Int16)(e.Link.SegmentCount - 1);
    }

    e.Link.UpdateFromPoints();
    e.Link.AutoRoute = true;
}
 



And the links appears correctly after execute that code over the link, but when I save and retrieve the link appears again bad. I think is because I cannot modify the segment count property. I've checked in debug mode, and no matters what value I substract from SegmentCount, it remains always in the same value. What is the best way to accomplish this?

Cheers.



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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Force links to honour the grid and the borders
Reply #1 - Mar 11th, 2009 at 10:43am
Print Post  
Set link.SnapToNodeBorder = true to make the links stick to the node borders when moving their end points.

To remove some control points, clone the ControlPoints collection, set the new SegmentCount value, clear ControlPoints, and add the points from the cloned collection that should remain.

Ideally SegmentCount should be updated automatically when you add or remove points, but we haven't implemented this because of some difficulties with Bezier links. For the next release we could implement updating the segment count from the UpdateFromPoints method - it would throw an exception if there is un invalid number of points for a Bezier link.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
vtortola
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 104
Joined: Nov 26th, 2008
Re: Force links to honour the grid and the borders
Reply #2 - Mar 11th, 2009 at 2:09pm
Print Post  
SnapToNodeBorder helps a lot, but still have problems like the 3rd picture. I think that it would be solved if I could force the table nodes to honour the grid, is there an option to do that?

I'm a bit messed with the link routing Cheesy I'd like use the exact saved postions, but at the same time I'd like when I move a node, the links route smartly... what do you recommend from your experience?

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