Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Arrow Questions (Read 4833 times)
torkos
YaBB Newbies
*
Offline



Posts: 2
Joined: Sep 28th, 2005
Arrow Questions
Sep 29th, 2005 at 12:17am
Print Post  
I have a couple of things I want to do with the arrows.

1.  I want to have multiple output arrows, but only allow one input.  So if multiple things are trying to connect to the input, I guess I would keep the latest and remove what was there previously.  What would be the best way to implement this?

2.  Connections to self.  I want to be able to allow a node to connect to itself, but visually this does not look right.  There is a loop from the same point to itself.  What I want it the output anchor to connect with the input anchor ... they are in different places (set up by me).  Yet it seems whatever I do to connect the node to itself, the appearance is the same.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow Questions
Reply #1 - Sep 29th, 2005 at 6:28am
Print Post  
To allow only one input arrow, try handling the ArrowCreated event like this:

if arrow.DestinationBox.IncomingArrows.Count > 1 then
  fc.DeleteItem arrow.DestinationBox.IncomingArrows(0)
end if

So when a second input arrow is linked to a node, the first one is automatically deleted.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow Questions
Reply #2 - Sep 29th, 2005 at 6:33am
Print Post  
At this time, when a reflexive arrow is created it is set to a single segment Bezier style representing a loop. So to change it to another shape, handle ArrowCreated and check whether the arrow's origin and destination are the same. If they are the same, set these properties:

- PrpArrowStartOrnt, if you need the reflexive arrow to be of the 'perpendicular' style
- Style
- Segments
- CtrlPtX and CtrlPtY coordinates for all control points so the arrow has the shape you need
  
Back to top
 
IP Logged
 
torkos
YaBB Newbies
*
Offline



Posts: 2
Joined: Sep 28th, 2005
Re: Arrow Questions
Reply #3 - Sep 30th, 2005 at 1:19am
Print Post  
Thank you, this helps a bunch.
I made a slight modification so that I can have multiple connections to a box, but each input anchor can have only 1 input connection.

I have one more question about the CtrlPts.

When I enter the anchor points for input/output on my box, I enter them as a percentage of the box size.  On the otherhand, it looks as if CtrlPtX and CtrlPtY are in absolute window coordinates ... is that correct?  If so, how would I map the start and end point of the arrow to the correct start and end point of the anchors?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow Questions
Reply #4 - Sep 30th, 2005 at 6:41am
Print Post  
Hi,

It could be easiest to recreate the arrow, e.g. delete the one just created and call CreateAnchoredArrow. That will align the end points to the anchor locations, and you will just have to set the intermediate points coordinates.

Otherwise, you can calculate the absolute location from the percent one like this:

absX = boxX + ancptXPercent * boxWidth / 100
absY = boxY + ancptYPercent * boxHeight / 100

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