Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to Get the diagram item's text ? (Read 5369 times)
BabyTL
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Apr 11th, 2014
How to Get the diagram item's text ?
Apr 11th, 2014 at 6:51am
Print Post  
All i know is that the diagram consisting of the "diagramNode"(Shape) ,and i want to get zhe shape text from the diagram.But How? :-[
eg:
     [color=#00ff00][b]ShapeNode diagramNode = diagram.Factory.CreateShapeNode(bounds, shape);
     diagramNode.Text = "abc";[/b][/color]
and [color=#ff00ff][b]how to get the text:"abc" from the diagram[/b][/color] using code?
  
Back to top
 
IP Logged
 
BabyTL
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Apr 11th, 2014
Re: How to Get the diagram item's text ?
Reply #1 - Apr 11th, 2014 at 6:51am
Print Post  
[quote author=30302A2B263E520 link=1397199072/0#0 date=1397199072]All i know is that the diagram consisting of the "diagramNode"(Shape) ,and i want to get zhe shape text from the diagram.But How? :-[
eg:
ShapeNode diagramNode = diagram.Factory.CreateShapeNode(bounds, shape);
diagramNode.Text = "abc";
and how to get the text:"abc" from the diagram using code?[/quote]
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to Get the diagram item's text ?
Reply #2 - Apr 11th, 2014 at 7:01am
Print Post  
There are different properties for text such as ShapeNode.Text and TableNode.Caption. You could either use type-casting, or access text values via the InplaceEditable interface:

Code
Select All
foreach (var item in diagram.Items)
{
	var textItem = (InplaceEditable)item;
	Debug.WriteLine(textItem.GetTextToEdit());
}

foreach (var item in diagram.Items)
{
	var shapeNode = item as ShapeNode;
	if (shapeNode != null)
		Debug.WriteLine(shapeNode.Text);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
BabyTL
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Apr 11th, 2014
Re: How to Get the diagram item's text ?
Reply #3 - Apr 11th, 2014 at 7:26am
Print Post  
[quote author=092E3523355A0 link=1397199072/2#2 date=1397199717]There are different properties for text such as ShapeNode.Text and TableNode.Caption. You could either use type-casting, or access text values via the InplaceEditable interface:

[code]
foreach (var item in diagram.Items)
{
     var textItem = (InplaceEditable)item;
     Debug.WriteLine(textItem.GetTextToEdit());
}

foreach (var item in diagram.Items)
{
     var shapeNode = item as ShapeNode;
     if (shapeNode != null)
           Debug.WriteLine(shapeNode.Text);
}[/code]

I hope that helps,
Stoyan[/quote]


TY ! I got some diagramNode eg-nodemap:x,y,z.. and i use the diagramlink to link them. I want to kown the every link's start node(eg:x) and the end node(eg:y).What way? Also how ~ let those links don't cross the nodes ?eg the file"2014.png" :)
  

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to Get the diagram item's text ?
Reply #4 - Apr 11th, 2014 at 7:37am
Print Post  
You can find which nodes are connected by a link via the link's Origin and Destination properties. Try calling the RouteAllLinks method to re-route links away from nodes.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
BabyTL
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Apr 11th, 2014
Re: How to Get the diagram item's text ?
Reply #5 - Apr 11th, 2014 at 8:00am
Print Post  
TY Stoyan ! I Get It !  But the RouteAllLinks method is not useful ~~ Sad
Even so, I sincerely thank you for your help!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to Get the diagram item's text ?
Reply #6 - Apr 11th, 2014 at 8:27am
Print Post  
RouteAllLinks should work as long as you don't have some large background node in the diagram. If there is one, set its Obstacle property to false.

Also make sure you call the method after applying any layout algorithm or placing the nodes yourself from code. E.g. you might get links passing over nodes if you call TreeLayout.Arrange on a diagram that's not strictly a tree (it ignores links that are not part of the diagram's spanning tree):

Code
Select All
treeLayout.Arrange(diag);
diag.RouteAllLinks(); 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
BabyTL
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Apr 11th, 2014
Re: How to Get the diagram item's text ?
Reply #7 - Apr 12th, 2014 at 4:55am
Print Post  
TY Stoyan ! Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint