Page Index Toggle Pages: 1 2 3 [4] 5  Send TopicPrint
Very Hot Topic (More than 25 Replies) Link routing - supperposition + arrow orientation (Read 32457 times)
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #45 - Jun 22nd, 2009 at 1:04pm
Print Post  
Hi Stoyan,

-1- I create my links from code every time (I'm not using a xml file so my links are supposed to be new). Just in case (even though technically it shouldn't change anything), I added the following after my links creation & when I hit refresh:
Code
Select All
foreach (DiagramLink link in _Diagram.Links)
    link.Style = LinkStyle.Bezier; 


To test the feature, I tried using the clean Entities sample, without success. What changes should I do in order to have Bezier links in it? I don't know if it changes anything, but I switched recently to .Net 3.5.

-2- Are you talking about release 5.3? If not, do you have an example of a custom BehaviorBase?

-3- Do you have a description of the differences between each HandlesStyle somewhere?

Thanks Smiley
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing - supperposition + arrow orientat
Reply #46 - Jun 22nd, 2009 at 2:20pm
Print Post  
Hi Marie,

Regarding Bezier links, when a link is initially created, its points are placed on a straight line, so it might not look as a curve until you move a related table or some of the control points. Is that the problem?

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #47 - Jun 22nd, 2009 at 2:27pm
Print Post  
Hi Stoyan,

-1- I guess this is the problem. I am not sure however, since I remember having bezier links without having to move the nodes. I find the current behavior really weird... I'll just do my own controls points calculations...

Thank you,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing - supperposition + arrow orientat
Reply #48 - Jun 22nd, 2009 at 2:34pm
Print Post  
1. Perhaps they had both Style=Bezier and AutoRoute=true?

2. Yes, one of the later beta builds adds a ShouldMoveSelection virtual method. Override it to return false when GetLinkAt() returns a link at the current position, and return null from StartDraw(). This should ensure that the click only selects the link and not start any other operation.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing - supperposition + arrow orientat
Reply #49 - Jun 22nd, 2009 at 2:38pm
Print Post  
3. You can see some short descriptions listed in the HandlesStyle enumeration topic. Also I've just noticed you can set HandlesStyle to Custom and handle the HitTestAdjustmentHandles event; this should be the easiest way to prevent starting a container move operation when there is a link under the mouse.

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #50 - Jun 22nd, 2009 at 8:51pm
Print Post  
Hi!

1) I tried with and without AutoRoute and the results are both weird to me but setting the controls points myself for the bezier is alright and will give me more control.

2) Great!!! I'll try custom handlesStyles with HitTestAdjustementHandles...

3) Smiley. I was looking in the code found by Visual Studio thinking they would match but next time I'll be more cautious Smiley.

Since all my questions have been answered, I have a new one!!!

I now have nice links once they are created & also when a node is moved. However, I want to set the Controls Points of my Bezier link when creating a new link. How can I do that? Using diagram.LinkCustomDraw = Additional? In this case, how can my code be called first? I don't want to do the actual drawing, just updating the control points as the link gets moved and then let Flowchart handle the actual drawing.
Also, in this case (in diagram.DrawLink event), what should I use as the link's start & end points? Can I use e.Origin, e.TableRow & e.AnchorIndex to get the anchor point's position (from there I'm fine) and use e.MousePosition as the link's end position? It doesn't seem to work in my case (or it could be because LinkCustomDraw is not appropriately set)...

Thanks a lot!
Marie
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #51 - Jun 23rd, 2009 at 2:30pm
Print Post  
Hi Stoyan,

Is the solution to handle MouseMove?? Or perhaps there is a way to have LinkCreating called more often?

Thanks,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing - supperposition + arrow orientat
Reply #52 - Jun 23rd, 2009 at 2:39pm
Print Post  
Hi Marie,

LinkCreating is raised for each MouseMove messages, so try to set the points from there. The LinkCreating event-args should contain the origin properties you need.

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #53 - Jun 23rd, 2009 at 2:49pm
Print Post  
Hi Stoyan,

In my case, LinkCreating gets called only when the link's end is over an anchor point or a node, not just in "thin air" (i.e. over the diagram's background).

How can I have it called more often?

Thanks,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing - supperposition + arrow orientat
Reply #54 - Jun 23rd, 2009 at 3:01pm
Print Post  
AllowCreating might not be raised if some of the boolean Allow* properties are disabled and the link cannot be created at the current location because of them. Try setting AllowUnconnectedLinks = true and from LinkCreating set e.Cancel = true when there is no node under the mouse pointer.

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #55 - Jun 23rd, 2009 at 3:51pm
Print Post  
Hi Stoyan,

It works (AllowUnanchoredLinks is still false), both the user now can try to create a link from thin air (I do cancel it, but still)... This is annoying since it doesn't make sense even just to try it and also because it prevents the user from drawing selection rectangles.

What can I do to avoid trying to create links when there is no origin anchor point while keeping AllowUnconnectedLinks to true?

Thanks,
Marie
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #56 - Jun 23rd, 2009 at 5:17pm
Print Post  
Hi,

Another question:
B) I got a crash! I was trying to route links from LinkCreating even if I didn't solve (A) yet. While routing a link (that is not created yet), I get:

NullReferenceException was unhandled
Code
Select All
   à MindFusion.Diagramming.DiagramLink.x0d5905a18dc24aa7(Boolean x1c5ff8c3c1ac16ad)
   à MindFusion.Diagramming.DiagramLink.UpdateFromPoints(Boolean updateGroups)
   à MindFusion.Diagramming.DiagramLink.UpdateFromPoints() 



As a reminder:
A) How to fully unallow links created from thin air?

Thanks,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link routing - supperposition + arrow orientat
Reply #57 - Jun 23rd, 2009 at 5:35pm
Print Post  
A) You could keep AllowUnconnectedLinks = false most of the time, and set it to true in the InitializeLink event handler so that the Creating event starts firing while the link is being dragged.

B) By routing links do you mean calling link.Route, or setting the ControlPoints positions yourself?

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #58 - Jun 23rd, 2009 at 5:38pm
Print Post  
Hi,

A) Trying that right now Smiley.

B) I mean setting the controls points myself in diagram.LinkCreating using e.link.Origin (& others) and e.MousePosition, then calling UpdateFromPoints (this is the method that crashes).

Thanks,
Marie
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Link routing - supperposition + arrow orientat
Reply #59 - Jun 23rd, 2009 at 5:50pm
Print Post  
Hi,

A) It's working Smiley. However, how can I set AllowUnconnectedLinks back to false when a link creation has been cancelled (if the link has been created it's easy)?

B) In another test project, I don't get the crash, but the link doesn't get updated.

Thanks,
Marie
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 3 [4] 5 
Send TopicPrint