Page Index Toggle Pages: 1 [2]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Arrow routing and creating straight lines (Read 14289 times)
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow routing and creating straight lines
Reply #15 - Apr 3rd, 2008 at 8:33am
Print Post  
Hi Stoyan,

I have made the changes to the JDiagram code you suggested and I am setting initializing the flowchart as follows on the outside:

[code]

private void initialize() {
flowChart = new FlowChart();
JScrollPane pane = new JScrollPane(flowChart);
this.getContentPane().add(pane);

flowChart.setArrowStyle(ArrowStyle.Cascading);
flowChart.setRouteArrows(true);
flowChart.setSnapToAnchor(SnapToAnchor.OnCreateOrModify);
flowChart.getRoutingOptions().setTriggerRerouting(
RerouteArrows.WhenIntersectNode | RerouteArrows.WhenModified
//| RerouteArrows.WhileCreating
);
}

[/code]

The problem is as follows:

1. If I turn on the RerouteArrows.WhileCreating, the arrow cannot be drawn straight. It takes the loop sort of a path.

2. With the RerouteArrows.WhileCreating off, the arrow can be drawn straight during the drag, but

a. if we drag it too deep into the second symbol, it attaches to a top or a bottom border.
b. Also, when connecting from and to the top borders of the symbols, there is no visual indication how the arrow is going to end up
c. the arrow doesn't snap to the border of the symbol when dragging the arrow over the second symbol.

So, ideally, I want the RerouteArrows.WhileCreating on because of the three above points, and with the creating on, be able to draw a straight line - something that behaves like Visio.

Please let me know if you understand the problem I am describing, and how that can be fixed.

Thanks,
Praveen
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #16 - Apr 4th, 2008 at 9:49am
Print Post  
Hi,

Ok, in the updateCreate method modify the routing code:

* comment out setEndPoints(orgnLink, target, current);
* comment out routeGetEndPoints(startPoint, endPoint,...) and the next two assignments.
* add the following instead of the last assignments

if (!(target.getNode() instanceof DummyNode))
     ptEnd = target.getNode().getNearestOutlinePt(endPoint);
endPoint = (Point2D) ptEnd.clone();

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow routing and creating straight lines
Reply #17 - Apr 5th, 2008 at 5:07pm
Print Post  
Hi Stoyan,

Thank you. Now it is much easier to draw straight lines.
One small point though - the arrows by default assume that they are going downwards - even when being dragged to the right - so we have that downward spoon shaped arrow.
Is it possible to build in the logic to make the arrow point to the horizontally if it is being dragged horizontally, and vertically (which it is already doing) when dragged vertically?

One more thing I noticed - if I draw a straight line horizontally now, I am unable to move the head, I can only move the base. For a line with one or more bends, the head also can be moved.

Thanks again for this change.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #18 - Apr 8th, 2008 at 12:03pm
Print Post  
Hi Praveen,

I can't reproduce this. Have you by chance set RoutingOptions.EndOrientation to Vertical?

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow routing and creating straight lines
Reply #19 - Apr 8th, 2008 at 12:06pm
Print Post  
Hi,

Could it be because I am using 1.0.1 version of NetDiagram?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #20 - Apr 9th, 2008 at 10:19am
Print Post  
Hi,

You should have received your upgrade to version 1.0.3, is there any reason not to move to it? Anyway, it's not likely that we'll copy these changes to V1.0.1.

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow routing and creating straight lines
Reply #21 - Apr 10th, 2008 at 12:19pm
Print Post  
Hi Stoyan,

I checked now with 1.0.3, and I still see the same 4 segment arrow when I drag (from a left box to a right box).

It seems to be because the function routeGetEndPoints returns dNearest as 0, when called from doRoute. If I change this to return 3, it shows it horizontal (just a hack I did to test this theory)

And I understand that you will be providing the changes only in the future releases, not any bygone ones.

Thanks,
Praveen
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #22 - Apr 11th, 2008 at 4:58am
Print Post  
Hi Praveen,

Is it the bend that the arrow makes while still not pointing to a node bothering you?

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow routing and creating straight lines
Reply #23 - Apr 11th, 2008 at 5:03am
Print Post  
:) Yes, that's the one I was talking about.

But please, only look at it if it is not too much of a bother. I think what you have done so far is just about right.

Thanks,
Praveen
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #24 - Apr 11th, 2008 at 5:17am
Print Post  
Ah, ok. We'll straighten it up in the 1.0.4 release - that should be a couple of lines of code.

Stoyan
  
Back to top
 
IP Logged
 
rachis
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 18
Joined: May 14th, 2007
Re: Arrow routing and creating straight lines
Reply #25 - Apr 17th, 2008 at 4:23am
Print Post  
Hi Stoyon,

When is the 1.0.4 release slated for? I am wondering if it is going to be after May end, can I request that the bend in the arrow issue be given a consideration, assuming this is not difficult.

I have a patch release sometime around mid-May and have considered to include the arrow routing refinements.

Thanks in advance,
Rachna
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #26 - Apr 17th, 2008 at 7:32am
Print Post  
We are now preparing the new version for release.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #27 - Apr 19th, 2008 at 12:05pm
Print Post  
Hi Rachna,

That's now implemented here:
https://mindfusion.eu/_beta/netdiag_104beta.zip

Version 1.0.4 will be in beta tests for about a week. If you prefer, you can add the following code to enable this in V1.0.3:

if (destLink instanceof DummyLink)
{
     endPoint.setLocation(ptdCenter);
     dNearest.set(-1);
}

Paste that before the final "else" in routeGetEndPoints, after the Utilities.add calls.

Stoyan
  
Back to top
 
IP Logged
 
koosala
Full Member
***
Offline


Java Happens

Posts: 136
Joined: May 13th, 2007
Re: Arrow routing and creating straight lines
Reply #28 - Apr 22nd, 2008 at 3:27am
Print Post  
Thank you Stoyan. The change works nicely.

Earlier I had mentioned this problem I saw:

If I draw a straight line horizontally now, I am unable to move the head, I can only move the base. For a line with one or more bends, the head also can be moved.

Do you also see it?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow routing and creating straight lines
Reply #29 - Apr 22nd, 2008 at 10:02am
Print Post  
There are two overlapping control points in that case. Edit the Arrow.pointInHandle method to hit-test the start and end points before all others, and it should work fine.

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