This is a migrated thread and some comments may be shown as answers.

Layout for AStarRouter

10 Answers 172 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 17 Feb 2017, 01:47 PM

Hi,

I build a diagram solution used to model something which consists of parts.

The process is defined by:

  • I have ONE result
  • Design is Left to Right (result is last shape on the right side)
  • Every shape has ONE "output" and 1 to n inputs
  • Input position MUST be respected

Most (?) of the thing I got working - I used something like shown is this thread: http://www.telerik.com/forums/orthogonal-routing-service-10bb0662a995

The user can drag from the "output" (right connector) to an input (not opposite).
Each "input" (connectors on the left side) can hold ONE connection.

I attached a result image - which also shows my problem.

On top you can see my "handmade" result.

Below is what I get after a redraw.

My router is a AStartRouter because it respects the input positions and also the lines appear like I want.

So how can I achieve the desired result without writing my own layouter?

Manfred

10 Answers, 1 is accepted

Sort by
0
ManniAT
Top achievements
Rank 2
answered on 17 Feb 2017, 01:50 PM

Sorry I forgot to attach the image - and since your forum doesn't support editing I have to do this by a reply.

On top is what I want (construct) - below is what I get after a redraw.

0
Shawn
Top achievements
Rank 1
answered on 20 Feb 2017, 09:27 PM

The problem is not with the router but with the layout you are using. Try using a Tree Layout and set all objects with outgoing connections as a root for the layout. Take a look at this example which will help point you in the right direction: https://github.com/telerik/xaml-sdk/tree/master/Diagram/MultipleRootsInSingleTreeLayout

Hope this helps,

Shawn

0
Martin Ivanov
Telerik team
answered on 21 Feb 2017, 08:44 AM
Hi Manfred,

You can also check the Layout help article and the other diagram SDK examples.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
ManniAT
Top achievements
Rank 2
answered on 21 Feb 2017, 12:28 PM

Hi Shwan,

first of all thank you for your will to help.

Since it took way too long before telerik support responds I played around with it and finally got a solution.
In short words - I use a TreeLayouter for the layout and a AStarRouter for the connections.

Everything works fine - except the fact that when I drag around shapes connectors search for "shortest" route.
I can fix the source of a connection (it is always the connector on the right side) but I can't (and don't want to) fix the target.

So my open problem is:
How can I mark a connector that it won't become the target in routing?

Manfred

0
ManniAT
Top achievements
Rank 2
answered on 21 Feb 2017, 12:47 PM

Hi Martin,

why do you think I'm posting here? Because I'm searching for the documentation?
As you could see (I have 880 posts here and I'm a member since 2003) - I'm not a newcomer.
I know there is documentation - Shawn already pointed me to the samples.

I checked the documentation - there is not even a word on how to use an extra "Layouter" for node placement.
I found something in the samples (OrgChart_WPF - which uses a TreeLayout) that helped me solve my problem (the main part of it).

I'm really sad to see that kind of support here at telerik.
Long delay before an answer arrives. And the answer is??

RTFM plus a link a customer (Shawn) already offered here - hours BEFORE you gave your one sentence answer.

To be precise - Shawn pointed to a specific sample - you to "the root of the samples" not even mentioning which specific sample could be helpful for my case.

I'm a telerik customer for almost 15 years - and one of the great things with telerik was their outstanding support.
But this changed a lot.

Manfred

0
Shawn
Top achievements
Rank 1
answered on 21 Feb 2017, 03:11 PM

Hi Manfred,

Unfortunately, setting the target connector to a name other than "Auto" is the only way I am aware of, without modifying Telerik code, to prevent the connector from searching for a new shorter path. If you can modify their code, the workaround is you have to create a local instance of the AStarRouter and override the GetRoutePoints function to prevent the call to the ShapeUtilities.GetNearestConnectors from searching for a shorter route.

Shawn

public ConnectionRoute GetRoutePoints(IConnection connection)
{
    if (connection == null) return new ConnectionRoute();
 
    IConnector startConnector = null;
    IConnector endConnector = null;
    ShapeUtilities.GetNearestConnectors(connection, out startConnector, out endConnector);
    Point startPoint = startConnector?.AbsolutePosition ?? connection.StartPoint;
    Point endPoint = endConnector?.AbsolutePosition ?? connection.EndPoint;
 
    return new ConnectionRoute(this.CreatePath(connection, startPoint, endPoint), startConnector, endConnector);
}
0
ManniAT
Top achievements
Rank 2
answered on 22 Feb 2017, 08:39 AM

Hi Shawn,

thank you for your answer. Your idea is exactly where I landed.

Unfortunately "CreatePath" is marked private - so there is no way to override GetRoutePoints using this call.
Also ShapeUtilities can't be replace.

Anyhow - I found a solution for my primary problem (the right connector must not be use as target).
Prior routing I give the Connector the Name "Auto" which prevents GetNearestConnectors to use it.

After the routing I name it back to what it was before.

Manfred

0
Martin Ivanov
Telerik team
answered on 23 Feb 2017, 02:22 PM
Hello guys,

Let me first thank to Shawn, because he posted some very helpful resources in this thread.

Manfred, I am glad to hear that you managed to find a solution for your case. Alternatively, as Shawn already suggested, to prevent the diagram router to search for the closest connector you can explicitly set the connector to which the connection will be attached. This can be done via the TargetConnectorPosition and SourceConnectorPosition properties of RadDiagramConnection. The properties are of type string and expect the Name of a connector. For example:
<telerik:RadDiagramConnection Source="{Binding ElementName=shape1}" Target="{Binding ElementName=shape2}" TargetConnectorPosition="Left"/>
"Left" is the Name of one of the default connectors.

Currently, the AStarRouter is not very flexible when it comes to customization so you can't override some of its methods. Instead, you could implement new router using the IRouter interface and use the AStarRouter code as a reference.

Can you also tell me what exactly you mean by extra Layouter? I am not sure what you mean, but if you clarify this we will consider updating our help documentation according to this.

In the rest of my reply I want to address the Manfred's feedback.

Manfred, we are more than happy to hear that you are using the Telerik products for so long now. And we are sorry to hear that you are not satisfied with the provided support service. If you have any particular feedback in regards to the support we will be very glad to share it with us.

About the delayed messages you mentioned in your previous replies, please keep in mind that the UI for WPF forum doesn't fall in the scope of our support service. This means that the forums are not bound to a specific time frame and you cannot expect to receive an answer from the support team. I can assure your that we are trying to help as much as we can to our community, but this doesn't necessarily guarantee an answer. To get a reply in the standard 24 hours time frame I would suggest you to open a new support ticket from telerik.com.

If you have further questions, do not hesitate to ask.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
ManniAT
Top achievements
Rank 2
answered on 27 Feb 2017, 04:40 PM

Hi Martin,

first of all with "the use of an extra layouter" I meant that (in the sample) they use mTreeLayout.Layout(Diagram, Settings) instead of Diagram.Layout(....)
This is by the way what I'm doing now.

About support and response time / response quality.

I know the forum is not a place for support tickets or so.
What I meant is "in earlier days" or "before the change to progress" forums had a much better quality.
The forums have been a place where solutions to problems could be found.
And (that was also mentioned extra) - a place where everyone (customer or even trial users) could find real help to (common) problems.

This was something special about telerik -having a problem the first was to search forums - after that the documentation.
And also special was that questions have been answered very fast and "precise" - most of the time with a solution - in the form of snippets or even sample projects.
And a support ticket helps (maybe) me - a qualified answered forum post helps all customers!

I don't say "...you do something wrong..." - nothing like this.

I just say - things changed.
And this is a matter of facts. From the time when I was a MVP here a telerik I have good statistics how fast question got answered (or at least replied) - and how many answers contained code (attachments) and a solution.

I guess you could check this via statistics in the forums.
I've also seen this when searching the forums for diagram solutions.
Posts with code / long answers / short response time are - "old".
Not all of them - but the newer the threads are the more often you find "manual links" - "on backlog" - "vote at PITS" - and the quantity of code / sample solutions goes downwards.

Also customers of mine (using telerik because I recommended it) are complaining about these changes.

When I met some of the telerik guys at the headquarter in Sofia I could feel their enthusiasm - for the products and also for the outstanding support - they have been proud about - and they had a reason for this!

Just check out your marketing material... "...great community...outstanding support..."

Do you really count "...after several days telling a customer to read the manual.." as outstanding?

A last word about a ticket ("...forums do not fall in the scope of our support service...").
I thought a support ticket is for solving a problem (fixing something broken)- I was looking for a solution - for help with your products - or "a hint to solve a problem using your products".

Anyhow - I got this running - last not least with the help of Shawn who pointed me to github.

Some word about your answer and the "code snippet" first.
I didn't mention that I use MVVM - but in my initial question I was telling "the user can drag a connection...".
So what does XAML help in this case?
Anyhow - I solved it - but doing some "dirty tricks" with the AStarRouter (renaming / hiding connectors prior routing).

Since you telerik code is not "open source" it is a bit hard to make an own router "using the AStartRouter code" as reference I guess.
But one interresting thing I noticed in your answer...
CURRENTLY the AStarRouter is not very flexible...

Does this mean it will change to be more flexible?
Or is one of the other routers "more flexible" when it comes to customization?

Manfred

0
Yana
Telerik team
answered on 02 Mar 2017, 11:49 AM
Hello Manfred,

Thank you for providing the extensive feedback, I appreciate it and will make sure to address the identified takeaways.

​I completely agree with you that issues posted and resolved in the forums are beneficial to other customers as well and we're trying to help as much as possible there. Forums are a community channel and this thread proves it - you received help from another customer of our tools, which is great.  Still,  if  you need a faster reply from the support team, it's better to submit a ticket.

Indeed, things are changing - our UI for WPF is already a mature product, now we have much more resources available. We're constantly working on improving our documentation and if you have a feedback on any concrete topic, we'll be glad to receive it - you can use the feedback form at the bottom of the topic.

In addition to our documentation, we provide SDK examples demonstrating the most common scenarios with our WPF controls. The ideas for this examples actually come from our customers - through the forums or through the private tickets. We often refer to the SDK repository instead of preparing custom solutions as these examples are extensively tested with each release.  Additionally, we're not aware of the complete requirements you have, that's why we could only advise on the possible approaches that you could use.

Regarding the support tickets - they can be used for any customer inquiries ( how-to questions, bug reports, etc), they do not have limitation of the type of the attachments, so you could attach a sample project there, also you could send us sensitive data as they're a private channel.  And lastly, they have a guaranteed response time ( 24h for licensed users, 72h for trial users), so if you need a quick reply, I'd recommend submitting a ticket instead of posting the question in the forum.

As to the concrete case - I agree that we could have handled it better. However, I'd like to assure you that Martin had no intent to neglect your inquiry - the reply he provided was an addition to Shawn's reply. We were and still are committed to helping our customers resolve their issues in a timely and precise manner and with this said, please take my apology for failing to provide the quality of service that's expected from us in this case.​


Finally, let me get to the RadDiagram specific questions:
  • About the diagram layouter, currently the Layout help article contains information about the available settings and how to apply them. Regardless this, we are going to review the article and consider updating it.
  • About the code snippet with the TargetConnectorPosition. property, it was used only to show the property. In an MVVM scenario you can bind it to a property from the connection view model via the RadDiagramConnection style. You can try this and let us know if it works for you. 

Regards,
Yana
Support Lead
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Diagram
Asked by
ManniAT
Top achievements
Rank 2
Answers by
ManniAT
Top achievements
Rank 2
Shawn
Top achievements
Rank 1
Martin Ivanov
Telerik team
Yana
Telerik team
Share this question
or