Ignore:
Timestamp:
2009-07-19T19:04:49+02:00 (15 years ago)
Author:
Gubaer
Message:

removed dependencies to Main.ds, removed Main.ds
removed AddVisitor, NameVisitor, DeleteVisitor - unnecessary double dispatching for these simple cases

File:
1 edited

Legend:

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

    r1640 r1814  
    3838    public OrthogonalizeAction() {
    3939        super(tr("Orthogonalize Shape"),
    40             "ortho",
    41             tr("Move nodes so all angles are 90 or 270 degree"),
    42             Shortcut.registerShortcut("tools:orthogonalize", tr("Tool: {0}", tr("Orthogonalize Shape")),
    43             KeyEvent.VK_Q,
    44             Shortcut.GROUP_EDIT), true);
     40                "ortho",
     41                tr("Move nodes so all angles are 90 or 270 degree"),
     42                Shortcut.registerShortcut("tools:orthogonalize", tr("Tool: {0}", tr("Orthogonalize Shape")),
     43                        KeyEvent.VK_Q,
     44                        Shortcut.GROUP_EDIT), true);
    4545    }
    4646
    4747    public void actionPerformed(ActionEvent e) {
    4848
    49         Collection<OsmPrimitive> sel = Main.ds.getSelected();
     49        Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
    5050
    5151        ArrayList<Node> dirnodes = new ArrayList<Node>();
     
    8484                double angle2 = Math.abs(way.nodes.get(i2).getEastNorth().heading(way.nodes.get(i3).getEastNorth()));
    8585                double delta = Math.abs(angle2 - angle1);
    86                 while(delta > Math.PI) delta -= Math.PI;
     86                while(delta > Math.PI) {
     87                    delta -= Math.PI;
     88                }
    8789                if(delta < Math.PI/4) {
    8890                    JOptionPane.showMessageDialog(Main.parent, tr("Please select ways with almost right angles to orthogonalize."));
     
    9698                    "to undesirable results when doing rectangular alignments.<br>" +
    9799                    "Change your projection to get rid of this warning.<br>" +
    98                     "Do you want to continue?");
    99 
    100             if (!DontShowAgainInfo.show("align_rectangular_4326", msg, false)) {
     100            "Do you want to continue?");
     101
     102            if (!DontShowAgainInfo.show("align_rectangular_4326", msg, false))
    101103                return;
    102             }
    103104        }
    104105        // Check, if selection held neither none nor two nodes
     
    122123
    123124        for (OsmPrimitive osm : sel) {
    124             if(!(osm instanceof Way))
     125            if(!(osm instanceof Way)) {
    125126                continue;
     127            }
    126128
    127129            Way way = (Way)osm;
     
    158160                        diff = heading_diff(headings[i], headings[i - 1]);
    159161                    }
    160                     if (diff > angle_diff_max) angle_diff_max = diff;
     162                    if (diff > angle_diff_max) {
     163                        angle_diff_max = diff;
     164                    }
    161165                }
    162166
     
    164168                    // rearrange headings: everything < 0 gets PI/2-rotated
    165169                    for (int i=0; i < sides; i++) {
    166                         if (headings[i] < 0)
     170                        if (headings[i] < 0) {
    167171                            headings[i] += Math.PI/2;
     172                        }
    168173                    }
    169174                }
     
    217222                // been duplicated
    218223
    219                 if (u == 0) continue;
     224                if (u == 0) {
     225                    continue;
     226                }
    220227
    221228                // q is a number between 0 and 1
     
    257264        double llimit = -Math.PI/4;
    258265        double ulimit = Math.PI/4;
    259         while (h - align_to > ulimit) h -= Math.PI/2;
    260         while (h - align_to < llimit) h += Math.PI/2;
     266        while (h - align_to > ulimit) {
     267            h -= Math.PI/2;
     268        }
     269        while (h - align_to < llimit) {
     270            h += Math.PI/2;
     271        }
    261272
    262273        return h;
Note: See TracChangeset for help on using the changeset viewer.