Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Moving circle on the line (Read 3106 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Moving circle on the line
Dec 13th, 2010 at 10:15am
Print Post  
Hi Stoyo

How one can implement a small moving circle on the line between two nodes ?

Also, how one can make the line in two colors ? Means when the circle is moving from the origin of the line upto circle it should be in one color and from circle to destination it should be in another color.

Regards
Rajesh
  
Back to top
WWW  
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Moving circle on the line
Reply #1 - Dec 13th, 2010 at 1:21pm
Print Post  
Hi Rajesh,

We made a basic sample that shows how this can be achieved. You can download it from here:
https://mindfusion.eu/_samples/CustomLinkSample.zip

The link is a custom class, deriving from DiagramLink and all the custom drawing (circle and colored lines) is done in the UpdateVisuals override.

The custom link has a Position dependency property that lets you adjust the relative position of the circle on the line.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: Moving circle on the line
Reply #2 - Dec 21st, 2010 at 9:54am
Print Post  
Hi Lyubo

Thanks for your example. I have a moving circle on the line after adding a function which gets invoked after changing the Position dependecney.

Can you provide me the code which works with following situation -
1. On cascading lines.
2. Cascading lines with rounded corner.
3. On curved line.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Moving circle on the line
Reply #3 - Dec 22nd, 2010 at 9:21am
Print Post  
Hi Rajesh,

We've updated the sample to support also cascading and bezier link styles.

You can download it from here:
https://mindfusion.eu/_samples/CustomLinkSample.zip

To find the circle position on a bezier curve relatively easy, we first approximate the curve to a series of straight lines, and then apply the same logic as with other link styles.
Alternatively, you could use de Casteljau's algorithm - http://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm to split the curve into two in order to find circle's position.

I hope this helps.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint