Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DiagramLink and LaneGrid (Read 4518 times)
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
DiagramLink and LaneGrid
Jul 26th, 2011 at 11:32am
Print Post  
Hello,

1. I have a diagram with a lanegrid. When i use "ctrl"-key and left mouseklick on left/right border of lanegridheader, the diagram inserts another header. How can i simply avoid this?

2. I use "DiagramLinks" between two shape nodes.
The head is an triangle (default).
Code
Select All
this.HeadShapeSize = 20;
this.StrokeThickness = 5;  


The triangle will not be displayed nicely, because the stroke of the link is overlying the head.

Thx in advance,
Amosius
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: DiagramLink and LaneGrid
Reply #1 - Jul 26th, 2011 at 12:10pm
Print Post  
1. There is currently no easy way to do this. It can be disabled through the AllowResizeHeaders property but this way you won't be able to resize the lane headers either. Another workaround would be to handle the HeaderAdded event and immediately delete the added header from the corresponding collection. Here is a sample HeaderAdded handler (which will only work if the newly created header is top level):

Code
Select All
if (e.Header.IsColumnHeader)
	diagram.LaneGrid.ColumnHeaders.Remove(e.Header);
else
	diagram.LaneGrid.RowHeaders.Remove(e.Header); 


2. That's how it works - the link body is drawn first, then all headers are rendered on top of it. If you are using simple (1 segment, polyline) links, you can probably work around this by custom-drawing the link and instead of a line paint the body as a rectangular polygon with sharp sides that match the slope of the arrow head.

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: DiagramLink and LaneGrid
Reply #2 - Jul 26th, 2011 at 1:13pm
Print Post  
Check this sample:

https://mindfusion.eu/_samples/_sample_LinkHeads.zip

It demonstrates how to custom draw 1-segment polyline links in order to prevent the overlapping of head and body. Keep in mind that the sample has some hard-coded numbers that will only work with the default triangular arrow heads.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: DiagramLink and LaneGrid
Reply #3 - Jul 26th, 2011 at 2:34pm
Print Post  
It's an event of the lane grid object, not the Diagram. You can also check the above sample, this event is illustrated there as well.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: DiagramLink and LaneGrid
Reply #4 - Jul 26th, 2011 at 3:21pm
Print Post  
Ah, ok removing the header helped me.

I will consider your solution for drawing diagram links. In your example it was only for diagram links with 2 control points. I suppose that it will be very complicated for my project.

Anyway, thx again for the removing header which is a "solid workaround" Smiley
  
Back to top
 
IP Logged
 
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: DiagramLink and LaneGrid
Reply #5 - Jul 28th, 2011 at 10:16am
Print Post  
One more question to LaneGrids.

I have an vertical LaneGrid and I would like to use SwimlaneLayout to arrange my nodes.

Code
Select All
//Markup 1
...
LayoutTraits.Add(MindFusion.Layout.SwimlaneLayoutTraits.Lane, 0);

//Markup 2
...
LayoutTraits.Add(MindFusion.Layout.SwimlaneLayoutTraits.Lane, 1);

//Markup 3
...
LayoutTraits.Add(MindFusion.Layout.SwimlaneLayoutTraits.Lane, 2); 



I have a LaneGrid with one Columnheader and several subheaders. So my subheaders would be the swimlanes.

Now i would like to arrange these nodes:
Code
Select All
            MindFusion.Diagramming.Wpf.Layout.SwimlaneLayout layout = new MindFusion.Diagramming.Wpf.Layout.SwimlaneLayout();
            layout.Orientation = MindFusion.Diagramming.Wpf.Layout.Orientation.Vertical;
            layout.NodeDistance = 40;
            layout.LaneDistance = 30;
            layout.Arrange(diagram); 



This does not work. I think my LayoutTraits are incorrect, because of my subheaders. I tried to give as value of LayoutTraits the corresponding subheader object, but that's also not working.

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


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: DiagramLink and LaneGrid
Reply #6 - Jul 28th, 2011 at 12:44pm
Print Post  
The Swimlane layout indeed operates only with top-level headers. You may be able to adapt it for subheaders by implementing a custom ISwimlaneGrid, but I cannot guarantee it will work. Here is an ISwimlaneGrid implementation, which works on the first column's subheaders instead of the top-level column headers:

Code
Select All
private class SLG : ISwimlaneGrid
{
      public SLG(MindFusion.Diagramming.Wpf.Lanes.Grid g)
      {
            this.g  = g;
      }

      private MindFusion.Diagramming.Wpf.Lanes.Grid g;

      public int GetColumnCount()
      {
            return g.ColumnHeaders[0].SubHeaders.Count;
      }

      public double GetColumnWidth(int index)
      {
            return g.ColumnHeaders[0].SubHeaders[index].Width;
      }

      public int GetRowCount()
      {
            return g.RowHeaders.Count;
      }

      public double GetRowHeight(int index)
      {
            return g.RowHeaders[index].Height;
      }

      public void SetColumnCount(int value)
      {
            g.ColumnHeaders[0].SubHeaders.Clear();
            for (int i = 0; i < value; i++)
                  g.ColumnHeaders[0].SubHeaders.Add(new MindFusion.Diagramming.Wpf.Lanes.Header());
      }

      public void SetColumnWidth(int index, double value)
      {
            g.ColumnHeaders[0].SubHeaders[index].Width = value;
      }

      public void SetLeftMargin(double value)
      {
            g.LeftMargin = value;
      }

      public void SetRowCount(int value)
      {
            g.RowCount = value;
      }

      public void SetRowHeight(int index, double value)
      {
            g.RowHeaders[index].Height = value;
      }

      public void SetTopMargin(double value)
      {
            g.TopMargin = value;
      }
} 


You need to assign an instance of this class to the SwimlaneGrid property of the layout.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Amosius
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 75
Joined: Sep 2nd, 2010
Re: DiagramLink and LaneGrid
Reply #7 - Jul 28th, 2011 at 2:56pm
Print Post  
Thx for your help. I can now experiment with that class.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint