Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Query to use Diagramming in a specific way (Read 3472 times)
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Query to use Diagramming in a specific way
May 4th, 2012 at 1:30pm
Print Post  
Hi,

I am using MindFusion.Diagramming.Wpf version 2.5.2.32851

I have following requirement. Please let know whether it can be achieved.
Please refer to attachments for more pictographic view .

     1. When Node A is double clicked, some new set of node will appear in the diagram. Need to preserve all other existing node
     2. REQ 1: Node A to become invisible  and the new set of nodes to be visible within some boundary  where links can be placed across boundaries (ref Img 2)
     3. REQ 2: Zooming can be applied to that specific boundary area only. (ref Img 2)
     4. REQ 3: A title bar to appear with the boundary and also we can minimize the boundary and the original node should appear again (as in Img1)
     
We are already using the expander node being provided with Diagramming nodes for some other purpose.

Please let know how can above be achieved.
A sample will be very helpful if possible.


Thanks,

Bala
  

Img1.png (Attachment deleted)
Img2.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query to use Diagramming in a specific way
Reply #1 - May 8th, 2012 at 5:55am
Print Post  
The closest you can get to this is to use ContainerNode with some event handling:

Quote:
1. When Node A is double clicked, some new set of node will appear in the diagram. Need to preserve all other existing node


Toggle the ContainerNode.Folded event from the NodeDoubleClicked event handler.

Quote:
2. REQ 1: Node A to become invisible  and the new set of nodes to be visible within some boundary  where links can be placed across boundaries (ref Img 2)


Set the container's Brush to Transparent to leave only the frame lines visible.

Quote:
3. REQ 2: Zooming can be applied to that specific boundary area only. (ref Img 2)


This is not supported out of the box. You might try copying the container's children to a new Diagram and show it over the container when the user wants to zoom in - then you can use the diagram's ZoomFactor to zoom.

Quote:
4. REQ 3: A title bar to appear with the boundary and also we can minimize the boundary and the original node should appear again (as in Img1)


ContainerNodes show a title bar by default.

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


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Query to use Diagramming in a specific way
Reply #2 - May 9th, 2012 at 11:05am
Print Post  
Hi Stoyo,

Thanks for your inputs.
Couple of more queries regarding the suggested thing.

     1. During startup, if I add some nodes to the container node and then set the Folded=False, the container node do not appear Folded.
      [Need all container nodes folded initially]

     2. On node double click when Folded property is toggled then it do not raise ContainerFolded or ContainerUnfolded
      Do we need to call them explicitly?

     3. How can the shape of Container Node be templated in Folded State.
     4. Can we zoom nodes in a particular rectangle area only?


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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query to use Diagramming in a specific way
Reply #3 - May 9th, 2012 at 6:12pm
Print Post  
Hi,

Quote:
1. During startup, if I add some nodes to the container node and then set the Folded=False, the container node do not appear Folded.


Shouldn't you set Folded=true to make it folded?

Quote:
2. On node double click when Folded property is toggled then it do not raise ContainerFolded or ContainerUnfolded Do we need to call them explicitly?


Yes, these events are raised only if the user folds/unfolds interactively. You'll have to call some method both from the event handlers and after folding programmatically in order to process both cases.

Quote:
3. How can the shape of Container Node be templated in Folded State.


You'll have to override ContainerNode.Draw to change the container's shape.

Quote:
4. Can we zoom nodes in a particular rectangle area only?


You can't zoom only a part of the diagram,. Perhaps you could show an Overview control over the part you need zoomed, and then set ScaleFactor larger than 100 to zoom in and call Overview.ScrollTo to show the diagram region you need.

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


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Query to use Diagramming in a specific way
Reply #4 - May 22nd, 2012 at 1:51pm
Print Post  
Hi Stoyo,

I understand that zooming in the way we want wouldn't be possible and we will have to think of alternate approach.

Can we achieve following functionality:

1. Lets say we have some nodes which are not child of containernode and located outside the containernode (as shown in attached image). When user resizes the container node (say to add more child nodes) the nodes which are outside container should relatively position themselves accordingly and should not overlap or go behind containernode.

2. Nodes which are not child of containernode should not be allowed to drag within the boundary of containernode

3. Containernode should have restriction on size in such a way that user will not be able to shrink the containernode to a size where its child nodes are not contained whitin the containerndoe boundary.

Your help in this regard will be higly appreciated.

Thanks,
Bala
  

Img1_001.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query to use Diagramming in a specific way
Reply #5 - May 23rd, 2012 at 1:51pm
Print Post  
1. You could call this method from ChildAdded or NodeModified events raised for containers:

Code
Select All
void ContainerResized(ContainerNode ctr)
{
	foreach (DiagramNode node in diagram.Nodes)
	{
		if (node == ctr)
			continue;
		if (ctr.ContainsRecursively(node))
			continue;
		if (!ctr.Bounds.IntersectsWith(node.Bounds))
			continue;

		// ctr and node intersect - move node aside
		if (node.GetCenter().X > ctr.GetCenter().X)
			node.Move(ctr.Bounds.Right + 50, node.Bounds.Y);
		// todo: handle cases for node to the left/top/bottom
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query to use Diagramming in a specific way
Reply #6 - May 23rd, 2012 at 2:00pm
Print Post  
2. Cancel the drag operation from NodeModifying handler:

Code
Select All
private void OnNodeModifying(object sender, NodeValidationEventArgs e)
{
	var nodes = diagram.GetNodesAt(e.MousePosition);
	foreach (DiagramNode node in nodes)
	{
		var ctr = node as ContainerNode;
		if (ctr != null && !ctr.ContainsRecursively(e.Node))
			e.Cancel = true;
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query to use Diagramming in a specific way
Reply #7 - May 23rd, 2012 at 2:02pm
Print Post  
3. You could find the union of the bounding rectangles of all containers' child nodes and assign its width / height to the container's Constraints.MinWidth/Height properties.

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


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Re: Query to use Diagramming in a specific way
Reply #8 - May 29th, 2012 at 7:04am
Print Post  
Thanks Stoyan! Your response was helpful.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint