Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Laying out arrows problem (Read 3683 times)
bt1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 18th, 2011
Laying out arrows problem
Oct 18th, 2011 at 3:24pm
Print Post  
Hi, I am evaluating FlowChartX Pro (c++) to create control flow diagrams. A small issue is when i create a chart and perform a tree layout followed by routing all arrows. After the arrows are routed, the destination end of the arrow is placed too far into the triangle and looks poorly (see left of the image below). If a call ArrangeDiagram() a second time, the arrows appear much nicer (the right side of the image below), however I do not want the performance hit of doing this (i am generating very large charts)



The code to create the left side image is as follows... anybody know what I am doing wrong? Smiley thanks!!

Code
Select All
FlowChart1->UndoDepth         = 0;

FlowChart1->AutoSizeDoc       = true;

FlowChart1->AutoScroll        = true;

FlowChart1->AllowMultiSel     = false;

FlowChart1->ShowShadows       = false;

FlowChart1->KbdActive         = false;

FlowChart1->SelectAfterCreate = false;

FlowChart1->ArrowEndsMovable  = false;

FlowChart1->ArrowSelStyle     = Flowchartlib_tlb::ESelStyle::sstCustom;

FlowChart1->ArrowHead         = Flowchartlib_tlb::EArrowHead::ahTriangle;

FlowChart1->ArrowStyle        = Flowchartlib_tlb::EArrowStyle::asPerpendicular;

FlowChart1->PrpArrowStartOrnt = Flowchartlib_tlb::EPrpStartOrientation::soVertical;

FlowChart1->ArrowSegments     = 3;

FlowChart1->ArrowCrossings    = Flowchartlib_tlb::EArrowCrossings::acArcs;

FlowChart1->FireMouseMove     = true;


FlowChart1->BoxSelStyle       = Flowchartlib_tlb::ESelStyle::sstInvisible;

FlowChart1->BoxStyle          = Flowchartlib_tlb::EBoxStyle::bsRect;

FlowChart1->Behavior          = Flowchartlib_tlb::EBehavior::bhDoNothing;


AnchorPattern1->AddAnchorPointF( 40, 100, false, true, Flowchartlib_tlb::EMarkStyle::msNone, 0x000000FF );

AnchorPattern1->AddAnchorPointF( 60, 100, false, true, Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00 );

AnchorPattern1->AddAnchorPointF( 50, 100, false, true, Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00 );

AnchorPattern1->AddAnchorPointF( 50,   0, true, false, Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00 );

AnchorPattern1->PatternId = L"AP1";


FlowChart1->RoutingOptions->SetDefaultMode();

FlowChart1->RoutingOptions->Anchoring        = Flowchartlib_tlb::EAnchoring::ancKeep;

FlowChart1->RoutingOptions->EndOrientation   = Flowchartlib_tlb::EPrpStartOrientation::soVertical;

FlowChart1->RoutingOptions->StartOrientation = Flowchartlib_tlb::EPrpStartOrientation::soVertical;

FlowChart1->RoutingOptions->TriggerRerouting = Flowchartlib_tlb::ERerouteArrow::raWhenIntersectNode;


for( int i = 0;i<20;i++)

{


b_next = FlowChart1->CreateBox( 100, 30, 70, 100 );


b_next->set_AnchorPattern( AnchorPattern1->GetDefaultInterface() );


b_next->set_Text( L"A" );



if( b_prev )


{



Flowchartlib_tlb::IArrowItem * a = FlowChart1->CreateAnchoredArrow( b_prev, 0, b_next, 3 );



a->set_Color( 0x000000FF );



a->set_FillColor( 0x000000FF );




b_next = FlowChart1->CreateBox( 0, 0, 70, 100 );



b_next->set_AnchorPattern( AnchorPattern1->GetDefaultInterface() );



b_next->set_Text( L"B" );




a = FlowChart1->CreateAnchoredArrow( b_prev, 1, b_next, 3 );



a->set_Color( 0x0000FF00 );



a->set_FillColor( 0x0000FF00 );


}



b_prev = b_next;

}


TreeLayout1->Root = FlowChart1->ActiveBox;


TreeLayout1->type           = Flowchartlib_tlb::ETreeLayoutType::tltCentralized;

TreeLayout1->ArrowStyle     = Flowchartlib_tlb::ETreeLayoutArrows::tlaPerpendicular3;

TreeLayout1->Direction      = Flowchartlib_tlb::ETreeLayoutDirection::tldTopToBottom;

TreeLayout1->KeepRootPos    = true;

TreeLayout1->ArrowAnchoring = Flowchartlib_tlb::EAnchoring::ancKeep;

TreeLayout1->NodeSpacing    = 50;

TreeLayout1->LevelSpacing   = 50;


// layout boxes and arrows...

FlowChart1->ArrangeDiagram( TreeLayout1->GetDefaultInterface() );

FlowChart1->RouteAllArrows(); 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Laying out arrows problem
Reply #1 - Oct 18th, 2011 at 4:35pm
Print Post  
Hi,

Setting TreeLayout.ArrowStyle to tlaPerpendicular3 automatically centers the arrow middle segments between the nodes, doesn't it?

If you are calling RouteAllLinks in order to arrange links that are not part of the tree (and ignored by TreeLayout), you could try setting larger NodeVicinityCost and NodeVicinitySize values in Flowchart->RoutingOptions before RouteAllArrows.

Alternatively, check the length of the last segment and move the next-to-last point further from the last one by setting its CtrlPtX/Y coordinates.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bt1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 18th, 2011
Re: Laying out arrows problem
Reply #2 - Oct 18th, 2011 at 5:12pm
Print Post  
Hi, thanks for quick reply!

Yes TreeLayout.ArrowStyle is set to tlaPerpendicular3 which draws things correctly after ArrangeDiagram(), its subsequently after a call to RouteAllArrows() which changes the arrow disply to look odd.

I will experiment further with the RoutingOptions.

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