Ignore:
Timestamp:
2008-12-23T15:07:05+01:00 (17 years ago)
Author:
stoecker
Message:

removed usage of tab stops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r1090 r1169  
    2828
    2929/**
    30  * Align edges of a way so all angles are right angles. 
    31  * 
     30 * Align edges of a way so all angles are right angles.
     31 *
    3232 * 1. Find orientation of all edges
    3333 * 2. Compute main orientation, weighted by length of edge, normalized to angles between 0 and pi/2
     
    3838public final class OrthogonalizeAction extends JosmAction {
    3939
    40         public OrthogonalizeAction() {
    41         super(tr("Orthogonalize shape"), 
    42             "ortho", 
     40    public OrthogonalizeAction() {
     41        super(tr("Orthogonalize shape"),
     42            "ortho",
    4343            tr("Move nodes so all angles are 90 or 270deg"),
    44             Shortcut.registerShortcut("tools:orthogonalize", tr("Tool: {0}", tr("Orthogonalize")), 
    45             KeyEvent.VK_Q, 
     44            Shortcut.registerShortcut("tools:orthogonalize", tr("Tool: {0}", tr("Orthogonalize")),
     45            KeyEvent.VK_Q,
    4646            Shortcut.GROUP_EDIT), true);
    47         }
     47    }
    4848
    4949    public void actionPerformed(ActionEvent e) {
     
    6060                    JOptionPane.showMessageDialog(Main.parent, tr("Only two nodes allowed"));
    6161                    return;
    62                 } 
     62                }
    6363                dirnodes.add((Node) osm);
    6464                continue;
     
    6868                JOptionPane.showMessageDialog(Main.parent, tr("Selection must consist only of ways."));
    6969                return;
    70             } 
     70            }
    7171
    7272            // Check if every way is made of at least four segments and closed
     
    7878
    7979            // Check if every edge in the way is a definite edge of at least 45 degrees of direction change
    80             // Otherwise, two segments could be turned into same direction and intersection would fail. 
     80            // Otherwise, two segments could be turned into same direction and intersection would fail.
    8181            // Or changes of shape would be too serious.
    8282            for (int i1=0; i1 < way.nodes.size()-1; i1++) {
     
    116116        boolean use_dirnodes = false;
    117117
    118         if (dirnodes.size() == 2) { 
    119             // When selection contains two nodes, use the nodes to compute a direction 
     118        if (dirnodes.size() == 2) {
     119            // When selection contains two nodes, use the nodes to compute a direction
    120120            // to align all ways to
    121121            align_to_heading = normalize_angle(dirnodes.get(0).eastNorth.heading(dirnodes.get(1).eastNorth));
     
    124124
    125125        for (OsmPrimitive osm : sel) {
    126             if(!(osm instanceof Way)) 
     126            if(!(osm instanceof Way))
    127127                continue;
    128128
     
    164164
    165165                if (angle_diff_max > Math.PI/3) {
    166                     // rearrange headings: everything < 0 gets PI/2-rotated 
     166                    // rearrange headings: everything < 0 gets PI/2-rotated
    167167                    for (int i=0; i < sides; i++) {
    168                         if (headings[i] < 0) 
     168                        if (headings[i] < 0)
    169169                            headings[i] += Math.PI/2;
    170170                    }
     
    183183                    sum_weights += weights[i];
    184184                }
    185                 align_to_heading = normalize_angle(sum_weighted_headings/sum_weights); 
     185                align_to_heading = normalize_angle(sum_weighted_headings/sum_weights);
    186186            }
    187187
    188188
    189189            for (int i=0; i < sides; i++) {
    190                 // Compute handy indices of three nodes to be used in one loop iteration. 
    191                 // We use segments (i1,i2) and (i2,i3), align them and compute the new 
     190                // Compute handy indices of three nodes to be used in one loop iteration.
     191                // We use segments (i1,i2) and (i2,i3), align them and compute the new
    192192                // position of the i2-node as the intersection of the realigned (i1,i2), (i2,i3) segments
    193193                // Not the most efficient algorithm, but we don't handle millions of nodes...
     
    212212
    213213                // compute intersection of segments
    214                 double u=det(B.east() - A.east(), B.north() - A.north(), 
     214                double u=det(B.east() - A.east(), B.north() - A.north(),
    215215                        C.east() - D.east(), C.north() - D.north());
    216216
    217217                // Check for parallel segments and do nothing if they are
    218                 // In practice this will probably only happen when a way has 
     218                // In practice this will probably only happen when a way has
    219219                // been duplicated
    220220
     
    225225                // if the segment is scaled to length 1
    226226
    227                 double q = det(B.north() - C.north(), B.east() - C.east(), 
     227                double q = det(B.north() - C.north(), B.east() - C.east(),
    228228                        D.north() - C.north(), D.east() - C.east()) / u;
    229229                EastNorth intersection = new EastNorth(
     
    239239                    cmds.add(new MoveCommand(n, dx, dy));
    240240                }
    241             } 
     241            }
    242242        }
    243243
Note: See TracChangeset for help on using the changeset viewer.