Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Arrows getting routed over one another? (Read 5541 times)
BF
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Feb 26th, 2013
Arrows getting routed over one another?
Jun 7th, 2013 at 3:51pm
Print Post  
I constantly get graphs (LayeredLayout) where an arrow get routed directly over one another as shown below.

I have experimented with RoutingOptions like CrossingCost and GridSize to no avail. The anchoring is set to reassign and there are many anchor points available.

Does TriggerRerouting happen when overlapping and existing arrow? (Not just crossing which is acceptable, but actually overlapping)

How can I ensure this wont happen?

Thanks (Last question for today too Wink )


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrows getting routed over one another?
Reply #1 - Jun 7th, 2013 at 5:47pm
Print Post  
Arrows should not overlap after LayeredLayout. Are you calling their Route method after applying layout? At this time the routing algorithm will avoid overlaps only for asPerpendicular style arrows.
  
Back to top
 
IP Logged
 
BF
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Feb 26th, 2013
Re: Arrows getting routed over one another?
Reply #2 - Jun 10th, 2013 at 9:48am
Print Post  
I have narrowed this down to an issue with the LayeredLayout XGap property. If I don't set an XGap value then routing is as expected with no overlapping arrows, however If I do set an XGap property the arrows overlap, unless the XGap property is very small.

The following gets routing working:

Code (C++)
Select All
FlowChart1->RoutingOptions->NodeVicinitySize  = 30;

LayeredLayout1->NodeDistance = 150;

// LayeredLayout1->XGap = 300; // Arrows will overlap
LayeredLayout1->XGap = 90; // Arrows wont overlap (but xgap looks too small)
 



This seems like a bug with XGap as for a nice looking graph I would need a XGap of 300 or so.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrows getting routed over one another?
Reply #3 - Jun 10th, 2013 at 11:50am
Print Post  
XGap should not matter if the links are in the same connected subgraph as in the image. Could you attach the saved flowchart file and post your complete layout code?
  
Back to top
 
IP Logged
 
BF
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 9
Joined: Feb 26th, 2013
Re: Arrows getting routed over one another?
Reply #4 - Jun 10th, 2013 at 1:21pm
Print Post  
sure, complete code is below and I attached a fcx file too. this code snippit has an xgap of 300 which causes the arrow from box 11 to 13 to be placed over the arrow from box 10 to 13 (like the screenshot I posted, my original screenshot had some custom drawing stuff which I removed.).

