Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Some queries (Read 10653 times)
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Some queries
Mar 3rd, 2009 at 1:51pm
Print Post  
Hi,

1) I have a xml string which gives me position of the nodes on the diagram and links between them. To add a node to the diagram i will do something like:

ShapeNode node = new ShapeNode(diagram);
// missing code to give node positoin and size information
diagram.Nodes.Add(node);

what should be the missing code? or any other alternative.

2) I get the guids of the nodes that are connected in the xml how should i map it to create links between this two nodes ?

3) I have some properties common to all the nodes and i do not want to repeat the initialization for each node so where should i place the common code for ex. Node.EnableHandles should be AdjustmentHandles.Move for all the diagram nodes.

Thanks,
Anurodh
« Last Edit: Mar 3rd, 2009 at 2:52pm by anurodhora »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #1 - Mar 3rd, 2009 at 2:51pm
Print Post  
Hi,

1) node.Bounds = new Rect(...);
2) Use a Dictionary<guid,DiagramNode> and map the nodes to their guids while creating nodes on the first pass. Create the link on a second pass - then you will already have a node created for each guid.
3) Most of the nodes properties have corresponding properties in the Diagram class. You could call some initialization method taking a node as argument to init properties that do not have corresponding default in Diagram.

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


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #2 - Mar 3rd, 2009 at 2:57pm
Print Post  
Thanks for the reply.

One more thing:

1) we do not want our links to cross the shape node (i.e. the links should never overlap with the node region they should never cross node boundaries), how to achieve this. we tried setting our links SnapToNodeBorder and SnapsToDevicePixels to true but then also the links are crossing node boundaries.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #3 - Mar 3rd, 2009 at 3:01pm
Print Post  
Call the Route() method after creating a link. It works best for cascading links (link.Style = Cascading).

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #4 - Mar 4th, 2009 at 9:20am
Print Post  
Thanx for the reply, but the Route() method creates links which can bend, i want straight links.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #5 - Mar 4th, 2009 at 10:24am
Print Post  
Do you mean the links start from the interior of the node, and you just need to align them to the border? This should be automatically done by the CreateDiagramLik method...

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


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #6 - Mar 4th, 2009 at 11:47am
Print Post  
1) Yes agree, but the thing is when two nodes are connected by link in the way that node1 is above node2 and the link starts from node1 bottom boundary to node2 upper boundary. Now select and move node2 to any location above node1 in y plane and note that the link still starts from node1 bottom boundary and now as the node2 is above node1 it is going through the node1 region to connect to node2.

How to set link start/end position so that links never get into node region even though the nodes are moved they should adjust to the boundaries automatically

2) Could you tell me how to achieve following:

We have a single node in the diagram sheet, the single node stands for a group of nodes.
The scenario is when you click on this single node the diagram should now display the nodes (and their links) inside the group.

How to achieve above scenario.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #7 - Mar 4th, 2009 at 12:06pm
Print Post  
You could try using foldable ContainerNodes for this. It's easy to implement it with ShapeNodes as well: attach the child nodes to the single node, set them Visible = false, and show them from the NodeClicked event when raised for the single node.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #8 - Mar 4th, 2009 at 12:31pm
Print Post  
Thanks i will try that.

Please suggest for the first one also.

one more query
1) I have a button to on the grid lines and on the click of which i am showing grid lines. However i also want that now the diagram nodes should be placed in their most neighboring grid cell. To achieve this i did something like following:
               diagram.ShowGrid = true;
               diagram.GridStyle = GridStyle.Lines;
               diagram.GridOffsetX = 0;
               diagram.GridOffsetY = 0;
               diagram.GridSizeX = 50;
               diagram.GridSizeY = 50;
               diagram.AlignToGrid = true;
However, the nodes are not getting aligned to the grid cells. How to achieve this?

Thanks once again,
Anurodh
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #9 - Mar 4th, 2009 at 1:04pm
Print Post  
Use the AlignPointToGrid method to find a grid point nearest to the argument point, and then call DiagramNode.Move to place the node at the grid location.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #10 - Mar 4th, 2009 at 1:54pm
Print Post  
Thanks.

Please also suggest about this:

when two nodes are connected by link in the way that node1 is above node2 and the link starts from node1 bottom boundary to node2 upper boundary. Now select and move node2 to any location above node1 in y plane and note that the link still starts from node1 bottom boundary and now as the node2 is above node1 it is going through the node1 region to connect to node2.

How to set link start/end position so that links never get into node region even though the nodes are moved they should adjust to the boundaries automatically

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #11 - Mar 4th, 2009 at 2:05pm
Print Post  
Set link.Dynamic = true.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #12 - Mar 5th, 2009 at 8:24am
Print Post  
Thanks. Resolved now.

some more queries:
1) Say we do not want link creation until user select the type of link present in a toolbar. So when user has not chosen any link creation button then he can only select and move the nodes in the diagram.

What we want here is when the node is selected the node movement cursor (the four arrow one) which currently appears only at the center of the node should come for whole node region.

2)  A pan button in the toolbar clicking that will take the diagram in panning mode changing the cursor to Hand cursor and allow user to pan with the use of mouse movement (without the use of alt key) 

3) I want to have an image on my decision shaped node for which i have written following code:

ShapeNode node = new ShapeNode(diagram);
           node.Bounds = new Rect(new Point(100, 100), new Size(50, 50));
           node.Shape = Shapes.Decision;
           Uri uri = new Uri(@"..\..\Test.png", UriKind.RelativeOrAbsolute);
           node.Image = new BitmapImage(uri);
           node.ImageAlign = ImageAlign.Center;

However, i want to allow my image to extend beyond node boundaries (the decision shape) but currently it is getting clipped of with the node boundaries. How to prevent it and allow image to extend.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some queries
Reply #13 - Mar 6th, 2009 at 6:42am
Print Post  
1) You could set node.HandlesStyle = EasyMove and call e.CancelDrag from the LinkCreating and LinkModifying event handlers. This could be done also by setting a custom Behavior object, that never starts interaction for a link in its StartDraw method.
  
Back to top
 
IP Logged
 
anurodhora
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 103
Joined: Jan 19th, 2009
Re: Some queries
Reply #14 - Mar 6th, 2009 at 6:52am
Print Post  
Hi,
Thanks for the reply.
But setting node.HandlesStyle = EasyMove is causing a circle to appear at center of the node and there the movement cursor does not appear. What to do in this case.

Secondly, can you tell me how to achieve this by custom behavior object.

Please also suggest about 2) and 3) above.

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