This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi We have an object hierarchy whereby a child can belong to muliple parents (potentially within different levels of the hierarchy). HierarchicalLayoutAlgorithm currently does not take into account the positioning of parent nodes that share the same child i.e. the two parent nodes can be positioned at opposite boundaries of the diagram which leads to a lot of link overlapping (and a messy diagram). Is it possible to leverage HierarchicalLayoutAlgoritm and extend it to support this scenario? I know we can inherit from LayoutAlgorithmBase and develop our own layout algorithm but we would prefer not to. Every time a node is positioned, the child nodes would need to be checked to see if they have muliple parents and if so then position the parents close together. Thanks Chris |
|
|
Hello Unfortunatly there are no hooks for extending the HierarchicalLayoutAlgorithm at the moment. We can look into improving the algorithm to support this functionality. Do you have a timeframe or priority of when you need this? Cheers |
|
|
Hi Jason It is a fairly high priority for our application. We require a solution by the end of this year. Thanks Chris |
|
|
Hello This time-frame is achievable. We'll let you know how it goes. Regards |
|
|
I also need this functionality and I am happy to beta-test solutions you are developing. Lacking this, is there a way to implement ILayoutAlgorithm such that I may write my own implementation for "Run"? If so, an example of processing the IDiagramModel would be most appreciated. |
|
|
Hello This functionality is currently scheduled to be done in a few more weeks. I'll reply to this forum thread once the first drop of it becomes available. Yes you can implement ILayoutAlgorithm to create your own layout algorithms if you want to while you're waiting. However there aren't any examples of this yet. The best way to do this would be to extend the LayoutAlgorithmBase class. The Run method gets the IDiagramModel which you can use to look at all the nodes and connections in the diagram. Nodes have collections of connection points on them, and connection points are the source and destinations of connections. Let me know if you need advice with understanding the structure of a diagram. You can set the Bounds property of a node to set its position on the diagram surface.
|
|
|
Hello Chris and ed The next nightly build will include a new class called TreeLayoutAlgorithm. This functions similar to the existing HierarchicalLayoutAlgorithm but is a bit smarter and produces much better results. For test diagrams that I have used containing children with multiple parents, the TreeLayoutAlgorithm has placed the parents closer together and arranged the nodes in a way that makes more sense. The next nightly build will be available around 1200 GMT and can be downloaded from here: https://www.mindscapehq.com/products/wpfdiagrams/nightly-builds Try it out and let us know how it goes. -Jason Fauchelle |
|
|
Happy to now be posting as a customer rather than an evaluator. TreeLayoutAlgorithm is a measurable improvement handling connected nodes; much thanks. Let's discuss disconnected nodes. Consider the use case where only a minority of the nodes have connections. Perhaps the user's task is to connect the nodes. Connected nodes coalesce nicely into manageable clusters. Disconnected nodes, however, are laid out horizontally, widening the diagram surface without bound. Can a maximum width be specified on the DiagramSurface to force disconnected nodes to "wrap" to another vertical position? Could disconnected nodes be placed at a different vertical position than connected nodes? |
|
|
Hello Based on your idea for setting the maximum width of the DiagramSurface, I have included a MaxDisconnectedAreaWidth property on the TreeLayoutAlgorithm. Disconnected nodes will still be positioned to the right of the connected node clusters, but now they wrap based on the MaxDisconnectedAreaWidth. The resulting behaviour is similar to that used in the popular SugiYama layout algorithm. The default max width is Double.MaxValue so as not to change the current behaviour. Set this property to something like 500 or 1000 and see how it looks in your diagram. This property and improved behaviour can be downloaded through the next nightly builds (available from around 1200 GMT). Try it out and let us know how it goes. -Jason |
|
|
The property works just as you explained, making disconnected nodes easier to manage. Much thanks! |
|
|
MaxDisconnectedAreaWidth works nicely for nodes which have no connections. But what about connected nodes? Assume there exist a large number of nodes in one particular diagram layer. How can they be wrapped? |
|
|
Hello ed I'm not sure if you would want to wrap connected nodes. Different branches of the tree could be merged together which could get very messy very fast. For a diagram that has many nodes, you'd either have each level in the tree on its own row like it currently does, or split the diagram into smaller diagrams that can be displayed better, or include logic and interaction for the user to expand or collapse different parts of the tree. I think that last idea would make for the best UI when dealing with many nodes. Jason Fauchelle |
|
|
Assume the diagram is being used to show an organizational chart. Some departments may have mid-level managers who each manage 3-5 office staffers. Other departments may have one manager in charge of 40 factory workers. 3-5 child nodes work nicely, but 40 child nodes extends the width of the diagram far beyond screen boundaries. We could split the 40 nodes representing factory workers into alphabetical ranges, but it costs the end user an unwanted click and creates an unwanted layer of abstraction in our data model. Expand/collapse functionality is desirable, but would not help the case where a single node with many children (at the same hierarchical level) must be displayed. I would like to discuss expand/collapse in the future. A perfect solution would attempt to fit all nodes within the client area of the diagram surface, producing scroll bars only when the viewable region is full of nodes. My desire to wrap connected nodes seems a reasonable compromise. My only other recourse would be to implement my own algorithm, which would be wasteful considering how close the Hierarchical/TreeLayout algorithms are to fulfilling my needs. I am happy to explore and test other potential solutions. |
|
|
Hello ed This functionality is on our backlog, but I can't predict when it will become available. For now, I have attached the full source code of the TreeLayoutAlgorithm which you can modify and add the desired behavior. Jason Fauchelle |
|