Code (C++)
Select All
	this->FlowChart1->UndoDepth         = 0;
	this->FlowChart1->AutoSizeDoc       = true;
	this->FlowChart1->AutoScroll        = true;
	this->FlowChart1->AllowMultiSel     = false;
	this->FlowChart1->ShowShadows       = false;
	this->FlowChart1->KbdActive         = false;
	this->FlowChart1->SelectAfterCreate = false;
	this->FlowChart1->ArrowEndsMovable  = false;
	this->FlowChart1->ArrowSelStyle     = Flowchartlib_tlb::ESelStyle::sstCustom;
	this->FlowChart1->ArrowHead         = Flowchartlib_tlb::EArrowHead::ahTriangle;
	this->FlowChart1->ArrowStyle        = Flowchartlib_tlb::EArrowStyle::asPerpendicular;
	this->FlowChart1->PrpArrowStartOrnt = Flowchartlib_tlb::EPrpStartOrientation::soVertical;
	this->FlowChart1->ArrowSegments     = 2;
	this->FlowChart1->ArrowCrossings    = Flowchartlib_tlb::EArrowCrossings::acStraight;
	this->FlowChart1->FireMouseMove     = true;
	this->FlowChart1->BoxCustomDraw     = Flowchartlib_tlb::ECustomDraw::cdNone;
	this->FlowChart1->BoxSelStyle       = Flowchartlib_tlb::ESelStyle::sstCustom;
	this->FlowChart1->BoxStyle          = Flowchartlib_tlb::EBoxStyle::bsRect;
	this->FlowChart1->Behavior          = Flowchartlib_tlb::EBehavior::bhPanOnly;

	this->AnchorPattern1->AddAnchorPointF(40, 100, false, true, Flowchartlib_tlb::EMarkStyle::msNone, 0x000000FF);
	this->AnchorPattern1->AddAnchorPointF(50, 100, false, true,Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00);
	this->AnchorPattern1->AddAnchorPointF(60, 100, false, true,Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00);
	this->AnchorPattern1->AddAnchorPointF(40, 0, true, false,Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00);
	this->AnchorPattern1->AddAnchorPointF(50, 0, true, false,Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00);
	this->AnchorPattern1->AddAnchorPointF(60, 0, true, false,Flowchartlib_tlb::EMarkStyle::msNone, 0x0000FF00);
	this->AnchorPattern1->PatternId = L"AP1";

	this->FlowChart1->RoutingOptions->NodeVicinityCost  = 10;
	this->FlowChart1->RoutingOptions->NodeVicinitySize  = 30;
	this->FlowChart1->RoutingOptions->GridSize          = 30;
	this->FlowChart1->RoutingOptions->TurnCost          = 10;
	this->FlowChart1->RoutingOptions->LengthCost        = 10;
	this->FlowChart1->RoutingOptions->CrossingCost      = 20;
	this->FlowChart1->RoutingOptions->EndOrientation    = Flowchartlib_tlb::EPrpStartOrientation::soVertical;//soVertical;
	this->FlowChart1->RoutingOptions->StartOrientation  = Flowchartlib_tlb::EPrpStartOrientation::soVertical;
	this->FlowChart1->RoutingOptions->TriggerRerouting  = Flowchartlib_tlb::ERerouteArrow::raWhenIntersectNode ;
	this->FlowChart1->RoutingOptions->Anchoring         = Flowchartlib_tlb::EAnchoring::ancReassign;

	this->LayeredLayout1->Orientation             = Flowchartlib_tlb::EOrientation::orVertical;
	this->LayeredLayout1->EnforceLinkFlow         = true;
	this->LayeredLayout1->IgnoreNodeSize          = false;
	this->LayeredLayout1->ArrowAnchoring          = Flowchartlib_tlb::EAnchoring::ancReassign;
	this->LayeredLayout1->NodeDistance            = 150;
	this->LayeredLayout1->LayerDistance           = 100;
	this->LayeredLayout1->StraightenLongLinks     = false;

	this->LayeredLayout1->XGap                    = 300;
	//this->LayeredLayout1->XGap                    = 90;


	this->LayeredLayout1->MultipleGraphsPlacement = EMultipleGraphsPlacement::mgpHorizontal;

	Flowchartlib_tlb::IBoxItem * b[16];

	for (int i = 0; i < 16; i++) {
		int width = 300;
		int height = 100;
		if (i == 0 || i == 4 || i == 8 || i == 7) {
			width = 350;
			height = 300;
		}

		b[i] = this->FlowChart1->CreateBox(0, 0, width, height);

		b[i]->FillColor = clYellow;

		b[i]->Obstacle = true;

		b[i]->set_AnchorPattern( this->AnchorPattern1->GetDefaultInterface() );

		UnicodeString caption;

		caption.printf(L"%d", i);

		b[i]->set_Text(caption.w_str());
	}

	this->FlowChart1->CreateArrow(b[0], b[1]);
	this->FlowChart1->CreateArrow(b[0], b[2]);
	this->FlowChart1->CreateArrow(b[1], b[2]);
	this->FlowChart1->CreateArrow(b[2], b[3]);
	this->FlowChart1->CreateArrow(b[2], b[4]);
	this->FlowChart1->CreateArrow(b[3], b[4]);
	this->FlowChart1->CreateArrow(b[4], b[5]);
	this->FlowChart1->CreateArrow(b[4], b[6]);
	this->FlowChart1->CreateArrow(b[5], b[6]);
	this->FlowChart1->CreateArrow(b[5], b[7]);
	this->FlowChart1->CreateArrow(b[6], b[8]);
	this->FlowChart1->CreateArrow(b[7], b[8]);
	this->FlowChart1->CreateArrow(b[8], b[9]);
	this->FlowChart1->CreateArrow(b[8], b[10]);
	this->FlowChart1->CreateArrow(b[9], b[10]);
	this->FlowChart1->CreateArrow(b[10], b[11]);
	this->FlowChart1->CreateArrow(b[10], b[13]);
	this->FlowChart1->CreateArrow(b[11], b[12]);
	this->FlowChart1->CreateArrow(b[11], b[13]);
	this->FlowChart1->CreateArrow(b[12], b[13]);
	this->FlowChart1->CreateArrow(b[13], b[14]);
	this->FlowChart1->CreateArrow(b[13], b[15]);
	this->FlowChart1->CreateArrow(b[14], b[15]);

	this->FlowChart1->ArrangeDiagram( this->LayeredLayout1->GetDefaultInterface() );

	this->FlowChart1->RouteAllArrows();

	this->FlowChart1->FitDocToObjects( this->FlowChart1->ClientWidth/2 );

	FlowChart1->SaveToFile( L"c:\\users\\test\\desktop\\xgap_bug.fcx", true );
 


  

xgap_bug.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrows getting routed over one another?
Reply #5 - Jun 10th, 2013 at 5:58pm
Print Post  
The overlap comes from the routing function and not from LayeredLayout. From what I can see, the larger XGap only changes on which side of the layout arrows get routed, and them not overlapping when it's set to 90 is just a coincidence. At this time auto-routing does not detect overlaps for polyline links, so to avoid them you will either have to keep the paths set by LayeredLayout, or pull overlapping segments apart with some post-processing code.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint