Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Change position after SpringLayout arrange (Read 2657 times)
Hamdy Ghanem
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Change position after SpringLayout arrange
Aug 16th, 2011 at 12:09pm
Print Post  
I have 3D diagram
I arrange the diagram by SpringLayout
but I need to extend the links depend in some value from database like "distance"
so I want to change the position of nodes after the arrange
but it is not changing

I tried to set the IgnoreLayout property to true after arrange but it doesn't work ,plz help
  
Back to top
 
IP Logged
 
Hamdy Ghanem
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Re: Change position after SpringLayout arrange
Reply #1 - Aug 16th, 2011 at 12:19pm
Print Post  
another question may be will fix the issue

in my 3D diagram i want to assign the length of the link, after search I find that I have to assign the position of the origin and destination node
so how I assign the position of the node in the 3D diagram
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Change position after SpringLayout arrange
Reply #2 - Aug 16th, 2011 at 12:41pm
Print Post  
Assigning custom 3D positions is shown in the MoleculeViewer sample project. You can do that by associating a Point3D with LayoutTraits[View3D.Position]:

node.LayoutTraits[View3D.Position] = new Point3D(x, y, z);

If the diagram is already shown in the 3D view, also call the ResetProjection method.

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


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Re: Change position after SpringLayout arrange
Reply #3 - Aug 16th, 2011 at 1:11pm
Print Post  
Oh yes , this is working now
but how can I get the new values of X,Y and Z to make the link longer or shorter

Is there any formula in the diagram to do this
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Change position after SpringLayout arrange
Reply #4 - Aug 16th, 2011 at 5:12pm
Print Post  
This moves p2 at the specified distance from p1 along the line that passes through them:

Code
Select All
float dx = p2.X - p1.X;
float dy = p2.Y - p1.Y;
float dz = p2.Z - p1.Z;
float len = (float)Math.Sqrt(dx * dx + dy * dy + dz * dz);
p2.X = distance * dx / len;
p2.Y = distance * dy / len;
p2.Z = distance * dz / len;
 



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


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
Re: Change position after SpringLayout arrange
Reply #5 - Aug 17th, 2011 at 8:00am
Print Post  
Yes it works
Thx
u always helpful man
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint