0

is there any easy method to define the placement speed of the nodes when using the SpringLayout? I am using the JUng library version 2.1.1.

I even created an own SpringLayout class to have the possibility to change any parameter, but changing the "movement speed" of the class "SpringVertexData" didn't change anything. Moreover, I tried to change the moveNodes() function, but again without any success. Or is there any easier way to change the movement/placement speed of the nodes, when using the SpringLayout?

Mohan Radhakrishnan
  • 3,002
  • 5
  • 28
  • 42
Matzka
  • 125
  • 1
  • 13

1 Answers1

1

Inside SpringLayout::moveNodes() there is code that limits how far the nodes can move in any single iteration:

// keeps nodes from moving any faster than 5 per time unit
xyd.setLocation(xyd.getX() + Math.max(-5, Math.min(5, vd.dx)),
                xyd.getY() + Math.max(-5, Math.min(5, vd.dy)));

This could (and probably should) be configured to be a configurable parameter rather than the magic constant '5', but in any event you can experiment with changing that value.

If you want something else, e.g., faster iterations rather than iterations that have larger effects, then please restate your question more clearly.

Joshua O'Madadhain
  • 2,704
  • 1
  • 14
  • 18