Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Indeces of Boxes / DestIndex (Arrow) (Read 3585 times)
IBS
Guest


Indeces of Boxes / DestIndex (Arrow)
Nov 22nd, 2005 at 11:16am
Print Post  
Hi,

I want to serialize the FlowChart to XML by myself (since the XMLWriter.Write() Method doesnt fit my needs).

So I build a class which will be serialized and stores all data I need. I only work with Boxes and Arrows.

The class has a property (Collection), which holds all boxes.
Then there will be a similar property which holds all Arrows.

I wonder how I can connect an arrow to a box.
Unfortunalty all arrows have a "-1" as DestIndex, though I would have expected the Index of the Box in the FlowChart.
A Box itself doesn't have an Index property either.

Other problem: Arrow.Destination returns a Node, and I cannot cast it to a Box! Strange.

Alternative idea was, to descend recursivly to all boxes, which are connected through an arrow, but that of course can end in an infinite loop.

Easiest approch to me seems, to save all Arrows in a Collection and each arrow has the Index of the start Box and of the end Box. But how to do.... what about the Indeces...?

Thanks very much!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Indeces of Boxes / DestIndex (Arrow)
Reply #1 - Nov 22nd, 2005 at 2:12pm
Print Post  
Hi,

You might use the ChartObject.ZIndex property for an index in the XML file. The ZIndex corresponds to the position of an item in the FlowChart.Objects collection. I.e. these statements

box == fc.Objects[box.ZIndex] as Box
arrow == fc.Objects[arrow.ZIndex] as Arrow

should always be true.

Arrow.Destination might be an instance of four classes: Box, Table, ControlHost or DummyNode. The DummyNode class is used with "unconnected" arrows.

I hope that helps
Stoyan
  
Back to top
 
IP Logged
 
IBS
Guest


Re: Indeces of Boxes / DestIndex (Arrow)
Reply #2 - Nov 22nd, 2005 at 2:21pm
Print Post  
Hi,

is the ZIndex unique for all Objects in the chart? I thought the zIndex can be the same for several objects.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Indeces of Boxes / DestIndex (Arrow)
Reply #3 - Nov 22nd, 2005 at 2:44pm
Print Post  
Hi,

Yes, the ZIndex is unique and corresponds to the item's index in Objects. If you change the ZIndex of some item to a value already occupied by another one, the items are shifted so their Z indices are always in the range [ 0 .. Objects.Count - 1 ].

Stoyan
  
Back to top
 
IP Logged
 
IBS
Guest


Re: Indeces of Boxes / DestIndex (Arrow)
Reply #4 - Nov 23rd, 2005 at 6:35am
Print Post  
Hi,

and why is the DestIndex and OriginIndex of the Arrow object always -1 ?
At least in my cases, I tested. An alternative would be, to use the Destination and Origin properties (Node object) and take their ZIndex, if I wanna now the Index of the two connected objects, right?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Indeces of Boxes / DestIndex (Arrow)
Reply #5 - Nov 23rd, 2005 at 10:34am
Print Post  
Hi,

DestIndex and OrgIndex are indices of anchor points to which the arrow is attached. So if the boxes don't have their AnchorPattern set, these indices will be always -1. So use arrow.Origin.ZIndex to get the origin box Z index.

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