Source code: com/eireneh/bible/control/map/FrictionRule.java
1
2 package com.eireneh.bible.control.map;
3
4 /**
5 * FrictionRule simply tries to make the nodes stay where they are.
6 *
7 * <table border='1' cellPadding='3' cellSpacing='0' width="100%">
8 * <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
9 * Distribution Licence:<br />
10 * Project B is free software; you can redistribute it
11 * and/or modify it under the terms of the GNU General Public License,
12 * version 2 as published by the Free Software Foundation.<br />
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.<br />
17 * The License is available on the internet
18 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
19 * <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 * MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
21 * The copyright to this program is held by it's authors.
22 * </font></td></tr></table>
23 * @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
24 * @see docs.Licence
25 * @author Joe Walker
26 * @version D0.I0.T0
27 */
28 public class FrictionRule extends AbstractRule
29 {
30 /**
31 * Specify where it would like a node to be positioned in space.
32 * Rules return an array of positions where the average of them
33 * specifies the real desired position. So to specify a single place
34 * simply return an array of one position. The positions are added
35 * to the results from all Rules so to specify a single position
36 * more strongly, return an array conataining that position many
37 * times.
38 * @param map The Map to select a node from
39 * @param ord The ordinal number (1 - 31104) of the verse
40 * @return An array of desired positions.
41 */
42 public Position[] getDesiredPosition(Map map, int ord)
43 {
44 if (scale == 0)
45 return new Position[] { };
46
47 float[] arr = map.getPosition(ord);
48 return scale(new Position(arr));
49 }
50 }